00001
00010 #ifndef _BOARD_TRANSFORMS_H_
00011 #define _BOARD_TRANSFORMS_H_
00012
00013 #include <limits>
00014 #include <vector>
00015
00016 namespace BoardLib {
00017
00018 struct Rect;
00019 struct Shape;
00020
00025 struct Transform {
00026 public:
00027 Transform():_scale(1.0), _deltaX(0.0), _deltaY(0.0) { }
00028 virtual ~Transform() { };
00029 virtual float mapX( float x ) const;
00030 virtual float mapY( float y ) const = 0;
00031 virtual void apply( float & x, float & y ) const;
00032 virtual float scale( float x ) const;
00033 virtual void furtherScale( float x );
00034 virtual float rounded( float x ) const;
00035 virtual void setBoundingBox( const Rect & rect ) = 0;
00036 protected:
00037 float _scale;
00038 float _deltaX;
00039 float _deltaY;
00040 };
00041
00047 struct TransformEPS : public Transform {
00048 public:
00049 float mapY( float y ) const;
00050 void setBoundingBox( const Rect & rect );
00051 };
00052
00058 struct TransformFIG : public Transform {
00059 public:
00060 TransformFIG():maxDepth(std::numeric_limits<int>::max()),minDepth(0) { }
00061 float rounded( float x ) const;
00062 float mapY( float y ) const;
00063 int mapWidth( float width ) const;
00064 void setBoundingBox( const Rect & rect );
00065 void setDepthRange( const std::vector<Shape*> & shapes );
00066 int mapDepth( int depth ) const;
00067 private:
00068 int maxDepth;
00069 int minDepth;
00070 };
00071
00077 struct TransformSVG : public Transform {
00078 public:
00079 float rounded( float x ) const;
00080 float mapY( float y ) const;
00081 float mapWidth( float width ) const;
00082 void setBoundingBox( const Rect & rect );
00083 };
00084
00085
00086 }
00087
00088 #endif