1.8.0
CCC
 
Loading...
Searching...
No Matches
gstlrn::Polygons Class Reference

#include <Polygons.hpp>

Inheritance diagram for gstlrn::Polygons:
gstlrn::AStringable gstlrn::ASerializable

Public Member Functions

 Polygons ()
 
 Polygons (const Polygons &r)
 
Polygonsoperator= (const Polygons &r)
 
virtual ~Polygons ()
 
String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable.
 
Id resetFromDb (const Db *db, double dilate=0., bool verbose=false)
 
Id resetFromCSV (const String &filename, const CSVformat &csv, bool verbose=false, Id ncol_max=-1, Id nrow_max=-1)
 
Id resetFromWKT (const String &filename, const CSVformat &csv, bool verbose=false, Id ncol_max=-1, Id nrow_max=-1)
 
Id getNPolyElem () const
 
void addPolyElem (const PolyElem &polyelem)
 
const std::vector< PolyElem > & getPolyElems () const
 
const PolyElemgetPolyElem (Id ipol) const
 
PolyElem getClosedPolyElem (Id ipol) const
 
const & getX (Id ipol) const
 
const & getY (Id ipol) const
 
void setX (Id ipol, const 1 &x)
 
void setY (Id ipol, const 1 &y)
 
void getExtension (double *xmin, double *xmax, double *ymin, double *ymax) const
 
double getSurface () const
 
bool inside (const 1 &coor, bool flag_nested=false) const
 
Polygons reduceComplexity (double distmin) const
 
- Public Member Functions inherited from gstlrn::AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (Id level) const final
 
- Public Member Functions inherited from gstlrn::ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
 ASerializable (ASerializable &&r) noexcept
 
ASerializableoperator= (ASerializable &&r) noexcept
 
virtual ~ASerializable ()
 
bool dumpToNF (const String &NFFilename, const EFormatNF &format=EFormatNF::fromKey("DEFAULT"), bool verbose=false) const
 Dump the contents of an object into an Output File using a given Output NF Format.
 
void setDefaultFormatNF (const EFormatNF &format)
 

Static Public Member Functions

static Polygonscreate ()
 
static PolygonscreateFromNF (const String &NFFilename, bool verbose=false)
 
static PolygonscreateFromCSV (const String &filename, const CSVformat &csv=CSVformat(), Id verbose=false, Id ncol_max=-1, Id nrow_max=-1)
 
static PolygonscreateFromWKT (const String &filename, const CSVformat &csv=CSVformat(), Id verbose=false, Id ncol_max=-1, Id nrow_max=-1)
 
static PolygonscreateFromDb (const Db *db, double dilate=0., bool verbose=false)
 
- Static Public Member Functions inherited from gstlrn::ASerializable
static String buildFileName (Id status, const String &filename, bool ensureDirExist=false)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetPrefixName ()
 

Constructor & Destructor Documentation

◆ Polygons() [1/2]

gstlrn::Polygons::Polygons ( )

◆ Polygons() [2/2]

gstlrn::Polygons::Polygons ( const Polygons r)

◆ ~Polygons()

gstlrn::Polygons::~Polygons ( )
virtual

Member Function Documentation

◆ addPolyElem()

void gstlrn::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

◆ create()

Polygons * gstlrn::Polygons::create ( )
static

◆ createFromCSV()

Polygons * gstlrn::Polygons::createFromCSV ( const String filename,
const CSVformat csv = CSVformat(),
Id  verbose = false,
Id  ncol_max = -1,
Id  nrow_max = -1 
)
static

◆ createFromDb()

Polygons * gstlrn::Polygons::createFromDb ( const Db db,
double  dilate = 0.,
bool  verbose = false 
)
static

◆ createFromNF()

Polygons * gstlrn::Polygons::createFromNF ( const String NFFilename,
bool  verbose = false 
)
static

◆ createFromWKT()

Polygons * gstlrn::Polygons::createFromWKT ( const String filename,
const CSVformat csv = CSVformat(),
Id  verbose = false,
Id  ncol_max = -1,
Id  nrow_max = -1 
)
static

◆ getClosedPolyElem()

PolyElem gstlrn::Polygons::getClosedPolyElem ( Id  ipol) const

◆ getExtension()

void gstlrn::Polygons::getExtension ( double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax 
) const

◆ getNPolyElem()

Id gstlrn::Polygons::getNPolyElem ( ) const
inline

◆ getPolyElem()

const PolyElem & gstlrn::Polygons::getPolyElem ( Id  ipol) const

◆ getPolyElems()

const std::vector< PolyElem > & gstlrn::Polygons::getPolyElems ( ) const
inline

◆ getSurface()

double gstlrn::Polygons::getSurface ( ) const

◆ getX()

const & gstlrn::Polygons::getX ( Id  ipol) const

◆ getY()

const & gstlrn::Polygons::getY ( Id  ipol) const

◆ inside()

bool gstlrn::Polygons::inside ( const 1 &  coor,
bool  flag_nested = false 
) const

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

◆ operator=()

Polygons & gstlrn::Polygons::operator= ( const Polygons r)

◆ reduceComplexity()

Polygons gstlrn::Polygons::reduceComplexity ( double  distmin) const

◆ resetFromCSV()

Id gstlrn::Polygons::resetFromCSV ( const String filename,
const CSVformat csv,
bool  verbose = false,
Id  ncol_max = -1,
Id  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

◆ resetFromDb()

Id gstlrn::Polygons::resetFromDb ( const Db db,
double  dilate = 0.,
bool  verbose = false 
)

◆ resetFromWKT()

Id gstlrn::Polygons::resetFromWKT ( const String filename,
const CSVformat csv,
bool  verbose = false,
Id  ncol_max = -1,
Id  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

◆ setX()

void gstlrn::Polygons::setX ( Id  ipol,
const 1 &  x 
)

◆ setY()

void gstlrn::Polygons::setY ( Id  ipol,
const 1 &  y 
)

◆ toString()

String gstlrn::Polygons::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Interface to AStringable.

Reimplemented from gstlrn::AStringable.


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