List of usage examples for org.jdom2 Element addContent
@Override public Element addContent(final Collection<? extends Content> newContent)
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordBounds1D and adds it to the parent * element.// ww w . ja v a 2 s . c om * * @param name * The name of the element. * @param bounds * The CoordBounds1D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordBounds1DElement(String name, CoordBounds1D bounds, Element parent) { if (bounds == null) { return; } Element element = getCaom2Element(name); addCoordRange1DListElement("samples", bounds.getSamples(), element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordBounds2D and adds it to the parent * element.// ww w . j ava 2s .c o m * * @param name * The name of the element. * @param bounds * The CoordBounds2D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordBounds2DElement(String name, CoordBounds2D bounds, Element parent) { if (bounds == null) { return; } Element element = getCaom2Element(name); if (bounds instanceof CoordCircle2D) { addCoordCircle2DElement("circle", (CoordCircle2D) bounds, element); } else if (bounds instanceof CoordPolygon2D) { addCoordPolygon2DElement("polygon", (CoordPolygon2D) bounds, element); } else { throw new IllegalStateException( "BUG: unsupported CoordBounds2D type " + bounds.getClass().getSimpleName()); } parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordCircle2D and adds it to the parent * element./* www . j av a2s.co m*/ * * @param name * The name of the element. * @param circle * The CoordCircle2D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordCircle2DElement(String name, CoordCircle2D circle, Element parent) { if (circle == null) { return; } Element element = getCaom2Element(name); addValueCoord2DElement("center", circle.getCenter(), element); addNumberElement("radius", circle.getRadius(), element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordError and adds it to the parent * element.//www. j ava 2s . c o m * * @param name * The name of the element. * @param error * The CoordError to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordErrorElement(String name, CoordError error, Element parent) { if (error == null) { return; } Element element = getCaom2Element(name); addNumberElement("syser", error.syser, element); addNumberElement("rnder", error.rnder, element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordFunction1D and adds it to the * parent element./*from ww w.j a va2s . c o m*/ * * @param name * The name of the element. * @param function * The CoordFunction1D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordFunction1DElement(String name, CoordFunction1D function, Element parent) { if (function == null) { return; } Element element = getCaom2Element(name); addNumberElement("naxis", function.getNaxis(), element); addNumberElement("delta", function.getDelta(), element); addRefCoordElement("refCoord", function.getRefCoord(), element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordFunction2D and adds it to the * parent element.//w ww . j a v a 2 s . co m * * @param name * The name of the element. * @param function * The CoordFunction2D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordFunction2DElement(String name, CoordFunction2D function, Element parent) { if (function == null) { return; } Element element = getCaom2Element(name); addDimension2DElement("dimension", function.getDimension(), element); addCoord2DElement("refCoord", function.getRefCoord(), element); addNumberElement("cd11", function.getCd11(), element); addNumberElement("cd12", function.getCd12(), element); addNumberElement("cd21", function.getCd21(), element); addNumberElement("cd22", function.getCd22(), element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordPolygon2D and adds it to the * parent element./* ww w. j a v a 2 s . com*/ * * @param name * The name of the element. * @param polygon * The CoordPolygon2D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordPolygon2DElement(String name, CoordPolygon2D polygon, Element parent) { if (polygon == null) { return; } Element element = getCaom2Element(name); if (!polygon.getVertices().isEmpty()) { Element verticesElement = getCaom2Element("vertices"); element.addContent(verticesElement); for (ValueCoord2D vertex : polygon.getVertices()) { addValueCoord2DElement("vertex", vertex, verticesElement); } } parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordRange1D and adds it to the parent * element.// w w w. j av a2 s . c om * * @param name * The name of the element. * @param range * The CoordRange1D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordRange1DElement(String name, CoordRange1D range, Element parent) { if (range == null) { return; } Element element = getCaom2Element(name); addRefCoordElement("start", range.getStart(), element); addRefCoordElement("end", range.getEnd(), element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a CoordRange2D and adds it to the parent * element.//from w ww .j av a 2 s. com * * @param name * The name of the element. * @param range * The CoordRange2D to add to the parent. * @param parent * The parent element for this child element. */ protected void addCoordRange2DElement(String name, CoordRange2D range, Element parent) { if (range == null) { return; } Element element = getCaom2Element(name); addCoord2DElement("start", range.getStart(), element); addCoord2DElement("end", range.getEnd(), element); parent.addContent(element); }
From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java
License:Open Source License
/** * Builds a JDOM representation of a Dimension2D and adds it to the parent * element./*from ww w . j a va2 s. co m*/ * * @param name * The name of the element. * @param dimension * The Dimension2D to add to the parent. * @param parent * The parent element for this child element. */ protected void addDimension2DElement(String name, Dimension2D dimension, Element parent) { if (dimension == null) { return; } Element element = getCaom2Element(name); addNumberElement("naxis1", dimension.naxis1, element); addNumberElement("naxis2", dimension.naxis2, element); parent.addContent(element); }