123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- /*!
- * \file Polygon.cpp
- * \brief
- * \author Gapchich Vladislav
- * \date 23/10/11
- */
- #include "vislearning/cbaselib/Polygon.h"
- using namespace OBJREC;
- using namespace std;
- using namespace NICE;
- //! A constructor
- Polygon::Polygon()
- {
- points_.clear();
- id_ = -1;
- }
- // A copy-constructor
- Polygon::Polygon(const Polygon ©)
- {
- points_ = PointsList(*(copy.points()));
- id_ = copy.id();
- }
- //! A desctructor
- Polygon::~Polygon()
- {
-
- }
- //! appends aPoint coordinate to the end of the point list
- void
- Polygon::push(const CoordT< int > &aPoint)
- {
- if (aPoint.x < 0 || aPoint.y < 0) {
- return;
- /* NOTREACHED */
- }
-
- points_.push_back(aPoint);
- }
- //! overloaded
- /*!
- * \see push(const CoordT< int > &aPoint)
- */
- void
- Polygon::push(const int &x, const int &y)
- {
- if (x < 0 || y < 0) {
- return;
- /* NOTREACHED */
- }
- CoordT< int > point;
- point.x = x;
- point.y = y;
- points_.push_back(point);
- }
- //! Sets a category ID(label ID) for the polygon
- /*!
- * /param[in] anID should not be less than zero
- */
- void
- Polygon::setID(const int &anID)
- {
- if (anID < 0) {
- return;
- /* NOTREACHED */
- }
- }
- //! returns a constant pointer to the list of polygon points(coordinates)
- const PointsList *
- Polygon::points() const
- {
- return &points_;
- }
- //! deletes last added point of the polygon and returns it
- CoordT< int >
- Polygon::pop()
- {
- CoordT< int > ret = points_.back();
- points_.pop_back();
- return ret;
- }
- //! returns a category ID of the polygon
- int
- Polygon::id() const
- {
- return id_;
- }
-
- /*
- *
- */
|