use of org.n52.shetland.w3c.xlink.Reference in project arctic-sea by 52North.
the class ReferenceReader method parseReference.
protected Reference parseReference() {
Reference ref = new Reference();
ref.setHref(URI.create(attr(W3CConstants.QN_XLINK_HREF).get()));
ref.setActuate(attr(W3CConstants.QN_XLINK_ACTUATE).orNull());
ref.setArcrole(attr(W3CConstants.QN_XLINK_ARCROLE).orNull());
ref.setRole(attr(W3CConstants.QN_XLINK_ROLE).orNull());
ref.setShow(attr(W3CConstants.QN_XLINK_SHOW).orNull());
ref.setTitle(attr(W3CConstants.QN_XLINK_TITLE).orNull());
ref.setType(attr(W3CConstants.QN_XLINK_TYPE).orNull());
return ref;
}
use of org.n52.shetland.w3c.xlink.Reference in project series-rest-api by 52North.
the class MultipleChartsRenderer method writeDataToChart.
@Override
public void writeDataToChart(DataCollection<QuantityData> data) {
Map<String, QuantityData> allTimeseries = data.getAllSeries();
List<? extends DatasetOutput> timeseriesMetadatas = getMetadataOutputs();
int rendererCount = timeseriesMetadatas.size();
for (int rendererIndex = 0; rendererIndex < timeseriesMetadatas.size(); rendererIndex++) {
/*
* For each index put data and its renderer configured to a particular style.
*
* As each timeseries may define its custom styling and different chart types we have to loop over
* all timeseries to configure chart rendering.
*/
DatasetOutput timeseriesMetadata = timeseriesMetadatas.get(rendererIndex);
String timeseriesId = timeseriesMetadata.getId();
StyleProperties style = getTimeseriesStyleFor(timeseriesId);
QuantityData timeseriesData = allTimeseries.get(timeseriesId);
String chartId = createChartId(timeseriesMetadata);
ChartIndexConfiguration configuration = new ChartIndexConfiguration(chartId, rendererIndex);
configuration.setData(timeseriesData, timeseriesMetadata, style);
configuration.setRenderer(createRenderer(style));
if (timeseriesData.hasReferenceValues()) {
int referenceIndex = rendererCount;
/*
* Configure timeseries reference value renderers with the same metadata and add it at the end
* of the plot's renderer list.
*/
QuantityDatasetMetadata metadata = timeseriesData.getMetadata();
Map<String, QuantityData> referenceValues = metadata.getReferenceValues();
for (Entry<String, QuantityData> referencedTimeseries : referenceValues.entrySet()) {
String referenceTimeseriesId = referencedTimeseries.getKey();
ReferenceValueOutput referenceOutput = getReferenceValue(referenceTimeseriesId, timeseriesMetadata);
String referenceChartId = createChartId(timeseriesMetadata, referenceOutput.getLabel());
QuantityData referenceData = referenceValues.get(referenceTimeseriesId);
ChartIndexConfiguration referenceConfiguration = new ChartIndexConfiguration(referenceChartId, referenceIndex);
StyleProperties referenceStyle = getTimeseriesStyleFor(timeseriesId, referenceTimeseriesId);
referenceConfiguration.setReferenceData(referenceData, timeseriesMetadata, referenceStyle);
referenceConfiguration.setRenderer(createRenderer(referenceStyle));
referenceIndex++;
}
}
}
}
use of org.n52.shetland.w3c.xlink.Reference in project series-rest-api by 52North.
the class IoParameters method transformToInnerCrs.
/**
* @param point
* a GeoJSON point to be transformed to internally used CRS:84.
* @param crsUtils
* a reference helper.
* @return a transformed GeoJSON instance.
* @throws IoParseException
* if point could not be transformed, or if requested CRS object could not be created.
*/
private GeojsonPoint transformToInnerCrs(GeojsonPoint point, CRSUtils crsUtils) {
try {
Point toTransformed = crsUtils.convertToPointFrom(point, getCrs());
Point crs84Point = (Point) crsUtils.transformOuterToInner(toTransformed, getCrs());
return crsUtils.convertToGeojsonFrom(crs84Point);
} catch (TransformException e) {
throw new IoParseException("Could not transform to internally used CRS:84.", e);
} catch (FactoryException e) {
throw new IoParseException("Check if 'crs' parameter is a valid EPSG CRS. Was: '" + getCrs() + "'.", e);
}
}
use of org.n52.shetland.w3c.xlink.Reference in project arctic-sea by 52North.
the class AbstractJSONDecoder method parseReference.
protected Reference parseReference(JsonNode node) {
Reference ref = new Reference();
ref.setHref(URI.create(node.path(AQDJSONConstants.HREF).textValue()));
ref.setActuate(node.path(AQDJSONConstants.ACTUATE).textValue());
ref.setArcrole(node.path(AQDJSONConstants.ARCROLE).textValue());
ref.setRemoteSchema(node.path(AQDJSONConstants.REMOTE_SCHEMA).textValue());
ref.setRole(node.path(AQDJSONConstants.ROLE).textValue());
ref.setShow(node.path(AQDJSONConstants.SHOW).textValue());
ref.setTitle(node.path(AQDJSONConstants.TITLE).textValue());
ref.setType(node.path(AQDJSONConstants.TYPE).textValue());
return ref;
}
use of org.n52.shetland.w3c.xlink.Reference in project arctic-sea by 52North.
the class SweCommonDecoderV101 method parseEnvelope.
private SweAbstractDataComponent parseEnvelope(EnvelopeType envelopeType) throws DecodingException {
String referenceFrame = null;
SweVector lowerCorner = null;
SweVector upperCorner = null;
SweTimeRange time = null;
if (envelopeType.isSetReferenceFrame()) {
referenceFrame = envelopeType.getReferenceFrame();
}
if (envelopeType.getLowerCorner() != null) {
lowerCorner = parseVectorProperty(envelopeType.getLowerCorner());
}
if (envelopeType.getUpperCorner() != null) {
upperCorner = parseVectorProperty(envelopeType.getUpperCorner());
}
if (envelopeType.isSetTime()) {
time = parseTimeRange(envelopeType.getTime().getTimeRange());
}
// FIXME get the northing first value for the reference frame
boolean northingFirst = false;
return new SweEnvelope(referenceFrame, upperCorner, lowerCorner, time, northingFirst);
}
Aggregations