include/board/ShapeList.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00011 #ifndef _BOARD_SHAPELIST_H_
00012 #define _BOARD_SHAPELIST_H_
00013 
00014 #include "board/Shapes.h"
00015 
00016 namespace BoardLib {
00017 
00022 struct ShapeList : public Shape {
00023   
00024   ShapeList( int depth = -1 )
00025     : Shape( Color::none, Color::none, 1.0, ButtCap, MiterJoin, depth ),
00026       _nextDepth( std::numeric_limits<int>::max() - 1 )
00027   { }
00028 
00029   ShapeList( const ShapeList & other );
00030 
00031   ~ShapeList();
00032   
00033   void clear();
00034 
00035   Point center() const;
00036 
00037   Shape & rotate( double angle, const Point & center );
00038 
00039   Shape & rotate( double angle );
00040 
00041   Shape & translate( double dx, double dy );
00042 
00043   Shape & scale( double sx, double sy );
00044   
00045   void flushPostscript( std::ostream & stream,
00046                         const TransformEPS & transform ) const;
00047   
00048   void flushFIG( std::ostream & stream,
00049                  const TransformFIG & transform,
00050                  std::map<Color,int> & colormap ) const;
00051 
00052   void flushSVG( std::ostream & stream,
00053                  const TransformSVG & transform ) const;
00054 
00055   Rect boundingBox() const;
00056 
00057   Shape * clone() const;
00058   
00059   ShapeList & operator=( const ShapeList & other );
00060 
00061   ShapeList & operator<<( const Shape & shape ); 
00062   
00063 protected:
00064   std::vector<Shape*> _shapes;  
00065   int _nextDepth;               
00070   void free();
00071 };
00072 
00078 struct Group : public ShapeList {
00079   
00080   Group( int depth = -1 ):ShapeList( depth ) { }
00081   
00082   Group( const Group & other ) : ShapeList( other ) { };
00083 
00084   ~Group() { };
00085 
00086   void flushPostscript( std::ostream & stream,
00087                         const TransformEPS & transform ) const;
00088   
00089   void flushFIG( std::ostream & stream,
00090                  const TransformFIG & transform,
00091                  std::map<Color,int> & colormap ) const;
00092 
00093   void flushSVG( std::ostream & stream,
00094                  const TransformSVG & transform ) const;
00095 
00096   Group & operator=( const Group & other );
00097 
00098   Group & operator<<( const Shape & shape ); 
00099 
00100   Shape * clone() const;
00101 };
00102 
00103 
00104 } // namespace BoardLib 
00105 
00106 #endif /* _SHAPELIST_H_ */
00107 

Generated on Mon Dec 17 11:15:51 2007 for Board by  doxygen 1.5.3-20071008