[geos-commits] r2889 - in trunk: . tests/unit/linearref

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Jan 27 17:09:49 EST 2010


Author: mloskot
Date: 2010-01-27 17:09:45 -0500 (Wed, 27 Jan 2010)
New Revision: 2889

Modified:
   trunk/CMakeLists.txt
   trunk/tests/unit/linearref/LengthIndexedLineTest.cpp
Log:
Fixed CMake configuration for the problem about unavailable C99 features if -std=c99 is not specified for GCC 4.3.3 on Ubuntu 9.04. This is inconsistent behaviour with GCC 4.4.1 (https://bugs.launchpad.net/ubuntu/+source/gcc-4.3/+bug/512741).

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2010-01-23 02:43:18 UTC (rev 2888)
+++ trunk/CMakeLists.txt	2010-01-27 22:09:45 UTC (rev 2889)
@@ -72,6 +72,9 @@
 
   # General options
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -ansi")
+  
+  #add_definitions(_ISOC99_SOURCE)
+  set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_ISOC99_SOURCE=1")
 
   # Warnings specification
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long")
@@ -165,10 +168,12 @@
 endif()
 
 check_prototype_exists(isfinite cmath HAVE_STD_ISFINITE)
+
 if(NOT HAVE_STD_ISFINITE)
   if(MSVC)
     check_prototype_exists(_finite float.h HAVE_FINITE)
   else()
+    #CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
     check_symbol_exists(isfinite math.h HAVE_ISFINITE)
   endif()
 endif()

Modified: trunk/tests/unit/linearref/LengthIndexedLineTest.cpp
===================================================================
--- trunk/tests/unit/linearref/LengthIndexedLineTest.cpp	2010-01-23 02:43:18 UTC (rev 2888)
+++ trunk/tests/unit/linearref/LengthIndexedLineTest.cpp	2010-01-27 22:09:45 UTC (rev 2889)
@@ -31,386 +31,365 @@
 
 namespace tut {
 
-	typedef auto_ptr<Geometry> GeomPtr;
-        static const double TOLERANCE_DIST = 0.001;
+    typedef auto_ptr<Geometry> GeomPtr;
+    static const double TOLERANCE_DIST = 0.001;
 
-	struct test_lengthindexedline_data {
+    struct test_lengthindexedline_data
+    {
+      test_lengthindexedline_data()
+          : pm(), gf(&pm), reader(&gf)
+      {}
 
-	test_lengthindexedline_data()
-		:
-		pm(),
-		gf(&pm),
-		reader(&gf)
-	{
-	}
+      PrecisionModel pm;
+      GeometryFactory gf;
+      geos::io::WKTReader reader;
 
-	PrecisionModel pm;
-	GeometryFactory gf;
-        geos::io::WKTReader reader;
-  
-  void checkExpected(Geometry* result, const string expected)
-  {
-    GeomPtr subLine(reader.read(expected));
-    ensure_equals_geometry(subLine.get(), result);
-  }
+      void checkExpected(Geometry* result, string const& expected)
+      {
+          GeomPtr subLine(reader.read(expected));
+          ensure_equals_geometry(subLine.get(), result);
+      }
+      
+      void checkExpected(Geometry* result, const Geometry* expected)
+      {
+          ensure_equals_geometry(expected, result);
+      }
+      
+      void runIndicesOfThenExtract(string const& inputStr, string const& subLineStr)
+      {
+          GeomPtr input(reader.read(inputStr));
+          GeomPtr subLine(reader.read(subLineStr));
+          GeomPtr result(indicesOfThenExtract(input.get(), subLine.get()));
+          
+          checkExpected(result.get(), subLine.get());
+      }
 
-  void checkExpected(Geometry* result, const Geometry* expected)
-  {
-    ensure_equals_geometry(expected, result);
-  }
+        bool indexOfAfterCheck(Geometry* linearGeom, Coordinate testPt)
+        {
+            LengthIndexedLine indexedLine(linearGeom);
+            
+            // check locations are consecutive
+            double loc1 = indexedLine.indexOf(testPt);
+            double loc2 = indexedLine.indexOfAfter(testPt, loc1);
+            if (loc2 <= loc1) return false;
+            
+            // check extracted points are the same as the input
+            Coordinate pt1 = indexedLine.extractPoint(loc1);
+            Coordinate pt2 = indexedLine.extractPoint(loc2);
+            if (! pt1.equals2D(testPt)) return false;
+            if (! pt2.equals2D(testPt)) return false;
+            
+            return true;
+        }
 
-  void runIndicesOfThenExtract(string inputStr,
-    string subLineStr)
-  {
-    GeomPtr input(reader.read(inputStr));
-    GeomPtr subLine(reader.read(subLineStr));
-    GeomPtr result(indicesOfThenExtract(input.get(), subLine.get()));
+        void runIndexOfAfterTest(string const& inputStr, string const& testPtWKT)
+        {
+            GeomPtr input(reader.read(inputStr));
+            GeomPtr testPoint(reader.read(testPtWKT));
+            const Coordinate* testPt = testPoint->getCoordinate();
+            bool resultOK = indexOfAfterCheck(input.get(), *testPt);
+            ensure(resultOK);
+        }
 
-    checkExpected(result.get(), subLine.get());
-  }
+        void runOffsetTest(string const& inputWKT, string const& testPtWKT,
+                           double offsetDistance, string const& expectedPtWKT)
+        {
+            GeomPtr input(reader.read(inputWKT));
+            GeomPtr testPoint(reader.read(testPtWKT));
+            GeomPtr expectedPoint(reader.read(expectedPtWKT));
+            const Coordinate* testPt = testPoint->getCoordinate();
+            const Coordinate* expectedPt = expectedPoint->getCoordinate();
+            Coordinate offsetPt = extractOffsetAt(input.get(), *testPt, offsetDistance);
+            
+            bool isOk = offsetPt.distance(*expectedPt) < TOLERANCE_DIST;
+            if (! isOk)
+                cout << "Expected = " << *expectedPoint << "  Actual = " << offsetPt << endl;
+            ensure(isOk);
+        }
 
+        Coordinate extractOffsetAt(Geometry* linearGeom, Coordinate testPt, double offsetDistance)
+        {
+            LengthIndexedLine indexedLine(linearGeom);
+            double index = indexedLine.indexOf(testPt);
+            return indexedLine.extractPoint(index, offsetDistance);
+        }
+        
+        void checkExtractLine(const char* wkt, double start, double end, const char* expected)
+        {
+            string wktstr(wkt);
+            GeomPtr linearGeom(reader.read(wktstr));
+            LengthIndexedLine indexedLine(linearGeom.get());
+            GeomPtr result(indexedLine.extractLine(start, end));
+            checkExpected(result.get(), expected);
+        }
+        
+        
+        Geometry* indicesOfThenExtract(Geometry* linearGeom, Geometry* subLine)
+        {
+            LengthIndexedLine indexedLine(linearGeom);
+            double* loc = indexedLine.indicesOf(subLine);
+            Geometry* result = indexedLine.extractLine(loc[0], loc[1]);
+            delete [] loc;
+            return result;
+        }
+        
+    }; // struct test_lengthindexedline_data
 
-/*
-  // example of indicesOfThenLocate method
-  private Geometry indicesOfThenLocate(LineString input, LineString subLine)
-  {
-    LocationIndexedLine indexedLine = new LocationIndexedLine(input);
-    LineStringLocation[] loc = indexedLine.indicesOf(subLine);
-    Geometry result = indexedLine.locate(loc[0], loc[1]);
-    return result;
-  }
-*/
-
-  bool indexOfAfterCheck(Geometry* linearGeom, Coordinate testPt)
-  {
-    LengthIndexedLine indexedLine(linearGeom);
+    typedef test_group<test_lengthindexedline_data> group;
+    typedef group::object object;
     
-    // check locations are consecutive
-    double loc1 = indexedLine.indexOf(testPt);
-    double loc2 = indexedLine.indexOfAfter(testPt, loc1);
-    if (loc2 <= loc1) return false;
+    group test_lengthindexedline_group("geos::linearref::LocationIndexedLine");
     
-    // check extracted points are the same as the input
-    Coordinate pt1 = indexedLine.extractPoint(loc1);
-    Coordinate pt2 = indexedLine.extractPoint(loc2);
-    if (! pt1.equals2D(testPt)) return false;
-    if (! pt2.equals2D(testPt)) return false;
-    
-    return true;
+    //1 - testML
+    template<>
+  template<>
+  void object::test<1>()
+  {
+      runIndicesOfThenExtract("MULTILINESTRING ((0 0, 10 10), (20 20, 30 30))",
+                            "MULTILINESTRING ((1 1, 10 10), (20 20, 25 25))");
   }
 
 
-  void runIndexOfAfterTest(string inputStr,
-      string testPtWKT)
-    {
-      GeomPtr input(reader.read(inputStr));
-      GeomPtr testPoint(reader.read(testPtWKT));
-      const Coordinate* testPt = testPoint->getCoordinate();
-      bool resultOK = indexOfAfterCheck(input.get(), *testPt);
-      ensure(resultOK);
-    }
-  
-  
-  void runOffsetTest(const string inputWKT,
-  		const string testPtWKT, double offsetDistance, string expectedPtWKT)
-    {
-      GeomPtr input(reader.read(inputWKT));
-      GeomPtr testPoint(reader.read(testPtWKT));
-      GeomPtr expectedPoint(reader.read(expectedPtWKT));
-      const Coordinate* testPt = testPoint->getCoordinate();
-      const Coordinate* expectedPt = expectedPoint->getCoordinate();
-      Coordinate offsetPt = extractOffsetAt(input.get(), *testPt, offsetDistance);
-      
-      bool isOk = offsetPt.distance(*expectedPt) < TOLERANCE_DIST;
-      if (! isOk)
-	cout << "Expected = " << *expectedPoint << "  Actual = " << offsetPt << endl;
-      ensure(isOk);
-    }
-  
-	  
-    Coordinate extractOffsetAt(Geometry* linearGeom, Coordinate testPt, double offsetDistance)
-	  {
-	    LengthIndexedLine indexedLine(linearGeom);
-	    double index = indexedLine.indexOf(testPt);
-	    return indexedLine.extractPoint(index, offsetDistance);
-	  }
-
-	  void checkExtractLine(const char* wkt, double start, double end, const char* expected)
+      //2 - testPartOfSegmentNoVertex
+  template<>
+  template<>
+  void object::test<2>() 
   {
-    string wktstr(wkt);
-    GeomPtr linearGeom(reader.read(wktstr));
-    LengthIndexedLine indexedLine(linearGeom.get());
-    GeomPtr result(indexedLine.extractLine(start, end));
-    checkExpected(result.get(), expected);
-  }
+  runIndicesOfThenExtract("LINESTRING (0 0, 10 10, 20 20)",
+          "LINESTRING (1 1, 9 9)");
+}
 
-  
-  Geometry* indicesOfThenExtract(Geometry* linearGeom, Geometry* subLine)
-  {
-    LengthIndexedLine indexedLine(linearGeom);
-    double* loc = indexedLine.indicesOf(subLine);
-    Geometry* result = indexedLine.extractLine(loc[0], loc[1]);
-    delete [] loc;
-    return result;
-  }
+//3 - testPartOfSegmentContainingVertex()
+  template<>
+  template<>
+  void object::test<3>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 10 10, 20 20)",
+          "LINESTRING (5 5, 10 10, 15 15)");
+}
 
-};
-	typedef test_group<test_lengthindexedline_data> group;
-	typedef group::object object;
+/**
+ * Tests that duplicate coordinates are handled correctly.
+ *
+ * @throws Exception
+ */
+// 4 - testPartOfSegmentContainingDuplicateCoords
+  template<>
+  template<>
+  void object::test<4>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 10 10, 10 10, 20 20)",
+          "LINESTRING (5 5, 10 10, 10 10, 15 15)");
+}
 
-	group test_lengthindexedline_group(
-		"geos::linearref::LocationIndexedLine");
+/**
+ * Following tests check that correct portion of loop is identified.
+ * This requires that the correct vertex for (0,0) is selected.
+ */
 
-        //1 - testML
-	template<>
-	template<>
-	void object::test<1>()
-	{
-	  runIndicesOfThenExtract("MULTILINESTRING ((0 0, 10 10), (20 20, 30 30))",
-				  "MULTILINESTRING ((1 1, 10 10), (20 20, 25 25))");
+//5 - testLoopWithStartSubLine
+  template<>
+  template<>
+  void object::test<5>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
+          "LINESTRING (0 0, 0 10, 10 10)");
 }
 
+//6 - testLoopWithEndingSubLine()
+  template<>
+  template<>
+  void object::test<6>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
+          "LINESTRING (10 10, 10 0, 0 0)");
+}
 
-        //2 - testPartOfSegmentNoVertex
-	template<>
-	template<>
-	void object::test<2>() 
-	{
-    runIndicesOfThenExtract("LINESTRING (0 0, 10 10, 20 20)",
-            "LINESTRING (1 1, 9 9)");
-  }
+// test a subline equal to the parent loop
+//7 - testLoopWithIdenticalSubLine()
+  template<>
+  template<>
+  void object::test<7>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
+          "LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)");
+}
 
-  //3 - testPartOfSegmentContainingVertex()
-	template<>
-	template<>
-	void object::test<3>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 10 10, 20 20)",
-            "LINESTRING (5 5, 10 10, 15 15)");
-  }
+// test a zero-length subline equal to the start point
+//8 - testZeroLenSubLineAtStart()
+  template<>
+  template<>
+  void object::test<8>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
+          "LINESTRING (0 0, 0 0)");
+}
 
-  /**
-   * Tests that duplicate coordinates are handled correctly.
-   *
-   * @throws Exception
-   */
-  // 4 - testPartOfSegmentContainingDuplicateCoords
-	template<>
-	template<>
-	void object::test<4>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 10 10, 10 10, 20 20)",
-            "LINESTRING (5 5, 10 10, 10 10, 15 15)");
-  }
+// test a zero-length subline equal to a mid point
+//9 - testZeroLenSubLineAtMidVertex()
+  template<>
+  template<>
+  void object::test<9>() 
+{
+  runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
+          "LINESTRING (10 10, 10 10)");
+}
 
-  /**
-   * Following tests check that correct portion of loop is identified.
-   * This requires that the correct vertex for (0,0) is selected.
-   */
+//10 - testIndexOfAfterSquare()
+  template<>
+  template<>
+  void object::test<10>() 
+{
+  runIndexOfAfterTest("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)", 
+          "POINT (0 0)");
+}
 
-  //5 - testLoopWithStartSubLine
-	template<>
-	template<>
-	void object::test<5>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
-            "LINESTRING (0 0, 0 10, 10 10)");
-  }
+//11 - testIndexOfAfterRibbon()
+  template<>
+  template<>
+  void object::test<11>() 
+{
+  runIndexOfAfterTest("LINESTRING (0 0, 0 60, 50 60, 50 20, -20 20)", 
+          "POINT (0 20)");
+}
 
-  //6 - testLoopWithEndingSubLine()
-	template<>
-	template<>
-	void object::test<6>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
-            "LINESTRING (10 10, 10 0, 0 0)");
-  }
+//12 -  testOffsetStartPoint()
+  template<>
+  template<>
+  void object::test<12>() 
+{
+  runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(0 0)", 1.0, "POINT (-0.7071067811865475 0.7071067811865475)");
+  runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(0 0)", -1.0, "POINT (0.7071067811865475 -0.7071067811865475)");
+  runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(10 10)", 5.0, "POINT (6.464466094067262 13.535533905932738)");
+  runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(10 10)", -5.0, "POINT (13.535533905932738 6.464466094067262)");
+}
 
-  // test a subline equal to the parent loop
-  //7 - testLoopWithIdenticalSubLine()
-	template<>
-	template<>
-	void object::test<7>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
-            "LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)");
-  }
 
-  // test a zero-length subline equal to the start point
-  //8 - testZeroLenSubLineAtStart()
-	template<>
-	template<>
-	void object::test<8>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
-            "LINESTRING (0 0, 0 0)");
-  }
+//13 - testExtractLineBeyondRange()
+  template<>
+  template<>
+  void object::test<13>() 
+{
+  checkExtractLine("LINESTRING (0 0, 10 10)", -100, 100, "LINESTRING (0 0, 10 10)");
+}
 
-  // test a zero-length subline equal to a mid point
-  //9 - testZeroLenSubLineAtMidVertex()
-	template<>
-	template<>
-	void object::test<9>() 
-  {
-    runIndicesOfThenExtract("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)",
-            "LINESTRING (10 10, 10 10)");
-  }
+//14 - testExtractLineReverse()
+  template<>
+  template<>
+  void object::test<14>() 
+{
+  checkExtractLine("LINESTRING (0 0, 10 0)", 9, 1, "LINESTRING (9 0, 1 0)");
+}
 
-  //10 - testIndexOfAfterSquare()
-	template<>
-	template<>
-	void object::test<10>() 
-  {
-  	runIndexOfAfterTest("LINESTRING (0 0, 0 10, 10 10, 10 0, 0 0)", 
-  			"POINT (0 0)");
-  }
-  
-  //11 - testIndexOfAfterRibbon()
-	template<>
-	template<>
-	void object::test<11>() 
-  {
-  	runIndexOfAfterTest("LINESTRING (0 0, 0 60, 50 60, 50 20, -20 20)", 
-  			"POINT (0 20)");
-  }
-  
-  //12 -  testOffsetStartPoint()
-	template<>
-	template<>
-	void object::test<12>() 
-  {
-  	runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(0 0)", 1.0, "POINT (-0.7071067811865475 0.7071067811865475)");
-  	runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(0 0)", -1.0, "POINT (0.7071067811865475 -0.7071067811865475)");
-  	runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(10 10)", 5.0, "POINT (6.464466094067262 13.535533905932738)");
-  	runOffsetTest("LINESTRING (0 0, 10 10, 10 10, 20 20)", "POINT(10 10)", -5.0, "POINT (13.535533905932738 6.464466094067262)");
-  }
+//15 - testExtractLineReverseMulti()
+  template<>
+  template<>
+  void object::test<15>() 
+{
+  checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
+                   19, 1, "MULTILINESTRING ((29 0, 25 0, 20 0), (10 0, 1 0))");
+}
 
+//16 - testExtractLineNegative()
+  template<>
+  template<>
+  void object::test<16>() 
+{
+  checkExtractLine("LINESTRING (0 0, 10 0)", -9, -1, "LINESTRING (1 0, 9 0)");
+}
 
-  //13 - testExtractLineBeyondRange()
-	template<>
-	template<>
-	void object::test<13>() 
-  {
-    checkExtractLine("LINESTRING (0 0, 10 10)", -100, 100, "LINESTRING (0 0, 10 10)");
-  }
+//17 - testExtractLineNegativeReverse()
+  template<>
+  template<>
+  void object::test<17>() 
+{
+  checkExtractLine("LINESTRING (0 0, 10 0)", -1, -9, "LINESTRING (9 0, 1 0)");
+}
 
-  //14 - testExtractLineReverse()
-	template<>
-	template<>
-	void object::test<14>() 
-  {
-    checkExtractLine("LINESTRING (0 0, 10 0)", 9, 1, "LINESTRING (9 0, 1 0)");
-  }
+//18 - testExtractLineIndexAtEndpoint()
+  template<>
+  template<>
+  void object::test<18>() 
+{
+  checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
+                   10, -1, "LINESTRING (20 0, 25 0, 29 0)");
+}
 
-  //15 - testExtractLineReverseMulti()
-	template<>
-	template<>
-	void object::test<15>() 
-  {
-    checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
-                     19, 1, "MULTILINESTRING ((29 0, 25 0, 20 0), (10 0, 1 0))");
-  }
+//19 - testExtractLineBothIndicesAtEndpoint()
+  template<>
+  template<>
+  void object::test<19>() 
+{
+  checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
+                   10, 10, "LINESTRING (20 0, 20 0)");
+}
 
-  //16 - testExtractLineNegative()
-	template<>
-	template<>
-	void object::test<16>() 
-  {
-    checkExtractLine("LINESTRING (0 0, 10 0)", -9, -1, "LINESTRING (1 0, 9 0)");
-  }
+//20 - testExtractLineBothIndicesAtEndpointNegative()
+  template<>
+  template<>
+  void object::test<20>() 
+{
+  checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
+                   -10, 10, "LINESTRING (20 0, 20 0)");
+}
 
-  //17 - testExtractLineNegativeReverse()
-	template<>
-	template<>
-	void object::test<17>() 
-  {
-    checkExtractLine("LINESTRING (0 0, 10 0)", -1, -9, "LINESTRING (9 0, 1 0)");
-  }
+//21 - testExtractPointBeyondRange()
+  template<>
+  template<>
+  void object::test<21>() 
+{
+  GeomPtr linearGeom(reader.read("LINESTRING (0 0, 10 10)"));
+  LengthIndexedLine indexedLine(linearGeom.get());
+  Coordinate pt = indexedLine.extractPoint(100);
+  ensure(pt == Coordinate(10, 10));
 
-  //18 - testExtractLineIndexAtEndpoint()
-	template<>
-	template<>
-	void object::test<18>() 
-  {
-    checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
-                     10, -1, "LINESTRING (20 0, 25 0, 29 0)");
-  }
+  Coordinate pt2 = indexedLine.extractPoint(0);
+  ensure(pt2 == Coordinate(0, 0));
+}
 
-  //19 - testExtractLineBothIndicesAtEndpoint()
-	template<>
-	template<>
-	void object::test<19>() 
-  {
-    checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
-                     10, 10, "LINESTRING (20 0, 20 0)");
-  }
+//22 - testProjectPointWithDuplicateCoords()
+  template<>
+  template<>
+  void object::test<22>() 
+{
+  GeomPtr linearGeom(reader.read("LINESTRING (0 0, 10 0, 10 0, 20 0)"));
+  LengthIndexedLine indexedLine(linearGeom.get());
+  double projIndex = indexedLine.project(Coordinate(10, 1));
+  ensure(projIndex == 10.0);
+}
 
-  //20 - testExtractLineBothIndicesAtEndpointNegative()
-	template<>
-	template<>
-	void object::test<20>() 
-  {
-    checkExtractLine("MULTILINESTRING ((0 0, 10 0), (20 0, 25 0, 30 0))",
-                     -10, 10, "LINESTRING (20 0, 20 0)");
-  }
+/**
+ * Tests that z values are interpolated
+ *
+ */
+//23 - testComputeZ()
+  template<>
+  template<>
+  void object::test<23>() 
+{
+  GeomPtr linearGeom(reader.read("LINESTRING (0 0 0, 10 10 10)"));
+  LengthIndexedLine indexedLine(linearGeom.get());
+  double projIndex = indexedLine.project(Coordinate(5, 5));
+  Coordinate projPt = indexedLine.extractPoint(projIndex);
+//    System.out.println(projPt);
+  ensure(projPt.equals3D(Coordinate(5, 5, 5)));  
+}
 
-  //21 - testExtractPointBeyondRange()
-	template<>
-	template<>
-	void object::test<21>() 
-  {
-    GeomPtr linearGeom(reader.read("LINESTRING (0 0, 10 10)"));
-    LengthIndexedLine indexedLine(linearGeom.get());
-    Coordinate pt = indexedLine.extractPoint(100);
-    ensure(pt == Coordinate(10, 10));
+/**
+ * Tests that if the input does not have Z ordinates, neither does the output.
+ *
+ */
+//24 - testComputeZNaN()
+  template<>
+  template<>
+  void object::test<24>() 
+{
 
-    Coordinate pt2 = indexedLine.extractPoint(0);
-    ensure(pt2 == Coordinate(0, 0));
-  }
+  GeomPtr linearGeom(reader.read("LINESTRING (0 0, 10 10 10)"));
+  LengthIndexedLine indexedLine(linearGeom.get());
+  double projIndex = indexedLine.project(Coordinate(5, 5));
+  Coordinate projPt = indexedLine.extractPoint(projIndex);
+  ensure(0 != ISNAN(projPt.z));
+}
 
-  //22 - testProjectPointWithDuplicateCoords()
-	template<>
-	template<>
-	void object::test<22>() 
-  {
-    GeomPtr linearGeom(reader.read("LINESTRING (0 0, 10 0, 10 0, 20 0)"));
-    LengthIndexedLine indexedLine(linearGeom.get());
-    double projIndex = indexedLine.project(Coordinate(10, 1));
-    ensure(projIndex == 10.0);
-  }
-
-  /**
-   * Tests that z values are interpolated
-   *
-   */
-  //23 - testComputeZ()
-	template<>
-	template<>
-	void object::test<23>() 
-  {
-    GeomPtr linearGeom(reader.read("LINESTRING (0 0 0, 10 10 10)"));
-	LengthIndexedLine indexedLine(linearGeom.get());
-    double projIndex = indexedLine.project(Coordinate(5, 5));
-    Coordinate projPt = indexedLine.extractPoint(projIndex);
-//    System.out.println(projPt);
-    ensure(projPt.equals3D(Coordinate(5, 5, 5)));  
-  }
-  
-  /**
-   * Tests that if the input does not have Z ordinates, neither does the output.
-   *
-   */
-  //24 - testComputeZNaN()
-	template<>
-	template<>
-	void object::test<24>() 
-  {
-  	
-    GeomPtr linearGeom(reader.read("LINESTRING (0 0, 10 10 10)"));
-    LengthIndexedLine indexedLine(linearGeom.get());
-    double projIndex = indexedLine.project(Coordinate(5, 5));
-    Coordinate projPt = indexedLine.extractPoint(projIndex);
-    ensure(0 != ISNAN(projPt.z));
-  }
-
 }



More information about the geos-commits mailing list