LengthLocationMap.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions 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: linearref/LengthLocationMap.java r463
*
**********************************************************************/
#pragma once
#include <geos/geom/Coordinate.h>
#include <geos/geom/Geometry.h>
#include <geos/linearref/LinearLocation.h>
namespace geos {
namespace linearref { // geos::linearref
class LengthLocationMap {
private:
const geom::Geometry* linearGeom;
LinearLocation getLocationForward(double length) const;
LinearLocation resolveHigher(const LinearLocation& loc) const;
public:
// TODO: cache computed cumulative length for each vertex
// TODO: support user-defined measures
// TODO: support measure index for fast mapping to a location
static LinearLocation
getLocation(const geom::Geometry* linearGeom, double length)
{
LengthLocationMap locater(linearGeom);
return locater.getLocation(length);
}
static LinearLocation
getLocation(const geom::Geometry* linearGeom, double length, bool resolveLower)
{
LengthLocationMap locater(linearGeom);
return locater.getLocation(length, resolveLower);
}
static double getLength(const geom::Geometry* linearGeom, const LinearLocation& loc);
LengthLocationMap(const geom::Geometry* linearGeom);
LinearLocation getLocation(double length, bool resolveLower) const;
LinearLocation getLocation(double length) const;
double getLength(const LinearLocation& loc) const;
};
} // geos.linearref
} // geos
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::linearref::LengthLocationMap::getLocation
static LinearLocation getLocation(const geom::Geometry *linearGeom, double length, bool resolveLower)
Computes the LinearLocation for a given length along a linear [Geometry].
Definition LengthLocationMap.h:81
geos::linearref::LengthLocationMap::getLength
static double getLength(const geom::Geometry *linearGeom, const LinearLocation &loc)
geos::linearref::LengthLocationMap::getLocation
static LinearLocation getLocation(const geom::Geometry *linearGeom, double length)
Computes the LinearLocation for a given length along a linear Geometry.
Definition LengthLocationMap.h:63
geos::linearref::LengthLocationMap::getLocation
LinearLocation getLocation(double length) const
Compute the LinearLocation corresponding to a length.
geos::linearref::LengthLocationMap::getLocation
LinearLocation getLocation(double length, bool resolveLower) const
Compute the LinearLocation corresponding to a length.
geos::linearref::LinearLocation
Represents a location along a LineString or MultiLineString.
Definition LinearLocation.h:43
geos::linearref
Contains classes and interfaces implementing linear referencing on linear geometries.
Definition ExtractLineByLocation.h:27
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38