logo separator

[mkgmap-dev] Putting the DP code under the microscope

From Mark Burton markb at ordern.com on Wed Jun 17 19:55:35 BST 2009

Hi Johann,

> > What are your thoughts on the patch (I think it was by Thilo) that
> > replaces the lost last point in each polygon? Seems like a good idea to
> > me.
> >
> >   
> I have looked at the patch only one minute. Seems correct.
> May thoughts was that the last segment ist not needed, if it is a 
> polygon which gets filled. But with only contours there will arise 
> problems. Right.
> 
> In my private working copy I have tested another solution in the meanwhile.
> 
> Do not remove the first point. Instead divide the line in two parts and 
> simplify both of them. Could not say if it works better or not.

I think I like this idea better. Perhaps folks can test both fixes and
decide which is best.

> Sorry, I'm in a hurry,  no more time left to create a patch.

No problem, I'm sure the team can do that.

Cheers,

Mark

> 
> 
> 
>         // Create a new list to rewrite the points into. Don't alter the 
> original one
>         List<Coord> coords = new ArrayList<Coord>(n);
>         coords.addAll(points);
> 
>         //Handle Polygons different
> +        if (element instanceof MapShape) {
> +           int middle = n/2;
> +           douglasPeucker(coords, middle, n, maxErrorDistance);
> +            douglasPeucker(coords, 0, middle, maxErrorDistance);
> +
> +        }
> +        else
>         {
>             // For now simplify all points, which are not nodes
>             // and no start and no end point
>             // Loop runs downwards, as the list length gets modified 
> while running
>             int endIndex = coords.size()-1;
>             for(int i = endIndex-1; i > 0; i--) {
> 
> 
> 
> Regards,
> Johann
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev



More information about the mkgmap-dev mailing list