Geometry Shapes not Locked to BaseMap

Aug 17, 2010 at 1:22 PM

source code 47598:

When I start the application, if I enlarge the window that the application is being displayed in by dragging a window edge with my mouse, the shapes are not locked to the basemap.

For example, when I enlarged the window the square that was over Africa is now in the Atlantic Ocean.

HOW DO I LOCK THE SHAPES DOWN SO THEY DO NOT SHIFT IN SPACE WHEN THE APPLICATION WINDOW IS ENLARGED?

Thanks.....

Developer
Aug 17, 2010 at 2:15 PM
GeometryLayer.UpdateModes.TransformUpdate
GeometryLayer.UpdateModes.PanOnlyUpdate
GeometryLayer.UpdateModes.ElementUpdate

var panLayer = new GeometryLayer(MyMap) { UpdateMode =
UpdateModes.PanOnlyUpdate };
Aug 17, 2010 at 2:52 PM

Thanks for the quick response - as always.  Great support through the forum here.

I've tried all as suggested.  Still when expand window, such as go to fullscreen, the shapes are not located properly in space.  So for example, using the code below on the original source code (no other changes) does not resolve the shifting shape issue.  What am I missing?

var

 

geometryLayer = new GeometryLayer (MyMap)

{

<font face="Consolas" size="2">

UpdateMode =

</font>
UpdateModes.TransformUpdate,  //.ElementUpdate, //.PanOnlyUpdate

Opacity = 0.5

};

MyMap.Layers.Add(geometryLayer);

 
Aug 18, 2010 at 1:13 PM

dotnetnoobie,

Using the source code - 47598, no changes except adding UpdateMode = UpdateModes.PanOnlyUpdate (TransformUpdate, ElementUpdate) when creating the geometryLayer, I notice this problem only occurs when resizing the main application window horizontally.  The shapes (PolygonControl, LineStringControl, PointControl) stay in location if resizing the main application window vertically. 

Can you give me an idea on how to resolve the problem of shifting shape locations when resizing the window horizontally?

Thanks.....

Developer
Aug 19, 2010 at 1:34 AM
ok this seems to happen when....

you resize the browsers horizontally and the map extends past the
boarders/edges of the browser....
the shapes will then update when the map is zoomed or panned/dragged
with the mouse

if the map is zoomed out so that the full map is showing and there is
empty space around the map, the shapes will update


this is the same problem you are having correct?
Aug 19, 2010 at 12:45 PM

Yes – that is problem; horizontal not vertical.

I know that shapes reposition themselves correctly after doing a pan or zoom. However, just after enlarging or shrinking application window (for example go to full screen), the shapes are in wrong location so desired results from interacting with shapes prior to a zoom or pan will provide erroneous results.

What’s your suggestion on this? Thanks again….


From: dotnetnoobie [mailto:notifications@codeplex.com]
Sent: Wednesday, August 18, 2010 6:35 PM
To: Robert Sosnowski
Subject: Re: Geometry Shapes not Locked to BaseMap [deepearth:223810]

From: dotnetnoobie

ok this seems to happen when....

you resize the browsers horizontally and the map extends past the
boarders/edges of the browser....
the shapes will then update when the map is zoomed or panned/dragged
with the mouse

if the map is zoomed out so that the full map is showing and there is
empty space around the map, the shapes will update


this is the same problem you are having correct?

Read the full discussion online.

To add a post to this discussion, reply to this email (deepearth@discussions.codeplex.com)

To start a new discussion for this project, email deepearth@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Aug 23, 2010 at 12:43 PM

Does the latest source code 49789 fix this?

Aug 23, 2010 at 1:47 PM

my quick fix:

 

private GeometryLayer m_GeometryLayer;

public MapControl()        

{            

InitializeComponent();

m_GeometryLayer = new GeometryLayer(mapInstance) { UpdateMode = UpdateMode.ElementUpdate }; //choose whatever updatemode you want

/*

intialization of other code

...

*/

Application.Current.Host.Content.Resized += new EventHandler(Content_Resized);

}

 

void Content_Resized(object sender, EventArgs e)        

m_GeometryLayer.UpdateMode = UpdateModes.ElementUpdate; //choose whatever updatemode you want

}

Aug 23, 2010 at 3:02 PM

Ok, that works for now, thanks. - I'll keep my eyes out for a more permanent fix....

Aug 23, 2010 at 5:13 PM

Excellent! It works great. I've incorporated it into my own Canvas/Layer implementation that I am working on.

Andy

Sep 1, 2010 at 3:11 PM

i have found the previous solution has stopped working with my version of the SL4 branch, so i figured out how to do it "properly"...

 

in your constructor: (mapInstance is your DeepEarth map control instance)

{

...

            mapInstance.Events.MapViewChangedEnded += new DeepEarth.Client.MapControl.Events.MapEvents.MapEvent(Events_MapViewChangedEnded);

}

 

 

void Events_MapViewChangedEnded(object sender, DeepEarth.Client.MapControl.Events.MapEventArgs args)

{

            foreach (GeometryLayer GL in mapInstance.Layers)
            {
                foreach (GeometryControlBase<GeoAPI.Geometries.IGeometry> geo in GL.Geometries)
                {
                    GL.UpdateChildLocation(geo);
                }

            }

}

 

Sep 1, 2010 at 4:08 PM

Hey thanks – I’ll make the change…enjoy the day


From: the_klaw [mailto:notifications@codeplex.com]
Sent: Wednesday, September 01, 2010 8:11 AM
To: Robert Sosnowski
Subject: Re: Geometry Shapes not Locked to BaseMap [deepearth:223810]

From: the_klaw

i have found the previous solution has stopped working with my version of the SL4 branch, so i figured out how to do it "properly"...

in your constructor: (mapInstance is your DeepEarth map control instance)

{

...

mapInstance.Events.MapViewChangedEnded += new DeepEarth.Client.MapControl.Events.MapEvents.MapEvent(Events_MapViewChangedEnded);

}

void Events_MapViewChangedEnded(object sender, DeepEarth.Client.MapControl.Events.MapEventArgs args)

{

foreach (GeometryLayer GL in mapInstance.Layers)
{
foreach (GeometryControlBase<GeoAPI.Geometries.IGeometry> geo in GL.Geometries)
{
GL.UpdateChildLocation(geo);
}

}

}

Read the full discussion online.

To add a post to this discussion, reply to this email (deepearth@discussions.codeplex.com)

To start a new discussion for this project, email deepearth@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Sep 2, 2010 at 11:19 PM

if you set UseSprings = false;
you get the same behavior  even if you zoom or pan with the mouse

Sep 2, 2010 at 11:41 PM

I just don't understand how people are able to use DeepEarth in any serious application if the geometry layers have fundamental problems like this. I think that I must be missing something. Doesn't everyone have the need to draw lines and points and keep them in place and visible as the map is zoomed and panned?

DeepEarth is perfect for an application I have to develop as quickly as possible. It's nice that when you click on the top right control it spins and it's tool areas retract, but it's not a fundamental feature IMO.

I've spent hours over several evenings looking at the canvas transformation code, stepping through it with simple situations that exhibit problems, and I cannot see why it just doesn't work properly. Perhaps there is a fundamental issue in Silverlight that makes it very difficult or impossible to keep things synchronized with a MultiScaleImage, I don't know. Anyway, I became frustrated and gave up with it.

I really hope that one of the core developers takes a look at these issues. It seems a terrible shame for a project with so much potential to have basic functionality issues. :(

Sorry for the rant.

Andy

Sep 3, 2010 at 2:09 PM

i have never had issues when zooming or panning. i have been using this fix solely for the purpose of re-placing the contol elements on the map when the map's actual height and width change due to maximising and minimising the browser's window. it doesn't seem like there is a default implementation of an update to the element's position on the window's resize event.

i guess this is why it's an open source project - if it's broken, you can fix it!

Sep 3, 2010 at 2:17 PM

Perhaps its just in the wording.

My observation is that I have not found any problems panning or zooming either - the problem has been on resizing the window.  Panning and zooming after resizing the window actually "relocated" geometries in the correct position.

Thanks to the fix above, the application seems to be working fine for my purposes. 

Anyways - my two cents, have a nice day...... and it is a great application......

Sep 3, 2010 at 2:52 PM

Meridian211 try to set

MyMap.BaseLayer.Msi.UseSprings = false;

and the test again

Sep 3, 2010 at 5:10 PM
the_klaw wrote:
i guess this is why it's an open source project - if it's broken, you can fix it!

What if the problems I am seeing are a bug in Silverlight? What if there is some fundamental issue in SilverLight that stops perfect synchronization of a canvas with a MultiScaleImage? As far as I know SilverLight is not an open source project...

Anyway, as I mentioned, I've spent many hours trying to pin these problems down myself and gave up. So I guess, no, I can't fix it. Can you?

Andy