Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Omgui Class Reference
[Library]

#include <omgui.h>

List of all members.


Detailed Description

This is a helper class with mainly static methods for easily obtaining the directories and paths relating to the application for example the users settings dir.

Definition at line 39 of file omgui.h.

Public Types

typedef QMap< QString, OmgLayerSetLayerSetMap
enum  TimeForm { longTimeForm, shortTimeForm }

Static Public Member Functions

static const QString userSettingsDirPath ()
static const QString userAlgorithmProfilesDirPath ()
static const QString fileSelectorCachePath ()
static const QString userLayersetDirPath ()
static const QString pluginDirPath ()
static const QString getModelOutputDir ()
static Omgui::LayerSetMap getAvailableLayerSets ()
static QStringList sortList (QStringList theList)
static QStringList uniqueList (QStringList theList)
static QString getLayers (QString theBaseDir)
static QStringList getExperimentsList ()
static QHash< QString, QString > getOutputFormats ()
static QHash< QString, QPair<
double, double > > 
getOutputFormatRanges ()
static QHash< QString, float > getOutputFormatNoData ()
static QHash< QString, QString > getOutputFormatNotes ()
static QString getOutputFormatExtension ()
static bool createTextFile (QString theFileName, QString theData)
static QString readTextFile (QString theFileName)
static QString xmlEncodeAmpersands (QString theString)
static QString xmlEncode (QString theString)
static void xmlEncodeInPlace (QString &theString)
static QString xmlDecode (QString theString)
static void xmlDecodeInPlace (QString &theString)
static QColor randomColour ()
static QString defaultStyleSheet ()
static QString getHtmlHeader ()
static QString getHtmlFooter ()
static bool deleteShapeFile (QString theFileBase)
static bool localitiesToShapefile (QString theShapefileName, OmgLocalities const &theLocalities)
static QString i18nPath ()
static QStringList i18nList ()
static QString version ()
static void createThumbnail (QString theTopLabel, QString theBottomLabel, QString theSourceImageFileName, QString theOutputFileName)
template<class T>
static QString secondsToString (T theSeconds, Omgui::TimeForm theForm=Omgui::shortTimeForm)

Static Private Member Functions

static void traverseDirectories (const QString theDirName, QDomDocument &theDocument, QDomElement &theParentElement)


Member Typedef Documentation

typedef QMap<QString,OmgLayerSet> Omgui::LayerSetMap
 

This typedef is used to refer to a collection of layersets. the key is the layerset name the value is the layerset itself

Definition at line 97 of file omgui.h.


Member Enumeration Documentation

enum Omgui::TimeForm
 

An enumerated type for describing formating options when printing time out.

Enumeration values:
longTimeForm 
shortTimeForm 

Definition at line 253 of file omgui.h.


Member Function Documentation

bool Omgui::createTextFile QString  theFileName,
QString  theData
[static]
 

A helper method to easily write a file to disk.

Parameters:
theFileName - the filename to be created or overwritten
theData - the data that will be written into the file
Returns:
bool - false if the file could not be written

Definition at line 539 of file omgui.cpp.

Referenced by OmgLayerSelector::buildTree(), OmgMainWindow::exportSamplesToCsv(), OmgModellerWebServicesPlugin::getAlgorithmSet(), OmgModel::postProcess(), OmguiTest::regression1711409(), OmguiTest::regression1728367(), OmgLocalitiesModelTest::rowsAndColumns(), OmgModelTest::run(), OmgExperiment::save(), OmgExperimentTest::saveAndLoadExperiment(), OmgModelTest::saveAndLoadModel(), OmgModel::toHtml(), OmgExperiment::toSummaryHtml(), and Localities2CsvTest::writeLocalities2Csv().

void Omgui::createThumbnail QString  theTopLabel,
QString  theBottomLabel,
QString  theSourceImageFileName,
QString  theOutputFileName
[static]
 

Definition at line 889 of file omgui.cpp.

Referenced by OmgModel::createThumbnail().

QString Omgui::defaultStyleSheet  )  [static]
 

A helper to get the standard style sheet for reports etc.

Returns:
QString containing the default application stylesheet.

Definition at line 669 of file omgui.cpp.

Referenced by OmgMainWindow::setReportStyleSheet(), and OmgLayerSelector::showInfo().

bool Omgui::deleteShapeFile QString  theFileBase  )  [static]
 

Delete a shapefile and its associated shx, dbf etc

Parameters:
theFileBase - the shapefile name e.g. /tmp/foo.shp
Returns:
true if file did not exist or delete completed ok otherwise false if any problem occurred.

Definition at line 725 of file omgui.cpp.

Referenced by localitiesToShapefile().

const QString Omgui::fileSelectorCachePath  )  [static]
 

Find the place in the file system where file selector tree documents are cached. These are cached on a per modeller plugin basis, and in the case of web services plugin, in subdirs based on the WS host name. File selector tree documents are cached xml documents representing the GIS raster files available for use in layersets.

Definition at line 97 of file omgui.cpp.

Referenced by OmgLayerSelector::buildTree().

Omgui::LayerSetMap Omgui::getAvailableLayerSets  )  [static]
 

Get a QMap of the avaliable layersets in the users layersets directory

Returns:
a QMap<QString,OmgLayerSet> where the QString key is the layerset name *

Definition at line 194 of file omgui.cpp.

References OmgSerialisable::fromXmlFile(), OmgLayerSet::name(), and userLayersetDirPath().

Referenced by OmgExperimentDesigner::getExperiment(), OmgExperimentDesigner::OmgExperimentDesigner(), OmgLayerSetManager::refreshLayerSetTable(), and OmgExperimentDesigner::refreshMapFormatCombo().

Here is the call graph for this function:

QStringList Omgui::getExperimentsList  )  [static]
 

Scan the users work directory looking for experiment files and return the list of files found.

Returns:
A QStringList of files found

Definition at line 426 of file omgui.cpp.

Referenced by OmguiTest::regression1728367(), and OmgExperimentSelector::updateExperimentList().

QString Omgui::getHtmlFooter  )  [static]
 

Add Standard Html footer

Returns:
QString containing the default html footer

Definition at line 717 of file omgui.cpp.

Referenced by OmgExperimentPrinter::run(), OmgModel::toHtml(), and OmgExperiment::toSummaryHtml().

QString Omgui::getHtmlHeader  )  [static]
 

Add Standard Html header

Returns:
QString containing the default html header

Definition at line 704 of file omgui.cpp.

Referenced by OmgExperimentPrinter::run(), OmgModel::toHtml(), and OmgExperiment::toSummaryHtml().

QString Omgui::getLayers QString  theBaseDir  )  [static]
 

Scan a directory looking for any valid gdal layers and return the result as an xml document complient with the openModeller WebServices interface format for AvailableLayers

Parameters:
theBaseDir directory root from which to start scanning
Returns:
a string containing an AvailableLayers xml document.

Definition at line 258 of file omgui.cpp.

References traverseDirectories().

Referenced by OmgModellerLocalPlugin::getLayers(), and OmguiTest::regression1711409().

Here is the call graph for this function:

const QString Omgui::getModelOutputDir  )  [static]
 

Get the place where model outputs are to be stored. By default this is in ~/.omgui/modelOutputs :: But if modelOutputsDir is specified in QSettings, it will override the default.

Definition at line 83 of file omgui.cpp.

References userSettingsDirPath().

Here is the call graph for this function:

QString Omgui::getOutputFormatExtension  )  [static]
 

Get the file extension for the default image format.

Returns:
A QString containing the 3 letter file extension

Definition at line 527 of file omgui.cpp.

Referenced by OmgModellerWebServicesPlugin::projectModel(), and OmgModellerLocalPlugin::projectModel().

QHash< QString, float > Omgui::getOutputFormatNoData  )  [static]
 

Return a hash containing the list of output image nodata values for formats supported by openModeller.

Returns:
QHash<QString,float> where the first string is a user friendly name (i18n enabled with tr()) and the second is the nodata value assigend to rasters in this format when created by the openModeller library.

Definition at line 514 of file omgui.cpp.

Referenced by OmgRasterThreshold::accept().

QHash< QString, QString > Omgui::getOutputFormatNotes  )  [static]
 

Return a hash containing the list of output image formats supported by openModeller.

Returns:
QHash<QString,QString> where the first string is a user friendly format and the second string is the description.

Definition at line 487 of file omgui.cpp.

Referenced by OmgOptions::on_cboOutputFormat_currentIndexChanged().

QHash< QString, QPair< double, double > > Omgui::getOutputFormatRanges  )  [static]
 

Return a hash containing the list of min/max ranges for each of the output formats supported by openModeller.

Returns:
QHash<QString,QPair <double,double> > where the first string is a user friendly name (i18n enabled with tr()) and the hash entry value is a pair containing the minimum and maximum value for that file format (as implemented in the openModeller lib.

Definition at line 501 of file omgui.cpp.

Referenced by OmgRasterThreshold::accept(), and OmgMainWindow::setCurrentModel().

QHash< QString, QString > Omgui::getOutputFormats  )  [static]
 

Return a hash containing the list of output image formats supported by openModeller.

Returns:
QHash<QString,QString> where the first string is a user friendly name (i18n enabled with tr()) and the second string is the format name expected by the openModeller library.

Definition at line 474 of file omgui.cpp.

Referenced by OmgOptions::OmgOptions().

QStringList Omgui::i18nList  )  [static]
 

Get a string list of the suportted locales (translations) for this application

Definition at line 633 of file omgui.cpp.

References i18nPath().

Referenced by OmgOptions::OmgOptions().

Here is the call graph for this function:

QString Omgui::i18nPath  )  [static]
 

Get the directory containing the qt .qm translation files.

Returns:
QString - the absolute path to the i18n dir.

Definition at line 604 of file omgui.cpp.

Referenced by i18nList(), and main().

bool Omgui::localitiesToShapefile QString  theShapefileName,
OmgLocalities const &  theLocalities
[static]
 

Convert a localities vector OmgLocalities into a shapefile.

Parameters:
theShapefileName - name of the shapefile to save to - it will be deleted if it exists and we have perms to delete.
theLocalities - pass by reference an OmgLocalities object.
Returns:
true on success.

Definition at line 767 of file omgui.cpp.

References OmgLocality::abundance(), deleteShapeFile(), OmgLocality::id(), OmgLocality::latitude(), OmgLocality::longitude(), and OmgLocality::samples().

Referenced by OmgScraperPluginInterface::createShapefile(), and OmgModel::toShapefile().

Here is the call graph for this function:

const QString Omgui::pluginDirPath  )  [static]
 

Get the path to where the plugins live. Usually this is not needed as the getModellerPlugin, getScraperPlugin etc factory methods below do all this for you.

Definition at line 143 of file omgui.cpp.

Referenced by OmgModellerPluginRegistry::OmgModellerPluginRegistry(), OmgScraperPluginRegistry::OmgScraperPluginRegistry(), and OmgModelTest::run().

QColor Omgui::randomColour  )  [static]
 

A helper method to get a random color

Returns:
a QColor

Definition at line 650 of file omgui.cpp.

Referenced by OmgDataSeries::OmgDataSeries(), and OmgGraph::randomGradient().

QString Omgui::readTextFile QString  theFileName  )  [static]
 

A helper method to easily read a file from disk.

Parameters:
theFileName - the filename to be read
Returns:
QString - the file contents - empty if a problem occurred

Definition at line 556 of file omgui.cpp.

Referenced by OmgMainWindow::printExperimentReport().

template<class T>
static QString Omgui::secondsToString theSeconds,
Omgui::TimeForm  theForm = Omgui::shortTimeForm
[inline, static]
 

A helper method to rewrite seconds as a string in the form 2 hours 20 minutes 12 seconds. If a given unit (e.g. mins) is zero that part wil be left out e.g. 2 hours 12 seconds

Note:
this is a template function in order to support both int and long being passed to it.

For template functions the implemementation and declaration must be in the same file to successfully compile and link.

See also:
http://www.cplusplus.com/doc/tutorial/templates.html for mode info (near the bottom of the page)
Parameters:
theSeconds - the seconds you want to convert to string
theForm - a TimeForm enum indicating if we should print in short form of 2h 20m 12s or in the long form of 2 hours 20 minutes 12 seconds Defaults to short form
Returns:
QString - a string representation of the seconds

Definition at line 286 of file omgui.h.

References shortTimeForm.

Referenced by OmgExperiment::getStatsHtml().

QStringList Omgui::sortList QStringList  theList  )  [static]
 

Sort a string list into descending alphabetic order and return the result.

Parameters:
theList - the QStringList to be sorted
Returns:
QStringList - sorted in descending alphabetical order

Definition at line 224 of file omgui.cpp.

Referenced by OmgLayerSetManager::on_toolAddLayers_clicked(), OmgExperimentDesigner::on_toolFormatLayer_clicked(), OmgExperimentDesigner::refreshMapFormatCombo(), and OmgExperimentDesigner::setSpeciesList().

void Omgui::traverseDirectories const QString  theDirName,
QDomDocument &  theDocument,
QDomElement &  theParentElement
[static, private]
 

A helper function used my getLayers to scan a directory looking for valid gdal filea.

Note:
This is a recursive function!
Parameters:
theDirName root directory to scan in
theDocument document to which layers will be added
theParentElement parent node to which found layers should be added

Definition at line 283 of file omgui.cpp.

References OmgGdal::isValidGdalFile(), and OmgGdal::isValidGdalProj().

Referenced by getLayers().

Here is the call graph for this function:

QStringList Omgui::uniqueList QStringList  theList  )  [static]
 

Remove any duplucate entries from a sorted list

Parameters:
theList - the QStringList to be sorted
Returns:
QStringList - a list with no sequential duplicates

Definition at line 239 of file omgui.cpp.

Referenced by OmgExperimentDesigner::refreshMapFormatCombo().

const QString Omgui::userAlgorithmProfilesDirPath  )  [static]
 

Find the place on the filesystem where user defined algorithm profiles are stored.

Typically this will be ~/.omgui/algorithmProfiles

Returns:
QString containing the relevant directory name

Definition at line 89 of file omgui.cpp.

Referenced by OmgMainWindow::OmgMainWindow().

const QString Omgui::userLayersetDirPath  )  [static]
 

Find the place on the filesystem where user defined layersets are stored.

Typically this will be ~/.omgui/layersets

Returns:
QString containing the relevant directory name

Definition at line 119 of file omgui.cpp.

Referenced by getAvailableLayerSets(), OmgLayerSetManager::on_toolCopy_clicked(), OmgLayerSet::save(), and OmgLayerSetManager::selectLayerSet().

const QString Omgui::userSettingsDirPath  )  [static]
 

Find the place on the filesystem where user data are stored.

Typically this will be ~/.omgui

Returns:
QString containing the relevant directory name

Definition at line 73 of file omgui.cpp.

Referenced by getModelOutputDir().

QString Omgui::version  )  [static]
 

Get the version string for this application. e.g. openModeller Desktop 1.0.7 (r2312)

Returns:
a QString containing internationaliased version string.

Definition at line 867 of file omgui.cpp.

Referenced by OmgAbout::OmgAbout().

QString Omgui::xmlDecode QString  theString  )  [static]
 

A helper method to xml deencode any special chars in a string (< > & etc) will become (< > & etc)

Parameters:
QString - the string to be properly decoded
Returns:
A QString with the encoded chars properly decoded

Definition at line 589 of file omgui.cpp.

Referenced by OmgLayerSet::fromXml(), OmgExperiment::fromXml(), OmgAlgorithm::fromXml(), and OmgExperimentSelector::updateExperimentList().

void Omgui::xmlDecodeInPlace QString &  theString  )  [static]
 

A helper method to xml deencode any special chars in a string (< > & etc) will become (< > & etc)

Parameters:
QString - the string to be properly decoded - passed by reference

Definition at line 597 of file omgui.cpp.

QString Omgui::xmlEncode QString  theString  )  [static]
 

A helper method to xml encode any special chars in a string (< > & etc) will become (< > & etc)

Parameters:
QString - the string to be properly encoded
Returns:
A QString with the special chars properly encoded

Definition at line 574 of file omgui.cpp.

Referenced by OmgExperiment::getStatsHtml(), and OmgScraperGbif::localitiesRequestDone().

QString Omgui::xmlEncodeAmpersands QString  theString  )  [static]
 

A helper method to xml encode any ampersands in a string & will become &

Parameters:
QString - the string to be properly encoded
Returns:
A QString with the special chars properly encoded

Definition at line 568 of file omgui.cpp.

Referenced by OmgModellerWebServicesPlugin::getAlgorithmSet().

void Omgui::xmlEncodeInPlace QString &  theString  )  [static]
 

A helper method to xml encode any special chars in a string. (< > & etc) will become (< > & etc)

Parameters:
QString - the string to be properly encoded - passed by reference

Definition at line 582 of file omgui.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Apr 28 15:14:10 2008 for openModellerDesktop by  doxygen 1.4.1-20050210