formcoord.h

Go to the documentation of this file.
00001 /** 
00002  * \file mgui/formcoord.h 
00003  * \brief Definitions for MGUI::FORM_EDIT_COORD class.
00004  *
00005  * \if NODOC
00006  * $Id: formcoord.h_v 1.1 2004/09/10 19:25:40 dwilliss Exp $
00007  *
00008  * $Log: formcoord.h_v $
00009  * Revision 1.1  2004/09/10 19:25:40  dwilliss
00010  * Initial revision
00011  *
00012  * \endif
00013 **/
00014 
00015 #ifndef  INC_MGUI_FORM_EDIT_COORD_H
00016 #define  INC_MGUI_FORM_EDIT_COORD_H
00017 
00018 #ifndef INC_MGUI_FORM_H
00019 #include <mgui/form.h>
00020 #endif
00021 
00022 #ifndef  INC_MGUI_CTRL_H
00023 #include <mgui/ctrl.h>
00024 #endif
00025 
00026 #ifndef  INC_MGUI_FORMBTXT_H
00027 #include <mgui/formbtxt.h>
00028 #endif
00029 
00030 #ifndef  INC_MGUI_COMBOBOX_H
00031 #include <mgui/combobox.h>
00032 #endif
00033 
00034 #ifndef  INC_MI32_SPATREF_H
00035 #include <mi32/spatref.h>
00036 #endif
00037 
00038 namespace MGUI {
00039 
00040 //:>===================================================================================================================
00041 //! Form consisting of label and edit fields for editing a single coordinate
00042 class FORM_EDIT_COORD : public MGUI::FORM_COMPOSITE {
00043    public:
00044 
00045       //! Constructor.
00046       FORM_EDIT_COORD (
00047          );
00048 
00049       //! Destructor.
00050       virtual ~FORM_EDIT_COORD (
00051          );
00052 
00053       //! Clear range edit controls.
00054       void Clear (
00055          bool notify = true
00056          );
00057 
00058       //! Create form with label from resource lookup.
00059       void Create (
00060          MGUI::LAYOUT_PANE_BASE& ParentPane,    //!< Parent pane
00061          MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize
00062          );
00063 
00064       //! Get the extents of the form
00065       const DPOINT3D& GetValue (
00066          ) const { return (m_Point); }
00067          
00068       //! Get the projection to use for extents selection.
00069       const SPATREF::COORDREFSYS& GetCoordRefSys (
00070          ) const { return (m_CoordRefSys); }
00071 
00072       //! Determine if user has entered values for both x and y (and z if enabled)
00073       bool HasValues (
00074          );
00075 
00076       //! Set the coordinate of the form
00077       //! Do this after the call to SetProjection() or the call to the method will alter the point
00078       void SetValue (
00079          const DPOINT2D& Point,
00080          bool notify = true
00081          );
00082 
00083       //! Set the coordinate of the form
00084       //! Do this after the call to SetProjection() or the call to the method will alter the point
00085       void SetValue (
00086          const DPOINT3D& Point,
00087          bool notify = true
00088          );
00089 
00090       //! Set the projection to use for coordinate selection.
00091       //! If a projection and value coordinates exists, the coordinate will be converted to the new projection
00092       void SetCoordRefSys (
00093          const SPATREF::COORDREFSYS& CoordRefSys,
00094          bool notify = true
00095          );
00096 
00097 
00098    private:
00099       #ifndef GENERATING_DOXYGEN_OUTPUT
00100       SPATREF::COORDREFSYS m_CoordRefSys;
00101       DPOINT3D m_Point;
00102       bool m_bIs3D;
00103       
00104       LAYOUT_PANE m_XPane;
00105       CTRL_LABEL m_XLabel;
00106       CTRL_EDIT_NUMBER_T<FORM_EDIT_COORD> m_XPrompt;
00107       
00108       LAYOUT_PANE m_YPane;
00109       CTRL_LABEL m_YLabel;
00110       CTRL_EDIT_NUMBER_T<FORM_EDIT_COORD> m_YPrompt;
00111       
00112       LAYOUT_PANE m_ZPane;
00113       CTRL_LABEL m_ZLabel;
00114       CTRL_EDIT_NUMBER_T<FORM_EDIT_COORD> m_ZPrompt;
00115       
00116       virtual void v_OnChangeValue ();
00117 
00118       void OnValueChanged ();
00119       void UpdateProjection ();
00120       #endif // GENERATING_DOXYGEN_OUTPUT
00121    };
00122 
00123 //:>-------------------------------------------------------------------------------------------------------------------
00124 // Convenience template for FORM_EDIT_COORD to allow method in container class to be called.
00125 template <class _CT> class FORM_EDIT_COORD_T : public MGUI::FORM_EDIT_COORD {
00126    public:
00127 
00128       //! Constructor.
00129       explicit FORM_EDIT_COORD_T (
00130          _CT *pContainer
00131          ): m_pContainer(pContainer), m_pfOnChangeValue(0), m_pfOnChangeCoordRefSys(0) 
00132          { }
00133 
00134       //! Set container pointer.
00135       //! Container may also be specified in constructor.
00136       void SetContainer (
00137          _CT *pContainer
00138          ) { m_pContainer = pContainer; }
00139 
00140       //! Set container method to call for OnChangeValue().
00141       void SetFuncChangePoint (
00142          void (_CT::*pfOnChangeValue)()
00143          ) { m_pfOnChangeValue = pfOnChangeValue; };
00144 
00145       //! Set container method to call for OnChangeProjection()
00146       void SetFuncChangeCoordRefSys (
00147          void (_CT::*pfOnChangeCoordRefSys)()
00148          ) { m_pfOnChangeCoordRefSys = pfOnChangeCoordRefSys; };
00149 
00150    private:
00151 
00152       #ifndef GENERATING_DOXYGEN_OUTPUT
00153       _CT *m_pContainer;
00154       void (_CT::*m_pfOnChangeValue)();
00155       void (_CT::*m_pfOnChangeCoordRefSys)();
00156 
00157       virtual void v_OnChangeValue (
00158          ) { if (m_pfOnChangeValue != 0) (m_pContainer->*m_pfOnChangeValue)(); }
00159 
00160       virtual void v_OnChangeCoordRefSys (
00161          ) { if (m_pfOnChangeCoordRefSys != 0) (m_pContainer->*m_pfOnChangeCoordRefSys)(); }
00162       #endif // GENERATING_DOXYGEN_OUTPUT
00163    };
00164 
00165 }  // End of MGUI namespace
00166 
00167 #endif      // INC_MGUI_FORM_COORD_H

Generated on Tue Dec 14 13:18:17 2004 for TNTsdk by  doxygen 1.3.8-20040913