Struct TObject2D
Defined in File TObject2D.h
Struct Documentation
-
struct TObject2D
A variant type for any lightweight 2D type: point, segment, line, polygon. Use provided helper method, or directly access the variant
data.See also
Public Types
-
using variant_t = std::variant<std::monostate, TPoint2D, TSegment2D, TLine2D, TPolygon2D>
Public Functions
-
~TObject2D() = default
-
inline bool isPoint() const
Checks whether content is a point.
-
inline bool isSegment() const
Checks whether content is a segment.
-
inline bool isLine() const
Checks whether content is a line.
-
inline bool isPolygon() const
Checks whether content is a polygon.
-
inline bool empty() const
-
template<typename T>
inline const T &getAs() const Gets the content as a given expected type (an exception will be thrown if type is wrong, check type first).
-
template<typename T>
inline T &getAs() This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline bool getPoint(TPoint2D &out) const
returns true if the objects is a point, and retrieves its value in
out. Prefer getAs(). This method was left in mrpt 2.3.0 for backwards compatibility.
-
inline bool getSegment(TSegment2D &out) const
returns true if the objects is a segment, and retrieves its value in
out. Prefer getAs(). This method was left in mrpt 2.3.0 for backwards compatibility.
-
inline bool getLine(TLine2D &out) const
returns true if the objects is a line, and retrieves its value in
out. Prefer getAs(). This method was left in mrpt 2.3.0 for backwards compatibility.
-
inline bool getPolygon(TPolygon2D &out) const
returns true if the objects is a TPolygon2D, and retrieves its value in
out. Prefer getAs(). This method was left in mrpt 2.3.0 for backwards compatibility.
-
std::string asString() const
Gets a string with the type and the parameters of the object.
emptyif not defined.Note
New in MRPT 2.3.0
-
using variant_t = std::variant<std::monostate, TPoint2D, TSegment2D, TLine2D, TPolygon2D>