gstlearn
1.0.0
CCC
|
#include <Polygons.hpp>
Public Member Functions | |
Polygons () | |
Polygons (const Polygons &r) | |
Polygons & | operator= (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 PolyElem | getPolyElem (int ipol) const |
PolyElem | getClosedPolyElem (int ipol) const |
const VectorDouble | getX (int ipol) const |
const VectorDouble | getY (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) | |
AStringable & | operator= (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) | |
ASerializable & | operator= (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 Polygons * | create () |
static Polygons * | createFromNF (const String &neutralFilename, bool verbose=false) |
static Polygons * | createFromCSV (const String &filename, const CSVformat &csv=CSVformat(), int verbose=false, int ncol_max=-1, int nrow_max=-1) |
static Polygons * | createFromWKT (const String &filename, const CSVformat &csv=CSVformat(), int verbose=false, int ncol_max=-1, int nrow_max=-1) |
static Polygons * | createFromDb (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 String & | getContainerName () |
static const String & | getPrefixName () |
static bool | createDirectory (const String &dir) |
static String | getExecDirectory () |
static String | getDirectory (const String &path) |
Protected Member Functions | |
virtual bool | _deserialize (std::istream &is, bool verbose=false) override |
Interface for ASerializable. More... | |
virtual bool | _serialize (std::ostream &os, bool verbose=false) const override |
String | _getNFName () const override |
Protected Member Functions inherited from ASerializable | |
bool | _fileOpenWrite (const String &filename, std::ofstream &os, bool verbose=false) const |
bool | _fileOpenRead (const String &filename, std::ifstream &is, bool verbose=false) const |
Private Member Functions | |
PolyElem | _extractFromTab (int ideb, int ifin, int ncol, const VectorDouble &tab) |
PolyElem | _extractFromWKT (const CSVformat &csv, String &polye) |
bool | _isValidPolyElemIndex (int ipol) const |
VectorInt | _getHullIndices (const VectorDouble &x, const VectorDouble &y) const |
void | _getExtend (double ext, VectorDouble &x, VectorDouble &y, int nsect=16) |
int | _buildHull (const Db *db, double dilate, bool verbose) |
void | _polygonHullPrint (const VectorInt &index, const VectorDouble &x, const VectorDouble &y) const |
Private Attributes | |
std::vector< PolyElem > | _polyelems |
Additional Inherited Members | |
Static Protected Member Functions inherited from ASerializable | |
static bool | _commentWrite (std::ostream &os, const String &comment) |
template<typename T > | |
static bool | _recordWrite (std::ostream &os, const String &title, const T &val) |
template<typename T > | |
static bool | _recordWriteVec (std::ostream &os, const String &title, const VectorT< T > &vec) |
template<typename T > | |
static bool | _recordRead (std::istream &is, const String &title, T &val) |
template<typename T > | |
static bool | _recordReadVec (std::istream &is, const String &title, VectorT< T > &vec, int nvalues) |
static bool | _onlyBlanks (char *string) |
static bool | _tableRead (std::istream &is, const String &string, int ntab, double *tab) |
static bool | _tableWrite (std::ostream &os, const String &string, int ntab, const VectorDouble &tab) |
Polygons::Polygons | ( | ) |
Polygons::Polygons | ( | const Polygons & | r | ) |
|
virtual |
|
private |
Create a polygon from the convex hull of active samples
[in] | db | descriptor of the Db serving for convex hull calculation |
[in] | dilate | Radius of the dilation |
[in] | verbose | Verbose flag |
|
overrideprotectedvirtual |
Interface for ASerializable.
Implements ASerializable.
|
private |
|
private |
Create a set of fictitious samples obtained by dilating the initial ones
ext | Dilation distance |
x | Vector of X-coordinates or initial samples |
y | Vector of Y-coordinates of initial samples |
nsect | Number of discretization points for dilation |
|
private |
Create a polygon from the convex hull of active samples
[in] | x | Vector of X coordinates |
[in] | y | Vector of Y coordinates |
|
inlineoverrideprotectedvirtual |
Implements ASerializable.
|
private |
|
private |
|
overrideprotectedvirtual |
Implements ASerializable.
void Polygons::addPolyElem | ( | const PolyElem & | polyelem | ) |
|
static |
|
static |
|
static |
Create a Polygon by loading the contents of a Neutral File
neutralFilename | Name of the Neutral File |
verbose | Verbose flag |
|
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 |
|
inline |
|
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
[in] | coor | Vector of coordinates |
[in] | flag_nested | Option for nested polyelems (see details) |
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
filename | Filename |
csv | CSV characteristics |
verbose | Verbose flag |
ncol_max | Maximum number of columns |
nrow_max | Maximum number of rows |
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
filename | Filename |
csv | CSV characteristics |
verbose | Verbose flag |
ncol_max | Maximum number of columns |
nrow_max | Maximum number of rows |
void Polygons::setX | ( | int | ipol, |
const VectorDouble & | x | ||
) |
void Polygons::setY | ( | int | ipol, |
const VectorDouble & | y | ||
) |
|
overridevirtual |
Interface to AStringable.
Reimplemented from AStringable.
|
private |