예제 #1
0
파일: testApp.cpp 프로젝트: j-v/of-sketches
//--------------------------------------------------------------
void testApp::update(){
	unsigned long long cur_time = ofGetSystemTime();
	
	// grid needs to be regenerated every draw due to random noise 
	// TODO maybe we can use a separate buffer for noise and do displacement in shader
	generateGrid();

	//rotate and zoom camera
	double tick_double = double(cur_time % 2000)/2000;
	
	double scale = abs(tick_double - 0.5) * 3;
	if (move_camera)
	{
		theCamera.position.x = cos(tick_double * 2 * PI) * scale;
		theCamera.position.y = 0.35f;
		theCamera.position.z = sin(tick_double * 2 * PI) * scale ;
	}
	else
	{
		theCamera.position.x = 0;
		theCamera.position.y = 0.35f;
		theCamera.position.z = -1.1f ;
	}

	theCamera.target.x = 0;
	theCamera.target.y = 0;
	theCamera.target.z = 0;
	theCamera.roll = 0.0;

}
예제 #2
0
TEST_P(MatricesToVtk_Grid3D_ptest, loadGrid3D)
{
    const auto & param = GetParam();

    io::ReadDataSet readDataSet;
    readDataSet.type = io::DataSetType::vectorGrid3D;
    auto & data = readDataSet.data;
    data = generateGrid(param);

    auto dataObject = MatricesToVtk::loadGrid3D("AGrid", { readDataSet });
    ASSERT_TRUE(dataObject);
    auto image = vtkImageData::SafeDownCast(dataObject->dataSet());
    ASSERT_TRUE(image);

    std::array<int, 3> dimensions;
    image->GetDimensions(dimensions.data());
    ASSERT_EQ(2, dimensions[0]);
    ASSERT_EQ(2, dimensions[1]);
    ASSERT_EQ(2, dimensions[2]);

    tDataBounds expectedBounds;
    expectedBounds.setDimension(static_cast<size_t>(param._0), ValueRange<>({0.0, 1.0}));
    expectedBounds.setDimension(static_cast<size_t>(param._1), ValueRange<>({0.0, 2.0}));
    expectedBounds.setDimension(static_cast<size_t>(param._2), ValueRange<>({0.0, 3.0}));
    tDataBounds bounds;
    image->GetBounds(bounds.data());
    ASSERT_EQ(expectedBounds, bounds);
}
Environment::Environment(int size, int blockRate, bool Agent)
{
	gridSize = size;
	blockGridRate = blockRate;
	generateCells();
	if( !Agent )
		generateGrid();

}
예제 #4
0
TEST_P(MatricesToVtk_Grid3D_ptest, loadGrid3D_vector3)
{
    const auto & param = GetParam();

    io::ReadDataSet readDataSet;
    readDataSet.type = io::DataSetType::vectorGrid3D;
    auto & data = readDataSet.data;
    data = generateGrid(param, 3u);

    auto dataObject = MatricesToVtk::loadGrid3D("AGrid", { readDataSet });
    ASSERT_TRUE(dataObject);
    auto image = vtkImageData::SafeDownCast(dataObject->dataSet());
    ASSERT_TRUE(image);

    std::array<int, 3> dimensions;
    image->GetDimensions(dimensions.data());
    ASSERT_EQ(2, dimensions[0]);
    ASSERT_EQ(2, dimensions[1]);
    ASSERT_EQ(2, dimensions[2]);

    auto vectors = image->GetPointData()->GetVectors();
    ASSERT_TRUE(vectors);

    std::array<int, 3> refIncrements;
    refIncrements[static_cast<size_t>(param._0)] = 1;
    refIncrements[static_cast<size_t>(param._1)] = dimensions[0];
    refIncrements[static_cast<size_t>(param._2)] = dimensions[0] * dimensions[1];

    for (int z = 0; z < dimensions[2]; ++z)
    {
        for (int y = 0; y < dimensions[1]; ++y)
        {
            for (int x = 0; x < dimensions[0]; ++x)
            {
                const size_t refIndex = static_cast<size_t>(
                    refIncrements[0] * x + refIncrements[1] * y + refIncrements[2] * z);
                for (int c = 0; c < 3; ++c)
                {
                    const auto expected = static_cast<float>(
                        data[3u + static_cast<size_t>(c)][refIndex]);
                    const auto parsedComponent = image->GetScalarComponentAsFloat(x, y, z, c);
                    ASSERT_FLOAT_EQ(expected, parsedComponent);
                }
            }
        }
    }
}
예제 #5
0
void OsmDataManager::load(const QString filename){
    QFile file(filename);
    if(!file.open(QIODevice::ReadOnly)) {
        QMessageBox::information(0, "error", file.errorString());
        return;
    }

    QXmlStreamReader xml(&file);

    if(xml.readNextStartElement()){
        if(xml.name() == "osm"){
            while(xml.readNextStartElement()){
                QString name = xml.name().toString();
                if(name == "bounds"){
                    xllcorner = xml.attributes().value("minlon").toFloat();
                    yllcorner = xml.attributes().value("minlat").toFloat();
                    xurcorner = xml.attributes().value("maxlon").toFloat();
                    yurcorner = xml.attributes().value("maxlat").toFloat();
                    xml.skipCurrentElement();
                }
                else if(name == "node"){
                    addNode(xml);
                }
                else if(name == "way"){
                    addWay(xml);
                }
                else{
                    xml.skipCurrentElement();
                }
            }
        }
    }
    xml.clear();
    file.close();

    generateGrid();
}
예제 #6
0
void GroundPlane::createGeometry( const Frustum& frustum )
{
   PROFILE_SCOPE( GroundPlane_createGeometry );
   
   enum { MAX_WIDTH = 256, MAX_HEIGHT = 256 };
   
   // Project the frustum onto the XY grid.

   Point2F min;
   Point2F max;

   projectFrustum( frustum, mSquareSize, min, max );
   
   // Early out if the grid projection hasn't changed.

   if(   mVertexBuffer.isValid() && 
         min == mMin && 
         max == mMax )
      return;

   mMin = min;
   mMax = max;

   // Determine the grid extents and allocate the buffers.
   // Adjust square size permanently if with the given frustum,
   // we end up producing more than a certain limit of geometry.
   // This is to prevent this code from causing trouble with
   // long viewing distances.
   // This only affects the client object, of course, and thus
   // has no permanent effect.
   
   U32 width = mCeil( ( max.x - min.x ) / mSquareSize );
   if( width > MAX_WIDTH )
   {
      mSquareSize = mCeil( ( max.x - min.x ) / MAX_WIDTH );
      width = MAX_WIDTH;
   }
   else if( !width )
      width = 1;
   
   U32 height = mCeil( ( max.y - min.y ) / mSquareSize );
   if( height > MAX_HEIGHT )
   {
      mSquareSize = mCeil( ( max.y - min.y ) / MAX_HEIGHT );
      height = MAX_HEIGHT;
   }
   else if( !height )
      height = 1;

   const U32 numVertices   = ( width + 1 ) * ( height + 1 );
   const U32 numTriangles  = width * height * 2;

   // Only reallocate if the buffers are too small.
   if ( mVertexBuffer.isNull() || numVertices > mVertexBuffer->mNumVerts )
   {
#if defined(TORQUE_OS_XENON)
      mVertexBuffer.set( GFX, numVertices, GFXBufferTypeVolatile );
#else
      mVertexBuffer.set( GFX, numVertices, GFXBufferTypeDynamic );
#endif
   }
   if ( mPrimitiveBuffer.isNull() || numTriangles > mPrimitiveBuffer->mPrimitiveCount )
   {
#if defined(TORQUE_OS_XENON)
      mPrimitiveBuffer.set( GFX, numTriangles*3, numTriangles, GFXBufferTypeVolatile );
#else
      mPrimitiveBuffer.set( GFX, numTriangles*3, numTriangles, GFXBufferTypeDynamic );
#endif
   }

   // Generate the grid.

   generateGrid( width, height, mSquareSize, min, max, mVertexBuffer, mPrimitiveBuffer );

   // Set up GFX primitive.

   mPrimitive.type            = GFXTriangleList;
   mPrimitive.numPrimitives   = numTriangles;
   mPrimitive.numVertices     = numVertices;
}
예제 #7
0
파일: main_2.c 프로젝트: pd0wm/epo2
/**
 * Second main function
 * @return
 */
int main_2() {
	// Initializations
	Position start, destination;
	Path_element *path = NULL;

	Path_element *robot_path;
	int x, y;



#ifdef CHALLENGE_AB
	int initial_facing_direction;
	int i;
	static int first_run = 1;

	if (first_run) {
		first_run = 0;

		// Get which places to user wants to visit
		getPlacesToVisit();
	}


	// Reset no_total_path_possible
	no_total_path_possible = 0;
#endif

	// Unvisit all places
	unvisitAll();

	// Seed the rand() function
	srand(time(NULL));
#ifdef CHALLENGE_AB
	// Randomize facing direction
	initial_facing_direction = NORTH;// = rand() % 4 + 1;
#endif

	// Initialize grid
	generateGrid();

#if MINES_ACTIVE == 1
	// Create mines
	// createMines();
	//	removeConnection(0,0,1,0);
	//	removeConnection(1,0,2,0);
	//	removeConnection(0,2,1,2);
	//	removeConnection(2,2,3,2);
	//	removeConnection(3,3,4,3);
	//	removeConnection(0,0,0,1);
	//	removeConnection(1,0,1,1);
	//	removeConnection(1,3,1,4);
	//	removeConnection(2,1,2,2);
	//	removeConnection(2,3,2,4);
	//	removeConnection(3,0,3,1);
	//	removeConnection(4,0,4,1);
	//	removeConnection(4,1,4,2);

	//	removeConnection(0,0,0,1);
	//	removeConnection(1,3,1,2);
	//	removeConnection(2,2,2,3);
	//	removeConnection(4,1,4,2);
#endif

	// Define the start position in the bottom left
	start.x = destination.x = 1;
	start.y = destination.y = 0;

#if MINES_ACTIVE == 1
	// Discover mines at start location
	// discoverMines(start.x, start.y);
#endif

#ifdef CHALLENGE_AB
	int key, q;
	goto go2;
	frombeginning2:
	cls_2();
	printf("Place the robot at the beginning, type '1' to continue...\n");
	key = 0;
	while (!key) { scanf("%d",&key); }
	go2:

	curDir = 0;

	setCommand(new_sck, MOVE, 1, 1, 0);
	wait_till_ready(new_sck);

	setCommand(new_sck, POS, 0, start.x+1, start.y+1);
	wait_till_ready(new_sck);

	// Get first destination
	destination.x = places_to_visit[getTargetPlace(start.x, start.y, initial_facing_direction, 0)][0];
	destination.y = places_to_visit[getTargetPlace(start.x, start.y, initial_facing_direction, 0)][1];

	// Create the robot_path linked list
	robot_path = malloc(sizeof (Path_element));
	robot_path->x = start.x;
	robot_path->y = start.y;
	robot_path->facing_direction = initial_facing_direction;
	robot_path->next = NULL;

	for (q = 0; q < NUM_NODES; q++) getNodeById(q)->mark = 0;

	// Mark places to visit
		for (i = 0; i < NUMBER_OF_PLACES_TO_VISIT; i++) {
			if (!places_to_visit[i][2])
				grid[places_to_visit[i][0]][places_to_visit[i][1]]->mark = 49 + i;
		}

	// Find initial path
		path = findShortestPath(start.x, start.y, initial_facing_direction, destination.x, destination.y);

	// If path == NULL, there was no path found
		if (!path || no_total_path_possible) {
		// Clear screen, print the grid, display a message, sleep for a while and then rerun the program
			cls_2();
			printGrid(robot_path);
			printf("\nCouldn't find a intial path...\n");
		// getchar();
		// main();
			return 0;
		}

	// Record start
		x = start.x;
		y = start.y;

	// Display first move
		cls_2();
		printGrid(robot_path);
	// getchar();
		int moveCorrect = 1;

		while (1) {
			if (kbhit()) goto frombeginning2;

			if (moveCorrect) path = path->next;
		// addToEndOfPath(&robot_path, path->x, path->y);
			if (x == path->x && y == path->y) {
				path = path->next;
			}

			int prevfd = path->facing_direction;

			if (makeMove(x,y,path->x,path->y)) {
				moveCorrect = 1;
				x = path->x;
				y = path->y;


			} else {
				printf("Returned mine between (%d,%d)<curr pos> and (%d,%d)\n",x,y,path->x,path->y);
				removeConnection(x,y,path->x,path->y);
				moveCorrect = 0;

			// prevfd = reverseDirection(prevfd);
			}


		// Move and save position and step weight, also add the position to the path
			if (moveCorrect) {
				path = path->next;
				addToEndOfPath(&robot_path, x, y);
			}

		// printf("VISIT\n");
			visit(x, y);
		// printf("VISITED ALL PLACES\n");
			if (visitedAllPlaces()) break;

		// printf("getTargetPlace\n");

 		// Get destination
			destination.x = places_to_visit[getTargetPlace(x, y, prevfd, 0)][0];
			destination.y = places_to_visit[getTargetPlace(x, y, prevfd, 0)][1];



// #if MINES_ACTIVE == 1
		// Check for mines
		// discoverMines(x, y);

		// Now filter combs for discovered mines

// #endif
		// Calculate new path, mines couldve changed something
// printf("New path %d,%d  %d  %d, %d\n",x,y,prevfd,destination.x,destination.y);

			path = findShortestPath(
			                        x, y,
			                        prevfd,
			                        destination.x,
			                        destination.y
			                        );

		// printf("kay\n");

		// If path == NULL, there was no path found
			if (!path || no_total_path_possible) {
				cls_2();
				printGrid(robot_path);
				printf("Could not find a path!\n");
				getchar();
				return 0;
			}

						// Display path and add step weight to path weight
			cls_2();
			printGrid(robot_path);
			getTargetPlace(x, y, path->facing_direction, DEBUG);
						// getchar();
		}

				// #if MINES_ACTIVE == 1
				// 	// Reveal mines
				// 	revealMines();
// #endif

	// Display final screen
		cls_2();
		printGrid(robot_path);
		printf("\nDone.\n");
		getchar();
#endif

#ifdef CHALLENGE_C
	// Find initial path
	int *combs;
	int index;
	int q;


	// clear grid markings


	// Some unreadable shit which makes things work like they should
	cls_2();
	printf("Press enter to start...\n"); getchar();
	int antiMine = 0;
	rerun:
	goto go3;
	antimine:
	antiMine = 1;
	go3:
	stepsTakenSize = 0;
	index = 0;
	int key;
	goto go2;
	frombeginning:
	cls_2();
	printf("Place the robot at the beginning, type '1' to continue, '9' to restart or '5' to restart in anti-mine mode...\n");
	key = 0;
	while (key==0) { scanf("%d",&key); }
	if(key==9) goto rerun;
	if(key==5) goto antimine;
	go2:

	curDir = 0;

	setCommand(new_sck, MOVE, 1, 1, 0);
	wait_till_ready(new_sck);

	for (q = 0; q < NUM_NODES; q++) getNodeById(q)->mark = 0;

		robot_path = malloc(sizeof (Path_element));
	robot_path->x = start.x;
	robot_path->y = start.y;
	robot_path->next = NULL;

	cls_2();
	printGrid(robot_path);

	setCommand(new_sck, POS, 0, start.x+1, start.y+1);
	wait_till_ready(new_sck);

	x = start.x;
	y = start.y;

	// Find initial path
	combs = exploreArea(grid[start.x][start.y]->id);



	// If path == NULL, there was no path found
	if (!combs) {
		// Clear screen, print the grid, display a message, sleep for a while and then rerun the program
		printf("\nCouldn't find a intial path...\n");
		getchar();
		// main();
		return 0;
	}

	while (1) {
		// Start by removing the path walked from the current combs
		int i;//, fins = 1;

		for (i = 0; combs[i] != -2; i+=2) {
			if (inStepsTaken(combs[i],combs[i+1])) {
				combs[i] = combs[i+1] = -1;
			}
		}
		// Check if there is a comb available
		if (combs[index] == -1) {
			index += 2;
			continue;
		}

		if (combs[index] == -2) break;

		// First walk to first node
		int nodeNow = combs[index];
		int nodeTo = combs[index+1];

		//printf

		path = findShortestPath(x, y,
		                        (path?path->facing_direction:NORTH),
			// 1,
		                        getNodeById(nodeNow)->positionGrid.x,
		                        getNodeById(nodeNow)->positionGrid.y);

		int failed = 0;
		int intcpt = 0;

		while (!(x == getNodeById(nodeNow)->positionGrid.x && y == getNodeById(nodeNow)->positionGrid.y)) {
			if (kbhit()) goto frombeginning;

			if (path && x == path->x && y == path->y) path = path->next;
			else if (!path) {
				printf("FAIL!\n");
				getchar();
				intcpt = 1;
				failed = 1;
				break;
			}

			// printf("Making first MOVE!\n");
			if (makeMove(x,y,path->x,path->y)) {

				stepTaken(grid[x][y]->id,grid[path->x][path->y]->id);
				// printf("Step correct! (from %d to %d)\n", grid[x][y]->id,grid[path->x][path->y]->id);getchar();
				x = path->x;
				y = path->y;
				path = path->next;
				addToEndOfPath(&robot_path, x, y);
			} else {
				if (antiMine) goto frombeginning;
				removeConnection(x,y,path->x,path->y);
				failed = 1;
				break;
			}

			cls_2();
			printGrid(robot_path);
		}

	if (failed) { // Soooo it failed, boohoo.
		if (!intcpt) islandSN(grid[x][y]->id);
			//cls_2();
		printf("Recalculating...\n");
		combs = exploreArea(grid[x][y]->id);
		index = 0;


		cls_2();
		printGrid(robot_path);
		continue;
	}

		// Okay now walk to second node

	path = findShortestPath(x, y,
	                        (path?path->facing_direction:NORTH),
	                        getNodeById(nodeTo)->positionGrid.x,
	                        getNodeById(nodeTo)->positionGrid.y);

	while (!(x == getNodeById(nodeTo)->positionGrid.x && y == getNodeById(nodeTo)->positionGrid.y)) {
		if (kbhit()) goto frombeginning;

		if (path && x == path->x && y == path->y) path = path->next;
		else if (!path) {
			printf("FAIL!\n");
			getchar();
			intcpt = 1;
			failed = 1;
			break;
		}

		if (makeMove(x,y,path->x,path->y)) {
			stepTaken(grid[x][y]->id,grid[path->x][path->y]->id);
				// printf("Step correct! (from %d to %d)\n", grid[x][y]->id,grid[path->x][path->y]->id);getchar();
			x = path->x;
			y = path->y;
			path = path->next;
			addToEndOfPath(&robot_path, x, y);
		} else {
			if (antiMine) goto frombeginning;
			removeConnection(x,y,path->x,path->y);
			failed = 1;
			break;
		}

		cls_2();
		printGrid(robot_path);
	}

		if (failed) { // Soooo it failed, boohoo.
			if (!intcpt) islandSN(grid[x][y]->id);
			//cls_2();
			printf("Recalculating...\n");
			combs = exploreArea(grid[x][y]->id);
			index = 0;
			// islandSN(grid[x][y]->id);

			cls_2();
			printGrid(robot_path);
			continue;
		}

		// Guess everything went okay
		index += 2;
	}

	printf("Aaaaaaaaaaaaaand we're done, type '1' to rerun and '5' to rerun in anti-mine mode!\n");
	key = 0;
	while (key==0) { scanf("%d",&key); }
	if (key==1)	goto rerun;
	else if(key==5) goto antimine;

#endif

	return EXIT_SUCCESS;
}
QList<QPoint>* DataContainer::gridList()
{
    if (settings->isMask() && maskCreated) _gridList = generateGrid(maskData,settings);
    else _gridList = generateGrid(settings);
    return &_gridList;
}
예제 #9
0
// Generate a new map
void MainWindow::on_btnGenerate_clicked()
{
    ui->txtConsole->clear();

    debug("Beginning map generation");

    if (!tiles.empty()) {
        while (!tiles.empty()) {
            ui->glMap->removeWidget(tiles.back());
            delete tiles.back(), tiles.pop_back();
        }

        debug("Existing map destroyed");
    }

    // Map size/type
    mapSize = -1;
    mapType = ui->cboMapType->currentIndex();

    // Determine size based on user selection
    switch (ui->cboMapSize->currentIndex()) {
    case 0:
        mapSize = 10;
        break;
    case 1:
        mapSize = 12;
        break;
    case 2:
        mapSize = 15;
        break;
    }

    // Should never happen
    if (mapSize == -1) {
        qWarning("Unable to detect size, defaulting to small");
        mapSize = 10;
    }

    // Generate grid
    tileIDs = generateGrid(mapType, mapSize);

    debug(QString::number(tileIDs.size()) + " tiles generated");

    // Get representative string for generated grid
    ui->txtMapCode->setText(getGridString(tileIDs));

    debug("Map import string generated");

    // Create tile images and add them to the grid
    for (int i = 1; i <= mapSize * mapSize; i++) {
        // Determine image path from tileTypes array
        const char *path;

        switch (tileIDs[i - 1]) {
        case 0:
            path = tilePaths[tileTypes::lava];
            break;
        case 1:
            path = tilePaths[tileTypes::water];
            break;
        case 2:
            path = tilePaths[tileTypes::lightning];
            break;
        case 3:
            path = tilePaths[tileTypes::ground];
        }

        // Create labels to display each tile via pixmap
        QLabel *label = new QLabel();
        QPixmap image(path);
        label->setPixmap(image);

        // Track the labels so we can destroy them later
        tiles.push_back(label);

        // Add the tile to the grid (filled from left to right)
        ui->glMap->addWidget(label, (i-1) / mapSize, (i-1) % mapSize + 1);
    }

    // Grab the start and finish images
    QPixmap startImage(tilePaths[tileTypes::meReg]);
    QPixmap endImage(tilePaths[tileTypes::finish]);

    // Add the start label to the bottom left
    QLabel *start = new QLabel();
    start->setPixmap(startImage);
    ui->glMap->addWidget(start, 0, 0);

    // Add the finish label to the top right
    QLabel *end = new QLabel();
    end->setPixmap(endImage);
    ui->glMap->addWidget(end, mapSize - 1, mapSize + 1);

    // Track these two as well
    tiles.push_back(start);
    tiles.push_back(end);

    // Remove any padding
    ui->glMap->setMargin(0);
    ui->glMap->setSpacing(0);

    // Resize to minimum requirements
    qApp->processEvents();
    resize(0, 0);

    // Initialize player location/state
    playerLoc[0] = -1;
    playerLoc[1] = 0;
    playerState = state::regular;
    stateTimer = -1;
    score = 0;
    finished = false;

    debug("Map rendered");
}
예제 #10
0
파일: geometry.c 프로젝트: CDragu/pspsdk
void generateGridNP(unsigned int columns, unsigned int rows, float width, float depth, NPVertex* vertices, unsigned short* indices)
{
	generateGrid(columns,rows,width,depth,vertices,indices,sizeof(NPVertex),-1,-1,3 * sizeof(float), 3 * sizeof(float));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    checkDialog c;
    c.show();

    // shortcuts
    ui->actionOpen->setShortcut(Qt::Key_O | Qt::CTRL);
    ui->actionChange_directory->setShortcut(Qt::Key_D | Qt::CTRL);
    ui->actionClose->setShortcut(Qt::Key_Q | Qt::CTRL);
    ui->actionRun_F5->setShortcut(Qt::Key_F5);
    ui->actionClear_case_F6->setShortcut(Qt::Key_F6);
    ui->actionWrite_input_file_F4->setShortcut(Qt::Key_F4);
    ui->actionCheck->setShortcut(Qt::Key_F7);
    QSignalMapper *signalMapper = new QSignalMapper(this);
    for( int index=0; index < ui->output->count() ; ++index ){
        QShortcut *shortcut  =new QShortcut( QKeySequence(QString("Ctrl+%1").arg( index +1 ) ), this );
        connect( shortcut, SIGNAL(activated() ), signalMapper, SLOT( map() ) );
        signalMapper->setMapping( shortcut, index );
    }
    connect( signalMapper, SIGNAL(mapped( int )),ui->output, SLOT(setCurrentIndex( int )) );


    // Wave theory
    ui->widget_SF->setVisible(false);
    ui->LorP_ComboBox->setVisible(false);
    ui->widget_waveFile->setVisible(false);
    QRect SFwidget_geo = ui->widget_SF->geometry();
    ui->widget_JONSWAP->setGeometry(SFwidget_geo);
    ui->widget_JONSWAP->setVisible(false);
    ui->widget_waveFile->setGeometry(SFwidget_geo);
    ui->widget_customSpectrum->setVisible(false);
    ui->widget_customSpectrum->setGeometry(SFwidget_geo);

    // About
    ui->aboutText_OCW3dGUI->setVisible(false);
    ui->aboutText_OCW3D_publications->setVisible(false);
    ui->aboutText_OCW3DVersion->setVisible(false);

    // Post processing
    ui->readProgressBar->setVisible(false);
    ui->tableWidget->setColumnCount(6);
    ui->tableWidget->setVisible(false);
    ui->SelectOutput->setEnabled(false);
    ui->convert->setEnabled(false);
    ui->morison_widget->setVisible(false);
    ui->eta_widget->setVisible(false);
    QRect Morison_geo = ui->morison_widget->geometry();
    ui->eta_widget->setGeometry(Morison_geo);
    ui->convertStatus->setVisible(false);

    // Custom grid
    ui->geometry_table->setRowCount(2);
    ui->geometry_table->setVerticalHeaderLabels(QString("x [m];d [m]").split(";"));
    ui->customGridWidget->setVisible(false);

    // set labels
    ui->alpha_label->setText(QString((QChar) 0x03B1));
    ui->beta_label->setText(QString((QChar) 0x03B2));
    ui->gamma_label->setText(QString((QChar) 0x03B3));

    connect(ui->waveType,SIGNAL(currentIndexChanged(int)),this,SLOT(on_waveTheoryChanged(int)));
    connect(ui->storeAscii_onOff,SIGNAL(clicked(bool)),this,SLOT(storeASCII(bool)));
    connect(ui->LorP_ComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(on_waveTheoryChanged()));
    connect(ui->nOutFiles,SIGNAL(valueChanged(int)),this,SLOT(on_outputWidgetChanged(int)));
    connect(ui->OpenDirBrowser,SIGNAL(clicked()),this,SLOT(openWorkDirDialog()));
    connect(ui->selectPPfile,SIGNAL(clicked()),this,SLOT(selectPPfile()));
    connect(ui->run,SIGNAL(clicked()),this,SLOT(run()));
    connect(ui->selectGnuplotFile,SIGNAL(clicked()),this,SLOT(openFileDialog()));
    connect(ui->plot,SIGNAL(clicked()),this,SLOT(gnuplot()));
    connect(ui->read_bottom,SIGNAL(clicked()),this,SLOT(readKinematicFile()));
    connect(ui->about_combobox,SIGNAL(currentIndexChanged(int)),this,SLOT(about_changed(int)));
    connect(ui->SelectOutput,SIGNAL(currentIndexChanged(int)),this,SLOT(convertTo_setup(int)));
    connect(ui->convert,SIGNAL(clicked()),this,SLOT(convertTo()));
    connect(ui->showGrid,SIGNAL(clicked()),this,SLOT(showGrid()));
    connect(ui->geometryType,SIGNAL(currentIndexChanged(int)),this,SLOT(geometryType_changed(int)));
    connect(ui->nGridPoints,SIGNAL(valueChanged(int)),this,SLOT(nGridPoints_changed()));
    connect(ui->smooth,SIGNAL(clicked()),this,SLOT(smooth()));
    connect(ui->generateGrid,SIGNAL(clicked()),this,SLOT(generateGrid()));
    connect(ui->selectWaveFile,SIGNAL(clicked()),this,SLOT(selectWaveFile()));
    connect(ui->selectGridFile,SIGNAL(clicked()),this,SLOT(selectGridFile()));
    connect(ui->selectWaveFile_eta,SIGNAL(clicked()),this,SLOT(selectWaveFile_eta()));
    connect(ui->DropDownListOutputType,SIGNAL(currentIndexChanged(int)),this,SLOT(WaveTypeSelected()));
    connect(ui->pushButton_advancedMorison,SIGNAL(clicked()),this,SLOT(advancedMorison()));
    // default
    connect(ui->checkBox_constantWidget,SIGNAL(stateChanged(int)),this,SLOT(constantWidget()));
    connect(ui->checkBox_breakingWidget,SIGNAL(stateChanged(int)),this,SLOT(breakingWidget()));
    connect(ui->checkBox_FD,SIGNAL(stateChanged(int)),this,SLOT(FDWidget()));
    connect(ui->checkBox_precon,SIGNAL(stateChanged(int)),this,SLOT(preconWidget()));

    // ations
    connect(ui->actionClose,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(openFile()));
    connect(ui->actionRun_F5,SIGNAL(triggered()),this,SLOT(run()));
    connect(ui->actionClear_case_F6,SIGNAL(triggered()),this,SLOT(clearCase()));
    connect(ui->actionWrite_input_file_F4,SIGNAL(triggered()),this,SLOT(writeInputFile()));
    connect(ui->actionChange_directory,SIGNAL(triggered()),this,SLOT(openWorkDirDialog()));
    connect(ui->actionCheck,SIGNAL(triggered()),this,SLOT(checkCase()));
    ui->workingDir->setText(dir.currentPath());

    // Special versions

#if externalOutputClass
    ui->SelectOutput->addItem("External output");
#endif


}
예제 #12
0
vector<Point2f> UIGridDetector::getGrid(const cv::Mat& image, unsigned int cols, unsigned int rows) {
    auto corners = getCornersFromUser(image);
    return generateGrid(corners, cols, rows);
}