/usr/include/ossim/base/ossimPolyLine.h is in libossim-dev 1.7.21-3ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// AUTHOR: Oscar Kramer (okramer@imagelinks.com)
//
// DESCRIPTION: Contains declaration of class ossimPolygon.
// This class provides utilities associated with N-vertex, convex
// (i.e., only two intersections for any line passing through the polygon).
//
// LIMITATIONS: None.
//
//*****************************************************************************
// $Id: ossimPolyLine.h 14789 2009-06-29 16:48:14Z dburken $
#ifndef ossimPolyLine_HEADER
#define ossimPolyLine_HEADER
#include <iostream>
#include <vector>
using namespace std;
#include <ossim/base/ossimDpt.h>
#include <ossim/base/ossimDrect.h>
#include <ossim/base/ossimIrect.h>
#include <ossim/base/ossimString.h>
class ossimLine;
class ossimPolygon;
/*!****************************************************************************
*
* CLASS: ossimPolyLine
*
*****************************************************************************/
class OSSIMDLLEXPORT ossimPolyLine
{
public:
ossimPolyLine()
:theCurrentVertex(0)
{}
ossimPolyLine(const vector<ossimIpt>& polygon);
ossimPolyLine(const vector<ossimDpt>& polygon);
ossimPolyLine(int numVertices, const ossimDpt* vertex_array);
ossimPolyLine(const ossimPolyLine& copy_this);
ossimPolyLine(const ossimPolygon& polygon);
/*!
* CONSTRUCTOR: Provided for convenience. Does not imply the polygon is
* limited to four vertices:
*/
ossimPolyLine(ossimDpt v1,
ossimDpt v2,
ossimDpt v3,
ossimDpt v4);
ossimPolyLine(const ossimIrect& rect);
ossimPolyLine(const ossimDrect& rect);
~ossimPolyLine();
ossimDpt& operator[](int index)
{
return theVertexList[index];
}
const ossimDpt& operator[](int index)const
{
return theVertexList[index];
}
ossim_uint32 getNumberOfVertices()const
{
return theVertexList.size();
}
void getIntegerBounds(ossim_int32& minX,
ossim_int32& minY,
ossim_int32& maxX,
ossim_int32& maxY)const;
void getBounds(double& minX,
double& minY,
double& maxX,
double& maxY)const;
void getBoundingRect(ossimDrect& rect)const
{
ossim_int32 minX;
ossim_int32 minY;
ossim_int32 maxX;
ossim_int32 maxY;
getIntegerBounds(minX, minY, maxX, maxY);
rect = ossimDrect(minX, minY, maxX, maxY);
}
ossimDrect getBoundingRect()const
{
ossimDrect result;
getBoundingRect(result);
return result;
}
void roundToIntegerBounds(bool compress=true);
void clear()
{
theVertexList.clear();
}
void addPoint(const ossimDpt& pt)
{
theVertexList.push_back(pt);
}
void addPoint(double x, double y)
{
theVertexList.push_back(ossimDpt(x, y));
}
void addAttribute( const ossimString& attribute )
{
theAttributeList.push_back( attribute );
}
ossimDpt midPoint()const;
/*!
* will sequence through the polygon and check to see if any values are NAN
*/
bool hasNans()const;
ossim_uint32 size()
{
return getNumberOfVertices();
}
void resize(ossim_uint32 newSize)
{
theVertexList.resize(newSize);
}
const vector<ossimDpt>& getVertexList()const
{
return theVertexList;
}
vector<ossimDpt>& getVertexList()
{
return theVertexList;
}
vector<ossimString>& getAttributeList()
{
return theAttributeList;
}
bool clipToRect(vector<ossimPolyLine>& result,
const ossimDrect& rect)const;
/*!
* Will clip this poly line list to the past in rect and
* will return true if any part of this object is visible within
* the rectangle;
*/
bool isWithin(const ossimDrect& rect)const;
/*!
* METHOD: pointWithin(ossimDpt)
* Returns TRUE if point is inside polygon.
*/
bool pointWithin(const ossimDpt& point) const
{
return isPointWithin(point);
}
bool isPointWithin(const ossimDpt& point) const;
/*!
* METHOD: vertex(index)
* Returns the ossimDpt vertex given the index. Returns false if no vertex
* defined.
*/
bool vertex(int index, ossimDpt& tbd_vertex) const;
/*!
* METHOD: nextVertex()
* Assigns the ossimDpt tbd_vertex following the current vertex. The current
* vertex is initialized with a call to vertex(int), or after the last
* vertex is reached. Returns false if no vertex defined. Intended to be
* when cycling through all vertices.
*/
bool nextVertex(ossimDpt& tbd_vertex) const;
void reverseOrder();
/*!
* OPERATORS: (Some are inlined at bottom)
*/
const ossimPolyLine& operator= (const ossimPolyLine& copy_this);
const ossimPolyLine& operator= (const vector<ossimDpt>& vertexList);
const ossimPolyLine& operator= (const vector<ossimIpt>& vertexList);
const ossimPolyLine& operator= (const ossimIrect& rect);
const ossimPolyLine& operator= (const ossimPolygon& polygon);
const ossimPolyLine& operator= (const ossimDrect& rect);
bool operator==(const ossimPolyLine& compare_this) const;
bool operator!=(const ossimPolyLine& compare_this) const;
const ossimPolyLine& operator *=(const ossimDpt& scale);
const ossimPolyLine& operator *=(double scale)
{
return ((*this)*=ossimDpt(scale, scale));
}
ossimPolyLine operator *(const ossimDpt& scale)const;
ossimPolyLine operator *(double scale)const
{
return ((*this)*ossimDpt(scale, scale));
}
/*!
* METHOD: print()
*/
void print(ostream& os) const;
friend ostream& operator<<(ostream&, const ossimPolyLine&);
bool saveState(ossimKeywordlist& kwl,
const char* prefix=0)const;
bool loadState(const ossimKeywordlist& kwl,
const char* prefix=0);
protected:
vector<ossimDpt> theVertexList;
vector<ossimString> theAttributeList;
mutable ossim_int32 theCurrentVertex;
};
inline bool ossimPolyLine::operator!=(const ossimPolyLine& compare_this) const
{
return !(*this == compare_this);
}
inline ostream& operator<<(ostream& os, const ossimPolyLine& polyLine)
{
polyLine.print(os);
return os;
}
#endif
|