31 "ossimImageViewProjectionTransform",
39 : m_imageGeometry(imageGeometry),
40 m_viewGeometry(viewGeometry),
41 m_crossesDateline(
false)
51 m_imageGeometry(src.m_imageGeometry),
52 m_viewGeometry(src.m_viewGeometry),
53 m_crossesDateline(false)
124 cout <<
"DEBUG ossimImageViewProjectionTransform::imageToView:" 127 <<
"\n vp: "<<vp<<std::endl;
153 if ((iproj && vproj && iproj->
isEqualTo(*vproj)) || (iproj == vproj))
158 if (((ixform && vxform && ixform->
isEqualTo(*vxform)) || (ixform == vxform)) &&
181 cout <<
"DEBUG ossimImageViewProjectionTransform::viewToImage:" 205 std::vector<ossimDpt> points;
206 std::vector<ossimGpt> gPoints;
210 if((numberOfEdgePoints > 2)&&(affectedByElevation))
218 points[0] = imageRect.
ul();
219 points[1] = imageRect.
ur();
220 points[2] = imageRect.
lr();
221 points[3] = imageRect.
ll();
229 std::vector<ossimPolygon> polyList;
230 for(idx=0; idx < points.size();++idx)
237 gPoints.push_back(testGpt);
245 for(idx=0; idx < gPoints.size();++idx)
247 if(std::fabs(gPoints[idx].lond()-cg.
lond()) > 180)
249 gPoints[idx].lond(gPoints[idx].lond()+
sgn*360);
265 for(pointListIdx=0;pointListIdx<polyList.size();++pointListIdx)
267 const std::vector<ossimDpt>& clipPoints = polyList[pointListIdx].getVertexList();
269 for(idx = 0; idx<clipPoints.size(); ++idx)
274 points.push_back(testPt);
279 if (points.size() >= 4)
281 points.push_back(points[0]);
288 for(idx=0; idx < gPoints.size();++idx)
290 gPoints[idx].lond(gPoints[idx].lond()+(-
sgn*360));
301 for(pointListIdx=0;pointListIdx<polyList.size();++pointListIdx)
303 const std::vector<ossimDpt>& clipPoints = polyList[pointListIdx].getVertexList();
305 for(idx = 0; idx<clipPoints.size(); ++idx)
310 points.push_back(testPt);
314 if (points.size() >= 4)
316 points.push_back(points[0]);
325 std::vector<ossimDpt> vpoints;
327 for(idx=0; idx < points.size();++idx)
333 vpoints.push_back(testDpt);
339 vpoints.push_back(vpoints[0]);
352 bool new_view_set =
false;
391 out <<
"ossimImageViewProjectionTransform::print: ..... entered " <<endl;
395 out <<
" Input Image (LEFT) Geometry: " << endl;
400 out <<
" None defined." << endl;
404 out <<
"Output View (RIGHT) Geometry: " << endl;
409 out <<
" None defined." << endl;
430 std::vector<ossimGpt> imageGpts(4);
437 imageGpts[0].changeDatum(viewDatum);
438 imageGpts[1].changeDatum(viewDatum);
439 imageGpts[2].changeDatum(viewDatum);
440 imageGpts[3].changeDatum(viewDatum);
444 viewPolyArea &= imagePolyArea;
445 std::vector<ossimPolygon> visiblePolygons;
446 viewPolyArea.getVisiblePolygons(visiblePolygons);
447 if(visiblePolygons.size())
449 std::vector<ossimDpt> vpts;
451 for(idx=0; idx<visiblePolygons[0].getNumberOfVertices();++idx)
454 ossimGpt gpt(visiblePolygons[0][idx].lat, visiblePolygons[0][idx].lon, 0.0, viewDatum);
456 vpts.push_back(tempPt);
496 const char* prefix)
const 572 if(std::fabs(ulg.
lond()-cg.
lond()) > 180)
576 if(std::fabs(urg.
lond()-cg.
lond()) > 180)
580 if(std::fabs(lrg.
lond()-cg.
lond()) > 180)
584 if(std::fabs(llg.
lond()-cg.
lond()) > 180)
600 size.x = ossim::round<ossim_int32>( rect.
width() );
601 size.y = ossim::round<ossim_int32>( rect.
height() );
602 if (
size.hasNans() == false )
613 if ( viewProj.
valid() )
625 ossimDpt iRight(imageRect.ul().x+1, imageRect.ul().y);
626 ossimDpt iDown(imageRect.ul().x, imageRect.ul().y+1);
649 if ( gul.lat > gDown.
lat )
651 if ( gul.lat >= gRight.
lat )
653 hdd = gul.lat - glr.
lat;
666 if ( gRight.
lat >= gul.lat )
668 hdd = glr.
lat - gul.lat;
680 if ( rightLon > leftLon )
682 wdd = rightLon - leftLon;
686 wdd = rightLon + 360.0 - leftLon;
694 size.x = ossim::round<ossim_int32>(
697 size.y = ossim::round<ossim_int32>(
702 cout <<
"\nwdd: " << wdd
714 size.x = ossim::round<ossim_int32>( rect.
width() );
715 size.y = ossim::round<ossim_int32>( rect.
height() );
721 <<
"\n\ncomputed view size: " <<
size << endl;
724 if (
size.hasNans() == false )
virtual const ossimDpt & getDecimalDegreesPerPixel() const
Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing...
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
ossim_uint32 numberOf(const char *str) const
bool isAffectedByElevation() const
Returns TRUE if this geometry is sensitive to elevation.
ossim_float64 width() const
const ossimIpt & getImageSize() const
double lond() const
Will convert the radian measure to degrees.
Represents serializable keyword/value map.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Attempts to initialize a transform and a projection given the KWL.
std::ostream & print(std::ostream &out) const
Prints contents to output stream.
void getBoundingRect(ossimIrect &bounding_rect) const
Get the bounding rect of (0, 0) to (imageSize.x-1, imageSize.y-1).
const ossimDpt & ul() const
void setImageSize(const ossimIpt &size)
const ossimDatum * datum() const
datum().
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
void rnToFull(const ossimDpt &rnPt, ossim_uint32 resolutionLevel, ossimDpt &fullPt) const
rnToFull is a utility method that takes a rn resolution image point and maps it to the full image poi...
virtual void getGroundClipPoints(ossimGeoPolygon &gpts) const
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
virtual ossimDpt getMetersPerPixel() const =0
unsigned int ossim_uint32
bool getCrossesDateline() const
const std::vector< ossimGpt > & getVertexList() const
void add(const ossimPolyArea2d &rhs)
ossim_float64 height() const
ossim_uint32 size() const
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
bool clipToRect(vector< ossimPolygon > &result, const ossimDrect &rect) const
Uses the ossimPolyArea2d class for the intersection.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
virtual ossimGpt origin() const =0
ossimDpt midPoint() const
const ossimDpt & ur() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
const ossim2dTo2dTransform * getTransform() const
Access methods for transform (may be NULL pointer).
bool hasProjection() const
Returns TRUE if valid projection defined.
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the transform (if any) and projection (if any) states to the KWL.
const ossimDpt & ll() const
void fullToRn(const ossimDpt &fullPt, ossim_uint32 resolutionLevel, ossimDpt &rnPt) const
fullToRn is a utility method that takes a full image point and maps it to a rn resolution image point...
const ossimDpt & lr() const
std::basic_ostream< char > ostream
Base class for char output streams.
ossimDpt decimationFactor(ossim_uint32 r_index) const
Returns the decimation factor from R0 for the resolution level specified.
void getImageEdgePoints(std::vector< ossimDpt > &result, ossim_uint32 partitions=25) const