OGS
|
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices in the point vector. A polyline consists of at least one line segment. The polyline is specified by the points of the line segments. The class Polyline stores ids of pointers to the points in the _ply_pnt_ids vector.
Definition at line 39 of file Polyline.h.
#include <Polyline.h>
Classes | |
class | SegmentIterator |
Public Member Functions | |
Polyline (const std::vector< Point * > &pnt_vec) | |
Polyline (const Polyline &ply) | |
Polyline & | operator= (Polyline const &other)=delete |
~Polyline () override=default | |
GEOTYPE | getGeoType () const override |
return a geometry type | |
virtual bool | addPoint (std::size_t pnt_id) |
virtual bool | insertPoint (std::size_t pos, std::size_t pnt_id) |
void | removePoint (std::size_t pos) |
void | closePolyline () |
std::size_t | getNumberOfPoints () const |
std::size_t | getNumberOfSegments () const |
bool | isClosed () const |
bool | isCoplanar () const |
bool | isPointIDInPolyline (std::size_t pnt_id) const |
std::size_t | getPointID (std::size_t const i) const |
void | setPointID (std::size_t idx, std::size_t id) |
const Point * | getPoint (std::size_t i) const |
returns the i-th point contained in the polyline | |
SegmentIterator | begin () const |
SegmentIterator | end () const |
std::vector< Point * > const & | getPointsVec () const |
double | getDistanceAlongPolyline (const MathLib::Point3d &pnt, const double epsilon_radius) const |
Public Member Functions inherited from GeoLib::GeoObject | |
virtual | ~GeoObject ()=default |
Static Public Member Functions | |
static Polyline * | constructPolylineFromSegments (const std::vector< Polyline * > &ply_vec, double prox=0.0) |
Protected Member Functions | |
void | reverseOrientation () |
std::vector< std::size_t > const & | getPolylinePointIDs () const |
Protected Attributes | |
const std::vector< Point * > & | _ply_pnts |
Private Member Functions | |
LineSegment | getSegment (std::size_t i) const |
Private Attributes | |
std::vector< std::size_t > | _ply_pnt_ids |
Friends | |
class | Polygon |
|
explicit |
constructor
pnt_vec | a reference to the point vector |
Definition at line 28 of file Polyline.cpp.
Referenced by constructPolylineFromSegments().
GeoLib::Polyline::Polyline | ( | const Polyline & | ply | ) |
|
overridedefault |
|
virtual |
Adds an id of a point at the end of the polyline if and only if the resulting segment won't be empty. The id have to be inside the (internal) _ply_pnts
vector the polyline is based on.
true
. If the addition of the point would result in empty line segment false
is returned. Reimplemented in GeoLib::PolygonWithSegmentMarker, and GeoLib::PolylineWithSegmentMarker.
Definition at line 35 of file Polyline.cpp.
References _ply_pnt_ids, and _ply_pnts.
Referenced by GeoLib::PolygonWithSegmentMarker::addPoint(), GeoLib::PolylineWithSegmentMarker::addPoint(), closePolyline(), createPolyline(), insertPoint(), MeshGeoToolsLib::markNodesOutSideOfPolygon(), mergeGeometries(), FileIO::SwmmInterface::readLinksAsPolylines(), FileIO::Legacy::readPolylinePointVector(), and GeoLib::Polygon::splitPolygonAtPoint().
|
inline |
Definition at line 188 of file Polyline.h.
Referenced by GeoLib::computeAndInsertAllIntersectionPoints(), GeoLib::Polygon::getNextIntersectionPointPolygonLine(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPolylineInPolygon(), GeoLib::lineSegmentsIntersect(), and MeshGeoToolsLib::mapPolylineOnSurfaceMesh().
void GeoLib::Polyline::closePolyline | ( | ) |
Closes a polyline by adding a line segment that connects start- and end-point.
Definition at line 302 of file Polyline.cpp.
References addPoint(), ERR(), getNumberOfPoints(), getPointID(), and isClosed().
Referenced by GEOModels::connectPolylineSegments().
|
static |
Constructs one polyline from a vector of connected polylines. All polylines in this vector need to reference the same point vector.
Definition at line 190 of file Polyline.cpp.
References Polyline(), ERR(), and GeoLib::pointsAreIdentical().
Referenced by GEOModels::connectPolylineSegments().
|
inline |
Definition at line 190 of file Polyline.h.
References getNumberOfSegments().
Referenced by GeoLib::computeAndInsertAllIntersectionPoints(), GeoLib::Polygon::getNextIntersectionPointPolygonLine(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPolylineInPolygon(), GeoLib::lineSegmentsIntersect(), and MeshGeoToolsLib::mapPolylineOnSurfaceMesh().
double GeoLib::Polyline::getDistanceAlongPolyline | ( | const MathLib::Point3d & | pnt, |
const double | epsilon_radius ) const |
returns the distance along the polyline from the beginning of the polyline
pnt | the point on the polyline |
epsilon_radius | the epsilon |
Definition at line 315 of file Polyline.cpp.
References MathLib::Point3d::asEigenVector3d(), MathLib::calcProjPntToLineAndDists(), getNumberOfSegments(), and getPoint().
Referenced by MeshGeoToolsLib::MeshNodesAlongPolyline::MeshNodesAlongPolyline().
|
inlineoverridevirtual |
return a geometry type
Implements GeoLib::GeoObject.
Definition at line 105 of file Polyline.h.
References GeoLib::POLYLINE.
std::size_t GeoLib::Polyline::getNumberOfPoints | ( | ) | const |
returns the number of points, the number of segments is about one smaller
Definition at line 109 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by GEOModels::addNameForObjectPoints(), GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), closePolyline(), GeoLib::containsEdge(), GeoLib::EarClippingTriangulation::copyPolygonPoints(), FileIO::createSurface(), FileIO::createSurfaceWithEarClipping(), GeoLib::Polygon::ensureCCWOrientation(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPntInPolygon(), MeshGeoToolsLib::markNodesOutSideOfPolygon(), GeoLib::markUsedPoints(), GeoLib::GEOObjects::mergePolylines(), GeoLib::operator==(), GeoLib::resetPointIDs(), GeoLib::rotatePolygonPointsToXY(), and LinearEditDialog::setupDialog().
std::size_t GeoLib::Polyline::getNumberOfSegments | ( | ) | const |
Definition at line 114 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by end(), getDistanceAlongPolyline(), getSegment(), and GeoLib::lineSegmentsIntersect().
const Point * GeoLib::Polyline::getPoint | ( | std::size_t | i | ) | const |
returns the i-th point contained in the polyline
Definition at line 179 of file Polyline.cpp.
References _ply_pnt_ids, and _ply_pnts.
Referenced by GeoTreeModel::addChildren(), GeoLib::EarClippingTriangulation::copyPolygonPoints(), GeoLib::Polygon::ensureCCWOrientation(), getDistanceAlongPolyline(), isCoplanar(), GeoLib::Polygon::isPartOfPolylineInPolygon(), GeoLib::Polygon::isPntInPolygon(), LinearEditDialog::on_comboBox_currentIndexChanged(), and GeoLib::rotatePolygonPointsToXY().
std::size_t GeoLib::Polyline::getPointID | ( | std::size_t const | i | ) | const |
returns the index of the i-th polyline point in the point vector
Definition at line 160 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by GeoLib::EarClippingTriangulation::EarClippingTriangulation(), GeoTreeModel::addChildren(), GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), closePolyline(), GeoLib::containsEdge(), FileIO::createSurface(), GeoLib::markUsedPoints(), mergeGeometries(), GeoLib::GEOObjects::mergePolylines(), GeoLib::operator==(), GeoLib::resetPointIDs(), FileIO::GMSH::GMSHPolygonTree::writeLineLoop(), and FileIO::GMSH::GMSHPolygonTree::writeSubPolygonsAsLineConstraints().
std::vector< Point * > const & GeoLib::Polyline::getPointsVec | ( | ) | const |
Definition at line 185 of file Polyline.cpp.
References _ply_pnts.
Referenced by GeoLib::EarClippingTriangulation::EarClippingTriangulation(), FileIO::createSurface(), FileIO::createSurfaceWithEarClipping(), GeoLib::markUsedPoints(), GeoLib::resetPointIDs(), and GeoLib::Polygon::splitPolygonAtIntersection().
|
inlineprotected |
Definition at line 215 of file Polyline.h.
References _ply_pnt_ids.
|
private |
Definition at line 166 of file Polyline.cpp.
References _ply_pnt_ids, _ply_pnts, and getNumberOfSegments().
|
virtual |
Method inserts a new point (that have to be inside the _ply_pnts vector) at the given position in the polyline if and only if the resulting segments won't be empty.
pos | the position in the polyline, pos have to be a value into the interval [0, number of points) |
pnt_id | the id of the new point in the vector of points the polyline is based on |
Reimplemented in GeoLib::PolygonWithSegmentMarker, and GeoLib::PolylineWithSegmentMarker.
Definition at line 55 of file Polyline.cpp.
References _ply_pnt_ids, _ply_pnts, and addPoint().
Referenced by GeoLib::computeAndInsertAllIntersectionPoints(), GeoLib::PolygonWithSegmentMarker::insertPoint(), GeoLib::PolylineWithSegmentMarker::insertPoint(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), and MeshGeoToolsLib::insertSubSegments().
bool GeoLib::Polyline::isClosed | ( | ) | const |
returns true if the polyline is closed
Definition at line 119 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by closePolyline(), FileIO::createSurface(), FileIO::createSurfaceWithEarClipping(), GeoLib::Polygon::initialise(), main(), anonymous_namespace{BoundaryElementsAlongPolyline.cpp}::modifyEdgeNodeOrdering(), and FileIO::FEFLOWMeshInterface::setMaterialIDs().
bool GeoLib::Polyline::isCoplanar | ( | ) | const |
returns true if the polyline is coplanar
Definition at line 129 of file Polyline.cpp.
References _ply_pnt_ids, DBUG(), getPoint(), and MathLib::isCoplanar().
bool GeoLib::Polyline::isPointIDInPolyline | ( | std::size_t | pnt_id | ) | const |
Method tests if the given id of a point (within the vector of points the polyline is based on) is inside the polyline.
pnt_id | the id of the point |
Definition at line 154 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by FileIO::GMSH::GMSHPolygonTree::insertPolyline().
void GeoLib::Polyline::removePoint | ( | std::size_t | pos | ) |
Method removes a point from the polyline. The connecting line segments will be removed and the length of the polyline will be changed.
pos | a valid position within the polyline |
Definition at line 97 of file Polyline.cpp.
References _ply_pnt_ids.
|
protected |
Definition at line 356 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by GeoLib::Polygon::ensureCCWOrientation().
void GeoLib::Polyline::setPointID | ( | std::size_t | idx, |
std::size_t | id ) |
Changes a point index for one point in a line
idx | Index of point in line |
id | ID of point in PointVec object |
Definition at line 173 of file Polyline.cpp.
References _ply_pnt_ids.
Referenced by GeoLib::resetPointIDs().
|
friend |
Definition at line 90 of file Polyline.h.
Referenced by GeoLib::Polygon::Polygon(), and GeoLib::Polygon::splitPolygonAtPoint().
|
private |
position of pointers to the geometric points
Definition at line 222 of file Polyline.h.
Referenced by addPoint(), getNumberOfPoints(), getNumberOfSegments(), getPoint(), getPointID(), getPolylinePointIDs(), getSegment(), insertPoint(), isClosed(), isCoplanar(), isPointIDInPolyline(), removePoint(), reverseOrientation(), and setPointID().
|
protected |
a reference to the vector of pointers to the geometric points
Definition at line 211 of file Polyline.h.
Referenced by addPoint(), getPoint(), getPointsVec(), getSegment(), insertPoint(), and GeoLib::Polygon::splitPolygonAtIntersection().