From 3aa5487ad57de63053b542908eb6e85a3a1bc81c Mon Sep 17 00:00:00 2001 From: Whitney O'Meara Date: Mon, 16 Sep 2024 12:46:15 +0000 Subject: [PATCH] Added tooltips to buttons --- .../FeatureCollectionSerializer.java | 3 +- .../data/serialization/FeatureSerializer.java | 3 +- .../microservice/map/geojson/GeoJSON.java | 41 +++++++++++++++++++ .../map/visitor/GeoFeatureVisitorTest.java | 15 +++++++ service/src/main/frontend/README.md | 2 +- .../src/components/AddContentPanel.vue | 4 +- .../frontend/src/components/BasemapItem.vue | 2 +- .../frontend/src/components/BasemapPanel.vue | 10 ++++- .../frontend/src/components/ContentPanel.vue | 12 ++++-- .../frontend/src/components/GeoIndexForm.vue | 34 +++++++++------ .../main/frontend/src/components/GeoItem.vue | 26 +++++++++--- .../src/components/GeoToolboxPanel.vue | 6 ++- .../frontend/src/components/LeafletMap.vue | 8 +++- .../src/components/ManualGeometryForm.vue | 8 +++- .../src/components/ManualQueryForm.vue | 8 +++- .../main/frontend/src/components/models.ts | 2 +- .../src/main/frontend/src/pages/IndexPage.vue | 5 ++- .../frontend/src/stores/simple-map-store.ts | 3 +- .../microservice/map/MapControllerTest.java | 5 --- 19 files changed, 153 insertions(+), 44 deletions(-) create mode 100644 api/src/main/java/datawave/microservice/map/geojson/GeoJSON.java diff --git a/api/src/main/java/datawave/microservice/map/data/serialization/FeatureCollectionSerializer.java b/api/src/main/java/datawave/microservice/map/data/serialization/FeatureCollectionSerializer.java index 5e7c262..91ae41b 100644 --- a/api/src/main/java/datawave/microservice/map/data/serialization/FeatureCollectionSerializer.java +++ b/api/src/main/java/datawave/microservice/map/data/serialization/FeatureCollectionSerializer.java @@ -4,7 +4,6 @@ import java.io.StringWriter; import org.geotools.feature.FeatureCollection; -import org.geotools.geojson.GeoJSON; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.slf4j.Logger; @@ -15,6 +14,8 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializerProvider; +import datawave.microservice.map.geojson.GeoJSON; + public class FeatureCollectionSerializer extends JsonSerializer> { private final Logger log = LoggerFactory.getLogger(this.getClass()); diff --git a/api/src/main/java/datawave/microservice/map/data/serialization/FeatureSerializer.java b/api/src/main/java/datawave/microservice/map/data/serialization/FeatureSerializer.java index d507673..6d10a5b 100644 --- a/api/src/main/java/datawave/microservice/map/data/serialization/FeatureSerializer.java +++ b/api/src/main/java/datawave/microservice/map/data/serialization/FeatureSerializer.java @@ -3,7 +3,6 @@ import java.io.IOException; import java.io.StringWriter; -import org.geotools.geojson.GeoJSON; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.opengis.feature.Feature; @@ -15,6 +14,8 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializerProvider; +import datawave.microservice.map.geojson.GeoJSON; + public class FeatureSerializer extends JsonSerializer { private final Logger log = LoggerFactory.getLogger(this.getClass()); diff --git a/api/src/main/java/datawave/microservice/map/geojson/GeoJSON.java b/api/src/main/java/datawave/microservice/map/geojson/GeoJSON.java new file mode 100644 index 0000000..cfd4f6b --- /dev/null +++ b/api/src/main/java/datawave/microservice/map/geojson/GeoJSON.java @@ -0,0 +1,41 @@ +package datawave.microservice.map.geojson; + +import java.io.IOException; + +import org.geotools.feature.FeatureCollection; +import org.geotools.geojson.feature.FeatureJSON; +import org.geotools.geojson.geom.GeometryJSON; +import org.locationtech.jts.geom.Geometry; +import org.opengis.feature.Feature; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +/** + * This is copied from org.geotools.geojson.GeoJSON, but increases the number of decimals to print. + */ +public class GeoJSON { + static final int DECIMALS = 7; + static GeometryJSON gjson = new GeometryJSON(DECIMALS); + static FeatureJSON fjson = new FeatureJSON(new GeometryJSON(DECIMALS)); + + public static Object read(Object input) throws IOException { + throw new UnsupportedOperationException(); + } + + public static void write(Object obj, Object output) throws IOException { + if (obj instanceof Geometry) { + gjson.write((Geometry) obj, output); + } else if (obj instanceof Feature || obj instanceof FeatureCollection || obj instanceof CoordinateReferenceSystem) { + + if (obj instanceof SimpleFeature) { + fjson.writeFeature((SimpleFeature) obj, output); + } else if (obj instanceof FeatureCollection) { + fjson.writeFeatureCollection((FeatureCollection) obj, output); + } else if (obj instanceof CoordinateReferenceSystem) { + fjson.writeCRS((CoordinateReferenceSystem) obj, output); + } else { + throw new IllegalArgumentException("Unable able to encode object of type " + obj.getClass()); + } + } + } +} diff --git a/api/src/test/java/datawave/microservice/map/visitor/GeoFeatureVisitorTest.java b/api/src/test/java/datawave/microservice/map/visitor/GeoFeatureVisitorTest.java index 7fa011e..c64ceae 100644 --- a/api/src/test/java/datawave/microservice/map/visitor/GeoFeatureVisitorTest.java +++ b/api/src/test/java/datawave/microservice/map/visitor/GeoFeatureVisitorTest.java @@ -7,10 +7,12 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import org.apache.commons.jexl3.parser.ASTJexlScript; +import org.apache.commons.jexl3.parser.JexlNode; import org.apache.commons.jexl3.parser.ParseException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -120,4 +122,17 @@ public void expandedGeoWithinBoundingBoxFunctionTest() throws ParseException, IO assertEquals(expected, objectMapper.writeValueAsString(geoQueryFeatures)); } + + @Test + public void testSmallGeometry() throws Exception { + String query = "GEOWAVE_FIELD == '1902eb0102010000'"; + + ASTJexlScript script = JexlASTHelper.parseAndFlattenJexlQuery(query); + GeoQueryFeatures geoQueryFeatures = GeoFeatureVisitor.getGeoFeatures(script, typesByField, GeoQueryConfig.builder().build()); + + ClassLoader classLoader = GeoFeatureVisitorTest.class.getClassLoader(); + String expected = Files.readString(Paths.get(classLoader.getResource("data/EXPANDED_GEO_FIELD.json").toURI())); + + assertEquals(expected, objectMapper.writeValueAsString(geoQueryFeatures)); + } } diff --git a/service/src/main/frontend/README.md b/service/src/main/frontend/README.md index 12762b6..7f09a01 100644 --- a/service/src/main/frontend/README.md +++ b/service/src/main/frontend/README.md @@ -122,7 +122,7 @@ To simplify debugging, install the Vue.js devtools extension in chrome. This wil - Change default polygon colors depending on the basemap - Utilities: - Convert (single? multiple?) WKT to GeoWave Index - - Convert (single? multiple?) WKT to Geo Index + - Convert (single? multiple?) WKT to Geo Indices - Find/highlight range/term, and geo function matching geometry - ~~Split a query geometry naturally (in case of geometry collection) or forcefully~~ - ~~Set portions of a query as evaluation only with the click of a mouse (query editor?)~~ diff --git a/service/src/main/frontend/src/components/AddContentPanel.vue b/service/src/main/frontend/src/components/AddContentPanel.vue index d543c9c..575f156 100644 --- a/service/src/main/frontend/src/components/AddContentPanel.vue +++ b/service/src/main/frontend/src/components/AddContentPanel.vue @@ -9,7 +9,9 @@ size="10px" icon="close" @click="appState.disableConfigPanel" - /> + > + Close + diff --git a/service/src/main/frontend/src/components/BasemapItem.vue b/service/src/main/frontend/src/components/BasemapItem.vue index d12fa0a..a8fefc3 100644 --- a/service/src/main/frontend/src/components/BasemapItem.vue +++ b/service/src/main/frontend/src/components/BasemapItem.vue @@ -34,7 +34,7 @@ import { Coordinate } from 'components/models'; interface BasemapItem { basemap: Basemap; selection: Ref; - previewTileCoords: Coordinate + previewTileCoords: Coordinate; } const radio = ref(); diff --git a/service/src/main/frontend/src/components/BasemapPanel.vue b/service/src/main/frontend/src/components/BasemapPanel.vue index 88359e8..c5e96e7 100644 --- a/service/src/main/frontend/src/components/BasemapPanel.vue +++ b/service/src/main/frontend/src/components/BasemapPanel.vue @@ -18,7 +18,9 @@ size="10px" icon="close" @click="appState.disableConfigPanel" - /> + > + Close + diff --git a/service/src/main/frontend/src/components/ContentPanel.vue b/service/src/main/frontend/src/components/ContentPanel.vue index d2ca863..d9cfc95 100644 --- a/service/src/main/frontend/src/components/ContentPanel.vue +++ b/service/src/main/frontend/src/components/ContentPanel.vue @@ -18,18 +18,24 @@ size="10px" icon="close" @click="appState.disableConfigPanel" - /> + > + Close + - + + Home + + > + Back + - + > + Edit + + + Upload + @@ -43,13 +47,10 @@
- Well-Known Text (WKT): + + Copy Text + + Well-Known Text (WKT):
Geo Point Index: + > + Copy Text + + Geo Point Index:
GeoWave Point Index: + > + Copy Text +
+ GeoWave Point Index: GeoWave Geometry Indices: + > + Copy Text + + GeoWave Geometry Indices: + > + Expand + @@ -29,7 +31,9 @@ round size="8px" @click="copyLabel()" - /> + > + Copy Text + {{ displayLabel }} + Edit Label @@ -66,7 +71,9 @@ round size="8px" @click="copyCaption()" - /> + > + Copy Text + {{ caption }} @@ -80,7 +87,9 @@ round icon="my_location" @click="zoomToBounds" - /> + > + Zoom to Feature + + > + Toggle Visibility +
+ Select Color + > + Delete Feature +
diff --git a/service/src/main/frontend/src/components/GeoToolboxPanel.vue b/service/src/main/frontend/src/components/GeoToolboxPanel.vue index be2c0b9..c39916d 100644 --- a/service/src/main/frontend/src/components/GeoToolboxPanel.vue +++ b/service/src/main/frontend/src/components/GeoToolboxPanel.vue @@ -9,7 +9,9 @@ size="10px" icon="close" @click="appState.disableConfigPanel" - /> + > + Close +
@@ -17,7 +19,7 @@ diff --git a/service/src/main/frontend/src/components/LeafletMap.vue b/service/src/main/frontend/src/components/LeafletMap.vue index 9401bc5..34618a0 100644 --- a/service/src/main/frontend/src/components/LeafletMap.vue +++ b/service/src/main/frontend/src/components/LeafletMap.vue @@ -37,7 +37,10 @@ const initMap = () => { basemaps .initialize() .then(() => { - const maxBounds = L.latLngBounds(L.latLng(-90, -360), L.latLng(90, 360)); + const maxBounds = L.latLngBounds( + L.latLng(-90, -360), + L.latLng(90, 360) + ); leafletMap.createMap( props.mapId, @@ -46,10 +49,11 @@ const initMap = () => { maxBounds, 1, 2, + 21, crs ); - leafletMap.setView([0, 0], 3); + leafletMap.setView([0, 0], 2.5); // add the basemap selector panel to the map leafletMap.enableLayerControl(props.enableLayerControl); diff --git a/service/src/main/frontend/src/components/ManualGeometryForm.vue b/service/src/main/frontend/src/components/ManualGeometryForm.vue index 8e569b6..4a8b536 100644 --- a/service/src/main/frontend/src/components/ManualGeometryForm.vue +++ b/service/src/main/frontend/src/components/ManualGeometryForm.vue @@ -23,8 +23,12 @@ editDialog = true; editDialogText = manualGeometryForm.geometry; " - /> - + > + Edit + + + Upload + diff --git a/service/src/main/frontend/src/components/ManualQueryForm.vue b/service/src/main/frontend/src/components/ManualQueryForm.vue index 8a639a6..085f6cb 100644 --- a/service/src/main/frontend/src/components/ManualQueryForm.vue +++ b/service/src/main/frontend/src/components/ManualQueryForm.vue @@ -23,8 +23,12 @@ editDialog = true; editDialogText = manualQueryForm.query; " - /> - + > + Edit + + + Upload + diff --git a/service/src/main/frontend/src/components/models.ts b/service/src/main/frontend/src/components/models.ts index 4403ac4..7b43b18 100644 --- a/service/src/main/frontend/src/components/models.ts +++ b/service/src/main/frontend/src/components/models.ts @@ -124,4 +124,4 @@ export interface Coordinate { x: number; y: number; z: number; -} \ No newline at end of file +} diff --git a/service/src/main/frontend/src/pages/IndexPage.vue b/service/src/main/frontend/src/pages/IndexPage.vue index 17f1251..8e483c7 100644 --- a/service/src/main/frontend/src/pages/IndexPage.vue +++ b/service/src/main/frontend/src/pages/IndexPage.vue @@ -18,7 +18,10 @@ v-if="appState.isConfigPanelEnabled" style="position: absolute; height: 100%; top: 0; left: 0; z-index: 1" > - + diff --git a/service/src/main/frontend/src/stores/simple-map-store.ts b/service/src/main/frontend/src/stores/simple-map-store.ts index 6cf8567..c64fddc 100644 --- a/service/src/main/frontend/src/stores/simple-map-store.ts +++ b/service/src/main/frontend/src/stores/simple-map-store.ts @@ -15,6 +15,7 @@ export class SimpleMapStore { maxBounds: L.LatLngBounds, maxBoundsViscosity: number, minZoom: number, + maxZoom: number, crs: string ) { let CRS; @@ -43,7 +44,7 @@ export class SimpleMapStore { maxBounds: maxBounds, maxBoundsViscosity: maxBoundsViscosity, minZoom: minZoom, - crs: CRS + crs: CRS, }); } diff --git a/service/src/test/java/datawave/microservice/map/MapControllerTest.java b/service/src/test/java/datawave/microservice/map/MapControllerTest.java index 767823d..13883e8 100644 --- a/service/src/test/java/datawave/microservice/map/MapControllerTest.java +++ b/service/src/test/java/datawave/microservice/map/MapControllerTest.java @@ -40,11 +40,6 @@ public void handleError(ClientHttpResponse response) throws IOException { }); } - // @Test - // public void someTest() { - // - // } - @Configuration public static class MapControllerTestConfiguration { // configuration overrides go here