#include <wx/button.h>
-#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
wxButton *btnInsertPoint = new wxButton( panel, -1, _T("Insert Point"));//CFT
wxButton *btnSetPositionPoint= new wxButton( panel, -1, _T("Set nearest point"));
- wxCheckBox *chkBox = new wxCheckBox(panel, -1, _T("Track Point") );
+ cbTrackPoint = new wxCheckBox(panel,-1, _T("Track Point") );
wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Rename point"));
wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("Erase Last point"));
wxButton *btnErasePoint = new wxButton( panel, -1, _T("Erase point"));
Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
+ Connect(cbTrackPoint->GetId() , wxEVT_CHECKBOX , (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint);
wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
sizer1->Add(textCtrl);
sizer1->Add(btnAddPoint);
sizer1->Add(btnInsertPoint);//CFT
- sizer1->Add(chkBox);
+ sizer1->Add(cbTrackPoint);
sizer1->Add(btnSetPositionPoint);
sizer1->Add(btnRenamePoint);
sizer1->Add(btnErasePoint);
} // dialog box
}
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
{
} // if id
SetOutputBox();
}
-
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
+{
+ idTrack = -1;
+// trackPointFlag = cbTrackPoint->GetValue();
+ if ( cbTrackPoint->GetValue() == true )
+ {
+ idTrack = GetModelShowNPoints()->IdInsidePoint();
+ } // if trackPointFlag
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::TrackPoint( )
+{
+ if ( cbTrackPoint->GetValue() == true )
+ {
+ int id = GetModelShowNPoints()->IdInsidePoint();
+ if (id>=0)
+ {
+ idTrack=id;
+ }
+
+ if (idTrack>=0)
+ {
+ GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
+ GetViewShowNPoints()->RefreshPoint(idTrack);
+ GetViewShowNPoints()->Render();
+ } // if id
+ } // if trackPointFlag
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::StopTrackPoint( )
+{
+ cbTrackPoint->SetValue(false);
+ idTrack=-1;
+}
+
+
//------------------------------------------------------------------------
void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
{
// EED 2022-05-19
//renderer->GetRenderWindow()->Render();
GetViewShowNPoints()->Render();
+ StopTrackPoint();
}
//------------------------------------------------------------------------
ErasePoint( id );
GetViewShowNPoints()->Render();
SetOutputBox();
+ StopTrackPoint();
}
//------------------------------------------------------------------------
{
InsertCollection();
RefreshColourCollection();
+ StopTrackPoint();
}
//------------------------------------------------------------------------
mActualCollection++;
InsertCollection();
RefreshColourCollection();
+ StopTrackPoint();
}
//------------------------------------------------------------------------
DeleteCollection_();
RefreshCollectionText();
RefreshColourCollection();
+ StopTrackPoint();
}
//------------------------------------------------------------------------
} //if <=0
RefreshCollectionText();
RefreshColourCollection();
+ StopTrackPoint();
}
//------------------------------------------------------------------------
} //if <=0
RefreshCollectionText();
RefreshColourCollection();
+ StopTrackPoint();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::DetectCollectionActive()
+{
+ int id;
+ int i,size=lstModelShowNPoints.size();
+ for (i=0;i<size;i++)
+ {
+ id = lstModelShowNPoints[i]->IdInsidePoint();
+ if (id>=0)
+ {
+ mActualCollection=i;
+ } // if id>=0
+ } // for i
+ RefreshCollectionText();
+ RefreshColourCollection();
}
//------------------------------------------------------------------------
} // dialog box
+ StopTrackPoint();
}
RefreshCollectionText();
RefreshColourCollection();
} // dialog box
+ StopTrackPoint();
}