Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#1407 closed defect (fixed)

Vector symbols can't be drawn in SVG format

Reported by: yt-kage@… Owned by: mapserverbugs
Priority: high Milestone:
Component: Output-SVG Version: 4.6
Severity: normal Keywords:
Cc:

Description

I put a vector symbol on an annotation layer to decorate a map, and
drew it in SVG format.  At that time, I found the vector symbol
couldn't be drawn.  When verifying if a MapServer can create a
correct SVG file, the following line was found in the produced SVG
file:
<polygon fill="#ff0000" stroke-width="1" (null) points="190,10 230,10 230,30
190,30 190,10"/>
A strange element, "(null)" is included in this polygon tag. I believe
several SVG viewers can't deal with a strange tag like this.

A vector symbol is converted into several SVG-format tags in mapsvg.c. 
In the function "msDrawMarkerSymbolSVG", I found several bugs in the 
portion of dealing with a vector symbol and writing SVG tags that 
correspond to it.  Here is the patch for simply fixing the problem mentioned
above:

--- mapsvg.c.orig
+++ mapsvg.c
@@ -1576,14 +1576,13 @@
                 k = 0; /* point counter */
                 for(j=0;j < symbol->numpoints;j++) 
                 {
-                    if((symbol->points[j].x < 0) && (symbol->points[j].x < 0)) 
+                    if((symbol->points[j].x < 0) && (symbol->points[j].y < 0)) 
                     { /* new polygon (PENUP) */
                         if(k>2) 
                         {
-                            
                             msIO_fprintfgz(image->img.svg->stream, 
                                            image->img.svg->compressed,  
-                                         "<polygon %s %s  stroke-width=\"%d\"
%s points=\"", 
+                                         "<polygon %s %s  stroke-width=\"%d\"
points=\"", 
                                          pszFill, pszStroke, width);
                             
                             for (i=0; i<k;i++)
@@ -1610,7 +1609,7 @@
 
                 msIO_fprintfgz(image->img.svg->stream, 
                                image->img.svg->compressed,  
-                             "<polygon %s %s  stroke-width=\"%d\" %s points=\"", 
+                             "<polygon %s %s  stroke-width=\"%d\" points=\"", 
                              pszFill, pszStroke, width);
                             
                 for (i=0; i<k;i++)
@@ -1632,7 +1631,7 @@
                 oldpnt.y = MS_NINT(d*symbol->points[0].y + offset_y);
       
                 for(j=1;j < symbol->numpoints;j++) { /* step through the marker
s */
-                    if((symbol->points[j].x < 0) && (symbol->points[j].x < 0)) {
+                    if((symbol->points[j].x < 0) && (symbol->points[j].y < 0)) {
                         oldpnt.x = MS_NINT(d*symbol->points[j].x + offset_x);
                         oldpnt.y = MS_NINT(d*symbol->points[j].y + offset_y);
                     } else {


I don't know which element should be placed as the fourth variable of
msIO_fprintfgz,
so there would be any better way than simply erasing it.

Change History (5)

comment:1 by assefa, 19 years ago

Status: newassigned
Summary: Vector symbols can't be drawn in SVG formatVector symbols can't be drawn in SVG format
Updated the cvs version with the pathes described.

Please verify if possible. I will close the bug when verfied.

comment:2 by yt-kage@…, 19 years ago

I downloaded the latest source tree from the mapserver CVS server and built it
to verify if the fix mentioned above was adopted properly. 
I tried to draw a map with an annotation layer and verified all the shapes on 
the layer was displayed correctly in SVG format.
Thanks for your help.


comment:3 by assefa, 19 years ago

Resolution: fixed
Status: assignedclosed
Thanks for testing. Maring it as Fixed.

comment:4 by yt-kage@…, 19 years ago

Summary: Vector symbols can't be drawn in SVG formatsymbol

comment:5 by yt-kage@…, 19 years ago

Summary: symbolVector symbols can't be drawn in SVG format
Note: See TracTickets for help on using tickets.