MapWindow 4 - ActiveX Control Programming : MapWindow Discussion Forum
Hi, The code below sets a renderer to my point shapefile. When the layer is loaded all symbols are rendered correctly, however when I add a new point to the layer this is rendered using the default symbol. Only when I reload the layer the newly added point is rendered using the defin
using pictures for point features
Posted by: JosP ()
Date: July 07, 2011 05:43AM

Hi,

The code below sets a renderer to my point shapefile. When the layer is loaded all symbols are rendered correctly, however when I add a new point to the layer this is rendered using the default symbol. Only when I reload the layer the newly added point is rendered using the defined categories. A redraw or refresh of the map alone does not help.

Another problem is that the transparency does not seem to work. The transparent color I pass is coloured in a light gray.

This is the renderer code:

Private Sub ApplyRendererPointRefLayer()

        Dim sdo As MapWinGIS.ShapeDrawingOptions = mPointRef.DefaultDrawingOptions
        Dim index As Integer = mPointRef.Table.FieldIndexByName("sterkte")

        For i As Integer = 0 To 3
            Dim NetImage As New System.Drawing.Icon(mMapWin.Plugins.PluginFolder + "\GPR\Images\PRef" + i.ToString() + ".ico")

            Dim imgUtil As New ToolsImages
            Dim ico As New MapWinGIS.Image
            ico.Picture = imgUtil.ImageToIPictureDisp(CType(NetImage.ToBitmap(), System.Drawing.Image))
            ico.TransparencyColor = Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(0, 128, 128)))
            ico.UseTransparencyColor = True

            mPointRef.Categories.Add(i.ToString())
            mPointRef.Categories.Item(i).Expression = "[sterkte]= " & i.ToString
            mPointRef.Categories.Item(i).DrawingOptions.PointType = MapWinGIS.tkPointSymbolType.ptSymbolPicture
            mPointRef.Categories.Item(i).DrawingOptions.Picture = ico

            mPointRef.Categories.ApplyExpression(i)

            ico = Nothing
        Next i

    End Sub


JosP

Options: ReplyQuote
Re: using pictures for point features
Posted by: Sergei ()
Date: July 07, 2011 08:00AM

The first thing is simple: you should call Categories.ApplyExpression(i) after adding new shapes.
But I can't give a quick answer regarding transparency issue, I need to test the code.

Hope it'll help,
Sergei

Options: ReplyQuote
Re: using pictures for point features
Posted by: JosP ()
Date: July 07, 2011 08:36AM

Thanks Sergei, that worked.
I hope you can look into the transparency issue.

JosP

Options: ReplyQuote
Re: using pictures for point features
Posted by: pmeems ()
Date: July 11, 2011 03:59PM

Jos,

It might be best to submit an issue report about the transparency so we don't forget.
Please go to bugs.mapwindow.org

Thanks en bedankt,

Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Options: ReplyQuote
Re: using pictures for point features
Posted by: JosP ()
Date: December 29, 2011 06:09AM

Hi there,

Recently I downloaded MapWindow 4.8.6 and rendering point features with images does not work anymore, using the code and Sergei's suggestion above. The previous version did draw the images. This is a very serious issue for my project, could you please look into this?

The transparancy issue is less important to me, but is there any progress on this issue?

JosP

Options: ReplyQuote


Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: