checkDock::checkDock( QgisInterface* qIface, QWidget* parent ) : QDockWidget( parent ), Ui::checkDock() { mTest = new topolTest( qIface ); setupUi( this ); // hide the fix-related stuff, needs more work qgsInterface = qIface; mFixButton->hide(); mFixBox->hide(); mErrorListModel = new DockModel( mErrorList, parent ); mErrorTableView->setModel( mErrorListModel ); mErrorTableView->setSelectionBehavior( QAbstractItemView::SelectRows ); mErrorTableView->verticalHeader()->setDefaultSectionSize( 20 ); mLayerRegistry = QgsMapLayerRegistry::instance(); mConfigureDialog = new rulesDialog( mLayerRegistry->mapLayers().keys(), mTest->testMap(), qIface, parent ); mTestTable = mConfigureDialog->testTable(); mValidateExtentButton->setIcon( QIcon( ":/topology/validateExtent.png" ) ); mValidateAllButton->setIcon( QIcon( ":/topology/validateAll.png" ) ); mConfigureButton->setIcon( QIcon( ":/topology/configureRules.png" ) ); // mQgisApp = QgisApp::instance(); QgsMapCanvas* canvas = qIface->mapCanvas();// mQgisApp->mapCanvas(); mRBFeature1 = new QgsRubberBand( canvas ); mRBFeature2 = new QgsRubberBand( canvas ); mRBConflict = new QgsRubberBand( canvas ); mRBFeature1->setColor( "blue" ); mRBFeature2->setColor( "green" ); mRBConflict->setColor( "red" ); mRBFeature1->setWidth( 5 ); mRBFeature2->setWidth( 5 ); mRBConflict->setWidth( 5 ); mVMConflict = 0; mVMFeature1 = 0; mVMFeature2 = 0; connect( mConfigureButton, SIGNAL( clicked() ), this, SLOT( configure() ) ); connect( mValidateAllButton, SIGNAL( clicked() ), this, SLOT( validateAll() ) ); //connect( mValidateSelectedButton, SIGNAL( clicked() ), this, SLOT( validateSelected() ) ); connect( mValidateExtentButton, SIGNAL( clicked() ), this, SLOT( validateExtent() ) ); connect( mToggleRubberbands, SIGNAL( clicked() ), this, SLOT( toggleErrorMarkers() ) ); connect( mFixButton, SIGNAL( clicked() ), this, SLOT( fix() ) ); connect( mErrorTableView, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( errorListClicked( const QModelIndex & ) ) ); connect( mLayerRegistry, SIGNAL( layerWasAdded( QgsMapLayer* ) ), mConfigureDialog, SLOT( addLayer( QgsMapLayer* ) ) ); connect( mLayerRegistry, SIGNAL( layerWillBeRemoved( QString ) ), mConfigureDialog, SLOT( removeLayer( QString ) ) ); connect( mLayerRegistry, SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( parseErrorListByLayer( QString ) ) ); connect( this, SIGNAL( visibilityChanged( bool ) ), this, SLOT( updateRubberBands( bool ) ) ); }
int main(void){ int puzzle[9][9]; int duplicates = 1; FILE *fp = fopen(puzzleFile, "r"); //Reads the sudoku numbers from puzzle.txt for (int i=0;i<9;i++){ for (int j=0;j<9;j++){ fscanf(fp, "%d", &puzzle[i][j]); } } fclose(fp); sudoku_helper(puzzle, 0, 0); duplicates = validateAll(puzzle); if (duplicates == 1) printf("The puzzle is valid, there are no duplicates\n"); else if (duplicates == 0) printf("The puzzle contains duplicates \n"); FILE *solved = fopen("solved_puzzle.txt", "w"); for(int i = 0; i <9; i++) { for(int j = 0; j < 9; j++) { fprintf(solved, "%d ", puzzle[i][j]); printf("%d ", puzzle[i][j]); } fprintf(solved, "\n"); printf("\n"); } fclose(solved); return 0; }