Skip to content
Commits on Source (7)
ossim (2.4.2-3) UNRELEASED; urgency=medium
ossim (2.5.0-1) unstable; urgency=medium
* Team upload.
* Move from experimental to unstable.
-- Bas Couwenberg <sebastic@debian.org> Sun, 26 Aug 2018 10:56:59 +0200
ossim (2.5.0-1~exp1) experimental; urgency=medium
* Team upload.
* New upstream release.
* Bump Standards-Version to 4.2.0, no changes.
* Update watch file to limit matches to archive path.
-- Bas Couwenberg <sebastic@debian.org> Sun, 05 Aug 2018 20:40:17 +0200
-- Bas Couwenberg <sebastic@debian.org> Fri, 24 Aug 2018 09:15:55 +0200
ossim (2.4.2-2) unstable; urgency=medium
......
......@@ -41,7 +41,9 @@ public:
: lat(alat),
lon(alon),
hgt(ahgt), // relative to the ellipsoid
theDatum(aDatum) {}//limitLonTo180();}
theDatum(aDatum)
{
} //limitLonTo180();}
/**
* Copy Constructor:
......@@ -57,8 +59,7 @@ public:
/**
* Argument aPt (x, y, z) is understood to represent (lon, lat, hgt) relative to WGS84 datum.
*/
ossimGpt(const ossimDpt3d &aPt) :
lat(aPt.y), lon(aPt.x), hgt(aPt.z), theDatum(ossimDatumFactory::instance()->wgs84()) {}
ossimGpt(const ossimDpt3d &aPt) : lat(aPt.y), lon(aPt.x), hgt(aPt.z), theDatum(ossimDatumFactory::instance()->wgs84()) {}
/**
* latr(). Returns the latitude in radian measure.
......@@ -79,7 +80,9 @@ public:
* Assumes the value being passed in is in radians.
*/
void lonr(double radianValue)
{lon = radianValue*DEG_PER_RAD; }//limitLonTo180();}
{
lon = radianValue * DEG_PER_RAD;
} //limitLonTo180();}
/**
* Will convert the radian measure to degrees.
......@@ -127,7 +130,12 @@ public:
*/
void heightMSL(double heightMSL);
void makeNan(){lat=ossim::nan(); lon=ossim::nan(); hgt=ossim::nan();}
void makeNan()
{
lat = ossim::nan();
lon = ossim::nan();
hgt = ossim::nan();
}
bool isNan() const
{
return (ossim::isnan(lat) && ossim::isnan(lon) && ossim::isnan(hgt));
......@@ -217,7 +225,12 @@ public:
* Converts the lon data member to a value between -180 and +180:
*/
void limitLonTo180()
{ if (lon <= -180.0) lon += 360.0; else if (lon > 180.0) lon -= 360.0; }
{
if (lon <= -180.0)
lon += 360.0;
else if (lon > 180.0)
lon -= 360.0;
}
/**
* @brief Wrap method to maintain longitude between -180 and +180 and latitude between
......@@ -227,20 +240,26 @@ public:
void clampLon(double low, double high)
{
if(lon < low) lon = low;
if(lon > high) lon = high;
if (lon < low)
lon = low;
if (lon > high)
lon = high;
}
void clampLat(double low, double high)
{
if(lat < low) lat = low;
if(lat > high) lat = high;
if (lat < low)
lat = low;
if (lat > high)
lat = high;
}
void clampHgt(double low, double high)
{
if(hgt < low) hgt = low;
if(hgt > high) hgt = high;
if (hgt < low)
hgt = low;
if (hgt > high)
hgt = high;
}
/**
......@@ -274,12 +293,10 @@ public:
ossim_float64 hgt;
private:
/**
* Know reference location plus an implied ellipsoid.
*/
const ossimDatum *theDatum;
};
inline const ossimGpt &ossimGpt::operator=(const ossimGpt &aPt)
......@@ -304,6 +321,11 @@ inline const ossimGpt& ossimGpt::operator=(const ossimGpt& aPt)
inline void ossimGpt::wrap()
{
// only wrap if values are not nan
// may want to change this to isbad because
// hey could be INF instead of NAN
if (ossim::isnan(lon) || ossim::isnan(lat))
return;
if (lon > 180.0)
{
do
......
......@@ -165,6 +165,13 @@ public:
const ossimProjection* getProjection() const { return m_projection.get(); }
ossimProjection* getProjection() { return m_projection.get(); }
/**
* @brief Returns true if underlying projection is derived from
* ossimMapProjection.
* @return true if map projected; false, if not.
*/
bool isMapProjected() const;
/**
* @return const ossimMapProjection* or NULL if projection not set or not
* derived from ossimMapProjection.
......
......@@ -214,7 +214,8 @@ private:
ossimDpt computeRoundTripErrorViewPt(const ossimDpt& dpt)const;
bool isViewAPoint()const;
bool isIdentity()const;
bool canBilinearInterpolate(double error)const;
//bool canBilinearInterpolate(double error) const;
bool canBilinearInterpolate() const;
ossimDpt getParametricCenter(const ossimDpt& ul, const ossimDpt& ur,
const ossimDpt& lr, const ossimDpt& ll)const;
......@@ -321,7 +322,7 @@ private:
* renderers together. So if we have one
* renderer doing a scale and they pass an r-level
* down and we have another renderer within the
* chain he will be starting at a different r-level.
* chain we will be starting at a different r-level.
* The default will be r-level 0 request coming
* from the right.
*/
......@@ -339,6 +340,9 @@ private:
ossimPolyArea2d m_viewArea;
bool m_crossesDateline;
double m_averageViewToImageScale;
double m_averageViewToImageRLevelScale;
TYPE_DATA
};
......
......@@ -57,7 +57,7 @@ public:
*/
virtual void getImageToViewScale(ossimDpt& resultScale,
const ossimDpt& imagePoint,
const ossimDpt& deltaImagePointXY)const;
const ossimDpt& deltaImagePointXY=ossimDpt(1.0,1.0))const;
/*!
* If it needs to it will use the information passed in to get the
......@@ -72,7 +72,7 @@ public:
*/
virtual void getViewToImageScale(ossimDpt &resultScale,
const ossimDpt &imagePoint,
const ossimDpt& deltaImagePointXY)const;
const ossimDpt &deltaImagePointXY = ossimDpt(1.0, 1.0)) const;
virtual void imageToView(const ossimDpt& imagePoint,
ossimDpt& viewPoint)const;
......
......@@ -1079,6 +1079,10 @@ void ossimImageGeometry::getImageEdgePoints(std::vector<ossimDpt>& result, ossim
// error out
return;
}
// Make edge to edge.
imageRect.expand( ossimDpt(0.5, 0.5) );
result.clear();
// First get the image points we will be transforming
if(partitions > 2)
......@@ -1151,7 +1155,7 @@ void ossimImageGeometry::calculatePolyBounds(ossimPolyArea2d& result, ossim_uint
ossimDpt(180,90),
ossimDpt(180,-90));
getBoundingRect(imageRect);
bool affectedByElevation = isAffectedByElevation();
// bool affectedByElevation = isAffectedByElevation();
bool crossesDateline = getCrossesDateline();
result.clear();
if(imageRect.hasNans())
......@@ -1221,7 +1225,6 @@ void ossimImageGeometry::calculatePolyBounds(ossimPolyArea2d& result, ossim_uint
}
else
{
ossim_uint32 idx=0;
for(std::vector<ossimDpt>::const_iterator iter=points.begin();
iter != points.end();++iter)
{
......@@ -1674,3 +1677,9 @@ ossim_float64 ossimImageGeometry::northUpAngle()const
return result;
} // End: ossimImageGeometry::northUpAngle()
bool ossimImageGeometry::isMapProjected() const
{
return dynamic_cast<const ossimMapProjection*>( m_projection.get() ) != 0;
}
......@@ -380,7 +380,7 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::tooBig()const
ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
{
#if 0
#if 1
ossim_uint16 result = SPLIT_NONE;
ossimDrect vRect = getViewRect();
......@@ -389,7 +389,7 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
// very small rectangles in canBilinearInterpolate(...) method.
// DRB 05 Dec. 2017
//---
if ( imageHasNans()||(vRect.width() < 8 && vRect.height() < 8) )
if ( imageIsNan()||(vRect.width() < 8 && vRect.height() < 8) )
{
return result;
}
......@@ -434,7 +434,10 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
if(result != SPLIT_ALL)
{
ossim_float64 bias = m_ImageToViewScale.length();
if(bias < 1.0) bias = 1.0/bias;
//ossim_float64 bias = (m_ImageToViewScale.x+m_ImageToViewScale.y)/2.0;
//std::cout << "SCALE BIAS = " << bias << "\n";
if (bias < 1.0)
bias = 1.0 / bias;
bias = std::sqrt(bias);
if(bias < 1) bias = 1.0;
......@@ -459,11 +462,9 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
// if(m_llRoundTripError.length() > sensitivityScale) result |= LOWER_LEFT_SPLIT_FLAG;
// std::cout << result << " == " << SPLIT_ALL << "\n";
if((result!=SPLIT_ALL)&&!canBilinearInterpolate(bias))
if(!canBilinearInterpolate())
{
// std::cout << "TESTING BILINEAR!!!!\n";
result = SPLIT_ALL;
}
else
{
......@@ -575,10 +576,15 @@ void ossimImageRenderer::ossimRendererSubRectInfo::transformViewToImage()
// m_llRoundTripError = m_transform->getRoundTripErrorView(m_Vll);
#if 1
m_VulScale = computeViewToImageScale(m_Vul, ossimDpt( w, h));
m_VurScale = computeViewToImageScale(m_Vur, ossimDpt(-w, h));
m_VlrScale = computeViewToImageScale(m_Vlr, ossimDpt(-w,-h));
m_VllScale = computeViewToImageScale(m_Vll, ossimDpt( w,-h));
m_transform->getViewToImageScale(m_VulScale, m_Vul);
m_transform->getViewToImageScale(m_VurScale, m_Vur);
m_transform->getViewToImageScale(m_VlrScale, m_Vlr);
m_transform->getViewToImageScale(m_VllScale, m_Vll);
// m_VulScale = computeViewToImageScale(m_Vul, ossimDpt( w, h));
// m_VurScale = computeViewToImageScale(m_Vur, ossimDpt(-w, h));
// m_VlrScale = computeViewToImageScale(m_Vlr, ossimDpt(-w,-h));
// m_VllScale = computeViewToImageScale(m_Vll, ossimDpt( w,-h));
ossim_int32 n = 0;
m_ViewToImageScale.x = 0.0;
......@@ -757,16 +763,16 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::isIdentity()const
(illDelta <= FLT_EPSILON));
}
bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double error)const
bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate() const
//bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double error) const
{
bool result = false;
// now check point placement
ossimDpt imageToViewScale = getAbsValueImageToViewScales();
double testScale = imageToViewScale.length();
// double testScale = imageToViewScale.length();
double testScale = ossim::max<ossim_float64>(imageToViewScale.x, imageToViewScale.y);
// ossimDpt errorUl = transform->getRoundTripErrorView(m_Vul);
// ossimDpt errorUr = transform->getRoundTripErrorView(m_Vur);
// ossimDpt errorLr = transform->getRoundTripErrorView(m_Vlr);
......@@ -888,6 +894,67 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double
double errorCheck3 = (testRight - iRight).length();
double errorCheck4 = (testBottom - iBottom).length();
double errorCheck5 = (testLeft - iLeft).length();
double error = 1.0;
if (testScale >= 1)
{
// std::cout <<"testScale MUL: " << testScale << "\n";
// std::cout << "errorCheck1: " << errorCheck1 << "\n";
// std::cout << "errorCheck2: " << errorCheck2 << "\n";
// std::cout << "errorCheck3: " << errorCheck3 << "\n";
// std::cout << "errorCheck4: " << errorCheck4 << "\n";
// std::cout << "errorCheck5: " << errorCheck5 << "\n";
// std::cout << "AFTER\n";
// errorCheck1 *= testScale;
// errorCheck2 *= testScale;
// errorCheck3 *= testScale;
// errorCheck4 *= testScale;
// errorCheck5 *= testScale;
// error*=testScale;
// std::cout << "errorCheck1: " << errorCheck1 << "\n";
// std::cout << "errorCheck2: " << errorCheck2 << "\n";
// std::cout << "errorCheck3: " << errorCheck3 << "\n";
// std::cout << "errorCheck4: " << errorCheck4 << "\n";
// std::cout << "errorCheck5: " << errorCheck5 << "\n";
}
else if (testScale >= FLT_EPSILON)
{
// std::cout << "testScale DIV: " << testScale << "\n";
// std::cout << "errorCheck1: " << errorCheck1 << "\n";
// std::cout << "errorCheck2: " << errorCheck2 << "\n";
// std::cout << "errorCheck3: " << errorCheck3 << "\n";
// std::cout << "errorCheck4: " << errorCheck4 << "\n";
// std::cout << "errorCheck5: " << errorCheck5 << "\n";
// errorCheck1 /= testScale;
// errorCheck2 /= testScale;
// errorCheck3 /= testScale;
// errorCheck4 /= testScale;
// errorCheck5 /= testScale;
// std::cout << "AFTER\n";
// std::cout << "errorCheck1: " << errorCheck1 << "\n";
// std::cout << "errorCheck2: " << errorCheck2 << "\n";
// std::cout << "errorCheck3: " << errorCheck3 << "\n";
// std::cout << "errorCheck4: " << errorCheck4 << "\n";
// std::cout << "errorCheck5: " << errorCheck5 << "\n";
// error /= testScale;
}
else
{
errorCheck1 = 0.0;
errorCheck2 = 0.0;
errorCheck3 = 0.0;
errorCheck4 = 0.0;
errorCheck5 = 0.0;
}
//std::cout << "errorCheck1:" << errorCheck1 << " ?????? " << error << "\n";
//std::cout << "DIV:" << (errorCheck1 / error) << " ?????? " << error << "\n";
//std::cout << "MULT:" << (errorCheck1 * error) << " ?????? " << error << "\n";
// result = ((errorCheck1 < error) &&
// (errorCheck2 < error) &&
// (errorCheck3 < error) &&
// (errorCheck4 < error) &&
// (errorCheck5 < error));
// std::cout << "error: " << error << "\n";
result = ((errorCheck1 < error) &&
(errorCheck2 < error) &&
(errorCheck3 < error) &&
......@@ -1037,8 +1104,7 @@ ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::getParametricCenter(const
}
ossimImageRenderer::ossimImageRenderer()
:
ossimImageSourceFilter(),
: ossimImageSourceFilter(),
ossimViewInterface(0),
m_Resampler(0),
m_BlankTile(0),
......@@ -1051,7 +1117,9 @@ m_viewRect(),
m_rectsDirty(true),
m_MaxRecursionLevel(5),
m_AutoUpdateInputTransform(true),
m_MaxLevelsToCompute(999999) // something large so it will always compute
m_MaxLevelsToCompute(999999), // something large so it will always compute
m_averageViewToImageScale(1.0),
m_averageViewToImageRLevelScale(0.0)
{
ossimViewInterface::theObject = this;
m_Resampler = new ossimFilterResampler();
......@@ -1073,7 +1141,10 @@ ossimImageRenderer::ossimImageRenderer(ossimImageSource* inputSource,
m_rectsDirty(true),
m_MaxRecursionLevel(5),
m_AutoUpdateInputTransform(true),
m_MaxLevelsToCompute(999999) // something large so it will always compute
m_MaxLevelsToCompute(999999),
m_averageViewToImageScale(1.0),
m_averageViewToImageRLevelScale(0.0)
// something large so it will always compute
{
ossimViewInterface::theObject = this;
m_Resampler = new ossimFilterResampler();
......@@ -1191,19 +1262,59 @@ ossimRefPtr<ossimImageData> ossimImageRenderer::getTile(
// return m_BlankTile;
//}
#if 0
#if 1
ossimIrect tempRect = tileRect;
ossim_uint32 levels = theInputConnection->getNumberOfDecimationLevels();
ossim_float64 length = ossim::max<ossim_float64>(m_inputR0Rect.width(), m_inputR0Rect.height());
// if we are zoomed out or we are completely within the requesting tile rect
bool canClip = (m_viewRect.completely_within(tileRect));
if(!canClip)
{
if(m_averageViewToImageScale > 1.0)
{
if ((length / m_averageViewToImageScale) <= 256)
{
// we are very small so we can clip
canClip = true;
}
}
}
// gpotts: Until I can fix the entire resampling process we will add a sanity
// if we are zoomed out or the rect completely fits within the tile
// then we will clip to the view rect
if (canClip)
{
ossimPolyArea2d tileRectArea(tileRect);
if (!(m_viewArea.intersects(tileRectArea)))
{
return m_BlankTile;
}
else
{
ossimDrect rect;
tileRectArea &= m_viewArea;
tileRectArea.getBoundingRect(rect);
tempRect = rect;
}
}
// tempRect = tileRect.clipToRect(m_viewRect);
// expand a small patch just to alleviate errors in the size of the rect when resampling
// ossimIrect viewRectClip = tileRect.clipToRect(ossimIrect(m_viewRect.ul() + ossimIpt(-8,-8),
// m_viewRect.lr() + ossimIpt(8,8)));
ossimIrect viewRectClip = tileRect.clipToRect(m_viewRect);
std::cout << "_____________________" << std::endl;
std::cout << "viewRectClip = " << viewRectClip << std::endl;
//ossimIrect viewRectClip = tileRect.clipToRect(m_viewRect);
// std::cout << "_____________________" << std::endl;
// std::cout << "viewRectClip = " << viewRectClip << std::endl;
// std::cout << "tileRect = " << tileRect << std::endl;
// std::cout << "m_viewRect = " << m_viewRect << std::endl;
ossimRendererSubRectInfo subRectInfo(viewRectClip.ul(),
viewRectClip.ur(),
viewRectClip.lr(),
viewRectClip.ll());
ossimRendererSubRectInfo subRectInfo(m_ImageViewTransform.get(),
tempRect.ul(),
tempRect.ur(),
tempRect.lr(),
tempRect.ll());
#else
ossimRendererSubRectInfo subRectInfo(m_ImageViewTransform.get(),
tileRect.ul(),
......@@ -1599,10 +1710,12 @@ void ossimImageRenderer::getBoundingRect(ossimIrect& rect, ossim_uint32 resLevel
void ossimImageRenderer::initializeBoundingRects()
{
m_averageViewToImageScale = 1.0;
m_rectsDirty = true;
ossimImageViewProjectionTransform *ivpt =
dynamic_cast<ossimImageViewProjectionTransform *>(m_ImageViewTransform.get());
if(!theInputConnection||!m_ImageViewTransform.valid()) return;
if (!theInputConnection || !m_ImageViewTransform.valid())
return;
m_inputR0Rect = theInputConnection->getBoundingRect(0);
if (!m_inputR0Rect.hasNans())
{
......@@ -1640,7 +1753,8 @@ void ossimImageRenderer::initializeBoundingRects()
if (!mpp.hasNans() && !vmpp.hasNans())
{
scale = mpp.y / vmpp.y;
if(scale > 1.0) scale = 1.0;
if (scale > 1.0)
scale = 1.0;
}
ossim_float64 mppTest = mpp.y;
ossim_float64 divisor = mppTest; // default to 30 meter elevation
......@@ -1655,24 +1769,27 @@ void ossimImageRenderer::initializeBoundingRects()
{
divisor = 1000; // 1 kilometer
}
if(divisor < 30) divisor = 30.0;
if (divisor < 30)
divisor = 30.0;
// now test to see if our edge walk is close to matching enough
// points for a good match.
//
ossim_uint32 maxEdgeSample = ossim::min(static_cast<ossim_uint32>(50), maxLen);
if(maxEdgeSample < 1) maxEdgeSample = 1;
if (maxEdgeSample < 1)
maxEdgeSample = 1;
ossim_uint32 testEdgeSample = ossim::round<ossim_uint32>((maxLen * scale * mpp.y) / divisor);
bool goodMatch = (testEdgeSample <= maxEdgeSample) || (testEdgeSample >= (maxLen >> 1));
ossim_float64 steps = ossim::min(testEdgeSample, maxEdgeSample);
ossim_uint32 finalSteps = ossim::round<ossim_uint32>(steps);
if(finalSteps<1) finalSteps=1;
if (finalSteps < 1)
finalSteps = 1;
if (igeom->getCrossesDateline())
{
if(finalSteps < maxEdgeSample) finalSteps = maxEdgeSample;
if (finalSteps < maxEdgeSample)
finalSteps = maxEdgeSample;
}
ivpt->getViewSegments(boundList, m_viewArea, finalSteps);
......@@ -1720,10 +1837,18 @@ void ossimImageRenderer::initializeBoundingRects()
m_viewArea = m_viewRect;
}
}
if(!m_viewRect.hasNans()&&m_ImageViewTransform)
{
ossimDpt result;
m_ImageViewTransform->getViewToImageScale(result, m_viewRect.midPoint());
m_averageViewToImageScale = (result.x+result.y)/2.0;
m_averageViewToImageRLevelScale = log(m_averageViewToImageScale) / log(2);
}
if ( m_rectsDirty )
{
m_viewRect.makeNan();
}
#if 0 /* Please leave for debug. */
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimImageRenderer::initializeBoundingRects() debug:\n"
......
......@@ -211,23 +211,55 @@ void ossimImageViewTransform::getScaleChangeViewToImage(ossimDpt& result,
}
}
void ossimImageViewTransform::getImageToViewScale(ossimDpt& resultScale,
const ossimDpt& imagePoint,
const ossimDpt& deltaImagePointXY)const
ossimDrect ossimImageViewTransform::getImageToViewBounds(const ossimDrect& imageRect)const
{
ossimDpt p1 = imagePoint;
ossimDpt p2(imagePoint.x + deltaImagePointXY.x,
imagePoint.y);
ossimDpt p3(imagePoint.x,
imagePoint.y + deltaImagePointXY.y);
ossimDpt p1;
ossimDpt p2;
ossimDpt p3;
ossimDpt p4;
imageToView(imageRect.ul(), p1);
imageToView(imageRect.ur(), p2);
imageToView(imageRect.lr(), p3);
imageToView(imageRect.ll(), p4);
return ossimDrect(p1, p2, p3, p4);
}
ossimDrect ossimImageViewTransform::getViewToImageBounds(const ossimDrect& viewRect)const
{
ossimDpt p1;
ossimDpt p2;
ossimDpt p3;
ossimDpt p4;
viewToImage(viewRect.ul(), p1);
viewToImage(viewRect.ur(), p2);
viewToImage(viewRect.lr(), p3);
viewToImage(viewRect.ll(), p4);
return ossimDrect(p1, p2, p3, p4);
}
#if 0
void ossimImageViewTransform::getViewToImageScale(ossimDpt &resultScale,
const ossimDpt &viewPoint,
const ossimDpt &deltaViewPointXY) const
{
ossimDpt p1 = viewPoint;
ossimDpt p2(viewPoint.x + deltaViewPointXY.x,
viewPoint.y);
ossimDpt p3(viewPoint.x,
viewPoint.y + deltaViewPointXY.y);
ossimDpt transformedP1;
ossimDpt transformedP2;
ossimDpt transformedP3;
imageToView(p1, transformedP1);
imageToView(p2, transformedP2);
imageToView(p3, transformedP3);
viewToImage(p1, transformedP1);
viewToImage(p2, transformedP2);
viewToImage(p3, transformedP3);
ossimDpt deltaP1P2 = transformedP1 - transformedP2;
ossimDpt deltaP1P3 = transformedP1 - transformedP3;
......@@ -243,31 +275,96 @@ void ossimImageViewTransform::getImageToViewScale(ossimDpt& resultScale,
if (sumSquaredSqrtP1P2 > FLT_EPSILON)
{
resultScale.x = sumSquaredSqrtP1P2/deltaImagePointXY.x;
resultScale.x = sumSquaredSqrtP1P2 / deltaViewPointXY.x;
}
if (sumSquaredSqrtP1P3 > FLT_EPSILON)
{
resultScale.y = sumSquaredSqrtP1P3/deltaImagePointXY.y;
resultScale.y = sumSquaredSqrtP1P3 / deltaViewPointXY.y;
}
}
#else
void ossimImageViewTransform::getViewToImageScale(ossimDpt &result,
const ossimDpt &viewSeedPoint,
const ossimDpt &dxdy) const
{
result.makeNan();
void ossimImageViewTransform::getViewToImageScale(ossimDpt& resultScale,
const ossimDpt& viewPoint,
const ossimDpt& deltaViewPointXY)const
ossimDpt dxdyHalf(dxdy.x / 2.0, dxdy.y / 2.0);
ossimDpt iptdx1 = viewSeedPoint - ossimDpt(dxdyHalf.x, 0.0);
ossimDpt iptdx2 = iptdx1 + ossimDpt(dxdy.x, 0.0);
ossimDpt iptdy1 = viewSeedPoint - ossimDpt(dxdyHalf.y, 0.0);
ossimDpt iptdy2 = iptdx1 + ossimDpt(0.0, dxdy.y);
ossimDpt dx1;
ossimDpt dx2;
ossimDpt dy1;
ossimDpt dy2;
viewToImage(iptdx1, dx1);
viewToImage(iptdx2, dx2);
viewToImage(iptdy1, dy1);
viewToImage(iptdy2, dy2);
if (!(dx1.hasNans() || dx2.hasNans()))
{
ossimDpt p1 = viewPoint;
ossimDpt p2(viewPoint.x + deltaViewPointXY.x,
viewPoint.y);
ossimDpt p3(viewPoint.x,
viewPoint.y + deltaViewPointXY.y);
ossimDpt delta = dx1 - dx2;
// now compute the distances.
ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
(delta.y * delta.y));
if (sumSquared > FLT_EPSILON)
{
result.x = sumSquared / dxdy.x;
}
else
{
result.x = ossim::nan();
}
}
if (!(dy1.hasNans() || dy2.hasNans()))
{
ossimDpt delta = dy1 - dy2;
// now compute the distances.
ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
(delta.y * delta.y));
if (sumSquared > FLT_EPSILON)
{
result.y = sumSquared / dxdy.y;
}
else
{
result.y = ossim::nan();
}
}
if (result.hasNans())
{
result.makeNan();
}
}
#endif
#if 0
void ossimImageViewTransform::getImageToViewScale(ossimDpt &resultScale,
const ossimDpt &imagePoint,
const ossimDpt &deltaImagePointXY) const
{
ossimDpt p1 = imagePoint;
ossimDpt p2(imagePoint.x + deltaImagePointXY.x,
imagePoint.y);
ossimDpt p3(imagePoint.x,
imagePoint.y + deltaImagePointXY.y);
ossimDpt transformedP1;
ossimDpt transformedP2;
ossimDpt transformedP3;
viewToImage(p1, transformedP1);
viewToImage(p2, transformedP2);
viewToImage(p3, transformedP3);
imageToView(p1, transformedP1);
imageToView(p2, transformedP2);
imageToView(p3, transformedP3);
ossimDpt deltaP1P2 = transformedP1 - transformedP2;
ossimDpt deltaP1P3 = transformedP1 - transformedP3;
......@@ -283,44 +380,77 @@ void ossimImageViewTransform::getViewToImageScale(ossimDpt& resultScale,
if (sumSquaredSqrtP1P2 > FLT_EPSILON)
{
resultScale.x = sumSquaredSqrtP1P2/deltaViewPointXY.x;
resultScale.x = sumSquaredSqrtP1P2 / deltaImagePointXY.x;
}
if (sumSquaredSqrtP1P3 > FLT_EPSILON)
{
resultScale.y = sumSquaredSqrtP1P3/deltaViewPointXY.y;
resultScale.y = sumSquaredSqrtP1P3 / deltaImagePointXY.y;
}
}
#else
void ossimImageViewTransform::getImageToViewScale(ossimDpt &result,
const ossimDpt &imageSeedPoint,
const ossimDpt &dxdy) const
{
result.makeNan();
ossimDrect ossimImageViewTransform::getImageToViewBounds(const ossimDrect& imageRect)const
ossimDpt dxdyHalf(dxdy.x / 2.0, dxdy.y / 2.0);
ossimDpt iptdx1 = imageSeedPoint - ossimDpt(dxdyHalf.x, 0.0);
ossimDpt iptdx2 = iptdx1 + ossimDpt(dxdy.x,0.0);
ossimDpt iptdy1 = imageSeedPoint - ossimDpt(dxdyHalf.y, 0.0);
ossimDpt iptdy2 = iptdx1 + ossimDpt(0.0,dxdy.y);
ossimDpt dx1;
ossimDpt dx2;
ossimDpt dy1;
ossimDpt dy2;
imageToView(iptdx1, dx1);
imageToView(iptdx2, dx2);
imageToView(iptdy1, dy1);
imageToView(iptdy2, dy2);
if (!(dx1.hasNans() || dx2.hasNans()))
{
ossimDpt p1;
ossimDpt p2;
ossimDpt p3;
ossimDpt p4;
ossimDpt delta = dx1 - dx2;
imageToView(imageRect.ul(), p1);
imageToView(imageRect.ur(), p2);
imageToView(imageRect.lr(), p3);
imageToView(imageRect.ll(), p4);
// now compute the distances.
ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
(delta.y * delta.y));
return ossimDrect(p1, p2, p3, p4);
if (sumSquared > FLT_EPSILON)
{
result.x = sumSquared / dxdy.x;
}
ossimDrect ossimImageViewTransform::getViewToImageBounds(const ossimDrect& viewRect)const
else
{
ossimDpt p1;
ossimDpt p2;
ossimDpt p3;
ossimDpt p4;
result.x = ossim::nan();
}
}
if (!(dy1.hasNans() || dy2.hasNans()))
{
ossimDpt delta = dy1 - dy2;
viewToImage(viewRect.ul(), p1);
viewToImage(viewRect.ur(), p2);
viewToImage(viewRect.lr(), p3);
viewToImage(viewRect.ll(), p4);
// now compute the distances.
ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
(delta.y * delta.y));
return ossimDrect(p1, p2, p3, p4);
if (sumSquared > FLT_EPSILON)
{
result.y = sumSquared / dxdy.y;
}
else
{
result.y = ossim::nan();
}
}
if (result.hasNans())
{
result.makeNan();
}
}
#endif
std::ostream& ossimImageViewTransform::print(std::ostream& out) const
{
return out;
......
......@@ -338,11 +338,11 @@ void ossimRsmModel::lineSampleHeightToWorld(const ossimDpt& image_point,
gpt.lon = ossim::radiansToDegrees(nlon*m_pca[pcaIndex].m_xnrmsf + m_pca[pcaIndex].m_xnrmo);
gpt.hgt = (nhgt * m_pca[pcaIndex].m_znrmsf) + m_pca[pcaIndex].m_znrmo; //ellHeight;
gpt.wrap();
//---
// Note: See above note. Added in wrap call. Longitude was coming out 242
// when should have been -118. (drb - 22 May 2015)
//---
gpt.wrap();
} // End: ossimRsmModel::lineSampleHeightToWorld( ... )
......