Skip to content
Snippets Groups Projects
Commit a7487d3e authored by Stéphane Albert's avatar Stéphane Albert
Browse files

ENH: Added generic SRT global functions.

parent 411191f1
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdTypes.h"
namespace mvd
{
......@@ -62,35 +64,32 @@ char const * const STR_UNKNOWN = QT_TRANSLATE_NOOP( "mvd::AbstractLayerModel", "
/*****************************************************************************/
/* STATIC IMPLEMENTATION SECTION */
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*******************************************************************************/
AbstractLayerModel
::AbstractLayerModel( QObject* parent ) :
AbstractModel( parent ),
VisibleInterface()
SpatialReferenceType
GetSpatialReferenceType( const std::string & filename )
{
}
DefaultImageFileReaderType::Pointer reader( DefaultImageFileReaderType::New() );
assert( !reader.IsNull() );
/*******************************************************************************/
AbstractLayerModel
::~AbstractLayerModel()
{
reader->SetFileName( filename );
reader->UpdateOutputInformation();
DefaultImageType * image = reader->GetOutput();
assert( image!=NULL );
return GetSpatialReferenceType(
image->GetProjectionRef(),
image->GetImageKeywordlist().GetSize()>0
);
}
/*******************************************************************************/
AbstractLayerModel::SpatialReferenceType
AbstractLayerModel
::GetSpatialReferenceType() const
/*****************************************************************************/
SpatialReferenceType
GetSpatialReferenceType( const std::string & wkt, bool hasKwl )
{
std::string wkt( GetWkt() );
if( wkt.empty() )
return
HasKwl()
hasKwl
? SRT_SENSOR
: SRT_UNKNOWN;
......@@ -109,6 +108,31 @@ AbstractLayerModel
return SRT_UNKNOWN;
}
/*****************************************************************************/
/* CLASS IMPLEMENTATION SECTION */
/*******************************************************************************/
AbstractLayerModel
::AbstractLayerModel( QObject* parent ) :
AbstractModel( parent ),
VisibleInterface()
{
}
/*******************************************************************************/
AbstractLayerModel
::~AbstractLayerModel()
{
}
/*******************************************************************************/
SpatialReferenceType
AbstractLayerModel
::GetSpatialReferenceType() const
{
return mvd::GetSpatialReferenceType( GetWkt(), HasKwl() );
}
/*******************************************************************************/
std::string
AbstractLayerModel
......
......@@ -66,6 +66,30 @@ namespace mvd
// Internal classes pre-declaration.
//
// Global types.
/**
*/
enum SpatialReferenceType
{
SRT_UNKNOWN =0,
SRT_CARTO,
SRT_GEO,
SRT_SENSOR,
};
//
// Global functions.
/**
*/
SpatialReferenceType GetSpatialReferenceType( const std::string & filename );
/**
*/
SpatialReferenceType GetSpatialReferenceType( const std::string & wkt, bool hasKwl );
/*****************************************************************************/
/* CLASS DEFINITION SECTION */
......@@ -89,14 +113,6 @@ class Monteverdi2_EXPORT AbstractLayerModel :
// Public methods.
public:
enum SpatialReferenceType
{
SRT_UNKNOWN,
SRT_SENSOR,
SRT_CARTO,
SRT_GEO,
};
/** \brief Destructor. */
virtual ~AbstractLayerModel();
......
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