Skip to content

Commit

Permalink
Merge pull request #468 from chrisvpeters/AUS-3945
Browse files Browse the repository at this point in the history
Aus 3945
  • Loading branch information
jia020 authored Mar 4, 2024
2 parents 574f8e4 + 28a2fb5 commit 93a4856
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/coverage/jacoco.csv
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
<version>4.10.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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<Object> coords = new ArrayList<>();
for (int i = 0; i < polygon.length(); i++) {
JSONArray coordNode = (JSONArray) polygon.get(i);

List<Double> 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<Object> coords = new ArrayList<>();
for (int i = 0; i < bbox.length(); i++) {
JSONArray coordNode = (JSONArray) bbox.get(i);

List<Double> 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) {
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public class KnownLayer implements Serializable {
/** VMF - geoJson polygon */
private JSONArray polygon;

/** geoJson bbox */
private JSONArray bbox;

/**
* Creates a new KnownLayer
*
Expand Down Expand Up @@ -532,6 +535,13 @@ public JSONArray getPolygon() {
return polygon;
}

/**
* @return the initial - bbox
*/
public JSONArray getBBox() {
return bbox;
}

/**
* Set the VMF - polygon
*
Expand All @@ -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);

}

}

}

0 comments on commit 93a4856

Please sign in to comment.