00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #ifndef INC_GRE_LRMAPGRD_H
00066 #define INC_GRE_LRMAPGRD_H
00067
00068 #ifndef INC_MI32_GRE_H
00069 #include <mi32/gre.h>
00070 #endif
00071
00072
00073
00074
00075
00076 class GRE_LAYER_MAPGRID : public GRE_LAYER {
00077 public:
00078
00079 class DISPPARM : public GRE_LAYER::DISPPARM {
00080 public:
00081
00082 class DLG;
00083
00084 TEXTSTYLE CoordLabelStyle;
00085 TEXTSTYLE AxisLabelStyle;
00086 double xinterval;
00087 double yinterval;
00088 double zinterval;
00089 double xdegrees;
00090 double ydegrees;
00091 SPATREF::COORDREFSYS IntervalCRS;
00092 SPATREF::COORDREFSYS ExtentsCRS;
00093 DRECT3D MapExtents;
00094 UINT8 IntervalUnitsXY;
00095 UINT8 IntervalUnitsZ;
00096 UINT8 IntervalLatLonFormat;
00097 UINT8 ExtentsUnits;
00098 UINT8 ExtentsLatLonFormat;
00099 LINESTYLE StyleGrid;
00100 LINESTYLE StyleBorder;
00101 LINESTYLE StyleBorderTickExt;
00102 LINESTYLE StyleInteriorTick;
00103 COLOR BorderTickIntColor1;
00104 COLOR BorderTickIntColor2;
00105 COLOR InteriorTickColor2;
00106 double GridWidth;
00107 double BorderWidth;
00108 double BorderTickExtWidth;
00109 double BorderTickExtLength;
00110 double BorderTickIntWidth;
00111 double BorderTickIntLength;
00112 double InteriorTickWidth;
00113 double InteriorTickLength;
00114 double BorderTextOffset;
00115 double GraphicMapScale;
00116 UINT8 GridWidthUnits;
00117 UINT8 BorderWidthUnits;
00118 UINT8 BorderTickExtWidthUnits;
00119 UINT8 BorderTickExtLengthUnits;
00120 UINT8 BorderTickIntWidthUnits;
00121 UINT8 BorderTickIntLengthUnits;
00122 UINT8 InteriorTickLengthUnits;
00123 UINT8 InteriorTickWidthUnits;
00124 UINT8 BorderTextOffsetUnits;
00125 UINT32 CoordFormatLatLon;
00126 UINT32 CoordFormatProj;
00127 UINT8 OldProjUnits;
00128 UINT8 VerticalAxes;
00129 UINT8 CoordOrient;
00130 UNICODE CoordUnitNameXY[32];
00131 UNICODE CoordUnitNameZ[32];
00132 UNICODE AxisLabelX[64];
00133 UNICODE AxisLabelY[64];
00134 UNICODE AxisLabelZ[64];
00135 DOUBLE_ARRAY<DPOINT2D> m_ToggledTickCoords;
00136
00137 DISPPARM ();
00138 DISPPARM (const DISPPARM& rhs) { Copy(rhs); }
00139 virtual ~DISPPARM () { Free(); }
00140
00141 DISPPARM& operator= (
00142 const DISPPARM& rhs
00143 ) { if (this != &rhs) { Free(); Copy(rhs); } return (*this); }
00144
00145
00146
00147
00148 void InitExtents (
00149 const GRE_LAYER_MAPGRID *layer
00150 );
00151
00152 virtual ERRVALUE Validate ();
00153
00154 protected:
00155 virtual const SERIALIZER::ITEMDEF* SerialGetItemDef (SERIALIZER& serializer) const;
00156 static int SerializerCB_TickToggledCoords (SERIALIZER& serializer, const SERIALIZER::ITEMDEF *itemdef, void *cbdata, SERIALIZER::ITEMDEF::ACTION action);
00157
00158 private:
00159 #ifndef GENERATING_DOXYGEN_OUTPUT
00160 void Copy (const DISPPARM&);
00161 void Free ();
00162 #endif
00163 };
00164
00165
00166 static int Construct (
00167 GRE_GROUP *group,
00168 GRE_LAYER **retlayer,
00169 GRE_LAYER *reflayer,
00170 UINT32 flags
00171 );
00172
00173
00174 static void RegisterType (
00175 );
00176
00177
00178 static void SMLClassInstall (
00179 SMLCONTEXT *context
00180 );
00181
00182
00183 explicit GRE_LAYER_MAPGRID (
00184 GRE_GROUP *group,
00185 GRE_LAYER *reflayer = 0,
00186 UINT32 flags = MDISPCREATE_InsertAfter
00187 );
00188
00189
00190 virtual ~GRE_LAYER_MAPGRID ();
00191
00192
00193 const DISPPARM& GetDispParm (
00194 ) const { return (m_dispparm); }
00195
00196
00197
00198
00199
00200
00201
00202
00203 ERRVALUE SetDispParm (
00204 const DISPPARM& dispparm
00205 );
00206
00207 protected:
00208
00209 DISPPARM m_dispparm;
00210
00211 private:
00212 #ifndef GENERATING_DOXYGEN_OUTPUT
00213
00214 class PRIVDRAWDATA;
00215 friend class PRIVDRAWDATA;
00216
00217 struct TICK {
00218 enum TYPE {
00219 TYPE_Interior = 0,
00220 TYPE_MinX = 1,
00221 TYPE_MaxX = 2,
00222 TYPE_MinY = 3,
00223 TYPE_MaxY = 4
00224 };
00225 enum FLAGS {
00226 FLAG_None = 0x00,
00227 FLAG_Lowest = 0x01,
00228 FLAG_AltColor = 0x02,
00229 FLAG_Corner = 0x04
00230 };
00231 DPOINT2D m_pt;
00232 DPOINT2D m_pt2;
00233 double m_label;
00234 TYPE m_type;
00235 FLAGS m_flags;
00236
00237 TICK (
00238 const DPOINT2D& pt,
00239 const DPOINT2D& pt2,
00240 TYPE type,
00241 FLAGS flags = FLAG_None,
00242 double label = 0
00243 );
00244 };
00245
00246 TRANS2D_MAPGEN m_TransMapToExt;
00247 DRECT2D m_GridRect;
00248 DPOINT2D m_GridInterval;
00249 SIMPLE_ARRAY<TICK> m_Ticks;
00250 int m_ActiveTick;
00251 void *m_LabelList;
00252
00253 #if defined(X_NATIVE)
00254 static void CB_ToggleTickColor (Widget, void*, void*);
00255 #endif
00256 static void SMLGET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00257 static void SMLSET_MapGridInterval (SMLCONTEXT*, SMLCLASSMEMBER*, void*, SMLARG*);
00258
00259 ERRVALUE OnToggleTickColor ();
00260 void ReadDefaultsIni ();
00261 void SaveDefaultsIni ();
00262 ERRVALUE TickAddCornerPoints ();
00263 ERRVALUE TickAddEdgePoint (const DPOINT2D& label, const DPOINT2D& pt, const DPOINT2D& pt2, TICK::TYPE type, TICK::FLAGS flags);
00264 ERRVALUE TickCalcPoints ();
00265 ERRVALUE TickLoadToggledCoords ();
00266 ERRVALUE TickSaveToggledCoords ();
00267
00268
00269 #if defined(X_NATIVE)
00270 virtual void v_AppendPopupMenuItems (Widget widget, const DPOINT2D *point, MENUITEMARRAY& menuitems);
00271 #endif
00272 virtual void v_ComputeMargins (double& tmargin, double& bmargin, double& lmargin, double& rmargin);
00273 #if defined(X_NATIVE) || defined(WIN32_MFC)
00274 virtual int v_ControlPanel (MDLGPARENT dlgparent, UINT32 flags = 0);
00275 #endif
00276 virtual ERRVALUE v_Draw (GRE_LAYERDC& layerdc);
00277 virtual const char* v_SerialGetTagName () const;
00278 virtual ERRVALUE v_SerialRead (SERIALIZER& serializer);
00279 virtual void v_SetDftName (bool ReplaceExisting);
00280 virtual int v_UpdateExtents (bool forceupdate);
00281 virtual bool v_IsAntialiased ()const;
00282 virtual bool v_IsLineWidthHinted () const;
00283 virtual bool v_NeedsMEM24 (bool isHirez) const;
00284 virtual void v_SetAntialiased (bool antialias);
00285 virtual void v_SetHintThinLines (bool hint);
00286 GRE_LAYER_MAPGRID (const GRE_LAYER_MAPGRID&);
00287 GRE_LAYER_MAPGRID& operator= (const GRE_LAYER_MAPGRID&);
00288
00289 #endif
00290 };
00291
00292 #define MAPGRIDDISPFLAG_SizeRelative (0x00000001)
00293 #define MAPGRIDDISPFLAG_ShowBorderTicksExt (0x00000002)
00294 #define MAPGRIDDISPFLAG_ShowBorderTicksInt (0x00000004)
00295 #define MAPGRIDDISPFLAG_ShowGrid (0x00000010)
00296 #define MAPGRIDDISPFLAG_ShowBorderTicks (0x00000020)
00297 #define MAPGRIDDISPFLAG_ShowCoordText2D (0x00000040)
00298 #define MAPGRIDDISPFLAG_ShowBorder (0x00000080)
00299 #define MAPGRIDDISPFLAG_ShowInteriorTicks (0x00000100)
00300 #define MAPGRIDDISPFLAG_ShowCoordText3D (0x00000200)
00301 #define MAPGRIDDISPFLAG_ShowBorderBottom3D (0x00000400)
00302 #define MAPGRIDDISPFLAG_ShowBorderTop3D (0x00000800)
00303 #define MAPGRIDDISPFLAG_BorderRelative (0x00001000)
00304 #define MAPGRIDDISPFLAG_ShowVerticalTicks (0x00002000)
00305 #define MAPGRIDDISPFLAG_LayoutScale (0x00004000)
00306 #define MAPGRIDDISPFLAG_ShowVerticalScale (0x00008000)
00307 #define MAPGRIDDISPFLAG_ShowMinSec0 (0x00010000)
00308 #define MAPGRIDDISPFLAG_ShowDegOnlyIfMin0 (0x00020000)
00309 #define MAPGRIDDISPFLAG_ShowCornerText2D (0x00040000)
00310 #define MAPGRIDDISPFLAG_ShowCornerText3D (0x00080000)
00311 #define MAPGRIDDISPFLAG_Antialias (0x00100000)
00312 #define MAPGRIDDISPFLAG_HintThinLines (0x00200000)
00313
00314 #define MAPGRIDDISPFLAGS_ShowBorderTicksAny (MAPGRIDDISPFLAG_ShowBorderTicks | MAPGRIDDISPFLAG_ShowBorderTicksExt | MAPGRIDDISPFLAG_ShowBorderTicksInt)
00315
00316 #define MAPGRID_COORDFMTLATLON_MASK 0x000F
00317 #define MAPGRID_COORDFMTLATLON_DDMMSS 0x0000
00318 #define MAPGRID_COORDFMTLATLON_DDdddd 0x0001
00319 #define MAPGRID_COORDFMTLATLON_DDMMmmm 0x0002
00320 #define MAPGRID_COORDFMTLATLON_DDMMSSss 0x0003
00321 #define MAPGRID_COORDFMTLATLON_DDMMSSs 0x0004
00322 #define MAPGRID_COORDFMTLATLON_None 0x000F
00323 #define MAPGRID_COORDFMTLATLON_NoSymbol 0x0020
00324 #define MAPGRID_COORDFMTLATLON_AddSpace 0x0040
00325 #define MAPGRID_COORDFMTLATLON_Leading0Deg 0x0080
00326 #define MAPGRID_COORDFMTLATLON_Leading0MS 0x0100
00327 #define MAPGRID_COORDFMTLATLON_DirFirst 0x0200
00328 #define MAPGRID_COORDFMTLATLON_DirLast 0x0400
00329
00330 #define MAPGRID_COORDFMTPROJ_Space 0
00331 #define MAPGRID_COORDFMTPROJ_Comma 1
00332 #define MAPGRID_COORDFMTPROJ_Period 2
00333 #define MAPGRID_COORDFMTPROJ_NoSpace 3
00334 #define MAPGRID_COORDFMTPROJ_xXXxxxN 4
00335 #define MAPGRID_COORDFMTPROJ_xXXxxx 5
00336 #define MAPGRID_COORDFMTPROJ_xXXxxx_XX 6
00337 #define MAPGRID_COORDFMTPROJ_xXXxxxN_XX 7
00338 #define MAPGRID_COORDFMTPROJ_xXXxxxNp_XX 8
00339
00340 #define MAPGRID_COORDORIENT_Horizontal 0
00341 #define MAPGRID_COORDORIENT_Parallel 1
00342 #define MAPGRID_COORDORIENT_Perpendicular 2
00343 #define MAPGRID_COORDORIENT_AlongTick 3
00344 #define MAPGRID_COORDORIENT_Vertical 4
00345
00346 #define MAPGRID_VERTICALAXES_None 0
00347 #define MAPGRID_VERTICALAXES_Farthest1 1
00348 #define MAPGRID_VERTICALAXES_Farthest2 2
00349 #define MAPGRID_VERTICALAXES_Farthest3 3
00350 #define MAPGRID_VERTICALAXES_All 4
00351
00352
00353
00354
00355 #endif