wxDefaultSize,
wxNB_TOP );
panel2 = new wxPanel(bookGroupManager);
- cbVisuActualCollection = new wxCheckBox ( panel2,-1, _T("A.V.") , wxDefaultPosition, sizeButton );
+ cbVisuActualCollection = new wxCheckBox ( panel2,-1, _T("Cur.") , wxDefaultPosition, sizeButton );
txtNrCollections = new wxStaticText ( panel2,-1, _T(" 1/1 "));
wxButton *btnBackCollection = new wxButton ( panel2, -1, _T("<") , wxDefaultPosition, sizeButton );
wxButton *btnNextCollection = new wxButton ( panel2, -1, _T(">") , wxDefaultPosition, sizeButton );
wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
- cbVisuActualCollection -> SetToolTip( _T("Visu actual collection") );
+ cbVisuActualCollection -> SetToolTip( _T("Current group") );
btnInsertCollectionBefore -> SetToolTip( _T("+ Add group before") );
btnInsertCollectionAfter -> SetToolTip( _T("+> Add group after") );
btnDeleteCollection -> SetToolTip( _T("- Erase group") );
StopAutoAddPoints();
StopTrackPoint();
+
if (GetViewShowNPoints()->renderer==NULL)
{
return;
}
+ UndoRedo_SaveCollection(); //A
std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
if (point.size()==3)
{
}
RefreshCollectionText();
RefreshColourCollection();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
//------------------------------------------------------------------------
std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
if (point.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();
+ UndoRedo_SaveCollection(); //B
} else {//mpoint.size
printf("creaMaracasVisu::ShowNPoints (not match point) \n");
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnSetPoint_()
{
+ UndoRedo_SaveCollection(); //A
+
StopAutoAddPoints();
StopTrackPoint();
RefreshCollectionText();
RefreshColourCollection();
SetOutputBox();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
//------------------------------------------------------------------------
if (dataArrayNormals!=NULL)
{
dataArrayNormals->GetTuple(idMeshPoint, normal);
-
int direction = step;
// pN[0] = p[0] / spc[0] + direction*normal[0];
// pN[1] = p[1] / spc[1] + direction*normal[1];
pN[0] = x + (direction * normal[0]);
pN[1] = y + (direction * normal[1]);
pN[2] = z + (direction * normal[2]);
+ UndoRedo_SaveCollection(); //A
GetModelShowNPoints()->SetPointById(idControlPoint, pN);
// GetViewShowNPoints()->RefreshPoint(idControlPoint);
// RefreshCollectionText();
// RefreshColourCollection();
// SetOutputBox();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
} else {
printf("Error! WidgetShowNPoints::MovePoint_ Missing normals in aux_mesh \n");
}
v[1] = 0;
v[2] = 0;
}// if mag
+ UndoRedo_SaveCollection(); //A
point.push_back( p[0] + step*v[0] );
point.push_back( p[1] + step*v[1] );
point.push_back( p[2] + step*v[2] );
GetModelShowNPoints()->SetPointById(id,point);
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
} // if id
} // if aux_mesh
RefreshCollectionText();
if (idTrack>=0)
{
+ UndoRedo_SaveCollection(); //A
GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
RefreshCollectionText();
// GetViewShowNPoints()->RefreshPoint(idTrack);
// GetViewShowNPoints()->Render();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
} // if id
} // if trackPointFlag
}
// EED 2022-05-19
//lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) );
//renderer->GetRenderWindow()->Render();
+ UndoRedo_SaveCollection(); //A
GetViewShowNPoints()->lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) );
GetViewShowNPoints()->Render();
SetOutputBox();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
} // if id
}
StopTrackPoint();
//ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
+ UndoRedo_SaveCollection(); //A
if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true)
{
SetOutputBox();
RefreshCollectionText();
RefreshColourCollection();
StopTrackPoint();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
}
StopAutoAddPoints();
StopTrackPoint();
+ UndoRedo_SaveCollection(); //A
int id = GetViewShowNPoints()->lstActorsSphere.size()-1;
ErasePoint( id );
RefreshCollectionText();
RefreshColourCollection();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
GetViewShowNPoints()->Render();
SetOutputBox();
StopTrackPoint();
StopAutoAddPoints();
StopTrackPoint();
+ UndoRedo_SaveCollection(); //A
DeleteAllPoints_();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void WidgetShowNPoints::OnInsertCollectionBefore_()
{
+ UndoRedo_SaveCollection(); //A
InsertCollectionBefore_();
CreatePointsIntoNewCollection();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnInsertCollectionAfter_()
{
+ UndoRedo_SaveCollection(); //A
InsertCollectionAfter_();
CreatePointsIntoNewCollection();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void WidgetShowNPoints::OnDeleteCollection_()
{
+ UndoRedo_SaveCollection(); //A
DeleteCollection_();
SetOutputBox();
GetViewShowNPoints()->Render();
RefreshCollectionText();
RefreshColourCollection();
StopTrackPoint();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void WidgetShowNPoints::OnResetCollections_()
{
+ UndoRedo_SaveCollection(); //A
ResetCollections_();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); //B
}
RefreshCollectionText();
RefreshColourCollection();
StopTrackPoint();
- UndoRedo_SaveCollection();
+// UndoRedo_SaveCollection();
}
//------------------------------------------------------------------------
RefreshCollectionText();
RefreshColourCollection();
StopTrackPoint();
- UndoRedo_SaveCollection();
+// UndoRedo_SaveCollection();
}
//------------------------------------------------------------------------
RefreshColourCollection();
}
+
+
+
//------------------------------------------------------------------------
void WidgetShowNPoints::RefreshColourCollection()
{
UpdatePoints_();
std::vector<double> colourAll;
- colourAll.push_back(1);
- colourAll.push_back(0);
colourAll.push_back(0);
+ colourAll.push_back(1);
+ colourAll.push_back(1);
std::vector<double> colourActualGroup;
colourActualGroup.push_back(1);
- colourActualGroup.push_back(1);
colourActualGroup.push_back(0);
-
+ colourActualGroup.push_back(0);
// For all collections
SetColour( colourAll );
- int i,size=lstViewShowNPoints.size();
- for (i=0;i<size;i++)
+ int sizeLstPoints;
+ int iCollection,sizeLstCollection=lstViewShowNPoints.size();
+ for ( iCollection=0 ; iCollection<sizeLstCollection ; iCollection++ )
{
- lstViewShowNPoints[i] -> mcolour = colourAll;
- lstViewShowNPoints[i] -> ratioRadio = 1;
- if ((cbVisuActualCollection!=NULL) && (cbVisuActualCollection->GetValue()==true))
+ if (iCollection==mActualCollection)
{
- lstViewShowNPoints[i] -> mopacity = 0.0;
+ // Actual collection
+ lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
+ lstViewShowNPoints[mActualCollection] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
+ lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.2;
+ lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
+
+ //Actual Point
+ int curPnt = lstModelShowNPoints[mActualCollection]->GetIdCurrentPoint();
+ sizeLstPoints = lstModelShowNPoints[mActualCollection]->GetLstPointsSize();
+ if ((curPnt>=0) && (curPnt<sizeLstPoints ) )
+ {
+ std::vector<double> colourActualPoint;
+ colourActualPoint.push_back(1);
+ colourActualPoint.push_back(1);
+ colourActualPoint.push_back(0);
+ double radio = GetModelShowNPoints()->GetRadio();
+ lstViewShowNPoints[mActualCollection] -> mcolour = colourActualPoint;
+ lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt );
+ lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
+ } // if
+ lstViewShowNPoints[mActualCollection]->TryToShowActorsInRender(true);
} else {
- lstViewShowNPoints[i] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
- }
- lstViewShowNPoints[i]->RefreshEachPoint();
+ lstViewShowNPoints[iCollection] -> mcolour = colourAll;
+ lstViewShowNPoints[iCollection] -> ratioRadio = 1;
+ if ((cbVisuActualCollection!=NULL) && (cbVisuActualCollection->GetValue()==true))
+ {
+ lstViewShowNPoints[iCollection]->TryToShowActorsInRender(false);
+ // lstViewShowNPoints[i] -> mopacity = 0.0;
+ } else {
+ lstViewShowNPoints[iCollection]->TryToShowActorsInRender(true);
+ // lstViewShowNPoints[i] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
+ }
+ lstViewShowNPoints[iCollection]->RefreshEachPoint();
+ }// if mActualCollection
} // for i
-
- // Actual collection
- lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
- lstViewShowNPoints[mActualCollection] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
- lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.1;
- lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
-
- //Actual Point
- int curPnt = lstModelShowNPoints[mActualCollection] -> GetIdCurrentPoint();
- size=lstModelShowNPoints[mActualCollection]->GetLstPointsSize();
- if ((curPnt>=0) && (curPnt<size ) )
- {
- std::vector<double> colourActualPoint;
- colourActualPoint.push_back(0);
- colourActualPoint.push_back(0);
- colourActualPoint.push_back(1);
- double radio = GetModelShowNPoints()->GetRadio();
- lstViewShowNPoints[mActualCollection] -> mcolour = colourActualPoint;
- lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt );
- lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
- } // if
lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render();
}
}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnSaveCollectionsIdsCurrent_( std::string filename )
+{
+ FILE *ff;
+ ff = fopen( filename.c_str() , "w+" );
+ if (ff!=NULL)
+ {
+ int i,size = lstModelShowNPoints.size();
+ fprintf(ff,"ActualCollection %d \n",mActualCollection);
+ fprintf(ff,"NumberOfGroups %d \n",size);
+ for (i=0 ; i<size ; i++)
+ {
+ fprintf(ff,"CurrentIdPoint %d \n",lstModelShowNPoints[i]->GetIdCurrentPoint());
+ } // for i
+ fclose(ff);
+ } else { // else ff
+ printf("WidgetShowNPoints::Save Groups Points ...Error... creating file \n");
+ } //ff
+}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnSaveCollections(wxCommandEvent &event)
StopTrackPoint();
}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnLoadCollectionsIdsCurrent_( std::string filename )
+{
+ FILE *ff = fopen( filename.c_str() , "r+" );
+ int iGroup,sizeGroups;
+ int IdCurrentPoint;
+ char chartmp[256];
+ fscanf(ff," %s %d",chartmp,&mActualCollection); // ActualCollection
+ fscanf(ff," %s %d",chartmp,&sizeGroups); // NumberOfGroups
+ for (iGroup=0;iGroup<sizeGroups;iGroup++)
+ {
+ fscanf(ff," %s %d",chartmp,&IdCurrentPoint); // CurrentPointId
+ lstModelShowNPoints[iGroup]->SetIdCurrentPoint( IdCurrentPoint );
+ } // for iGroup
+
+ GetViewShowNPoints()->Render();
+ RefreshCollectionText();
+ RefreshColourCollection();
+
+}
+
+
+
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnLoadCollections(wxCommandEvent &event)
{
if (FD->GetReturnCode()==wxID_OK)
{
std::string filename= (const char*) ( FD->GetPath().mb_str() );
+ UndoRedo_SaveCollection(); // A
OnLoadCollections_( filename );
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); // B
} // dialog box
}
//------------------------------------------------------------------------
void WidgetShowNPoints::OnInvertLstPoints_()
{
+ UndoRedo_SaveCollection(); // A
StopAutoAddPoints();
StopTrackPoint();
InvertLstPoints_();
SetOutputBox();
- UndoRedo_SaveCollection();
+ UndoRedo_SaveCollection(); // B
}
idUndoRedo=-1;
} else {
OnLoadCollections_( GetUndoRedoFileName() );
+ OnLoadCollectionsIdsCurrent_( GetUndoRedoFileName()+".current" );
}// if idUndoRedo
idUndoRedo++;
} else {
ResetCollections_();
OnLoadCollections_( GetUndoRedoFileName() );
+ OnLoadCollectionsIdsCurrent_( GetUndoRedoFileName()+".current" );
idUndoRedo++;
}// if idUndoRedo
}
void WidgetShowNPoints::UndoRedo_SaveCollection()
{
OnSaveCollections_( GetUndoRedoFileName() );
+ OnSaveCollectionsIdsCurrent_( GetUndoRedoFileName()+".current" );
maxUndoRedo = idUndoRedo;
idUndoRedo++;
}