Revision: 4932
          http://sourceforge.net/p/jump-pilot/code/4932
Author:   michaudm
Date:     2016-06-12 08:50:08 +0000 (Sun, 12 Jun 2016)
Log Message:
-----------
fix 2 bugs in CoverageCleanerPlugin which prevented some cases to be processed.

Modified Paths:
--------------
    plug-ins/TopologyPlugin/trunk/build.xml
    
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/boundarymatch/SegmentMatcher.java
    
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/coverage/CoverageFeature.java
    
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/qa/InternalMatchedSegmentFinder.java
    
plug-ins/TopologyPlugin/trunk/src/fr/michaelm/jump/plugin/topology/TopologyExtension.java

Modified: plug-ins/TopologyPlugin/trunk/build.xml
===================================================================
--- plug-ins/TopologyPlugin/trunk/build.xml     2016-06-07 13:20:45 UTC (rev 
4931)
+++ plug-ins/TopologyPlugin/trunk/build.xml     2016-06-12 08:50:08 UTC (rev 
4932)
@@ -17,8 +17,8 @@
     <property name="dist"    value="dist" />
     <property name="javadoc" value="javadoc" />
 
-    <property name="version" value="0.8.1" />
-    <property name="current-oj" 
value="C:\Users\Michaël\DEVELOPPEMENTS\OpenJUMP-2012\dist\openjump-1.6.0alpha\lib\ext"
 />
+    <property name="version" value="0.8.2" />
+    <!--property name="current-oj" 
value="C:\Users\Michaël\DEVELOPPEMENTS\OpenJUMP-2012\dist\openjump-1.6.0alpha\lib\ext"
 /-->
     
     <!-- =================================================================== 
-->
     <!-- Defines the classpath used for compilation and test.                
-->
@@ -65,7 +65,7 @@
         <jar basedir="${build}" jarfile="${dist}/topology-${version}.jar">
             <include name="**"/>
         </jar>
-        <copy file="${dist}/topology-${version}.jar" todir="${current-oj}"/>
+        <!--copy file="${dist}/topology-${version}.jar" 
todir="${current-oj}"/-->
     </target>
     
     <!-- =================================================================== 
-->

Modified: 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/boundarymatch/SegmentMatcher.java
===================================================================
--- 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/boundarymatch/SegmentMatcher.java
 2016-06-07 13:20:45 UTC (rev 4931)
+++ 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/boundarymatch/SegmentMatcher.java
 2016-06-12 08:50:08 UTC (rev 4932)
@@ -64,47 +64,30 @@
 
     /**
      * Computes an equivalent angle in the range 0 <= ang < 2*PI
+     * This method is now recursive.
      *
      * @param angle the angle to be normalized
      * @return the normalized equivalent angle
      */
     public static double normalizedAngle(double angle) {
-        if (angle < 0.0) return PI2 + angle;
-        if (angle >= PI2) angle -= PI2;
-        return angle;
+        if (angle < 0.0) return normalizedAngle(angle + PI2);
+        else if (angle >= PI2) return normalizedAngle(angle - PI2);
+        else return angle;
     }
 
     /**
-     * Computes the delta in the angles between two line segments.
+     * Computes the minimum angle between two line segments.
+     * The minimum angle is a positive angle between 0 and PI (this is the
+     * cw angle between 0 and 1 if cw angle is < PI and the ccw angle if not).
+     * (LineSegment.angle returns an angle in the range [-PI, PI]
      */
     public static double angleDiff(LineSegment seg0, LineSegment seg1) {
         double a0 = normalizedAngle(seg0.angle());
         double a1 = normalizedAngle(seg1.angle());
-        double delta = Math.abs(a0 - a1);
+        double delta = Math.min(normalizedAngle(a0 - a1), 
normalizedAngle(a1-a0));
         return delta;
     }
 
-    /**
-     * Computes the delta in the angles between a line segment and the inverse 
of another line seg.
-     */
-    public static double angleInverseDiff(LineSegment seg0, LineSegment seg1) {
-        return angleDiff(seg0.angle(), seg1.angle() + Math.PI);
-    }
-
-    /**
-     * Computes the angle difference between two angles.
-     * @param angle0
-     * @param angle1
-     * @return the angle difference.  This will always be <= PI.
-     */
-    public static double angleDiff(double angle0, double angle1) {
-        double norm0 = normalizedAngle(angle0);
-        double norm1 = normalizedAngle(angle1);
-        double angleDiff = Math.abs(norm0 - norm1);
-        if (angleDiff > Math.PI) return PI2 - angleDiff;
-        return angleDiff;
-    }
-
     // temp storage for point args
     private LineSegment line0 = new LineSegment();
     private LineSegment line1 = new LineSegment();
@@ -160,8 +143,7 @@
     public boolean isMatch(LineSegment seg1, LineSegment seg2) {
         boolean isMatch = true;
         double dAngle = angleDiff(seg1, seg2);
-        //double dAngleInv = angleInverseDiff(seg1, seg2);
-        double dAngleInv = (dAngle + Math.PI)%PI2;
+        double dAngleInv = angleDiff(new LineSegment(seg1.p1, seg1.p0), seg2);
         switch (segmentOrientation) {
             case OPPOSITE_ORIENTATION:
                 if (dAngleInv > angleToleranceRad) {

Modified: 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/coverage/CoverageFeature.java
===================================================================
--- 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/coverage/CoverageFeature.java
     2016-06-07 13:20:45 UTC (rev 4931)
+++ 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/conflate/coverage/CoverageFeature.java
     2016-06-12 08:50:08 UTC (rev 4932)
@@ -139,8 +139,12 @@
             //if (cgf.getFeature().getID() < feature.getID()) continue;
             Debug.println("      Try to match " + feature.getID() + "/0 with 
feature " + cgf.getFeature().getID() + "...");
             isModified |= shell.match(cgf.shell, segMatcher, 
matchedSegmentIndex);
+            // [mmichaud 2016-06-12] process target feature holes as well
+            for (Shell hole : cgf.getHoles()) {
+                isModified |= shell.match(hole, segMatcher, 
matchedSegmentIndex);
+            }
             
-            // proessing holes added by michaud on 2010-01-17
+            // [mmichaud 2010-01-17] process this feature holes
             int count = 0;
             for (Shell hole : holes) {
                 Debug.println("      Try to match " + feature.getID() + "/" + 
(++count) + " with feature " + cgf.getFeature().getID() + "...");

Modified: 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/qa/InternalMatchedSegmentFinder.java
===================================================================
--- 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/qa/InternalMatchedSegmentFinder.java
       2016-06-07 13:20:45 UTC (rev 4931)
+++ 
plug-ins/TopologyPlugin/trunk/src/com/vividsolutions/jcs/qa/InternalMatchedSegmentFinder.java
       2016-06-12 08:50:08 UTC (rev 4932)
@@ -340,7 +340,7 @@
      * Find any segments that match the query segment.  The segment index is
      * used to speed up the performance.
      *
-     * @param fs the candidate segment to be matched
+     * @param querySeg the candidate segment to be matched
      */
     private void findMatches(FeatureSegment querySeg) {
         // zero-length segments should not be matched

Modified: 
plug-ins/TopologyPlugin/trunk/src/fr/michaelm/jump/plugin/topology/TopologyExtension.java
===================================================================
--- 
plug-ins/TopologyPlugin/trunk/src/fr/michaelm/jump/plugin/topology/TopologyExtension.java
   2016-06-07 13:20:45 UTC (rev 4931)
+++ 
plug-ins/TopologyPlugin/trunk/src/fr/michaelm/jump/plugin/topology/TopologyExtension.java
   2016-06-12 08:50:08 UTC (rev 4932)
@@ -34,6 +34,13 @@
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
 
 // History
+// 0.8.2 (2016-06-12) : fix two bugs in CoverageCleanerPlugIn (angle between
+//                      - angle between segments was not computed correctly
+//                      - holes were not managed in some cases
+// 0.8.1 (2014-05-27) : fix a bug in project point on line affecting multiple
+//                      target option
+// 0.8.0 (2014-05-26) : rewrite project point on line to handle correctly
+//                      the insertion of several points on a single segment
 // 0.7.1 (2014-05-17) : fix a bug in ProjectPointsOnLinesPlugIn
 // 0.7.0 (2013-01-27) : add CoverageCleanerPlugIn
 // 0.6.1 (2013-01-09) : add es/it/fi language files (from G. Aruta and J. 
Rahkonen)
@@ -63,7 +70,7 @@
     }
 
     public String getVersion() {
-        return "0.7.0 (2013-02-17)";
+        return "0.8.2 (2016-06-12)";
     }
 
     public void configure(PlugInContext context) throws Exception {


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to