TerraLib 4.1
TeLayer Class Reference

A class for supporting a layer. More...

#include <TeLayer.h>

List of all members.

Public Member Functions

 TeLayer ()
 Empty constructor.
 TeLayer (const string &name, TeDatabase *db=0, TeProjection *proj=0)
 Constructor with parameters.
 TeLayer (const string &name, TeDatabase *db, TeBox &box, TeProjection *proj=0)
 Constructor with parameters.
virtual ~TeLayer ()
 Destructor.
 TeLayer (const TeLayer &other)
 Copy Constructor.
TeLayeroperator= (const TeLayer &other)
 Operator =.
virtual TeDatabase *const database ()
 Retrieves the database associated to this layer.
virtual void setDatabase (TeDatabase *db)
 Sets the layer database.
virtual int id ()
 Returns the layer id.
virtual void id (int id)
 Sets the layer id.
virtual string name ()
 Returns the layer name.
virtual void name (const string &name)
 Sets the layer name.
virtual void setProjection (TeProjection *proj)
 Sets the layer projection.
virtual TeProjectionprojection ()
 Retrieves the layer projection.
virtual TeBoxbox ()
 Returns the layer bounding box.
virtual void setLayerBox (const TeBox &box)
 Sets the bounding box of a layer.
virtual void updateLayerBox (const TeBox &box)
 Updates the bounding box of a layer.
virtual void updateLayerBox ()
 Refreshes the bounding box of a layer according to its representation.
virtual int getNewObjectId ()
 Returns a possible new object id based on the objects stored in database.
Attribute Tables

Methods to deal with the attribute tables of the layer

virtual int nObjects (const string &tName)
 Returns the number of distinct objects in the layer.
virtual TeAttrTableVectorattrTables ()
 Returns a vector with the definition of all attribute tables associated to layer.
virtual const TeAttrTableVectorattrTables () const
 Returns a vector with the definition of all attribute tables associated to layer.
virtual bool createAttributeTable (TeTable &table)
 Creates a new attribute table for the layer.
virtual bool addAttributeTable (TeTable &table)
 Adds an attribute table definition to layer vector of attribute tables (in memory)
virtual bool removeAttributeTable (string tableName)
 Remove an attribute table definition to layer vector of attribute tables (in memory)
virtual void updateAttributeTable (TeTable &table)
 Update an attribute table definition to layer vector of attribute tables (in memory)
virtual bool loadLayerTables ()
 Reload the tables definition from database to memory.
virtual bool saveAttributeTable (TeTable &table)
 Saves an attribute table into the database where layer is stored.
virtual bool getAttrTables (TeAttrTableVector &atts, TeAttrTableType attType=TeAllAttrTypes)
 Gets all attribute tables associated to this layer that are of a certain type.
virtual bool getAttrTablesByName (vector< string > &tableNames, TeAttrTableVector &atts, TeAttrTableType attType=TeAllAttrTypes)
 Gets a set of attribute table specifications associated to this layer that are of a certain type.
virtual bool getAttrTablesByName (const string &tableName, TeTable &table, TeAttrTableType attType=TeAllAttrTypes)
 Gets an attribute table associated to a layer.
virtual string mediaTable ()
 Gets the name of the media table associated to layer.
virtual void mediaTable (const string &name)
 Sets the name of the media table associated to layer.
Geometries

Methods to deal with geometrical representations of a layer

virtual TeRasterraster (const string &objectId="", const char &mode= 'r')
 Returns a pointer to the raster geometry associated to an object of this layer.
virtual void raster (TeRaster *raster)
 Sets the pointer to the raster representation.
virtual bool getPolygons (TePolygonSet &ps, const string &whereClause="")
 Retrieves a polygon set given a selection criteria, expressed as a where clause.
virtual bool getLines (TeLineSet &ls, const string &whereClause="")
 Retrieves a line set given a selection criteria, expressed as a where clause.
virtual bool getPoints (TePointSet &ps, const string &whereClause="")
 Retrieves a point set given a selection criteria, expressed as a where clause.
virtual bool getText (TeTextSet &ts, const string &whereClause="")
 Retrieve a point set given a selection criteria, expressed as a where clause.
virtual bool getCells (TeCellSet &cs, const string &whereClause="")
 Retrieve a cell set given a selection criteria, expressed as a where clause.
virtual bool locatePolygon (TeCoord2D &pt, TePolygon &polygon, const double &tol=0.0)
 Locates a polygon that cointains a certain coordinate.
virtual bool locateLine (TeCoord2D &pt, TeLine2D &line, const double &tol=0.0)
 Locates a line that cointains a certain coordinate.
virtual bool locatePoint (TeCoord2D &pt, TePoint &point, const double &tol=0.0)
 Retrieves a point that cointains a certain coordinate.
virtual bool locateText (TeCoord2D &pt, TeText &text, const double &tol=0.0)
 Retrieves a TeText that cointains a certain coordinate.
virtual bool locateCell (TeCoord2D &pt, TeCell &cell, const double &tol=0.0)
 Retrieves a point that cointains a certain coordinate.
virtual bool loadGeometrySet (const string &geoid, TePolygonSet &ps)
 Retrieves the set of polygons with a certain geoid.
virtual bool loadGeometrySet (const string &geoid, TeLineSet &ls)
 Retrieves the set of lines with a certain geoid.
virtual bool loadGeometrySet (const string &geoid, TePointSet &ps)
 Retrieves the set of points with a certain geoid.
virtual bool loadGeometrySet (const string &geoid, TeCellSet &cs)
 Retrieves the set of points with a certain geoid.
virtual bool loadGeometrySet (const string &geoid, TeTextSet &cs)
 Retrieves the set of texts with a certain geoid.
virtual bool addGeometrySet (TePolygonSet &polySet, const string &="")
 Adds a set of polygons to a layer.
virtual bool addGeometrySet (TeLineSet &lineSet, const string &="")
 Adds a set of lines to a layer.
virtual bool addGeometrySet (TePointSet &pointSet, const string &="")
 Adds a set of points to a layer.
virtual bool addGeometrySet (TeTextSet &textSet, const string &tName="")
 Adds a set of text to a layer.
virtual bool addGeometrySet (TeCellSet &cellSet, const string &="")
 Adds a set of cells to a layer.
virtual bool addPolygons (TePolygonSet &polySet)
 Adds a set of polygons to a layer.
virtual bool addLines (TeLineSet &lineSet)
 Adds a set of lines to a layer.
virtual bool addPoints (TePointSet &pointSet)
 Adds a set of points to a layer.
virtual bool addText (TeTextSet &textSet, const string &tName)
 Adds a set of text to a layer.
virtual bool addCells (TeCellSet &cellSet)
 Adds a set of cells to a layer.
virtual bool updatePolygons (TePolygonSet &polySet)
 Updates a set of polygons to a layer.
virtual bool updateLines (TeLineSet &lineSet)
 Updates a set of lines to a layer.
virtual bool updatePoints (TePointSet &pointSet)
 Updates a set of points to a layer.
virtual bool updateText (TeTextSet &textSet, const string &tName)
 Updates a set of text to a layer.
virtual bool updateCells (TeCellSet &cellSet)
 Updates a set of cells to a layer.
virtual bool removeGeometries (const std::vector< int > &vecGeomIds, const TeGeomRep &rep)
 Removes the geometries from the layer.
virtual bool removeGeometry (TeGeomRep repType, const string &tName="")
 Removes a geometry from layer.
virtual bool hasGeometry (TeGeomRep rep)
 Indicates if layer has a geometry representation.
virtual string tableName (TeGeomRep rep)
 Retrieves the table name associated to a geometry representation.
virtual int nGeometries (TeGeomRep rep)
 Retrieves the number of geometries of a type.
virtual bool getRepresentation (TeGeomRep repType, TeRepresPointerVector &result)
 Gets all information about a representation.
virtual TeRepresentationgetRepresentation (TeGeomRep repType, const string &tableName="")
 Gets an specific representation.
virtual bool addGeometry (TeGeomRep repType, const string &tableName="", const string &desc="")
 Creates a new geometry representation to a layer.
virtual bool addRasterGeometry (TeRasterParams &par, const string &objectId, const string &tableName="", const string &desc="")
 Creates a new raster geometry to a layer.
bool addRasterGeometry (TeRaster *raster, const string &objectId="")
 Inserts a raster as a geometry of an object of the layer.
bool addRasterFileGeometry (TeRaster *raster, const string &objectId="", const string &desc="")
 Inserts a reference to a raster file as a raster geometry of an object of the layer.
virtual bool getRasterGeometries (vector< string > &objectIds, unsigned int tilingType=0, const TeBox &box=TeBox())
 Returns a vector with the identification of all objects of the layer that has a raster representation.
virtual int geomRep ()
 Returns a combination of all representations in the layer.
virtual void addVectRepres (TeRepresentation *rep)
 Adds a representation to vector of representation of the layer.
virtual TeRepresPointerVectorvectRepres ()
 Returns a vector with all representations in the layer.
virtual const
TeRepresPointerVector
vectRepres () const
 Returns the dateTime that the layer was last edited.
virtual TeTime getEditionTime () const
 Sets in memory the edition time of the layer.
virtual void setEditionTime (const TeTime &editionTime)
 Updates the layer last edition time in memory and in the database.
virtual bool updateLayerEditionTime (const bool &setEditionToNow=true)
 Reloads the edition time from the database.
virtual bool reloadLayerEditionTime ()

Detailed Description

A class for supporting a layer.

In TerraLib, a layer is a collection of geometries that share the same geographical projection, and are related in some way (e.g. a shapefile). A layer has a pointer to a database that effectively stores its atributes and geometries.

See also:
TeGeometry, TeProjection, TeBox, TeDatabase, TeTheme, TeTable
Examples:

addGeomRepresentation.cpp, copyLayer.cpp, createLayer.cpp, createProximityMatrix.cpp, createSTElementSetFromLayer.cpp, createSTElementSetFromTheme.cpp, createTheme.cpp, databaseQuery.cpp, databaseSQLQuery.cpp, importGeoTab.cpp, importGridData.cpp, importJPEG.cpp, importMIDMIF.cpp, importShape.cpp, proxMatrixAndSpatialStatistics.cpp, querierFromLayer.cpp, rasterSlicing.cpp, spatialQuery.cpp, and spatialQueryAndBuffer.cpp.


Constructor & Destructor Documentation

TeLayer::TeLayer ( ) [inline]

Empty constructor.

TeLayer::TeLayer ( const string name,
TeDatabase db = 0,
TeProjection proj = 0 
)

Constructor with parameters.

TeLayer::TeLayer ( const string name,
TeDatabase db,
TeBox box,
TeProjection proj = 0 
)

Constructor with parameters.

TeLayer::~TeLayer ( ) [virtual]

Destructor.

TeLayer::TeLayer ( const TeLayer other)

Copy Constructor.


Member Function Documentation

bool TeLayer::addAttributeTable ( TeTable table) [virtual]

Adds an attribute table definition to layer vector of attribute tables (in memory)

bool TeLayer::addCells ( TeCellSet cellSet) [virtual]

Adds a set of cells to a layer.

bool TeLayer::addGeometry ( TeGeomRep  repType,
const string tableName = "",
const string desc = "" 
) [virtual]

Creates a new geometry representation to a layer.

Examples:
createLayer.cpp.
virtual bool TeLayer::addGeometrySet ( TePolygonSet polySet,
const string = "" 
) [inline, virtual]

Adds a set of polygons to a layer.

virtual bool TeLayer::addGeometrySet ( TeLineSet lineSet,
const string = "" 
) [inline, virtual]

Adds a set of lines to a layer.

virtual bool TeLayer::addGeometrySet ( TePointSet pointSet,
const string = "" 
) [inline, virtual]

Adds a set of points to a layer.

virtual bool TeLayer::addGeometrySet ( TeCellSet cellSet,
const string = "" 
) [inline, virtual]

Adds a set of cells to a layer.

virtual bool TeLayer::addGeometrySet ( TeTextSet textSet,
const string tName = "" 
) [inline, virtual]

Adds a set of text to a layer.

bool TeLayer::addLines ( TeLineSet lineSet) [virtual]

Adds a set of lines to a layer.

Examples:
createLayer.cpp.
bool TeLayer::addPoints ( TePointSet pointSet) [virtual]

Adds a set of points to a layer.

Examples:
addGeomRepresentation.cpp, and createLayer.cpp.
bool TeLayer::addPolygons ( TePolygonSet polySet) [virtual]

Adds a set of polygons to a layer.

Examples:
createLayer.cpp.
bool TeLayer::addRasterFileGeometry ( TeRaster raster,
const string objectId = "",
const string desc = "" 
)

Inserts a reference to a raster file as a raster geometry of an object of the layer.

bool TeLayer::addRasterGeometry ( TeRasterParams par,
const string objectId,
const string tableName = "",
const string desc = "" 
) [virtual]

Creates a new raster geometry to a layer.

bool TeLayer::addRasterGeometry ( TeRaster raster,
const string objectId = "" 
)

Inserts a raster as a geometry of an object of the layer.

bool TeLayer::addText ( TeTextSet textSet,
const string tName 
) [virtual]

Adds a set of text to a layer.

virtual void TeLayer::addVectRepres ( TeRepresentation rep) [inline, virtual]

Adds a representation to vector of representation of the layer.

virtual const TeAttrTableVector& TeLayer::attrTables ( ) const [inline, virtual]

Returns a vector with the definition of all attribute tables associated to layer.

virtual TeAttrTableVector& TeLayer::attrTables ( ) [inline, virtual]

Returns a vector with the definition of all attribute tables associated to layer.

Examples:
createTheme.cpp.
virtual TeBox& TeLayer::box ( ) [inline, virtual]

Returns the layer bounding box.

Examples:
importGeoTab.cpp, importMIDMIF.cpp, and importShape.cpp.
bool TeLayer::createAttributeTable ( TeTable table) [virtual]

Creates a new attribute table for the layer.

Examples:
createLayer.cpp.
virtual TeDatabase* const TeLayer::database ( ) [inline, virtual]

Retrieves the database associated to this layer.

int TeLayer::geomRep ( ) [virtual]

Returns a combination of all representations in the layer.

Examples:
createTheme.cpp.
bool TeLayer::getAttrTables ( TeAttrTableVector atts,
TeAttrTableType  attType = TeAllAttrTypes 
) [virtual]

Gets all attribute tables associated to this layer that are of a certain type.

Examples:
createSTElementSetFromTheme.cpp, importGeoTab.cpp, importMIDMIF.cpp, and importShape.cpp.
bool TeLayer::getAttrTablesByName ( vector< string > &  tableNames,
TeAttrTableVector atts,
TeAttrTableType  attType = TeAllAttrTypes 
) [virtual]

Gets a set of attribute table specifications associated to this layer that are of a certain type.

bool TeLayer::getAttrTablesByName ( const string tableName,
TeTable table,
TeAttrTableType  attType = TeAllAttrTypes 
) [virtual]

Gets an attribute table associated to a layer.

bool TeLayer::getCells ( TeCellSet cs,
const string whereClause = "" 
) [virtual]

Retrieve a cell set given a selection criteria, expressed as a where clause.

TeTime TeLayer::getEditionTime ( ) const [virtual]

Sets in memory the edition time of the layer.

bool TeLayer::getLines ( TeLineSet ls,
const string whereClause = "" 
) [virtual]

Retrieves a line set given a selection criteria, expressed as a where clause.

int TeLayer::getNewObjectId ( ) [virtual]

Returns a possible new object id based on the objects stored in database.

bool TeLayer::getPoints ( TePointSet ps,
const string whereClause = "" 
) [virtual]

Retrieves a point set given a selection criteria, expressed as a where clause.

bool TeLayer::getPolygons ( TePolygonSet ps,
const string whereClause = "" 
) [virtual]

Retrieves a polygon set given a selection criteria, expressed as a where clause.

bool TeLayer::getRasterGeometries ( vector< string > &  objectIds,
unsigned int  tilingType = 0,
const TeBox box = TeBox() 
) [virtual]

Returns a vector with the identification of all objects of the layer that has a raster representation.

bool TeLayer::getRepresentation ( TeGeomRep  repType,
TeRepresPointerVector result 
) [virtual]

Gets all information about a representation.

Examples:
addGeomRepresentation.cpp, databaseQuery.cpp, and databaseSQLQuery.cpp.
TeRepresentation * TeLayer::getRepresentation ( TeGeomRep  repType,
const string tableName = "" 
) [virtual]

Gets an specific representation.

Parameters:
repTypethe geometrical representation being searched
tableNamethe table associated to this representation
Returns:
the representation associated to a geometry with the given table name
Note:
if no table name is specified the first found is returned
bool TeLayer::getText ( TeTextSet ts,
const string whereClause = "" 
) [virtual]

Retrieve a point set given a selection criteria, expressed as a where clause.

bool TeLayer::hasGeometry ( TeGeomRep  rep) [virtual]

Indicates if layer has a geometry representation.

virtual void TeLayer::id ( int  id) [inline, virtual]

Sets the layer id.

virtual int TeLayer::id ( ) [inline, virtual]
bool TeLayer::loadGeometrySet ( const string geoid,
TePolygonSet ps 
) [virtual]

Retrieves the set of polygons with a certain geoid.

Examples:
createSTElementSetFromTheme.cpp.
bool TeLayer::loadGeometrySet ( const string geoid,
TeLineSet ls 
) [virtual]

Retrieves the set of lines with a certain geoid.

bool TeLayer::loadGeometrySet ( const string geoid,
TePointSet ps 
) [virtual]

Retrieves the set of points with a certain geoid.

bool TeLayer::loadGeometrySet ( const string geoid,
TeTextSet cs 
) [virtual]

Retrieves the set of texts with a certain geoid.

bool TeLayer::loadGeometrySet ( const string geoid,
TeCellSet cs 
) [virtual]

Retrieves the set of points with a certain geoid.

bool TeLayer::loadLayerTables ( ) [virtual]

Reload the tables definition from database to memory.

bool TeLayer::locateCell ( TeCoord2D pt,
TeCell cell,
const double &  tol = 0.0 
) [virtual]

Retrieves a point that cointains a certain coordinate.

bool TeLayer::locateLine ( TeCoord2D pt,
TeLine2D line,
const double &  tol = 0.0 
) [virtual]

Locates a line that cointains a certain coordinate.

bool TeLayer::locatePoint ( TeCoord2D pt,
TePoint point,
const double &  tol = 0.0 
) [virtual]

Retrieves a point that cointains a certain coordinate.

bool TeLayer::locatePolygon ( TeCoord2D pt,
TePolygon polygon,
const double &  tol = 0.0 
) [virtual]

Locates a polygon that cointains a certain coordinate.

bool TeLayer::locateText ( TeCoord2D pt,
TeText text,
const double &  tol = 0.0 
) [virtual]

Retrieves a TeText that cointains a certain coordinate.

string TeLayer::mediaTable ( ) [virtual]

Gets the name of the media table associated to layer.

void TeLayer::mediaTable ( const string name) [virtual]

Sets the name of the media table associated to layer.

virtual string TeLayer::name ( ) [inline, virtual]

Returns the layer name.

Examples:
copyLayer.cpp, importGeoTab.cpp, importMIDMIF.cpp, and importShape.cpp.
virtual void TeLayer::name ( const string name) [inline, virtual]

Sets the layer name.

int TeLayer::nGeometries ( TeGeomRep  rep) [virtual]

Retrieves the number of geometries of a type.

Parameters:
repgeometrical representation
Examples:
importGeoTab.cpp, importMIDMIF.cpp, and importShape.cpp.
int TeLayer::nObjects ( const string tName) [virtual]

Returns the number of distinct objects in the layer.

Examples:
importGeoTab.cpp, importMIDMIF.cpp, and importShape.cpp.
TeLayer & TeLayer::operator= ( const TeLayer other)

Operator =.

virtual TeProjection* TeLayer::projection ( ) [inline, virtual]
TeRaster * TeLayer::raster ( const string objectId = "",
const char &  mode = 'r' 
) [virtual]

Returns a pointer to the raster geometry associated to an object of this layer.

Parameters:
objectIdunique identification of the object (if empty it will look for the first raster geometry found)
modepermission access ('r', 'w')
void TeLayer::raster ( TeRaster raster) [virtual]

Sets the pointer to the raster representation.

bool TeLayer::reloadLayerEditionTime ( ) [virtual]
bool TeLayer::removeAttributeTable ( string  tableName) [virtual]

Remove an attribute table definition to layer vector of attribute tables (in memory)

bool TeLayer::removeGeometries ( const std::vector< int > &  vecGeomIds,
const TeGeomRep rep 
) [virtual]

Removes the geometries from the layer.

bool TeLayer::removeGeometry ( TeGeomRep  repType,
const string tName = "" 
) [virtual]

Removes a geometry from layer.

bool TeLayer::saveAttributeTable ( TeTable table) [virtual]

Saves an attribute table into the database where layer is stored.

Examples:
createLayer.cpp.
virtual void TeLayer::setDatabase ( TeDatabase db) [inline, virtual]

Sets the layer database.

void TeLayer::setEditionTime ( const TeTime editionTime) [virtual]

Updates the layer last edition time in memory and in the database.

void TeLayer::setLayerBox ( const TeBox box) [virtual]

Sets the bounding box of a layer.

void TeLayer::setProjection ( TeProjection proj) [virtual]

Sets the layer projection.

string TeLayer::tableName ( TeGeomRep  rep) [virtual]

Retrieves the table name associated to a geometry representation.

Parameters:
repgeometrical representation
Note:
When there is more than one representation of a given type returns the table name associated to the first one encountered
Examples:
addGeomRepresentation.cpp, spatialQuery.cpp, and spatialQueryAndBuffer.cpp.
void TeLayer::updateAttributeTable ( TeTable table) [virtual]

Update an attribute table definition to layer vector of attribute tables (in memory)

bool TeLayer::updateCells ( TeCellSet cellSet) [virtual]

Updates a set of cells to a layer.

void TeLayer::updateLayerBox ( ) [virtual]

Refreshes the bounding box of a layer according to its representation.

void TeLayer::updateLayerBox ( const TeBox box) [virtual]

Updates the bounding box of a layer.

bool TeLayer::updateLayerEditionTime ( const bool &  setEditionToNow = true) [virtual]

Reloads the edition time from the database.

bool TeLayer::updateLines ( TeLineSet lineSet) [virtual]

Updates a set of lines to a layer.

bool TeLayer::updatePoints ( TePointSet pointSet) [virtual]

Updates a set of points to a layer.

bool TeLayer::updatePolygons ( TePolygonSet polySet) [virtual]

Updates a set of polygons to a layer.

bool TeLayer::updateText ( TeTextSet textSet,
const string tName 
) [virtual]

Updates a set of text to a layer.

virtual const TeRepresPointerVector& TeLayer::vectRepres ( ) const [inline, virtual]

Returns the dateTime that the layer was last edited.

virtual TeRepresPointerVector& TeLayer::vectRepres ( ) [inline, virtual]

Returns a vector with all representations in the layer.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines