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

Generated on Wed May 31 15:26:41 2006 for TNTsdk by  doxygen 1.3.8-20040913