00001
00125 #ifndef INC_GRE_LRMAPGRD_H
00126 #define INC_GRE_LRMAPGRD_H
00127
00128 #ifndef INC_GRE_LAYER_H
00129 #include <gre/layer.h>
00130 #endif
00131
00132
00133 namespace GRE {
00134
00135
00137 class LAYER_MAPGRID : public GRE::LAYER {
00138 public:
00139
00140 class DISPPARM : public GRE::LAYER::DISPPARM {
00141 public:
00142
00143 class DLG;
00144
00145 TEXTSTYLE CoordLabelStyle;
00146 TEXTSTYLE AxisLabelStyle;
00147 double xinterval;
00148 double yinterval;
00149 double zinterval;
00150 double xdegrees;
00151 double ydegrees;
00152 SPATREF::COORDREFSYS IntervalCRS;
00153 SPATREF::COORDREFSYS ExtentsCRS;
00154 DRECT3D MapExtents;
00155 UINT8 IntervalUnitsXY;
00156 UINT8 IntervalUnitsZ;
00157 UINT8 IntervalLatLonFormat;
00158 UINT8 ExtentsUnits;
00159 UINT8 ExtentsLatLonFormat;
00160 LINESTYLE StyleGrid;
00161 LINESTYLE StyleBorder;
00162 LINESTYLE StyleBorderTickExt;
00163 LINESTYLE StyleInteriorTick;
00164 COLOR BorderTickIntColor1;
00165 COLOR BorderTickIntColor2;
00166 COLOR InteriorTickColor2;
00167 double GridWidth;
00168 double BorderWidth;
00169 double BorderTickExtWidth;
00170 double BorderTickExtLength;
00171 double BorderTickIntWidth;
00172 double BorderTickIntLength;
00173 double InteriorTickWidth;
00174 double InteriorTickLength;
00175 double BorderTextOffset;
00176 double GraphicMapScale;
00177 UINT8 GridWidthUnits;
00178 UINT8 BorderWidthUnits;
00179 UINT8 BorderTickExtWidthUnits;
00180 UINT8 BorderTickExtLengthUnits;
00181 UINT8 BorderTickIntWidthUnits;
00182 UINT8 BorderTickIntLengthUnits;
00183 UINT8 InteriorTickLengthUnits;
00184 UINT8 InteriorTickWidthUnits;
00185 UINT8 BorderTextOffsetUnits;
00186 UINT32 CoordFormatLatLon;
00187 UINT32 CoordFormatProj;
00188 UINT8 OldProjUnits;
00189 UINT8 VerticalAxes;
00190 UINT8 CoordOrient;
00191 MIUNICODE CoordUnitNameXY[32];
00192 MIUNICODE CoordUnitNameZ[32];
00193 MIUNICODE AxisLabelX[64];
00194 MIUNICODE AxisLabelY[64];
00195 MIUNICODE AxisLabelZ[64];
00196 DOUBLE_ARRAY<DPOINT2D> m_ToggledTickCoords;
00197 UINT32 m_GridFlags;
00198
00199 DISPPARM ();
00200 DISPPARM (const DISPPARM& rhs) { Copy(rhs); }
00201 virtual ~DISPPARM () { Free(); }
00202
00203 DISPPARM& operator= (
00204 const DISPPARM& rhs
00205 ) { if (this != &rhs) { Free(); Copy(rhs); } return (*this); }
00206
00210 void InitExtents (
00211 const LAYER_MAPGRID *layer
00212 );
00214 virtual ERRVALUE Validate ();
00215
00216 protected:
00217 virtual const SERIALIZERITEM* SerialGetItemDef (SERIALIZER& serializer) const;
00218 static int SerializerCB_TickToggledCoords (SERIALIZER& serializer, const SERIALIZERITEM *itemdef, void *cbdata, SERIALIZERITEM::ACTION action);
00219
00220 private:
00221 #ifndef GENERATING_DOXYGEN_OUTPUT
00222 void Copy (const DISPPARM&);
00223 void Free ();
00224 #endif
00225 };
00226
00228 static void RegisterType (
00229 );
00230
00232 static void SMLClassInstall (
00233 SML::CONTEXT *context
00234 );
00235
00236 static const SML::CLASSMEMBER* GetSMLClassMembers (
00237 );
00238
00240 explicit LAYER_MAPGRID (
00241 GRE::GROUP *group,
00242 CREATEFLAGS createflags = CREATEFLAG_None,
00243 GRE::LISTPOS listpos = GRE::LISTPOS_Last,
00244 GRE::LAYER *reflayer = 0
00245 );
00246
00248 virtual ~LAYER_MAPGRID ();
00249
00251 const DISPPARM& GetDispParm (
00252 ) const { return (m_dispparm); }
00253
00261 ERRVALUE SetDispParm (
00262 const DISPPARM& dispparm
00263 );
00264
00265 protected:
00266
00267 DISPPARM m_dispparm;
00268
00269 private:
00270 #ifndef GENERATING_DOXYGEN_OUTPUT
00271 typedef LAYER_MAPGRID THISCLASS;
00272
00273 class PRIVDRAWDATA;
00274 friend class PRIVDRAWDATA;
00275
00276 struct TICK {
00277 enum LOCATION {
00278 LOCATION_Interior = 0,
00279 LOCATION_MinX = 1,
00280 LOCATION_MaxX = 2,
00281 LOCATION_MinY = 3,
00282 LOCATION_MaxY = 4,
00283 LOCATION_Other = 5
00284 };
00285 enum FLAGS {
00286 FLAG_None = 0x00,
00287 FLAG_Lowest = 0x01,
00288 FLAG_AltColor = 0x02,
00289 FLAG_Corner = 0x04
00290 };
00291 DPOINT2D m_pt;
00292 DPOINT2D m_pt2;
00293 double m_label;
00294 LOCATION m_LocGridRect;
00295 LOCATION m_LocMapRect;
00296 FLAGS m_flags;
00297
00298 TICK (
00299 const DPOINT2D& pt,
00300 const DPOINT2D& pt2,
00301 LOCATION LocGridRect,
00302 LOCATION LocMapRect,
00303 FLAGS flags = FLAG_None,
00304 double label = 0
00305 );
00306 };
00307
00308 TRANS2D_MAPGEN m_TransMapToExt;
00309 DRECT2D m_GridRect;
00310 DPOINT2D m_GridInterval;
00311 SIMPLE_ARRAY<TICK> m_Ticks;
00312 int m_ActiveTick;
00313 void *m_LabelList;
00314
00315 #if defined(X_NATIVE)
00316 static void CB_ToggleTickColor (Widget, void*, void*);
00317 #endif
00318 static void SMLGET_MapGridInterval (SML::CONTEXT*, SML::CLASSMEMBER*, void*, SMLARG*);
00319 static void SMLSET_MapGridInterval (SML::CONTEXT*, SML::CLASSMEMBER*, void*, SMLARG*);
00320
00321 #ifdef USE_MGUI
00322 void OnMenuToggleTickColor (MGUI::ID id, bool ToggleOn);
00323 #endif
00324
00325 ERRVALUE OnToggleTickColor ();
00326 void ReadDefaultsIni ();
00327 void SaveDefaultsIni ();
00328 ERRVALUE TickAddCornerPoints ();
00329 ERRVALUE TickAddEdgePoint (const DPOINT2D& label, const DPOINT2D& pt, const DPOINT2D& pt2, TICK::LOCATION type, TICK::FLAGS flags);
00330 ERRVALUE TickCalcPoints ();
00331 bool TickFindEdgePoint (const DPOINT2D& ptGridInside, const DPOINT2D& ptGridOutside, const DPOINT2D& ptMapInside, const DPOINT2D& ptMapOutside, TICK::LOCATION TickType, TICK::FLAGS TickFlags);
00332 ERRVALUE TickLoadToggledCoords ();
00333 ERRVALUE TickSaveToggledCoords ();
00334
00335
00336 #if defined(X_NATIVE)
00337 virtual void v_AppendPopupMenuItems (Widget widget, const DPOINT2D *point, MENUITEMARRAY& menuitems);
00338 #endif
00339 virtual void v_ComputeMargins (double& tmargin, double& bmargin, double& lmargin, double& rmargin);
00340 #ifdef USE_MGUI
00341 virtual int v_ControlPanel (MDLGPARENT dlgparent, UINT32 flags = 0);
00342 #endif
00343 virtual GRE::LAYER* v_Copy (GRE::GROUP *group) const;
00344 virtual ERRVALUE v_Draw (GRE::LAYERDC& layerdc);
00345 virtual bool v_IsAntialiased ()const;
00346 virtual bool v_IsLineWidthHinted () const;
00347 #ifdef USE_MGUI
00348 virtual void v_MenuAddViewPopupItems (MGUI::MENU& menu, const DPOINT2D *point, VIEW *view);
00349 #endif
00350 virtual const char* v_SerialGetTagName () const;
00351 virtual ERRVALUE v_SerialRead (SERIALIZER& serializer);
00352 virtual void v_SetAntialiased (bool antialias);
00353 virtual void v_SetDftName (bool ReplaceExisting);
00354 virtual void v_SetHintThinLines (bool hint);
00355 virtual int v_SnapPoint (DPOINT3D& ptObject, SNAPTO SnapTo, double MaxDistance, VIEW *view) const;
00356 virtual bool v_SnapPointIsAllowed (SNAPTO SnapTo) const;
00357 virtual int v_UpdateExtents (bool forceupdate);
00358
00359 LAYER_MAPGRID (const LAYER_MAPGRID&);
00360 LAYER_MAPGRID& operator= (const LAYER_MAPGRID&);
00361
00362 #endif // GENERATING_DOXYGEN_OUTPUT
00363 };
00364
00365 #define MAPGRIDDISPFLAG_SizeRelative (0x00000001)
00366 #define MAPGRIDDISPFLAG_ShowBorderTicksExt (0x00000002)
00367 #define MAPGRIDDISPFLAG_ShowBorderTicksInt (0x00000004)
00368 #define MAPGRIDDISPFLAG_NoFullCoordLowest (0x00000008)
00369 #define MAPGRIDDISPFLAG_ShowGrid (0x00000010)
00370 #define MAPGRIDDISPFLAG_ShowBorderTicks (0x00000020)
00371 #define MAPGRIDDISPFLAG_ShowCoordText2D (0x00000040)
00372 #define MAPGRIDDISPFLAG_ShowBorder (0x00000080)
00373 #define MAPGRIDDISPFLAG_ShowInteriorTicks (0x00000100)
00374 #define MAPGRIDDISPFLAG_ShowCoordText3D (0x00000200)
00375 #define MAPGRIDDISPFLAG_ShowBorderBottom3D (0x00000400)
00376 #define MAPGRIDDISPFLAG_ShowBorderTop3D (0x00000800)
00377 #define MAPGRIDDISPFLAG_BorderRelative (0x00001000)
00378 #define MAPGRIDDISPFLAG_ShowVerticalTicks (0x00002000)
00379 #define MAPGRIDDISPFLAG_LayoutScale (0x00004000)
00380 #define MAPGRIDDISPFLAG_ShowVerticalScale (0x00008000)
00381 #define MAPGRIDDISPFLAG_ShowMinSec0 (0x00010000)
00382 #define MAPGRIDDISPFLAG_ShowDegOnlyIfMin0 (0x00020000)
00383 #define MAPGRIDDISPFLAG_ShowCornerText2D (0x00040000)
00384 #define MAPGRIDDISPFLAG_ShowCornerText3D (0x00080000)
00385 #define MAPGRIDDISPFLAG_Antialias (0x00100000)
00386 #define MAPGRIDDISPFLAG_HintThinLines (0x00200000)
00387 #define MAPGRIDDISPFLAG_MatchGroupExtents (0x00400000)
00388 #define MAPGRIDDISPFLAG_ExcludeFromGroupExt (0x00800000)
00389
00390 #define MAPGRIDDISPFLAGS_ShowBorderTicksAny (MAPGRIDDISPFLAG_ShowBorderTicks | MAPGRIDDISPFLAG_ShowBorderTicksExt | MAPGRIDDISPFLAG_ShowBorderTicksInt)
00391
00392 #define MAPGRID_COORDFMTLATLON_MASK 0x000F
00393 #define MAPGRID_COORDFMTLATLON_DDMMSS 0x0000
00394 #define MAPGRID_COORDFMTLATLON_DDdddd 0x0001
00395 #define MAPGRID_COORDFMTLATLON_DDMMmmm 0x0002
00396 #define MAPGRID_COORDFMTLATLON_DDMMSSss 0x0003
00397 #define MAPGRID_COORDFMTLATLON_DDMMSSs 0x0004
00398 #define MAPGRID_COORDFMTLATLON_DDMM 0x0005
00399 #define MAPGRID_COORDFMTLATLON_None 0x000F
00400 #define MAPGRID_COORDFMTLATLON_NoSymbol 0x0020
00401 #define MAPGRID_COORDFMTLATLON_AddSpace 0x0040
00402 #define MAPGRID_COORDFMTLATLON_Leading0Deg 0x0080
00403 #define MAPGRID_COORDFMTLATLON_Leading0MS 0x0100
00404 #define MAPGRID_COORDFMTLATLON_DirFirst 0x0200
00405 #define MAPGRID_COORDFMTLATLON_DirLast 0x0400
00406
00407 #define MAPGRID_COORDFMTPROJ_Space 0
00408 #define MAPGRID_COORDFMTPROJ_Comma 1
00409 #define MAPGRID_COORDFMTPROJ_Period 2
00410 #define MAPGRID_COORDFMTPROJ_NoSpace 3
00411 #define MAPGRID_COORDFMTPROJ_xXXxxxN 4
00412 #define MAPGRID_COORDFMTPROJ_xXXxxx 5
00413 #define MAPGRID_COORDFMTPROJ_xXXxxx_XX 6
00414 #define MAPGRID_COORDFMTPROJ_xXXxxxN_XX 7
00415 #define MAPGRID_COORDFMTPROJ_xXXxxxNp_XX 8
00416 #define MAPGRID_COORDFMTPROJ_xXXN 9
00417 #define MAPGRID_COORDFMTPROJ_xXX 10
00418
00419 #define MAPGRID_COORDORIENT_Horizontal 0
00420 #define MAPGRID_COORDORIENT_Parallel 1
00421 #define MAPGRID_COORDORIENT_Perpendicular 2
00422 #define MAPGRID_COORDORIENT_AlongTick 3
00423 #define MAPGRID_COORDORIENT_Vertical 4
00424
00425 #define MAPGRID_VERTICALAXES_None 0
00426 #define MAPGRID_VERTICALAXES_Farthest1 1
00427 #define MAPGRID_VERTICALAXES_Farthest2 2
00428 #define MAPGRID_VERTICALAXES_Farthest3 3
00429 #define MAPGRID_VERTICALAXES_All 4
00430
00431
00432
00433 }
00434
00435
00436 #endif