[geos-commits] r2699 - in trunk/source: headers/geos/linearref linearref

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Oct 23 08:58:49 EDT 2009


Author: strk
Date: 2009-10-23 08:58:48 -0400 (Fri, 23 Oct 2009)
New Revision: 2699

Modified:
   trunk/source/headers/geos/linearref/LinearLocation.h
   trunk/source/linearref/LinearLocation.cpp
Log:
Fix port info, add standard protection notes


Modified: trunk/source/headers/geos/linearref/LinearLocation.h
===================================================================
--- trunk/source/headers/geos/linearref/LinearLocation.h	2009-10-23 10:21:15 UTC (rev 2698)
+++ trunk/source/headers/geos/linearref/LinearLocation.h	2009-10-23 12:58:48 UTC (rev 2699)
@@ -27,14 +27,13 @@
 #include <geos/geom/Geometry.h>
 #include <geos/geom/LineSegment.h>
 
-namespace geos
-{
-namespace linearref   // geos::linearref
-{
+namespace geos {
+namespace linearref { // geos::linearref
 
 
-/**
+/** \brief
  * Represents a location along a {@link LineString} or {@link MultiLineString}.
+ *
  * The referenced geometry is not maintained within
  * this location, but must be provided for operations which require it.
  * Various methods are provided to manipulate the location value
@@ -71,8 +70,8 @@
 	 * point of the segment is returned.
 	 * If the fraction is less than or equal to 0.0 the first point
 	 * of the segment is returned.
-	 * The Z ordinate is interpolated from the Z-ordinates of the given points,
-	 * if they are specified.
+	 * The Z ordinate is interpolated from the Z-ordinates of
+	 * the given points, if they are specified.
 	 *
 	 * @param p0 the first point of the line segment
 	 * @param p1 the last point of the line segment
@@ -85,7 +84,6 @@
 	/**
 	 * Creates a location referring to the start of a linear geometry
 	 */
-
 	LinearLocation(unsigned int segmentIndex = 0, double segmentFraction = 0.0);
 
 	LinearLocation(unsigned int componentIndex, unsigned int segmentIndex, double segmentFraction);
@@ -115,6 +113,7 @@
 	 * @return the length of the segment
 	 */
 	double getSegmentLength(const geom::Geometry* linearGeom) const;
+
 	/**
 	 * Sets the value of this location to
 	 * refer the end of a linear geometry
@@ -232,7 +231,7 @@
 };
 
 
-}
-}
+} // namespace geos.linearref
+} // namespace geos
 
 #endif

Modified: trunk/source/linearref/LinearLocation.cpp
===================================================================
--- trunk/source/linearref/LinearLocation.cpp	2009-10-23 10:21:15 UTC (rev 2698)
+++ trunk/source/linearref/LinearLocation.cpp	2009-10-23 12:58:48 UTC (rev 2699)
@@ -14,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: linearref/LinearLocation.java rev. 1.35
+ * Last port: linearref/LinearLocation.java rev. 1.10
  *
  **********************************************************************/
 
@@ -27,12 +27,12 @@
 
 using namespace geos::geom;
 
-namespace geos
-{
-namespace linearref   // geos.linearref
-{
+namespace geos {
+namespace linearref { // geos::linearref
 
-LinearLocation LinearLocation::getEndLocation(const Geometry* linear)
+/* public static */
+LinearLocation
+LinearLocation::getEndLocation(const Geometry* linear)
 {
 	// assert: linear is LineString or MultiLineString
 	LinearLocation loc;
@@ -40,7 +40,9 @@
 	return loc;
 }
 
-Coordinate LinearLocation::pointAlongSegmentByFraction(const Coordinate& p0, const Coordinate& p1, double frac)
+/* public static */
+Coordinate
+LinearLocation::pointAlongSegmentByFraction(const Coordinate& p0, const Coordinate& p1, double frac)
 {
 	if (frac <= 0.0) return p0;
 	if (frac >= 1.0) return p1;
@@ -52,17 +54,30 @@
 	return Coordinate(x, y, z);
 }
 
-LinearLocation::LinearLocation(unsigned int segmentIndex, double segmentFraction) :
-		componentIndex(0), segmentIndex(segmentIndex), segmentFraction(segmentFraction) {}
+/* public */
+LinearLocation::LinearLocation(unsigned int segmentIndex,
+		double segmentFraction)
+	:
+	componentIndex(0),
+	segmentIndex(segmentIndex),
+	segmentFraction(segmentFraction)
+{}
 
 
-LinearLocation::LinearLocation(unsigned int componentIndex, unsigned int segmentIndex, double segmentFraction):
-		componentIndex(componentIndex), segmentIndex(segmentIndex), segmentFraction(segmentFraction)
+/* public */
+LinearLocation::LinearLocation(unsigned int componentIndex,
+		unsigned int segmentIndex, double segmentFraction)
+	:
+	componentIndex(componentIndex),
+	segmentIndex(segmentIndex),
+	segmentFraction(segmentFraction)
 {
 	normalize();
 }
 
-void LinearLocation::normalize()
+/* private */
+void
+LinearLocation::normalize()
 {
 	if (segmentFraction < 0.0)
 	{
@@ -91,9 +106,9 @@
 	}
 }
 
-
-
-void LinearLocation::clamp(const Geometry* linear)
+/* public */
+void
+LinearLocation::clamp(const Geometry* linear)
 {
 	if (componentIndex >= linear->getNumGeometries())
 	{
@@ -108,7 +123,9 @@
 	}
 }
 
-void LinearLocation::snapToVertex(const Geometry* linearGeom, double minDistance)
+/* public */
+void
+LinearLocation::snapToVertex(const Geometry* linearGeom, double minDistance)
 {
 	if (segmentFraction <= 0.0 || segmentFraction >= 1.0)
 		return;
@@ -125,7 +142,9 @@
 	}
 }
 
-double LinearLocation::getSegmentLength(const Geometry* linearGeom) const
+/* public */
+double
+LinearLocation::getSegmentLength(const Geometry* linearGeom) const
 {
 	const LineString* lineComp = dynamic_cast<const LineString*> (linearGeom->getGeometryN(componentIndex));
 
@@ -139,7 +158,9 @@
 	return p0.distance(p1);
 }
 
-void LinearLocation::setToEnd(const Geometry* linear)
+/* public */
+void
+LinearLocation::setToEnd(const Geometry* linear)
 {
 	componentIndex = linear->getNumGeometries() - 1;
 	const LineString* lastLine = dynamic_cast<const LineString*>(linear->getGeometryN(componentIndex));
@@ -147,27 +168,37 @@
 	segmentFraction = 1.0;
 }
 
-unsigned int LinearLocation::getComponentIndex() const
+/* public */
+unsigned int
+LinearLocation::getComponentIndex() const
 {
 	return componentIndex;
 }
 
-unsigned int LinearLocation::getSegmentIndex() const
+/* public */
+unsigned int
+LinearLocation::getSegmentIndex() const
 {
 	return segmentIndex;
 }
 
-double LinearLocation::getSegmentFraction() const
+/* public */
+double
+LinearLocation::getSegmentFraction() const
 {
 	return segmentFraction;
 }
 
-bool LinearLocation::isVertex() const
+/* public */
+bool
+LinearLocation::isVertex() const
 {
 	return segmentFraction <= 0.0 || segmentFraction >= 1.0;
 }
 
-Coordinate LinearLocation::getCoordinate(const Geometry* linearGeom) const
+/* public */
+Coordinate
+LinearLocation::getCoordinate(const Geometry* linearGeom) const
 {
 	const LineString* lineComp = dynamic_cast<const LineString *> (linearGeom->getGeometryN(componentIndex));
 	Coordinate p0 = lineComp->getCoordinateN(segmentIndex);
@@ -177,7 +208,9 @@
 	return pointAlongSegmentByFraction(p0, p1, segmentFraction);
 }
 
-LineSegment* LinearLocation::getSegment(const Geometry* linearGeom) const
+/* public */
+LineSegment*
+LinearLocation::getSegment(const Geometry* linearGeom) const
 {
 	const LineString* lineComp = dynamic_cast<const LineString *> (linearGeom->getGeometryN(componentIndex));
 	Coordinate p0 = lineComp->getCoordinateN(segmentIndex);
@@ -191,8 +224,9 @@
 	return new LineSegment(p0, p1);
 }
 
-
-bool LinearLocation::isValid(const Geometry* linearGeom) const
+/* public */
+bool
+LinearLocation::isValid(const Geometry* linearGeom) const
 {
 	if (componentIndex < 0 || componentIndex >= linearGeom->getNumGeometries())
 		return false;
@@ -208,8 +242,9 @@
 	return true;
 }
 
-
-int LinearLocation::compareTo(const LinearLocation& other) const
+/* public */
+int
+LinearLocation::compareTo(const LinearLocation& other) const
 {
 	// compare component indices
 	if (componentIndex < other.componentIndex) return -1;
@@ -224,8 +259,10 @@
 	return 0;
 }
 
-
-int LinearLocation::compareLocationValues(unsigned int componentIndex1, unsigned int segmentIndex1, double segmentFraction1) const
+/* public */
+int
+LinearLocation::compareLocationValues(unsigned int componentIndex1,
+		unsigned int segmentIndex1, double segmentFraction1) const
 {
 	// compare component indices
 	if (componentIndex < componentIndex1) return -1;
@@ -241,9 +278,13 @@
 }
 
 
-int LinearLocation::compareLocationValues(
-	unsigned int componentIndex0, unsigned int segmentIndex0, double segmentFraction0,
-	unsigned int componentIndex1, unsigned int segmentIndex1, double segmentFraction1)
+/* public */
+int
+LinearLocation::compareLocationValues(
+	unsigned int componentIndex0, unsigned int segmentIndex0,
+	double segmentFraction0,
+	unsigned int componentIndex1, unsigned int segmentIndex1,
+	double segmentFraction1)
 {
 	// compare component indices
 	if (componentIndex0 < componentIndex1) return -1;
@@ -259,7 +300,9 @@
 }
 
 
-bool LinearLocation::isOnSameSegment(const LinearLocation& loc) const
+/* public */
+bool
+LinearLocation::isOnSameSegment(const LinearLocation& loc) const
 {
 	if (componentIndex != loc.componentIndex) return false;
 	if (segmentIndex == loc.segmentIndex) return true;
@@ -279,6 +322,6 @@
 	       obj.segmentIndex << ", " << obj.segmentFraction << ")";
 }
 
-}
-}
+} // namespace geos.linearref
+} // namespace geos
 



More information about the geos-commits mailing list