CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
2d_shape.h
Go to the documentation of this file.
1
14
15#ifndef C2DSHAPE_H
16#define C2DSHAPE_H
17/*===============================================================================================================================
18This file is part of CoastalME, the Coastal Modelling Environment.
19
20CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
21
22This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23
24You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25===============================================================================================================================*/
26#include <vector>
27using std::vector;
28
29#include <algorithm>
30using std::reverse;
31
32#include "2d_point.h"
33
35{
36private:
37
38protected:
40 vector<CGeom2DPoint> m_VPoints;
41
42 CA2DShape(void);
43 virtual ~CA2DShape(void);
44
45 void Clear(void);
46
47// void InsertAtFront(double const, double const);
48// void SetPoints(const vector<CGeom2DPoint>*);
49// int nLookUp(CGeom2DPoint*);
50// double dGetLength(void) const;
51// CGeom2DPoint PtGetCentroid(void);
52
53 virtual void Display() = 0;
54
55public:
56 void Reverse(void);
57
58 int nGetSize(void) const;
59 void Resize(int const);
60
61 void Append(CGeom2DPoint const*);
62 void Append(double const, double const);
63 void AppendIfNotAlready(double const, double const);
64 CGeom2DPoint* pPtBack(void);
65
66 CGeom2DPoint& operator[] (int const);
67 vector<CGeom2DPoint>* pPtVGetPoints(void);
68};
69#endif // C2DSHAPE_H
70
Contains CGeom2DPoint definitions.
vector< CGeom2DPoint > m_VPoints
The points which comprise the float-coordinate 2D shape.
Definition 2d_shape.h:40
void Append(CGeom2DPoint const *)
Appends a point to this 2D shape.
Definition 2d_shape.cpp:67
vector< CGeom2DPoint > * pPtVGetPoints(void)
Returns the address of the vector which represents this 2D shape.
Definition 2d_shape.cpp:130
void Reverse(void)
Reverses the sequence of points in the vector which represents this 2D polygon.
Definition 2d_shape.cpp:166
void Clear(void)
Clears this 2D shape.
Definition 2d_shape.cpp:44
CA2DShape(void)
Constructor.
Definition 2d_shape.cpp:27
CGeom2DPoint * pPtBack(void)
Returns the last element of this 2D shape.
Definition 2d_shape.cpp:91
virtual void Display()=0
void AppendIfNotAlready(double const, double const)
Appends a point to this 2D shape only if it isn't already in the shape vector.
Definition 2d_shape.cpp:79
int nGetSize(void) const
Definition 2d_shape.cpp:56
void Resize(int const)
Resizes the vector which represents this 2D shape.
Definition 2d_shape.cpp:50
CGeom2DPoint & operator[](int const)
Operator to return one point of this 2D shape.
Definition 2d_shape.cpp:37
virtual ~CA2DShape(void)
Destructor.
Definition 2d_shape.cpp:32
Geometry class used to represent 2D point objects with floating-point coordinates.
Definition 2d_point.h:27