Ejemplo n.º 1
0
 private Map<String, Double> fetchLineValues(KmlFeature feature, List<String> parameters) {
   try {
     double totalLength = feature.getGeometry().getLength();
     if (totalLength == 0) return Collections.emptyMap();
     Map<SimpleFeature, Double> shares = new HashMap<>();
     SimpleFeatureIterator iterator = getIterator();
     while (iterator.hasNext()) {
       SimpleFeature shape = iterator.next();
       Geometry shapeGeo = (Geometry) shape.getDefaultGeometry();
       Geometry featureGeo = feature.getGeometry();
       if (!featureGeo.crosses(shapeGeo)) continue;
       double length = featureGeo.intersection(shapeGeo).getLength();
       shares.put(shape, length / totalLength);
     }
     return fetchValues(shares, parameters);
   } catch (Exception e) {
     log.error("failed to fetch line parameters", e);
     return Collections.emptyMap();
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns a boolean value that shows if this geometry crosses the specified geometry.
  *
  * @param node1 xml element containing gml object(s)
  * @param node2 xml element containing gml object(s)
  * @return boolean value
  * @throws QueryException query exception
  */
 @Deterministic
 public Bln crosses(final ANode node1, final ANode node2) throws QueryException {
   final Geometry geo1 = checkGeo(node1);
   final Geometry geo2 = checkGeo(node2);
   return Bln.get(geo1.crosses(geo2));
 }