Opened 13 years ago

Last modified 13 years ago

#4016 new defect

pointObj draw - missing original coordinates

Reported by: brunovani22 Owned by: aboudreault
Priority: high Milestone: 6.0.1 release
Component: MapScript-PHP Version: 6.0
Severity: normal Keywords: pointObj draw missing coordinates
Cc: dmorissette, sdlime

Description

Hi, first, sorry if any mistakes, it is my first post. When using mapscript "draw" for a pointObj, the object loses its originals coordinates, assigning the image coordinates values.

by example-->

echo "before draw: ".$click_geo->x.", ".$click_geo->y."<br>";

$image = $map->draw(); #create map figure

$layer = $map->getLayerByName('virtual');

$click_geo->draw($map, $layer, $image, 0 ,'');

echo "after draw: ".$click_geo->x.", ".$click_geo->y."<br>";

output: before draw: 467738, 7543543 after draw: 346, 180

I try to use php clone for backup the value, but an error occurs:
Fatal error: Trying to clone an uncloneable object of class pointObj in...

Change History (1)

comment:1 by aboudreault, 13 years ago

Cc: dmorissette sdlime added

The problem is that, internally, the point has to be transformed in pixel to be drawn. The behavior is the same using other bindings. The issue should also applied to drawShape, drawLine etc. I see 2 options:

  • Do nothing... the user will have to copy the original coordinates himself. (Manually or using the clone feature when it will be available) I don't thinks it's available in other bindings neither. ie. we can do a deepcopy of the object in python.
  • Make the mapscript internal functions do a copy of the original object before calling the draw functions. This has a cost.... copying a big shapeObj/lineObj might has a big impact on the performance.

What do you think?

About the clonable objects... I created a new ticket for this enhancement: #4032.

Note: See TracTickets for help on using tickets.