Full Version : Simplemap problem
xmlspawner >>Q&A >>Simplemap problem
<< Prev | Next >>
Xavier_WER- 04-12-2007
Evening, Im using simplemaps to create a sort of scavanger hunt, where spawners
adds pins to a map for the next location. The spawners are all duped and are
somewhat advanced in the way that they check for a map that has the same pin
location as the location of the spawner.
The problem im having though is that there seems to be a strange offset to the pins.
Even though they're set with a specefic XY, the pin location they recieve get an offset
thats between 5 to 12 points wrong in both XY.
Anyway to combat this?
ArteGordon- 04-12-2007
are you sure that you are looking at the actual pin insertion location and not the location of the pinhead which will be shifted up and to the right by about that much?
Xavier_WER- 04-12-2007
I have a spawner that sets the NewPin property.
and the location spawners checks the CurrentPin
ArteGordon- 04-13-2007
I'll check that out.
ArteGordon- 04-13-2007
ok, it is because of a basic limitation on the way in which pin coordinates are stored on maps in general.
They are stored in map pixel coordinates (actual x,y location on the map itself) rather than in world coordinates (the x,y location that you specify). Because the maps are lower resolution, you lose some precision in placement.
For example, if you put a pin at (200,300) in world coordinates, for a 400x400 pixel map it internally scales it down to (15,29) which is the equivalent location in map coordinates, and stores that as the pin location. When it converts it back up to world coordinates (for example when you check the PinLocation property), it comes back as (191,296).
If you put it at (202,302), it will also come back as (191,296) because of the precision loss.
The loss in precision is a function of the physical map size (Width, Height) with bigger maps = more precision.
I will look at ways of getting around that by maintaining an explicit woordcoord list instead of using the standard map coord conversion system that mapitems use.
Xavier_WER- 04-13-2007
hm, a way around it would perhaps to add a attachment to the map with the
correct co-ordinates.
ArteGordon- 04-14-2007
yes, that would also work.