コード例 #1
0
 /**
  * Parse Layer Bounding Boxes
  *
  * @param nl
  * @return LayerBoundingBox[]
  * @throws XMLParsingException
  */
 protected LayerBoundingBox[] parseLayerBoundingBoxes(List nl) throws XMLParsingException {
   LOG.entering();
   LayerBoundingBox[] llBoxes = new LayerBoundingBox[nl.size()];
   for (int i = 0; i < llBoxes.length; i++) {
     double minx = XMLTools.getRequiredNodeAsDouble((Node) nl.get(i), "./@minx", nsContext);
     double maxx = XMLTools.getRequiredNodeAsDouble((Node) nl.get(i), "./@maxx", nsContext);
     double miny = XMLTools.getRequiredNodeAsDouble((Node) nl.get(i), "./@miny", nsContext);
     double maxy = XMLTools.getRequiredNodeAsDouble((Node) nl.get(i), "./@maxy", nsContext);
     double resx = XMLTools.getNodeAsDouble((Node) nl.get(i), "./@resx", nsContext, -1);
     double resy = XMLTools.getNodeAsDouble((Node) nl.get(i), "./@resx", nsContext, -1);
     String srs = XMLTools.getRequiredNodeAsString((Node) nl.get(i), "./@SRS", nsContext);
     Position min = GeometryFactory.createPosition(minx, miny);
     Position max = GeometryFactory.createPosition(maxx, maxy);
     llBoxes[i] = new LayerBoundingBox(min, max, srs, resx, resy);
   }
   LOG.exiting();
   return llBoxes;
 }
コード例 #2
0
  /**
   * Parse Scale Hint
   *
   * @param layerElem
   * @return ScaleHint
   * @throws XMLParsingException
   */
  protected ScaleHint parseScaleHint(Element layerElem) throws XMLParsingException {
    LOG.entering();

    ScaleHint scaleHint = null;

    Node scNode = XMLTools.getNode(layerElem, "./ScaleHint", nsContext);
    if (scNode != null) {
      double mn = XMLTools.getNodeAsDouble(scNode, "./@min", nsContext, 0);
      double mx = XMLTools.getNodeAsDouble(scNode, "./@max", nsContext, Double.MAX_VALUE);
      scaleHint = new ScaleHint(mn, mx);
    } else {
      // set default value to avoid NullPointerException
      // when accessing a layers scalehint
      scaleHint = new ScaleHint(0, Double.MAX_VALUE);
    }

    LOG.exiting();
    return scaleHint;
  }