Commit 40318e7c authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

MRG

parents 1de44720 8a167de5
......@@ -575,7 +575,7 @@ ENDIF(OTB_USE_EXTERNAL_GDAL)
FIND_PACKAGE(Gettext)
IF(GETTEXT_FOUND)
SET(OTB_I18N 1)
SET(OTB_LANG "en" CACHE STRING "OTB internationalization (Experimental)")#might want to get the Locale from the system here
SET(OTB_LANG $ENV{LANG} CACHE STRING "OTB internationalization (Experimental)")#might want to get the Locale from the system here
SET(OTB_LANG_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/I18n)
SUBDIRS(I18n)
ELSE(GETTEXT_FOUND)
......
......@@ -28,7 +28,6 @@
#define _QUOTEME(x) #x
#define QUOTEME(x) _QUOTEME(x)
#if defined(OTB_I18N)
#define otbI18nMacro() \
setlocale( LC_ALL, QUOTEME(OTB_LANG) );\
......
......@@ -23,8 +23,9 @@
#include "otbGISConnectionImplementation.h"
#include "otbLabelObjectToPolygonFunctor.h"
#include "otbSimplifyPathFunctor.h"
#include "otbClosePathFunctor.h"
// #include "otbSimplifyPathFunctor.h"
// #include "otbClosePathFunctor.h"
#include "otbCorrectPolygonFunctor.h"
#include "itkLabelMap.h"
#include <iostream>
#include <sstream>
......@@ -82,6 +83,7 @@ public:
typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType,PolygonType> FunctorType;
typedef otb::SimplifyPathFunctor<PolygonType,PolygonType> SimplifyFunctorType;
typedef ClosePathFunctor <PolygonType,PolygonType> CloseFunctorType;
typedef CorrectPolygonFunctor <PolygonType> CorrectFunctorType;
/** ImageDimension constants */
//itkStaticConstMacro(InputImageDimension, unsigned int,
// TInputImage::ImageDimension);
......
......@@ -134,10 +134,12 @@ LabelMapToGISTableFilter< TLabelMap, TGISTable >
output->CreateTable(m_DropExistingGISTable);
FunctorType functor;
SimplifyFunctorType simplifyFunctor;
simplifyFunctor.SetTolerance (0.0);
// SimplifyFunctorType simplifyFunctor;
// simplifyFunctor.SetTolerance (0.0);
//
// CloseFunctorType closeFunctor;
CloseFunctorType closeFunctor;
CorrectFunctorType correctFunctor;
// Lets begin by declaring the iterator for the objects in the image.
typename InputLabelMapType::LabelObjectContainerType::const_iterator it;
// And get the object container to reuse it later
......@@ -157,14 +159,15 @@ LabelMapToGISTableFilter< TLabelMap, TGISTable >
//std::cout << "polygon : " << polygon << std::endl;
//Simply polygon (erase aligned points)
PolygonPointerType simplifyPolygon = simplifyFunctor(polygon);
// PolygonPointerType simplifyPolygon = simplifyFunctor(polygon);
//std::cout << "simplify polygon : " << simplifyPolygon << std::endl;
//Close polygon if necessary
PolygonPointerType closePolygon = closeFunctor(simplifyPolygon);
// PolygonPointerType closePolygon = closeFunctor(simplifyPolygon);
PolygonPointerType correctPolygon = correctFunctor(polygon);
//std::cout << "simplify polygon : " << closePolygon << std::endl;
this->GetOutput()->InsertPolygons( static_cast<typename TGISTable::PolygonConstPointerType> (closePolygon), static_cast<typename TGISTable::PolygonListConstPointerType> (0), oss.str());
this->GetOutput()->InsertPolygons( static_cast<typename TGISTable::PolygonConstPointerType> (correctPolygon), static_cast<typename TGISTable::PolygonListConstPointerType> (0), oss.str());
//Add polygon to the gis table
}
......
......@@ -20,8 +20,9 @@
#include "otbVectorDataSource.h"
#include "itkLabelMap.h"
#include "otbLabelObjectToPolygonFunctor.h"
#include "otbSimplifyPathFunctor.h"
#include "otbClosePathFunctor.h"
// #include "otbSimplifyPathFunctor.h"
// #include "otbClosePathFunctor.h"
#include "otbCorrectPolygonFunctor.h"
#include "otbDataNode.h"
#include <string>
......@@ -69,8 +70,9 @@ public:
typedef typename PolygonType::Pointer PolygonPointerType;
/** Some typedefs specific to functors*/
typedef otb::Functor::LabelObjectToPolygonFunctor<LabelObjectType,PolygonType> FunctorType;
typedef otb::SimplifyPathFunctor<PolygonType,PolygonType> SimplifyFunctorType;
typedef ClosePathFunctor <PolygonType,PolygonType> CloseFunctorType;
typedef otb::CorrectPolygonFunctor<PolygonType> CorrectFunctorType;
// typedef otb::SimplifyPathFunctor<PolygonType,PolygonType> SimplifyFunctorType;
// typedef ClosePathFunctor <PolygonType,PolygonType> CloseFunctorType;
/** ImageDimension constants */
/** Standard New method. */
......
......@@ -104,31 +104,27 @@ void
LabelMapToVectorDataFilter<TLabelMap, TVectorData>
::GenerateData()
{
// std::cout << "ICI" << std::endl;
/**Allocate the output*/
this->AllocateOutputs();
// this->AllocateOutputs();
// std::cout << "ICI" << std::endl;
OutputVectorDataType * output = this->GetOutput();
const InputLabelMapType * input = this->GetInput();
/**create functors */
FunctorType functor;
SimplifyFunctorType simplifyFunctor;
CloseFunctorType closeFunctor;
// SimplifyFunctorType simplifyFunctor;
// CloseFunctorType closeFunctor;
CorrectFunctorType correctFunctor;
/**Create usual root elements of the output vectordata*/
DataNodePointerType document = DataNodeType::New();
DataNodePointerType folder1 = DataNodeType::New();
document->SetNodeType(DOCUMENT);
folder1->SetNodeType(FOLDER);
DataNodePointerType root = output->GetDataTree()->GetRoot()->Get();
output->GetDataTree()->Add(document,root);
output->GetDataTree()->Add(folder1,document);
// Lets begin by declaring the iterator for the objects in the image.
typename InputLabelMapType::LabelObjectContainerType::const_iterator it;
// And get the object container to reuse it later
......@@ -145,12 +141,15 @@ void
typename PolygonType::Pointer polygon = functor(labelObject);
/** Erase aligned points*/
PolygonPointerType simplifyPolygon = simplifyFunctor(polygon);
//std::cout << "simplify polygon : " << simplifyPolygon << std::endl;
// PolygonPointerType simplifyPolygon = simplifyFunctor(polygon);
/**Close polygon if necessary*/
PolygonPointerType closePolygon = closeFunctor(simplifyPolygon);
// PolygonPointerType closePolygon = closeFunctor(simplifyPolygon);
/**correct polygon if necessary*/
PolygonPointerType correctPolygon = correctFunctor(polygon);
// std::cout << "correct polygon : " << correctPolygon << std::endl;
DataNodePointerType node = DataNodeType::New();
node->SetNodeType(otb::FEATURE_POLYGON);
......@@ -159,7 +158,7 @@ void
oss << labelObject->GetLabel();
node->SetNodeId(oss.str());
//TODO hole in the polygon are not handle yet by the functor
node->SetPolygonExteriorRing(closePolygon);
node->SetPolygonExteriorRing(correctPolygon);
/**Add the polygon to the VectorData*/
output->GetDataTree()->Add(node,folder1);
......
......@@ -311,6 +311,7 @@ PostGISTable<TConnectionImplementation, TPrecision, SpatialDimension>
if ( !m_TableName.empty() ) {
connectionSTR +="tables=";
connectionSTR += m_TableName;
// connectionSTR += "' ";
}
otbGenericMsgDebugMacro(<<"OGR connection string " << connectionSTR);
......
......@@ -126,8 +126,8 @@ VectorDataToGISTableFilter< TVectorData, TGISTable >
output->GetConnection()->ConnectToDB();
/**Name of the table is settedd automaticcaly to "vector_data_to_gis"*/
output->SetTableName ("vector_data_to_gis");
// output->SetTableName ("vector_data_to_gis");
output->SetTableName (this->GetGISTableName());
/**Create the PostgreSQL table*/
//output->CreateTable(m_DropExistingGISTable);
......
......@@ -327,7 +327,7 @@ VectorDataToLabelMapFilter< TVectorData, TLabelMap >
index[1] = vertex[1] - polygonExtRingBoundReg.GetOrigin(1);
// index[0] += this->GetOutput()->GetOrigin()[0];
// index[1] += this->GetOutput()->GetOrigin()[1];
std::cout << "index " << index << std::endl;
// std::cout << "index " << index << std::endl;
if (this->GetOutput()->HasLabel( m_lab ) )
{
if (!this->GetOutput()->GetLabelObject( m_lab )->HasIndex( index ))
......
......@@ -194,6 +194,7 @@ private:
Those method will disappear.
Use Default because don't need to know the sensor type*/
typename DefaultImageMetadataInterface::Pointer m_ImageMetadataInterface;
};
......
......@@ -100,7 +100,7 @@ public:
virtual bool CanWriteFile(const char*) const;
/** Writes the data to disk from the data structure provided */
virtual void Write(VectorDataConstPointerType data);
virtual void Write(VectorDataConstPointerType data, char ** papszOptions = NULL);
protected:
/** Construtor.*/
......
......@@ -546,7 +546,7 @@ bool KMLVectorDataIO<TData>::CanWriteFile( const char* filename ) const
}
template<class TData>
void KMLVectorDataIO<TData>::Write(const VectorDataConstPointerType data)
void KMLVectorDataIO<TData>::Write(const VectorDataConstPointerType data, char ** papszOptions)
{
itk::TimeProbe chrono;
chrono.Start();
......
......@@ -99,7 +99,7 @@ public:
virtual bool CanWriteFile(const char*) const;
/** Writes the data to disk from the memory buffer provided */
virtual void Write(VectorDataConstPointerType data);
virtual void Write(VectorDataConstPointerType data, char ** papszOptions = NULL);
protected:
/** Construtor.*/
......
......@@ -191,7 +191,7 @@ bool OGRVectorDataIO<TData>::CanWriteFile( const char* filename ) const
}
template<class TData>
void OGRVectorDataIO<TData>::Write(const VectorDataConstPointerType data)
void OGRVectorDataIO<TData>::Write(const VectorDataConstPointerType data, char ** papszOptions)
{
itk::TimeProbe chrono;
chrono.Start();
......@@ -225,7 +225,7 @@ void OGRVectorDataIO<TData>::Write(const VectorDataConstPointerType data)
// m_DataSource = OGRSFDriverRegistrar::Open(this->m_FileName.c_str(), TRUE);
m_DataSource = ogrDriver->CreateDataSource(this->m_FileName.c_str(),NULL);
m_DataSource = ogrDriver->CreateDataSource(this->m_FileName.c_str(),papszOptions);
// check the created data source
......
......@@ -150,7 +150,7 @@ public:
/** Writes the data to disk from the memory buffer provided. Make sure
* that the IORegions has been set properly. The buffer is cast to a
* pointer to the beginning of the image data. */
virtual void Write(VectorDataConstPointerType data) = 0;
virtual void Write(VectorDataConstPointerType data, char ** papszOptions = NULL) = 0;
protected:
......
......@@ -811,19 +811,20 @@ WaveletFilterBank< TInputImage, TOutputImage, TWaveletOperator, INVERSE >
lowPassOperator.SetUpSampleFactor( this->GetUpSampleFilterFactor() );
lowPassOperator.CreateDirectional();
unsigned long radius [ InputImageDimension ];
radius[0] = lowPassOperator.GetRadius()[0];
long int radius [ InputImageDimension ];
//radius[0] = lowPassOperator.GetRadius()[0];
HighPassOperatorType highPassOperator;
highPassOperator.SetDirection(0);
highPassOperator.SetUpSampleFactor( this->GetUpSampleFilterFactor() );
highPassOperator.CreateDirectional();
if ( radius[0] < highPassOperator.GetRadius()[0] )
radius[0] = highPassOperator.GetRadius()[0];
for ( unsigned int i = 1; i < InputImageDimension; i++ )
radius[i] = 0;
for ( unsigned int i = 0; i < InputImageDimension; i++ )
{
radius[i] = lowPassOperator.GetRadius()[0];
if ( radius[i] < highPassOperator.GetRadius()[0] )
radius[i] = highPassOperator.GetRadius()[0];
}
InputImageRegionType paddedRegion = destRegion;
paddedRegion.PadByRadius( radius );
......
......@@ -147,7 +147,7 @@ protected:
virtual void RasterizeVisibleLayers(void);
/** Notify a registered listener */
virtual void Notify(ListenerType * listener);
virtual void NotifyListener(ListenerType * listener);
/** Constrains the given region to the largest possible one. */
virtual RegionType ConstrainRegion(const RegionType & region, const RegionType & largest);
......
......@@ -243,7 +243,7 @@ ImageLayerRenderingModel<TOutputImage, TLayer>
template <class TOutputImage, class TLayer>
void
ImageLayerRenderingModel<TOutputImage, TLayer>
::Notify(ListenerType * listener)
::NotifyListener(ListenerType * listener)
{
// Notify the listener
otbMsgDevMacro(<<"ImageLayerRenderingModel::Notify(): Notifying listener");
......
......@@ -70,12 +70,12 @@ public:
it!=m_RegisteredListeners.end();
++it)
{
this->Notify(*it);
this->NotifyListener(*it);
}
}
/** Notify changes to a given listerner */
virtual void Notify(ListenerType * listener)
virtual void NotifyListener(ListenerType * listener)
{
listener->Notify();
};
......
......@@ -78,7 +78,7 @@ protected:
void PrintSelf(std::ostream& os, itk::Indent indent) const;
/** Notify a registered listener */
void Notify(ListenerType * listener);
void NotifyListener(ListenerType * listener);
private:
PixelDescriptionModel(const Self&); // purposely not implemented
......
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