Skip to content

Commit

Permalink
Added tooltips to buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
jwomeara committed Sep 16, 2024
1 parent 68062d0 commit 3aa5487
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<FeatureCollection<?,?>> {
private final Logger log = LoggerFactory.getLogger(this.getClass());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Feature> {
private final Logger log = LoggerFactory.getLogger(this.getClass());

Expand Down
41 changes: 41 additions & 0 deletions api/src/main/java/datawave/microservice/map/geojson/GeoJSON.java
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion service/src/main/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?)~~
Expand Down
4 changes: 3 additions & 1 deletion service/src/main/frontend/src/components/AddContentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
size="10px"
icon="close"
@click="appState.disableConfigPanel"
/>
>
<q-tooltip :delay="1000">Close</q-tooltip>
</q-btn>
</q-card-section>
</q-card>
<q-list bordered class="q-pa-none">
Expand Down
2 changes: 1 addition & 1 deletion service/src/main/frontend/src/components/BasemapItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Coordinate } from 'components/models';
interface BasemapItem {
basemap: Basemap;
selection: Ref<string>;
previewTileCoords: Coordinate
previewTileCoords: Coordinate;
}
const radio = ref<QRadio>();
Expand Down
10 changes: 8 additions & 2 deletions service/src/main/frontend/src/components/BasemapPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
size="10px"
icon="close"
@click="appState.disableConfigPanel"
/>
>
<q-tooltip :delay="1000">Close</q-tooltip>
</q-btn>
</q-card-section>
</q-card>
<q-scroll-area
Expand All @@ -29,7 +31,11 @@
<BasemapItem
v-for="basemap in basemaps.getBasemaps"
:key="basemap.title"
v-bind="{ basemap: basemap, selection: selectionRef(), previewTileCoords: previewTileCoords }"
v-bind="{
basemap: basemap,
selection: selectionRef(),
previewTileCoords: previewTileCoords,
}"
/>
</q-list>
</q-scroll-area>
Expand Down
12 changes: 9 additions & 3 deletions service/src/main/frontend/src/components/ContentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@
size="10px"
icon="close"
@click="appState.disableConfigPanel"
/>
>
<q-tooltip :delay="1000">Close</q-tooltip>
</q-btn>
</q-card-section>
</q-card>
<q-bar dark class="bg-primary text-white">
<q-btn dense flat icon="home" @click="initContent" />
<q-btn dense flat icon="home" @click="initContent">
<q-tooltip :delay="1000">Home</q-tooltip>
</q-btn>
<q-btn
v-if="content.getFeatureChain.length > 0"
dense
flat
icon="arrow_back"
@click="content.navigateBack"
/>
>
<q-tooltip :delay="1000">Back</q-tooltip>
</q-btn>
<GeoNav
v-if="content.getFeatureChain.length > 0"
v-bind="content.getRootFeature"
Expand Down
34 changes: 22 additions & 12 deletions service/src/main/frontend/src/components/GeoIndexForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
editDialog = true;
editDialogText = geometry;
"
/>
<q-btn dense flat icon="upload" @click="selectFile" />
>
<q-tooltip :delay="1000">Edit</q-tooltip>
</q-btn>
<q-btn dense flat icon="upload" @click="selectFile">
<q-tooltip :delay="1000">Upload</q-tooltip>
</q-btn>
</template>
</q-input>
</div>
Expand All @@ -43,13 +47,10 @@
<q-separator inset />
<div class="q-py-md">
<div class="row q-pt-md">
<q-btn
icon="content_copy"
flat
round
size="8px"
@click="copyWkt()"
/><strong>Well-Known Text (WKT):</strong>
<q-btn icon="content_copy" flat round size="8px" @click="copyWkt()">
<q-tooltip :delay="1000">Copy Text</q-tooltip>
</q-btn>
<strong>Well-Known Text (WKT):</strong>
</div>
<q-scroll-area
:content-style="contentStyle"
Expand All @@ -65,7 +66,10 @@
round
size="8px"
@click="copyGeoPointIndex()"
/><strong>Geo Point Index:</strong>
>
<q-tooltip :delay="1000">Copy Text</q-tooltip>
</q-btn>
<strong>Geo Point Index:</strong>
</div>
<q-scroll-area
:content-style="contentStyle"
Expand All @@ -81,7 +85,10 @@
round
size="8px"
@click="copyGeoWavePointIndex()"
/><strong>GeoWave Point Index:</strong>
>
<q-tooltip :delay="1000">Copy Text</q-tooltip>
</q-btn>
<strong>GeoWave Point Index:</strong>
</div>
<q-scroll-area
:content-style="contentStyle"
Expand All @@ -97,7 +104,10 @@
round
size="8px"
@click="copyGeoWaveGeometryIndices()"
/><strong>GeoWave Geometry Indices:</strong>
>
<q-tooltip :delay="1000">Copy Text</q-tooltip>
</q-btn>
<strong>GeoWave Geometry Indices:</strong>
</div>
<q-scroll-area
:content-style="contentStyle"
Expand Down
26 changes: 20 additions & 6 deletions service/src/main/frontend/src/components/GeoItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
size="18px"
padding="none"
@click="drillDown"
/>
>
<q-tooltip :delay="1000">Expand</q-tooltip>
</q-btn>
</q-item-section>
<q-item-section>
<q-item-label lines="1">
Expand All @@ -29,7 +31,9 @@
round
size="8px"
@click="copyLabel()"
/>
>
<q-tooltip :delay="1000">Copy Text</q-tooltip>
</q-btn>
{{ displayLabel }}
<q-btn
v-if="showEditLabelButton()"
Expand All @@ -52,6 +56,7 @@
maxlength="20"
/>
</q-popup-proxy>
<q-tooltip :delay="1000">Edit Label</q-tooltip>
</q-btn>
</span>
<span v-if="showDisplayTypeName()" class="text-grey-8">
Expand All @@ -66,7 +71,9 @@
round
size="8px"
@click="copyCaption()"
/>
>
<q-tooltip :delay="1000">Copy Text</q-tooltip>
</q-btn>
{{ caption }}
</q-item-label>
</q-item-section>
Expand All @@ -80,7 +87,9 @@
round
icon="my_location"
@click="zoomToBounds"
/>
>
<q-tooltip :delay="1000">Zoom to Feature</q-tooltip>
</q-btn>
<q-btn
class="gt-xs"
size="14px"
Expand All @@ -90,7 +99,9 @@
:color="isVisible ? 'primary' : 'gray'"
:icon="isVisible ? 'visibility' : 'visibility_off'"
@click="toggleVisibility"
/>
>
<q-tooltip :delay="1000">Toggle Visibility</q-tooltip>
</q-btn>
<q-btn class="gt-xs" size="14px" flat dense round>
<div
:style="[
Expand All @@ -110,6 +121,7 @@
style="max-width: 250px"
/>
</q-popup-proxy>
<q-tooltip :delay="1000">Select Color</q-tooltip>
</q-btn>
<q-btn
v-if="showDeleteButton()"
Expand All @@ -120,7 +132,9 @@
round
icon="delete"
@click="deleteFeatures"
/>
>
<q-tooltip :delay="1000">Delete Feature</q-tooltip>
</q-btn>
</div>
</q-item-section>
</q-item>
Expand Down
6 changes: 4 additions & 2 deletions service/src/main/frontend/src/components/GeoToolboxPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
size="10px"
icon="close"
@click="appState.disableConfigPanel"
/>
>
<q-tooltip :delay="1000">Close</q-tooltip>
</q-btn>
</q-card-section>
</q-card>
<q-list bordered class="q-pa-none">
<!-- Get index entries for geometry -->
<q-expansion-item
group="contentgroup"
icon="grid_view"
label="Geo Index"
label="Geo Indices"
header-class="text-secondary"
>
<GeoIndexForm :supportedGeometries="supportedGeometries" />
Expand Down
8 changes: 6 additions & 2 deletions service/src/main/frontend/src/components/LeafletMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
editDialog = true;
editDialogText = manualGeometryForm.geometry;
"
/>
<q-btn dense flat icon="upload" @click="selectFile" />
>
<q-tooltip :delay="1000">Edit</q-tooltip>
</q-btn>
<q-btn dense flat icon="upload" @click="selectFile">
<q-tooltip :delay="1000">Upload</q-tooltip>
</q-btn>
</template>
</q-input>
</div>
Expand Down
Loading

0 comments on commit 3aa5487

Please sign in to comment.