* {@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);
}
}
});