Skip to content

Commit

Permalink
feat: Add paramter "resolvedepth" in UI when downloading data via WFS
Browse files Browse the repository at this point in the history
Add in the dialog for the WFS GetCapability the possibility to choose if you want to add a resolveDepth for a request and how much would that be. Has been added a spinner to choose a number above 0 or the '*' for all the possible depths to be resolved.

ING-4129
  • Loading branch information
emanuelaepure10 committed May 15, 2024
1 parent 03b2bf5 commit e6f77d4
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;

import eu.esdihumboldt.hale.ui.util.wizard.ConfigurationWizard;
Expand All @@ -37,6 +38,11 @@ public class GetFeatureParamsPage extends ConfigurationWizardPage<WFSGetFeatureC

private Button maxFeaturesEnabled;
private Spinner maxFeatures;
private Button resolveLinks;
private Button resolveLinksRadioValue;
private Spinner resolveLinksValueSpinner;
private Button resolveLinksRadioAllValues;
private final String resolveDepthAll = "*";

/**
* Create a new wizard page.
Expand All @@ -60,6 +66,18 @@ public boolean updateConfiguration(WFSGetFeatureConfig configuration) {
else {
configuration.setMaxFeatures(null);
}

if (resolveLinks.getSelection()) {
if (resolveLinksRadioValue.getSelection()) {
// Set resolve depth based on the value from the spinner
int selectedDepth = resolveLinksValueSpinner.getSelection();
configuration.setResolvedepth(String.valueOf(selectedDepth));
}
else if (resolveLinksRadioAllValues.getSelection()) {
// Set resolve depth to a predefined value for all values
configuration.setResolvedepth(resolveDepthAll);
}
}
return true;
}

Expand Down Expand Up @@ -93,6 +111,60 @@ public void widgetSelected(SelectionEvent e) {
}
});

Group resolveLinksGroup = new Group(page, SWT.NONE);
resolveLinksGroup.setText("Resolve linked features");
GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(resolveLinksGroup);
GridDataFactory.fillDefaults().grab(true, false).applyTo(resolveLinksGroup);

resolveLinks = new Button(resolveLinksGroup, SWT.CHECK);
resolveLinks.setText("Resolve links");
resolveLinks.setSelection(false);

// Add an empty string in the second column
Label emptyLabel = new Label(resolveLinksGroup, SWT.NONE);
emptyLabel.setText(""); // Set an empty string

resolveLinksRadioValue = new Button(resolveLinksGroup, SWT.RADIO);
resolveLinksRadioValue.setText("Resolve links to a depth of");
resolveLinksRadioValue.setSelection(true);
resolveLinksRadioValue.setEnabled(false);

resolveLinksValueSpinner = new Spinner(resolveLinksGroup, SWT.BORDER);
resolveLinksValueSpinner.setMinimum(1);
resolveLinksValueSpinner.setMaximum(10);
resolveLinksValueSpinner.setIncrement(1);
resolveLinksValueSpinner.setPageIncrement(1);
resolveLinksValueSpinner.setSelection(1);
resolveLinksValueSpinner.setEnabled(false);

resolveLinksRadioAllValues = new Button(resolveLinksGroup, SWT.RADIO);
resolveLinksRadioAllValues.setText("Resolve links to all possible depths ('*')");
resolveLinksRadioAllValues.setEnabled(false);

// Add an empty string in the second column
Label emptyLabelAll = new Label(resolveLinksGroup, SWT.NONE);
emptyLabelAll.setText(""); // Set an empty string

resolveLinks.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {
resolveLinksRadioValue.setEnabled(resolveLinks.getSelection());
if (resolveLinks.getSelection() && resolveLinksRadioValue.getSelection()) {
resolveLinksValueSpinner.setEnabled(resolveLinks.getSelection());
}
resolveLinksRadioAllValues.setEnabled(resolveLinks.getSelection());
}
});

resolveLinksRadioValue.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {
resolveLinksValueSpinner.setEnabled(resolveLinksRadioValue.getSelection());
}
});

setControl(page);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ class WFSGetFeatureConfig {
BBox bbox
String bboxCrsUri
Integer maxFeatures
String resolvedepth
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ protected void determineSource(URIFieldEditor sourceURL) {
}
}

if (!result.getResolvedepth().isEmpty()) {
builder.addParameter("resolveDepth", result.getResolvedepth());
}

try {
sourceURL.setStringValue(builder.build().toString());
getPage().setErrorMessage(null);
Expand Down
4 changes: 2 additions & 2 deletions ui/plugins/eu.esdihumboldt.hale.ui.application/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
point="org.eclipse.core.runtime.products">
<product
application="eu.esdihumboldt.hale.ui.application"
name="hale»studio">
name="hale studio">
<property
name="appName"
value="hale»studio">
value="hale studio">
</property>
<property
name="windowImages"
Expand Down

0 comments on commit e6f77d4

Please sign in to comment.