Updated Geometry and Geospatial
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@112169 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ac1ccd4cfd
commit
22d8fda52c
|
@ -177,11 +177,10 @@ public class GeometryCreatePointPanel extends FramedPanel implements
|
||||||
vl.setScrollMode(ScrollMode.AUTO);
|
vl.setScrollMode(ScrollMode.AUTO);
|
||||||
vl.setAdjustForScroll(true);
|
vl.setAdjustForScroll(true);
|
||||||
|
|
||||||
vl.add(new FieldLabel(comboLatitude, "Latitude"),
|
|
||||||
new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
vl.add(new FieldLabel(comboLongitude, "Longitude"),
|
vl.add(new FieldLabel(comboLongitude, "Longitude"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
vl.add(new FieldLabel(comboLatitude, "Latitude"),
|
||||||
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
vl.add(columnLab, new VerticalLayoutData(1, -1));
|
vl.add(columnLab, new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
@ -248,10 +247,10 @@ public class GeometryCreatePointPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onGeometryCreatePoint() {
|
protected void onGeometryCreatePoint() {
|
||||||
ColumnData latitude = comboLatitude.getCurrentValue();
|
|
||||||
if (latitude != null) {
|
|
||||||
ColumnData longitude = comboLongitude.getCurrentValue();
|
ColumnData longitude = comboLongitude.getCurrentValue();
|
||||||
if (longitude != null) {
|
if (longitude != null) {
|
||||||
|
ColumnData latitude = comboLatitude.getCurrentValue();
|
||||||
|
if (latitude != null) {
|
||||||
String columnLab = columnLabelField.getCurrentValue();
|
String columnLab = columnLabelField.getCurrentValue();
|
||||||
if (columnLab != null && !columnLab.isEmpty()) {
|
if (columnLab != null && !columnLab.isEmpty()) {
|
||||||
GeometryCreatePointSession geoCreatePointSession = new GeometryCreatePointSession(
|
GeometryCreatePointSession geoCreatePointSession = new GeometryCreatePointSession(
|
||||||
|
@ -261,10 +260,10 @@ public class GeometryCreatePointPanel extends FramedPanel implements
|
||||||
UtilsGXT3.alert("Attention", "Select a column label!");
|
UtilsGXT3.alert("Attention", "Select a column label!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention", "Select Longitude!");
|
UtilsGXT3.alert("Attention", "Select Latitude!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention", "Select Latitude!");
|
UtilsGXT3.alert("Attention", "Select Longitude!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.Radio;
|
import com.sencha.gxt.widget.core.client.form.Radio;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
||||||
import com.sencha.gxt.widget.core.client.info.Info;
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +87,9 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
private Radio hasQuadrantFalse;
|
private Radio hasQuadrantFalse;
|
||||||
private FieldLabel comboQuadrantLabel;
|
private FieldLabel comboQuadrantLabel;
|
||||||
private FieldLabel hasQuadrantLabel;
|
private FieldLabel hasQuadrantLabel;
|
||||||
private TextField resolutionField;
|
|
||||||
|
private ComboBox<Resolution> comboResolution;
|
||||||
|
private ListStore<Resolution> storeComboResolution;
|
||||||
|
|
||||||
public GeospatialCreateCoordinatesPanel(TRId trId,
|
public GeospatialCreateCoordinatesPanel(TRId trId,
|
||||||
RequestProperties requestProperties, EventBus eventBus) {
|
RequestProperties requestProperties, EventBus eventBus) {
|
||||||
|
@ -207,9 +208,28 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL);
|
comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
// Resolution
|
// Resolution
|
||||||
resolutionField = new TextField();
|
ResolutionPropertiesCombo propsResolution = GWT
|
||||||
resolutionField.setValue("0.1");
|
.create(ResolutionPropertiesCombo.class);
|
||||||
FieldLabel resolutionLabel = new FieldLabel(resolutionField,
|
|
||||||
|
storeComboResolution = new ListStore<Resolution>(propsResolution.id());
|
||||||
|
storeComboResolution
|
||||||
|
.addAll(ResolutionStore.getStoreCSquareResolution());
|
||||||
|
|
||||||
|
comboResolution = new ComboBox<Resolution>(storeComboResolution,
|
||||||
|
propsResolution.value());
|
||||||
|
Log.trace("Combo Resolution created");
|
||||||
|
|
||||||
|
addHandlersForComboResolution(propsResolution.value());
|
||||||
|
|
||||||
|
comboResolution.setEmptyText("Select a resolution...");
|
||||||
|
comboResolution.setValue(ResolutionStore
|
||||||
|
.getStoreCSquareResolutionDefault());
|
||||||
|
comboResolution.setWidth(191);
|
||||||
|
comboResolution.setTypeAhead(false);
|
||||||
|
comboResolution.setEditable(false);
|
||||||
|
comboResolution.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
FieldLabel resolutionLabel = new FieldLabel(comboResolution,
|
||||||
"Resolution");
|
"Resolution");
|
||||||
|
|
||||||
// Has Quadrant
|
// Has Quadrant
|
||||||
|
@ -301,11 +321,10 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
vl.setScrollMode(ScrollMode.AUTO);
|
vl.setScrollMode(ScrollMode.AUTO);
|
||||||
vl.setAdjustForScroll(true);
|
vl.setAdjustForScroll(true);
|
||||||
|
|
||||||
vl.add(new FieldLabel(comboLatitude, "Latitude"),
|
|
||||||
new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
vl.add(new FieldLabel(comboLongitude, "Longitude"),
|
vl.add(new FieldLabel(comboLongitude, "Longitude"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
vl.add(new FieldLabel(comboLatitude, "Latitude"),
|
||||||
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
vl.add(new FieldLabel(comboGsCoordinatesType, "Type"),
|
vl.add(new FieldLabel(comboGsCoordinatesType, "Type"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
@ -325,6 +344,32 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addHandlersForComboResolution(
|
||||||
|
final LabelProvider<Resolution> value) {
|
||||||
|
comboResolution.addSelectionHandler(new SelectionHandler<Resolution>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<Resolution> event) {
|
||||||
|
Info.display(
|
||||||
|
"Resolution Selected",
|
||||||
|
"You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
|
: value.getLabel(event
|
||||||
|
.getSelectedItem()) + "!"));
|
||||||
|
Log.debug("Reolution selected: " + event.getSelectedItem());
|
||||||
|
Resolution resolution = event.getSelectedItem();
|
||||||
|
updatedResolution(resolution);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updatedResolution(Resolution resolution) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void addHandlersForComboColumnLatitude(
|
private void addHandlersForComboColumnLatitude(
|
||||||
final LabelProvider<ColumnData> labelProvider) {
|
final LabelProvider<ColumnData> labelProvider) {
|
||||||
comboLatitude.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
comboLatitude.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||||
|
@ -417,7 +462,14 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
hasQuadrantLabel.setVisible(false);
|
hasQuadrantLabel.setVisible(false);
|
||||||
comboQuadrantLabel.setVisible(false);
|
comboQuadrantLabel.setVisible(false);
|
||||||
comboGsCoordinatesType.setValue(gsCoordinatesType);
|
comboGsCoordinatesType.setValue(gsCoordinatesType);
|
||||||
resolutionField.setValue("10.0");
|
storeComboResolution.clear();
|
||||||
|
storeComboResolution.addAll(ResolutionStore
|
||||||
|
.getStoreCSquareResolution());
|
||||||
|
storeComboResolution.commitChanges();
|
||||||
|
comboResolution.clear();
|
||||||
|
comboResolution.reset();
|
||||||
|
comboResolution.setValue(ResolutionStore
|
||||||
|
.getStoreCSquareResolutionDefault());
|
||||||
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
|
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
|
||||||
.geospatialCSquare());
|
.geospatialCSquare());
|
||||||
|
|
||||||
|
@ -433,14 +485,28 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
comboQuadrantLabel.setVisible(true);
|
comboQuadrantLabel.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
resolutionField.setValue("0.1");
|
storeComboResolution.clear();
|
||||||
|
storeComboResolution.addAll(ResolutionStore
|
||||||
|
.getStoreOceanAreaResolution());
|
||||||
|
storeComboResolution.commitChanges();
|
||||||
|
comboResolution.clear();
|
||||||
|
comboResolution.reset();
|
||||||
|
comboResolution.setValue(ResolutionStore
|
||||||
|
.getStoreOceanAreaResolutionDefault());
|
||||||
hasQuadrantLabel.setVisible(true);
|
hasQuadrantLabel.setVisible(true);
|
||||||
comboGsCoordinatesType.setValue(gsCoordinatesType);
|
comboGsCoordinatesType.setValue(gsCoordinatesType);
|
||||||
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
|
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
|
||||||
.geospatialOceanArea());
|
.geospatialOceanArea());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
resolutionField.setValue("10.0");
|
storeComboResolution.clear();
|
||||||
|
storeComboResolution.addAll(ResolutionStore
|
||||||
|
.getStoreCSquareResolution());
|
||||||
|
storeComboResolution.commitChanges();
|
||||||
|
comboResolution.clear();
|
||||||
|
comboResolution.reset();
|
||||||
|
comboResolution.setValue(ResolutionStore
|
||||||
|
.getStoreCSquareResolutionDefault());
|
||||||
hasQuadrantLabel.setVisible(false);
|
hasQuadrantLabel.setVisible(false);
|
||||||
comboQuadrantLabel.setVisible(false);
|
comboQuadrantLabel.setVisible(false);
|
||||||
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
|
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
|
||||||
|
@ -488,18 +554,12 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onGeospatialCreateCoordinates() {
|
protected void onGeospatialCreateCoordinates() {
|
||||||
ColumnData latitude = comboLatitude.getCurrentValue();
|
|
||||||
if (latitude != null) {
|
|
||||||
ColumnData longitude = comboLongitude.getCurrentValue();
|
ColumnData longitude = comboLongitude.getCurrentValue();
|
||||||
if (longitude != null) {
|
if (longitude != null) {
|
||||||
String resol = resolutionField.getCurrentValue();
|
ColumnData latitude = comboLatitude.getCurrentValue();
|
||||||
Double resolution = null;
|
if (latitude != null) {
|
||||||
try {
|
Resolution resolution = comboResolution.getCurrentValue();
|
||||||
resolution = new Double(resol);
|
if (resolution != null) {
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
UtilsGXT3.alert("Attention", "Insert a valid resolution!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeospatialCoordinatesType type = comboGsCoordinatesType
|
GeospatialCoordinatesType type = comboGsCoordinatesType
|
||||||
.getCurrentValue();
|
.getCurrentValue();
|
||||||
|
@ -508,8 +568,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case C_SQUARE:
|
case C_SQUARE:
|
||||||
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
||||||
trId, latitude, longitude, type, false, null,
|
trId, latitude, longitude, type, false,
|
||||||
resolution);
|
null, resolution.getValue());
|
||||||
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
||||||
break;
|
break;
|
||||||
case OCEAN_AREA:
|
case OCEAN_AREA:
|
||||||
|
@ -518,8 +578,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
.getCurrentValue();
|
.getCurrentValue();
|
||||||
if (quadrant != null) {
|
if (quadrant != null) {
|
||||||
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
||||||
trId, latitude, longitude, type, true,
|
trId, latitude, longitude, type,
|
||||||
quadrant, resolution);
|
true, quadrant, resolution.getValue());
|
||||||
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention",
|
UtilsGXT3.alert("Attention",
|
||||||
|
@ -530,13 +590,14 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
} else {
|
} else {
|
||||||
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
||||||
trId, latitude, longitude, type, false,
|
trId, latitude, longitude, type, false,
|
||||||
null, resolution);
|
null, resolution.getValue());
|
||||||
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UtilsGXT3.alert("Attention",
|
UtilsGXT3
|
||||||
|
.alert("Attention",
|
||||||
"Select valid geospatial coordinates type!");
|
"Select valid geospatial coordinates type!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -546,12 +607,15 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||||
UtilsGXT3.alert("Attention",
|
UtilsGXT3.alert("Attention",
|
||||||
"Invalid Geospatial Coordinates Type!");
|
"Invalid Geospatial Coordinates Type!");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
UtilsGXT3.alert("Attention", "Select Resolution!");
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention", "Select Longitude!");
|
UtilsGXT3.alert("Attention", "Select Latitude!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention", "Select Latitude!");
|
UtilsGXT3.alert("Attention", "Select Longitude!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.gcube.portlets.user.td.tablewidget.client.geospatial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Resolution {
|
||||||
|
private int id;
|
||||||
|
private Double value;
|
||||||
|
|
||||||
|
public Resolution() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resolution(int id, Double value) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Double value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Resolution [id=" + id + ", value=" + value + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.gcube.portlets.user.td.tablewidget.client.geospatial;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ResolutionPropertiesCombo extends PropertyAccess<Resolution> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<Resolution> id();
|
||||||
|
|
||||||
|
LabelProvider<Resolution> value();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package org.gcube.portlets.user.td.tablewidget.client.geospatial;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ResolutionStore implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 6520001942214730827L;
|
||||||
|
|
||||||
|
private static ArrayList<Resolution> storeCSquareResolution;
|
||||||
|
private static ArrayList<Resolution> storeOcenaAreaResolution;
|
||||||
|
|
||||||
|
private static Resolution resolutionCSquare1=new Resolution(1, 0.1d);
|
||||||
|
private static Resolution resolutionCSquare2=new Resolution(2, 0.5d);
|
||||||
|
private static Resolution resolutionCSquare3=new Resolution(3, 1.0d);
|
||||||
|
private static Resolution resolutionCSquare4=new Resolution(4, 5.0d);
|
||||||
|
private static Resolution resolutionCSquare5=new Resolution(5, 10.0d);
|
||||||
|
|
||||||
|
private static Resolution resolutionOceanArea1=new Resolution(1, 1.0d);
|
||||||
|
private static Resolution resolutionOceanArea2=new Resolution(2, 5.0d);
|
||||||
|
private static Resolution resolutionOceanArea3=new Resolution(3, 10.0d);
|
||||||
|
|
||||||
|
public static ArrayList<Resolution> getStoreCSquareResolution() {
|
||||||
|
storeCSquareResolution=new ArrayList<Resolution>();
|
||||||
|
storeCSquareResolution.add(resolutionCSquare1);
|
||||||
|
storeCSquareResolution.add(resolutionCSquare2);
|
||||||
|
storeCSquareResolution.add(resolutionCSquare3);
|
||||||
|
storeCSquareResolution.add(resolutionCSquare4);
|
||||||
|
storeCSquareResolution.add(resolutionCSquare5);
|
||||||
|
return storeCSquareResolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Resolution getStoreCSquareResolutionDefault(){
|
||||||
|
return resolutionCSquare2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Resolution> getStoreOceanAreaResolution() {
|
||||||
|
storeOcenaAreaResolution=new ArrayList<Resolution>();
|
||||||
|
storeOcenaAreaResolution.add(resolutionOceanArea1);
|
||||||
|
storeOcenaAreaResolution.add(resolutionOceanArea2);
|
||||||
|
storeOcenaAreaResolution.add(resolutionOceanArea3);
|
||||||
|
return storeOcenaAreaResolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Resolution getStoreOceanAreaResolutionDefault(){
|
||||||
|
return resolutionOceanArea2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue