Opened 18 years ago

Closed 16 years ago

#1706 closed defect (fixed)

cast to integer in image coordinates

Reported by: patrickmachado@… Owned by: assefa
Priority: normal Milestone: 5.4 release
Component: Output-SVG Version: 5.0
Severity: normal Keywords:
Cc:

Description

The output-svg module casts point coordinates to integers, when outputing
results in full resolution (and conversion to image coordinates).

This is a drawback because resolution is lost (e.g. when you want to zoom the
map later). Furthermore, the lines are poorly antialiased this way.

I looked into the code and it seems that the right way is already there, but
commented. Is there any reason for that?

Here follows the relevant code:


/* full resolution, pixel output */
    if (bFullRes && !bUseGeoCoord)
    {
        if(shape->type == MS_SHAPE_LINE || shape->type == MS_SHAPE_POLYGON) 
        { 
            for(i=0; i<shape->numlines; i++) 
            {
                for(j=0; j < shape->line[i].numpoints; j++ ) 
                {
                    /*
                    shape->line[i].point[j].x = 
                      (shape->line[i].point[j].x - extent.minx)/cellsize;
                    shape->line[i].point[j].y = 
                      (extent.maxy - shape->line[i].point[j].y)/cellsize;
                    
                    */
                    shape->line[i].point[j].x =
MS_MAP2IMAGE_X(shape->line[i].point[j].x,
                                                               extent.minx,
cellsize);
                    shape->line[i].point[j].y = MS_MAP2IMAGE_Y(
shape->line[i].point[j].y,
                                                                extent.maxy,
                                                                cellsize);
                                                                
                    
                }
            }      
            return;
        }
    }

Attachments (6)

1706.map (616 bytes ) - added by hopfgartner 16 years ago.
1706-no-cast.svg (132.0 KB ) - added by hopfgartner 16 years ago.
1706-orig.svg (132.0 KB ) - added by hopfgartner 16 years ago.
1706-float.svg (229.6 KB ) - added by hopfgartner 16 years ago.
mapsvg.c.diff (1.8 KB ) - added by hopfgartner 16 years ago.
Fix
bug1706.diff (6.5 KB ) - added by assefa 16 years ago.

Download all attachments as: .zip

Change History (12)

by hopfgartner, 16 years ago

Attachment: 1706.map added

by hopfgartner, 16 years ago

Attachment: 1706-no-cast.svg added

by hopfgartner, 16 years ago

Attachment: 1706-orig.svg added

comment:1 by hopfgartner, 16 years ago

Version: 4.85.0

There is no cure for the symptone in this part of the mapserver code. I tried to compile mapserver, SVN as of today, 2008-09-15 with both variants, the original one and the one commented out, and there is no significant visual difference, files attached, look at them at 500%. Anyway, I did not try to find where the correct fix should belong, maybe someone knows, where the path coordinates are aligned with the grid.

by hopfgartner, 16 years ago

Attachment: 1706-float.svg added

by hopfgartner, 16 years ago

Attachment: mapsvg.c.diff added

Fix

comment:2 by hopfgartner, 16 years ago

Resolution: fixed
Status: newclosed

comment:3 by assefa, 16 years ago

Milestone: 5.4 release
Resolution: fixed
Status: closedreopened

reopening to apply the patch

comment:4 by assefa, 16 years ago

Owner: changed from mapserverbugs to assefa
Status: reopenednew

checking the patch now.

comment:5 by assefa, 16 years ago

Status: newassigned

Attaching a patch with changes that allow to fulfill the FULL_RESOLUTION settings and keeps the old behavior if that metadata is not set. It is applied both on lines and polygons.

Peter, if it is possible for you to quickly test the patch, that would be great. I can then commit.

The only thing that I thing is missing is maybe a par mater allowing the user to specify the resolution (numbers after .). For now it is set to 2.

by assefa, 16 years ago

Attachment: bug1706.diff added

comment:6 by assefa, 16 years ago

Resolution: fixed
Status: assignedclosed

patch committed in r7913

Note: See TracTickets for help on using tickets.