OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeoAnnotationPolyLineObject.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // Author: Garrett Potts
7 //
8 //*************************************************************************
9 // $Id: ossimGeoAnnotationPolyLineObject.cpp 15766 2009-10-20 12:37:09Z gpotts $
15 
16 
18  "ossimGeoAnnotationPolyLineObject",
20 
22  const vector<ossimGpt>& groundPts,
23  ossim_uint8 r,
24  ossim_uint8 g,
25  ossim_uint8 b,
26  ossim_uint8 thickness)
27  :ossimGeoAnnotationObject(r, g, b, thickness),
28  theProjectedMultiLineObject(0)
29 {
30 
31  thePolygon = groundPts;
32 
33  // we will initialize the projected polygon's size
34  // so we don't have to reset it every time we do a
35  // projection
36  //
37  vector<ossimDpt> projectedPoints(thePolygon.size());
38 
39  theProjectedMultiLineObject = new ossimAnnotationMultiLineObject(ossimPolyLine(projectedPoints),
40  r,
41  g,
42  b,
43  thickness);
44 }
45 
48  thePolygon(rhs.thePolygon),
49  theProjectedMultiLineObject(rhs.theProjectedMultiLineObject?(ossimAnnotationMultiLineObject*)rhs.theProjectedMultiLineObject->dup():(ossimAnnotationMultiLineObject*)NULL)
50 {
51 }
52 
54 {
56  {
59  }
60 }
61 
63 {
64  return new ossimGeoAnnotationPolyLineObject(*this);
65 }
66 
68  double y)
69 {
70  for(int i = 0; i < (int)thePolygon.size(); ++i)
71  {
72  thePolygon[i].lond(thePolygon[i].lond()*x);
73  thePolygon[i].latd(thePolygon[i].latd()*y);
74  }
76  {
78  }
79 
80 }
81 
83 {
84  // make sure it's not null
85  if(!projection)
86  {
87  return;
88  }
89  vector<ossimPolyLine>& polyList =
91 
92  if(polyList.size())
93  {
94  vector<ossimDpt>& poly = polyList[0].getVertexList();
95 
96  const std::vector<ossimGpt>::size_type BOUNDS = thePolygon.size();
97 
98  for(std::vector<ossimGpt>::size_type index=0; index < BOUNDS; ++index)
99  {
100  projection->worldToLocal(thePolygon[index], poly[index]);
101  }
102 
103  // update the bounding rect
105  }
106 }
107 
109 {
110  out << "number_of_points: " << thePolygon.size() << endl;
111  if(thePolygon.size() > 0)
112  {
113  for(long index =0; index < (long)(thePolygon.size()-1); ++index)
114  {
115  out << thePolygon[index] << endl;
116  }
117  out << thePolygon[thePolygon.size()-1] << endl;
118  }
119  out << "Projected Polygon" << endl;
121  return out;
122 }
123 
125 {
127 }
128 
130 {
132  {
134  }
135 
136  return false;
137 }
138 
140 {
142  {
144  }
145 
146  return (ossimAnnotationObject*)NULL;;
147 }
148 
150 {
152 }
153 
155 {
157 }
158 
160  ossim_uint8 g,
161  ossim_uint8 b)
162 {
164  {
166  }
167 }
168 
170 {
172  {
174  }
175 }
ossim_uint32 x
virtual std::ostream & print(std::ostream &out) const
Generic print method.
virtual void setThickness(ossim_uint8 thickness)
ossim_uint32 y
RTTI_DEF1(ossimGeoAnnotationPolyLineObject, "ossimGeoAnnotationPolyLineObject", ossimGeoAnnotationObject) ossimGeoAnnotationPolyLineObject
virtual ossimAnnotationObject * getNewClippedObject(const ossimDrect &rect) const
virtual void setThickness(ossim_uint8 thickness)
Sets the pen thickness of thePolygon.
virtual void draw(ossimRgbImage &anImage) const
ossimGeoAnnotationPolyLineObject(const vector< ossimGpt > &groundPts, ossim_uint8 r=255, ossim_uint8 g=255, ossim_uint8 b=255, ossim_uint8 thickness=1)
virtual ossimAnnotationObject * getNewClippedObject(const ossimDrect &rect) const
virtual bool intersects(const ossimDrect &rect) const
virtual const vector< ossimPolyLine > & getPolyLineList() const
virtual ossimDrect getBoundingRect() const
virtual std::ostream & print(std::ostream &out) const
Generic print method.
ossimAnnotationMultiLineObject * theProjectedMultiLineObject
virtual bool intersects(const ossimDrect &rect) const
virtual void setColor(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
virtual void getBoundingRect(ossimDrect &rect) const
virtual void draw(ossimRgbImage &anImage) const
virtual void transform(ossimImageGeometry *projection)
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
virtual void setColor(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
Sets the color of thePolygon.
unsigned char ossim_uint8
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
virtual void applyScale(double x, double y)