Dots on Mapsui WPF Sample

May 23, 2011 at 1:49 PM

Hi,

i try to figure out, where the dots are come from. I Would like to make Dots on the card, but i dont know how, because of this i look for the line where the dots are created.

Later i want draw on the map, is there something what i can use to draw on the map?

 

Thank you

Coordinator
May 29, 2011 at 9:35 PM

Hi,

Here is sample to create a layer with a single dot:

            var layer = new Layer("test");
            layer.DataSource = new MemoryProvider(new SharpMap.Geometries.Point(0, 0));
            layer.Styles.Add(new SymbolStyle() { Width = 20, Height = 20, Fill = new Brush() { Color = Color.White }, Outline = null });
            mapControl.Map.Layers.Add(layer);

another sample is the city layer in here:

http://mapsui.codeplex.com/SourceControl/changeset/view/65960#1040746

Paul

Jun 6, 2011 at 10:45 AM

Thx pauldendulk,

this works fine. I Try to Draw on the Map in realtime with a digital pen. But if i try to draw Points with your posted method i get
performance problems.  Is there a faster way to draw on the map?

 

Thanks

Coordinator
Jun 6, 2011 at 2:27 PM

Not at the moment. The current symbol rendering is a slow as can be :). You can think of ways to make it somewhat faster, but my hopes are for SL5's XNA rendering. 

Paul

Jun 6, 2011 at 3:23 PM
Edited Jun 6, 2011 at 4:38 PM

Hmm okay, i will first complete my application and then starting with optimisation.

Is there a way to use somethink like that in MapSui? http://sharpmap.codeplex.com/wikipage?title=Transform%20between%20image%20coordinates%20and%20world%20coordinates&referringTitle=How%20to...

I would like to transform from image coordinations to world coordinations

Thanks :)

 

I find where to do it.

In the view object there is a function to do this:

"view.ViewToWorld(Point)"

Jul 3, 2011 at 5:15 PM
Edited Jul 4, 2011 at 11:14 AM

I use now only one layer to draw multiple LineStrings. Performance is very good.

But if i create one more it slows down. I am looking at the moment for a way to draw multiple linestings with

different colors. Do you know a way how to do this?

I set the color of the linestrings over the Layer...

Coordinator
Jul 4, 2011 at 8:13 AM

`You could use a ThemeStyle. There are samples for countries and cities in ShapefileSample.cs:

http://mapsui.codeplex.com/SourceControl/changeset/view/65960#1040746

Paul

Jul 4, 2011 at 10:12 PM

I use ThemeStyle in this way:

featureContainer = new Dictionary(); 

   private void iTHEME()
        {
            ThemeStyle t = new ThemeStyle(testc);
            layer.Styles.Add(t);
        }

        public IStyle testc(IFeature i)
        {
            if (featureContainer.ContainsKey(i.GetHashCode()))
            {
                Console.WriteLine("ist da");
            }
            return createStyleForRegion(20, 50, 0, 0);
        }

But i dont know how to identify a Feature. I dont undestand where this happen in your example which you have posted.

Is this the right way to do this?

Thank you

Coordinator
Jul 5, 2011 at 5:50 AM

you could create a ThemeStyle 

in the sample add a method:

        private static IStyle GetMyStyle(IFeature f)
        {
            var style1 = new VectorStyle();
            style1.Outline = new Pen { Color = Color.Black };
            style1.Fill = new Brush { Color = Color.Red };

            var style2 = new VectorStyle();
            style2.Outline = new Pen { Color = Color.Black };
            style2.Fill = new Brush { Color = Color.Blue };
            
            if (Convert.ToDouble(f["POPDENS"]) > 10) 
                return style1;
            else
                return style2;
        }

and replace:

countries.Styles.Add(popdens);

with:

countries.Styles.Add(new ThemeStyle(GetMyStyle));

and run Mapsui.WinForms

Jul 5, 2011 at 11:04 AM

Thank You :)

I dont know that i can do this =>  f["blub"] = "lala";

Jul 10, 2011 at 9:53 PM
Edited Jul 11, 2011 at 11:28 AM

Which coordinate system are you yousing? I have some points (longitude, latitude) and want to draw them on the map. But i

dont know how to transform them.

 

I found my answer here :) http://pauldendulk.com/2011/04/projecting-from-wgs84-to.html