Public Member Functions | Static Public Member Functions | List of all members
openfluid::utils::GrassGISProxy Class Reference

#include <utils/GrassGISProxy.hpp>

Inheritance diagram for openfluid::utils::GrassGISProxy:
Inheritance graph
[legend]
Collaboration diagram for openfluid::utils::GrassGISProxy:
Collaboration graph
[legend]

Public Member Functions

 GrassGISProxy (const QString &GISBase, const QString &Location, const QString &Mapset="PERMANENT")
 
virtual ~GrassGISProxy ()
 
void setLocation (const QString &Location)
 
void setMapset (const QString &Mapset)
 
void clearTasks ()
 
void appendTask (const QString &Command, const std::map< QString, QString > Arguments={}, const std::vector< QString > Options={})
 
int runJob ()
 
int runSingleTask (const QString &Command, const std::map< QString, QString > Arguments={}, const std::vector< QString > Options={}) const
 
void setOutputFile (const QString &FullPath)
 
void setErrorFile (const QString &FullPath)
 
const QStringList & jobLines () const
 
bool isLocationExist () const
 
bool createLocation (const QString &EPSG) const
 
std::map< std::string, double > region () const
 
std::map< std::string, std::string > gisenv () const
 
std::vector< std::string > mapsets () const
 

Static Public Member Functions

static bool isAvailable ()
 
- Static Public Member Functions inherited from openfluid::utils::ProgramProxy< GrassGISProxy >
static bool isAvailable ()
 
static QString getVersion ()
 
static QString getExecutablePath ()
 

Additional Inherited Members

- Static Protected Attributes inherited from openfluid::utils::ProgramProxy< GrassGISProxy >
static QString m_ExecutablePath
 
static QString m_Version
 

Constructor & Destructor Documentation

openfluid::utils::GrassGISProxy::GrassGISProxy ( const QString &  GISBase,
const QString &  Location,
const QString &  Mapset = "PERMANENT" 
)
virtual openfluid::utils::GrassGISProxy::~GrassGISProxy ( )
virtual

Member Function Documentation

void openfluid::utils::GrassGISProxy::appendTask ( const QString &  Command,
const std::map< QString, QString >  Arguments = {},
const std::vector< QString >  Options = {} 
)

Appends a task to the current GRASS job.

Parameters
[in]Commandthe GRASS command to execute
[in]Argumentsa key-value map of arguments to pass to the GRASS command
[in]Optionsoptions to pass to the GRASS command
void openfluid::utils::GrassGISProxy::clearTasks ( )
inline

Clears all appended tasks.

bool openfluid::utils::GrassGISProxy::createLocation ( const QString &  EPSG) const

Creates the location defined for the current GRASS session, with the given EPSG code

Parameters
[in]EPSGthe EPSG code for the location
Returns
true if the location has been created, false if it could not be created or if it already exists
std::map<std::string,std::string> openfluid::utils::GrassGISProxy::gisenv ( ) const

Returns the environment informations as a key-value map, given by the results of the "g.gisenv -n --q" GRASS command

Returns
a key-value map about containing environment informations
static bool openfluid::utils::GrassGISProxy::isAvailable ( )
static
bool openfluid::utils::GrassGISProxy::isLocationExist ( ) const

Returns true if the location already exists

Returns
true if the location already exists, false otherwise
const QStringList& openfluid::utils::GrassGISProxy::jobLines ( ) const
inline

Returns the current command lines of the job

Returns
a list of command lines
std::vector<std::string> openfluid::utils::GrassGISProxy::mapsets ( ) const

Returns the list of mapsets in the current location, given by the results of the "g.mapsets separator='\n' -l" GRASS command

Returns
a vector of strings containing the mapsets list
std::map<std::string,double> openfluid::utils::GrassGISProxy::region ( ) const

Returns the region informations as a key-value map, given by the results of the "g.region -gucep" GRASS command

Returns
a key-value map about containing region informations
int openfluid::utils::GrassGISProxy::runJob ( )

Runs a GRASS job made of appended tasks. Once finished, the task queue is cleared.

Returns
the exit code of the execution
int openfluid::utils::GrassGISProxy::runSingleTask ( const QString &  Command,
const std::map< QString, QString >  Arguments = {},
const std::vector< QString >  Options = {} 
) const

Runs a single GRASS task.

Parameters
[in]Commandthe GRASS command to execute
[in]Argumentsa key-value map of arguments to pass to the GRASS command
[in]Optionsoptions to pass to the GRASS command
Returns
the exit code of the execution
void openfluid::utils::GrassGISProxy::setErrorFile ( const QString &  FullPath)
inline

Sets the file path where the standard error stream will be redirected. If not set or empty, the stream is redirected to a temporary file.

Parameters
[in]FullPaththe full path for the error file
void openfluid::utils::GrassGISProxy::setLocation ( const QString &  Location)
inline

Sets the current location to use for next GRASS execution

Parameters
[in]Locationthe location directory
void openfluid::utils::GrassGISProxy::setMapset ( const QString &  Mapset)
inline

Sets the current mapset to use for next GRASS execution

Parameters
[in]Mapsetthe mapset directory
void openfluid::utils::GrassGISProxy::setOutputFile ( const QString &  FullPath)
inline

Sets the file path where the standard output stream will be redirected. If not set or empty, the stream is redirected to a temporary file.

Parameters
[in]FullPaththe full path for the output file

The documentation for this class was generated from the following file: