scriptcontext.h

Go to the documentation of this file.
00001 /**
00002  * \file scriptcontext.h <gre/scriptcontext.h>
00003  * \brief GRE_SCRIPTCONTEXT classes
00004  *
00005  * \if NODOC
00006  * $Id: scriptcontext.h_v 1.2 2005/03/31 16:57:07 fileserver!dwilliss Exp $
00007  *
00008  * $Log: scriptcontext.h_v $
00009  * Revision 1.2  2005/03/31 16:57:07  fileserver!dwilliss
00010  * Rename one of our types to MIUNICODE because it conflicted with a Microsoft #define
00011  *
00012  * Revision 1.1  2005/01/20 16:58:21  mju
00013  * Initial revision
00014  *
00015  * \endif
00016 **/
00017 
00018 #ifndef  INC_GRE_SCRIPTCONTEXT_H
00019 #define  INC_GRE_SCRIPTCONTEXT_H
00020 
00021 #ifndef INC_GRE_BASE
00022    #include <gre/base.h>
00023 #endif
00024 
00025 #ifndef INC_MI32_SML_H
00026    #include <mi32/sml.h>
00027 #endif
00028 
00029 #ifndef INC_MI32_MGD2_H
00030    #include <mi32/mgd2.h>
00031 #endif
00032 
00033 #ifndef INC_RVC_CAD_H
00034    #include <rvc/cad.h>
00035 #endif
00036 
00037 namespace RVC {
00038    class STYLE;
00039    }
00040 
00041 //===================================================================================================================
00042 
00043 class GRE_SCRIPTCONTEXT_DRAW {
00044    public:
00045 
00046       //! Constructor.
00047       GRE_SCRIPTCONTEXT_DRAW (
00048          );
00049 
00050       //! Destructor.
00051       virtual ~GRE_SCRIPTCONTEXT_DRAW (
00052          );
00053 
00054       //! Attach SML context.
00055       //! After attachment the SCRIPTCONTEXT_DRAW 'owns' the context and will destroy it when
00056       //! necessary.  The context pointer is passed by reference and set to NULL on return to
00057       //! prevent external use of the context.
00058       void AttachContext (
00059          SMLCONTEXT *& context               //!< Context to attach, will set to NULL on return
00060          );
00061 
00062       //! Create SML context using RVC::GEOMETRIC object.
00063       ERRVALUE CreateContext (
00064          RVC::GEOMETRIC& GeoObj              //!< Geometric object (VECTOR, TIN, CAD, etc)
00065          );
00066 
00067       //! Destroy attached SML context if any.
00068       void DestroyContext (
00069          ) { if (m_context != 0) { m_context->Destroy(); m_context = 0; } }
00070 
00071       //! Get attached SMLCONTEXT pointer.
00072       //! Do not free or Destroy() the returned pointer.
00073       SMLCONTEXT * GetContext (
00074          ) const { return (m_context); }
00075 
00076       //! Determine if have SMLCONTEXT attached.
00077       bool HasContext (
00078          ) const { return (m_context != 0); }
00079 
00080       //! Initialize context variables for drawing.
00081       ERRVALUE InitDraw (
00082          GRE_LAYER *layer,                   //!< Layer
00083          MGD::CONTEXT *gc,                   //!< Drawing device context
00084          const TRANS2D_MAPGEN& trans,
00085          bool Is3D = false                   //!< 3D setting for CartoScript
00086          );
00087 
00088       //! Initialize using layer drawing context.
00089       ERRVALUE InitDraw (
00090          GRE_LAYERDC& layerdc
00091          );
00092 
00093    protected:
00094 
00095       virtual void CreateSymbols (
00096          );
00097 
00098    private:
00099       #ifndef GENERATING_DOXYGEN_OUTPUT
00100 
00101       //! SML symbol pointers for standard symbols.
00102       struct DRAWSYMS {
00103          SMLSYMBOL *CurMapScale;       //!< Current Mapscale at time of drawing
00104          SMLSYMBOL *LayoutMapScale;    //!< Layout Mapscale at time of drawing
00105          SMLSYMBOL *DesignScale;       //!< Design scale at time of drawing
00106          };
00107 
00108       SMLCONTEXT *m_context;
00109       DRAWSYMS m_drawsym;
00110 
00111       GRE_SCRIPTCONTEXT_DRAW (const GRE_SCRIPTCONTEXT_DRAW&);
00112       GRE_SCRIPTCONTEXT_DRAW& operator= (const GRE_SCRIPTCONTEXT_DRAW&);
00113 
00114       #endif // GENERATING_DOXYGEN_OUTPUT
00115    };
00116 
00117 
00118 class GRE_SCRIPTCONTEXT_STYLE : public GRE_SCRIPTCONTEXT_DRAW {
00119    public:
00120 
00121       //! Constructor.
00122       GRE_SCRIPTCONTEXT_STYLE (
00123          );
00124 
00125       //! Destructor.
00126       virtual ~GRE_SCRIPTCONTEXT_STYLE (
00127          );
00128 
00129       //! Create script segment for element and parse specified script.
00130       //! @return SML 'Segment' for parsed script or error < 0.
00131       int CreateSegment (
00132          ELEMTYPE elemtype,                  //!< Element type
00133          const MIUNICODE *scriptstr          //!< Script string
00134          );
00135 
00136       ERRVALUE Evaluate (
00137          int segment,                        //!< SML segment
00138          INT32 ElemNum,                      //!< Element number, type determined from 'segment'
00139          const RVC::STYLE& StyleObj,         //!< RVC Style object
00140          POINTSTYLE& style,                  //!< Style passed/returned
00141          const DPOINT2D* pt = 0,             //!< Sample point for style sample
00142          bool bDrawingLegendView = false     //!< true if drawing sample for legend view
00143          ) const;
00144 
00145       ERRVALUE Evaluate (
00146          int segment,                        //!< SML segment
00147          INT32 ElemNum,                      //!< Element number, type determined from 'segment'
00148          const RVC::STYLE& StyleObj,         //!< RVC Style object
00149          LINESTYLE& style,                   //!< Style passed/returned
00150          const SIMPLE_ARRAY<DPOINT2D>* pt = 0,     //!< Sample points for style sample
00151          bool bDrawingLegendView = false     //!< true if drawing sample for legend view
00152          ) const;
00153 
00154       ERRVALUE Evaluate (
00155          int segment,                        //!< SML segment
00156          INT32 ElemNum,                      //!< Element number, type determined from 'segment'
00157          const RVC::STYLE& StyleObj,         //!< RVC Style object
00158          POLYSTYLE& style,                   //!< Style passed/returned
00159          const SIMPLE_ARRAY<DPOINT2D>* pt = 0,     //!< Sample points for style sample
00160          bool bDrawingLegendView = false     //!< true if drawing sample for legend view
00161          ) const;
00162 
00163       ERRVALUE Evaluate (
00164          int segment,                        //!< SML segment
00165          RVC::CAD::ELEMENT& Element,         //!< CAD element
00166          const RVC::STYLE& StyleObj,         //!< RVC Style object
00167          const SIMPLE_ARRAY<DPOINT2D>* pt = 0,     //!< Sample points for style sample
00168          bool bDrawingLegendView = false     //!< true if drawing sample for legend view
00169          ) const;
00170 
00171       //! Sets the value of the sample rectangle
00172       void SetSampleRect (
00173          const DRECT2D& rect
00174          ) { m_stylesym.rect = rect; }
00175 
00176    protected:
00177 
00178       virtual void CreateSymbols (
00179          );
00180 
00181    private:
00182       #ifndef GENERATING_DOXYGEN_OUTPUT
00183 
00184       //! SML symbol pointers for standard symbols.
00185       struct STYLESYMS {
00186          SMLSYMBOL *Style;             //!< Style name (string)
00187          SMLSYMBOL *Symbol;            //!< Point symbol name (string)
00188          SMLSYMBOL *DrawPatt;          //!< Pattern for line drawing (string)
00189          SMLSYMBOL *FillPatt;          //!< Pattern for filling (string)
00190          SMLSYMBOL *DrawColor;         //!< Line or Point color (string)
00191          SMLSYMBOL *FillColor;         //!< Fill color (string)
00192          SMLSYMBOL *LineScale;         //!< Line Scaling (number)
00193          SMLSYMBOL *XScale;            //!< X scaling (number)
00194          SMLSYMBOL *YScale;            //!< Y scaling (number)
00195          SMLSYMBOL *Angle;             //!< Rotation angle (number)
00196          SMLSYMBOL *UseStyle;          //!< Flag to use specified style (number)
00197          SMLSYMBOL *DrawSymbol;        //!< Flag to use point symbol (number)
00198          SMLSYMBOL *DrawLinePatt;      //!< Flag to use line pattern for drawing (number)
00199          SMLSYMBOL *DrawBitmapPatt;    //!< Flag to use bitmap pattern for drawing (line or symbol) (number)
00200          SMLSYMBOL *FillBitmapPatt;    //!< Flag to use bitmap pattern for filling (number)
00201          SMLSYMBOL *FillHatchPatt;     //!< Flag to use hatch pattern for filling (number)
00202          SMLSYMBOL *FillInside;        //!< Flag set to fill inside (number)
00203          SMLSYMBOL *DrawBorder;        //!< Flag set to draw border (number)
00204          SMLSYMBOL *MapScale;          //!< Mapscale for relative sizes
00205          SMLSYMBOL *DrawDone;          //!< Flag shows that drawing was already done by query
00206          SMLSYMBOL *DrawTransPct;      //!< Transparency percentage for "DrawColor"
00207          SMLSYMBOL *FillTransPct;      //!< Transparency percentage for "FillColor"
00208          SMLSYMBOL *DrawingSample;     //!< Drawing Sample
00209          SMLSYMBOL *DrawingLegendView;    //!< Drawing Sample
00210          SMLSYMBOL *SampleRect;        //!< Symbol when drawing a style sample
00211          DRECT2D rect;                 //!< The rectangle that SampleRect points to
00212          };
00213 
00214       STYLESYMS m_stylesym;
00215 
00216       void GetColor (
00217          SMLSYMBOL*,
00218          SMLSYMBOL*,
00219          COLOR& color
00220          ) const;
00221 
00222       GRE_SCRIPTCONTEXT_STYLE (const GRE_SCRIPTCONTEXT_STYLE&);
00223       GRE_SCRIPTCONTEXT_STYLE& operator= (const GRE_SCRIPTCONTEXT_STYLE&);
00224 
00225       #endif // GENERATING_DOXYGEN_OUTPUT
00226    };
00227 
00228 
00229 class GRE_SCRIPTCONTEXT_LABEL : public GRE_SCRIPTCONTEXT_DRAW {
00230    public:
00231 
00232       //! Constructor.
00233       GRE_SCRIPTCONTEXT_LABEL (
00234          );
00235 
00236       //! Destructor.
00237       virtual ~GRE_SCRIPTCONTEXT_LABEL (
00238          );
00239 
00240       void GetFrameParms (
00241          LABELFRAMEPARMS& parms
00242          ) const;
00243 
00244       double GetPriority (
00245          ) const;
00246 
00247       void SetFrameParms (
00248          const LABELFRAMEPARMS& parms
00249          );
00250 
00251       void SetPriority (
00252          double priority
00253          );
00254 
00255    protected:
00256 
00257       virtual void CreateSymbols (
00258          );
00259 
00260    private:
00261       #ifndef GENERATING_DOXYGEN_OUTPUT
00262 
00263       //! SML symbol pointers for standard symbols.
00264       struct LABELSYMS {
00265          SMLSYMBOL *Priority;          //!< Label priority for optimization
00266          SMLSYMBOL *Frame;             //!< Label frame parameters
00267          };
00268 
00269       LABELSYMS m_labelsym;
00270       LABELFRAMEPARMS* m_FrameParms;
00271 
00272       GRE_SCRIPTCONTEXT_LABEL (const GRE_SCRIPTCONTEXT_LABEL&);
00273       GRE_SCRIPTCONTEXT_LABEL& operator= (const GRE_SCRIPTCONTEXT_LABEL&);
00274 
00275       #endif // GENERATING_DOXYGEN_OUTPUT
00276    };
00277 
00278 //===================================================================================================================
00279 
00280 #endif   // INC_GRE_SCRIPTCONTEXT_H

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