public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException { CRSEnvelope bbox = new CRSEnvelope(); bbox.setMinX(Double.parseDouble(attrs.getValue("minx"))); bbox.setMaxX(Double.parseDouble(attrs.getValue("maxx"))); bbox.setMinY(Double.parseDouble(attrs.getValue("miny"))); bbox.setMaxY(Double.parseDouble(attrs.getValue("maxy"))); return bbox; }
public void setLatLonBoundingBox(CRSEnvelope latLonBoundingBox) { if (latLonBoundingBox.getSRSName() != null) { String srsName = latLonBoundingBox.getSRSName(); if (!srsName.equals("CRS:84")) { throw new IllegalStateException( "Layer LatLonBoundingBox srsName required to be null or CRS:84"); } } else { latLonBoundingBox.setSRSName("CRS:84", false); } this.latLonBoundingBox = latLonBoundingBox; }
public static CRSEnvelope bbox2bbox(BoundingBoxType bbox) { return new CRSEnvelope( bbox.getCrs(), (Double) bbox.getLowerCorner().get(0), (Double) bbox.getLowerCorner().get(1), (Double) bbox.getUpperCorner().get(0), (Double) bbox.getUpperCorner().get(1)); } }
while (iBboxList.hasNext()) { CRSEnvelope bbox = (CRSEnvelope)iBboxList.next(); bboxes.put(bbox.getEPSGCode(), bbox);
/** * Returns every BoundingBox associated with this layer. The <code>HashMap</code> returned has * each bounding box's SRS Name (usually an EPSG code) value as the key, and the value is the * <code>BoundingBox</code> object itself. * * <p>Implements inheritance: if this layer's bounding box is null, query ancestors until the * first bounding box is found or no more ancestors * * @return a HashMap of all of this layer's bounding boxes or null if no bounding boxes found */ public synchronized Map<String, CRSEnvelope> getBoundingBoxes() { if (allBoundingBoxesCache == null) { allBoundingBoxesCache = new HashMap<String, CRSEnvelope>(); for (CRSEnvelope bbox : getLayerBoundingBoxes()) { allBoundingBoxesCache.put(bbox.getSRSName(), bbox); } Layer parent = this.getParent(); while (parent != null && allBoundingBoxesCache.size() == 0) { for (CRSEnvelope bbox : parent.getLayerBoundingBoxes()) { allBoundingBoxesCache.put(bbox.getSRSName(), bbox); } parent = parent.getParent(); } } // May return empty. But that is OK since spec says 0 or more may be specified return allBoundingBoxesCache; }
@Override public Object convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException { try { String srsName = parentElement.getChild(SRS_NAME).getValue(); double minX = Double.parseDouble(parentElement.getChild(MIN_X).getValue()); double minY = Double.parseDouble(parentElement.getChild(MIN_Y).getValue()); double maxX = Double.parseDouble(parentElement.getChild(MAX_X).getValue()); double maxY = Double.parseDouble(parentElement.getChild(MAX_Y).getValue()); value = new CRSEnvelope(srsName, minX, minY, maxX, maxY); } catch (Exception e) { throw new IllegalArgumentException(e); } return value; }
CRSEnvelope bbox = (CRSEnvelope) value[i].getValue(); boundingBoxes.put(bbox.getEPSGCode(), bbox);
public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException { CRSEnvelope bbox = new CRSEnvelope(); bbox.setMinX(Double.parseDouble(attrs.getValue("minx"))); bbox.setMaxX(Double.parseDouble(attrs.getValue("maxx"))); bbox.setMinY(Double.parseDouble(attrs.getValue("miny"))); bbox.setMaxY(Double.parseDouble(attrs.getValue("maxy"))); return bbox; }
@Override public Object convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException { try { String srsName = parentElement.getChild(SRS_NAME).getValue(); double minX = Double.parseDouble(parentElement.getChild(MIN_X).getValue()); double minY = Double.parseDouble(parentElement.getChild(MIN_Y).getValue()); double maxX = Double.parseDouble(parentElement.getChild(MAX_X).getValue()); double maxY = Double.parseDouble(parentElement.getChild(MAX_Y).getValue()); value = new CRSEnvelope(srsName, minX, minY, maxX, maxY); } catch (Exception e) { throw new IllegalArgumentException(e); } return value; }
CRSEnvelope bbox = (CRSEnvelope) value[i].getValue(); boundingBoxes.put(bbox.getEPSGCode(), bbox);
/** * Fix the provided layer's bounding box so that it can be correctly handled. * * <p>Call layer.clearCache() after this method. * * @param layer * @param forceXY true prior to WMS 1.3.0, false after WMS 1.3.0 */ static void fixLayerBoundingBox(Layer layer, boolean forceXY) { if (layer == null) { return; } if (layer.getLayerBoundingBoxes() != null) { for (CRSEnvelope boundingBox : layer.getLayerBoundingBoxes()) { String srsName = boundingBox.getSRSName(); boundingBox.setSRSName(srsName, forceXY); } } for (Layer child : layer.getChildren()) { fixLayerBoundingBox(child, forceXY); } }