TeMultiGeometry Class Reference

#include <TeMultiGeometry.h>


Detailed Description

Definition at line 33 of file TeMultiGeometry.h.


Public Member Functions

void addGeometry (const TeText &text)
 Add cell geometry.
void addGeometry (const TeCell &cell)
 Add cell geometry.
void addGeometry (const TePoint &point)
 Add point geometry.
void addGeometry (const TeLine2D &line)
 Add line geometry.
void addGeometry (const TePolygon &poly)
 Add polygon geometry.
TeBox box ()
 Get the total extension of the multi-geometry.
void clear ()
 Clear geometries.
bool empty ()
 Return true if there are not any geometry.
TeBox getBox ()
 Get the total extension of the multi-geometry.
TeCellSetgetCells ()
 Get a reference to the cell geometry container.
bool getGeometry (vector< TeGeometry * > &result)
 Get all geometries. Return true if the geometries exit.
bool getGeometry (TeTextSet &result) const
 Get a copy of text geometries. Return true if the geometries exit.
bool getGeometry (TeCellSet &result) const
 Get a copy of cell geometries. Return true if the geometries exit.
bool getGeometry (TePointSet &result) const
 Get a copy of point geometries. Return true if the geometries exit.
bool getGeometry (TeLineSet &result) const
 Get a copy of line geometries. Return true if the geometries exit.
bool getGeometry (TePolygonSet &result) const
 Get a copy of polygon geometries. Return true if the geometries exit.
TeLineSetgetLines ()
 Get a reference to the line geometry container.
TePointSetgetPoints ()
 Get a reference to the point geometry container.
TePolygonSetgetPolygons ()
 Get a reference to the polygon geometry container.
TeTextSetgetTexts ()
 Get a reference to the text geometry container.
bool hasCells () const
 Return true if this has cells.
bool hasLines () const
 Return true if this has lines.
bool hasPoints () const
 Return true if this has points.
bool hasPolygons () const
 Return true if this has polygons.
bool hasTexts () const
 Return true if this has cells.
TeMultiGeometryoperator= (const TeMultiGeometry &other)
 Assignment operator.
void setGeometry (vector< TeGeometry * > &result)
 Set all geometries.
void setGeometry (const TeTextSet &result)
 Set text geometries.
void setGeometry (const TeCellSet &result)
 Set cell geometries.
void setGeometry (const TePointSet &result)
 Set point geometries.
void setGeometry (const TeLineSet &result)
 Set line geometries.
void setGeometry (const TePolygonSet &result)
 Set polygon geometries.
 TeMultiGeometry (const TeMultiGeometry &other)
 Copy constructor.
 TeMultiGeometry ()
 Constructor.

Data Fields

TeCellSet cells_
TeLineSet lines_
TePointSet points_
TePolygonSet polygons_
TeTextSet texts_

Constructor & Destructor Documentation

TeMultiGeometry::TeMultiGeometry (  )  [inline]

Definition at line 44 of file TeMultiGeometry.h.

00044 {};

TeMultiGeometry::TeMultiGeometry ( const TeMultiGeometry other  ) 

Definition at line 27 of file TeMultiGeometry.cpp.

References cells_, TeGeomComposite< T >::copyElements(), TeLineSet::copyElements(), TePolygonSet::copyElements(), lines_, points_, polygons_, and texts_.

00028 {
00029         polygons_.copyElements(other.polygons_);
00030         lines_.copyElements(other.lines_);
00031         points_.copyElements(other.points_);
00032         cells_.copyElements(other.cells_);
00033         texts_.copyElements(other.texts_); 
00034 }


Member Function Documentation

void TeMultiGeometry::addGeometry ( const TeText text  ) 

Definition at line 235 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::add(), TeGeometry::objectId(), TeGeomComposite< T >::objectId(), and texts_.

00236 { 
00237         texts_.add(text); 
00238         texts_.objectId(text.objectId()); 
00239 }

void TeMultiGeometry::addGeometry ( const TeCell cell  ) 

Definition at line 228 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::add(), cells_, TeGeometry::objectId(), and TeGeomComposite< T >::objectId().

00229 { 
00230         cells_.add(cell); 
00231         cells_.objectId(cell.objectId()); 
00232 }

void TeMultiGeometry::addGeometry ( const TePoint point  ) 

Definition at line 221 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::add(), TePoint::objectId(), TeGeomComposite< T >::objectId(), and points_.

00222 { 
00223         points_.add(point); 
00224         points_.objectId(point.objectId()); 
00225 } 

void TeMultiGeometry::addGeometry ( const TeLine2D line  ) 

Definition at line 214 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::add(), lines_, TeLine2D::objectId(), and TeGeomComposite< T >::objectId().

00215 { 
00216         lines_.add(line); 
00217         lines_.objectId(line.objectId()); 
00218 }

void TeMultiGeometry::addGeometry ( const TePolygon poly  ) 

Definition at line 207 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::add(), TeGeomComposite< T >::objectId(), and polygons_.

Referenced by TeSTInstance::addGeometry(), TePGRecordset::getWKBGeomColl(), TeGeoOpAggregation(), and TeOverlay().

00208 { 
00209         polygons_.add(poly); 
00210         polygons_.objectId(poly.objectId()); 
00211 }

TeBox TeMultiGeometry::box (  )  [inline]

Definition at line 157 of file TeMultiGeometry.h.

Referenced by getBox().

00158         { return this->getBox(); } 

void TeMultiGeometry::clear ( void   ) 

Definition at line 242 of file TeMultiGeometry.cpp.

References cells_, TeGeomComposite< T >::clear(), lines_, points_, polygons_, and texts_.

Referenced by TeSTInstance::clear(), setGeometry(), TeGeoOpAggregation(), and TeGeoOpNearestNeighbour().

00243 {
00244         polygons_.clear ();
00245         lines_.clear ();
00246         points_.clear ();
00247         cells_.clear ();
00248         texts_.clear();
00249 }

bool TeMultiGeometry::empty (  )  [inline]

Definition at line 144 of file TeMultiGeometry.h.

Referenced by TeSTInstance::getGeometry(), and TeGeoOpAggregation().

00145         { 
00146                 return ( polygons_.empty() &&  lines_.empty() &&
00147                                  points_.empty()   &&  cells_.empty() &&  texts_.empty());
00148         }

TeBox TeMultiGeometry::getBox ( void   ) 

Definition at line 252 of file TeMultiGeometry.cpp.

References TeGeometry::box(), box(), cells_, hasCells(), hasLines(), hasPoints(), hasPolygons(), hasTexts(), lines_, points_, polygons_, texts_, and updateBox().

Referenced by TeQuerierDBStr3::fetchInstance(), and TeQuerierDBStr1::fetchInstance().

00253 {
00254         TeBox box;
00255         if (hasPolygons())
00256                 updateBox(box,polygons_.box());
00257         if (hasLines())
00258                 updateBox(box,lines_.box());
00259         if (hasPoints())
00260                 updateBox(box,points_.box());
00261         if (hasCells())
00262                 updateBox(box,cells_.box());
00263         if (hasTexts())
00264                 updateBox(box,texts_.box());
00265         return box;
00266 }

TeCellSet& TeMultiGeometry::getCells (  )  [inline]

Definition at line 80 of file TeMultiGeometry.h.

Referenced by addGeometry(), TeSTInstance::getCells(), and TeFindCentroid().

00081         {       return cells_; }

bool TeMultiGeometry::getGeometry ( vector< TeGeometry * > &  result  ) 

Definition at line 98 of file TeMultiGeometry.cpp.

References cells_, hasCells(), hasLines(), hasPoints(), hasPolygons(), lines_, points_, polygons_, and TeGeomComposite< T >::size().

00099 {
00100         bool status = false;
00101         if(hasPolygons())
00102         {
00103                 for(int i=0; i< (int)polygons_.size(); ++i)
00104                 {
00105                         TePolygon* pol = new TePolygon();
00106                         (*pol) = polygons_[i];
00107                         result.push_back (pol);
00108                         status = true;
00109                 }
00110         }
00111         if(hasLines())
00112         {
00113                 for(int i=0; i< (int)lines_.size(); ++i)
00114                 {
00115                         TeLine2D* lin = new TeLine2D();
00116                         (*lin) = lines_[i];
00117                         result.push_back (lin);
00118                         status = true;
00119                 }
00120         }
00121         if(hasPoints())
00122         {
00123                 for(int i=0; i< (int)points_.size(); ++i)
00124                 {
00125                         TePoint* pon = new TePoint();
00126                         (*pon) = points_[i];
00127                         result.push_back (pon);
00128                         status = true;
00129                 }
00130         }
00131         if(hasCells())
00132         {
00133                 for(int i=0; i< (int)cells_.size(); ++i)
00134                 {
00135                         TeCell* cell = new TeCell();
00136                         (*cell) = cells_[i];
00137                         result.push_back (cell);
00138                         status = true;
00139                 }
00140         }
00141         return status;
00142 }

bool TeMultiGeometry::getGeometry ( TeTextSet result  )  const

Definition at line 89 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::copyElements(), hasTexts(), and texts_.

00090 {
00091         if(!hasTexts())
00092                 return false;
00093         result.copyElements(texts_);
00094         return true;
00095 }

bool TeMultiGeometry::getGeometry ( TeCellSet result  )  const

Definition at line 80 of file TeMultiGeometry.cpp.

References cells_, TeGeomComposite< T >::copyElements(), and hasCells().

00081 {
00082         if(!hasCells())
00083                 return false;
00084         result.copyElements(cells_);
00085         return true;
00086 }

bool TeMultiGeometry::getGeometry ( TePointSet result  )  const

Definition at line 71 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::copyElements(), hasPoints(), and points_.

00072 {
00073         if(!hasPoints())
00074                 return false;
00075         result.copyElements(points_);
00076         return true;
00077 }

bool TeMultiGeometry::getGeometry ( TeLineSet result  )  const

Definition at line 62 of file TeMultiGeometry.cpp.

References TeLineSet::copyElements(), hasLines(), and lines_.

00063 {
00064         if(!hasLines())
00065                 return false;
00066         result.copyElements(lines_);
00067         return true;
00068 }

bool TeMultiGeometry::getGeometry ( TePolygonSet result  )  const

Definition at line 52 of file TeMultiGeometry.cpp.

References TePolygonSet::copyElements(), hasPolygons(), and polygons_.

Referenced by TeSTInstance::getGeometry(), multiGeometryToLayer(), TeFindObjectCentroid(), TeGeometryArea(), TeGeoOpAssignByLocationCollect(), TeGeoOpAssignDataLocationDistribute(), and TeGeoOpOverlayIntersection().

00053 {
00054         if(!hasPolygons())
00055                 return false;
00056         result.copyElements(polygons_);
00057         return true;
00058 }

TeLineSet& TeMultiGeometry::getLines (  )  [inline]

Definition at line 72 of file TeMultiGeometry.h.

Referenced by TeOGRDriver::addElement(), addGeometry(), CalculateDistance(), TeLineLengthStrategy::compute(), TeCountLineObjectsStrategy::compute(), TeSTInstance::getLines(), TeShapefileDriver::loadData(), TeFindCentroid(), and TeMinimumDistanceLinesStrategy::TeMinimumDistanceLinesStrategy().

00073         {       return lines_; }

TePointSet& TeMultiGeometry::getPoints (  )  [inline]

Definition at line 76 of file TeMultiGeometry.h.

Referenced by TeOGRDriver::addElement(), addGeometry(), CalculateDistance(), TeSTInstance::getPoints(), TeShapefileDriver::loadData(), TeFindCentroid(), TeGeoOpAssignByLocationCollect(), and TeMinimumDistancePointsStrategy::TeMinimumDistancePointsStrategy().

00077         {       return points_; }

TePolygonSet& TeMultiGeometry::getPolygons (  )  [inline]

Definition at line 68 of file TeMultiGeometry.h.

Referenced by TeOGRDriver::addElement(), addGeometry(), CalculateDistance(), TeMinimumDistancePolygonsStrategy::compute(), TeSumWeighByAreaStrategy::compute(), TeCountPolygonalObjectsStrategy::compute(), TeTotalAreaPercentageStrategy::compute(), TeCategoryMajorityStrategy::compute(), TeAverageWeighByAreaStrategy::compute(), TeSTInstance::getPolygons(), TeShapefileDriver::loadData(), TeFindCentroid(), TeGeoOpAggregation(), and TeMinimumDistancePolygonsStrategy::TeMinimumDistancePolygonsStrategy().

00069         {       return polygons_; }

TeTextSet& TeMultiGeometry::getTexts (  )  [inline]

Definition at line 84 of file TeMultiGeometry.h.

Referenced by addGeometry(), and TeSTInstance::getTexts().

00085         {       return texts_; }

bool TeMultiGeometry::hasCells (  )  const [inline]

Definition at line 136 of file TeMultiGeometry.h.

Referenced by getBox(), getGeometry(), TeSTInstance::hasCells(), multiGeometryToLayer(), TeFindCentroid(), and TeGeometryArea().

00137         { return (!cells_.empty()); } 

bool TeMultiGeometry::hasLines (  )  const [inline]

Definition at line 128 of file TeMultiGeometry.h.

Referenced by TeOGRDriver::addElement(), getBox(), getGeometry(), TeSTInstance::hasLines(), multiGeometryToLayer(), and TeFindCentroid().

00129         { return (!lines_.empty()); } 

bool TeMultiGeometry::hasPoints (  )  const [inline]

Definition at line 132 of file TeMultiGeometry.h.

Referenced by TeOGRDriver::addElement(), getBox(), getGeometry(), TeSTInstance::hasPoints(), multiGeometryToLayer(), and TeFindCentroid().

00133         { return (!points_.empty()); } 

bool TeMultiGeometry::hasPolygons (  )  const [inline]

Definition at line 124 of file TeMultiGeometry.h.

Referenced by TeOGRDriver::addElement(), getBox(), getGeometry(), TeSTInstance::hasPolygons(), multiGeometryToLayer(), TeFindCentroid(), TeGeometryArea(), and TeGeoOpAggregation().

00125         { return (!polygons_.empty()); } 

bool TeMultiGeometry::hasTexts (  )  const [inline]

Definition at line 140 of file TeMultiGeometry.h.

Referenced by getBox(), getGeometry(), and TeSTInstance::hasTexts().

00141         { return (!texts_.empty()); } 

TeMultiGeometry & TeMultiGeometry::operator= ( const TeMultiGeometry other  ) 

Definition at line 37 of file TeMultiGeometry.cpp.

References cells_, TeGeomComposite< T >::copyElements(), TeLineSet::copyElements(), TePolygonSet::copyElements(), lines_, points_, polygons_, and texts_.

00038 {
00039         if ( this != &other )
00040         {
00041                 polygons_.copyElements(other.polygons_);
00042                 lines_.copyElements(other.lines_);
00043                 points_.copyElements(other.points_);
00044                 cells_.copyElements(other.cells_);
00045                 texts_.copyElements(other.texts_); 
00046         }
00047         return *this;
00048 }

void TeMultiGeometry::setGeometry ( vector< TeGeometry * > &  result  ) 

Definition at line 175 of file TeMultiGeometry.cpp.

References TeGeomComposite< T >::add(), cells_, clear(), lines_, points_, polygons_, and texts_.

00176 {
00177         this->clear();
00178         vector<TeGeometry*>::iterator it = result.begin();
00179         
00180         while(it!=result.end())
00181         {
00182                 TeGeometry* geom = (*it);
00183                 
00184                 if(dynamic_cast<TePolygon*> (geom))
00185                         polygons_.add (*((TePolygon*)geom));
00186                 else if (dynamic_cast<TePolygonSet*> (geom))
00187                         polygons_ = *((TePolygonSet*) geom);
00188                 else if(dynamic_cast<TeLine2D*> (geom))
00189                         lines_.add (*((TeLine2D*)geom));
00190                 else if(dynamic_cast<TeLineSet*> (geom))
00191                         lines_ = *((TeLineSet*)geom);
00192                 else if(dynamic_cast<TePoint*> (geom))
00193                         points_.add (*((TePoint*)geom));
00194                 else if(dynamic_cast<TePointSet*> (geom))
00195                         points_ = *((TePointSet*)geom);
00196                 else if(dynamic_cast<TeCell*> (geom))
00197                         cells_.add (*((TeCell*)geom));
00198                 else if(dynamic_cast<TeCellSet*> (geom))
00199                         cells_ = *((TeCellSet*)geom);
00200                 else if(dynamic_cast<TeText*> (geom))
00201                         texts_.add (*((TeText*)geom));
00202                 ++it;
00203         }
00204 }

void TeMultiGeometry::setGeometry ( const TeTextSet result  ) 

Definition at line 169 of file TeMultiGeometry.cpp.

References texts_.

00170 { 
00171         texts_ = result; 
00172 }

void TeMultiGeometry::setGeometry ( const TeCellSet result  ) 

Definition at line 163 of file TeMultiGeometry.cpp.

References cells_.

00164 { 
00165         cells_ = result; 
00166 }

void TeMultiGeometry::setGeometry ( const TePointSet result  ) 

Definition at line 157 of file TeMultiGeometry.cpp.

References points_.

00158 { 
00159         points_ = result; 
00160 }

void TeMultiGeometry::setGeometry ( const TeLineSet result  ) 

Definition at line 151 of file TeMultiGeometry.cpp.

References lines_.

00152 { 
00153         lines_ = result; 
00154 }

void TeMultiGeometry::setGeometry ( const TePolygonSet result  ) 

Definition at line 145 of file TeMultiGeometry.cpp.

References polygons_.

Referenced by TeSTInstance::setGeometry(), TeGeoOpAggregation(), and TeOverlay().

00146 { 
00147         polygons_ = result;
00148 }


Field Documentation

TeCellSet TeMultiGeometry::cells_

Definition at line 40 of file TeMultiGeometry.h.

Referenced by addGeometry(), clear(), getBox(), TeSTInstance::getGeometry(), getGeometry(), operator=(), setGeometry(), and TeMultiGeometry().

TeLineSet TeMultiGeometry::lines_

Definition at line 38 of file TeMultiGeometry.h.

Referenced by addGeometry(), clear(), getBox(), TeSTInstance::getGeometry(), getGeometry(), operator=(), setGeometry(), TeDecodeShape(), and TeMultiGeometry().

TePointSet TeMultiGeometry::points_

Definition at line 39 of file TeMultiGeometry.h.

Referenced by addGeometry(), clear(), getBox(), TeSTInstance::getGeometry(), getGeometry(), operator=(), setGeometry(), TeDecodeShape(), and TeMultiGeometry().

TePolygonSet TeMultiGeometry::polygons_

Definition at line 37 of file TeMultiGeometry.h.

Referenced by addGeometry(), clear(), getBox(), TeSTInstance::getGeometry(), getGeometry(), operator=(), setGeometry(), TeDecodeShape(), and TeMultiGeometry().

TeTextSet TeMultiGeometry::texts_

Definition at line 41 of file TeMultiGeometry.h.

Referenced by addGeometry(), clear(), getBox(), getGeometry(), operator=(), setGeometry(), and TeMultiGeometry().


The documentation for this class was generated from the following files:
Generated on Sun Jul 29 04:06:52 2012 for TerraLib - Development Source by  doxygen 1.5.3