35 m_decimationFactors(0),
54 m_decimationFactors(copy_this.m_decimationFactors),
55 m_imageSize(copy_this.m_imageSize),
56 m_targetRrds(copy_this.m_targetRrds)
67 m_transform(transform),
69 m_decimationFactors(0),
101 if (inResolutionLevel != outResolutionLevel)
219 const double& h_ellipsoid,
422 double dlatx = std::fabs(g0.
lat - gx.
lat);
423 double dlaty = std::fabs(g0.
lat - gy.
lat);
424 double dlonx = std::fabs(g0.
lon - gx.
lon);
425 double dlony = std::fabs(g0.
lon - gy.
lon);
426 dpp.
lat = sqrt(dlatx*dlatx + dlaty*dlaty);
427 dpp.
lon = sqrt(dlonx*dlonx + dlony*dlony);
441 out <<
"type: ossimImageGeometry" << std::endl;
444 out <<
" m_transform: ";
449 out <<
" No transform defined. Using identity transform.\n";
454 out <<
" m_projection: ";
459 out <<
" No projection defined. ";
538 std::vector<ossimDpt>& decimations)
const 560 createNativeObjectFromRegistry(kwl, transformPrefix.
c_str());
561 if( transform.
valid() )
569 createProjection(kwl, projectionPrefix.
c_str());
570 if( projection.
valid() )
577 if( decimations.
size() )
585 if( imageSize.
size() )
592 if ( targetRrds.
size() )
601 createProjection(kwl, prefix);
614 createProjection(kwl, prefix);
629 bool good_save =
true;
655 kwl.
add(prefix,
"decimations", resultPoints,
true);
659 kwl.
add(prefix,
"decimations",
"",
true);
689 if (
this != ©_this)
758 tie.
lat += half_pixel_shift.
y;
759 tie.
lon -= half_pixel_shift.
x;
816 std::cout <<
"gul: " << gul <<
"\n" 817 <<
"gur: " << gur <<
"\n" 818 <<
"glr: " << glr <<
"\n" 819 <<
"gll: " << gll <<
"\n" 820 <<
"gRight: " << gRight <<
"\n" 821 <<
"gDown: " << gDown <<
"\n";
823 if ( gul.
lat > gDown.lat )
825 if ( gul.
lat >= gRight.
lat )
827 std::cout <<
"ONE\n";
833 std::cout <<
"TWO\n";
840 if ( gRight.
lat >= gul.
lat )
842 std::cout <<
"THREE\n";
848 std::cout <<
"FOUR\n";
853 std::cout <<
"TIE BEFORE ==== " << tie <<
"\n";
859 pt.
y += half_pixel_shift.
y;
860 pt.
x -= half_pixel_shift.
x;
864 std::cout <<
"TIE ==== " << tie <<
"\n";
912 tie.
y += half_pixel_shift.
y;
913 tie.
x -= half_pixel_shift.
x;
929 if ( (decimation.
x != 1.0) || (decimation.
y != 1.0) )
933 outPt.
x = rnPt.
x * (1.0/decimation.
x);
934 outPt.
y = rnPt.
y * (1.0/decimation.
y);
960 if ( (decimation.
x != 1.0) || (decimation.
y != 1.0) )
964 rnPt.
x = inPt.
x * decimation.
x;
965 rnPt.
y = inPt.
y * decimation.
y;
991 for(decimationIdx = 0; result&&(decimationIdx <
m_decimationFactors.size());++decimationIdx)
1029 bool result =
false;
1057 result = ( (fabs(center.
lond()-ul.
lond()) > 180.0) ||
1058 (fabs(center.
lond()-ur.
lond()) > 180.0) ||
1059 (fabs(center.
lond()-lr.
lond()) > 180.0) ||
1060 (fabs(center.
lond()-ll.
lond()) > 180.0) ||
1061 (fabs(ul.
lond()) > 180.0) ||
1062 (fabs(ur.
lond()) > 180.0) ||
1063 (fabs(lr.
lond()) > 180.0) ||
1064 (fabs(ll.
lond()) > 180.0)
1096 ossimDpt deltaUpper = (uri-uli)*(1.0/stepSize);
1097 ossimDpt deltaRight = (lri-uri)*(1.0/stepSize);
1098 ossimDpt deltaLower = (lli-lri)*(1.0/stepSize);
1099 ossimDpt deltaLeft = (uli-lli)*(1.0/stepSize);
1104 for(idx = 0; idx < stepSize;++idx)
1106 result.push_back(initialPoint);
1107 initialPoint.
x+=deltaUpper.
x;
1108 initialPoint.
y+=deltaUpper.
y;
1111 for(idx = 0; idx < stepSize;++idx)
1113 result.push_back(initialPoint);
1114 initialPoint.
x+=deltaRight.
x;
1115 initialPoint.
y+=deltaRight.
y;
1119 for(idx = 0; idx < stepSize;++idx)
1121 result.push_back(initialPoint);
1122 initialPoint.
x+=deltaLower.
x;
1123 initialPoint.
y+=deltaLower.
y;
1127 for(idx = 0; idx < stepSize;++idx)
1129 result.push_back(initialPoint);
1130 initialPoint.
x+=deltaLeft.
x;
1131 initialPoint.
y+=deltaLeft.
y;
1138 result[0] = imageRect.
ul();
1139 result[1] = imageRect.
ur();
1140 result[2] = imageRect.
lr();
1141 result[3] = imageRect.
ll();
1148 std::vector<ossimDpt> points;
1149 std::vector<ossimGpt> gPoints;
1150 std::vector<ossimPolygon> polyList;
1182 for(std::vector<ossimDpt>::const_iterator iter=points.begin();
1183 iter != points.end();
1191 bool needToShift =( (std::fabs(testGpt.
lond()-cg.
lond()) > 180.0)||
1192 (std::fabs(testGpt.
lond()>180.0)) );
1197 gPoints.push_back(testGpt);
1204 for(std::vector<ossimPolygon>::const_iterator iter = polyList.begin();
1205 iter!=polyList.end();++iter)
1211 for(std::vector<ossimGpt>::iterator iter = gPoints.begin();
1212 iter != gPoints.end();
1215 (*iter).lond((*iter).lond()+(-
sgn*360));
1220 for(std::vector<ossimPolygon>::const_iterator iter = polyList.begin();
1221 iter!=polyList.end();++iter)
1228 for(std::vector<ossimDpt>::const_iterator iter=points.begin();
1229 iter != points.end();++iter)
1236 gPoints.push_back(testGpt);
1287 if ((scale.
x != 0.0) && (scale.
y != 0.0))
1294 map_Proj->
applyScale(scale, recenterTiePoint);
1315 double den = 0.5/paramDelta;
1320 if(!adjustableParamInterface)
return false;
1338 result = (p2-p1)*den;
1357 result = NEWMAT::Matrix(nAdjustables, 2);
1358 for(;idx < nAdjustables; ++idx)
1365 result[idx][0] = paramResResult.
x;
1366 result[idx][1] = paramResResult.
y;
1381 if(nAdjustables != deltas.size())
return false;
1384 result = NEWMAT::Matrix(nAdjustables, 2);
1385 for(;idx < nAdjustables; ++idx)
1393 result[idx][0] = paramResResult.
x;
1394 result[idx][1] = paramResResult.
y;
1418 double den = 0.5/deltaLlh.
x;
1419 deltaWithRespectToLon = (p2-p1)*den;
1427 den = 0.5/deltaLlh.
y;
1428 deltaWithRespectToLat = (p2-p1)*den;
1436 den = 0.5/deltaLlh.
z;
1437 deltaWithRespectToH = (p2-p1)*den;
1440 result = NEWMAT::Matrix(3,2);
1448 result[2][0] = deltaWithRespectToH.
x;
1449 result[2][1] = deltaWithRespectToH.
y;
1487 const int NUMBER_OF_SAMPLES = 9;
1490 const double ELEVATION_DISPLACEMENT = 20;
1513 std::vector<ossimDpt> ipts(NUMBER_OF_SAMPLES);
1514 std::vector<ossimGpt> gpts(NUMBER_OF_SAMPLES);
1515 std::vector<ossimDpt> iptsDisplacement(NUMBER_OF_SAMPLES);
1516 std::vector<ossimDpt> partials(NUMBER_OF_SAMPLES);
1534 ipts[0] = centerIpt +
ossimDpt(-widthPercent, -heightPercent);
1536 ipts[1] = centerIpt +
ossimDpt(0.0,heightPercent);
1538 ipts[2] = centerIpt +
ossimDpt(widthPercent, -heightPercent);
1541 ipts[3] = centerIpt +
ossimDpt(-widthPercent, 0.0);
1542 ipts[4] = centerIpt;
1543 ipts[5] = centerIpt +
ossimDpt(widthPercent, 0.0);
1546 ipts[6] = centerIpt +
ossimDpt(-widthPercent, heightPercent);
1547 ipts[7] = centerIpt +
ossimDpt(0.0, heightPercent);
1548 ipts[8] = centerIpt +
ossimDpt(widthPercent, heightPercent);
1551 for(idx = 0; idx < ipts.size(); ++idx)
1555 h = gpts[idx].height();
1557 gpts[idx].height(h + ELEVATION_DISPLACEMENT);
1559 averageDelta = averageDelta + (iptsDisplacement[idx] - ipts[idx]);
1563 if(averageLength < 1)
return false;
1567 averageDelta = averageDelta/averageLength;
1584 double len = deltaPt.
length();
1587 deltaUnitPt = deltaUnitPt/len;
1591 deltaUnitPt.
y *= -1.0;
1601 if(result < 0) result += 360.0;
1667 if ( !midBottomGpt.hasNans() && !midTopGpt.
hasNans() )
1669 result = midBottomGpt.azimuthTo( midTopGpt );
1671 if(result < 0) result += 360.0;
void getBoundingGroundRect(ossimGrect &bounding_grect) const
ossimString toString() const
void set_uly(ossim_float64 y)
void calculatePolyBounds(ossimPolyArea2d &result, ossim_uint32 partitions=25) const
This is the first stage implementation.
void set_uly(ossim_int32 y)
virtual const ossimDpt & getDecimalDegreesPerPixel() const
Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing...
bool operator==(const ossimImageGeometry &compare_this) const
Returns TRUE if argument geometry has exactly the same instances for transform and m_projection...
virtual ossimObject * dup() const =0
RTTI_DEF1(ossimImageGeometry, "ossimImageGeometry", ossimObject)
void rnToRn(const ossimDpt &inRnPt, ossim_uint32 inResolutionLevel, ossim_uint32 outResolutionLevel, ossimDpt &outRnPt) const
rnToRn is a utility method that takes a rn resolution image point and maps it to the another rn resol...
ossimRefPtr< ossim2dTo2dTransform > m_transform
Maintains local_image-to-full_image transformation.
void setProjection(ossimProjection *projection)
Sets the projection to be used for local-to-world coordinate transformation.
bool computeImageToGroundPartialsWRTAdjParam(ossimDpt &result, const ossimGpt &gpt, ossim_uint32 idx, ossim_float64 paramDelta=1.0)
void set_ulx(ossim_float64 x)
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
bool isAffectedByElevation() const
Returns TRUE if this geometry is sensitive to elevation.
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
double lond() const
Will convert the radian measure to degrees.
void undecimatePoint(const ossimDpt &rnPt, ossim_uint32 resolutionLevel, ossimDpt &outPt) const
Method to back out decimation of a point.
Represents serializable keyword/value map.
OSSIM_DLL void toStringList(ossimString &resultStringOfPoints, const std::vector< ossimDpt > &pointList, char separator=' ')
Will take a vector of ossimDpt and convert to a string list separated by spaces For example: (45...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Attempts to initialize a transform and a projection given the KWL.
bool isValid(bool displayValidationError=false) const
const char * find(const char *key) const
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
std::ostream & print(std::ostream &out) const
Prints contents to output stream.
double nan()
Method to return ieee floating point double precision NAN.
void getBoundingRect(ossimIrect &bounding_rect) const
Get the bounding rect of (0, 0) to (imageSize.x-1, imageSize.y-1).
bool computeGroundToImagePartials(NEWMAT::Matrix &result, const ossimGpt &gpt, const ossimDpt3d &deltaLlh)
const ossimDpt & ul() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
void setTargetRrds(ossim_uint32 rrds)
Set m_targetRrds data member.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual ossimGpt inverse(const ossimDpt &pp) const
virtual bool isGeographic() const
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
const ossimIpt & ul() const
ossim_float64 hgt
Height in meters above the ellipsiod.
ossim_float64 upIsUpAngle() const
ossim_uint32 m_targetRrds
Target rrds for localToWorld and worldToLocal methods.
ossim_uint32 toUInt32() const
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
bool getCornerGpts(ossimGpt &ul, ossimGpt &ur, ossimGpt &lr, ossimGpt &ll) const
Assigns the ossimGpts with the ground coordinates of the four corresponding image corner points...
ossimDpt getDegreesPerPixel() const
Returns the resolution of this image in degrees/pixel.
double latd() const
Will convert the radian measure to degrees.
const ossimIpt & ll() const
void wrap()
Wrap method to maintain longitude between -180 and +180 and latitude between -90 and +90...
ossim_uint32 getNumberOfAdjustableParameters() const
double distanceTo(const ossimGpt &arg_gpt) const
METHOD: distanceTo(ossimGpt) Computes straight-line distance in meters between this and arg gpt: ...
virtual void applyScale(const ossimDpt &scale, bool recenterTiePoint)
Applies scale to theDeltaLonPerPixel, theDeltaLatPerPixel and theMetersPerPixel data members (eg: the...
const ossimDrect & expand(const ossimDpt &padding)
static const char * TYPE_KW
ossimImageGeometry()
Default constructor defaults to unity transform with no projection.
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
#define STATIC_TYPE_NAME(T)
const ossimDatum * datum() const
datum().
std::vector< ossim_float64 > DeltaParamList
bool open(const ossimFilename &image)
Shortcut way of getting to an image's geometry when access to pixels is not needed.
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual ossimAdjustableParameterInterface * getAdjustableParameterInterface()
void set_lry(ossim_float64 y)
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...
OSSIM_DLL void toVector(std::vector< ossimDpt > &result, const ossimString &stringOfPoints)
Will take a string list separated by spaces and convert to a vector of ossimDpts. ...
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
virtual void lineSampleToEastingNorthing(const ossimDpt &liineSample, ossimDpt &eastingNorthing) const
std::string::size_type size() const
virtual double getHeightAboveEllipsoid(const ossimGpt &gpt)
ossimIpt midPoint() const
virtual ossimDpt getMetersPerPixel() const =0
virtual void lineSampleHeightToWorld(const ossimDpt &lineSampPt, const double &heightAboveEllipsoid, ossimGpt &worldPt) const =0
unsigned int ossim_uint32
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
ossimRefPtr< ossimProjection > m_projection
Maintains full_image-to-world_space transformation.
bool getCrossesDateline() const
virtual ~ossimImageGeometry()
const ossimGpt & ul() const
double atan2d(double y, double x)
const ossimIpt & lr() const
void rnToWorld(const ossimDpt &rnPt, ossim_uint32 resolutionLevel, ossimGpt &wpt) const
rnToWorld is a utility method that takes a rn resolution image point and maps it to the world point...
void worldToRn(const ossimGpt &wpt, ossim_uint32 resolutionLevel, ossimDpt &rnPt) const
worldToRn is a utility method that takes a world point allows one to transform all the way back to an...
void decimatePoint(const ossimDpt &inPt, ossim_uint32 resolutionLevel, ossimDpt &rnPt) const
Method to apply decimation of a point.
void add(const ossimPolyArea2d &rhs)
void toPoint(const std::string &s)
Initializes this point from string.
const ossimIpt & ur() 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.
static ossimProjectionFactoryRegistry * instance()
void set_lrx(ossim_int32 x)
void applyScale(const ossimDpt &scale, bool recenterTiePoint)
Changes the GSD and image size to reflect the scale provided.
void decimationFactors(std::vector< ossimDpt > &decimations) const
Gets array of all decimation levels.
const ossimImageGeometry & operator=(const ossimImageGeometry ©_this)
Replaces any existing transform and projection with those in the copy_this object.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
bool isEqualTo(const ossimIpt &rhs, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
ossimString toString(ossim_uint32 precision=15) const
void getTiePoint(ossimGpt &tie, bool edge) const
Get the latitude, longitude of the tie point.
void set_lry(ossim_int32 y)
virtual ossimDpt forward(const ossimGpt &wp) const
ossimDpt midPoint() const
const ossimDpt & ur() const
void setTransform(ossim2dTo2dTransform *transform)
Sets the transform to be used for local-to-full-image coordinate transformation.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual ossimObject * dup() const
virtual bool isAffectedByElevation() const =0
Pure virtual method to query if projection is affected by elevation.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimPolyArea2d & setToBufferedShape(double distance=FLT_EPSILON)
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
ossimDpt metersPerDegree() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the transform (if any) and projection (if any) states to the KWL.
static ossimImageHandlerRegistry * instance()
const ossimDpt & ll() const
virtual void lineSampleToWorld(const ossimDpt &lineSampPt, ossimGpt &worldPt) const =0
virtual ossimDpt getMetersPerPixel() const
void set_lrx(ossim_float64 x)
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...
void setParameterCenter(ossim_uint32 idx, double center, bool notify=false)
ossim_float64 northUpAngle() const
virtual void worldToLineSample(const ossimGpt &worldPoint, ossimDpt &lineSampPt) const =0
std::vector< ossimDpt > m_decimationFactors
List of decimation factors for R-levels.
const ossimDpt & lr() const
bool crossesDateline(H5::DataSet &dataset, const ossimIrect &validRect)
Checks for dateline cross.
bool isMapProjected() const
Returns true if underlying projection is derived from ossimMapProjection.
const ossimGpt & lr() const
double getParameterCenter(ossim_uint32 idx) 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 set_ulx(ossim_int32 x)
void getImageEdgePoints(std::vector< ossimDpt > &result, ossim_uint32 partitions=25) const
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
bool computeImageToGroundPartialsWRTAdjParams(NEWMAT::Matrix &result, const ossimGpt &gpt, ossim_float64 paramDelta=1.0)
ossim_uint32 getTargetRrds() const