I've tried to cheat in Script editor with something like
Dim lyr as Layer lyr=m_MapWin.Layers.Item(m_MapWin.Layers.CurrentLayer) Dim cs as MapWinGIS.ShapefileColorScheme cs=lyr.ColoringScheme MsgBox("Hello")
to get unique values through coloring. It would be enough for my task. However I haven't even got message box.
P.S. It would be nice if there was an option to get unique values for Shapefile's attribute.
P.P.S. Script shouldn't just unpredictably terminate without any message.
If your layer is a grid, you can't use ShapefileColorScheme
You should use GridColorScheme
But I don't know if it will provide you the data your looking for.
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:
Follow me on Twitter MapWindow_nl to read when a new installer is published.
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
I didn't try on all versions of MW I have. I tried on one I built a while ago from SVN. It would be nice also to have an option to ignore warnings like unused variables etc.
Imports MapWindow.Interfaces Imports MapWinGIS Imports System.Windows.Forms Imports Microsoft.VisualBasic Imports System Public Module Ksat Public Sub ScriptMain(ByRef m_MapWin As IMapWin) Dim lyr as Layer If -1=m_MapWin.Layers.CurrentLayer Then MsgBox("Select layer first!") return End if lyr=m_MapWin.Layers.Item(m_MapWin.Layers.CurrentLayer) Dim old As Grid old = lyr.GetGridObject If IsNothing(old) MsgBox("Select raster layer first!") Return End if Dim s as string Dim cs as MapWinGIS.ShapefileColorScheme 'Dim cs as MapWinGIS.GridColorScheme cs=lyr.ColoringScheme MsgBox("Hello") s=cs.NumBreaks MsgBox(s) 'Dim cb as GridColorBreak 'cb=cs.Break(0) 's=cb.Caption 'MsgBox(s) 'Dim connectionString As String 'Dim dbConnection As System.Data.IDbConnection End Sub End Module