Ejemplo n.º 1
0
  private double calculateDamageValue(final GM_Position position, final double wspHeight) {
    /* This list has some unknown cs. */
    final List<ILandusePolygon> list = m_polygonCollection.query(position);
    if (list == null || list.size() == 0) return Double.NaN;

    for (final ILandusePolygon polygon : list) {
      // TODO: hotspot, slow. Consider using the statistics object that already has a specialized
      // geo index for all areas (associate area with its class,
      // so we do not have to look up the class as well)
      if (polygon.contains(position)) {
        final double damageValue = polygon.getDamageValue(wspHeight);

        if (Double.isNaN(damageValue)) return Double.NaN;

        if (damageValue <= 0.0) return Double.NaN;

        // /* set statistic for landuse class */
        // final Integer landuseClassOrdinalNumber = polygon.getLanduseClassOrdinalNumber();
        // final ILanduseClass landuseClass = m_landuseClasses.get( landuseClassOrdinalNumber );
        // if( landuseClass == null )
        //  System.out.println( String.format( "Unknown landuse class: %s",
        // landuseClassOrdinalNumber ) ); //$NON-NLS-1$

        return damageValue;
      }
    }

    return Double.NaN;
  }
Ejemplo n.º 2
0
  public RiskSpecificDamageGrid(
      final IGeoGrid inputGrid,
      final URL pUrl,
      final IFeatureBindingCollection<ILandusePolygon> polygonCollection,
      final List<ILanduseClass> landuseClasses,
      final double cellSize,
      final int returnPeriod,
      final StatisticCollector statistics)
      throws IOException, GeoGridException {
    super(inputGrid, pUrl);

    m_polygonCollection = polygonCollection;
    m_landuseClasses = landuseClasses;
    m_cellSize = cellSize;
    m_returnPeriod = returnPeriod;
    m_statistics = statistics;

    final ILandusePolygon landusePolygon = m_polygonCollection.get(0);
    final String coordinateSystem = landusePolygon.getGeometry().getCoordinateSystem();

    m_geoTransformer = GeoTransformerFactory.getGeoTransformer(coordinateSystem);
  }