00001
00041 #ifndef INC_MGUI_TOOLMULTIPOINT_H
00042 #define INC_MGUI_TOOLMULTIPOINT_H
00043
00044 #ifndef INC_MGUI_TOOLGPS_H
00045 #include <mgui/toolgps.h>
00046 #endif
00047
00048 #ifndef INC_MI32_POLYLINE_H
00049 #include <mi32/polyline.h>
00050 #endif
00051
00052 namespace MGUI {
00053
00054
00055
00057 class TOOL_MULTIPOINT : public TOOL_GPS {
00058 public:
00059
00060 typedef fastdelegate::FastDelegate<bool(CHANGESEQ, DPOINT3D&)> DELEGATE_ONSETPOINT;
00061
00063 explicit TOOL_MULTIPOINT (
00064 TOOLCANVAS *canvas
00065 );
00066
00068 virtual ~TOOL_MULTIPOINT ();
00069
00071 void AddPoint (
00072 const DPOINT3D& pt,
00073 bool MakePointActive = true
00074 ) { SetPoint(m_Points.GetNumPoints(), pt, MakePointActive); }
00075
00078 void DeletePoint (
00079 int index
00080 );
00081
00083 DPOINT3D GetActivePoint (
00084 ) const { return (GetPoint(m_ActiveIndex)); }
00085
00087 int GetActivePointIndex (
00088 ) const { return (m_ActiveIndex); }
00089
00091 int GetNumPoints (
00092 ) const { return (m_Points.GetNumPoints()); }
00093
00096 DPOINT3D GetPoint (
00097 int index
00098 ) const;
00099
00101 const POLYLINE& GetPoints (
00102 ) const { return (m_Points); }
00103
00105 bool IsActiveValid (
00106 ) const { return (m_ActiveIndex >= 0 && m_ActiveIndex < m_Points.GetNumPoints()); }
00107
00109 void SetActivePointIndex (
00110 int index
00111 );
00112
00116 void SetDelegateOnSetPoint (
00117 DELEGATE_ONSETPOINT delegate
00118 ) { m_DelegateOnSetPoint = delegate; }
00119
00122 void SetMarker (
00123 MARKER marker,
00124 UINT16 size = 0
00125 );
00126
00130 void SetPoint (
00131 int index,
00132 const DPOINT3D& pt,
00133 bool MakePointActive = true
00134 );
00135
00137 void SetPoints (
00138 const POLYLINE& PointArray
00139 );
00140
00141 private:
00142
00143 #ifndef GENERATING_DOXYGEN_OUTPUT
00144
00145 enum EDITMODE {
00146 EDITMODE_Automatic,
00147 EDITMODE_Add,
00148 EDITMODE_Move,
00149 EDITMODE_Select
00150 };
00151
00152 enum ZONE {
00153 ZONE_NoFunction = 0,
00154 ZONE_Outside,
00155 };
00156
00158 MARKER m_marker;
00159 UINT16 m_markersize;
00160 EDITMODE m_EditMode;
00162 POLYLINE m_Points;
00163 int m_ActiveIndex;
00164
00165 ZONE m_CursorZone;
00166 DPOINT2D m_prevpt;
00167 bool m_NotifyChangeElem;
00169 DELEGATE_ONSETPOINT m_DelegateOnSetPoint;
00170
00172 class MANUAL_MULTIPOINT;
00173 friend class MANUAL_MULTIPOINT;
00174 class FORM_MULTIPOINT;
00175 FORM_MULTIPOINT* m_pFormMultiPoint;
00176
00178 void ActivateClosestPoint (const DPOINT2D&);
00179 void AddPoint (MGD::CONTEXT*, const DPOINT2D&);
00180 void AdjustTool (DPOINT2D&, CHANGESEQ);
00181 void ComputeCursorZone (const DPOINT2D&);
00182 void DeletePoint ();
00183 void DrawNeighborPoints (MGD::CONTEXT*, const LRECT2D&, int SkipPoint) const;
00184 void DrawPoint (MGD::CONTEXT*, int) const;
00185 void ErasePoint (MGD::CONTEXT*, bool circleonly = false) const;
00186 void SetActiveIndex (int);
00187 void UpdateCursor () const;
00188
00190 virtual MGUI::FORM* v_CreateControlForm (LAYOUT_PANE_BASE& ParentPane, CTRLOPT ctrlopt);
00191 virtual MANUAL_BASE* v_CreateManualBase ();
00192 virtual void v_DoDraw ();
00193 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00194 virtual void v_OnClear ();
00195 virtual int v_GenerateRegion (REGION2D& region) const;
00196 virtual bool v_OnKey (MGUI::POINT point, KEYCODE keycode, KEYSTATE keystate);
00197 virtual bool v_OnPointerButtonDown (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00198 virtual bool v_OnPointerButtonUp (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00199 virtual void v_OnPointerMove (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00200
00202 virtual void v_OnGPSCoordinate (const DPOINT3D& point);
00203
00204 #endif // GENERATING_DOXYGEN_OUTPUT
00205 };
00206
00207
00208
00209 }
00210
00211 #endif // INC_MGUI_TOOLMULTIPOINT_H