public static void writeColor(final String tagName, final int indent, final Color color, final XmlWriter writer) { final String[] colorTags = XmlWriter.createTags(indent, tagName); writer.println(colorTags[0]); DimapProductHelpers.printColorTag(indent + 1, color, writer); writer.println(colorTags[1]); } }
public static void writePlacemarksFile(Writer writer, List<Placemark> placemarks) throws IOException { XmlWriter xmlWriter = new XmlWriter(writer, true); final String[] tags = XmlWriter.createTags(0, "Placemarks"); xmlWriter.println(tags[0]); for (Placemark placemark : placemarks) { if (placemark != null) { writeXML(placemark, xmlWriter, 1); } } xmlWriter.println(tags[1]); xmlWriter.close(); }
public void writeXML(XmlWriter writer, int indent) { Guardian.assertNotNull("writer", writer); Guardian.assertGreaterThan("indent", indent, -1); String[][] attributes = new String[1][]; attributes[0] = new String[]{DimapProductConstants.ATTRIB_NAME, getName()}; String[] bdTags = XmlWriter.createTags(indent, DimapProductConstants.TAG_BITMASK_DEFINITION, attributes); writer.println(bdTags[0]); String description = getDescription(); if (description == null) { description = ""; } attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, description}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_DESCRIPTION, attributes, null); String expr = getExpr(); if (expr == null) { expr = ""; } attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, expr}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_EXPRESSION, attributes, null); DimapProductHelpers.printColorTag(indent + 1, getColor(), writer); attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, String.valueOf(getTransparency())}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_TRANSPARENCY, attributes, null); writer.println(bdTags[1]); }
protected void writeMaskUsages(XmlWriter pw, int indent, RasterDataNode[] rasterDataNodes) { Guardian.assertNotNull("pw", pw); Guardian.assertNotNull("rasterDataNodes", rasterDataNodes); for (int i = 0; i < rasterDataNodes.length; i++) { final RasterDataNode rasterDataNode = rasterDataNodes[i]; ProductNodeGroup<Mask> overlayMaskGroup = rasterDataNode.getOverlayMaskGroup(); if (overlayMaskGroup.getNodeCount() > 0) { final String[] boTags = createTags(indent, DimapProductConstants.TAG_MASK_USAGE); pw.println(boTags[0]); if (rasterDataNode instanceof Band) { pw.printLine(indent + 1, DimapProductConstants.TAG_BAND_INDEX, i); } else { pw.printLine(indent + 1, DimapProductConstants.TAG_TIE_POINT_GRID_INDEX, i); } final String[][] attributes = new String[1][]; if (overlayMaskGroup.getNodeCount() > 0) { attributes[0] = new String[]{ DimapProductConstants.ATTRIB_NAMES, StringUtils.arrayToCsv(overlayMaskGroup.getNodeNames()) }; pw.printLine(indent + 1, DimapProductConstants.TAG_OVERLAY, attributes, null); } pw.println(boTags[1]); } } }
public static void writeXML(Placemark placemark, XmlWriter writer, int indent) { Guardian.assertNotNull("writer", writer); Guardian.assertGreaterThan("indent", indent, -1); final String[][] attributes = {new String[]{DimapProductConstants.ATTRIB_NAME, placemark.getName()}}; final String[] pinTags = XmlWriter.createTags(indent, DimapProductConstants.TAG_PLACEMARK, attributes); writer.println(pinTags[0]); indent++; writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LABEL, placemark.getLabel()); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_DESCRIPTION, placemark.getDescription()); final GeoPos geoPos = placemark.getGeoPos(); if (geoPos != null) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LATITUDE, geoPos.lat); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LONGITUDE, geoPos.lon); } final PixelPos pixelPos = placemark.getPixelPos(); if (pixelPos != null && pixelPos.isValid()) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_PIXEL_X, pixelPos.x); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_PIXEL_Y, pixelPos.y); } final String styleCss = placemark.getStyleCss(); if (styleCss != null && !styleCss.isEmpty()) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_STYLE_CSS, styleCss); } writer.println(pinTags[1]); }
if (band.getImageInfo() != null) { final String[] bsTags = createTags(indent + 1, DimapProductConstants.TAG_BAND_STATISTICS); sXmlW.println(bsTags[0]); sXmlW.printLine(indent + 2, DimapProductConstants.TAG_BAND_INDEX, i); final ColorPaletteDef.Point point = (ColorPaletteDef.Point) iterator.next(); final String[] cppTags = createTags(indent + 2, DimapProductConstants.TAG_COLOR_PALETTE_POINT); sXmlW.println(cppTags[0]); sXmlW.printLine(indent + 3, DimapProductConstants.TAG_SAMPLE, point.getSample()); if (StringUtils.isNotNullAndNotEmpty(point.getLabel())) { sXmlW.println(cppTags[1]); sXmlW.println(bsTags[1]);