Search in sources :

Example 1 with LineSplitterFilter

use of uk.me.parabola.mkgmap.filters.LineSplitterFilter in project mkgmap by openstreetmap.

the class MapBuilder method processLines.

/**
 * Step through the lines, filter, simplify if necessary, and create a map
 * line which is then added to the map.
 *
 * Note that the location and resolution of map elements is relative to the
 * subdivision that they occur in.
 *
 * @param map	The map to add points to.
 * @param div	The subdivision that the lines belong to.
 * @param lines The lines to be added.
 */
private void processLines(Map map, Subdivision div, List<MapLine> lines) {
    // Signal that we are beginning to draw the lines.
    div.startLines();
    int res = div.getResolution();
    FilterConfig config = new FilterConfig();
    config.setResolution(res);
    config.setLevel(div.getZoom().getLevel());
    config.setRoutable(doRoads);
    // Maybe more efficient if merging before creating subdivisions.
    if (mergeLines) {
        LineMergeFilter merger = new LineMergeFilter();
        lines = merger.merge(lines, res);
    }
    LayerFilterChain filters = new LayerFilterChain(config);
    if (enableLineCleanFilters && (res < 24)) {
        filters.addFilter(new RoundCoordsFilter());
        filters.addFilter(new SizeFilter(MIN_SIZE_LINE));
        if (reducePointError > 0)
            filters.addFilter(new DouglasPeuckerFilter(reducePointError));
    }
    filters.addFilter(new LineSplitterFilter());
    filters.addFilter(new RemoveEmpty());
    filters.addFilter(new RemoveObsoletePointsFilter());
    filters.addFilter(new LinePreparerFilter(div));
    filters.addFilter(new LineAddFilter(div, map, doRoads));
    for (MapLine line : lines) {
        if (line.getMinResolution() > res)
            continue;
        filters.startFilter(line);
    }
}
Also used : MapLine(uk.me.parabola.mkgmap.general.MapLine) DouglasPeuckerFilter(uk.me.parabola.mkgmap.filters.DouglasPeuckerFilter) SizeFilter(uk.me.parabola.mkgmap.filters.SizeFilter) LinePreparerFilter(uk.me.parabola.mkgmap.filters.LinePreparerFilter) LineMergeFilter(uk.me.parabola.mkgmap.filters.LineMergeFilter) MapPoint(uk.me.parabola.mkgmap.general.MapPoint) MapExitPoint(uk.me.parabola.mkgmap.general.MapExitPoint) Point(uk.me.parabola.imgfmt.app.trergn.Point) RoundCoordsFilter(uk.me.parabola.mkgmap.filters.RoundCoordsFilter) RemoveEmpty(uk.me.parabola.mkgmap.filters.RemoveEmpty) RemoveObsoletePointsFilter(uk.me.parabola.mkgmap.filters.RemoveObsoletePointsFilter) FilterConfig(uk.me.parabola.mkgmap.filters.FilterConfig) LineSplitterFilter(uk.me.parabola.mkgmap.filters.LineSplitterFilter)

Aggregations

Point (uk.me.parabola.imgfmt.app.trergn.Point)1 DouglasPeuckerFilter (uk.me.parabola.mkgmap.filters.DouglasPeuckerFilter)1 FilterConfig (uk.me.parabola.mkgmap.filters.FilterConfig)1 LineMergeFilter (uk.me.parabola.mkgmap.filters.LineMergeFilter)1 LinePreparerFilter (uk.me.parabola.mkgmap.filters.LinePreparerFilter)1 LineSplitterFilter (uk.me.parabola.mkgmap.filters.LineSplitterFilter)1 RemoveEmpty (uk.me.parabola.mkgmap.filters.RemoveEmpty)1 RemoveObsoletePointsFilter (uk.me.parabola.mkgmap.filters.RemoveObsoletePointsFilter)1 RoundCoordsFilter (uk.me.parabola.mkgmap.filters.RoundCoordsFilter)1 SizeFilter (uk.me.parabola.mkgmap.filters.SizeFilter)1 MapExitPoint (uk.me.parabola.mkgmap.general.MapExitPoint)1 MapLine (uk.me.parabola.mkgmap.general.MapLine)1 MapPoint (uk.me.parabola.mkgmap.general.MapPoint)1