XamlPathGeometry.h

00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined XAML_PATH_GEOMETRY
00020 #define XAML_PATH_GEOMETRY
00021 
00022 #include "XAML/XamlAttribute.h"
00023 #include "XAML/MemoryBuffer.h"
00024 
00025 class XamlGraphicsObject;
00026 
00027 class XamlPathGeometry
00028 {
00029 public:
00030     XamlPathGeometry(void);
00031     XamlPathGeometry(const XamlPathGeometry& s);
00032     virtual ~XamlPathGeometry(void);
00033 
00034     XamlPathGeometry& operator=(const XamlPathGeometry& s);
00035     bool operator==(const XamlPathGeometry& s) const;
00036     
00037     WT_Result serializeAttributeValue( WT_XAML_File &rFile, tMemoryBuffer*& rpBuffer ) const;
00038     WT_Result materializeAttribute( WT_XAML_File &rFile, const char* pAttribute );
00039 
00040 public:
00041     class XamlPathFigure : public DWFOwner
00042     {
00043     private:
00044         typedef vector<WT_Point2D> tPointVector;
00045     public:
00046         typedef vector<XamlGraphicsObject*> tGraphicsVector;
00047 
00048     public:
00049         XamlPathFigure()
00050         : _voGraphicsObjects()
00051         , _oPointVector()
00052         {}
00053         XamlPathFigure(const XamlPathFigure& s);
00054         virtual ~XamlPathFigure() throw();
00055         XamlPathFigure& operator=(const XamlPathFigure& s);
00056         bool operator==(const XamlPathFigure& s) const;
00057 
00058         void appendFigure(const XamlPathFigure&);
00059         void addDrawable(XamlGraphicsObject* d);
00060         void reset();
00061 
00062         const tGraphicsVector& graphics() const { return _voGraphicsObjects; }
00063 
00064         WT_Result serializeAttributeValue( WT_XAML_File &rFile, tMemoryBuffer*& rpBuffer ) const;
00065         WT_Result materializeAttribute( WT_XAML_File &rFile, const char* pAttribute );
00066 
00067     public:
00068         static WT_Result getPoints( WT_XAML_File *pFile, char *& rpRead, tPointVector &points, bool bIsRelative, bool bAddFirstPoint = true );
00069         static WT_Result getPoint( WT_XAML_File *pFile,  char *& rpRead, WT_Point2D& rPoint, bool bIsRelative );
00070         static WT_Result getPointFromString( WT_XAML_File *pFile, char *pCoords, WT_Point2D& rPoint, bool bIsRelative );
00071         static WT_Result getScalar( char *& rpRead, double& rScalar );
00072         static WT_Result getScalarFromString( char *pCoords, double& rScalar);
00073 
00074     private:
00075         WT_Result _createPathGeometry( WT_XAML_File& rFile, char *& rpRead );
00076         char _getNextCommand( char *& rpRead ) const;
00077 
00078     private:
00079         tGraphicsVector _voGraphicsObjects;
00080         //used during materialization
00081         tPointVector _oPointVector; 
00082 
00083     protected:
00084     void notifyOwnableDeletion( DWFOwnable& rOwnable )
00085         throw( DWFException );
00086 
00087     };
00088 
00089 
00090     const XamlPathFigure& figure() const { return _oPathFigure; }
00091           XamlPathFigure& figure()       { return _oPathFigure; }
00092 
00093 private:
00094     XamlPathFigure  _oPathFigure;
00095 
00096 public:
00097     static const char kcAbsolute_Move;
00098     static const char kcRelative_Move;
00099     static const char kcAbsolute_Line;
00100     static const char kcRelative_Line;
00101     static const char kcAbsolute_Close;
00102     static const char kcRelative_Close;
00103     static const char kcAbsolute_HorizontalLine;
00104     static const char kcRelative_HorizontalLine;
00105     static const char kcAbsolute_VerticalLine;
00106     static const char kcRelative_VerticalLine;
00107     static const char kcAbsolute_EllipticalArc;
00108     static const char kcRelative_EllipticalArc;
00109 
00110 };
00111 
00112 #endif //XAML_PATH_GEOMETRY

Generated on Tue Jan 6 22:40:06 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5