Example #1
0
//--------------------------------------------------------------
void testApp::setup(){
	ofBackgroundHex(0xfdefc2);
	ofSetLogLevel(OF_LOG_NOTICE);
	ofSetVerticalSync(true);
	
	// Box2d
	box2d.init();
	box2d.setGravity(0, 20);
	box2d.createGround();
	box2d.setFPS(30.0);
	
	
	
	// load the shape we saved...
	vector <ofVec2f> pts = loadPoints("shape.dat");
	ofxBox2dPolygon poly;
	
	// loop and add vertex points
	for (int i=0; i<pts.size(); i++) {
		poly.addVertex(pts[i]);
	}
	poly.setAsEdge(false);
	poly.triangulate(15);
	poly.setPhysics(1.0, 0.3, 0.3);
	poly.create(box2d.getWorld());
	triangles.push_back(poly);
}
Example #2
0
MainWindow::MainWindow()
{
    setupUi(this); 

    connect(action_Load_Model, SIGNAL(triggered()), this, SLOT(loadModel()));
    connect(action_Snap_Shot, SIGNAL(triggered()), this, SLOT(snapShot()));
    connect(action_Fix_Camera, SIGNAL(triggered()), this, SLOT(fixCamera()));
    connect(action_Reset_Screen, SIGNAL(triggered()), this, SLOT(resetScreen()));
    connect(action_Update_Geometry, SIGNAL(triggered()), this, SLOT(updateGeometry()));
    connect(action_Export_OBJ, SIGNAL(triggered()), this, SLOT(exportOBJ()));
    connect(action_Render, SIGNAL(triggered()), this, SLOT(renderTexture()));
    connect(action_Vector_Field, SIGNAL(triggered()), this, SLOT(setVectorField()));
    connect(action_Load_2D_3D_points, SIGNAL(triggered()), this, SLOT(loadPoints()));
    connect(action_Tool_Box, SIGNAL(triggered()), this, SLOT(showToolBox()));
    connect(action_Delete_Last_Line_Of_Source, SIGNAL(triggered()), this, SLOT(deleteLastLine_Source()));
    connect(action_Delete_Last_Line_Of_Target, SIGNAL(triggered()), this, SLOT(deleteLastLine_Target()));

    disp_modules.reset(new DispModuleHandler(centralwidget));
    this->setCentralWidget(centralwidget);

    parameter_dock.reset(new ParameterDock);
    parameter_dock->setFixedWidth(250);
    this->addDockWidget(Qt::LeftDockWidgetArea, parameter_dock.get());
    parameter_dock->setDispModules(disp_modules);
    parameter_dock->hide();

    this->show();

	//pointsSelect = false;
	//isCompute = false;
}
Example #3
0
liveAutoLane::liveAutoLane(sequencerApp* _sequencer, int _id, int _x, int _y) {
	sequencer = _sequencer;
	sqlite = sequencer->getSQLite();
	id = _id;
	x = _x;
	y = _y;
	w = 140;
	h = TRACK_HEIGHT;
	s = y;
	
	last_click_x = 0;
	last_click_y = 0;
	
	range = 132;
	
	// Get name
	ofxSQLiteSelect sel = sequencer->getSQLite()->select("name")
	.from("auto_lanes")
	.where("id", id)
	.execute().begin();
	while(sel.hasNext()) {
		name = sel.getString();
		sel.next();
	}
	
	// Set val
	val = 0.0;
	
	loadPoints();
}
Example #4
0
void
MainWindow::connectActions()
{
  QObject::connect(this->actionNew_Point_Set, SIGNAL(triggered()), 
		   this, SLOT(newPointSet()));

  QObject::connect(this->actionLoad_points, SIGNAL(triggered()), 
		   this, SLOT(loadPoints()));

  QObject::connect(this->actionSave_points, SIGNAL(triggered()), 
		   this, SLOT(savePoints()));

  QObject::connect(this->speedSlider, SIGNAL(valueChanged(int)), 
		   this, SLOT(speedChanged(int)));

  QObject::connect(this->viewer, SIGNAL(valueChanged(int)),
                   this, SLOT(speedChanged(int)));

  QObject::connect(this, SIGNAL(sceneChanged()), 
		   this->viewer, SLOT(sceneChanged()));
  
  QObject::connect(this->actionStep, SIGNAL(triggered()),
                   this, SLOT(lloydStep()));

  QObject::connect(this->actionPlay, SIGNAL(toggled(bool)),
                   this, SLOT(togglePause(bool)));

  QObject::connect(this->actionShow_8_Copies, SIGNAL(toggled(bool)),
                   this, SLOT(toggle8Copies(bool)));

  QObject::connect(this->action2D_version, SIGNAL(toggled(bool)),
                   this, SLOT(toggle2D(bool)));

  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
		   qApp, SLOT(quit()));

  QObject::connect(this->actionDemo_Help, SIGNAL(triggered()),
                   this, SLOT(help()));
}
Example #5
0
//--------------------------------------------------------------
void ofApp::setup() {

	ofDisableAntiAliasing();
	ofBackgroundHex(0xfdefc2);
	ofSetLogLevel(OF_LOG_NOTICE);
	ofSetVerticalSync(true);

	// Box2d
	box2d.init();
	box2d.setGravity(0, 10);
	box2d.createGround();
	box2d.setFPS(30.0);

	breakupIntoTriangles = true;

	// load the shape we saved...
	auto pts = loadPoints("shape.dat");
	auto poly = std::make_shared<ofxBox2dPolygon>();
	poly->addVertices(pts);
	poly->setPhysics(1.0, 0.3, 0.3);
	poly->triangulatePoly();
	poly->create(box2d.getWorld());
	polyShapes.push_back(poly);
}
MultiVariableInterp2D::MultiVariableInterp2D(const char* fileName) {
	loadPoints(fileName);
	calcBoundaries();
}
//--------------------------------------------------------------
void ofxStreetViewCollector::loadAndCollect(string path){
    loadPoints(path);
    collectIterator = points.begin();
    startCollectingData();
    
}
Example #8
0
int 
main (int argc, char ** argv)
{
  if (argc < 3) 
  {
    pcl::console::print_info ("Syntax is: %s source target <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    -i min_sample_dist,max_dist,nr_iters ................ Compute initial alignment\n");
    pcl::console::print_info ("    -r max_dist,rejection_thresh,tform_eps,max_iters ............. Refine alignment\n");
    pcl::console::print_info ("    -s output.pcd ........................... Save the registered and merged clouds\n");
    pcl::console::print_info ("Note: The inputs (source and target) must be specified without the .pcd extension\n");

    return (1);
  }

  // Load the points
  PointCloudPtr src_points = loadPoints (argv[1]);
  PointCloudPtr tgt_points = loadPoints (argv[2]);
  Eigen::Matrix4f tform = Eigen::Matrix4f::Identity ();

  // Compute the intial alignment
  double min_sample_dist, max_correspondence_dist, nr_iters;
  bool compute_intial_alignment = 
    pcl::console::parse_3x_arguments (argc, argv, "-i", min_sample_dist, max_correspondence_dist, nr_iters) > 0;
  if (compute_intial_alignment)
  {
    // Load the keypoints and local descriptors
    PointCloudPtr src_keypoints = loadKeypoints (argv[1]);
    LocalDescriptorsPtr src_descriptors = loadLocalDescriptors (argv[1]);
    PointCloudPtr tgt_keypoints = loadKeypoints (argv[2]);
    LocalDescriptorsPtr tgt_descriptors = loadLocalDescriptors (argv[2]);

    // Find the transform that roughly aligns the points
    tform = computeInitialAlignment (src_keypoints, src_descriptors, tgt_keypoints, tgt_descriptors,
                                     min_sample_dist, max_correspondence_dist, nr_iters);
    
    pcl::console::print_info ("Computed initial alignment\n");
  }

  // Refine the initial alignment
  std::string params_string;
  bool refine_alignment = pcl::console::parse_argument (argc, argv, "-r", params_string) > 0;
  if (refine_alignment)
  {
    std::vector<std::string> tokens;
    boost::split (tokens, params_string, boost::is_any_of (","), boost::token_compress_on);
    assert (tokens.size () == 4);    
    float max_correspondence_distance = atof(tokens[0].c_str ());
    float outlier_rejection_threshold = atof(tokens[1].c_str ());
    float transformation_epsilon = atoi(tokens[2].c_str ());
    int max_iterations = atoi(tokens[3].c_str ());

    tform = refineAlignment (src_points, tgt_points, tform, max_correspondence_distance,  
                             outlier_rejection_threshold, transformation_epsilon, max_iterations);

    pcl::console::print_info ("Refined alignment\n");
  }  

  // Transform the source point to align them with the target points
  pcl::transformPointCloud (*src_points, *src_points, tform);

  // Save output
  std::string filename;
  bool save_output = pcl::console::parse_argument (argc, argv, "-s", filename) > 0;
  if (save_output)
  {
    // Merge the two clouds
    (*src_points) += (*tgt_points);

    // Save the result
    pcl::io::savePCDFile (filename, *src_points);

    pcl::console::print_info ("Saved registered clouds as %s\n", filename.c_str ());    
  }
  // Or visualize the result
  else
  {
    pcl::console::print_info ("Starting visualizer... Close window to exit\n");
    pcl::visualization::PCLVisualizer vis;

    pcl::visualization::PointCloudColorHandlerCustom<PointT> red (src_points, 255, 0, 0);
    vis.addPointCloud (src_points, red, "src_points");

    pcl::visualization::PointCloudColorHandlerCustom<PointT> yellow (tgt_points, 255, 255, 0);
    vis.addPointCloud (tgt_points, yellow, "tgt_points");
    
    vis.resetCamera ();
    vis.spin ();
  }

  return (0);
}
QVariantMap QgsShortestPathPointToLayerAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
  loadCommonParams( parameters, context, feedback );

  QgsPointXY startPoint = parameterAsPoint( parameters, QStringLiteral( "START_POINT" ), context, mNetwork->sourceCrs() );

  std::unique_ptr< QgsFeatureSource > endPoints( parameterAsSource( parameters, QStringLiteral( "END_POINTS" ), context ) );
  if ( !endPoints )
    throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "END_POINTS" ) ) );

  QgsFields fields = endPoints->fields();
  fields.append( QgsField( QStringLiteral( "start" ), QVariant::String ) );
  fields.append( QgsField( QStringLiteral( "end" ), QVariant::String ) );
  fields.append( QgsField( QStringLiteral( "cost" ), QVariant::Double ) );

  QString dest;
  std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, fields, QgsWkbTypes::LineString, mNetwork->sourceCrs() ) );
  if ( !sink )
    throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );

  QVector< QgsPointXY > points;
  points.push_front( startPoint );
  QHash< int, QgsAttributes > sourceAttributes;
  loadPoints( endPoints.get(), points, sourceAttributes, context, feedback );

  feedback->pushInfo( QObject::tr( "Building graph…" ) );
  QVector< QgsPointXY > snappedPoints;
  mDirector->makeGraph( mBuilder.get(), points, snappedPoints, feedback );

  feedback->pushInfo( QObject::tr( "Calculating shortest paths…" ) );
  QgsGraph *graph = mBuilder->graph();
  int idxStart = graph->findVertex( snappedPoints[0] );
  int idxEnd;

  QVector< int > tree;
  QVector< double > costs;
  QgsGraphAnalyzer::dijkstra( graph, idxStart, 0, &tree, &costs );

  QVector<QgsPointXY> route;
  double cost;

  QgsFeature feat;
  feat.setFields( fields );
  QgsAttributes attributes;

  int step =  points.size() > 0 ? 100.0 / points.size() : 1;
  for ( int i = 1; i < points.size(); i++ )
  {
    if ( feedback->isCanceled() )
    {
      break;
    }

    idxEnd = graph->findVertex( snappedPoints[i] );
    if ( tree.at( idxEnd ) == -1 )
    {
      feedback->reportError( QObject::tr( "There is no route from start point (%1) to end point (%2)." )
                             .arg( startPoint.toString(),
                                   points[i].toString() ) );
      feat.clearGeometry();
      attributes = sourceAttributes.value( i );
      attributes.append( QVariant() );
      attributes.append( points[i].toString() );
      feat.setAttributes( attributes );
      sink->addFeature( feat, QgsFeatureSink::FastInsert );
      continue;
    }

    route.clear();
    route.push_front( graph->vertex( idxEnd ).point() );
    cost = costs.at( idxEnd );
    while ( idxEnd != idxStart )
    {
      idxEnd = graph->edge( tree.at( idxEnd ) ).fromVertex();
      route.push_front( graph->vertex( idxEnd ).point() );
    }

    QgsGeometry geom = QgsGeometry::fromPolylineXY( route );
    QgsFeature feat;
    feat.setFields( fields );
    attributes = sourceAttributes.value( i );
    attributes.append( startPoint.toString() );
    attributes.append( points[i].toString() );
    attributes.append( cost / mMultiplier );
    feat.setAttributes( attributes );
    feat.setGeometry( geom );
    sink->addFeature( feat, QgsFeatureSink::FastInsert );

    feedback->setProgress( i * step );
  }

  QVariantMap outputs;
  outputs.insert( QStringLiteral( "OUTPUT" ), dest );
  return outputs;
}
Example #10
0
int main (int    argc,
	  char** argv)
// ---------------------------------------------------------------------------
// Driver.
// ---------------------------------------------------------------------------
{
  char              *session, *dump, *points = 0;
  int_t             NP, NZ,  NEL;
  int_t             np, nel, ntot;
  int_t             i, j, k, nf, step;
  ifstream          fldfile;
  istream*          pntfile;
  FEML*             F;
  Mesh*             M;
  real_t            c, time, timestep, kinvis, beta;
  vector<real_t>    r, s;
  vector<Point*>    point;
  vector<Element*>  elmt;
  vector<Element*>  Esys;
  vector<AuxField*> u;

  // -- Initialize.

  Femlib::initialize (&argc, &argv);
  getargs            (argc, argv, session, dump, points);

  fldfile.open (dump, ios::in);
  if (!fldfile) message (prog, "no field file", ERROR);

  // -- Set up 2D mesh information.
  
  F   = new FEML (session);
  M   = new Mesh (F);

  NEL = M -> nEl();  
  NP  = Femlib::ivalue ("N_P");
  NZ  = Femlib::ivalue ("N_Z");
  
  Geometry::set (NP, NZ, NEL, Geometry::Cartesian);
  Esys.resize   (NEL);

  for (k = 0; k < NEL; k++) Esys[k] = new Element (k, NP, M);
  
  // -- Construct the list of points, then find them in the Mesh.

  if (points) {
    pntfile = new ifstream (points);
    if (pntfile -> bad())
      message (prog, "unable to open point file", ERROR);
  } else 
    pntfile = &cin;

  np = nel = ntot = 0;

  loadPoints (*pntfile, np, nel, ntot, point);
  findPoints (point, Esys, elmt, r, s);

  // -- Load field file, interpolate within it.

  cout.precision (8);
  while (getDump (fldfile, u, Esys, NP, NZ, NEL,
		  step, time, timestep, kinvis, beta)) {

    if (np) putHeader (session, u,  np, NZ, nel,
		       step, time, timestep, kinvis, beta);

    nf = u.size();
    for (k = 0; k < NZ; k++)
      for (i = 0; i < ntot; i++) {
	for (j = 0; j < nf; j++) {
	  if   (elmt[i]) c = u[j] -> probe (elmt[i], r[i], s[i], k);
	  else           c = 0.0;
	  cout << setw(15) <<  c;
	}
	if (verbose && !((i + 1)% nreport))
	  cerr 
	    << "interp: plane " << k + 1 << ", "
	    << i + 1 << " points interpolated" << endl;
	cout << endl;
      }
  }

  Femlib::finalize();
  return EXIT_SUCCESS;
}
MainApplication::MainApplication(QWidget *parent) : QWidget(parent)
{

	const int textSize = 12;
	const int toolBoxWidth = 160;
	const int toolBoxWidgetsWidth = 140;
	const int toolBoxSubWidgetsWidth = 120;
	QSize textEditSize = QSize(40, 30);
	int windowHeight = 500;
	int windowWidth = 800;

	/*---- Buttons ----*/
	QPushButton *rangeQueryButton = new QPushButton(tr("Range"));
	rangeQueryButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *radiusQueryButton = new QPushButton(tr("Radius"));
	radiusQueryButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *loadButton = new QPushButton(tr("Load"));
	loadButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *nnQueryButton = new QPushButton(tr("NN-Query"));
	nnQueryButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *smoothingButton = new QPushButton(tr("Smooth"));
	smoothingButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *distanceColorMapButton = new QPushButton(tr("ColorbyDist"));
	distanceColorMapButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *thinningButton = new QPushButton(tr("Thinning"));
	thinningButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *lineFittingButton = new QPushButton(tr("fit Line"));
	lineFittingButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *planeFittingButton = new QPushButton(tr("fit Plane"));
	planeFittingButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	QPushButton *sphereFittingButton = new QPushButton(tr("fit Sphere"));
	sphereFittingButton->setFont(QFont("Times", textSize, QFont::AnyStyle));

	connect(loadButton, SIGNAL(clicked()), this, SLOT(loadPoints()));
	connect(rangeQueryButton, SIGNAL(clicked()), this, SLOT(rangeQuery()));
	connect(radiusQueryButton, SIGNAL(clicked()), this, SLOT(radiusQuery()));
	connect(smoothingButton, SIGNAL(clicked()), this, SLOT(smoothPointCloud()));
	connect(nnQueryButton, SIGNAL(clicked()), this, SLOT(nnQuery()));
	connect(distanceColorMapButton, SIGNAL(clicked()), this, SLOT(colorPointsByDistance()));
	connect(thinningButton, SIGNAL(clicked()), this, SLOT(applyThinning()));
	connect(lineFittingButton, SIGNAL(clicked()), this, SLOT(fitLine()));
	connect(planeFittingButton, SIGNAL(clicked()), this, SLOT(fitPlane()));
	connect(sphereFittingButton, SIGNAL(clicked()), this, SLOT(fitSphere()));

	/*---- Labels ----*/ 
	labelCloudBounds = new QLabel("---", this);
	labelCloudBounds->setMaximumHeight(60);

	labelPoints = new QLabel("---", this);
	labelPoints->setMaximumHeight(60);

	labelTime = new QLabel("---", this);
	labelTime->setMaximumHeight(60);

	labelFitting = new QLabel("p: dir:", this);
	labelFitting->setMaximumHeight(120);

	/*---- Text Edits ----*/
	QDoubleValidator *validDouble = new QDoubleValidator();
	minXRange = new QLineEdit();
	minXRange->setMaximumSize(textEditSize);
	minXRange->setValidator(validDouble);
	maxXRange = new QLineEdit();
	maxXRange->setMaximumSize(textEditSize);
	maxXRange->setValidator(validDouble);
	minYRange = new QLineEdit();
	minYRange->setMaximumSize(textEditSize);
	minYRange->setValidator(validDouble);
	maxYRange = new QLineEdit();
	maxYRange->setMaximumSize(textEditSize);
	maxYRange->setValidator(validDouble);
	minZRange = new QLineEdit();
	minZRange->setMaximumSize(textEditSize);
	minZRange->setValidator(validDouble);
	maxZRange = new QLineEdit();
	maxZRange->setMaximumSize(textEditSize);
	maxZRange->setValidator(validDouble);

	xRadius = new QLineEdit();
	xRadius->setMaximumSize(textEditSize);
	xRadius->setValidator(validDouble);
	yRadius = new QLineEdit();
	yRadius->setMaximumSize(textEditSize);
	yRadius->setValidator(validDouble);
	zRadius = new QLineEdit();
	zRadius->setMaximumSize(textEditSize);
	zRadius->setValidator(validDouble);
	rRadius = new QLineEdit();
	rRadius->setMaximumSize(textEditSize);
	rRadius->setValidator(validDouble);

	xNeighbour = new QLineEdit();
	xNeighbour->setMaximumSize(textEditSize);
	xNeighbour->setValidator(validDouble);
	yNeighbour = new QLineEdit();
	yNeighbour->setMaximumSize(textEditSize);
	yNeighbour->setValidator(validDouble);
	zNeighbour = new QLineEdit();
	zNeighbour->setMaximumSize(textEditSize);
	zNeighbour->setValidator(validDouble);

	rSmoothing = new QLineEdit();
	rSmoothing->setMaximumSize(textEditSize);
	rSmoothing->setMaximumWidth(toolBoxSubWidgetsWidth);
	rSmoothing->setValidator(validDouble);

	rThinning = new QLineEdit();
	rThinning->setMaximumSize(textEditSize);
	rThinning->setMaximumWidth(toolBoxSubWidgetsWidth);
	rThinning->setValidator(validDouble);
	
	/*---- Tool Box and Tool Box Widgets ----*/
	QToolBox *toolBox = new QToolBox();

	//Load
	QVBoxLayout *layoutLoad = new QVBoxLayout();
	layoutLoad->addWidget(loadButton);
	QWidget* LoadWidget = new QWidget();
	LoadWidget->setLayout(layoutLoad);
	LoadWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(LoadWidget, "Load Data");
	
	// Range Query
	QGridLayout *layoutRangeTextEdits = new QGridLayout();
	layoutRangeTextEdits->addWidget(minXRange,0,0,0);
	layoutRangeTextEdits->addWidget(maxXRange,0,1,0);
	layoutRangeTextEdits->addWidget(minYRange,1,0,0);
	layoutRangeTextEdits->addWidget(maxYRange,1,1,0);
	layoutRangeTextEdits->addWidget(minZRange,2,0,0);
	layoutRangeTextEdits->addWidget(maxZRange,2,1,0);

	QWidget* RangeTextEditsWidget = new QWidget();
	RangeTextEditsWidget->setLayout(layoutRangeTextEdits);
	RangeTextEditsWidget->setFixedWidth(toolBoxSubWidgetsWidth);

	QVBoxLayout *layoutRange = new QVBoxLayout();
	layoutRange->addWidget(RangeTextEditsWidget);
	layoutRange->addWidget(rangeQueryButton);	

	QWidget* RangeWidget = new QWidget();
	RangeWidget->setLayout(layoutRange);
	RangeWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(RangeWidget, "Range Query");

	// Radius Query
	QGridLayout *layoutRadiusTextEdits = new QGridLayout();
	layoutRadiusTextEdits->addWidget(xRadius, 0, 0, 0);
	layoutRadiusTextEdits->addWidget(yRadius, 0, 1, 0);
	layoutRadiusTextEdits->addWidget(zRadius, 0, 3, 0);
	layoutRadiusTextEdits->addWidget(rRadius, 1, 1, 0);

	QWidget* RadiusTextEditsWidget = new QWidget();
	RadiusTextEditsWidget->setLayout(layoutRadiusTextEdits);
	RadiusTextEditsWidget->setFixedWidth(toolBoxSubWidgetsWidth);

	QVBoxLayout *layoutRadius = new QVBoxLayout();
	layoutRadius->addWidget(RadiusTextEditsWidget);
	layoutRadius->addWidget(radiusQueryButton);

	QWidget* RadiusWidget = new QWidget();
	RadiusWidget->setLayout(layoutRadius);
	RadiusWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(RadiusWidget, "Radius Query");

	// NN Query
	QGridLayout *layoutNNTextEdits = new QGridLayout();
	layoutNNTextEdits->addWidget(xNeighbour, 0, 0, 0);
	layoutNNTextEdits->addWidget(yNeighbour, 0, 1, 0);
	layoutNNTextEdits->addWidget(zNeighbour, 0, 3, 0);

	QWidget* NNTextEditsWidget = new QWidget();
	NNTextEditsWidget->setLayout(layoutNNTextEdits);
	NNTextEditsWidget->setFixedWidth(toolBoxSubWidgetsWidth);

	QVBoxLayout *layoutNN = new QVBoxLayout();
	layoutNN->addWidget(NNTextEditsWidget);
	layoutNN->addWidget(nnQueryButton);

	QWidget* NNWidget = new QWidget();
	NNWidget->setLayout(layoutNN);
	NNWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(NNWidget, "Nearest Neighbour");

	// Thinning
	QVBoxLayout *layoutThinning = new QVBoxLayout();
	layoutThinning->addWidget(rThinning);
	layoutThinning->addWidget(thinningButton);
	
	QWidget* ThinningWidget = new QWidget();
	ThinningWidget->setLayout(layoutThinning);
	ThinningWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(ThinningWidget, "Thinning");

	// Smoothing
	QVBoxLayout *layoutSmoothing = new QVBoxLayout();
	layoutSmoothing->addWidget(rSmoothing);
	layoutSmoothing->addWidget(smoothingButton);

	QWidget* SmoothingWidget = new QWidget();
	SmoothingWidget->setLayout(layoutSmoothing);
	SmoothingWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(SmoothingWidget, "Smoothing");

	// Fitting
	QVBoxLayout *layoutFitting = new QVBoxLayout();
	layoutFitting->addWidget(labelFitting);
	layoutFitting->addWidget(planeFittingButton);
	layoutFitting->addWidget(lineFittingButton);
	layoutFitting->addWidget(sphereFittingButton);

	QWidget* FittingWidget = new QWidget();
	FittingWidget->setLayout(layoutFitting);
	FittingWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(FittingWidget, "Fitting");

	// Color
	QVBoxLayout *layoutColorByDist = new QVBoxLayout();
	layoutColorByDist->addWidget(distanceColorMapButton);

	QWidget* ColorByDistWidget = new QWidget();
	ColorByDistWidget->setLayout(layoutColorByDist);
	ColorByDistWidget->setFixedWidth(toolBoxWidgetsWidth);
	toolBox->addItem(ColorByDistWidget, "Color by Distance");

	/*---- Data Group Box ----*/
	QGroupBox *dataBox = new QGroupBox(tr("Data"));
	QVBoxLayout *layoutDataBox = new QVBoxLayout;
	layoutDataBox->addWidget(labelPoints);
	layoutDataBox->addWidget(labelCloudBounds);
	dataBox->setLayout(layoutDataBox);

	/*---- Side Bar ----*/
	QVBoxLayout *layoutSideBar = new QVBoxLayout();

	layoutSideBar->addWidget(dataBox);
	layoutSideBar->addWidget(toolBox);
	layoutSideBar->addWidget(labelTime);
	
	QWidget* sideBarWidget = new QWidget();
	sideBarWidget->setLayout(layoutSideBar);
	sideBarWidget->setFixedWidth(toolBoxWidth);
	
	/*---- Main Widget ----*/
	glWidget = new MainGLWidget();
	glWidget->resize(windowWidth, windowHeight);
	glWidget->setMinimumWidth(windowWidth);
	glWidget->setMinimumHeight(windowHeight);

	QHBoxLayout *layoutMain = new QHBoxLayout();
	layoutMain->addWidget(glWidget);
	layoutMain->addWidget(sideBarWidget);

	setLayout(layoutMain);
}
Example #12
0
	std::vector<Point> readAndScalePoints(std::ifstream &in) {
		cv::Rect *rect = getSecondMonitorGeometry();

		return scaled(loadPoints(in), rect->width, rect->height);
	}