<commit_before>/*=========================================================================

  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 __otbGenericRSTransform_h
#define __otbGenericRSTransform_h

#include <iostream>
#include <sstream>
#include <stdio.h>
#include "otbTransform.h"
#include "itkMacro.h"
#include "otbCompositeTransform.h"

namespace otb
{
namespace Projection
{
enum TransformAccuracy {UNKNOWN, ESTIMATE, PRECISE};
}
/** \class GenericRSTransform
 *  \brief This is the class to handle generic remote sensing transform
 *
 * The transformation will transform the coordinate from any map projection or sensor
 * model to any map projection or sensor model.
 *
 * If one of the projection (output or input) is a map projection, it can be
 * specified using the WKT or the EPSG code.
 *
 * \ingroup Projection
 *
 **/

template <class TScalarType = double,
    unsigned int NInputDimensions = 2,
    unsigned int NOutputDimensions = 2>
class ITK_EXPORT GenericRSTransform : public otb::Transform<TScalarType,          // Data type for scalars
      NInputDimensions,                                                       // Number of dimensions in the input space
      NOutputDimensions>                                                       // Number of dimensions in the output space
{
public:
  /** Standard class typedefs. */
  typedef otb::Transform<TScalarType,
      NInputDimensions,
      NOutputDimensions>                Superclass;
  typedef GenericRSTransform            Self;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  typedef typename Superclass::ScalarType           ScalarType;
  typedef itk::Point<ScalarType, NInputDimensions>  InputPointType;
  typedef itk::Point<ScalarType, NOutputDimensions> OutputPointType;

  typedef itk::Vector<double, 2> SpacingType;
  typedef itk::Point<double, 2>  OriginType;

  typedef itk::Transform<double, NInputDimensions, NOutputDimensions>         GenericTransformType;
  typedef typename GenericTransformType::Pointer                              GenericTransformPointerType;
  typedef otb::CompositeTransform<GenericTransformType, GenericTransformType> TransformType;
  typedef typename TransformType::Pointer                                     TransformPointerType;

  typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer;

  typedef std::pair<InputPointType,InputPointType>  InputTiePointType;
  typedef std::pair<OutputPointType,InputPointType> OutputTiePointType;
  typedef std::vector<InputTiePointType>            InputTiePointContainerType;
  typedef std::vector<OutputTiePointType>           OutputTiePointContainerType;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(GenericRSTransform, Transform);

  typedef TransformDirection::TransformationDirection DirectionOfMappingEnumType;

  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions * (NInputDimensions + 1));

  /** Set/Get for input and output projections.  */
  itkSetStringMacro(InputProjectionRef);
  itkGetStringMacro(InputProjectionRef);

  itkSetStringMacro(OutputProjectionRef);
  itkGetStringMacro(OutputProjectionRef);

  itkSetStringMacro(DEMDirectory);
  itkGetStringMacro(DEMDirectory);

  itkSetStringMacro(GeoidFile);
  itkGetStringMacro(GeoidFile);

  itkSetMacro(AverageElevation, double);
  itkGetMacro(AverageElevation, double);

  itkSetMacro(OptimizeInputTransform,bool);
  itkGetMacro(OptimizeInputTransform,bool);
  itkBooleanMacro(OptimizeInputTransform);

  itkSetMacro(OptimizeOutputTransform,bool);
  itkGetMacro(OptimizeOutputTransform,bool);
  itkBooleanMacro(OptimizeOutputTransform);

  itkSetMacro(InputTiePoints,InputTiePointContainerType);
  itkGetConstReferenceMacro(InputTiePoints,InputTiePointContainerType);

  itkSetMacro(OutputTiePoints,OutputTiePointContainerType);
  itkGetConstReferenceMacro(OutputTiePoints,OutputTiePointContainerType);


  void AddInputTiePoint(const InputPointType & inputPoint, const InputPointType & wgs84Point);
  
  void AddOutputTiePoint(const OutputPointType & outputPoint, const InputPointType & wgs84Point);
  
  void ClearInputTiePoints();

  void ClearOutputTiePoints();

  /** Set/Get Dictionary*/
  const itk::MetaDataDictionary& GetInputDictionary() const
  {
    return m_InputDictionary;
  }

  void SetInputDictionary(const itk::MetaDataDictionary& dictionary)
  {
    m_InputDictionary = dictionary;
    this->Modified();<commit_msg>COMP: Replacing setter and getter macro by plain method implementation to avoid call to << operator on stl containers<commit_after>/*=========================================================================

  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 __otbGenericRSTransform_h
#define __otbGenericRSTransform_h

#include <iostream>
#include <sstream>
#include <stdio.h>
#include "otbTransform.h"
#include "itkMacro.h"
#include "otbCompositeTransform.h"

namespace otb
{
namespace Projection
{
enum TransformAccuracy {UNKNOWN, ESTIMATE, PRECISE};
}
/** \class GenericRSTransform
 *  \brief This is the class to handle generic remote sensing transform
 *
 * The transformation will transform the coordinate from any map projection or sensor
 * model to any map projection or sensor model.
 *
 * If one of the projection (output or input) is a map projection, it can be
 * specified using the WKT or the EPSG code.
 *
 * \ingroup Projection
 *
 **/

template <class TScalarType = double,
    unsigned int NInputDimensions = 2,
    unsigned int NOutputDimensions = 2>
class ITK_EXPORT GenericRSTransform : public otb::Transform<TScalarType,          // Data type for scalars
      NInputDimensions,                                                       // Number of dimensions in the input space
      NOutputDimensions>                                                       // Number of dimensions in the output space
{
public:
  /** Standard class typedefs. */
  typedef otb::Transform<TScalarType,
      NInputDimensions,
      NOutputDimensions>                Superclass;
  typedef GenericRSTransform            Self;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;

  typedef typename Superclass::ScalarType           ScalarType;
  typedef itk::Point<ScalarType, NInputDimensions>  InputPointType;
  typedef itk::Point<ScalarType, NOutputDimensions> OutputPointType;

  typedef itk::Vector<double, 2> SpacingType;
  typedef itk::Point<double, 2>  OriginType;

  typedef itk::Transform<double, NInputDimensions, NOutputDimensions>         GenericTransformType;
  typedef typename GenericTransformType::Pointer                              GenericTransformPointerType;
  typedef otb::CompositeTransform<GenericTransformType, GenericTransformType> TransformType;
  typedef typename TransformType::Pointer                                     TransformPointerType;

  typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer;

  typedef std::pair<InputPointType,InputPointType>  InputTiePointType;
  typedef std::pair<OutputPointType,InputPointType> OutputTiePointType;
  typedef std::vector<InputTiePointType>            InputTiePointContainerType;
  typedef std::vector<OutputTiePointType>           OutputTiePointContainerType;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(GenericRSTransform, Transform);

  typedef TransformDirection::TransformationDirection DirectionOfMappingEnumType;

  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
  itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions);
  itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions * (NInputDimensions + 1));

  /** Set/Get for input and output projections.  */
  itkSetStringMacro(InputProjectionRef);
  itkGetStringMacro(InputProjectionRef);

  itkSetStringMacro(OutputProjectionRef);
  itkGetStringMacro(OutputProjectionRef);

  itkSetStringMacro(DEMDirectory);
  itkGetStringMacro(DEMDirectory);

  itkSetStringMacro(GeoidFile);
  itkGetStringMacro(GeoidFile);

  itkSetMacro(AverageElevation, double);
  itkGetMacro(AverageElevation, double);

  itkSetMacro(OptimizeInputTransform,bool);
  itkGetMacro(OptimizeInputTransform,bool);
  itkBooleanMacro(OptimizeInputTransform);

  itkSetMacro(OptimizeOutputTransform,bool);
  itkGetMacro(OptimizeOutputTransform,bool);
  itkBooleanMacro(OptimizeOutputTransform);
  
  void SetInputTiePoints(const InputTiePointContainerType & tiePoints)
  {
    m_InputTiePoints = tiePoints;
    this->Modified();
  }

  const InputTiePointContainerType& GetInputTiePoinst() const
  {
    return m_InputTiePoints;
  }

  void SetOutputTiePoints(const OutputTiePointContainerType & tiePoints)
  {
    m_OutputTiePoints = tiePoints;
    this->Modified();
  }

  const OutputTiePointContainerType& GetOutputTiePoinst() const
  {
    return m_OutputTiePoints;
  }

  void AddInputTiePoint(const InputPointType & inputPoint, const InputPointType & wgs84Point);
  
  void AddOutputTiePoint(const OutputPointType & outputPoint, const InputPointType & wgs84Point);
  
  void ClearInputTiePoints();

  void ClearOutputTiePoints();

  /** Set/Get Dictionary*/
  const itk::MetaDataDictionary& GetInputDictionary() const
  {
    return m_InputDictionary;
  }

  void SetInputDictionary(const itk::MetaDataDictionary& dictionary)
  {
    m_InputDictionary = dictionary;
    this->Modified();
{'fraction_non_alphanumeric': 0.09775270507722186, 'fraction_numerical': 0.0016646629057615833, 'mean_word_length': 4.506109979633401, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7473480', 'n_tokens_mistral': 3055, 'n_tokens_neox': 2911, 'n_words': 720}