symbols are distorted

Topics: WinForms Controls
Oct 30, 2009 at 4:12 PM

Hi,

 

I can't seem to get sharpmap to put symbols on a layer which is just points without distorting the image.

I've tried setting SymbolScale to 1.0 and then 0.9 and then 0.8 but no success. It takes a nice icon and makes it quite blurred.

This seems like quite a simple thing but I would appreciate some help.

 

Thanks

Paul

Oct 30, 2009 at 4:14 PM

See http://rapidshare.com/files/300065715/sharpmapsymbol.png.html for an example of a screen capture of the icon and sharpmap window

Coordinator
Oct 30, 2009 at 8:44 PM

Hi Paul, from your image I am unclear if the map is being displayed in a MapImage/MapControl or a PictureBox. If it is a PictureBox then in may be being stretched. Anyway you want 1.0f as the scale hth j

Oct 31, 2009 at 4:39 AM

Hi John,

 

I'm using a MapImage control.

 

This is the code I use to load the layer onto the MapImage:

SharpMap.Data.Providers.GeometryFeatureProvider gfpAirports = new SharpMap.Data.Providers.GeometryFeatureProvider(fdtAirports);
                            SharpMap.Layers.VectorLayer layerAirports = new SharpMap.Layers.VectorLayer(layerName.ToString());
                            layerAirports.DataSource = gfpAirports;
                            layerAirports.Style.Symbol = Properties.Resources.windsoc16x16k;
                            layerAirports.Style.SymbolScale = 1.0f;

SharpMap.Map myMap = new SharpMap.Map();
            myMap.MinimumZoom = 0.1; //Minimum zoom allowed
            myMap.BackColor = Color.White; //Set background

            myMap.Layers.Add(layerAirports);

            myMap.ZoomToExtents();
            mapImage1.Map = myMap;
            mapImage1.Map.ZoomToExtents();

Oct 31, 2009 at 1:21 PM

Just to clarify - when I looked at the definition of MapImage control it extends the standard .NET PictureBox control. But the MapImage is the only control I could find when I added the SharpMap dll's to my toolbox.

 

Coordinator
Oct 31, 2009 at 10:47 PM

 

It has been a while since I have used the 0.9 controls but it sounds like the control is being stretched possibly due to docking or anchoring. Try setting StretchMode (iirc) to Center.. apologies for code block - only way to post from my phone... hth jd

 

 

Nov 1, 2009 at 5:12 AM

Hi John,

 

Thanks for the help - especially over a weekend! I did try and set the SizeMode to CenterImage however that didn't work. I'm going to try and respond to window resize commands and then manually adjust the size of the control - currently it is docked to "Fill". I'll let you know what the result is.

 

Just to clarify - you mention it's been a while since you've used the 0.9 controls however that's the latest download on codeplex. 22nd Oct 2009. Is there a later version I could be using?

 

Thanks

p.

Nov 1, 2009 at 5:15 AM

Hi John,

 

Even with the control undocked and trying ALL the possible settings of SizeMode the bitmaps are still distorted! Whew this is quite frustrating.

 

p.

 

Coordinator
Nov 2, 2009 at 9:21 AM

Hi Paul, I will try and look into it asap... btw there should be MapBox control which extends Control not PictureBox.. perhaps you could try that.

When I say about it being a while since I used the 0.9 controls irts because I am working more with v2 http://sharpmapv2.googlecode.com hth jd 

Nov 2, 2009 at 10:32 AM

Hi John,

 

There's definitely no MapBox control in SharpMap.UI.dll or SharpMap.dll.

 

You can see my ildasm dump - there's only 1 class in the SharpMap.UI.Forms namespace:

http://rapidshare.com/files/301324633/sharpmapildasm.jpg.html

 

Is sharpmapv2 ready for use? I probably want to go into production within 2-3 months.

 

p.

Coordinator
Nov 2, 2009 at 10:40 AM

It looks like you are using the really old 0.9 dlls _ I updated them the other day.. But I would still advise building the trunk from source and using Tortoise SVN to keep up to date..

SharpMap v2 is usable depending on what you need to do.. but It is in development and subject to change.. There is certainly not going to be a final release in 2 months.. hth jd

Nov 2, 2009 at 10:44 AM

Thanks - I will update from svn. Just to let you know the dll's I'm using were from 2009/10/22. So I think the release rar's are incorrect. I  just re-downloaded them from http://sharpmap.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34810 and mine are the same as the links on codeplex.

I'll get from codeplex svn though.

Is there a wiki or anything listing some major points of what v2 will have over v0.9?

p.

Coordinator
Nov 2, 2009 at 11:41 AM

Ah my mistake.. MapBox is still in the tree but excluded from the project.. V2 is completely redesigned - very briefly it has:

Much closer integration with NTS and GeoAPI

MVP pattern controls

Pluggable renderers (wip)

An expressive query system

....

It has a steeper learning curve though and is in need of some work in various places.. hth jd

Nov 4, 2009 at 2:39 AM

Hi John,

I built the trunk and included MapBox but still the images are stretched on a MapBox control. Any ideas?

Coordinator
Nov 4, 2009 at 9:40 PM

Hi Paul, can you try to load your data into the demo win form project and see what you get. Also do you have data from multiple coordinate reference systems or are you applying any kind of gdi transform when rendering? cheers jd

Nov 5, 2009 at 2:37 AM
Thanks John. I will try it out. I will check the ref. Systems but they all should be the same.

Paul de Goede
+27 82 941 5151

On 05 Nov 2009, at 12:40 AM, johndiss <notifications@codeplex.com> wrote:

From: johndiss

Hi Paul, can you try to load your data into the demo win form project and see what you get. Also do you have data from multiple coordinate reference systems or are you applying any kind of gdi transform when rendering? cheers jd