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

ENH: add otb adapter class for platform position

parent 6e458311
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbPlatformPositionAdapter.h"
#include "otbMacro.h"
#include "otbImageKeywordlist.h"
#include "ossimGeometricSarSensorModel.h"
#include "projection/ossimProjection.h"
#include "ossim/ossimPluginProjectionFactory.h"
namespace otb {
PlatformPositionAdapter::PlatformPositionAdapter():
m_SensorModel(NULL)
{
}
PlatformPositionAdapter::~PlatformPositionAdapter()
{
if (m_SensorModel != NULL)
{
delete m_SensorModel;
m_SensorModel = NULL;
}
}
void PlatformPositionAdapter::CreateSensorModel(const ImageKeywordlist& image_kwl)
{
ossimKeywordlist geom;
image_kwl.convertToOSSIMKeywordlist(geom);
otbMsgDevMacro(<< "CreateSensorModel()");
otbMsgDevMacro(<< "* type: " << geom.find("type"));
ossimProjection* sensor = ossimplugins::ossimPluginProjectionFactory::instance()->createProjection(geom);
m_SensorModel = dynamic_cast<ossimplugins::ossimGeometricSarSensorModel*>(sensor);
if (!m_SensorModel)
{
otbMsgDevMacro(<< "CreateSensorModel() failed");
}
}
void PlatformPositionAdapter::GetPlatformPosition(
double line, std::vector<double>& position, std::vector<double>& speed)
{
m_SensorModel->getPlatformPositionAtLine(line, position, speed);
}
} // namespace otb
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbPlatformPositionAdapter_h
#define __otbPlatformPositionAdapter_h
#include <vector>
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace ossimplugins
{
class ossimGeometricSarSensorModel;
}
namespace otb
{
class ImageKeywordlist;
/**
* \class PlatformPositionAdapter
* \brief Wrapper class to access the platform position from ossim
*
* This class is intended to be used in an InSAR setting to get
* information relative to the baseline. If necessary, it could be
* extended to non SAR models, but the optical ossim classes would
* need to be modified.
**/
class PlatformPositionAdapter: public itk::Object
{
public:
/** Standard class typedefs. */
typedef PlatformPositionAdapter Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(PlatformPositionAdapter, itk::Object);
void CreateSensorModel(const ImageKeywordlist& image_kwl);
void GetPlatformPosition(
double line, std::vector<double>& position, std::vector<double>& speed);
protected:
PlatformPositionAdapter();
virtual ~PlatformPositionAdapter();
private:
PlatformPositionAdapter(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
ossimplugins::ossimGeometricSarSensorModel* m_SensorModel;
};
} // namespace otb
#endif
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