IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Polygon2d.h
1 // Polygon2d.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKGEOMETRY_POLYGON2D_H__
16 #define __IPSDKGEOMETRY_POLYGON2D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::geom::Polygon2d<T>::_pointColl' : class 'std::vector<ipsdk::geom::Point2dData<T>>' needs to have dll-interface to be used by clients of class 'ipsdk::geom::Polygon2d<T>'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKGeometry/Entity/2d/BaseTypedGeometryEntity2d.h>
24 #include <IPSDKGeometry/Entity/2d/Point/Point2dData.h>
29 #include <vector>
30 
31 namespace ipsdk {
32 namespace geom {
33 
36 
37 template <typename T>
39 {
40  // declare 2d geometry entity
42 
43 // predefined public types
44 public:
46  static const eCoordinateSystem2dType::domain g_coordinateSystem2dType = eCoordinateSystem2dType::eCS2DT_Cartesian;
47 
49  static const eEntity2dType::domain g_entity2dType = eEntity2dType::eE2DT_Polygon;
50 
53 
55  typedef std::vector<PointType> PointColl;
56 
58  typedef typename PointColl::iterator PointIterator;
59 
60 public:
63  Polygon2d();
64  ~Polygon2d();
66 
67 // methods
68 public:
70  inline eCoordinateSystem2dType getCoordinateSystem2dType() const;
71 
73  inline eEntity2dType getEntity2dType() const;
74 
76  inline const ePolygon2dType& getPolygon2dType() const;
77 
79  inline void setPolygon2dType(const ePolygon2dType& polygon2dType);
80 
82  inline bool isEmpty() const;
83 
85  inline ipUInt32 getNbPoints() const;
86 
88  inline const PointColl& getPointColl() const;
89 
91  inline PointColl& getPointColl();
92 
95  inline PointIterator beginPoint();
96  inline PointIterator endPoint();
98 
100  void clear();
101 
102 // attributes
103 protected:
108 
111 };
112 
115 
116 template <typename T>
119 {
120  return g_coordinateSystem2dType;
121 }
122 
123 template <typename T>
124 inline eEntity2dType
126 {
127  return g_entity2dType;
128 }
129 
130 template <typename T>
131 inline const ePolygon2dType&
133 {
134  return _polygon2dType;
135 }
136 
137 template <typename T>
138 inline void
140 {
141  _polygon2dType = polygon2dType;
142 }
143 
144 template <typename T>
145 IPSDK_FORCEINLINE bool
147 {
148  return _pointColl.empty();
149 }
150 
151 template <typename T>
152 IPSDK_FORCEINLINE ipUInt32
154 {
155  return static_cast<ipUInt32>(_pointColl.size());
156 }
157 
158 template <typename T>
159 IPSDK_FORCEINLINE const typename Polygon2d<T>::PointColl&
161 {
162  return _pointColl;
163 }
164 
165 template <typename T>
166 IPSDK_FORCEINLINE typename Polygon2d<T>::PointColl&
168 {
169  return _pointColl;
170 }
171 
172 template <typename T>
173 IPSDK_FORCEINLINE typename Polygon2d<T>::PointIterator
175 {
176  return _pointColl.begin();
177 }
178 
179 template <typename T>
180 IPSDK_FORCEINLINE typename Polygon2d<T>::PointIterator
182 {
183  return _pointColl.end();
184 }
185 
188 
189 } // end of namespace geom
190 } // end of namespace ipsdk
191 
192 #pragma warning (pop)
193 
194 #endif // __IPSDKGEOMETRY_POLYGON2D_H__
Polygon.
Definition: GeometryEntity2dTypes.h:48
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
PointIterator beginPoint()
iterator used to parse polygon points
Definition: Polygon2d.h:174
ePolygon2dType _polygon2dType
Definition: Polygon2d.h:107
bool isEmpty() const
method allowing to check whether polygon is empty
Definition: Polygon2d.h:146
PointIterator endPoint()
iterator used to parse polygon points
Definition: Polygon2d.h:181
ePolygon2dType
Enumerate describing polygon type.
Definition: Polygon2dTypes.h:34
eCoordinateSystem2dType getCoordinateSystem2dType() const
method allowing to retrieve coordinate system 2d type
Definition: Polygon2d.h:118
ipUInt32 getNbPoints() const
retrieve number of polygon points
Definition: Polygon2d.h:153
eCoordinateSystem2dType
Enumerate describing coordinate system 2d type.
Definition: GeometryEntity2dTypes.h:76
const PointColl & getPointColl() const
retrieve polygon points collection
Definition: Polygon2d.h:160
void setPolygon2dType(const ePolygon2dType &polygon2dType)
setup polygon 2d type
Definition: Polygon2d.h:139
Basic operators used for polygon 2d management.
Point2dData< T > PointType
point type associated to object
Definition: Polygon2d.h:52
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
PointColl _pointColl
ordered collection of points associated to polygon
Definition: Polygon2d.h:110
Base class for typed 3d geometry entities.
Definition: BaseTypedGeometryEntity2d.h:27
PointColl::iterator PointIterator
iterator to collection of points
Definition: Polygon2d.h:58
Predefined types for polygon 2d management.
#define IPSDK_DECLARE_GEOMETRY_ENTITY_2D(libraryName, className)
Macro allowing to declare a geometry entity 2d.
Definition: GeometryEntity2dHdrMacros.h:131
Closed polygon associated to an ordered collection of 2d points.
Definition: Polygon2d.h:38
Basic operators used for point 2d management.
eEntity2dType
Enumerate describing entity 2d type.
Definition: GeometryEntity2dTypes.h:38
std::vector< PointType > PointColl
collection of points associated to polygon
Definition: Polygon2d.h:55
Lightweight structure used to store Point2d data.
Definition: GeometryEntity2dTypes.h:26
const ePolygon2dType & getPolygon2dType() const
retrieve polygon 2d type
Definition: Polygon2d.h:132
eEntity2dType getEntity2dType() const
method allowing to retrieve entity 2d type
Definition: Polygon2d.h:125
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type >::type, RulePtr >::type isEmpty(const boost::shared_ptr< AttributeType > &pAttribute)
functions allowing to check that a leaf collection is empty
Definition: LeafCollSizeRuleOperators.h:65
Cartesian coordinate system.
Definition: GeometryEntity2dTypes.h:78
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53