#include "WidgetShowNPoints.h"
+#include <creaContoursFactory.h>
+
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//------------------------------------------------------------------------
void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label)
{
+ printf("WidgetShowNPoints::AddPoint 0 model=%p\n", GetModelShowNPoints() );
GetModelShowNPoints()->AddPoint(x,y,z, label );
// EED 2022-05-19
//AddVtkPoint();
//RefreshPoint(lstActorsSphere.size()-1);
+ printf("WidgetShowNPoints::AddPoint 1 view=%p\n", GetViewShowNPoints() );
GetViewShowNPoints()->AddPoint();
+ printf("WidgetShowNPoints::AddPoint 2\n");
}
//------------------------------------------------------------------------
{
ModelShowNPoints* model = new ModelShowNPoints();
ViewShowNPoints* view = new ViewShowNPoints( model );
+ view->mopacity = lstViewShowNPoints[0]->mopacity;
+ view->renderer = lstViewShowNPoints[0]->renderer;
model->SetImage( lstModelShowNPoints[0]->GetImage() );
- view->mopacity = lstViewShowNPoints[0]->mopacity;
- view->renderer = lstViewShowNPoints[0]->renderer;
lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model );
lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view );
}
//------------------------------------------------------------------------
-void WidgetShowNPoints::InsertCollectionBefore_()
+void WidgetShowNPoints::InsertCollectionBefore_()
{
InsertCollection();
RefreshCollectionText();
void WidgetShowNPoints::OnInsertCollectionBefore_()
{
InsertCollectionBefore_();
+ CreatePointsIntoNewCollection();
UndoRedo_SaveCollection();
}
StopTrackPoint();
}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnInsertCollectionAfter_()
{
InsertCollectionAfter_();
+ CreatePointsIntoNewCollection();
UndoRedo_SaveCollection();
}
OnInsertCollectionAfter_();
}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::CreatePointsIntoNewCollection()
+{
+ // ---------------------------------------------
+ printf("\nWidgetShowNPoints::InsertCollection mActualCollection=%d\n",mActualCollection);
+ int c1 = mActualCollection-1;
+ int c2 = mActualCollection+1;
+ if (c2==lstModelShowNPoints.size()) { c2=0; }
+ if ((c1>=0) && (c1!=c2) )
+ {
+ std::vector<double> c1LstX = lstModelShowNPoints[c1]->GetLstPointsX();
+ std::vector<double> c1LstY = lstModelShowNPoints[c1]->GetLstPointsY();
+ std::vector<double> c1LstZ = lstModelShowNPoints[c1]->GetLstPointsZ();
+ std::vector<double> c2LstX = lstModelShowNPoints[c2]->GetLstPointsX();
+ std::vector<double> c2LstY = lstModelShowNPoints[c2]->GetLstPointsY();
+ std::vector<double> c2LstZ = lstModelShowNPoints[c2]->GetLstPointsZ();
+ std::vector<double> c1LstXX;
+ std::vector<double> c1LstYY;
+ std::vector<double> c1LstZZ;
+ std::vector<double> c2LstXX;
+ std::vector<double> c2LstYY;
+ std::vector<double> c2LstZZ;
+ creaContoursFactory f;
+ manualContourModel *m;
+ double x,y,z;
+ int i,size;
+ int sc; // sizeContour
+
+ if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) )
+ {
+ // ----------------- Spline 1 --------------------
+ sc = 100;
+ size = c1LstX.size();
+ m = (manualContourModel*)f.getContourModel( 1 ); // Spline
+ // m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
+ m->SetNumberOfPointsSpline( sc );
+ m->SetCloseContour( false );
+ for (i=0;i<size;i++)
+ {
+ m->AddPoint( c1LstX[i] , c1LstY[i] , c1LstZ[i] );
+ } // for
+ m->UpdateSpline();
+ for (i=0;i<sc;i++)
+ {
+ m->GetSpline_i_Point(i,&x,&y,&z);
+ c1LstXX.push_back(x);
+ c1LstYY.push_back(y);
+ c1LstZZ.push_back(z);
+ } // for
+ delete m;
+ // ----------------- Spline 2 --------------------
+ size = c2LstX.size();
+ m = (manualContourModel*)f.getContourModel( 1 ); // Spline
+ // m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
+ m->SetNumberOfPointsSpline( sc );
+ m->SetCloseContour( false );
+ for (i=0;i<size;i++)
+ {
+ m->AddPoint( c2LstX[i] , c2LstY[i] , c2LstZ[i] );
+ } // for
+ m->UpdateSpline();
+ for (i=0;i<sc;i++)
+ {
+ m->GetSpline_i_Point(i,&x,&y,&z);
+ c2LstXX.push_back(x);
+ c2LstYY.push_back(y);
+ c2LstZZ.push_back(z);
+ } // for
+ delete m;
+ // ----------------- Add new Points --------------------
+ i=0; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+// i=33; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+// i=66; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+ i=25; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+ i=50; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+ i=75; x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+ i=sc-1;x=(c1LstXX[i]+c2LstXX[i])/2; y=(c1LstYY[i]+c2LstYY[i])/2; z=(c1LstZZ[i]+c2LstZZ[i])/2; AddPoint(x,y,z,"");
+ } // if size of c1LstX c2LstX
+ } // if c1 && c2
+
+}
+
+
+
//------------------------------------------------------------------------
void WidgetShowNPoints::DeleteCollection_()
{