1.2.3
CCC
 
Polygons Class Reference

#include <Polygons.hpp>

Inheritance diagram for Polygons:
AStringable ASerializable

Public Member Functions

 Polygons ()
 
 Polygons (const Polygons &r)
 
Polygonsoperator= (const Polygons &r)
 
virtual ~Polygons ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable. More...
 
int resetFromDb (const Db *db, double dilate=0., bool verbose=false)
 
int resetFromCSV (const String &filename, const CSVformat &csv, int verbose=false, int ncol_max=-1, int nrow_max=-1)
 
int resetFromWKT (const String &filename, const CSVformat &csv, int verbose=false, int ncol_max=-1, int nrow_max=-1)
 
int getPolyElemNumber () const
 
void addPolyElem (const PolyElem &polyelem)
 
const std::vector< PolyElem > & getPolyElems () const
 
const PolyElemgetPolyElem (int ipol) const
 
PolyElem getClosedPolyElem (int ipol) const
 
const VectorDoublegetX (int ipol) const
 
const VectorDoublegetY (int ipol) const
 
void setX (int ipol, const VectorDouble &x)
 
void setY (int ipol, const VectorDouble &y)
 
void getExtension (double *xmin, double *xmax, double *ymin, double *ymax) const
 
double getSurface () const
 
bool inside (const VectorDouble &coor, bool flag_nested=false)
 
Polygons reduceComplexity (double distmin) const
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 

Static Public Member Functions

static Polygonscreate ()
 
static PolygonscreateFromNF (const String &neutralFilename, bool verbose=false)
 
static PolygonscreateFromCSV (const String &filename, const CSVformat &csv=CSVformat(), int verbose=false, int ncol_max=-1, int nrow_max=-1)
 
static PolygonscreateFromWKT (const String &filename, const CSVformat &csv=CSVformat(), int verbose=false, int ncol_max=-1, int nrow_max=-1)
 
static PolygonscreateFromDb (const Db *db, double dilate=0., bool verbose=false)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Constructor & Destructor Documentation

Polygons::Polygons ( )
Polygons::Polygons ( const Polygons r)
Polygons::~Polygons ( )
virtual

Member Function Documentation

void Polygons::addPolyElem ( const PolyElem polyelem)

Add the PolyElem to the list of polygons. This is performed only if the current PolyElem contains at least 3 vertices.

Parameters
polyelem
Polygons * Polygons::create ( )
static
Polygons * Polygons::createFromCSV ( const String filename,
const CSVformat csv = CSVformat(),
int  verbose = false,
int  ncol_max = -1,
int  nrow_max = -1 
)
static
Polygons * Polygons::createFromDb ( const Db db,
double  dilate = 0.,
bool  verbose = false 
)
static
Polygons * Polygons::createFromNF ( const String neutralFilename,
bool  verbose = false 
)
static
Polygons * Polygons::createFromWKT ( const String filename,
const CSVformat csv = CSVformat(),
int  verbose = false,
int  ncol_max = -1,
int  nrow_max = -1 
)
static
PolyElem Polygons::getClosedPolyElem ( int  ipol) const
void Polygons::getExtension ( double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax 
) const
const PolyElem & Polygons::getPolyElem ( int  ipol) const
int Polygons::getPolyElemNumber ( ) const
inline
const std::vector<PolyElem>& Polygons::getPolyElems ( ) const
inline
double Polygons::getSurface ( ) const
const VectorDouble & Polygons::getX ( int  ipol) const
const VectorDouble & Polygons::getY ( int  ipol) const
bool Polygons::inside ( const VectorDouble coor,
bool  flag_nested = false 
)

Check if one point belongs to a Polygons

Returns
1 if the point belongs to the Polygons; 0 otherwise
Parameters
[in]coorVector of coordinates
[in]flag_nestedOption for nested polyelems (see details)
Remarks
When coor is dimensioned to 3, the third dimension test is performed
If flag_nested=TRUE, a sample is masked off if the number of
polyelems to which it belongs is odd
If flag_nested=FALSE, a sample is masked off as soon as it
belongs to one PolyElem
Polygons & Polygons::operator= ( const Polygons r)
Polygons Polygons::reduceComplexity ( double  distmin) const
int Polygons::resetFromCSV ( const String filename,
const CSVformat csv,
int  verbose = false,
int  ncol_max = -1,
int  nrow_max = -1 
)

Reset the Polygon from a CSV file

Parameters
filenameFilename
csvCSV characteristics
verboseVerbose flag
ncol_maxMaximum number of columns
nrow_maxMaximum number of rows
Returns
int Polygons::resetFromDb ( const Db db,
double  dilate = 0.,
bool  verbose = false 
)
int Polygons::resetFromWKT ( const String filename,
const CSVformat csv,
int  verbose = false,
int  ncol_max = -1,
int  nrow_max = -1 
)

Reset the Polygon from a CSV file using WKT format (first column) exported by QGIS

Parameters
filenameFilename
csvCSV characteristics
verboseVerbose flag
ncol_maxMaximum number of columns
nrow_maxMaximum number of rows
Returns
void Polygons::setX ( int  ipol,
const VectorDouble x 
)
void Polygons::setY ( int  ipol,
const VectorDouble y 
)
String Polygons::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Interface to AStringable.

Reimplemented from AStringable.


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