/** * Encode a GML time period * * @param beginPosition * @param endPosition * @param timePeriodId * @param intervalUnit * @param intervalValue */ public void encodeTimePeriod( String beginPosition, String endPosition, String timePeriodId, String intervalUnit, Long intervalValue) { AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "gml:id", "gml:id", "", timePeriodId); start("gml:TimePeriod", atts); element("gml:beginPosition", beginPosition); element("gml:endPosition", endPosition); if (intervalUnit != null && intervalValue != null) { atts = new AttributesImpl(); atts.addAttribute("", "unit", "unit", "", intervalUnit); element("gml:timeInterval", intervalValue.toString(), atts); } end("gml:TimePeriod"); }
/** * Encode Interval * * @param beginPosition * @param endPosition * @param dimensionId */ public void encodeInterval( String beginPosition, String endPosition, String intervalUnit, Double intervalValue) { AttributesImpl atts = new AttributesImpl(); start(TAG.RANGE, atts); element(TAG.INTERVAL_START, beginPosition); element(TAG.INTERVAL_END, endPosition); if (intervalUnit != null && intervalValue != null) { atts = new AttributesImpl(); atts.addAttribute("", "unit", "unit", "", intervalUnit); element(TAG.INTERVAL_PERIOD, intervalValue.toString(), atts); } end(TAG.RANGE); } /**
/** * Encode a Date item as a GML TimeInstant * * @param item * @param helper * @param id */ private void encodeDate( final Date item, final WCSDimensionsHelper helper, final String id) { final AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "gml:id", "gml:id", "", id); start("gml:TimeInstant", atts); element("gml:timePosition", helper.format(item)); end("gml:TimeInstant"); }
element("gml:low", lowSb.toString().trim()); element("gml:high", highSb.toString().trim()); end("gml:GridEnvelope"); end("gml:limits"); ? g2W.getTranslateY() + " " + g2W.getTranslateX() : g2W.getTranslateX() + " " + g2W.getTranslateY()); end("gml:Point"); end("gml:origin"); + Double.valueOf(axesSwap ? g2W.getShearY() : g2W.getScaleY()), offsetAttr); end("gml:RectifiedGrid"); end("gml:domainSet");
end("gml:RectifiedGridCoverage");
end("swe:description"); uom == null ? "W.m-2.Sr-1" : SimpleUnitFormat.getInstance().format(uom)); start("swe:uom", uomAttr); end("swe:uom"); start("swe:AllowedValues"); end("swe:AllowedValues"); end("swe:constraint"); end("swe:Quantity"); end("swe:field"); end("swe:DataRecord"); end("gml:rangeType");
end(TAG.ADDITIONAL_DIMENSION);
end(TAG.TIME_DOMAIN);
end(TAG.ELEVATION_DOMAIN);
/** * Encode the coverage function or better the GridFunction as per clause 19.3.12 of GML * 3.2.1 which helps us with indicating in which way we traverse the data. * * <p>Notice that we use the axisOrder to actually <strong>always</strong> encode data il * easting,northing, hence in case of a northing,easting crs we use a reversed order to * indicate that we always walk on the raster columns first. * * <p>In cases where the coordinates increases in the opposite order ho our walk the * offsetVectors of the RectifiedGrid will do the rest. * * @param gc2d * @param axisSwap */ public void handleCoverageFunction(GridEnvelope2D gridRange, boolean axisSwap) { start("gml:coverageFunction"); start("gml:GridFunction"); // build the fragment final AttributesImpl gridAttrs = new AttributesImpl(); gridAttrs.addAttribute("", "axisOrder", "axisOrder", "", axisSwap ? "+2 +1" : "+1 +2"); element("gml:sequenceRule", "Linear", gridAttrs); // minOccurs 0, default Linear element( "gml:startPoint", gridRange.x + " " + gridRange.y); // we start at minx, miny (this is optional though) end("gml:GridFunction"); end("gml:coverageFunction"); }
/** * Encode the interval range * * @param range */ private boolean setRange(NumberRange<? extends Number> range) { if (range != null && !Double.isInfinite(range.getMaximum()) && !Double.isInfinite(range.getMinimum())) { start("swe:interval"); chars(range.getMinValue() + " " + range.getMaxValue()); end("swe:interval"); return true; } return false; }
private void encodeFileReference(FileReference fileReference) { start("gml:File"); final AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "xlink:arcrole", "xlink:arcrole", "", "fileReference"); atts.addAttribute( "", "xlink:href", "xlink:href", "", "cid:" + fileReference.getReference()); atts.addAttribute( "", "xlink:role", "xlink:role", "", fileReference.getConformanceClass()); element("gml:rangeParameters", "", atts); element("gml:fileReference", "cid:" + fileReference.getReference()); element("gml:fileStructure", ""); element("gml:mimeType", fileReference.getMimeType()); end("gml:File"); }
/** * Encodes the Range as per the GML spec of the provided {@link GridCoverage2D} * * @param gc2d the {@link GridCoverage2D} for which to encode the Range. */ public void handleRange(GridCoverage2D gc2d) { // preamble start("gml:rangeSet"); if (fileReference != null) { encodeFileReference(fileReference); } else { encodeAsDataBlocks(gc2d); } end("gml:rangeSet"); }