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
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 #ifndef INC_GRE_GROUP_H
00155 #define INC_GRE_GROUP_H
00156
00157 #ifndef INC_GRE_VIEWABLE_H
00158 #include <gre/viewable.h>
00159 #endif
00160
00161 #ifndef INC_GRE_LAYER_H
00162 #include <gre/layer.h>
00163 #endif
00164
00165 #ifndef INC_MI32_MATTE_H
00166 #include <mi32/matte.h>
00167 #endif
00168
00169 #ifndef INC_MI32_REGION2D_H
00170 #include <mi32/region2d.h>
00171 #endif
00172
00173 class GEOCAT_DIALOG;
00174
00175 namespace GRE {
00176
00177
00178 #define GROUPFLAG_None 0x00000000
00179 #define GROUPFLAG_Ignore 0x00000001
00180 #define GROUPFLAG_NoFixAspectLL 0x00000002
00181 #define GROUPFLAG_SingleLayer 0x00000004
00182 #define GROUPFLAG_Clip 0x00000008
00183 #define GROUPFLAG_OrientMatchRasterOnly 0x00000010
00184 #define GROUPFLAG_OrientMatchRasterOther 0x00000020
00185 #define GROUPFLAG_OrientMatchLayer 0x00000040
00186 #define GROUPFLAG_3D 0x00000200
00187 #define GROUPFLAG_ShowLatLonCoords 0x00001000
00188 #define GROUPFLAG_NoLockZoom 0x00004000
00189 #define GROUPFLAG_ShowLayerList 0x00008000
00190 #define GROUPFLAG_NoClipToAttachedGroup 0x00010000
00191 #define GROUPFLAG_CombineLayersInLegend 0x00020000
00192 #define GROUPFLAG_TemplateSaveLayersAsIs 0x00040000
00193 #define GROUPFLAG_NoClipToRectOnly 0x00080000
00194 #define GROUPFLAG_NoLegacyRectExtents 0x00100000
00195 #define GROUPFLAG_CreatedBySML 0x00200000
00196
00197 #define GROUPFLAG_OrientMask 0x00000070
00198 #define GROUPFLAG_NoNotifyMask GROUPFLAG_TemplateSaveLayersAsIs
00199 #define GROUPFLAG_Mask_NoRedraw (GROUPFLAG_ShowLatLonCoords | GROUPFLAG_NoLockZoom | GROUPFLAG_ShowLayerList | GROUPFLAG_CombineLayersInLegend | GROUPFLAG_TemplateSaveLayersAsIs)
00200
00201 #define ATTACHMENT_None 0
00202 #define ATTACHMENT_Left 1
00203 #define ATTACHMENT_Bottom 1
00204 #define ATTACHMENT_Center 2
00205 #define ATTACHMENT_Right 3
00206 #define ATTACHMENT_Top 3
00207 #define ATTACHMENT_Geographic 4
00208
00209 #define ATTACHREF_None 0
00210 #define ATTACHREF_Group 1
00211 #define ATTACHREF_Page 2
00212 #define ATTACHREF_Margin 3
00213
00214
00215 class GROUP : public GRE::VIEWABLE, public SERIALIZABLE {
00216
00217 public:
00218
00219
00220 enum CREATEFLAGS {
00221 CREATEFLAG_None = 0x0000,
00222 CREATEFLAG_NoCallCreateCB = 0x0001,
00223 CREATEFLAG_Temporary = 0x0002,
00224 CREATEFLAG_3D = 0x0004,
00225 CREATEFLAG_NoAutoMatch = 0x0008,
00226 CREATEFLAG_NoSetActive = 0x0010,
00227 CREATEFLAG_DeferCreate = 0x0020,
00228 CREATEFLAG_SML = 0x0040
00229 };
00230
00231 enum ORIENTATION_BASE {
00232 ORIENTATION_BASE_Projection = 0,
00233 ORIENTATION_BASE_North = 1
00234 };
00235
00236 enum LABEL_MANAGEMENT_MODE {
00237 LABEL_MANAGEMENT_MODE_RenderWithLayer = 0,
00238 LABEL_MANAGEMENT_MODE_RenderLast
00239 };
00240
00241
00242 enum EXTENTCOORD {
00243 EXTENTCOORD_Group,
00244 EXTENTCOORD_Layout,
00245 EXTENTCOORD_View
00246 };
00247
00248
00249 struct POSN {
00250 GROUP *refgroup;
00251 UINT8 AttachRefType;
00252 UINT8 AttachmentThis;
00253 UINT8 AttachmentRef;
00254 UINT8 PosnSet;
00255 double offset;
00256 mutable MISTRING m_RefGroupName;
00257 POSN ();
00258 ~POSN ();
00259 void Clear ();
00260 };
00261
00262 GRE::LAYER *firstlayer;
00263 GRE::LAYER *lastlayer;
00264 GRE::LAYER *activelayer;
00265 GRE::LAYER *matchedlayer;
00266 UINT8 RotBase;
00267 double AspectX;
00268 double AspectY;
00269 double RotAngle;
00270 double zinit;
00271 double zlast;
00272 GROUP *prevgroup;
00273 GROUP *nextgroup;
00274 GRE::LAYOUT *layout;
00275 UINT32 groupflags;
00276 POSN xposn, yposn;
00277 GRE::VIEWPOINT3D *m_ViewPoint3D;
00278 UINT32 VisibleViewLayout;
00279
00280 #ifdef X_NATIVE
00281
00282 static GROUP* GetFromWidget (
00283 Widget w
00284 );
00285 #endif
00286
00287
00288 static void SMLClassInstall (
00289 SMLCONTEXT *context
00290 );
00291
00292
00293 explicit GROUP (
00294 CREATEFLAGS createflags = CREATEFLAG_None
00295 );
00296
00297
00298 GROUP (
00299 GRE::LAYOUT *layout,
00300 CREATEFLAGS createflags = CREATEFLAG_None,
00301 GRE::LISTPOS listpos = GRE::LISTPOS_Last,
00302 GROUP *refgroup = 0
00303 );
00304
00305
00306 virtual ~GROUP ();
00307
00308
00309 bool AdjLatLon (
00310 );
00311
00312
00313 bool AdjLatLonCanSet (
00314 );
00315
00316
00317 bool ChangeListPos (
00318 GROUP* refgroup,
00319 GRE::LISTPOS listpos
00320 );
00321
00322
00323 ERRVALUE CheckAddLayer (
00324 GRE::LAYER::TYPE layertype = GRE::LAYER::TYPE_None
00325 ) const;
00326
00327
00328 void CheckGeorefCompatible (
00329 ) const;
00330
00331
00332 void ComputeLayoutExtents (
00333 );
00334
00335
00336 ERRVALUE ComputeMapExtents (
00337 );
00338
00339 ERRVALUE ComputeRegionFromLayers (
00340 REGION2D& region,
00341 bool IncludeMargins,
00342 GRE::LAYER::FILTER *filter = 0
00343 ) const;
00344
00345 #ifndef GENERATING_DOXYGEN_OUTPUT
00346
00347 GRE::GROUPVIEW* ConstructGroupView (
00348 GRE::VIEW *view
00349 );
00350 #endif
00351
00352
00353 void Create (
00354 CREATEFLAGS createflags = CREATEFLAG_None
00355 );
00356
00357
00358 void DestroyAllLayers (
00359 );
00360
00361
00362 void DestroyLayer (
00363 GRE::LAYER* layer
00364 );
00365
00366
00367 ERRVALUE DrawActiveOverlay (
00368 GRE::DRAWFLAGS DrawFlags = GRE::DRAWFLAG_UpdateScreen,
00369 GRE::VIEW *view = 0
00370 );
00371
00372 #if defined(X_NATIVE) || defined(WIN32_MFC)
00373
00374 ERRVALUE DlgGetClipSettings (
00375 MDLGPARENT dlgparent
00376 );
00377 #endif
00378
00379
00380 virtual GRE::LAYER *FindLayerByID (
00381 UINT32 LayerID
00382 ) const;
00383
00384
00385 ERRVALUE GeoCatDlgOpen (
00386 MDLGPARENT dlgparent
00387 );
00388
00389
00390 void GeoCatDlgSetSearchPoint (
00391 const DPOINT2D& SearchPoint,
00392 const SPATREF::COORDREFSYS& PointCRS
00393 ) const;
00394
00395
00396
00397 GRE::LAYER* GetActiveLayer (
00398 ) const { return (activelayer); }
00399
00400
00401 const REGION2D& GetClipRegion (
00402 ) const;
00403
00404
00405 bool GetClipToMatchedLayer (
00406 ) const { return (m_ClipToMatchedLayer); }
00407
00408
00409 ERRVALUE GetExtents (
00410 DRECT2D& extents,
00411 EXTENTCOORD coords
00412 );
00413
00414
00415 GRE::LAYER* GetFirstLayer (
00416 ) const { return (firstlayer); }
00417
00418
00419 UINT32 GetFlags (
00420 ) const { return (groupflags); }
00421
00422
00423 virtual void GetFullName (
00424 MISTRING& name
00425 ) const;
00426
00427 const REGION2D& GetFullRegion (
00428 ) const { return (m_FullRegion); }
00429
00430 LABEL_MANAGEMENT_MODE GetLabelManagementMode (
00431 ) const { return (m_LabelManagementMode); }
00432
00433
00434 GRE::LAYER* GetLastLayer (
00435 ) const { return (lastlayer); }
00436
00437
00438 GRE::LAYER* GetLayerZoom1X (
00439 bool PreferredOnly
00440 ) const;
00441
00442
00443
00444 GRE::LAYOUT * GetLayout (
00445 ) const { return (layout); }
00446
00447 const DRECT2D& GetLayoutExtents (
00448 ) const { return (m_LayoutExtents); }
00449
00450
00451
00452 int GetListPos (
00453 );
00454
00455
00456 GROUP* GetMatchedGroup (
00457 bool firstonly = false
00458 ) const;
00459
00460 MATTE& GetMatte (
00461 ) { return (m_Matte); }
00462
00463
00464 UINT32 GetMutualExclusiveGroupSet (
00465 ) const { return (m_MutualExclusiveGroupSet); }
00466
00467
00468 const MISTRING& GetName (
00469 ) const { return (m_name); }
00470
00471
00472 bool GetNeedUpdateExtents (
00473 ) const { return (m_NeedUpdateExtents); }
00474
00475
00476 GROUP* GetNext (
00477 ) const { return (nextgroup); }
00478
00479
00480 virtual UINT32 GetNextLayerID (
00481 ) const;
00482
00483
00484 GROUP* GetPrevious (
00485 ) const { return (prevgroup); }
00486
00487
00488 double GetRelativeScale (
00489 ) const { return (m_RelativeScale); }
00490
00491
00492 double GetRotationAngle (
00493 ) const { return (RotAngle); }
00494
00495
00496
00497 SERIALIZER* GetSerializer (
00498 ) const { return (m_pSerializer); }
00499
00500
00501 virtual ERRVALUE GetSizeMeters (
00502 DPOINT2D& sizemeters
00503 );
00504
00505
00506 const TRANS2D_AFFINE& GetTransViewToGroup (
00507 ) const { return (m_ViewToGroup); }
00508
00509
00510 const SPATREF::COORDREFSYS& GetUsedCoordRefSys (
00511 ) const;
00512
00513 GRE::VIEWPOINT3D* GetViewPoint3D (
00514 ) const { return (m_ViewPoint3D); }
00515
00516
00517 UINT32 GetVisible (
00518 ) const { return (this->VisibleViewLayout); }
00519
00520
00521 void GetVisibleScaleRange (
00522 double& MinScaleVisible,
00523 double& MaxScaleVisible
00524 ) { MinScaleVisible = m_MinScaleVisible; MaxScaleVisible = m_MaxScaleVisible; return; }
00525
00526
00527 bool HasAttachedGroups (
00528 ) const;
00529
00530
00531 bool HasHighlightableLayer (
00532 GRE::VIEW *view = 0
00533 ) const;
00534
00535
00536 virtual bool HasLayers (
00537 ) const;
00538
00539
00540 bool HasLegend (
00541 ) const { return ((this->groupflags & GROUPFLAG_CombineLayersInLegend) != 0); }
00542
00543
00544 bool HasMutuallyExclusiveLayers (
00545 ) const { return (m_HasMutuallyExclusiveLayers); }
00546
00547
00548 bool HasTempLayers (
00549 ) const;
00550
00551
00552 void HighlightSetupDefault (
00553 GRE::VIEW *view = 0
00554 );
00555
00556
00557 void InvalidateAllViews (
00558 GRE::RENDERTARGET Target = GRE::RENDERTARGET_GroupAll | GRE::RENDERTARGET_LayerAll
00559 );
00560
00561
00562 bool Is3D (
00563 ) const { return (!layout || (groupflags & GROUPFLAG_3D)); }
00564
00565 bool IsBeingLoaded (
00566 ) const { return (m_pSerializer != 0); }
00567
00568
00569 bool IsClipped (
00570 ) const;
00571
00572
00573 bool IsClippedToMatchedLayer (
00574 ) const { return (m_ClipToMatchedLayer && GetMatchedLayer() != 0); }
00575
00576
00577
00578 bool IsCreated (
00579 ) const { return (m_IsCreated); }
00580
00581
00582 bool IsIgnored (
00583 ) const;
00584
00585
00586 bool IsSingleLayer (
00587 ) const { return ((groupflags & GROUPFLAG_SingleLayer) != 0); }
00588
00589
00590 bool IsValid (
00591 ) const;
00592
00593
00594 bool IsVisibleAtScale (
00595 double scale
00596 ) const { return (!layout || (scale >= m_MinScaleVisible && (m_MaxScaleVisible <= 0.0 || scale <= m_MaxScaleVisible))); }
00597
00598
00599 bool IsVisibleInView (
00600 const GRE::VIEW *view
00601 ) const;
00602
00603
00604 virtual ERRVALUE SerialRead (
00605 SERIALIZER& serializer
00606 );
00607
00608
00609 virtual ERRVALUE SerialWrite (
00610 SERIALIZER& serializer,
00611 const char *tagname = 0
00612 ) const;
00613
00614
00615 void Set2D (
00616 );
00617
00618
00619 void SetActiveLayer (
00620 GRE::LAYER *layer
00621 );
00622
00623
00624 void SetClipRect (
00625 const DRECT2D& ClipRect,
00626 const SPATREF::COORDREFSYS& RectCRS,
00627 bool notify = true
00628 );
00629
00630
00631
00632
00633
00634
00635
00636
00637 void SetClipToMatchedLayer (
00638 bool ClipToMatchedLayer,
00639 bool notify = true
00640 );
00641
00642
00643 void SetFlags (
00644 UINT32 flags,
00645 UINT32 mask
00646 );
00647
00648 void SetLabelManagementMode (
00649 LABEL_MANAGEMENT_MODE mode
00650 ) { m_LabelManagementMode = mode; }
00651
00652
00653 void SetListPos (
00654 int newpos
00655 );
00656
00657
00658 void SetModified (
00659 bool notify = true,
00660 bool ViewsNeedRedraw = true
00661 );
00662
00663
00664 void SetMutualExclusiveGroupSet (
00665 UINT32 GroupSet
00666 );
00667
00668
00669 void SetMutuallyExclusiveLayers (
00670 bool LayersMutuallyExclusive = true
00671 );
00672
00673
00674 ERRVALUE SetName (
00675 const MISTRING& newname
00676 );
00677
00678
00679 void SetNeedUpdateExtents (
00680 ) { m_NeedUpdateExtents = true; }
00681
00682
00683 void SetOrientation (
00684 UINT8 NewRotBase,
00685 double NewRotAngle
00686 ) { RotBase = NewRotBase; RotAngle = NewRotAngle; }
00687
00688
00689 void SetProjView (
00690 const GRE::LAYER *layer
00691 );
00692
00693
00694 void SetRelativeScale (
00695 double RelativeScale,
00696 bool notify = true
00697 );
00698
00699
00700 ERRVALUE SetRenderCoordRefSys (
00701 const SPATREF::COORDREFSYS& RenderCRS
00702 );
00703
00704
00705 ERRVALUE SetupEquirectangular (
00706 SPATREF::COORDREFSYS& CoordRefSys,
00707 const DPOINT2D& center
00708 ) const;
00709
00710
00711 void SetVisible (
00712 UINT32 flags,
00713 bool set
00714 );
00715
00716
00717 void SetVisibleScaleRange (
00718 double MinScaleVisible,
00719 double MaxScaleVisible
00720 ) { m_MinScaleVisible = MinScaleVisible; m_MaxScaleVisible = MaxScaleVisible; }
00721
00722
00723 void SetVisibleView (
00724 GRE::VIEW *view,
00725 bool visible
00726 );
00727
00728
00729 ERRVALUE TemplateWrite (
00730 SERIALIZER& serializer,
00731 const char *tagname = 0
00732 );
00733
00734 private:
00735
00736 #ifndef GENERATING_DOXYGEN_OUTPUT
00737
00738 #ifdef X_NATIVE
00739 GEOCAT_DIALOG *m_GeoCatDlg;
00740 #endif
00741
00742 SERIALIZER *m_pSerializer;
00743 bool m_IsCreated;
00744 bool m_NeedUpdateExtents;
00745 double m_MinScaleVisible;
00746 double m_MaxScaleVisible;
00747 double m_DesignScale;
00748 double m_RelativeScale;
00749 mutable MISTRING m_ActiveLayerName;
00750 bool m_ClipToMatchedLayer;
00751 bool m_HasMutuallyExclusiveLayers;
00752 GRE::HIGHLIGHTMODE m_ElemHighlightMode;
00753 UINT32 m_MutualExclusiveGroupSet;
00754 MATTE m_Matte;
00755 MISTRING m_name;
00756 SPATREF::COORDREFSYS m_RenderCRS;
00757 REGION2D m_ClipRegion;
00758 REGION2D m_FullRegion;
00759 TRANS2D_AFFINE m_ViewToGroup;
00760 DRECT2D m_LayoutExtents;
00761 LABEL_MANAGEMENT_MODE m_LabelManagementMode;
00762
00763 static void GRECB_Group (
00764 const GRE::MSG *msg,
00765 void *vgroup
00766 );
00767
00768 static const SERIALIZER::ITEMDEF* SerialGetItemDef (
00769 SERIALIZER& serializer
00770 );
00771
00772 static ERRVALUE SerializerCB_OldClipProj (SERIALIZER&, const SERIALIZER::ITEMDEF*, void *vgroup, SERIALIZER::ITEMDEF::ACTION);
00773 static ERRVALUE SerializerCB_OldClipRect (SERIALIZER&, const SERIALIZER::ITEMDEF*, void *vgroup, SERIALIZER::ITEMDEF::ACTION);
00774 static ERRVALUE SerializerCB_OldGroupFlags (SERIALIZER&, const SERIALIZER::ITEMDEF*, void *vgroup, SERIALIZER::ITEMDEF::ACTION);
00775
00776 void Init ();
00777
00778
00779 GRE::LAYER *GetMatchedLayer () const;
00780
00781
00782 virtual bool v_Destroy (bool NotifyParent);
00783 virtual MICON v_GetIcon () const;
00784 virtual const char* v_GetTypeName () const;
00785
00786
00787 virtual ERRVALUE v_DrawAllViews (GRE::DRAWCONDITION condition);
00788 virtual double v_GetDesignScale () const;
00789 virtual const DRECT2D& v_GetExtents () const;
00790 virtual double v_GetMaxScaleVisibleAny () const;
00791 virtual double v_GetMinScaleVisibleAny () const;
00792 virtual void v_SetDesignScale (double DesignScale, bool notify);
00793
00794 GROUP (const GROUP&);
00795 GROUP& operator= (const GROUP&);
00796
00797 friend class GRE::LAYOUT;
00798
00799 #endif
00800 };
00801
00802 DEFINE_ENUM_OP_BITWISE(GROUP::CREATEFLAGS)
00803
00804
00805
00806 }
00807
00808 #endif