lrlegend.h

Go to the documentation of this file.
00001 /**
00002  * \file lrlegend.h <gre/lrlegend.h>
00003  * \brief GRE_LAYER_LEGEND class definitions
00004  *
00005  * \if NODOC
00006  * $Id: lrlegend.h_v 1.8 2005/03/31 16:57:06 fileserver!dwilliss Exp $
00007  *
00008  * $Log: lrlegend.h_v $
00009  * Revision 1.8  2005/03/31 16:57:06  fileserver!dwilliss
00010  * Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define
00011  *
00012  * Revision 1.7  2005/02/28 17:53:24  scowan
00013  * Support layer copy virtual method.
00014  *
00015  * Revision 1.6  2005/01/20 16:56:35  mju
00016  * Redesign layer type registration.
00017  *
00018  * Revision 1.5  2004/10/01 17:19:55  mju
00019  * Add dlgparent to assignObject.
00020  *
00021  * Revision 1.4  2004/03/05 18:53:41  mju
00022  * Use virtual dtor if virtual fns.
00023  *
00024  * Revision 1.3  2003/09/15 13:48:59  fileserver!dwilliss
00025  * Doxygen
00026  *
00027  * Revision 1.2  2003/07/30 15:21:53  mju
00028  * Ignore private section.
00029  *
00030  * Revision 1.1  2002/09/20 17:37:28  mju
00031  * Initial revision
00032  *
00033  * \endif
00034 **/
00035 
00036 #ifndef  INC_GRE_LRLEGEND_H
00037 #define  INC_GRE_LRLEGEND_H
00038 
00039 #ifndef  INC_MI32_GRE_H
00040 #include <mi32/gre.h>
00041 #endif
00042 
00043 //===================================================================================================================
00044 
00045 class GRE_LAYER_LEGEND : public GRE_LAYER {
00046    public:
00047 
00048       enum SUBTYPE {
00049          //! These types are stored in layouts by number
00050          //! and thus must not be changed
00051          SUBTYPE_Point =         0,
00052          SUBTYPE_Line =          1,
00053          SUBTYPE_Poly =          2,
00054          SUBTYPE_ColorSample =   3,
00055          SUBTYPE_ColorScale =    4,
00056          SUBTYPE_RasterSample =  5
00057          };
00058 
00059       class DISPPARM : public GRE_LAYER::DISPPARM {
00060          public:
00061 
00062             class DLG;
00063 
00064             MIUNICODE filename[FILENAME_MAX];         //!< Filename of the object
00065             MIUNICODE stylefilename[FILENAME_MAX]; //!< File for style object if needed, blank if under vector
00066             INT32 styleinode;                      //!< Inode for style object if needed, <= 0 if under vector
00067             RVCLEGENDINFO objinfo;
00068 
00069          /*=================This stuff must be saved/loaded by mdlegend.c=============*/
00070             INT32 flags;                        //!< LEGENDFLAG_...
00071             SUBTYPE LegendType;                 //!< Legend subtype
00072             int StyleTable;                     //!< Style assignment table (-1 if not used)
00073             int NumCols;                        //!< # of columns of legend stuff
00074             TEXTSTYLE Style[4];                 //!< Font styles to use
00075             COLOR BackgroundColor;              //!< Color for background (default: transparent)
00076             COLOR SampleBorderColor;            //!< Sample border color
00077             COLOR LegendBorderColor;            //!< Legend border color
00078             //! All measurements are stored in output mm
00079             double SampleBorderWidth;
00080             double LegendBorderWidth;
00081             double ColSpace;                    //!< Space between columns
00082             double SampleSpace;                 //!< Space between sample and description
00083             double SampleHeight;                //!< Size of sample
00084             double SampleWidth;                 //!< Size of sample
00085             double SampleOffset;                //!< Offset from left edge
00086             double MapScale;                    //!< Map scale all measurements are relative to
00087             double LineSpace;                   //!< Minimum space between lines
00088             double MarginWidth;                 //!< Margin around whole legend
00089             int units;                          //!< Units user wants to edit sizes in
00090 
00091             //! Stuff for LAYERTYPE_LegendColorScale
00092             double MinIndex;                    //!< Minimum colormap index
00093             double MaxIndex;                    //!< Maximum colormap index
00094             UINT32 NumTicksL;                   //!< Number of ticks
00095             UINT32 NumTicksR;                   //!< Number of ticks
00096             double MinValL;                     //!< Minimum Value
00097             double MinValR;                     //!< Minimum Value
00098             double MaxValL;                     //!< Maximum Value
00099             double MaxValR;                     //!< Maximum Value
00100 
00101          /*=================This stuff is just internal=========================*/
00102 
00103             double Height, Width;      //!< Size of layer in ground meters (computed)
00104             double FullDescHeightM; 
00105 
00106             DISPPARM ();
00107             DISPPARM (const DISPPARM& rhs) {
00108                Copy(rhs);
00109                }
00110             virtual ~DISPPARM () {
00111                Free();
00112                }
00113 
00114             DISPPARM& operator= (const DISPPARM& rhs) {
00115                if (this != &rhs) {
00116                   Free();
00117                   Copy(rhs);
00118                   }
00119                return (*this);
00120                }
00121 
00122          protected:
00123             virtual const SERIALIZER::ITEMDEF* SerialGetItemDef (SERIALIZER& serializer) const;
00124 
00125          private:
00126             #ifndef GENERATING_DOXYGEN_OUTPUT
00127             void Copy (const DISPPARM&);
00128             void Free ();
00129             #endif //!< GENERATING_DOXYGEN_OUTPUT
00130          };
00131 
00132       //! Register this layer type
00133       static void RegisterType (
00134          );
00135 
00136       //! Construct layer and insert into list
00137       explicit GRE_LAYER_LEGEND (
00138          GRE_GROUP *group,                            //!< Group to contain layer
00139          CREATEFLAGS createflags = CREATEFLAG_None    //!< Creation flags
00140          );
00141 
00142       virtual ~GRE_LAYER_LEGEND ();
00143 
00144       //! Retrieve layer-specific display parameters.
00145       const DISPPARM& GetDispParm (
00146          ) const { return (m_dispparm); }
00147 
00148       //! Set layer-specific display parameters.
00149       //! This is the recommended method for changing how an existing layer is to be
00150       //! rendered.  Validation will be performed on the specified parameters and
00151       //! adjustments made to the layer's copy if necessary.  Use of this method
00152       //! usually result in a ChangeBegin / ChangeEnd message pair, and will also
00153       //! generate a ChangeObject message if the spatial object used in the layer
00154       //! is changed.
00155       ERRVALUE SetDispParm (
00156          const DISPPARM& dispparm               //!< Parameters to set
00157          );
00158 
00159    #if defined(X_NATIVE) && !defined(GENERATING_DOXYGEN_OUTPUT)
00160       static void CB_CreateDialog (Widget, void*, void*);
00161    #endif
00162 
00163    protected:
00164 
00165       DISPPARM m_dispparm;                      //!< Layer-specific display parameters
00166 
00167    private:
00168       #ifndef GENERATING_DOXYGEN_OUTPUT
00169 
00170       int DrawLegend (void*, int);
00171       int SetupLegend (void*);
00172 
00173       //! Overrides from GRE_LAYER.
00174       virtual ERRVALUE v_AssignObject (const RVC::OBJITEM& objitem, MDLGPARENT dlgparent);
00175    #if defined(X_NATIVE) || defined(WIN32_MFC)
00176       virtual int v_ControlPanel (MDLGPARENT dlgparent,UINT32 flags = 0);
00177    #endif
00178       virtual GRE_LAYER* v_Copy (GRE_GROUP *group) const;
00179       virtual ERRVALUE v_Draw (GRE_LAYERDC& layerdc);
00180       virtual const RVC::OBJITEM& v_GetObjItem (int component) const;
00181       virtual const char* v_SerialGetTagName () const;
00182       virtual void v_SetDftName (bool ReplaceExisting);
00183       virtual ERRVALUE v_TemplateRead (SERIALIZER& serializer);
00184       virtual int v_UpdateExtents (bool forceupdate);
00185 
00186       GRE_LAYER_LEGEND (const GRE_LAYER_LEGEND&);
00187       GRE_LAYER_LEGEND& operator= (const GRE_LAYER_LEGEND&);
00188 
00189       #endif //!< GENERATING_DOXYGEN_OUTPUT
00190    };
00191 
00192 
00193 #define LEGENDFLAG_ConstantSize     0x00000001
00194 #define LEGENDFLAG_RowMajor         0x00000002
00195 #define LEGENDFLAG_LayoutScale      0x00000004  //!< Use layout scale for sizes
00196 #define LEGENDFLAG_RightJustify     0x00000008  //!< Right justify descriptions
00197 #define LEGENDFLAG_SampleOnRight    0x00000010  //!< Samples on the right
00198 #define LEGENDFLAG_SideA            0x00000040  //!< Labels on top/left
00199 #define LEGENDFLAG_SideB            0x00000080  //!< Labels on bottom/right
00200 #define LEGENDFLAG_DescCenterVert   0x00000100
00201 #define LEGENDFLAG_CenterHeadings   0x00000200
00202 #define LEGENDFLAG_Horizontal    LEGENDFLAG_RowMajor
00203 
00204 //===================================================================================================================
00205 
00206 #endif   //!< INC_GRE_LRLEGEND_H

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