- Main Page
- Classes
- Files
- Examples

- File List
- File Members

# include/board/Transforms.h

Go to the documentation of this file.

    00001 /* -*- mode: c++ -*- */
    00010 #ifndef _BOARD_TRANSFORMS_H_
    00011 #define _BOARD_TRANSFORMS_H_
    00012
    00013 #include <limits>
    00014 #include <vector>
    00015 #include <cmath>
    00016
    00017 namespace LibBoard {
    00018
    00019 struct Rect;
    00020 struct Shape;
    00021 struct ShapeList;
    00022
    00027 struct Transform {
    00028 public:
    00029   inline Transform();
    00030   virtual ~Transform() { };
    00031   virtual double mapX( double x ) const;
    00032   virtual double mapY( double y ) const = 0;
    00033   virtual void apply( double & x, double & y ) const;
    00034   virtual double scale( double x ) const;
    00035   virtual double rounded( double x ) const;
    00036   virtual void setBoundingBox( const Rect & rect,
    00037                                const double pageWidth,
    00038                                const double pageHeight,
    00039                                const double margin ) = 0;
    00040
    00041   static inline double round( const double & x );
    00042
    00043 protected:
    00044   double _scale;
    00045   double _deltaX;
    00046   double _deltaY;
    00047   double _height;
    00048 };
    00049
    00055 struct TransformEPS : public Transform {
    00056 public:
    00057   double mapY( double y ) const;
    00058   void setBoundingBox( const Rect & rect,
    00059                        const double pageWidth,
    00060                        const double pageHeight,
    00061                        const double margin );
    00062 };
    00063
    00069 struct TransformFIG : public Transform {
    00070 public:
    00071   inline TransformFIG();
    00072   double rounded( double x ) const;
    00073   double mapY( double y ) const;
    00074   int mapWidth( double width ) const;
    00075   void setBoundingBox( const Rect & rect,
    00076                        const double pageWidth,
    00077                        const double pageHeight,
    00078                        const double margin );
    00079   void setDepthRange( const ShapeList & shapes );
    00080   int mapDepth( int depth ) const;
    00081 private:
    00082   int _maxDepth;
    00083   int _minDepth;
    00084 };
    00085
    00091 struct TransformSVG : public Transform {
    00092 public:
    00093   double rounded( double x ) const;
    00094   double mapY( double y ) const;
    00095   double mapWidth( double width ) const;
    00096   void setBoundingBox( const Rect & rect,
    00097                        const double pageWidth,
    00098                        const double pageHeight,
    00099                        const double margin );
    00100 };
    00101
    00102 #include "Transforms.ih"
    00103
    00104 } // namespace LibBoard
    00105
    00106 #endif /* _TRANSFORMS_H_ */