Package org.codemap.tasks

Source Code of org.codemap.tasks.ComputeElevationModelTask

package org.codemap.tasks;

import org.codemap.DigitalElevationModel;
import org.codemap.MapInstance;
import org.codemap.internal.DEMAlgorithm;
import org.codemap.util.MapScheme;

import ch.akuhn.util.ProgressMonitor;
import ch.akuhn.values.Arguments;
import ch.akuhn.values.TaskValue;
import ch.akuhn.values.Value;

public class ComputeElevationModelTask extends TaskValue<DigitalElevationModel> {

    public ComputeElevationModelTask(Value<MapInstance> mapInstance, Value<MapScheme<Boolean>> hills) {
        super("Creating digital elevation model", mapInstance, hills);
    }

    @Override
    protected DigitalElevationModel computeValue(ProgressMonitor monitor, Arguments arguments) {
        MapInstance map = arguments.nextOrFail();
        MapScheme<Boolean> hills = arguments.nextOrFail();
        if (hills == null) hills = new MapScheme<Boolean>(true);
        return computeValue(monitor, map, hills);
    }

    private DigitalElevationModel computeValue(ProgressMonitor monitor, MapInstance map, MapScheme<Boolean> hills) {
        DEMAlgorithm algorithm = new DEMAlgorithm();
        algorithm.setMap(processMap(map));
        return new DigitalElevationModel(algorithm.call());
    }

    protected MapInstance processMap(MapInstance map) {
        return map;
    }
}
TOP

Related Classes of org.codemap.tasks.ComputeElevationModelTask

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.