Opened 18 years ago

Closed 18 years ago

#1823 closed defect (fixed)

MapObj clone only clones first outputformat

Reported by: bartvde@… Owned by: warmerdam
Priority: high Milestone:
Component: MapScript-PHP Version: 4.8
Severity: normal Keywords:
Cc:

Description

When cloning a MapObj which has multiple output formats, only the first output
format gets cloned and makes it into the resulting MapObj.

Test MAP file:
MAP
  OUTPUTFORMAT
    NAME gif
    DRIVER "GD/GIF"
    MIMETYPE "image/gif"
    IMAGEMODE PC256
    EXTENSION "gif"
  END
  OUTPUTFORMAT
    NAME png
    DRIVER "GD/PNG"
    MIMETYPE "image/png"
    IMAGEMODE PC256
    EXTENSION "png"
  END
END

PHP Script:
<?php
$oMap = ms_newmapobj('testoutputformat.map');
$oResultMap = $oMap->clone();
$oResultMap->save('/tmp/testoutputformat.map');
?>

Output MAP file (only upper part):
MAP
  EXTENT -1 -1 -1 -1
  IMAGECOLOR 255 255 255
  IMAGETYPE gif
  SIZE -1 -1
  STATUS ON
  UNITS METERS
  NAME "MS"

  OUTPUTFORMAT
    NAME "gif"
    MIMETYPE "image/gif"
    DRIVER "GD/GIF"
    EXTENSION "gif"
    IMAGEMODE "PC256"
    TRANSPARENT FALSE
  END

  LEGEND
    IMAGECOLOR 255 255 255
    KEYSIZE 20 10
    KEYSPACING 5 5
    LABEL
      SIZE MEDIUM
      TYPE BITMAP
      BUFFER 0
      COLOR 0 0 0
      FORCE FALSE
      MINDISTANCE -1
      MINFEATURESIZE -1
      OFFSET 0 0
      PARTIALS TRUE
      POSITION CC
    END
    POSITION LL
    STATUS OFF
  END

Change History (4)

comment:1 by fwarmerdam, 18 years ago

Owner: changed from mapserverbugs to fwarmerdam
Bart,

I'll take this problem.  I do think it is somewhat related to Bug 1816. 

I think the problem is that the msCloneOutputFormat() does not propogate
the new inmapfile flag.  I believe the following change is needed in 
mapoutput.c (in this case the patch is against 4.9. 


*** mapoutput.c.~1.35.~	2005-11-10 10:41:16.000000000 -0500
--- mapoutput.c	2006-07-10 09:50:24.468711688 -0400
***************
*** 762,767 ****
--- 762,769 ----
      for( i = 0; i < src->numformatoptions; i++ )
          dst->formatoptions[i] = strdup(src->formatoptions[i]);
  
+     dst->inmapfile = src->inmapfile;
+ 
      return dst;
  }

If you could test and verify the change, I'll apply it in 4.9 
and patch it back into 4.8 branch. 

comment:2 by dmorissette, 18 years ago

Cc: dmorissette@… added

comment:3 by fwarmerdam, 18 years ago

Status: newassigned
I'm pretty confident in this fix.  Applying it in 4.9 and 4.8 branch.  
Let me know what you find Bart. 

comment:4 by bartvde@…, 18 years ago

Resolution: fixed
Status: assignedclosed
I tested Frank's fix and it works like a charm. Thanks for the quick action!

Setting status to FIXED.
Note: See TracTickets for help on using tickets.