OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeoPolygon.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // FILE: ossimPolygon.h
3 //
4 // Copyright (C) 2001 ImageLinks, Inc.
5 //
6 // License: See top level LICENSE.txt file.
7 //
8 // AUTHOR: Garrett Potts
9 //
10 //*****************************************************************************
11 // $Id: ossimGeoPolygon.h 23166 2015-02-24 20:57:50Z dburken $
12 #ifndef ossimGeoPolygon_HEADER
13 #define ossimGeoPolygon_HEADER
14 #include <vector>
15 #include <ossim/base/ossimGpt.h>
16 
17 class ossimKeywordlist;
18 
20 {
21 public:
23 
25 
26  ossimGeoPolygon(const std::vector<ossimGpt>& points);
27 
28  ossimGeoPolygon(const ossimGeoPolygon& rhs);
29 
30  bool addWmsBbox(const ossimString& wmsBbox);
31  void addPoint(const ossimGpt& pt)
32  {
33  theVertexList.push_back(pt);
34  }
35  void addPoint(double lat, double lon, double h=ossim::nan(), const ossimDatum* datum=0)
36  {
37  theVertexList.push_back(ossimGpt(lat, lon, h, datum));
38  }
39  void addAttribute( const ossimString& attribute )
40  {
41  theAttributeList.push_back( attribute );
42  }
43  void addHole( const ossimGeoPolygon& polygon )
44  {
45  theHoleList.push_back( polygon );
46  }
47  ossimGpt& operator[](int index)
48  {
49  return theVertexList[index];
50  }
51  const ossimGpt& operator[](int index)const
52  {
53  return theVertexList[index];
54  }
55 
56  const std::vector<ossimGpt>& getVertexList()const
57  {
58  return theVertexList;
59  }
60  std::vector<ossimString>& getAttributeList()
61  {
62  return theAttributeList;
63  }
64  std::vector<ossimGeoPolygon>& getHoleList()
65  {
66  return theHoleList;
67  }
68 
69  void clear()
70  {
71  theVertexList.clear();
72  }
74  {
75  return (ossim_uint32)theVertexList.size();
76  }
77  void resize(ossim_uint32 newSize)
78  {
79  theVertexList.resize(newSize);
80  theCurrentVertex = 0;
81  theOrderingType = OSSIM_VERTEX_ORDER_UNKNOWN;
82  }
83  const ossimGeoPolygon& operator = (const std::vector<ossimGpt>& rhs)
84  {
85  theVertexList = rhs;
86  theCurrentVertex = 0;
87  theOrderingType = OSSIM_VERTEX_ORDER_UNKNOWN;
88 
89  return *this;
90  }
91 
92  const ossimGeoPolygon& operator = (const ossimGeoPolygon& rhs);
93 
94  void stretchOut(ossimGeoPolygon& newPolygon,
95  double displacement);
96  double area()const;
97 
98  ossimGpt computeCentroid()const;
99 
100  bool vertex(int index, ossimGpt& v) const;
101  bool nextVertex(ossimDpt& v) const;
102  bool hasNans()const;
103  void reverseOrder();
104 
105  bool saveState(ossimKeywordlist& kwl,
106  const char* prefix=0)const;
107 
108  bool loadState(const ossimKeywordlist& kwl,
109  const char* prefix=0);
110 
111  void checkOrdering()const;
113  {
114  if(theOrderingType == OSSIM_VERTEX_ORDER_UNKNOWN)
115  {
116  checkOrdering();
117  }
118  return theOrderingType;
119  }
121  {
122  theOrderingType = ordering;
123  }
124 protected:
125  std::vector<ossimGpt> theVertexList;
126  std::vector<ossimString> theAttributeList;
127  std::vector<ossimGeoPolygon> theHoleList;
129 
134 
135 };
136 
137 #endif
std::vector< ossimString > theAttributeList
ossimVertexOrdering getOrdering() const
const ossimGpt & operator[](int index) const
#define OSSIMDLLEXPORT
Represents serializable keyword/value map.
std::vector< ossimString > & getAttributeList()
std::vector< ossimGeoPolygon > theHoleList
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossimGeoPolygon > & getHoleList()
void setOrdering(ossimVertexOrdering ordering)
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
void resize(ossim_uint32 newSize)
ossimGpt & operator[](int index)
ossimVertexOrdering
unsigned int ossim_uint32
void addHole(const ossimGeoPolygon &polygon)
std::vector< ossimGpt > theVertexList
const std::vector< ossimGpt > & getVertexList() const
void addPoint(const ossimGpt &pt)
ossim_uint32 size() const
ossimVertexOrdering theOrderingType
#define OSSIM_DLL
ossim_int32 theCurrentVertex
void addPoint(double lat, double lon, double h=ossim::nan(), const ossimDatum *datum=0)
void addAttribute(const ossimString &attribute)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32