//------------------------------------------------------------------------
void WidgetShowNPoints::OnAddPoint__()
-{
+{
// EED 2022-05-19
//if (this->renderer==NULL)
if (GetViewShowNPoints()->renderer==NULL)
{
return;
}
- std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
- if (point.size()==3)
+ std::vector<double> refPoint = GetModelShowNPoints()->GetReferencePoint();
+ if (refPoint.size()==3)
{
- UndoRedo_SaveCollection(); //A
- AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
- SetOutputBox();
- // EED 2022-05-19
- //renderer->GetRenderWindow()->Render();
- GetViewShowNPoints()->Render();
- UndoRedo_SaveCollection(); //B
+ std::vector<double> lastPoint;
+ bool ok = true;
+ int lastId = GetModelShowNPoints()->GetLstPointsSize()-1;
+ if (lastId>=0)
+ {
+ lastPoint=GetModelShowNPoints()->GetPointById( lastId );
+ if (lastPoint.size()==3) printf("WidgetShowNPoints::OnAddPoint__ lastPoint %f %f %f\n" , lastPoint[0],lastPoint[1],lastPoint[2] );
+ if ((lastPoint[0]==refPoint[0]) && (lastPoint[1]==refPoint[1]) && (lastPoint[2]==refPoint[2]))
+ {
+ ok=false;
+ } // if lastPoint == refPoint
+ } // if lastId
+ if (ok==true)
+ {
+ UndoRedo_SaveCollection(); //A
+ AddPoint(refPoint[0],refPoint[1],refPoint[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
+ SetOutputBox();
+ // EED 2022-05-19
+ //renderer->GetRenderWindow()->Render();
+ GetViewShowNPoints()->Render();
+ UndoRedo_SaveCollection(); //B
+ } // if ok
} else {//mpoint.size
- printf("creaMaracasVisu::ShowNPoints (not match point) \n");
+ printf("creaMaracasVisu::ShowNPoints OnAddPoint__ (not match point) \n");
}
}