Skip to content
Snippets Groups Projects
Commit 3f5548e2 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

add display, value to imt

parent 80695a00
No related branches found
No related tags found
1 merge request!507Hazard response
...@@ -31,6 +31,7 @@ import gov.usgs.earthquake.nshmp.model.SourceType; ...@@ -31,6 +31,7 @@ import gov.usgs.earthquake.nshmp.model.SourceType;
import gov.usgs.earthquake.nshmp.www.HazardController; import gov.usgs.earthquake.nshmp.www.HazardController;
import gov.usgs.earthquake.nshmp.www.meta.DoubleParameter; import gov.usgs.earthquake.nshmp.www.meta.DoubleParameter;
import gov.usgs.earthquake.nshmp.www.meta.Metadata; import gov.usgs.earthquake.nshmp.www.meta.Metadata;
import gov.usgs.earthquake.nshmp.www.meta.Parameter;
import gov.usgs.earthquake.nshmp.www.services.ServicesUtil.ServiceQueryData; import gov.usgs.earthquake.nshmp.www.services.ServicesUtil.ServiceQueryData;
import gov.usgs.earthquake.nshmp.www.services.ServicesUtil.ServiceRequestData; import gov.usgs.earthquake.nshmp.www.services.ServicesUtil.ServiceRequestData;
import gov.usgs.earthquake.nshmp.www.services.SourceServices.SourceModel; import gov.usgs.earthquake.nshmp.www.services.SourceServices.SourceModel;
...@@ -216,20 +217,12 @@ public final class HazardService { ...@@ -216,20 +217,12 @@ public final class HazardService {
} }
private static final class ResponseMetadata { private static final class ResponseMetadata {
// final SourceModel model;
// final double latitude;
// final double longitude;
// final double vs30;
final String imt;
final String xlabel = "Ground Motion (g)"; final String xlabel = "Ground Motion (g)";
final String ylabel = "Annual Frequency of Exceedence"; final String ylabel = "Annual Frequency of Exceedence";
final Object server;
ResponseMetadata(Imt imt) { ResponseMetadata(Object server) {
// model = new SourceModel(ServletUtil.model()); this.server = server;
// latitude = data.latitude;
// longitude = data.longitude;
// vs30 = data.vs30;
this.imt = imtShortLabel(imt);
} }
} }
...@@ -253,21 +246,21 @@ public final class HazardService { ...@@ -253,21 +246,21 @@ public final class HazardService {
} }
private static final class ResponseData { private static final class ResponseData {
final Object server; final ResponseMetadata metadata;
final List<HazardResponse> hazards; final List<HazardResponse> hazards;
ResponseData(Object server, List<HazardResponse> hazards) { ResponseData(ResponseMetadata metadata, List<HazardResponse> hazards) {
this.server = server; this.metadata = metadata;
this.hazards = hazards; this.hazards = hazards;
} }
} }
private static final class HazardResponse { private static final class HazardResponse {
final ResponseMetadata metadata; final Parameter imt;
final List<Curve> data; final List<Curve> data;
HazardResponse(ResponseMetadata metadata, List<Curve> data) { HazardResponse(Imt imt, List<Curve> data) {
this.metadata = metadata; this.imt = new Parameter(imtShortLabel(imt), imt.name());
this.data = data; this.data = data;
} }
} }
...@@ -343,7 +336,6 @@ public final class HazardService { ...@@ -343,7 +336,6 @@ public final class HazardService {
var hazards = new ArrayList<HazardResponse>(); var hazards = new ArrayList<HazardResponse>();
for (Imt imt : totalMap.keySet()) { for (Imt imt : totalMap.keySet()) {
var responseData = new ResponseMetadata(imt);
var curves = new ArrayList<Curve>(); var curves = new ArrayList<Curve>();
// total curve // total curve
...@@ -355,11 +347,11 @@ public final class HazardService { ...@@ -355,11 +347,11 @@ public final class HazardService {
curves.add(new Curve(type.toString(), typeMap.get(type))); curves.add(new Curve(type.toString(), typeMap.get(type)));
} }
hazards.add(new HazardResponse(responseData, List.copyOf(curves))); hazards.add(new HazardResponse(imt, List.copyOf(curves)));
} }
Object server = Metadata.serverData(ServletUtil.THREAD_COUNT, timer); Object server = Metadata.serverData(ServletUtil.THREAD_COUNT, timer);
var response = new ResponseData(server, List.copyOf(hazards)); var response = new ResponseData(new ResponseMetadata(server), List.copyOf(hazards));
return new Response<>(Status.SUCCESS, NAME, request, response, urlHelper); return new Response<>(Status.SUCCESS, NAME, request, response, urlHelper);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment