OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimEastingNorthingCutter.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 // $Id: ossimEastingNorthingCutter.cpp 15766 2009-10-20 12:37:09Z gpotts $
10 //----------------------------------------------------------------------------
11 
12 #include <sstream>
16 #include <ossim/base/ossimTrace.h>
17 
19 
20 static ossimTrace traceDebug(ossimString("ossimEastingNorthingCutter:debug"));
21 
22 
24  ossimImageSource* inputSource)
26  inputSource),
28  theViewProjection(0)
29 {
33 }
34 
36  :ossimRectangleCutFilter(inputSource),
38  theViewProjection(0)
39 {
43 }
44 
46 {
47 }
48 
50  const ossimDpt& lr)
51 {
54 
56 }
57 
59 {
60  return theUlEastingNorthing;
61 }
62 
64 {
65  return theLrEastingNorthing;
66 }
67 
68 
70 {
73 }
74 
76  const char* prefix)const
77 {
78  kwl.add(prefix,
79  "ul_en",
82  true);
83  kwl.add(prefix,
84  "lr_en",
87  true);
88 
89  return ossimRectangleCutFilter::saveState(kwl, prefix);
90 }
91 
93  const char* prefix)
94 {
95  const char *ul = kwl.find(prefix,
96  "ul_en");
97  const char *lr = kwl.find(prefix,
98  "lr_en");
99 
102 
103  if(ul)
104  {
105  istringstream in(ul);
106  ossimString x;
107  ossimString y;
108 
109  in >> x >> y;
110 
111  theUlEastingNorthing.x = x.toDouble();
112  theUlEastingNorthing.y = y.toDouble();
113 
114  }
115 
116  if(lr)
117  {
118  istringstream in(lr);
119  ossimString x;
120  ossimString y;
121 
122  in >> x >> y;
123 
124  theLrEastingNorthing.x = x.toDouble();
125  theLrEastingNorthing.y = y.toDouble();
126  }
127 
128  if (traceDebug())
129  {
131  << "ossimEastingNorthingCutter::loadState DEBUG:"
132  << "\ntheUlEastingNorthing: " << theUlEastingNorthing
133  << "\ntheLrEastingNorthing: " << theLrEastingNorthing
134  << endl;
135  }
136 
137  return ossimRectangleCutFilter::loadState(kwl, prefix);
138 }
139 
141 {
143  baseObject);
144  if(!tempProj)
145  {
146  return false;
147  }
148 
149 
150  theViewProjection = tempProj;
151 
153 
154  return true;
155 }
156 
158 {
159  return theViewProjection.get();
160 }
161 
163 {
164  return theViewProjection.get();
165 }
166 
168 {
170 
174  {
175  return;
176  }
177 
180  ossimDpt ul;
181  ossimDpt lr;
182  ossimDpt easting;
183  ossimDpt northing;
184  if(mapProj)
185  {
188 
189  ossimDrect drect(ul.x, ul.y, lr.x, lr.y);
190 
191  theRectangle = drect;
192 
193  if (traceDebug())
194  {
196  << "ossimEastingNorthingCutter::transformVertices DEBUG:"
197  << "original drect: " << drect
198  << "\ntheRectangle: " << theRectangle
199  << endl;
200  }
201  }
202 }
ossimRectangleCutType theCutType
ossim_uint32 x
RTTI_DEF2(ossimEastingNorthingCutter, "ossimEastingNorthingCutter", ossimRectangleCutFilter, ossimViewInterface)
Represents serializable keyword/value map.
ossim_uint32 y
const char * find(const char *key) const
double y
Definition: ossimDpt.h:165
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=NULL)
Method to the load (recreate) the state of an object from a keyword list.
static ossimString toString(bool aValue)
Numeric to string methods.
void setEastingNorthingRectangle(const ossimDpt &ul, const ossimDpt &lr)
ossimRefPtr< ossimProjection > theViewProjection
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimEastingNorthingCutter(ossimObject *owner, ossimImageSource *inputSource=NULL)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=NULL) const
Method to save the state of an object to a keyword list.
bool hasNans() const
Definition: ossimDpt.h:67
virtual bool setView(ossimObject *baseObject)
void makeNan()
Definition: ossimIrect.h:329
double x
Definition: ossimDpt.h:164
virtual void eastingNorthingToLineSample(const ossimDpt &eastingNorthing, ossimDpt &lineSample) const
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void makeNan()
Definition: ossimDpt.h:65