From 9d919faca73b87e6eab5afd6b91651d587cffa41 Mon Sep 17 00:00:00 2001 From: chrisvpeters Date: Thu, 29 Feb 2024 23:22:05 +0000 Subject: [PATCH 1/2] Autogenerated JaCoCo coverage badge --- .github/coverage/jacoco.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/coverage/jacoco.csv b/.github/coverage/jacoco.csv index 74e5616aa..38077d013 100644 --- a/.github/coverage/jacoco.csv +++ b/.github/coverage/jacoco.csv @@ -1,6 +1,6 @@ GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED -Portal-Core,org.auscope.portal.core.server,PortalProfileXmlWebApplicationContext,24,0,2,0,5,0,3,0,2,0 Portal-Core,org.auscope.portal.core.server,PortalPropertySourcesPlaceholderConfigurer,99,0,10,0,25,0,8,0,3,0 +Portal-Core,org.auscope.portal.core.server,PortalProfileXmlWebApplicationContext,24,0,2,0,5,0,3,0,2,0 Portal-Core,org.auscope.portal.core.server,OgcServiceProviderType,0,36,0,2,0,6,0,3,0,2 Portal-Core,org.auscope.portal.core.services.methodmakers,GeonetworkMethodMaker,210,0,0,0,39,0,7,0,7,0 Portal-Core,org.auscope.portal.core.services.methodmakers,SOSMethodMaker,4,295,8,18,1,61,8,8,0,3 @@ -48,8 +48,8 @@ Portal-Core,org.auscope.portal.core.services.responses.wcs,SingleValue,0,17,0,0, Portal-Core,org.auscope.portal.core.services.responses.wcs,CoverageOfferingBrief,45,120,2,4,18,27,8,8,6,7 Portal-Core,org.auscope.portal.core.services.responses.wcs,SimpleEnvelope,77,137,4,6,16,28,6,10,2,9 Portal-Core,org.auscope.portal.core.services.responses.wcs,TimeConstraint,41,65,5,5,5,14,4,8,1,6 -Portal-Core,org.auscope.portal.core.services.responses.wcs,SimpleTimePosition,0,45,0,0,0,13,0,3,0,3 Portal-Core,org.auscope.portal.core.services.responses.wcs,RectifiedGrid,89,244,0,8,17,63,1,21,1,17 +Portal-Core,org.auscope.portal.core.services.responses.wcs,SimpleTimePosition,0,45,0,0,0,13,0,3,0,3 Portal-Core,org.auscope.portal.core.services.responses.wcs,AxisDescriptionImpl,4,79,1,3,1,16,1,6,0,5 Portal-Core,org.auscope.portal.core.services.csw.custom,CustomRegistry,78,0,8,0,23,0,15,0,11,0 Portal-Core,org.auscope.portal.core.server.http,HttpServiceCaller,241,163,15,15,57,41,22,10,12,5 @@ -238,8 +238,8 @@ Portal-Core,org.auscope.portal.core.util,FileIOUtil,415,569,50,58,118,142,47,31, Portal-Core,org.auscope.portal.core.util,MimeUtil,20,143,5,15,6,33,6,7,1,2 Portal-Core,org.auscope.portal.core.util,DOMResponseUtil,19,41,0,0,5,11,1,1,1,1 Portal-Core,org.auscope.portal.core.util,ResourceUtil,15,14,1,1,2,5,2,2,1,2 -Portal-Core,org.auscope.portal.core.util,DateUtil.TimeField,0,33,0,0,0,2,0,1,0,1 Portal-Core,org.auscope.portal.core.util,SLDLoader,137,84,11,9,29,22,10,5,3,2 +Portal-Core,org.auscope.portal.core.util,DateUtil.TimeField,0,33,0,0,0,2,0,1,0,1 Portal-Core,org.auscope.portal.core.util,DOMUtil,3,136,0,2,1,37,1,9,1,8 Portal-Core,org.auscope.portal.core.util,HttpUtil,92,48,4,2,19,7,5,2,3,1 Portal-Core,org.auscope.portal.core.util,TextUtil,58,50,11,3,10,11,10,3,4,2 From 28a2fb51def133bbaa7beb73acf85ac1532314ed Mon Sep 17 00:00:00 2001 From: chrisvpeters Date: Fri, 1 Mar 2024 17:17:13 +1100 Subject: [PATCH 2/2] AUS-3945 --- pom.xml | 2 +- .../core/view/ViewKnownLayerFactory.java | 40 ++++++++++++++----- .../core/view/knownlayer/KnownLayer.java | 31 ++++++++++++++ 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 824d79922..bece353d8 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ com.squareup.okhttp3 okhttp - 4.12.0 + 4.10.0 diff --git a/src/main/java/org/auscope/portal/core/view/ViewKnownLayerFactory.java b/src/main/java/org/auscope/portal/core/view/ViewKnownLayerFactory.java index 13a825dd3..ae7abfbfc 100644 --- a/src/main/java/org/auscope/portal/core/view/ViewKnownLayerFactory.java +++ b/src/main/java/org/auscope/portal/core/view/ViewKnownLayerFactory.java @@ -17,7 +17,8 @@ import org.springframework.ui.ModelMap; /** - * A factory class containing methods for generating view representations of the KnownLayer + * A factory class containing methods for generating view representations of the + * KnownLayer * * @author Josh Vote * @@ -68,25 +69,42 @@ public ModelMap toView(KnownLayer k) { // add a geojson object to support the VMF layer - Indigenous if (k.getEndPoint() != null) { - ModelMap geoObj = new ModelMap(); + ModelMap geoObj = new ModelMap(); geoObj.put("endPoint", k.getEndPoint()); if (k.getPolygon() != null) { JSONArray polygon = k.getPolygon(); List coords = new ArrayList<>(); for (int i = 0; i < polygon.length(); i++) { JSONArray coordNode = (JSONArray) polygon.get(i); - + List coord = new ArrayList<>(); coord.add((Double) coordNode.get(0)); coord.add((Double) coordNode.get(1)); - coords.add(coord); + coords.add(coord); } - geoObj.put("polygon", coords); + geoObj.put("polygon", coords); + } + obj.put("geojson", geoObj); + } + + // add a geojson object to support the bbox; + if (k.getBBox() != null) { + ModelMap geoObj = new ModelMap(); + JSONArray bbox = k.getBBox(); + List coords = new ArrayList<>(); + for (int i = 0; i < bbox.length(); i++) { + JSONArray coordNode = (JSONArray) bbox.get(i); + + List coord = new ArrayList<>(); + coord.add((Double) coordNode.get(0)); + coord.add((Double) coordNode.get(1)); + coords.add(coord); } + geoObj.put("bbox", coords); obj.put("geojson", geoObj); } - - // LayersMode is from GA GPT-41 where Layers can have Layers and they can be 'OR'd or 'AND'd. + // LayersMode is from GA GPT-41 where Layers can have Layers and they can be + // 'OR'd or 'AND'd. if (k.getKnownLayerSelector() != null) { KnownLayerSelector knownLayerSelector = k.getKnownLayerSelector(); if (knownLayerSelector instanceof WMSSelectors) { @@ -99,8 +117,8 @@ public ModelMap toView(KnownLayer k) { obj.put("layerMode", SelectorsMode.NA); } - if(k.getFilterCollection()!=null){ - obj.put("filterCollection",k.getFilterCollection()); + if (k.getFilterCollection() != null) { + obj.put("filterCollection", k.getFilterCollection()); } if (k.getStackdriverServiceGroup() != null) { @@ -109,9 +127,9 @@ public ModelMap toView(KnownLayer k) { if (k.getSupportsCsvDownloads()) { obj.put("supportsCsvDownloads", k.getSupportsCsvDownloads()); } - + if (k.getServerType() != null) { - obj.put("serverType", k.getServerType()); + obj.put("serverType", k.getServerType()); } return obj; diff --git a/src/main/java/org/auscope/portal/core/view/knownlayer/KnownLayer.java b/src/main/java/org/auscope/portal/core/view/knownlayer/KnownLayer.java index ba082714c..05ea8f6c6 100644 --- a/src/main/java/org/auscope/portal/core/view/knownlayer/KnownLayer.java +++ b/src/main/java/org/auscope/portal/core/view/knownlayer/KnownLayer.java @@ -116,6 +116,9 @@ public class KnownLayer implements Serializable { /** VMF - geoJson polygon */ private JSONArray polygon; + /** geoJson bbox */ + private JSONArray bbox; + /** * Creates a new KnownLayer * @@ -532,6 +535,13 @@ public JSONArray getPolygon() { return polygon; } + /** + * @return the initial - bbox + */ + public JSONArray getBBox() { + return bbox; + } + /** * Set the VMF - polygon * @@ -553,5 +563,26 @@ public void setPolygon(JSONArray polygonGeoJson) { } } + + /** + * Set the initialBBox + * + * @param bboxGeoJson + */ + public void setBBox(JSONArray bboxGeoJson) { + this.bbox = new JSONArray(); + + for (int i = 0; i < bboxGeoJson.length(); i++) { + + JSONArray oldCoordNode = (JSONArray) bboxGeoJson.get(i); + + JSONArray newCoordNode = new JSONArray(); + newCoordNode.put(oldCoordNode.get(0)); + newCoordNode.put(oldCoordNode.get(1)); + this.bbox.put(newCoordNode); + + } + + } }