Search in sources :

Example 1 with SinkSourceManager

use of org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager in project osmosis by openstreetmap.

the class BoundingBoxFilterFactory method createTaskManagerImpl.

/**
 * {@inheritDoc}
 */
@Override
protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    IdTrackerType idTrackerType;
    double left;
    double right;
    double top;
    double bottom;
    boolean clipIncompleteEntities;
    boolean completeWays;
    boolean completeRelations;
    boolean cascadingRelations;
    int zoom;
    // Get the task arguments.
    idTrackerType = getIdTrackerType(taskConfig);
    left = getDoubleArgument(taskConfig, ARG_LEFT, DEFAULT_LEFT);
    right = getDoubleArgument(taskConfig, ARG_RIGHT, DEFAULT_RIGHT);
    top = getDoubleArgument(taskConfig, ARG_TOP, DEFAULT_TOP);
    bottom = getDoubleArgument(taskConfig, ARG_BOTTOM, DEFAULT_BOTTOM);
    clipIncompleteEntities = getBooleanArgument(taskConfig, ARG_CLIP_INCOMPLETE_ENTITIES, DEFAULT_CLIP_INCOMPLETE_ENTITIES);
    completeWays = getBooleanArgument(taskConfig, ARG_COMPLETE_WAYS, DEFAULT_COMPLETE_WAYS);
    completeRelations = getBooleanArgument(taskConfig, ARG_COMPLETE_RELATIONS, DEFAULT_COMPLETE_RELATIONS);
    cascadingRelations = getBooleanArgument(taskConfig, ARG_CASCADING_RELATIONS, DEFAULT_CASCADING_RELATIONS);
    zoom = getIntegerArgument(taskConfig, ARG_ZOOM, DEFAULT_ZOOM);
    if (doesArgumentExist(taskConfig, ARG_X1)) {
        int x1 = getIntegerArgument(taskConfig, ARG_X1);
        left = xToLon(zoom, x1);
        right = xToLon(zoom, getIntegerArgument(taskConfig, ARG_X2, x1) + 1);
    }
    if (doesArgumentExist(taskConfig, ARG_Y1)) {
        int y1 = getIntegerArgument(taskConfig, ARG_Y1);
        top = yToLat(zoom, y1);
        bottom = yToLat(zoom, getIntegerArgument(taskConfig, ARG_Y2, y1) + 1);
    }
    return new SinkSourceManager(taskConfig.getId(), new BoundingBoxFilter(idTrackerType, left, right, top, bottom, clipIncompleteEntities, completeWays, completeRelations, cascadingRelations), taskConfig.getPipeArgs());
}
Also used : IdTrackerType(org.openstreetmap.osmosis.core.filter.common.IdTrackerType) SinkSourceManager(org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager)

Example 2 with SinkSourceManager

use of org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager in project osmosis by openstreetmap.

the class PolygonFilterFactory method createTaskManagerImpl.

/**
 * {@inheritDoc}
 */
@Override
protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    IdTrackerType idTrackerType;
    String fileName;
    File file;
    boolean clipIncompleteEntities;
    boolean completeWays;
    boolean completeRelations;
    boolean cascadingRelations;
    // Get the task arguments.
    idTrackerType = getIdTrackerType(taskConfig);
    fileName = getStringArgument(taskConfig, ARG_FILE, DEFAULT_FILE);
    clipIncompleteEntities = getBooleanArgument(taskConfig, ARG_CLIP_INCOMPLETE_ENTITIES, DEFAULT_CLIP_INCOMPLETE_ENTITIES);
    completeWays = getBooleanArgument(taskConfig, ARG_COMPLETE_WAYS, DEFAULT_COMPLETE_WAYS);
    completeRelations = getBooleanArgument(taskConfig, ARG_COMPLETE_RELATIONS, DEFAULT_COMPLETE_RELATIONS);
    cascadingRelations = getBooleanArgument(taskConfig, ARG_CASCADING_RELATIONS, DEFAULT_CASCADING_RELATIONS);
    // Create a file object from the file name provided.
    file = new File(fileName);
    return new SinkSourceManager(taskConfig.getId(), new PolygonFilter(idTrackerType, file, clipIncompleteEntities, completeWays, completeRelations, cascadingRelations), taskConfig.getPipeArgs());
}
Also used : IdTrackerType(org.openstreetmap.osmosis.core.filter.common.IdTrackerType) SinkSourceManager(org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager) File(java.io.File)

Example 3 with SinkSourceManager

use of org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager in project osmosis by openstreetmap.

the class BoundSetterFactory method createTaskManagerImpl.

@Override
protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    double left;
    double right;
    double top;
    double bottom;
    int zoom;
    Bound newBound = null;
    String origin = null;
    boolean remove;
    remove = getBooleanArgument(taskConfig, ARG_REMOVE, DEFAULT_REMOVE);
    if (!remove) {
        origin = getStringArgument(taskConfig, ARG_ORIGIN, DEFAULT_ORIGIN);
        left = getDoubleArgument(taskConfig, ARG_LEFT, DEFAULT_LEFT);
        right = getDoubleArgument(taskConfig, ARG_RIGHT, DEFAULT_RIGHT);
        top = getDoubleArgument(taskConfig, ARG_TOP, DEFAULT_TOP);
        bottom = getDoubleArgument(taskConfig, ARG_BOTTOM, DEFAULT_BOTTOM);
        zoom = getIntegerArgument(taskConfig, ARG_ZOOM, DEFAULT_ZOOM);
        if (doesArgumentExist(taskConfig, ARG_X1)) {
            int x1 = getIntegerArgument(taskConfig, ARG_X1);
            left = xToLon(zoom, x1);
            right = xToLon(zoom, getIntegerArgument(taskConfig, ARG_X2, x1) + 1);
        }
        if (doesArgumentExist(taskConfig, ARG_Y1)) {
            int y1 = getIntegerArgument(taskConfig, ARG_Y1);
            top = yToLat(zoom, y1);
            bottom = yToLat(zoom, getIntegerArgument(taskConfig, ARG_Y2, y1) + 1);
        }
        newBound = new Bound(right, left, top, bottom, origin);
    }
    return new SinkSourceManager(taskConfig.getId(), new BoundSetter(newBound), taskConfig.getPipeArgs());
}
Also used : SinkSourceManager(org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager) Bound(org.openstreetmap.osmosis.core.domain.v0_6.Bound)

Example 4 with SinkSourceManager

use of org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager in project osmosis by openstreetmap.

the class WayKeyValueFilterFactory method createTaskManagerImpl.

/**
 * {@inheritDoc}
 */
@Override
protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    WayKeyValueFilter wayKeyValueFilter;
    if (doesArgumentExist(taskConfig, ARG_KEY_VALUE_LIST)) {
        String keyValueList = getStringArgument(taskConfig, ARG_KEY_VALUE_LIST);
        wayKeyValueFilter = new WayKeyValueFilter(keyValueList);
    } else if (doesArgumentExist(taskConfig, ARG_KEY_VALUE_LIST_FILE)) {
        String keyValueListFile = getStringArgument(taskConfig, ARG_KEY_VALUE_LIST_FILE);
        wayKeyValueFilter = new WayKeyValueFilter(new File(keyValueListFile));
    } else {
        String keyValueList = getDefaultStringArgument(taskConfig, "highway.motorway,highway.motorway_link,highway.trunk,highway.trunk_link");
        wayKeyValueFilter = new WayKeyValueFilter(keyValueList);
    }
    return new SinkSourceManager(taskConfig.getId(), wayKeyValueFilter, taskConfig.getPipeArgs());
}
Also used : SinkSourceManager(org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager) File(java.io.File)

Aggregations

SinkSourceManager (org.openstreetmap.osmosis.core.pipeline.v0_6.SinkSourceManager)4 File (java.io.File)2 IdTrackerType (org.openstreetmap.osmosis.core.filter.common.IdTrackerType)2 Bound (org.openstreetmap.osmosis.core.domain.v0_6.Bound)1