OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimGeoAnnotationMultiPolyObject Class Reference

#include <ossimGeoAnnotationMultiPolyObject.h>

Inheritance diagram for ossimGeoAnnotationMultiPolyObject:
ossimGeoAnnotationObject ossimAnnotationObject ossimObject ossimReferenced

Public Member Functions

 ossimGeoAnnotationMultiPolyObject ()
 
 ossimGeoAnnotationMultiPolyObject (const vector< ossimGeoPolygon > &multiPoly, bool enableFill=false, unsigned char r=255, unsigned char g=255, unsigned char b=255, long thickness=1)
 
 ossimGeoAnnotationMultiPolyObject (const ossimGeoAnnotationMultiPolyObject &rhs)
 
virtual ossimObjectdup () const
 
virtual void transform (ossimImageGeometry *projection)
 
virtual void applyScale (double x, double y)
 
virtual void draw (ossimRgbImage &anImage) const
 
virtual bool intersects (const ossimDrect &rect) const
 
virtual ossimAnnotationObjectgetNewClippedObject (const ossimDrect &rect) const
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual void getBoundingRect (ossimDrect &rect) const
 
virtual void addPoint (ossim_uint32 polygonIndex, const ossimGpt &pt)
 
virtual void setMultiPolygon (const vector< ossimGeoPolygon > &multiPoly)
 
virtual void setColor (unsigned char r, unsigned char g, unsigned char b)
 
virtual void setThickness (ossim_uint8 thickness)
 
virtual void computeBoundingRect ()
 
virtual bool isPointWithin (const ossimDpt &imagePoint) const
 
virtual void setFillFlag (bool flag)
 
const std::vector< ossimGeoPolygon > & getMultiPolygon () const
 
std::vector< ossimGeoPolygon > & getMultiPolygon ()
 
- Public Member Functions inherited from ossimGeoAnnotationObject
 ossimGeoAnnotationObject (unsigned char r=255, unsigned char g=255, unsigned char b=255, long thickness=1)
 
 ossimGeoAnnotationObject (const ossimGeoAnnotationObject &rhs)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Saves the current state of this object. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
- Public Member Functions inherited from ossimAnnotationObject
virtual ~ossimAnnotationObject ()
 
 ossimAnnotationObject (ossim_uint8 r=255, ossim_uint8 g=255, ossim_uint8 b=255, ossim_uint8 thickness=1)
 
virtual void applyScale (const ossimDpt &scale)
 
virtual ossimDrect getBoundingRect () const
 
void getColor (ossim_uint8 &r, ossim_uint8 &g, ossim_uint8 &b) const
 
ossim_uint8 getThickness () const
 
virtual ossimString getName () const
 
virtual void setName (const ossimString &name)
 
ossim_uint32 getId () const
 
virtual ossim_uint32 setId ()
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Protected Member Functions

virtual ~ossimGeoAnnotationMultiPolyObject ()
 
void allocateProjectedPolygon ()
 
- Protected Member Functions inherited from ossimGeoAnnotationObject
virtual ~ossimGeoAnnotationObject ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

std::vector< ossimGeoPolygontheMultiPolygon
 
ossimDrect theBoundingRect
 
bool theFillEnabled
 
ossimRefPtr< ossimAnnotationMultiPolyObjecttheProjectedPolyObject
 
- Protected Attributes inherited from ossimAnnotationObject
ossim_uint8 theRed
 
ossim_uint8 theGreen
 
ossim_uint8 theBlue
 
ossim_uint8 theThickness
 
ossimString theName
 
ossim_uint32 theId
 

Additional Inherited Members

- Static Public Member Functions inherited from ossimAnnotationObject
static ossim_uint32 getNextId ()
 
static void restIdCounter ()
 
- Static Protected Attributes inherited from ossimAnnotationObject
static ossim_uint32 theIdCounter = 0
 

Detailed Description

Definition at line 17 of file ossimGeoAnnotationMultiPolyObject.h.

Constructor & Destructor Documentation

◆ ossimGeoAnnotationMultiPolyObject() [1/3]

ossimGeoAnnotationMultiPolyObject::ossimGeoAnnotationMultiPolyObject ( )

Definition at line 19 of file ossimGeoAnnotationMultiPolyObject.cpp.

References allocateProjectedPolygon(), ossimDrect::makeNan(), and theBoundingRect.

Referenced by dup().

20  :
24  theFillEnabled(false),
26 {
29 }
void makeNan()
Definition: ossimDrect.h:388
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject
ossimGeoAnnotationObject(unsigned char r=255, unsigned char g=255, unsigned char b=255, long thickness=1)

◆ ossimGeoAnnotationMultiPolyObject() [2/3]

ossimGeoAnnotationMultiPolyObject::ossimGeoAnnotationMultiPolyObject ( const vector< ossimGeoPolygon > &  multiPoly,
bool  enableFill = false,
unsigned char  r = 255,
unsigned char  g = 255,
unsigned char  b = 255,
long  thickness = 1 
)

Definition at line 31 of file ossimGeoAnnotationMultiPolyObject.cpp.

References allocateProjectedPolygon(), ossimDrect::makeNan(), and theBoundingRect.

37  :
38  ossimGeoAnnotationObject(r, g, b, thickness),
39  theMultiPolygon(multiPoly),
41  theFillEnabled(enableFill),
43 {
46 }
void makeNan()
Definition: ossimDrect.h:388
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject
ossimGeoAnnotationObject(unsigned char r=255, unsigned char g=255, unsigned char b=255, long thickness=1)

◆ ossimGeoAnnotationMultiPolyObject() [3/3]

ossimGeoAnnotationMultiPolyObject::ossimGeoAnnotationMultiPolyObject ( const ossimGeoAnnotationMultiPolyObject rhs)

◆ ~ossimGeoAnnotationMultiPolyObject()

ossimGeoAnnotationMultiPolyObject::~ossimGeoAnnotationMultiPolyObject ( )
protectedvirtual

Definition at line 63 of file ossimGeoAnnotationMultiPolyObject.cpp.

References theProjectedPolyObject.

64 {
66 }
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

Member Function Documentation

◆ addPoint()

void ossimGeoAnnotationMultiPolyObject::addPoint ( ossim_uint32  polygonIndex,
const ossimGpt pt 
)
virtual

Definition at line 169 of file ossimGeoAnnotationMultiPolyObject.cpp.

References theMultiPolygon, and theProjectedPolyObject.

171 {
172  if(polygonIndex < theMultiPolygon.size())
173  {
174  theMultiPolygon[polygonIndex].addPoint(pt);
175 
176  // we will have to reset the projected polygon
178  }
179 }
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ allocateProjectedPolygon()

void ossimGeoAnnotationMultiPolyObject::allocateProjectedPolygon ( )
protected

Definition at line 237 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimAnnotationObject::theBlue, theFillEnabled, ossimAnnotationObject::theGreen, theMultiPolygon, theProjectedPolyObject, ossimAnnotationObject::theRed, and ossimAnnotationObject::theThickness.

Referenced by ossimGeoAnnotationMultiPolyObject(), and transform().

238 {
240 
241  if(theMultiPolygon.size())
242  {
243  vector<ossimPolygon> polyList( theMultiPolygon.size() );
245  new ossimAnnotationMultiPolyObject(polyList,
247  theRed,
248  theGreen,
249  theBlue,
250  theThickness);
251  }
252 }
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ applyScale()

void ossimGeoAnnotationMultiPolyObject::applyScale ( double  x,
double  y 
)
virtual

Implements ossimAnnotationObject.

Definition at line 68 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimNotify(), and ossimNotifyLevel_NOTICE.

70 {
72  << "ossimGeoAnnotationPolyObject::applyScale NOT IMPLEMENTED!!!!"
73  << endl;
74 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ computeBoundingRect()

void ossimGeoAnnotationMultiPolyObject::computeBoundingRect ( )
virtual

◆ draw()

void ossimGeoAnnotationMultiPolyObject::draw ( ossimRgbImage anImage) const
virtual

Implements ossimAnnotationObject.

Definition at line 148 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimAnnotationMultiPolyObject::draw(), theProjectedPolyObject, and ossimRefPtr< T >::valid().

149 {
151  {
152  theProjectedPolyObject->draw(anImage);
153  }
154 }
virtual void draw(ossimRgbImage &anImage) const
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ dup()

ossimObject * ossimGeoAnnotationMultiPolyObject::dup ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 58 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimGeoAnnotationMultiPolyObject().

Referenced by getNewClippedObject().

◆ getBoundingRect()

void ossimGeoAnnotationMultiPolyObject::getBoundingRect ( ossimDrect rect) const
virtual

Implements ossimAnnotationObject.

Definition at line 156 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimAnnotationMultiPolyObject::getBoundingRect(), ossimDrect::isNan(), theBoundingRect, theProjectedPolyObject, and ossimRefPtr< T >::valid().

157 {
158  //---
159  // Should we make non const and call computeBoundingRect if theBoundingRect
160  // is nan? (drb - 20100728)
161  //---
162  rect = theBoundingRect;
163  if (rect.isNan()&&theProjectedPolyObject.valid())
164  {
166  }
167 }
virtual void getBoundingRect(ossimDrect &rect) const
bool isNan() const
Definition: ossimDrect.h:401
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ getMultiPolygon() [1/2]

const std::vector<ossimGeoPolygon>& ossimGeoAnnotationMultiPolyObject::getMultiPolygon ( ) const
inline

Definition at line 53 of file ossimGeoAnnotationMultiPolyObject.h.

Referenced by ossimTilingPoly::parseShpFile().

53 {return theMultiPolygon;}

◆ getMultiPolygon() [2/2]

std::vector<ossimGeoPolygon>& ossimGeoAnnotationMultiPolyObject::getMultiPolygon ( )
inline

Definition at line 54 of file ossimGeoAnnotationMultiPolyObject.h.

54 {return theMultiPolygon;}

◆ getNewClippedObject()

ossimAnnotationObject * ossimGeoAnnotationMultiPolyObject::getNewClippedObject ( const ossimDrect rect) const
virtual

Will allocate a new object that is clipped to the passed. in rect. Look at derived classes to see if the object is actually clipped or not. A new object is returned if it clips to the rect else NULL should be returned it doesn't clip.

Implements ossimAnnotationObject.

Definition at line 138 of file ossimGeoAnnotationMultiPolyObject.cpp.

References dup(), ossimNotify(), and ossimNotifyLevel_NOTICE.

140 {
142  << "ossimGeoAnnotationMultiPolyObject::getNewClippedObject "
143  << "NOT IMPLEMENTED" << endl;
144 
145  return (ossimAnnotationObject*)(dup());
146 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ intersects()

bool ossimGeoAnnotationMultiPolyObject::intersects ( const ossimDrect rect) const
virtual

Implements ossimAnnotationObject.

Definition at line 130 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimNotify(), and ossimNotifyLevel_NOTICE.

131 {
133  << "ossimGeoAnnotationMultiPolyObject::intersects NOT IMPLEMENTED"
134  << endl;
135  return false;
136 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ isPointWithin()

bool ossimGeoAnnotationMultiPolyObject::isPointWithin ( const ossimDpt imagePoint) const
virtual

This method allows you to pick an object. It will return true or false if the point falls somewhere on an object. Look at derived classes for further information.

Reimplemented from ossimAnnotationObject.

Definition at line 218 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimAnnotationMultiPolyObject::isPointWithin(), theProjectedPolyObject, and ossimRefPtr< T >::valid().

219 {
221  {
222  return theProjectedPolyObject->isPointWithin(imagePoint);
223  }
224 
225  return false;
226 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool isPointWithin(const ossimDpt &imagePoint) const
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ print()

std::ostream & ossimGeoAnnotationMultiPolyObject::print ( std::ostream &  out) const
virtual

Generic print method.

Derived classes should re-implement as they see fit.

Returns
std::ostream&

Reimplemented from ossimAnnotationObject.

Definition at line 122 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimNotify(), and ossimNotifyLevel_NOTICE.

123 {
125  << "ossimGeoAnnotationMultiPolyObject::print NOT IMPLEMENTED"
126  << endl;
127  return out;
128 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ setColor()

void ossimGeoAnnotationMultiPolyObject::setColor ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)
virtual

Reimplemented from ossimAnnotationObject.

Definition at line 188 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimAnnotationObject::setColor(), theProjectedPolyObject, and ossimRefPtr< T >::valid().

Referenced by ossimVpfAnnotationFeatureInfo::setDrawingFeaturesToAnnotation().

191 {
194  {
196  }
197 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject
virtual void setColor(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)

◆ setFillFlag()

void ossimGeoAnnotationMultiPolyObject::setFillFlag ( bool  flag)
virtual

◆ setMultiPolygon()

void ossimGeoAnnotationMultiPolyObject::setMultiPolygon ( const vector< ossimGeoPolygon > &  multiPoly)
virtual

Definition at line 181 of file ossimGeoAnnotationMultiPolyObject.cpp.

References theMultiPolygon, and theProjectedPolyObject.

183 {
184  theMultiPolygon = multiPoly;
186 }
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ setThickness()

void ossimGeoAnnotationMultiPolyObject::setThickness ( ossim_uint8  thickness)
virtual

Reimplemented from ossimAnnotationObject.

Definition at line 199 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimAnnotationObject::setThickness(), theProjectedPolyObject, and ossimRefPtr< T >::valid().

Referenced by ossimVpfAnnotationFeatureInfo::setDrawingFeaturesToAnnotation().

200 {
203  {
205  }
206 }
virtual void setThickness(ossim_uint8 thickness)
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject

◆ transform()

void ossimGeoAnnotationMultiPolyObject::transform ( ossimImageGeometry projection)
virtual

Add the projection interface to all geographically defined objects.

Implements ossimGeoAnnotationObject.

Definition at line 76 of file ossimGeoAnnotationMultiPolyObject.cpp.

References ossimPolygon::addPoint(), ossimAnnotationMultiPolyObject::addPolygon(), allocateProjectedPolygon(), ossimPolygon::clear(), ossimAnnotationMultiPolyObject::computeBoundingRect(), ossimDpt::hasNans(), theMultiPolygon, theProjectedPolyObject, and ossimImageGeometry::worldToLocal().

Referenced by ossimGdalOgrVectorAnnotation::loadMultiPolygon().

77 {
78  if(!projection)
79  {
80  return;
81  }
82 
84 
85  //---
86  // NOTE:
87  // allocateProjectedPolygon() will set theProjectedPolyObject to 0 if
88  // theMultiPolygon is empty (theMultiPolygon.size() == 0). So check before
89  // accessing pointer to avoid a core dump.
90  //---
92  {
93  return;
94  }
95 
96  ossimDpt temp;
97  std::vector<ossimPolygon> visiblePolygons;
98  ossimPolygon polygon;
99  for(ossim_uint32 polyI = 0; polyI < theMultiPolygon.size(); ++polyI)
100  {
101  polygon.clear();
102  for(ossim_uint32 pointI = 0;
103  pointI < theMultiPolygon[polyI].size();
104  ++pointI)
105  {
106  projection->worldToLocal(theMultiPolygon[polyI][pointI],
107  temp);
108  if(!temp.hasNans())
109  {
110  polygon.addPoint(temp);
111  }
112  }
113  theProjectedPolyObject->addPolygon(polyI, polygon);
114  }
115 
116  //---
117  // Update the bounding rect.
118  //---
120 }
void addPoint(const ossimDpt &pt)
virtual void addPolygon(ossim_uint32 polygonIndex, const ossimPolygon &poly)
unsigned int ossim_uint32
ossimRefPtr< ossimAnnotationMultiPolyObject > theProjectedPolyObject
bool hasNans() const
Definition: ossimDpt.h:67
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.

Member Data Documentation

◆ theBoundingRect

ossimDrect ossimGeoAnnotationMultiPolyObject::theBoundingRect
protected

◆ theFillEnabled

bool ossimGeoAnnotationMultiPolyObject::theFillEnabled
protected

Definition at line 61 of file ossimGeoAnnotationMultiPolyObject.h.

Referenced by allocateProjectedPolygon(), and setFillFlag().

◆ theMultiPolygon

std::vector<ossimGeoPolygon> ossimGeoAnnotationMultiPolyObject::theMultiPolygon
protected

◆ theProjectedPolyObject

ossimRefPtr<ossimAnnotationMultiPolyObject> ossimGeoAnnotationMultiPolyObject::theProjectedPolyObject
protected

The documentation for this class was generated from the following files: