Examples of TerrainInterpolator


Examples of org.osm2world.core.map_elevation.creation.TerrainInterpolator

   * {@link WorldObject}s
   */
  private void calculateElevations(MapData mapData,
      TerrainElevationData eleData, Configuration config) {
       
    final TerrainInterpolator interpolator =
        (eleData != null)
        ? terrainEleInterpolatorFactory.make()
        : new ZeroInterpolator();
   
    /* provide known elevations from eleData to the interpolator */
   
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
       
    if (!(interpolator instanceof ZeroInterpolator)) {
   
      Collection<VectorXYZ> sites = emptyList();
     
      try {
             
        sites = eleData.getSites(mapData);
       
        System.out.println("time getSites: " + stopWatch);
        stopWatch.reset();
        stopWatch.start();
       
      } catch (IOException e) {
        e.printStackTrace();
      }
     
      interpolator.setKnownSites(sites);
     
      System.out.println("time setKnownSites: " + stopWatch);
      stopWatch.reset();
      stopWatch.start();
     
    }
   
    /* interpolate connectors' elevations */
   
    final List<EleConnector> connectors = new ArrayList<EleConnector>();
   
    FaultTolerantIterationUtil.iterate(mapData.getWorldObjects(),
        new Operation<WorldObject>() {
      @Override public void perform(WorldObject worldObject) {
       
        for (EleConnector conn : worldObject.getEleConnectors()) {
          conn.setPosXYZ(interpolator.interpolateEle(conn.pos));
          connectors.add(conn);
        }
       
      }
    });
View Full Code Here

Examples of org.osm2world.core.map_elevation.creation.TerrainInterpolator

   
    try {
     
      Collection<VectorXYZ> sites = eleData.getSites(map);
     
      TerrainInterpolator strategy = buildInterpolator();
      strategy.setKnownSites(sites);
     
      AxisAlignedBoundingBoxXZ bound = map.getDataBoundary();
     
      VectorGridXZ sampleGrid = new VectorGridXZ(bound, SAMPLE_DIST);
     
      VectorXYZ[][] samples = new VectorXYZ[sampleGrid.sizeX()][sampleGrid.sizeZ()];
     
      long startTimeMillis = System.currentTimeMillis();
     
      for (int x = 0; x < sampleGrid.sizeX(); x++) {
        for (int z = 0; z < sampleGrid.sizeZ(); z++) {
         
          samples[x][z] = strategy.interpolateEle(sampleGrid.get(x, z));
                   
        }
       
        if (x % 100 == 0) {
          long finishedSamples = x * sampleGrid.sizeZ();
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.