This project has moved and is read-only. For the latest updates, please go here.

Animation and Pan problem + source code

Aug 10, 2014 at 5:29 PM
Edited Aug 10, 2014 at 5:33 PM
hello, sorry for my bad English.
I have problem with pan in zoom-in high value.
in a layer with animation symbol that update position in timer, symbol disappear when i pan map. there is a moving area that symbol hidden when pan to it:

please help. i use winformsample code:
//Adds a moving variable layer
            VectorLayer pushPinLayer = new VectorLayer("PushPins");
            position = geom.Centre;
            pushPinLayer.Style.Symbol = Resources.test;
            var geoProvider = new SharpMap.Data.Providers.GeometryProvider(geos);
            pushPinLayer.DataSource = geoProvider;

Aug 12, 2014 at 7:28 AM
You mean while zooming/panning the content of the variable layer collection is not shown, or does it not reappear after the panning operation is complete?
Aug 12, 2014 at 10:50 AM
Edited Aug 12, 2014 at 10:52 AM
thank you for reply. this is my problem:
i zoom in map x10 time. my symbol moving to top and right. every thing is ok. but when i pan symbol to bottom left corner, symbol disapear!!! and when i pan it to top right symbol showing. this problem is only on zoom high level.
i can submit complete project if u need.
please help. there is a bug?
Aug 12, 2014 at 5:11 PM
are you only adding the one point to the map?

If so you are going to struggle to zoom in on a single point because it has no area. You really need to specify an area to zoom to. If you look at the envelope of your geom (which I assume is a point), you'll see the min and max values are the same, hence it has no area, hence zoomToBox will likely give you odd results.

The easiest way to fix this is to call geom.buffer(#value here#) with a value that makes sense in the coordinate system your data is in (so for lat/long 1 might be a good figure).

That should return a geometry with an area that the map can zoom too.
Aug 12, 2014 at 7:24 PM
thank you Robert. yes i have only one point, and add a png image to it. i will test geom.buffer. or change max min value, i hope this work.
if problem not solved, i submit complete project.
Aug 13, 2014 at 11:23 AM
problem not solved.
this is source code: (visual studio 2012)

I can't find geom.buffer or any buffer. please download project, click add symbol, zoom in to end level, when symbol moved, pan map to left bottom. symbol disapear!
please help.
Aug 15, 2014 at 7:03 PM
please help me on this problem. my project stopped...
Aug 18, 2014 at 8:11 AM
Edited Aug 18, 2014 at 8:11 AM
The problem is that you are changing the underlying coordinate of the geometry without calling GeometryChanged on the geometry.

After updating the X/Y values, you need to call .GeometryChanged(); on your geometry using that coordinate.

I could suggest doing the following changes:
  1. [Line 25] Change to : GeoAPI.Geometries.IPoint position; instead of Coordinate
  2. private void MainTimer_Tick(object sender, EventArgs e)
        position.X = position.X + 0.001;
        position.Y = position.Y + 0.001;
        //Update envelope after position have changed
  3. in button1_click change to
        position = gf.CreatePoint(new GeoPoint(0, 0));
        var aux = new List<IGeometry>();
Hope this helps..
Marked as answer by petlof on 8/18/2014 at 1:06 PM
Aug 18, 2014 at 7:27 PM
Edited Aug 18, 2014 at 7:27 PM
thank you peter. it's worked.Most of these problems are due to lack of reference information about functions and property. thank you.