Ticket #1706 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

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

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

Change History

Changed 5 years ago by hopfgartner

Changed 5 years ago by hopfgartner

Changed 5 years ago by hopfgartner

Changed 5 years ago by hopfgartner

  • version changed from 4.8 to 5.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.

Changed 5 years ago by hopfgartner

Changed 5 years ago by hopfgartner

Fix

Changed 5 years ago by hopfgartner

  • status changed from new to closed
  • resolution set to fixed

Changed 5 years ago by assefa

  • status changed from closed to reopened
  • resolution fixed deleted
  • milestone set to 5.4 release

reopening to apply the patch

Changed 5 years ago by assefa

  • owner changed from mapserverbugs to assefa
  • status changed from reopened to new

checking the patch now.

Changed 5 years ago by assefa

  • status changed from new to assigned

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.

Changed 5 years ago by assefa

Changed 5 years ago by assefa

  • status changed from assigned to closed
  • resolution set to fixed

patch committed in r7913

Note: See TracTickets for help on using tickets.