use of eu.esdihumboldt.cst.functions.geometric.join.SpatialJoinParameter in project hale by halestudio.
the class SpatialJoinParameterPage method getConfiguration.
/**
* @see eu.esdihumboldt.hale.ui.function.generic.pages.ParameterPage#getConfiguration()
*/
@Override
public ListMultimap<String, ParameterValue> getConfiguration() {
ListMultimap<String, ParameterValue> result = ArrayListMultimap.create(1, 1);
Set<SpatialJoinCondition> conditions = new HashSet<>();
for (ConditionPage page : pages) {
conditions.addAll(page.conditions);
}
SpatialJoinParameter param = new SpatialJoinParameter(types, conditions);
result.put(PARAMETER_SPATIAL_JOIN, new ParameterValue(new ComplexValue(param)));
return result;
}
use of eu.esdihumboldt.cst.functions.geometric.join.SpatialJoinParameter in project hale by halestudio.
the class SpatialJoinParameterPage method onShowPage.
/**
* @see eu.esdihumboldt.hale.ui.HaleWizardPage#onShowPage(boolean)
*/
@Override
protected void onShowPage(boolean firstShow) {
super.onShowPage(firstShow);
Cell cell = getWizard().getUnfinishedCell();
List<? extends Entity> sourceEntities = cell.getSource().get(JOIN_TYPES);
List<TypeEntityDefinition> types = new ArrayList<TypeEntityDefinition>();
Iterator<? extends Entity> iter = sourceEntities.iterator();
while (iter.hasNext()) types.add(AlignmentUtil.getTypeEntity(iter.next().getDefinition()));
if (sameTypes(this.types, types))
return;
if (containsDuplicateType(types)) {
setPageComplete(false);
setErrorMessage("The selected source types contain duplicates.");
this.types.clear();
table.setInput(null);
return;
} else {
setErrorMessage(null);
}
SpatialJoinParameter initialValue = null;
if (firstShow && !getInitialValues().isEmpty()) {
initialValue = getInitialValues().get(PARAMETER_SPATIAL_JOIN).get(0).as(SpatialJoinParameter.class);
if (initialValue != null && (initialValue.validate() != null || !sameTypes(types, initialValue.types)))
initialValue = null;
}
for (ConditionPage page : pages) page.dispose();
pages.clear();
if (initialValue != null) {
// use ordering of the initial value (needs to be modifiable)
types = new ArrayList<>(initialValue.types);
}
this.types = types;
if (table != null)
table.setInput(types);
for (int i = 1; i < types.size(); i++) {
ConditionPage conditionPage = new ConditionPage(i);
conditionPage.setWizard(getWizard());
pages.add(conditionPage);
}
if (initialValue != null) {
// add initial conditions
for (SpatialJoinCondition condition : initialValue.conditions) {
TypeEntityDefinition joinType = AlignmentUtil.getTypeEntity(condition.joinProperty);
int typeIndex = types.indexOf(joinType);
int pageIndex = typeIndex - 1;
pages.get(pageIndex).conditions.add(condition);
pages.get(pageIndex).updateCompletionStatus();
}
}
// order is always valid, will trigger updateButtons
setPageComplete(true);
}
use of eu.esdihumboldt.cst.functions.geometric.join.SpatialJoinParameter in project hale by halestudio.
the class SpatialJoinParameterPage method createJoinParameter.
/**
* Creates a join parameter for the types up to <code>upToIndex</code>.
*
* @param upToIndex the type index up to which the parameter should be
* created for
* @return the current join parameter up to the specified index
*/
private SpatialJoinParameter createJoinParameter(int upToIndex) {
Set<SpatialJoinCondition> conditions = new HashSet<>();
for (int i = 0; i < upToIndex; i++) conditions.addAll(pages.get(i).conditions);
SpatialJoinParameter param = new SpatialJoinParameter(types.subList(0, upToIndex + 1), conditions);
return param;
}
Aggregations