From a34818e90c8a7206db80fa21cb8d5f0eb874c97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Michaud?= Date: Wed, 5 Oct 2022 08:51:11 +0200 Subject: [PATCH] Fix #1 in GraphNodesPlugIn (filter on outdegree = 0) --- pom.xml | 2 +- .../fr/michaelm/jump/plugin/graph/GraphExtension.java | 2 ++ .../fr/michaelm/jump/plugin/graph/GraphNodesPlugIn.java | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index b234c49..93ae5ae 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openjump graph-toolbox - 2.0.2 + 2.0.3 1.8 diff --git a/src/main/java/fr/michaelm/jump/plugin/graph/GraphExtension.java b/src/main/java/fr/michaelm/jump/plugin/graph/GraphExtension.java index cbef376..09985b2 100644 --- a/src/main/java/fr/michaelm/jump/plugin/graph/GraphExtension.java +++ b/src/main/java/fr/michaelm/jump/plugin/graph/GraphExtension.java @@ -38,6 +38,8 @@ * @author Michaël Michaud * @version 2.0.1 (2022-03-09) */ +//version 2.0.3 (2022-10-05) Fix bug in GraphNodesPlugIn +//version 2.0.2 (2022-08-27) Fix compatibility issue with JTS 1.19 and set I18N to UTF-8 //version 2.0.1 (2022-03-09) Resources encoding //version 2.0.0 (2022-03-01) Complete refactoring for OpenJUMP 2.0 //version 1.1.0 (2021-08-08) Refactoring to use new I18N and FeatureInstaller diff --git a/src/main/java/fr/michaelm/jump/plugin/graph/GraphNodesPlugIn.java b/src/main/java/fr/michaelm/jump/plugin/graph/GraphNodesPlugIn.java index 5880e21..6eb9533 100644 --- a/src/main/java/fr/michaelm/jump/plugin/graph/GraphNodesPlugIn.java +++ b/src/main/java/fr/michaelm/jump/plugin/graph/GraphNodesPlugIn.java @@ -319,8 +319,12 @@ public void run(TaskMonitor monitor, PlugInContext context) throws Exception { degree1 && degree == 1 || degree2 && degree == 2 || degree3p && degree > 2) { - if (indegree0 && indegree != 0) continue; - if (outdegree0 && outdegree != 0) continue; + if (indegree0 && indegree != 0 && !outdegree0) continue; + if (outdegree0 && outdegree != 0 && !indegree0) continue; + // indegree0 && outdegree0 checked means one OR the other + // -> continue if neither indegree nor outdegree are 0 + if (indegree0 && outdegree0 && indegree != 0 && outdegree !=0) continue; + //if (outdegree0 && outdegree != 0) continue; Feature bf = new BasicFeature(schemaNodes); bf.setGeometry(node.getGeometry()); if (use_attribute) bf.setAttribute(attribute, k); @@ -328,7 +332,6 @@ public void run(TaskMonitor monitor, PlugInContext context) throws Exception { bf.setAttribute(OUT_DEGREE, outdegree); bf.setAttribute(DEGREE, degree); resultNodes.add(bf); - } } }