- added the possibility to choose between the construction of a polyline or a spline.
- added a step to remove double points when building the contours.
-> most of the problem I noticed previously in contours disappear.
This commit is contained in:
gdd 2011-10-19 13:24:50 +00:00
parent defe9b3d2a
commit 71206bf1b7
2 changed files with 46 additions and 16 deletions

View File

@ -161,6 +161,13 @@ EntityGUI_FeatureDetectorDlg::EntityGUI_FeatureDetectorDlg( GeometryGUI* theGeom
mySelectGrpLayout->addWidget(mySnapshotLabel, 1, 1); mySelectGrpLayout->addWidget(mySnapshotLabel, 1, 1);
mySelectGrpLayout->addWidget(myPushButton, 1, 0); mySelectGrpLayout->addWidget(myPushButton, 1, 0);
myOutputGroup = new DlgRef_3Radio(centralWidget());
myOutputGroup->GroupBox1->setTitle(tr("GEOM_DETECT_OUTPUT"));
myOutputGroup->RadioButton2->setText(tr( "GEOM_POLYLINE" ));
myOutputGroup->RadioButton1->setText(tr( "GEOM_SPLINE"));
myOutputGroup->RadioButton3->hide();
// NOTE what follows is mostly unuseful but is kept until end of development as code examples
myCoordGrp1 = new QGroupBox(tr("GEOM_SCALING"), centralWidget()); myCoordGrp1 = new QGroupBox(tr("GEOM_SCALING"), centralWidget());
QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp1); QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp1);
@ -224,6 +231,7 @@ EntityGUI_FeatureDetectorDlg::EntityGUI_FeatureDetectorDlg( GeometryGUI* theGeom
layout->addWidget( myCoordGrp1); layout->addWidget( myCoordGrp1);
layout->addWidget( myViewGroup); layout->addWidget( myViewGroup);
layout->addWidget( mySelectionGroup); layout->addWidget( mySelectionGroup);
layout->addWidget( myOutputGroup);
// mainFrame()->GroupBoxName->hide(); // mainFrame()->GroupBoxName->hide();
@ -297,6 +305,7 @@ void EntityGUI_FeatureDetectorDlg::Init()
resize(100,100); resize(100,100);
myViewGroup->RadioButton1->setChecked(true); myViewGroup->RadioButton1->setChecked(true);
myOutputGroup->RadioButton1->setChecked(true);
gp_Pnt aOrigin = gp_Pnt(0, 0, 0); gp_Pnt aOrigin = gp_Pnt(0, 0, 0);
gp_Dir aDirZ = gp_Dir(0, 0, 1); gp_Dir aDirZ = gp_Dir(0, 0, 1);
@ -745,24 +754,44 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects )
// double z = aContourPnt.Z(); // double z = aContourPnt.Z();
// When using the new way with textures on shapes we just have to do the following // When using the new way with textures on shapes we just have to do the following
// double pnt_array[] = {it->x,it->y}; // TEST pour éviter les points doubles
// std::vector<int> pnt (pnt_array, pnt_array + sizeof(pnt_array) / sizeof(double) ); int pnt_array[] = {it->x,it->y};
// std::vector<int> pnt (pnt_array, pnt_array + sizeof(pnt_array) / sizeof(int) );
// pnt_it=existing_points.insert(pnt);
// if (pnt_it.second == true) MESSAGE("pnt[x] = "<<pnt[0]<<",pnt[y] = "<<pnt[1])
// {
// MESSAGE("point absent du contour insere") pnt_it=existing_points.insert(pnt);
double x = -0.5*width + it->x; if (pnt_it.second == true)
double y = 0.5 *height - it->y; {
double z = 0; MESSAGE("point absent du contour insere")
aGeomContourPnt = aBasicOperations->MakePointXYZ( x,y,z ); //fin TEST
geomContourPnts[j] = aGeomContourPnt; double x = -0.5*width + it->x;
j++; double y = 0.5 *height - it->y;
// } double z = 0;
aGeomContourPnt = aBasicOperations->MakePointXYZ( x,y,z );
geomContourPnts->length( j+1 );
geomContourPnts[j] = aGeomContourPnt;
j++;
}
else
{
MESSAGE("point deja insere")
}
} }
// GEOM::GEOM_Object_var aWire = aCurveOperations->MakePolyline(geomContourPnts.in(), false);
GEOM::GEOM_Object_var aWire;
if(myOutputGroup->RadioButton2->isChecked())
{
aWire = aCurveOperations->MakePolyline(geomContourPnts.in(), false);
// GEOM::GEOM_Object_var aContourCompound = aShapesOperations->MakeCompound(geomContourPnts); // GEOM::GEOM_Object_var aContourCompound = aShapesOperations->MakeCompound(geomContourPnts);
GEOM::GEOM_Object_var aWire = aCurveOperations->MakeSplineInterpolation(geomContourPnts.in(), false, false); }
else if(myOutputGroup->RadioButton1->isChecked())
{
aWire = aCurveOperations->MakeSplineInterpolation(geomContourPnts.in(), false, false);
}
else
return res;
if ( !aWire->_is_nil() ) if ( !aWire->_is_nil() )
{ {
geomContours->length(contourCount + 1); geomContours->length(contourCount + 1);

View File

@ -113,6 +113,7 @@ private:
QPushButton* myPushButton2; QPushButton* myPushButton2;
DlgRef_3Radio* myViewGroup; DlgRef_3Radio* myViewGroup;
DlgRef_3Radio* myOutputGroup;
QButtonGroup* myViewButtonGroup; QButtonGroup* myViewButtonGroup;
}; };