Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
ShapeSpace.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef _SHAPESPACE_H_ 00003 #define _SHAPESPACE_H_ 00004 00005 #include <vector> 00006 #include <iostream> 00007 00008 #include "Vision/colors.h" 00009 #include "Shared/newmat/newmat.h" 00010 00011 #include "Shared/Measures.h" 00012 #include "ShapeTypes.h" 00013 00014 namespace DualCoding { 00015 00016 //**************** 00017 // 00018 // ShapeSpace holds a collection of data objects, e.g., AgentData, 00019 // LineData, EllipseData 00020 00021 class BaseData; 00022 class ShapeRoot; 00023 class Point; 00024 class SketchSpace; 00025 class LineData; 00026 template<typename T> class Shape; 00027 class Shape<LineData>; 00028 00029 //! Holds a collection of diverse shapes such as LineData or EllipseData 00030 00031 class ShapeSpace { 00032 private: 00033 friend class SketchSpace; 00034 friend class ShapeRoot; 00035 friend class VisualRoutinesBehavior; 00036 // friend class WorldMapBuilder; 00037 00038 public: 00039 std::string name; //!< Name of the ShapeSpace 00040 00041 private: 00042 SketchSpace* dualSpace; 00043 int id_counter; 00044 std::vector<ShapeRoot> shapeCache; 00045 ShapeRoot& addShape(BaseData* p); 00046 ReferenceFrameType_t refFrameType; 00047 00048 public: 00049 00050 //! Constructor for ShapeSpace; requires dual SketchSpace. 00051 ShapeSpace(SketchSpace* dualSkS, int init_id=70000, std::string const _name="", 00052 ReferenceFrameType_t _refFrameType=camcentric); 00053 00054 ~ShapeSpace(void); 00055 00056 SketchSpace& getDualSpace(void) const { return *dualSpace; } 00057 ReferenceFrameType_t getRefFrameType() const { return refFrameType; } 00058 00059 void importShapes(std::vector<ShapeRoot>& foreign_shapes); 00060 BaseData* importShape(const ShapeRoot& foreign_shape); 00061 00062 void deleteShape(ShapeRoot &b); 00063 void deleteShapes(std::vector<ShapeRoot>& shapes_vec); 00064 template<typename T> void deleteShapes() { deleteShapeType(T::getStaticType()); } 00065 00066 void clear(); 00067 00068 std::vector<ShapeRoot>& allShapes(void) { return shapeCache; } 00069 const std::vector<ShapeRoot>& allShapes(void) const { return shapeCache; } 00070 std::vector<ShapeRoot> allShapes(ShapeType_t type); 00071 std::vector<ShapeRoot> allShapes(rgb color); 00072 00073 // Coerce a ShapeSpace into a vector of ShapeRoots it contains 00074 operator std::vector<ShapeRoot>&() { return shapeCache; } 00075 std::vector<ShapeRoot>::iterator begin() { return shapeCache.begin(); } 00076 std::vector<ShapeRoot>::iterator end() { return shapeCache.end(); } 00077 00078 std::string getShapeListForGUI(void); 00079 00080 00081 void printParams(void); 00082 void printSummary(void); 00083 00084 //! Transformation and Location Utilities 00085 //@{ 00086 void applyTransform(const NEWMAT::Matrix& Tmat, const ReferenceFrameType_t newref=unspecified); 00087 00088 Point getCentroid(void); 00089 00090 Point getCentroidOfSubset(const std::vector<ShapeRoot>& subset); 00091 //@} 00092 00093 private: 00094 ShapeSpace(const ShapeSpace&); //!< never call this 00095 ShapeSpace& operator=(const ShapeSpace&); //!< never call this 00096 void deleteShapeType(ShapeType_t type); 00097 00098 }; 00099 00100 } // namespace 00101 00102 #endif |
DualCoding 4.0 |
Generated Thu Nov 22 00:52:36 2007 by Doxygen 1.5.4 |