LineString.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2001-2002 Vivid Solutions Inc.
* Copyright (C) 2005 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: geom/LineString.java r320 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Geometry.h> // for inheritance
#include <geos/geom/CoordinateSequence.h> // for proper use of unique_ptr<>
#include <geos/geom/Envelope.h> // for proper use of unique_ptr<>
#include <geos/geom/Dimension.h> // for Dimension::DimensionType
#include <geos/geom/SimpleCurve.h>
#include <string>
#include <vector>
#include <memory> // for unique_ptr
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
namespace geos {
namespace geom {
class Coordinate;
class CoordinateSequenceFilter;
}
}
namespace geos {
namespace geom { // geos::geom
class GEOS_DLL LineString: public SimpleCurve {
public:
friend class GeometryFactory;
typedef std::vector<const LineString*> ConstVect;
~LineString() override;
std::unique_ptr<LineString> clone() const
{
return std::unique_ptr<LineString>(cloneImpl());
}
std::string getGeometryType() const override;
GeometryTypeId getGeometryTypeId() const override;
double getLength() const override;
bool isCurved() const override {
return false;
}
std::unique_ptr<LineString> reverse() const { return std::unique_ptr<LineString>(reverseImpl()); }
protected:
LineString(const LineString& ls);
LineString(CoordinateSequence::Ptr && pts,
const GeometryFactory& newFactory);
LineString* cloneImpl() const override { return new LineString(*this); }
LineString* reverseImpl() const override;
int
getSortIndex() const override
{
return SORTINDEX_LINESTRING;
};
void geometryChangedAction() override
{
envelope = computeEnvelopeInternal(true);
}
private:
void validateConstruction();
};
struct GEOS_DLL LineStringLT {
bool
operator()(const LineString* ls1, const LineString* ls2) const
{
return ls1->compareTo(ls2) < 0;
}
};
} // namespace geos::geom
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::geom::CoordinateSequenceFilter
Interface for classes which provide operations that can be applied to the coordinates in a Coordinate...
Definition CoordinateSequenceFilter.h:56
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::LineString
Definition LineString.h:66
geos::geom::LineString::reverseImpl
LineString * reverseImpl() const override
Make a geometry with coordinates in reverse order.
geos::geom::LineString::cloneImpl
LineString * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition LineString.h:117
geos::geom::LineString::getGeometryTypeId
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
geos::geom::LineString::reverse
std::unique_ptr< LineString > reverse() const
Definition LineString.h:105
geos::geom::LineString::ConstVect
std::vector< const LineString * > ConstVect
A vector of const LineString pointers.
Definition LineString.h:73
geos::geom::LineString::LineString
LineString(CoordinateSequence::Ptr &&pts, const GeometryFactory &newFactory)
Constructs a LineString taking ownership the given CoordinateSequence.
geos::geom::LineString::getLength
double getLength() const override
Returns the length of this Geometry.
geos::geom::LineString::getGeometryType
std::string getGeometryType() const override
Return a string representation of this Geometry type.
geos::geom::LineString::clone
std::unique_ptr< LineString > clone() const
Creates and returns a full copy of this LineString object (including all coordinates contained by it)...
Definition LineString.h:84
geos::geom::LineString::geometryChangedAction
void geometryChangedAction() override
Notifies this Geometry that its Coordinates have been changed by an external party.
Definition LineString.h:127
geos::geom
Definition Angle.h:26
geos::geom::GeometryTypeId
GeometryTypeId
Geometry types.
Definition Geometry.h:73
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38