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

VectorLayer Symbol Rotation

Topics: SharpMap v0.9 / v1.x, Web Controls
Dec 8, 2010 at 11:17 PM

Hello everybody

I'm having an issue with VectorLayer Symbol Rotation. I'm using the ExampleCodeSnippets.SymbolRotationTheming example to rotate a vector layer point's bitmap symbol by it's rotation column.

The symbols are rotated correctly but the center of the point is changed. By closer zoom levels the point is almost in the correct position, but at farther zoom levels the points get completily far way their center positions.

I have also tried assigning the Style.SymbolRotation property to the layer but got the same problem. 

I saw this related workitem but not sure if I have to change the source code for VectorRenderer.cs.

I compiled the lastest source code version, change set 81011 (VS2010) and copied the dlls to another project in VS2005. I'm using vectorlayers inside the ajaxMapControl.

Please some help !!! and sorry for the poor English.


Dec 9, 2010 at 1:25 PM

I'm posting the code I'm using for symbol rotation.

If someone can help me I can email the images resulting at different rotation angles.

private static void CargarPunto(ref SharpMap.Layers.VectorLayer layer, int srid,
        double max_visible, double min_visible, string nombre_icono, string rotation_column)
        if (nombre_icono != "") {
            layer.Style.Symbol = new Bitmap(HttpContext.Current.Server.MapPath(@"~\App_data\Iconos\" + nombre_icono + ".png"));
        layer.Style.Enabled = true;
        layer.Style.MaxVisible = max_visible;
        layer.Style.MinVisible = min_visible;
        layer.Style.SymbolOffset = new PointF(0, 0);
        layer.Style.SymbolRotation = 0;
        layer.Style.SymbolScale = 1f; //0.8f;

        if (rotation_column != "")
            ExampleCodeSnippets.SymbolRotationTheming rotation_theming =
                new ExampleCodeSnippets.SymbolRotationTheming(rotation_column, layer.Style);

            SharpMap.Rendering.Thematics.CustomTheme tema =
            new SharpMap.Rendering.Thematics.CustomTheme(rotation_theming.GetRotatedSymol);
            layer.Theme = tema;
            tema.DefaultStyle = layer.Style;
        layer.MaxVisible = max_visible;
        layer.MinVisible = min_visible;
        layer.SRID = srid;
        layer.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; 
Dec 9, 2010 at 2:08 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 9, 2010 at 2:09 PM

Carjona, could you setup a sample / Unit Test and add it to the WorkItem? Thanks

Dec 9, 2010 at 2:29 PM

Ok, should I upload the sample as an attach file ?

Dec 9, 2010 at 2:59 PM


Yes, please.