Commit 5670416f authored by Luc Hermitte's avatar Luc Hermitte Committed by Cédric Traizet

REFACT: Deprecate `auto_ptr`

`auto_ptr` has been deprecated in C++11 and completely removed from C++17
standard.

This was the last occurrence of this class which emits a few warnings.
parent 1f1d2123
......@@ -56,16 +56,16 @@ class OTBOSSIMAdapters_EXPORT SarSensorModelAdapter: public itk::Object
{
public:
/** Standard class typedefs. */
typedef SarSensorModelAdapter Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
using Self = SarSensorModelAdapter;
using Superclass = itk::Object;
using Pointer = itk::SmartPointer<Self>;
using ConstPointer = itk::SmartPointer<const Self>;
typedef std::auto_ptr<ossimplugins::ossimSarSensorModel> InternalModelPointer;
using InternalModelPointer = std::unique_ptr<ossimplugins::ossimSarSensorModel>;
using Point2DType = itk::Point<double,2>;
using Point3DType = itk::Point<double,3>;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......@@ -77,32 +77,32 @@ public:
/** Save keyword list from model */
bool SaveState(ImageKeywordlist & image_kwl);
/** Is sensor model valid method. return false if the m_SensorModel is null*/
bool IsValidSensorModel() const;
/** Deburst metadata if possible and return lines to keep in image file */
bool Deburst(std::vector<std::pair<unsigned long, unsigned long> > & lines,
std::pair<unsigned long,unsigned long> & samples, bool onlyValidSample=false);
std::pair<unsigned long,unsigned long> & samples, bool onlyValidSample=false);
/** Burst extraction and return lines/samples to keep into image file (the required burst) */
bool BurstExtraction(const unsigned int burst_index, std::pair<unsigned long,unsigned long> & lines,
std::pair<unsigned long,unsigned long> & samples, bool allPixels=false);
bool BurstExtraction(const unsigned int burst_index, std::pair<unsigned long,unsigned long> & lines,
std::pair<unsigned long,unsigned long> & samples, bool allPixels=false);
/** Deburst metadata if possible and prepare the burst concatenation */
/** Deburst metadata if possible and prepare the burst concatenation */
bool DeburstAndConcatenate(std::vector<std::pair<unsigned long, unsigned long> > & linesBursts,
std::vector<std::pair<unsigned long,unsigned long> > & samplesBursts,
unsigned int & linesOffset, unsigned int first_burstInd,
bool inputWithInvalidPixels=false);
/** Specify overlap area between two bursts */
bool Overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels=false);
std::vector<std::pair<unsigned long,unsigned long> > & samplesBursts,
unsigned int & linesOffset, unsigned int first_burstInd,
bool inputWithInvalidPixels=false);
/** Specify overlap area between two bursts */
bool Overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels=false);
/** Transform world point (lat,lon,hgt) to input image point
(col,row) and YZ frame */
......@@ -113,12 +113,12 @@ public:
bool WorldToLineSample(const Point3DType & inGEoPOint, Point2DType & cr) const;
/** Transform world point (lat,lon,hgt) to satellite position (x,y,z) and satellite velocity */
bool WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const;
bool WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const;
/** Transform line index to satellite position (x,y,z) and satellite velocity */
bool LineToSatPositionAndVelocity(const double line, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const;
bool LineToSatPositionAndVelocity(const double line, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const;
/** Transform world point (lat,lon,hgt) to cartesian point (x,y,z) */
static bool WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint);
......@@ -127,8 +127,8 @@ public:
static void DeburstLineToImageLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long deburstLine, unsigned long & imageLine);
protected:
SarSensorModelAdapter();
virtual ~SarSensorModelAdapter() override;
......
......@@ -58,7 +58,7 @@ bool SarSensorModelAdapter::LoadState(const ImageKeywordlist& image_kwl)
ossimKeywordlist geom;
image_kwl.convertToOSSIMKeywordlist(geom);
m_SensorModel.reset(dynamic_cast<ossimplugins::ossimSarSensorModel* >(ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom)));
return IsValidSensorModel();
......@@ -66,7 +66,7 @@ bool SarSensorModelAdapter::LoadState(const ImageKeywordlist& image_kwl)
bool SarSensorModelAdapter::SaveState(ImageKeywordlist & image_kwl)
{
if(m_SensorModel.get() != nullptr)
if(m_SensorModel)
{
ossimKeywordlist geom;
......@@ -76,36 +76,36 @@ bool SarSensorModelAdapter::SaveState(ImageKeywordlist & image_kwl)
{
image_kwl.Clear();
image_kwl.SetKeywordlist(geom);
}
return success;
}
return false;
return false;
}
bool SarSensorModelAdapter::IsValidSensorModel() const
{
return m_SensorModel.get() != nullptr;
return m_SensorModel != nullptr;
}
bool SarSensorModelAdapter::Deburst(std::vector<std::pair<unsigned long, unsigned long> > & lines,
std::pair<unsigned long,unsigned long> & samples,
bool onlyValidSample)
std::pair<unsigned long,unsigned long> & samples,
bool onlyValidSample)
{
if(m_SensorModel.get() != nullptr)
if(m_SensorModel)
{
return m_SensorModel->deburst(lines, samples, onlyValidSample);
}
return false;
}
bool SarSensorModelAdapter::BurstExtraction(const unsigned int burst_index,
std::pair<unsigned long,unsigned long> & lines,
std::pair<unsigned long,unsigned long> & samples, bool allPixels)
bool SarSensorModelAdapter::BurstExtraction(const unsigned int burst_index,
std::pair<unsigned long,unsigned long> & lines,
std::pair<unsigned long,unsigned long> & samples, bool allPixels)
{
if(m_SensorModel.get())
if(m_SensorModel)
{
return m_SensorModel->burstExtraction(burst_index, lines, samples, allPixels);
}
......@@ -113,33 +113,33 @@ bool SarSensorModelAdapter::BurstExtraction(const unsigned int burst_index,
return false;
}
bool
bool
SarSensorModelAdapter::DeburstAndConcatenate(std::vector<std::pair<unsigned long, unsigned long> > & linesBursts,
std::vector<std::pair<unsigned long,unsigned long> >& samplesBursts,
unsigned int & linesOffset, unsigned int first_burstInd,
bool inputWithInvalidPixels)
std::vector<std::pair<unsigned long,unsigned long> >& samplesBursts,
unsigned int & linesOffset, unsigned int first_burstInd,
bool inputWithInvalidPixels)
{
if(m_SensorModel.get())
if(m_SensorModel)
{
return m_SensorModel->deburstAndConcatenate(linesBursts, samplesBursts, linesOffset, first_burstInd,
inputWithInvalidPixels);
return m_SensorModel->deburstAndConcatenate(linesBursts, samplesBursts, linesOffset, first_burstInd,
inputWithInvalidPixels);
}
return false;
}
bool
SarSensorModelAdapter::Overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels)
bool
SarSensorModelAdapter::Overlap(std::pair<unsigned long,unsigned long> & linesUp,
std::pair<unsigned long,unsigned long> & linesLow,
std::pair<unsigned long,unsigned long> & samplesUp,
std::pair<unsigned long,unsigned long> & samplesLow,
unsigned int burstIndUp,
bool inputWithInvalidPixels)
{
if(m_SensorModel.get())
if(m_SensorModel)
{
return m_SensorModel->overlap(linesUp, linesLow, samplesUp, samplesLow, burstIndUp,
inputWithInvalidPixels);
inputWithInvalidPixels);
}
return false;
......@@ -157,7 +157,7 @@ void SarSensorModelAdapter::DeburstLineToImageLine(const std::vector<std::pair<u
bool SarSensorModelAdapter::WorldToLineSampleYZ(const Point3DType & inGeoPoint, Point2DType & cr, Point2DType & yz) const
{
if(m_SensorModel.get() == nullptr)
if(! m_SensorModel)
{
return false;
}
......@@ -185,7 +185,7 @@ bool SarSensorModelAdapter::WorldToLineSampleYZ(const Point3DType & inGeoPoint,
bool SarSensorModelAdapter::WorldToLineSample(const Point3DType & inGeoPoint, Point2DType & cr) const
{
if(m_SensorModel.get() == nullptr)
if(! m_SensorModel)
{
return false;
}
......@@ -216,7 +216,7 @@ bool SarSensorModelAdapter::WorldToCartesian(const Point3DType & inGeoPoint, Poi
inGpt.hgt = inGeoPoint[2];
ossimEcefPoint outCartesien(inGpt);
if(outCartesien.isNan())
return false;
......@@ -226,12 +226,12 @@ bool SarSensorModelAdapter::WorldToCartesian(const Point3DType & inGeoPoint, Poi
return true;
}
bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint,
Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const
bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint,
Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const
{
if(m_SensorModel.get() == nullptr)
if(! m_SensorModel)
{
return false;
}
......@@ -240,14 +240,14 @@ bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & in
inGpt.lon = inGeoPoint[0];
inGpt.lat = inGeoPoint[1];
inGpt.hgt = inGeoPoint[2];
ossimplugins::ossimSarSensorModel::TimeType azimuthTime;
double rangeTime;
ossimEcefPoint sensorPos;
ossimEcefVector sensorVel;
const bool success = m_SensorModel->worldToAzimuthRangeTime(inGpt, azimuthTime, rangeTime,sensorPos,sensorVel);
if(sensorPos.isNan() || !success)
return false;
......@@ -257,15 +257,15 @@ bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & in
satelliteVelocity[0] = sensorVel.x();
satelliteVelocity[1] = sensorVel.y();
satelliteVelocity[2] = sensorVel.z();
satelliteVelocity[2] = sensorVel.z();
return true;
}
bool SarSensorModelAdapter::LineToSatPositionAndVelocity(const double line, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const
bool SarSensorModelAdapter::LineToSatPositionAndVelocity(const double line, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const
{
if(!m_SensorModel.get())
if(!m_SensorModel)
{
return false;
}
......@@ -286,7 +286,7 @@ bool SarSensorModelAdapter::LineToSatPositionAndVelocity(const double line, Poin
satelliteVelocity[0] = sensorVel.x();
satelliteVelocity[1] = sensorVel.y();
satelliteVelocity[2] = sensorVel.z();
satelliteVelocity[2] = sensorVel.z();
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment