Skip to content
Snippets Groups Projects
Commit fbe400a3 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: clear up useless code

parent 26dea959
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,9 @@ DEMToImageGenerator<TDEMImage>
m_OutputSize[1] = 1;
m_OutputOrigin[0] = 0;
m_OutputOrigin[1] = 0;
m_DefaultUnknownValue = static_cast<PixelType>(-32768); // Value defined in the norm for points strm doesn't have information.
// Value defined in the norm for points strm doesn't have information.
m_DefaultUnknownValue = static_cast<PixelType>(-32768);
}
// DEM folder specification method
......@@ -97,7 +99,7 @@ DEMToImageGenerator<TDEMImage>
// otbMsgDevMacro(<< "PhyPoint : (" << phyPoint[0] << "," << phyPoint[1] << ")");
height=m_DEMHandler->GetHeightAboveMSL(phyPoint); // Altitude calculation
height = m_DEMHandler->GetHeightAboveMSL(phyPoint); // Altitude calculation
// otbMsgDevMacro(<< "height" << height);
// MNT sets a default value (-32768) at point where it doesn't have altitude information.
// OSSIM has chosen to change this default value in OSSIM_DBL_NAN (-4.5036e15).
......
......@@ -80,22 +80,6 @@ public :
/** Run-time type information (and related methods). */
itkTypeMacro(DEMToOrthoImageGenerator,ImageSource);
/** Set/Get the Output Origin coordinates. */
itkSetMacro(OutputOrigin,PointType);
itkGetConstReferenceMacro(OutputOrigin,PointType);
/** Set/Get the Output Size. */
itkSetMacro(OutputSize,SizeType);
itkGetConstReferenceMacro(OutputSize,SizeType);
/** Set/Get the Output Spacing. */
itkSetMacro(OutputSpacing,SpacingType);
itkGetConstReferenceMacro(OutputSpacing,SpacingType);
/** Set/Get the Default Unknown Value. */
itkSetMacro(DefaultUnknownValue,PixelType);
itkGetConstReferenceMacro(DefaultUnknownValue,PixelType);
/** Set/Get the projection*/
itkSetMacro(MapProjection, MapProjectionPointerType);
itkGetMacro(MapProjection, MapProjectionPointerType);
......@@ -105,17 +89,12 @@ protected:
virtual ~DEMToOrthoImageGenerator(){};
void PrintSelf(std::ostream& os, Indent indent) const;
virtual void GenerateOutputInformation();
// virtual void GenerateOutputInformation();
// void AllocateOutputs();
void BeforeThreadedGenerateData();
void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
int threadId);
DEMHandlerPointerType m_DEMHandler;
PointType m_OutputOrigin;
SpacingType m_OutputSpacing;
SizeType m_OutputSize;
PixelType m_DefaultUnknownValue;
MapProjectionPointerType m_MapProjection;
private:
......
......@@ -30,39 +30,9 @@ template<class TDEMImage, class TMapProjection>
DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
::DEMToOrthoImageGenerator()
{
m_DEMHandler = DEMHandlerType::New();
m_OutputSpacing[0] = 0.0001;
m_OutputSpacing[1] = -0.0001;
m_OutputSize[0] = 1;
m_OutputSize[1] = 1;
m_OutputOrigin[0] = 0;
m_OutputOrigin[1] = 0;
m_DefaultUnknownValue = static_cast<PixelType> (-32768); // Value defined in the norm for points strm doesn't have information.
m_MapProjection = NULL;
}
// GenerateOutputInformation method
template <class TDEMImage, class TMapProjection>
void DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
::GenerateOutputInformation()
{
DEMImageType *output;
output = this->GetOutput(0);
IndexType start;
start[0] = 0;
start[1] = 0;
// Specify region parameters
OutputImageRegionType largestPossibleRegion;
largestPossibleRegion.SetSize( m_OutputSize );
largestPossibleRegion.SetIndex( start );
output->SetLargestPossibleRegion( largestPossibleRegion );
output->SetSpacing(m_OutputSpacing);
output->SetOrigin(m_OutputOrigin);
}
template <class TDEMImage, class TMapProjection>
void
DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
......@@ -115,7 +85,7 @@ DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
// otbMsgDevMacro(<< "GeoPoint: (" << geoPoint[0] << "," << geoPoint[1] << ")");
height=m_DEMHandler->GetHeightAboveMSL(geoPoint); // Altitude calculation
height = this-> m_DEMHandler->GetHeightAboveMSL(geoPoint); // Altitude calculation
// otbMsgDevMacro(<< "height: " << height);
// MNT sets a default value (-32768) at point where it doesn't have altitude information.
// OSSIM has chosen to change this default value in OSSIM_DBL_NAN (-4.5036e15).
......@@ -127,7 +97,7 @@ DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
else
{
// Back to the MNT default value
DEMImage->SetPixel(currentindex, m_DefaultUnknownValue);
DEMImage->SetPixel(currentindex, this->m_DefaultUnknownValue);
}
progress.CompletedPixel();
}
......@@ -139,10 +109,7 @@ DEMToOrthoImageGenerator<TDEMImage, TMapProjection>
::PrintSelf(std::ostream& os, Indent indent) const
{
Superclass::PrintSelf(os,indent);
os << indent << "Output Spacing:"<< m_OutputSpacing[0] << ","<< m_OutputSpacing[1] << std::endl;
os << indent << "Output Origin:"<< m_OutputOrigin[0] << ","<< m_OutputOrigin[1] << std::endl;
os << indent << "Output Size:"<< m_OutputSize[0] << ","<< m_OutputSize[1] << std::endl;
os << indent << "Map projection:" << m_MapProjection-> GetWkt() << std::endl;
}
} // namespace otb
......
......@@ -44,7 +44,7 @@ namespace otb
**/
template <InverseOrForwardTransformationEnum transform,
template <InverseOrForwardTransformationEnum TTransformDirection,
class TScalarType = double,
unsigned int NInputDimensions=2,
unsigned int NOutputDimensions=2>
......@@ -54,15 +54,14 @@ class ITK_EXPORT TileMapTransform: public itk::Transform<TScalarType, // D
{
public :
/** Standard class typedefs. */
typedef TileMapTransform Self;
typedef itk::Transform< TScalarType,
NInputDimensions,
NOutputDimensions > Superclass;
typedef TileMapTransform Self;
NInputDimensions, NOutputDimensions > Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename Superclass::ScalarType ScalarType;
typedef ossimTileMapModel OssimTileMapTransformType;
typedef ossimTileMapModel OssimTileMapTransformType;
typedef itk::Point<ScalarType,NInputDimensions > InputPointType;
typedef itk::Point<ScalarType,NOutputDimensions > OutputPointType;
......@@ -74,7 +73,7 @@ public :
typedef InverseOrForwardTransformationEnum DirectionOfMappingEnumType;
itkStaticConstMacro(DirectionOfMapping,DirectionOfMappingEnumType,transform);
itkStaticConstMacro(DirectionOfMapping,DirectionOfMappingEnumType,TTransformDirection);
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
......@@ -82,40 +81,16 @@ public :
void SetLevel(unsigned char level);
// virtual void SetEllipsoid ();
// void SetEllipsoid (const ossimEllipsoid &ellipsoid);
// void SetEllipsoid(std::string code);
// void SetEllipsoid(const double &major_axis, const double &minor_axis);
OutputPointType TransformPoint(const InputPointType &point) const;
virtual InputPointType Origin();
// virtual double GetFalseNorthing() const;
// virtual double GetFalseEasting() const;
// virtual double GetStandardParallel1() const;
// virtual double GetStandardParallel2() const;
// virtual std::string GetProjectionName() const;
// virtual bool IsGeographic() const;
// virtual double GetA() const;
// virtual double GetB() const;
// virtual double GetF() const;
// virtual OutputPointType GetMetersPerPixel() const;
// virtual OutputPointType GetDecimalDegreesPerPixel() const;
// virtual void SetAB(double a, double b);
// virtual void SetOrigin(const InputPointType &origin);
// virtual void SetMetersPerPixel(const OutputPointType &point);
// virtual void SetDecimalDegreesPerPixel(const OutputPointType &point);
// virtual void ComputeDegreesPerPixel(const InputPointType &ground, const OutputPointType &metersPerPixel, double &deltaLat, double &deltaLon);
// virtual void ComputeMetersPerPixel(const InputPointType &center, double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel);
// virtual void ComputeMetersPerPixel(double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel);
// //virtual void SetMatrix(double rotation, const OutputPointType &scale, const OutputPointType &translation);
// void SetFalseEasting(double falseEasting);
virtual void PrintMap() const;
/** FIXME with a Mercator projection definition*/
virtual std::string GetWkt() const
{
return "";
return "TileMapTransform";
}
protected:
......
......@@ -24,25 +24,28 @@
namespace otb
{
template<InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
template<InverseOrForwardTransformationEnum TTransformDirection, class TScalarType,
unsigned int NInputDimensions, unsigned int NOutputDimensions>
TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>
::TileMapTransform() : Superclass(SpaceDimension,ParametersDimension)
{
m_TileMapTransform = new OssimTileMapTransformType();
}
template<InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
template<InverseOrForwardTransformationEnum TTransformDirection, class TScalarType,
unsigned int NInputDimensions, unsigned int NOutputDimensions>
TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>
::~TileMapTransform()
{
delete m_TileMapTransform;
}
template<InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType
TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
template<InverseOrForwardTransformationEnum TTransformDirection, class TScalarType,
unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType
TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>
::TransformPoint(const InputPointType & point) const
{
OutputPointType outputPoint;
......@@ -77,7 +80,8 @@ TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
ossimDpt ossimDPoint;
// ossimDPoint=m_TileMapTransform->forward(ossimGPoint);
m_TileMapTransform->worldToLineSample(ossimGPoint, ossimDPoint);
// otbGenericMsgDebugMacro(<< "Forward : ========================= " << std::endl << m_TileMapTransform->print(std::cout));
// otbGenericMsgDebugMacro(<< "Forward : ========================= \n"
// << m_TileMapTransform->print(std::cout));
outputPoint[0]=ossimDPoint.x;
outputPoint[1]=ossimDPoint.y;
......@@ -97,9 +101,10 @@ TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
///\return The geographic point corresponding to (0,0)
template<InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>::InputPointType
TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
template<InverseOrForwardTransformationEnum TTransformDirection, class TScalarType,
unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>::InputPointType
TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>
::Origin()
{
ossimGpt ossimOrigin=m_TileMapTransform->origin();
......@@ -111,16 +116,18 @@ TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
}
template<InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
template<InverseOrForwardTransformationEnum TTransformDirection, class TScalarType,
unsigned int NInputDimensions, unsigned int NOutputDimensions>
void
TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>
::PrintMap() const
{
std::cout << m_TileMapTransform->print(std::cout);
}
template<InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void TileMapTransform<Transform, TScalarType, NInputDimensions, NOutputDimensions>
template<InverseOrForwardTransformationEnum TTransformDirection, class TScalarType,
unsigned int NInputDimensions, unsigned int NOutputDimensions>
void TileMapTransform<TTransformDirection, TScalarType, NInputDimensions, NOutputDimensions>
::SetLevel(unsigned char level)
{
m_TileMapTransform->setDepth(level);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment