gre/lrmapgrd.h

Go to the documentation of this file.
00001 /**
00002  * \file lrmapgrd.h <gre/lrmapgrd.h>
00003  * \brief GRE_LAYER_MAPGRID class definitions.
00004  *
00005  * \if NODOC
00006  * $Id: lrmapgrd.h_v 1.11 2003/09/15 13:48:59 fileserver!dwilliss Exp $
00007  *
00008  * $Log: lrmapgrd.h_v $
00009  * Revision 1.11  2003/09/15 13:48:59  fileserver!dwilliss
00010  * Doxygen
00011  *
00012  * Revision 1.10  2003/07/30 15:24:23  mju
00013  * Ignore private sections.
00014  *
00015  * Revision 1.9  2003/03/10 16:09:52  mju
00016  * Save toggled tick coords.
00017  *
00018  * Revision 1.8  2003/03/10 14:34:57  mju
00019  * Use ifdef for appendpopup.
00020  *
00021  * Revision 1.7  2003/03/07 23:20:25  mju
00022  * Add ability to toggle tick colors.
00023  * Add more UTM label formats.
00024  *
00025  * Revision 1.6  2002/11/04 21:01:03  mju
00026  * Add separate control for corner coords in 2D/3D.
00027  *
00028  * Revision 1.5  2002/10/15 22:01:42  mju
00029  * Add more text formatting options.
00030  * Add option to show corner labels.
00031  * Add field for border text offset.
00032  *
00033  * Revision 1.4  2002/09/23 17:20:53  mju
00034  * Add InitExtents to DISPPARM.
00035  *
00036  * Revision 1.3  2002/09/20 17:03:19  mju
00037  * Only declare v_ControlPanel if X or MFC.
00038  *
00039  * Revision 1.1  2002/09/10 14:24:51  mju
00040  * Initial revision
00041  * \endif
00042 **/
00043 
00044 #ifndef  INC_GRE_LRMAPGRD_H
00045 #define  INC_GRE_LRMAPGRD_H
00046 
00047 #ifndef  INC_MI32_GRE_H
00048 #include <mi32/gre.h>
00049 #endif
00050 
00051 
00052 //===================================================================================================================
00053 
00054 //! GRE layer class for viewing Map Grid.
00055 class GRE_LAYER_MAPGRID : public GRE_LAYER {
00056    public:
00057 
00058       class DISPPARM : public GRE_LAYER::DISPPARM {
00059          public:
00060 
00061             class DLG;                             //!< Layer settings dialog, defined in <gre/uimapgrd.h>
00062 
00063             TEXTSTYLE CoordLabelStyle;
00064             TEXTSTYLE AxisLabelStyle;
00065             double xinterval;             //!< Interval in meters for non lat/lon projections
00066             double yinterval;
00067             double zinterval;
00068             double xdegrees;              //!< Interval to use for lat/lon (in degrees)
00069             double ydegrees;
00070             MAPPROJPARM IntervalProj;     //!< Projection of grid interval
00071             MAPPROJPARM ExtentsProj;      //!< Projection of grid extents
00072             DRECT3D MapExtents;           //!< Extents (sans ticks/text) in ExtentsProj
00073             UINT8 IntervalUnitsXY;        //!< X-Y interval units (if not lat-lon)
00074             UINT8 IntervalUnitsZ;         //!< Z interval units
00075             UINT8 IntervalLatLonFormat;   //!< Format for interval lat/lon prompts
00076             UINT8 ExtentsUnits;           //!< Units for entering extents if not lat-lon
00077             UINT8 ExtentsLatLonFormat;    //!< Format for extents lat/lon prompts
00078             LINESTYLE StyleGrid;          //!< Style for grid lines
00079             LINESTYLE StyleBorder;        //!< Style for border/neatline
00080             LINESTYLE StyleBorderTickExt; //!< Style for ticks outside border
00081             LINESTYLE StyleInteriorTick;  //!< Style for interior ticks
00082             COLOR BorderTickIntColor1;    //!< Primary color for border tick interior
00083             COLOR BorderTickIntColor2;    //!< Alternate color for border tick interior
00084             COLOR InteriorTickColor2;     //!< Alternate color for interior ticks
00085             double GridWidth;             //!< Thickness of grid lines
00086             double BorderWidth;           //!< Thickness of border
00087             double BorderTickExtWidth;    //!< Thickness of exterior border ticks
00088             double BorderTickExtLength;   //!< Outside length of border ticks
00089             double BorderTickIntWidth;    //!< Thickness of interior border ticks
00090             double BorderTickIntLength;   //!< Inside length of border ticks
00091             double InteriorTickWidth;     //!< Thickness of interior ticks
00092             double InteriorTickLength;    //!< Size of interior ticks
00093             double BorderTextOffset;      //!< Offset to border text from edge/tick endpoint
00094             double GraphicMapScale;       //!< Scale for graphics
00095             UINT8 GridWidthUnits;
00096             UINT8 BorderWidthUnits;
00097             UINT8 BorderTickExtWidthUnits;
00098             UINT8 BorderTickExtLengthUnits;
00099             UINT8 BorderTickIntWidthUnits;
00100             UINT8 BorderTickIntLengthUnits;
00101             UINT8 InteriorTickLengthUnits;
00102             UINT8 InteriorTickWidthUnits;
00103             UINT8 BorderTextOffsetUnits;
00104             UINT32 CoordFormatLatLon;     //!< Coordinate format for lat-lon
00105             UINT32 CoordFormatProj;       //!< Coordinate format for projection other than lat/lon
00106             UINT8 OldProjUnits;           //!< For old map grids used in conversion
00107             UINT8 VerticalAxes;
00108             UINT8 CoordOrient;            //!< Coordinate orientation
00109             UNICODE CoordUnitNameXY[32];
00110             UNICODE CoordUnitNameZ[32];
00111             UNICODE AxisLabelX[64];
00112             UNICODE AxisLabelY[64];
00113             UNICODE AxisLabelZ[64];
00114             DOUBLE_ARRAY<DPOINT2D> m_ToggledTickCoords;  //!< Coordinates of toggled ticks in 'extents' projection
00115 
00116             DISPPARM ();
00117             DISPPARM (const DISPPARM& rhs) { Copy(rhs); }
00118             ~DISPPARM () { Free(); }
00119 
00120             DISPPARM& operator= (
00121                const DISPPARM& rhs
00122                ) { if (this != &rhs) { Free(); Copy(rhs); } return (*this); }
00123 
00124             //! Initialize extents based on current projection and layer's group extents.
00125             //! The specified layer's group will be used to determine the extents,
00126             //! ignoring the layer itself.
00127             void InitExtents (
00128                const GRE_LAYER_MAPGRID *layer
00129                );
00130             //! Validate dispparm, adjusting if necessary.
00131             virtual ERRVALUE Validate ();
00132 
00133          protected:
00134             virtual const SERIALIZER::ITEMDEF* SerialGetItemDef (SERIALIZER& serializer) const;
00135             static int SerializerCB_TickToggledCoords (SERIALIZER& serializer, const SERIALIZER::ITEMDEF *itemdef, void *cbdata, SERIALIZER::ITEMDEF::ACTION action);
00136 
00137          private:
00138             #ifndef GENERATING_DOXYGEN_OUTPUT
00139             void Copy (const DISPPARM&);
00140             void Free ();
00141             #endif //!< GENERATING_DOXYGEN_OUTPUT
00142          };
00143 
00144       //! Construct instance of this layer type
00145       static int Construct (
00146          GRE_GROUP *group,                      //!< Group to contain layer
00147          GRE_LAYER **retlayer,                  //!< Layer returned
00148          GRE_LAYER *reflayer,                   //!< Reference layer for insertion
00149          UINT32 flags                           //!< Creation flags
00150          );
00151 
00152       //! Register this layer type
00153       static void RegisterType (
00154          );
00155 
00156       //! Install SML class, called by internal SML function.
00157       static void SMLClassInstall (
00158          SMLCONTEXT *context
00159          );
00160 
00161       //! Construct layer and insert into list
00162       explicit GRE_LAYER_MAPGRID (
00163          GRE_GROUP *group,                      //!< Group to contain layer
00164          GRE_LAYER *reflayer = 0,               //!< Reference layer for insertion
00165          UINT32 flags = MDISPCREATE_InsertAfter //!< MDISPCREATE flags
00166          );
00167 
00168       //! Destructor.
00169       virtual ~GRE_LAYER_MAPGRID ();
00170 
00171       //! Retrieve layer-specific display parameters.
00172       const DISPPARM& GetDispParm (
00173          ) const { return (m_dispparm); }
00174 
00175       //! Set layer-specific display parameters.
00176       //! This is the recommended method for changing how an existing layer is to be
00177       //! rendered.  Validation will be performed on the specified parameters and
00178       //! adjustments made to the layer's copy if necessary.  Use of this method
00179       //! usually result in a ChangeBegin / ChangeEnd message pair, and will also
00180       //! generate a ChangeObject message if the spatial object used in the layer
00181       //! is changed.
00182       ERRVALUE SetDispParm (
00183          const DISPPARM& dispparm               //!< Parameters to set
00184          );
00185 
00186    protected:
00187 
00188       DISPPARM m_dispparm;                      //!< Layer-specific display parameters
00189 
00190    private:
00191       #ifndef GENERATING_DOXYGEN_OUTPUT
00192 
00193       class PRIVDRAWDATA;
00194       friend class PRIVDRAWDATA;
00195 
00196       struct TICK {
00197          enum TYPE {
00198             TYPE_Interior =   0,
00199             TYPE_MinX =       1,
00200             TYPE_MaxX =       2,
00201             TYPE_MinY =       3,
00202             TYPE_MaxY =       4
00203             };
00204          enum FLAGS {
00205             FLAG_None =       0x00,
00206             FLAG_Lowest =     0x01,
00207             FLAG_AltColor =   0x02,
00208             FLAG_Corner =     0x04
00209             };
00210          DPOINT2D m_pt;                //!< Coordinates in "extents" projection
00211          DPOINT2D m_pt2;               //!< Secondary point for determining orientation
00212          double m_label;               //!< X or Y map coordinate for tick point label
00213          TYPE m_type;
00214          FLAGS m_flags;
00215 
00216          TICK (
00217             const DPOINT2D& pt,
00218             const DPOINT2D& pt2,
00219             TYPE type,
00220             FLAGS flags = FLAG_None,
00221             double label = 0
00222             );
00223          };
00224 
00225       TRANS2D_MAPGEN m_TransMapToExt;
00226       DRECT2D m_GridRect;
00227       DPOINT2D m_GridInterval;
00228       SIMPLE_ARRAY<TICK> m_Ticks;
00229       int m_ActiveTick;
00230       void *m_LabelList;
00231 
00232    #if defined(X_NATIVE)
00233       static void CB_ToggleTickColor (Widget, void*, void*);
00234    #endif
00235       static void SMLGET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00236       static void SMLSET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00237 
00238       ERRVALUE OnToggleTickColor ();
00239       void ReadDefaultsIni ();
00240       void SaveDefaultsIni ();
00241       ERRVALUE TickAddCornerPoints ();
00242       ERRVALUE TickAddEdgePoint (const DPOINT2D& label, const DPOINT2D& pt, const DPOINT2D& pt2, TICK::TYPE type, TICK::FLAGS flags);
00243       ERRVALUE TickCalcPoints ();
00244       ERRVALUE TickLoadToggledCoords ();
00245       ERRVALUE TickSaveToggledCoords ();
00246 
00247       //! Overrides from GRE_LAYER
00248    #if defined(X_NATIVE)
00249       virtual void v_AppendPopupMenuItems (Widget widget, const DPOINT2D *point, MENUITEMARRAY& menuitems);
00250    #endif
00251       virtual void v_ComputeMargins (double& tmargin, double& bmargin, double& lmargin, double& rmargin);
00252    #if defined(X_NATIVE) || defined(WIN32_MFC)
00253       virtual int v_ControlPanel (MDLGPARENT dlgparent, UINT32 flags = 0);
00254    #endif
00255       virtual ERRVALUE v_Draw (GRE_LAYERDC& layerdc);
00256       virtual const char* v_SerialGetTagName () const;
00257       virtual ERRVALUE v_SerialRead (SERIALIZER& serializer);
00258       virtual void v_SetDftName (bool ReplaceExisting);
00259       virtual int v_UpdateExtents (bool forceupdate);
00260 
00261       GRE_LAYER_MAPGRID (const GRE_LAYER_MAPGRID&);
00262       GRE_LAYER_MAPGRID& operator= (const GRE_LAYER_MAPGRID&);
00263 
00264       #endif //!< GENERATING_DOXYGEN_OUTPUT
00265    };
00266 
00267 #define  MAPGRIDDISPFLAG_SizeRelative        (0x00000001)   //! Sizes relative to TickScale
00268 #define  MAPGRIDDISPFLAG_ShowBorderTicksExt  (0x00000002)   //! Show tick marks outside border
00269 #define  MAPGRIDDISPFLAG_ShowBorderTicksInt  (0x00000004)   //! Show tick marks inside border
00270 #define  MAPGRIDDISPFLAG_ShowGrid            (0x00000010)   //! Show grid
00271 #define  MAPGRIDDISPFLAG_ShowBorderTicks     (0x00000020)   //! Show tick marks at border (OLD)
00272 #define  MAPGRIDDISPFLAG_ShowCoordText2D     (0x00000040)   //! Show coordinate text in 2D
00273 #define  MAPGRIDDISPFLAG_ShowBorder          (0x00000080)   //! Show border
00274 #define  MAPGRIDDISPFLAG_ShowInteriorTicks   (0x00000100)   //! Show interior tick marks
00275 #define  MAPGRIDDISPFLAG_ShowCoordText3D     (0x00000200)   //! Show coordinate text in 3D
00276 #define  MAPGRIDDISPFLAG_ShowBorderBottom3D  (0x00000400)   //! Show border at Z = zmin in 3D
00277 #define  MAPGRIDDISPFLAG_ShowBorderTop3D     (0x00000800)   //! Show border at Z = zmax in 3D
00278 #define  MAPGRIDDISPFLAG_BorderRelative      (0x00001000)   //! Interval is relative to borders, not 0
00279 #define  MAPGRIDDISPFLAG_ShowVerticalTicks   (0x00002000)   //! Show ticks on vertical axes
00280 #define  MAPGRIDDISPFLAG_LayoutScale         (0x00004000)   //! Use layout mapscale
00281 #define  MAPGRIDDISPFLAG_ShowVerticalScale   (0x00008000)   //! Show scale on vertical axes
00282 #define  MAPGRIDDISPFLAG_ShowMinSec0         (0x00010000)   //! Show minutes/seconds in lat-lon even if 0
00283 #define  MAPGRIDDISPFLAG_ShowDegOnlyIfMin0   (0x00020000)   //! Show degrees in lat-lon only if minutes = 0
00284 #define  MAPGRIDDISPFLAG_ShowCornerText2D    (0x00040000)   //! Show coordinates at corners
00285 #define  MAPGRIDDISPFLAG_ShowCornerText3D    (0x00080000)   //! Show coordinates at corners
00286 
00287 #define  MAPGRIDDISPFLAGS_ShowBorderTicksAny (MAPGRIDDISPFLAG_ShowBorderTicks | MAPGRIDDISPFLAG_ShowBorderTicksExt | MAPGRIDDISPFLAG_ShowBorderTicksInt)
00288 
00289 #define  MAPGRID_COORDFMTLATLON_MASK         0x000F
00290 #define  MAPGRID_COORDFMTLATLON_DDMMSS       0x0000
00291 #define  MAPGRID_COORDFMTLATLON_DDdddd       0x0001
00292 #define  MAPGRID_COORDFMTLATLON_DDMMmmm      0x0002
00293 #define  MAPGRID_COORDFMTLATLON_DDMMSSss     0x0003
00294 #define  MAPGRID_COORDFMTLATLON_DDMMSSs      0x0004
00295 #define  MAPGRID_COORDFMTLATLON_None         0x000F
00296 #define  MAPGRID_COORDFMTLATLON_NoSymbol     0x0020
00297 #define  MAPGRID_COORDFMTLATLON_AddSpace     0x0040
00298 #define  MAPGRID_COORDFMTLATLON_Leading0Deg  0x0080
00299 #define  MAPGRID_COORDFMTLATLON_Leading0MS   0x0100
00300 #define  MAPGRID_COORDFMTLATLON_DirFirst     0x0200
00301 #define  MAPGRID_COORDFMTLATLON_DirLast      0x0400
00302 
00303 #define  MAPGRID_COORDFMTPROJ_Space          0
00304 #define  MAPGRID_COORDFMTPROJ_Comma          1
00305 #define  MAPGRID_COORDFMTPROJ_Period         2
00306 #define  MAPGRID_COORDFMTPROJ_NoSpace        3
00307 #define  MAPGRID_COORDFMTPROJ_xXXxxxN        4
00308 #define  MAPGRID_COORDFMTPROJ_xXXxxx         5
00309 #define  MAPGRID_COORDFMTPROJ_xXXxxx_XX      6
00310 #define  MAPGRID_COORDFMTPROJ_xXXxxxN_XX     7
00311 #define  MAPGRID_COORDFMTPROJ_xXXxxxNp_XX    8
00312 
00313 #define  MAPGRID_COORDORIENT_Horizontal      0
00314 #define  MAPGRID_COORDORIENT_Parallel        1
00315 #define  MAPGRID_COORDORIENT_Perpendicular   2
00316 #define  MAPGRID_COORDORIENT_AlongTick       3
00317 #define  MAPGRID_COORDORIENT_Vertical        4
00318 
00319 #define  MAPGRID_VERTICALAXES_None           0
00320 #define  MAPGRID_VERTICALAXES_Farthest1      1
00321 #define  MAPGRID_VERTICALAXES_Farthest2      2
00322 #define  MAPGRID_VERTICALAXES_Farthest3      3
00323 #define  MAPGRID_VERTICALAXES_All            4
00324 
00325 
00326 //===================================================================================================================
00327 
00328 #endif   //!< INC_GRE_LRMAPGRD_H

Generated on Thu Aug 12 06:18:25 2004 for TNTsdk by doxygen 1.3.4-20031026