diff --git a/cst/plugins/eu.esdihumboldt.cst.functions.geometric/plugin.xml b/cst/plugins/eu.esdihumboldt.cst.functions.geometric/plugin.xml
index b9a215cf2e..9055f054c0 100644
--- a/cst/plugins/eu.esdihumboldt.cst.functions.geometric/plugin.xml
+++ b/cst/plugins/eu.esdihumboldt.cst.functions.geometric/plugin.xml
@@ -379,6 +379,24 @@
scriptable="false">
+
+
+
+
+
+
partitionInstances(InstanceCollection in
iterator.close();
}
- return new SpatialJoinIterator(instances, startInstances, directParent, services,
- joinTable);
+ boolean innerJoin = false; // default to false if not specified
+ List innerJoinValues = transformationParameters
+ .get(JoinFunction.PARAMETER_INNER_JOIN);
+ if (!innerJoinValues.isEmpty()) {
+ innerJoin = innerJoinValues.get(0).as(Boolean.class, innerJoin);
+ }
+
+ return new SpatialJoinIterator(instances, startInstances, directParent, services, joinTable,
+ innerJoin);
}
private class SpatialJoinIterator
- extends GenericResourceIteratorAdapter {
+ extends FilterResourceIteratorAdapter {
private final InstanceCollection instances;
// type -> direct-parent
@@ -156,15 +165,19 @@ private class SpatialJoinIterator
private final ServiceProvider provider;
private final Map> joinTable;
+ private final boolean innerJoin;
+
protected SpatialJoinIterator(InstanceCollection instances,
Collection startInstances, int[] parent,
ServiceProvider provider,
- Map> joinTable) {
+ Map> joinTable,
+ boolean innerJoin) {
super(startInstances.iterator());
this.instances = instances;
this.parent = parent;
this.provider = provider;
this.joinTable = joinTable;
+ this.innerJoin = innerJoin;
}
/**
@@ -176,13 +189,20 @@ protected FamilyInstance convert(InstanceReference next) {
FamilyInstance[] currentInstances = new FamilyInstance[parent.length];
currentInstances[0] = base;
- join(currentInstances, 0);
+ if (!join(currentInstances, 0)) {
+ // skip this instance
+ return null;
+ }
return base;
}
- // Joins all direct children of the given type to currentInstances.
- private void join(FamilyInstance[] currentInstances, int currentType) {
+ /**
+ * Joins all direct children of the given type to currentInstances.
+ *
+ * @return if the instance should be skipped
+ */
+ private boolean join(FamilyInstance[] currentInstances, int currentType) {
@SuppressWarnings("unchecked")
SpatialIndexService index = provider
.getService(SpatialIndexService.class);
@@ -281,13 +301,24 @@ private void join(FamilyInstance[] currentInstances, int currentType) {
FamilyInstance child = new FamilyInstanceImpl(inst);
parent.addChild(child);
currentInstances[i] = child;
- join(currentInstances, i);
+ if (!join(currentInstances, i)) {
+ return false;
+ }
}
currentInstances[i] = null;
}
+ else {
+ if (innerJoin) {
+ // no instances for this link
+ return false;
+ }
+ }
}
}
+
+ return true;
}
+
}
/**