OGS
PolygonWithSegmentMarker.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6namespace GeoLib
7{
9 GeoLib::Polyline const& polyline)
10 : GeoLib::Polygon(polyline, true),
11 _marker(polyline.getNumberOfPoints(), false)
12{
13}
14
15void PolygonWithSegmentMarker::markSegment(std::size_t seg_num, bool mark_val)
16{
17 _marker[seg_num] = mark_val;
18}
19
20bool PolygonWithSegmentMarker::isSegmentMarked(std::size_t seg_num) const
21{
22 return _marker[seg_num];
23}
24
25bool PolygonWithSegmentMarker::addPoint(std::size_t pnt_id)
26{
27 if (Polyline::addPoint(pnt_id))
28 {
29 _marker.push_back(false);
30 return true;
31 }
32 return false;
33}
34
35bool PolygonWithSegmentMarker::insertPoint(std::size_t pos, std::size_t pnt_id)
36{
37 if (Polyline::insertPoint(pos, pnt_id))
38 {
39 _marker.insert(_marker.begin() + pos, _marker[pos]);
40 return true;
41 }
42 return false;
43}
44
45} // namespace GeoLib
bool isSegmentMarked(std::size_t seg_num) const
PolygonWithSegmentMarker(GeoLib::Polyline const &polyline)
bool insertPoint(std::size_t pos, std::size_t pnt_id) override
bool addPoint(std::size_t pnt_id) override
void markSegment(std::size_t seg_num, bool mark_val=true)
Polygon(const Polyline &ply, bool init=true)
Definition Polygon.cpp:124
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:29
std::size_t getNumberOfPoints() const
Definition Polyline.cpp:98
virtual bool insertPoint(std::size_t pos, std::size_t pnt_id)
Definition Polyline.cpp:44
virtual bool addPoint(std::size_t pnt_id)
Definition Polyline.cpp:24