group.h

Go to the documentation of this file.
00001 /**
00002  * \file group.h <gre/group.h>
00003  * \brief GRE::GROUP class definitions
00004  *
00005  * \if NODOC
00006  * $Id: group.h_v 1.39 2006/05/05 21:47:04 mju Exp $
00007  *
00008  * $Log: group.h_v $
00009  * Revision 1.39  2006/05/05 21:47:04  mju
00010  * Support deferred creation.
00011  *
00012  * Revision 1.38  2005/06/30 16:49:19  mju
00013  * Add mask for groupflag to determine which flags don't require redraw.
00014  *
00015  * Revision 1.37  2005/06/14 15:27:28  mju
00016  * Add parm to getMatchedGroup to determine if want first in link.
00017  *
00018  * Revision 1.36  2005/06/10 20:34:59  vdronov
00019  * combined old and new 3d rendering
00020  *
00021  * Revision 1.35  2005/05/31 15:20:00  mju
00022  * Make getUsedCoordRefSys non-inline.
00023  *
00024  * Revision 1.34  2005/05/31 13:45:12  mju
00025  * Add getNeedUpdateExtents.
00026  *
00027  * Revision 1.33  2005/05/13 14:37:25  scowan
00028  * Moved global standalone group list to system.
00029  *
00030  * Revision 1.32  2005/05/02 17:43:36  mju
00031  * Move highightMode to viewable.
00032  *
00033  * Revision 1.31  2005/04/29 17:49:45  mju
00034  * Support rendertarget.
00035  *
00036  * Revision 1.30  2005/03/31 16:57:05  fileserver!dwilliss
00037  * Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define
00038  *
00039  * Revision 1.29  2005/03/22 22:00:55  mju
00040  * Add invalidateAllViews.
00041  *
00042  * Revision 1.28  2005/03/16 23:56:35  vdronov
00043  * *** empty log message ***
00044  *
00045  * Revision 1.27  2005/03/16 22:37:55  vdronov
00046  * added toggle for advanced 3d rendering
00047  *
00048  * Revision 1.26  2005/02/25 20:30:49  mju
00049  * Move groupview to own header.
00050  *
00051  * Revision 1.25  2005/02/25 18:54:09  mju
00052  * Declare device_mem32rgba.
00053  *
00054  * Revision 1.24  2005/02/24 18:52:13  mju
00055  * Add groupview methods for overlay device.
00056  *
00057  * Revision 1.23  2005/02/23 18:52:23  mju
00058  * Add groupview stuff for overlsy.
00059  *
00060  * Revision 1.22  2005/02/14 18:52:38  mju
00061  * Add groupview class.
00062  *
00063  * Revision 1.21  2005/01/20 16:54:11  mju
00064  * Add createflags.
00065  * Drawmode enum.
00066  *
00067  * Revision 1.20  2004/09/03 22:51:34  dwilliss
00068  * Added an enum, member to hold it and Get/Set methods
00069  *
00070  * Revision 1.19  2004/08/27 21:55:32  mju
00071  * Set clip region not supported.
00072  *
00073  * Revision 1.18  2004/08/12 16:59:53  dglasser
00074  * Added destroy layer for sml func.
00075  *
00076  * Revision 1.17  2004/07/30 14:20:17  mju
00077  * Add groupflag_noLegacyRectExtents.
00078  *
00079  * Revision 1.16  2004/07/27 17:44:36  mju
00080  * Add groupflag to not clip to rectangle.
00081  *
00082  * Revision 1.15  2004/07/20 13:14:47  mju
00083  * Use new region2d hdr.
00084  *
00085  * Revision 1.14  2004/07/14 20:12:40  mju
00086  * No more mapprojparm.
00087  *
00088  * Revision 1.13  2004/07/08 21:23:56  mju
00089  * Docs for setupequirectangular.
00090  *
00091  * Revision 1.12  2004/06/30 22:11:23  mju
00092  * Make setupequirectangular public.
00093  *
00094  * Revision 1.11  2004/06/28 20:30:24  mju
00095  * Wanted getfullregion to return reference.
00096  *
00097  * Revision 1.10  2004/06/28 17:53:09  mju
00098  * Convert to spatref.
00099  *
00100  * Revision 1.9  2004/02/18 21:16:21  mju
00101  * Add GetLayerZoom1X.
00102  *
00103  * Revision 1.8  2003/11/12 22:41:42  mju
00104  * Use serializer to log errors instead of group.
00105  *
00106  * Revision 1.7  2003/11/10 18:43:35  mju
00107  * Remove savefilename/inode as need in base.
00108  *
00109  * Revision 1.6  2003/11/04 18:43:55  mju
00110  * Add DlgObjMgr overrides.
00111  *
00112  * Revision 1.5  2003/09/15 13:48:59  fileserver!dwilliss
00113  * Doxygen
00114  *
00115  * Revision 1.4  2003/08/29 20:13:43  mju
00116  * Add v_GetExtents.
00117  *
00118  * Revision 1.3  2003/07/30 14:58:25  mju
00119  * Ignore private sections.
00120  *
00121  * Revision 1.2  2003/07/29 19:58:55  mju
00122  * Add SetNeedUpdateExtents.
00123  *
00124  * Revision 1.1  2003/06/16 19:39:31  mju
00125  * Initial revision
00126  *
00127  * \endif
00128 **/
00129 
00130 #ifndef  INC_GRE_GROUP_H
00131 #define  INC_GRE_GROUP_H
00132 
00133 #ifndef  INC_GRE_VIEWABLE_H
00134    #include <gre/viewable.h>
00135 #endif
00136 
00137 #ifndef  INC_GRE_LAYER_H
00138    #include <gre/layer.h>
00139 #endif
00140 
00141 #ifndef  INC_MI32_MATTE_H
00142    #include <mi32/matte.h>
00143 #endif
00144 
00145 #ifndef INC_MI32_REGION2D_H
00146    #include <mi32/region2d.h>
00147 #endif
00148 
00149 class GEOCAT_DIALOG;
00150 
00151 
00152 //===================================================================================================================
00153 
00154 #define  GROUPFLAG_None                   0x00000000
00155 #define  GROUPFLAG_Ignore                 0x00000001  //!< Completely ignores group for positioning/display
00156 #define  GROUPFLAG_NoFixAspectLL          0x00000002  //!< Don't perform "aspect correction" if viewed in lat/lon projection
00157 #define  GROUPFLAG_SingleLayer            0x00000004  //!< Group can only contain a single layer (other than background)
00158 #define  GROUPFLAG_Clip                   0x00000008  //!< Clip layers in group to specified region
00159 #define  GROUPFLAG_OrientMatchRasterOnly  0x00000010  //!< Match first raster layer or nothing if no raster
00160 #define  GROUPFLAG_OrientMatchRasterOther 0x00000020  //!< Match first raster layer or first layer if no raster
00161 #define  GROUPFLAG_OrientMatchLayer       0x00000040  //!< Match first layer
00162 #define  GROUPFLAG_3D                     0x00000200  //!< 3-D group in a layout
00163 #define  GROUPFLAG_ShowLatLonCoords       0x00001000  //!< Show group coordinates in lat-lon
00164 #define  GROUPFLAG_NoLockZoom             0x00004000  //!< Don't lock group zoom factor
00165 #define  GROUPFLAG_ShowLayerList          0x00008000  //!< Show list of layers for group
00166 #define  GROUPFLAG_NoClipToAttachedGroup  0x00010000  //!< Don't clip to attached group if that group is clipped
00167 #define  GROUPFLAG_CombineLayersInLegend  0x00020000  //!< Combine layers within group in LegendView by showing only legend for active layer
00168 #define  GROUPFLAG_TemplateSaveLayersAsIs 0x00040000  //!< Save layers as-is to template
00169 #define  GROUPFLAG_NoClipToRectOnly       0x00080000  //!< Don't force clipping to just be rectangle (for legacy layouts)
00170 #define  GROUPFLAG_NoLegacyRectExtents    0x00100000  //!< Don't just use layer rectangle when compute extents (for legacy layouts)
00171 
00172 #define  GROUPFLAG_OrientMask             0x00000070
00173 #define  GROUPFLAG_NoNotifyMask           GROUPFLAG_TemplateSaveLayersAsIs
00174 #define  GROUPFLAG_Mask_NoRedraw          (GROUPFLAG_ShowLatLonCoords | GROUPFLAG_NoLockZoom | GROUPFLAG_ShowLayerList | GROUPFLAG_CombineLayersInLegend | GROUPFLAG_TemplateSaveLayersAsIs)
00175 
00176 #define  ATTACHMENT_None         0
00177 #define  ATTACHMENT_Left         1
00178 #define  ATTACHMENT_Bottom       1
00179 #define  ATTACHMENT_Center       2
00180 #define  ATTACHMENT_Right        3
00181 #define  ATTACHMENT_Top          3
00182 #define  ATTACHMENT_Geographic   4
00183 
00184 #define  ATTACHREF_None          0
00185 #define  ATTACHREF_Group         1
00186 #define  ATTACHREF_Page          2
00187 #define  ATTACHREF_Margin        3
00188 
00189 struct MDISPGROUPPOSN {                //! Layout/Positioning parameters
00190    GRE_GROUP *refgroup;
00191    UINT8 AttachRefType;                //!< Reference type, ATTACHREF_...
00192    UINT8 AttachmentThis;               //!< Attachment type for this group (ATTACHMENT_...)
00193    UINT8 AttachmentRef;                //!< Attachment type for reference group
00194    UINT8 PosnSet;
00195    double offset;                      //!< Offset in METERS at design scale
00196    mutable MIUNICODE refgroupname[GRE_GROUP_NAMELEN];
00197    };
00198 
00199 class GRE_GROUP : public GRE_VIEWABLE, public SERIALIZABLE {
00200 
00201    public:
00202 
00203       //! Flags for group creation.
00204       enum CREATEFLAGS {
00205          CREATEFLAG_None =             0x0000,
00206          CREATEFLAG_NoCallCreateCB =   0x0001,  //!< Don't call callback list when object created
00207          CREATEFLAG_Temporary =        0x0002,  //!< Object is temporary
00208          CREATEFLAG_3D =               0x0004,  //!< Group is 3D
00209          CREATEFLAG_NoAutoMatch =      0x0008,  //!< Don't default to automatch any layers
00210          CREATEFLAG_NoSetActive =      0x0010,  //!< Don't make newly-created group "active"
00211          CREATEFLAG_DeferCreate =      0x0020   //!< Defer creation until Create() called (standalone group only)
00212          };
00213 
00214       enum ORIENTATION_BASE {
00215          ORIENTATION_BASE_Projection =    0,
00216          ORIENTATION_BASE_North =         1
00217          };
00218 
00219       enum LABEL_MANAGEMENT_MODE {
00220          LABEL_MANAGEMENT_MODE_RenderWithLayer = 0,
00221          LABEL_MANAGEMENT_MODE_RenderLast
00222          };
00223 
00224    #ifdef X_NATIVE
00225       class OBJMGRFORM {
00226          public:
00227 
00228             //! Constructor.
00229             OBJMGRFORM (
00230                GRE_GROUP *group
00231                );
00232 
00233             //! Destructor.
00234             ~OBJMGRFORM (
00235                );
00236 
00237             //! Create the form widget and show in object manager.
00238             Widget Create (
00239                );
00240 
00241             Widget GetForm (
00242                ) const { return (m_form); }
00243 
00244             void HideLayers (
00245                );
00246 
00247             //! @return Next position after item.
00248             short SetObjMgrPos (
00249                short pindex = -2
00250                );
00251 
00252             void ShowLayers (
00253                );
00254 
00255          private:
00256             #ifndef GENERATING_DOXYGEN_OUTPUT
00257 
00258             GRE_GROUP *m_group;
00259             Widget m_form;
00260             Widget m_ActiveTB;
00261             Widget m_ShowLayersTB;
00262             Widget m_VisibleIcon[GRE_MAXVIEWS];
00263             Widget m_GroupNameP;
00264             MIUNICODE m_GroupNameStr[64];
00265 
00266             static void CB_CmdGroupControls (Widget, GRE_GROUP *group, void*);
00267             static void CB_CmdGroupDelete (Widget, GRE_GROUP *group, void*);
00268             static void CB_CmdGroupDeleteActiveLayer (Widget, GRE_GROUP *group, void*);
00269             static void CB_CmdGroupDeleteAllLayers (Widget, GRE_GROUP *group, void*);
00270             static void CB_CmdGroupViewpoint (Widget, GRE_GROUP *group, void*);
00271             static void CB_CmdLayerAddAny (Widget, GRE_GROUP *group, void*);
00272             static void CB_CmdLayerAdd (Widget, void *vlayertype, void*);
00273             static void CB_CmdLayerControls (Widget, GRE_GROUP *group, void*);
00274             static void CB_CmdLayerOrder (Widget, void *voption, void*);
00275             static void CB_EditGroupName (MxPromptCallbackStruct*, void *vgroup);
00276             static void CB_NotifyGreObject (const GRE_CALLBACK_MSG *msg, void *vpObjMgrForm);
00277             static void CB_NotifyGreView (const GRE_CALLBACK_MSG *msg, void*);
00278             static void CB_ToggleActive (Widget, void *vgroup, XmToggleButtonCallbackStruct*);
00279             static void CB_ToggleShowLayers (Widget, void *vpObjMgrForm, XmToggleButtonCallbackStruct*);
00280             static void CB_ToggleVisibleInViewNum (Widget, void *vViewNum, XmToggleButtonCallbackStruct*);
00281 
00282             void DestroyForm ();
00283             void OnNotifyGreObject (const GRE_CALLBACK_MSG& msg);
00284 
00285             OBJMGRFORM (const OBJMGRFORM&);
00286             OBJMGRFORM& operator= (const OBJMGRFORM&);
00287 
00288             #endif //!< GENERATING_DOXYGEN_OUTPUT
00289          }; //! End of GRE_GROUP::OBJMGRFORM
00290       #endif
00291 
00292       GRE_LAYER *firstlayer;              //!< First layer in group
00293       GRE_LAYER *lastlayer;               //!< Last layer in group
00294       GRE_LAYER *activelayer;             //!< Currently active layer for group
00295       GRE_LAYER *matchedlayer;            //!< Layer matched to for auto-match options
00296       UINT8 RotBase;                      //!< Base for rotation: 0=Projection, 1=North
00297       double AspectX;
00298       double AspectY;
00299       double RotAngle;                    //!< Rotation angle
00300       double zinit;                       //!< Minimum Z value for group (unscaled)
00301       double zlast;                       //!< Maximum Z value for group (unscaled)
00302       GRE_GROUP *prevgroup;
00303       GRE_GROUP *nextgroup;
00304       GRE_LAYOUT *layout;                 //!< Pointer to "parent" layout
00305       UINT32 groupflags;
00306       MDISPGROUPPOSN xposn, yposn;
00307       GRE_VIEWPOINT3D *m_ViewPoint3D;     //!< 3-D viewpoint for group when used in layout
00308       UINT32 VisibleViewLayout;           //!< Bits for whether group is visible in layout views
00309 
00310    #ifdef X_NATIVE
00311       //! Get group from object attached to Widget userData
00312       static GRE_GROUP* GetFromWidget (
00313          Widget w
00314          );
00315    #endif
00316 
00317       //! Install SML class, called by internal SML function.
00318       static void SMLClassInstall (
00319          SMLCONTEXT *context                    //!< SML context
00320          );
00321 
00322       //! Construct "stand-alone" group
00323       explicit GRE_GROUP (
00324          CREATEFLAGS createflags = CREATEFLAG_None
00325          );
00326 
00327       //! Construct group within a layout
00328       GRE_GROUP (
00329          GRE_LAYOUT *layout,
00330          CREATEFLAGS createflags = CREATEFLAG_None,
00331          GRE::LISTPOS listpos = GRE::LISTPOS_Last,
00332          GRE_GROUP *refgroup = 0
00333          );
00334 
00335       //! Destructor.
00336       virtual ~GRE_GROUP ();
00337 
00338       //! Determine if lat/lon aspect adjustment will be done
00339       bool AdjLatLon (
00340          );
00341 
00342       //! Determine if option to adjust lat/lon aspect can be set
00343       bool AdjLatLonCanSet (
00344          );
00345 
00346       //! Change group position in list
00347       bool ChangeListPos (
00348          GRE_GROUP* refgroup,
00349          GRE::LISTPOS listpos
00350          );
00351 
00352       //! Check if layer of specified type can be added
00353       ERRVALUE CheckAddLayer (
00354          GRE_LAYER::TYPE layertype = GRE_LAYER::TYPE_None
00355          ) const;
00356 
00357       //! Check if georeference for layers in group are compatible
00358       void CheckGeorefCompatible (
00359          ) const;
00360 
00361       //! Compute extents of group in layout
00362       void ComputeLayoutExtents (
00363          );
00364 
00365       //! Compute map coordinate extents for group
00366       ERRVALUE ComputeMapExtents (
00367          ); 
00368 
00369       ERRVALUE ComputeRegionFromLayers (
00370          REGION2D& region,                   //!< Region returned, will be in group's RenderCoordRefSys
00371          bool IncludeMargins,                //!< Include layer margins
00372          GRE_LAYER::FILTER *filter = 0       //!< Filter
00373          ) const;
00374 
00375    #ifndef GENERATING_DOXYGEN_OUTPUT
00376       // Construct GROUPVIEW instance for this group and specified view.
00377       GRE::GROUPVIEW* ConstructGroupView (
00378          GRE_VIEW *view
00379          );
00380    #endif
00381 
00382       //! Create group if CREATEFLAG_DeferCreate was specified in constructor.
00383       void Create (
00384          CREATEFLAGS createflags = CREATEFLAG_None
00385          );
00386 
00387       //! Destroy all layers in this group
00388       void DestroyAllLayers (
00389          );
00390 
00391       //! Destroy specified layer in this group
00392       void DestroyLayer (
00393          GRE_LAYER* layer
00394          );
00395 
00396       //! Draw group overlay containing 'active' element for each layer.
00397       ERRVALUE DrawActiveOverlay (
00398          GRE::DRAWFLAGS DrawFlags = GRE::DRAWFLAG_UpdateScreen,
00399          GRE_VIEW *view = 0                     //!< View to draw overlay for, 0 for all, will be drawn first if drawing multiple
00400          );
00401 
00402    #if defined(X_NATIVE) || defined(WIN32_MFC)
00403       //! Dialog to specify group clip settings.
00404       ERRVALUE DlgGetClipSettings (
00405          MDLGPARENT dlgparent
00406          );
00407    #endif
00408 
00409       //! Find layer using unique ID.
00410       virtual GRE_LAYER *FindLayerByID (
00411          UINT32 LayerID
00412          ) const;
00413 
00414       //! Open geocatalog dialog for adding layers to group.
00415       ERRVALUE GeoCatDlgOpen (
00416          );
00417 
00418       //! Set point for next "point search" operation in geocatalog dialog.
00419       void GeoCatDlgSetSearchPoint (
00420          const DPOINT2D& SearchPoint,           //!< Point coordinates
00421          const SPATREF::COORDREFSYS& PointCRS   //!< Point coordinate reference system
00422          ) const;
00423 
00424       //! Determine "active" layer for group.
00425       //! @return Active layer or NULL if none.
00426       GRE_LAYER* GetActiveLayer (
00427          ) const { return (activelayer); }
00428 
00429       //! Get clipping region for group.
00430       const REGION2D& GetClipRegion (
00431          ) const;
00432 
00433       //! Get setting for "clip to matched layer" regardless of whether or not will be auto-matched.
00434       bool GetClipToMatchedLayer (
00435          ) const { return (m_ClipToMatchedLayer); }
00436 
00437       //! Get extents of group in specified coordinates
00438       ERRVALUE GetExtents (
00439          DRECT2D* extents,                      //!< Group extents returned
00440          UINT32 flags                           //!< MDISPEXTENTS_... flags
00441          );
00442 
00443       //! Get first layer in group.
00444       GRE_LAYER* GetFirstLayer (
00445          ) const { return (firstlayer); }
00446 
00447       //! Get current group flag settings
00448       UINT32 GetFlags (
00449          ) const { return (groupflags); }
00450 
00451       //! Get full group name as MISTRING.
00452       virtual void GetFullName (
00453          MISTRING& name                         //!< Name returned
00454          ) const;
00455 
00456       const REGION2D& GetFullRegion (
00457          ) const { return (m_FullRegion); }
00458 
00459       LABEL_MANAGEMENT_MODE GetLabelManagementMode (
00460          ) const { return (m_LabelManagementMode); }
00461 
00462       //! Get last layer in group.
00463       GRE_LAYER* GetLastLayer (
00464          ) const { return (lastlayer); }
00465 
00466       //! Get layer to use for 1X zoom.
00467       GRE_LAYER* GetLayerZoom1X (
00468          bool PreferredOnly                     //!< Use 'preferred' layers only
00469          ) const;
00470 
00471       //! Get layout group is contained in.
00472       //! @return pointer to layout.
00473       GRE_LAYOUT * GetLayout (
00474          ) const { return (layout); }
00475 
00476       const DRECT2D& GetLayoutExtents (
00477          ) const { return (m_LayoutExtents); }
00478 
00479       //! Get current group drawing order position in list.
00480       //! @return 0 for first group, 1 for second, etc.
00481       int GetListPos (
00482          );
00483 
00484       //! Return geographically-attached reference group if any.
00485       GRE_GROUP* GetMatchedGroup (
00486          bool firstonly = false           //! True to return immediate (first link) matched group
00487          ) const;
00488 
00489       MATTE& GetMatte (
00490          ) { return (m_Matte); }
00491       
00492       //! Get "set" for mutual exclusiveness between groups.
00493       UINT32 GetMutualExclusiveGroupSet (
00494          ) const { return (m_MutualExclusiveGroupSet); }
00495 
00496       //! Get group name.
00497       const MISTRING& GetName (
00498          ) const { return (m_name); }
00499 
00500       //! Determine if need updated extents.
00501       bool GetNeedUpdateExtents (
00502          ) const { return (m_NeedUpdateExtents); }
00503 
00504       //! Get next group in layout.
00505       GRE_GROUP* GetNext (
00506          ) const { return (nextgroup); }
00507 
00508       //! Get next available unique ID.
00509       virtual UINT32 GetNextLayerID (
00510          ) const;
00511 
00512    #ifdef X_NATIVE
00513       OBJMGRFORM& GetObjMgrForm (
00514          ) { return (m_ObjMgrForm); }
00515    #endif
00516 
00517       //! Get previous group in layout.
00518       GRE_GROUP* GetPrevious (
00519          ) const { return (prevgroup); }
00520 
00521       //! Get relative scale
00522       double GetRelativeScale (
00523          ) const { return (m_RelativeScale); }
00524 
00525       //! Get CoordRefSys group is to be rendered in if not auto-matched.
00526       const SPATREF::COORDREFSYS& GetRenderCoordRefSys (
00527          ) const { return (m_RenderCRS); }
00528 
00529       //! Get rotation angle relative to base in radians
00530       double GetRotationAngle (
00531          ) const { return (RotAngle); }
00532 
00533       //! Get serializer instance being used to load group.
00534       //! @return Pointer to SERIALIZER, NULL if not being loaded.
00535       SERIALIZER* GetSerializer (
00536          ) const { return (m_pSerializer); }
00537 
00538       //! Compute dimensions of object based on scale and georeference
00539       virtual ERRVALUE GetSizeMeters (
00540          DPOINT2D& sizemeters                   //!< Size returned in meters
00541          );
00542 
00543       //! Get transformation from group to view.
00544       const TRANS2D_AFFINE& GetTransViewToGroup (
00545          ) const { return (m_ViewToGroup); }
00546 
00547       //! Get CoordRefSys group actually used for rendering.
00548       const SPATREF::COORDREFSYS& GetUsedCoordRefSys (
00549          ) const;
00550 
00551       GRE_VIEWPOINT3D* GetViewPoint3D (
00552          ) const { return (m_ViewPoint3D); }
00553 
00554       //! Get scale range over which group is visible
00555       void GetVisibleScaleRange (
00556          double& MinScaleVisible,            //!< Minimum scale visible returned, 0 for no minimum
00557          double& MaxScaleVisible             //!< Maximum scale visible returned, 0 for no maximum
00558          ) { MinScaleVisible = m_MinScaleVisible; MaxScaleVisible = m_MaxScaleVisible; return; }
00559 
00560       //! Determine if group has other groups attached to it
00561       bool HasAttachedGroups (
00562          ) const;
00563 
00564       //! Determine if any layers in group have "highlightable" elements.
00565       bool HasHighlightableLayer (
00566          GRE_VIEW *view = 0                     //!< Reference view for layer visibility test
00567          ) const;
00568 
00569       //! Determine if group has any layers
00570       virtual bool HasLayers (
00571          ) const;
00572 
00573       //! Determine if group has a legend.
00574       bool HasLegend (
00575          ) const { return ((this->groupflags & GROUPFLAG_CombineLayersInLegend) != 0); }
00576 
00577       //! Determine if group has mutually-exclusive layers
00578       bool HasMutuallyExclusiveLayers (
00579          ) const { return (m_HasMutuallyExclusiveLayers); }
00580 
00581       //! Determine if group has any temporary layers
00582       bool HasTempLayers (
00583          ) const;
00584 
00585       //! Setup for default highlighting of layer elements.
00586       void HighlightSetupDefault (
00587          GRE_VIEW *view = 0                     //!< Optional view for determining layer visibility
00588          );
00589 
00590       //! Invalidate all view buffers for this group.
00591       void InvalidateAllViews (
00592          GRE::RENDERTARGET Target = GRE::RENDERTARGET_GroupAll | GRE::RENDERTARGET_LayerAll
00593          );
00594 
00595       //! Determine if group can be viewed in 3D
00596       bool Is3D (
00597          ) const { return (!layout || (groupflags & GROUPFLAG_3D)); }
00598 
00599       bool IsBeingLoaded (
00600          ) const { return (m_pSerializer != 0); }
00601 
00602       //! Determine if group is to be clipped.
00603       bool IsClipped (
00604          ) const;
00605 
00606       //! Determine if group is to be clipped to the auto-matched layer.
00607       bool IsClippedToMatchedLayer (
00608          ) const { return (m_ClipToMatchedLayer && GetMatchedLayer() != 0); }
00609 
00610       //! Determine if group has been created.
00611       //! This is done automatically by constructor unless CREATEFLAG_DeferCreate was specified.
00612       bool IsCreated (
00613          ) const { return (m_IsCreated); }
00614 
00615       //! Determine if group should be ignored for extents determination
00616       bool IsIgnored (
00617          ) const;
00618 
00619       //! Determine if group only allows a single layer
00620       bool IsSingleLayer (
00621          ) const { return ((groupflags & GROUPFLAG_SingleLayer) != 0); }
00622 
00623       //! Determine if group is a valid object
00624       bool IsValid (
00625          ) const;
00626 
00627       //! Determine if group visible at specified scale
00628       bool IsVisibleAtScale (
00629          double scale
00630          ) const { return (!layout || (scale >= m_MinScaleVisible && (m_MaxScaleVisible <= 0.0 || scale <= m_MaxScaleVisible))); }
00631 
00632       //! Determine if group is visible in specified view.
00633       bool IsVisibleInView (
00634          const GRE_VIEW *view
00635          ) const;
00636 
00637       //! Read from serialization
00638       virtual ERRVALUE SerialRead (
00639          SERIALIZER& serializer
00640          );
00641 
00642       //! Write values to serialization
00643       virtual ERRVALUE SerialWrite (
00644          SERIALIZER& serializer,
00645          const char *tagname = 0
00646          ) const;
00647 
00648       //! Set group to 2D
00649       void Set2D (
00650          );
00651 
00652       //! Set active layer for group
00653       void SetActiveLayer (
00654          GRE_LAYER *layer                       //!< Layer to make active
00655          );
00656 
00657       //! Set clipping rectangle.
00658       void SetClipRect (
00659          const DRECT2D& ClipRect,               //!< Rectangle to clip to
00660          const SPATREF::COORDREFSYS& RectCRS,   //!< Rectangle CRS
00661          bool notify = true
00662          );
00663 
00664       //! Set clipping region.
00665 //    void SetClipRegion (
00666 //       const REGION2D& ClipRegion,            //!< Clip region
00667 //       bool notify = true
00668 //       );
00669 
00670       //! Set whether to clip to 'auto-matched' layer
00671       void SetClipToMatchedLayer (
00672          bool ClipToMatchedLayer,               //!< 'true' to clip, 'false' to not
00673          bool notify = true                     //!< Send ACTION_ChangeBegin/End notification
00674          );
00675 
00676       //! Set specified group flags
00677       void SetFlags (
00678          UINT32 flags,                          //!< GROUPFLAG_... flag values
00679          UINT32 mask                            //!< GROUPFLAG_... mask for which flags to change
00680          );
00681 
00682       void SetLabelManagementMode (
00683          LABEL_MANAGEMENT_MODE mode
00684          ) { m_LabelManagementMode = mode; }
00685 
00686       //! Set group position in list
00687       void SetListPos (
00688          int newpos                             //!< New list position
00689          );
00690 
00691       //! Set group to "modified" status
00692       void SetModified (
00693          bool notify = true,                    //!< Set to invoke callbacks with "Changed" message
00694          bool ViewsNeedRedraw = true            //!< Set all views of group as needing redraw
00695          );
00696 
00697       //! Set "group set" which group is mutually-exclusive with.
00698       void SetMutualExclusiveGroupSet (
00699          UINT32 GroupSet                        //!< Group set bits
00700          );
00701 
00702       //! Set whether layers are mutually-exclusive.
00703       void SetMutuallyExclusiveLayers (
00704          bool LayersMutuallyExclusive = true
00705          );
00706 
00707       //! Set group name.
00708       ERRVALUE SetName (
00709          const MISTRING& newname                //!< New name
00710          );
00711 
00712       //! Set group to recompute extents.
00713       void SetNeedUpdateExtents (
00714          ) { m_NeedUpdateExtents = true; }
00715 
00716       //! Set group rotation base and orientation.
00717       void SetOrientation (
00718          UINT8 NewRotBase,                      //!< ROTBASE_Projection or ROTBASE_North
00719          double NewRotAngle                     //!< Rotation angle, radians clockwise relative to base
00720          ) { RotBase = NewRotBase; RotAngle = NewRotAngle; }
00721 
00722       //! Set group projection to match specified layer
00723       void SetProjView (
00724          const GRE_LAYER *layer                 //!< Layer to obtain projection from, NULL to match first raster/layer
00725          );
00726 
00727       //! Set group scale relative to layout design scale.
00728       void SetRelativeScale (
00729          double RelativeScale,
00730          bool notify = true
00731          );
00732 
00733       //! Set coordinate reference system to render group in.
00734       ERRVALUE SetRenderCoordRefSys (
00735          const SPATREF::COORDREFSYS& RenderCRS
00736          );
00737 
00738       //! Setup equirectangular CRS based on group datum.
00739       ERRVALUE SetupEquirectangular (
00740          SPATREF::COORDREFSYS& CoordRefSys,     //!< Coordinate Reference System definition returned
00741          const DPOINT2D& center                 //!< Projection center in CRS used by group
00742          ) const;
00743 
00744       //! Set group visibility in specified views
00745       void SetVisible (
00746          UINT32 flags,                          //!< Bits indicating which views to modify visibility for
00747          bool set                               //!< true if visible, false if not
00748          );
00749 
00750       //! Set scale range over which group is visible
00751       void SetVisibleScaleRange (
00752          double MinScaleVisible,
00753          double MaxScaleVisible
00754          ) { m_MinScaleVisible = MinScaleVisible; m_MaxScaleVisible = MaxScaleVisible; }
00755 
00756       //! Set group visibility in specified view
00757       void SetVisibleView (
00758          GRE_VIEW *view,                        //!< View to set visibility for
00759          bool visible                           //!< true if visible, false if not
00760          );
00761 
00762       //! Write template to serialization
00763       ERRVALUE TemplateWrite (
00764          SERIALIZER& serializer,
00765          const char *tagname = 0
00766          );
00767       
00768    protected:
00769 
00770    #ifdef X_NATIVE
00771       //! Create initial set of items in object manager.
00772       virtual void ObjMgrInitItems (
00773          );
00774    #endif
00775 
00776    private:
00777 
00778       #ifndef GENERATING_DOXYGEN_OUTPUT
00779 
00780    #ifdef X_NATIVE
00781       OBJMGRFORM m_ObjMgrForm;
00782       GEOCAT_DIALOG *m_GeoCatDlg;
00783       MXDHANDLE m_pDlgObjMgr;
00784    #endif
00785 
00786       SERIALIZER *m_pSerializer;             // Set while group is being loaded
00787       bool m_IsCreated;
00788       bool m_NeedUpdateExtents;              // Extents need to be recomputed
00789       double m_MinScaleVisible;
00790       double m_MaxScaleVisible;
00791       double m_DesignScale;                  // Group Design scale
00792       double m_RelativeScale;                // Scale relative to layout Design scale
00793       mutable MIUNICODE m_ActiveLayerName[64];
00794       bool m_ClipToMatchedLayer;
00795       bool m_HasMutuallyExclusiveLayers;
00796       GRE::HIGHLIGHTMODE m_ElemHighlightMode;
00797       UINT32 m_MutualExclusiveGroupSet;
00798       MATTE m_Matte; 
00799       MISTRING m_name;
00800       SPATREF::COORDREFSYS m_RenderCRS;      // Coordinate reference system group rendered in if not auto-matched
00801       REGION2D m_ClipRegion;                 // Clip region
00802       REGION2D m_FullRegion;                 // Union of all layer regions in group's render CRS
00803       TRANS2D_AFFINE m_ViewToGroup;
00804       DRECT2D m_LayoutExtents;               // Extents in layout coordinates
00805       LABEL_MANAGEMENT_MODE m_LabelManagementMode;
00806 
00807       static void GRECB_Group (
00808          const GRE_CALLBACK_MSG *msg,
00809          void *vgroup
00810          );
00811 
00812       static const SERIALIZER::ITEMDEF* SerialGetItemDef (
00813          SERIALIZER& serializer
00814          );
00815 
00816       static ERRVALUE SerializerCB_OldClipProj (SERIALIZER&, const SERIALIZER::ITEMDEF*, void *vgroup, SERIALIZER::ITEMDEF::ACTION);
00817       static ERRVALUE SerializerCB_OldClipRect (SERIALIZER&, const SERIALIZER::ITEMDEF*, void *vgroup, SERIALIZER::ITEMDEF::ACTION);
00818       static ERRVALUE SerializerCB_OldGroupFlags (SERIALIZER&, const SERIALIZER::ITEMDEF*, void *vgroup, SERIALIZER::ITEMDEF::ACTION);
00819 
00820       void Init ();
00821 
00822       //! Determine layer group projection will be auto-matched to
00823       GRE_LAYER *GetMatchedLayer () const;
00824 
00825    #ifdef X_NATIVE
00826       virtual void OnNotifyGreObjMgr (const GRE_CALLBACK_MSG& msg);
00827    #endif
00828 
00829       // GRE_OBJECT overrides.
00830       virtual bool v_Destroy (bool NotifyParent);
00831       virtual MICON v_GetIcon () const;
00832       virtual const char* v_GetTypeName () const;
00833 
00834       // GRE_VIEWABLE overrides.
00835    #ifdef X_NATIVE
00836       virtual void v_DlgObjMgrClose ();
00837       virtual ERRVALUE v_DlgObjMgrCreate (MDLGPARENT dlgparent, const MISTRING& title);
00838       virtual void v_DlgObjMgrDestroy ();
00839       virtual bool v_DlgObjMgrIsOpen () const;
00840       virtual void v_DlgObjMgrOpen ();
00841    #endif
00842       virtual ERRVALUE v_DrawAllViews (GRE::DRAWCONDITION condition);
00843       virtual double v_GetDesignScale () const;
00844       virtual const DRECT2D& v_GetExtents () const;
00845       virtual void v_SetDesignScale (double DesignScale, bool notify);
00846 
00847       GRE_GROUP (const GRE_GROUP&);
00848       GRE_GROUP& operator= (const GRE_GROUP&);
00849 
00850       friend class GRE_LAYOUT;
00851    #ifdef X_NATIVE
00852       friend class GRE_GROUP::OBJMGRFORM;
00853    #endif
00854 
00855       #endif //!< GENERATING_DOXYGEN_OUTPUT
00856    };
00857 
00858 DEFINE_ENUM_OP_BITWISE(GRE_GROUP::CREATEFLAGS)
00859 
00860 
00861 //===================================================================================================================
00862 
00863 #ifdef WIN32_MFC
00864 
00865 #ifndef GENERATING_DOXYGEN_OUTPUT
00866 class GRE_MFC_GROUP : public GRE_MFC_VIEWABLE {
00867    protected:
00868 
00869       GRE_MFC_GROUP ();
00870       DECLARE_DYNCREATE(GRE_MFC_GROUP)
00871 
00872    public:
00873 
00874       GRE_GROUP* GetGroup (
00875          ) const { return (m_group); }
00876 
00877       virtual ~GRE_MFC_GROUP();
00878 
00879    protected:
00880       GRE_GROUP *m_group;
00881 
00882       DECLARE_MESSAGE_MAP()
00883    };
00884 #endif //!< GENERATING_DOXYGEN_OUTPUT
00885 
00886 #endif
00887 
00888 //===================================================================================================================
00889 
00890 #endif   //!< INC_GRE_GROUP_H

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