This project is read-only.


PointBase on GeometryLayer not rendered according to its Template's anchor point


In the DeepEarthPrototype project there are templates defined for a DevPin. These templates define an AnchorPoint that ranges from 0.0 to 1.0. Looking at the code in GeometryBase.cs and GeometryLayer.cs, it seems that the AnchorPoint is indeed used (and used correctly) to translate the image so that its defined center is exactly on the point to which it belongs. In GeometryLayer I can even see that Canvas.SetLeft and Canvas.SetTop are called with this new information.
The problem is, the images are always rendered as if the AncorPoint were 0.0;0.0. You can see this in the DeepEarthPrototype project: the pins are always to the lower right of the location for which they're defined.
Joost M
Closed Jan 29, 2009 at 4:32 PM by RoadWarrior
Not able to recreate. Appears issues are in the Joost's own code.


RoadWarrior wrote Jan 28, 2009 at 3:17 PM

I'll take a look today.

RoadWarrior wrote Jan 28, 2009 at 7:24 PM

Was not able to recreate the issue. I've even added a test to the Prototype startup that adds two points to location center map (Lat=0, Lon=0). The default PointBase, red circle, has an anchor of (0.5, 0.5) and ArrowPushPin has an anchor of (0.5, 1.0). Both of the locked onto the correct point in all layer update modes. What code version are you using? Can you provide a sample code snippet that recreates the issue on the latest codebase?

RoadWarrior wrote Jan 28, 2009 at 8:18 PM

Just noticed that the DeveloperPin Templates DO NOT in fact define an AnchorPoint property. Therefore, the default of (0,0) (aka Top, Left) will be used. So what was reported appears to be the expected behavior.

RoadWarrior wrote Jan 28, 2009 at 9:00 PM

Correction to my earlier post. The default AnchorPoint is (0.5, 0.5).

Joost_M wrote Jan 29, 2009 at 8:50 AM

I'm using a ~one week old version of DeepEarth, but now is really not a good time for me to upgrade to the latest version (we're demo'ing this on a conference right now).

I have a Style that sets the Template of a PointBase that I extended into my own Pin class. The AnchorPoint I need for it is 0.0;0.0. I wasn't able to use <Setter Property="AnchorPoint" Value="0.0,0.0"/>. So what I then intended to do was use a Canvas to set the templates Border Canvas.Left dependency property to 30. That shifted it 30 pixels to the right. With the Canvas.Left property at 0 it displays as if the anchor point is 0.0;0.0, which is what I want.

I'd have to investigate further using the latest code to see what is happening here; to me it's not 100% clear why using the Canvas without any active properties changes the observed anchor point (as opposed to the internal defined anchor point, the real value, so to speak) from .5;.5 to 0;0. Something to do with automatic layouts, maybe.

RoadWarrior wrote Jan 29, 2009 at 4:28 PM

So now it comes out that the problem isn't in the DevPins as you stated,, but in your own new pins you added. The fact that you are using code over 1 week old doesn't matter either. This hasn't changed since then.

wrote Jan 29, 2009 at 4:32 PM

satavsomnath wrote Jan 13, 2012 at 10:07 AM

I am facing issue related with this.
I have a 'Test' class derived from Pointbase which is almost similar to the prototype Devpin class except that it has a few additional fields to display.
The problem is the Devpin sometimes shows up on the left top corner (0,0) of the map. When I debug I suspect that _LogicalCoordinate = Map.DefaultInstance.CoordHelper.GeoToLogical(_Point); this returns (0.0).
Any clues why this happening.

wrote Feb 14, 2013 at 8:50 PM

wrote May 16, 2013 at 10:33 AM