We've been experimenting with the manifest file and it will at least solves the need to register the ocx. Just copying will be enough.
In a short while we'll write a article about it how to do this for your own application.
Thanks,
Paul
Dim category As MapWinGIS.ShapefileCategory = sf.Categories.Add("Manual")
Dim ad As String = "Alaska"
Dim UniqueShape As New MapWinGIS.Shapefile
UniqueShape = FormMain.AxMapMain.get_GetObject(idx)
Dim af As String = UniqueShape.Table.Field(1).Name
Const cote As String = """"
'failed
' category.Expression = "[STATE_NAME] = """ + ad + """"
'failed
' category.Expression = "[STATE_NAME] <> """""
'failed
category.Expression = "[" + af + "] = " + ad
'failed
category.Expression = "[STATE_NAME] = " & cote & "Alaska" & cote
'failed
'category.Expression = "[STATE_NAME] = ""Alaska"""
Dim utils As New MapWinGIS.Utils
category.DrawingOptions.FillColor = utils.ColorByName(MapWinGIS.tkMapColor.Magenta)
sf.Categories.ApplyExpression(0)
sf.DefaultDrawingOptions.Visible = False
' FormMain.AxMapMain.AddLayer(sf, True)
FormMain.AxMapMain.Redraw()
FormMain.AxMapMain.Refresh()
sf.Categories.Clear()
idx = FormMain.Legend.SelectedLayer
sf = FormMain.AxMapMain.get_Shapefile(idx)
Dim cat As MapWinGIS.ShapefileCategory = sf.Categories.Add("1")
cat.Expression = "[PERIMETER] >=0 AND [PERIMETER]<=2 "
Dim utils As New MapWinGIS.Utils
cat.DrawingOptions.FillColor = utils.ColorByName(MapWinGIS.tkMapColor.Magenta)
sf.Categories.ApplyExpression(0)
sf.DefaultDrawingOptions.Visible = False
FormMain.AxMapMain.Redraw()
FormMain.AxMapMain.Refresh()
End Sub
REM ...
' Layerobjekt erstellen
Set objShape = Forms(strMap).mapMain.GetObject(lngHandle)
' Index erstellen
intIndexField = objShape.Table.FieldIndexByName("oid")
objShape.Categories.Generate intIndexField, MapWinGIS.tkClassificationType.ctUniqueValues, 0
objShape.Categories.ApplyExpressions
' Shape-Objekte durchlaufen
For i = 0 To objShape.NumShapes - 1
' auf GemarkungsNr testen
If objShape.CellValue(1, i) = CStr(gmkgNr) Then
' Testen, ob FlurstücksNr übereinstimmt
If objShape.CellValue(2, i) = CStr(flstNr) Then
' Testen, ob Teilfläche übereinstimmt
If objShape.CellValue(3, i) = CStr(flstTl) Then
' Auf Shape zoomen
Forms(strMap).mapMain.ZoomToShape lngHandle, i
' Fenster vergößern - in Prozent
Forms(strMap).mapMain.zoomOut (3)
' Farbe setzen
lngShpIndex = objShape.ShapeCategory(i) ' lngShpIndex = -1
' Testen, ob Füllfarbe übergeben
If IsMissing(fillColor) Then
'objShape.Categories.Item(lngShpIndex).DrawingOptions.fillColor = ReadIni.getWert("SelectionColor")
objShape.Categories.Item(lngShpIndex).DrawingOptions.fillColor = 10584682
Else
objShape.Categories.Item(lngShpIndex).DrawingOptions.fillColor = fillColor
End If
' Karte neu zeichnen - sonst wird beim ersten Aufruf das Flurstück nicht markiert
Forms(strMap).mapMain.Redraw
End If
End If
End If
Next i
REM ...
The shape is found, as the inner if branch is entered, but lngShpIndex is set to -1 and accordingly the line:objShape.Categories.Item(lngShpIndex).DrawingOptions.fillColor = 10584682
produces an "Object or withblock not set" error.Hi All,
I have an access database that incorporates the MapWinGis (activex) component. I have this database installed on numerous systems. Two systems have some sort of problem that I’m having trouble debugging. It acts as if MapWinGis isn’t installed (cant create component errors), but if I go into the code library, references to MPGIS are there, below is a screen capture of the error message, and in the background you can see that access is ‘seeing’ mapwingis library. In this case, the offending line of code is:
GisLandfillFile.Open (GridFile)
Where GisLandfillFile is defined as:
GisLandfillFile As New MapWinGIS.Shapefile
I also get error messages if I open forms that include a map control object, with similar (no object in this control) errors. Any ideas?
Douglas J. KellyL.G., L.HG.
Hydrogeologist
Island County Environmental Health
(360) 678-7885
Public Sub clearSelection()
' Selection zurücksetzen
Dim objShape As MapWinGIS.Shapefile
Dim objOptions As MapWinGIS.ShapeDrawingOptions
Dim lngLayerHandle As Long
Dim varShapeIDs As Variant
Dim lngShapeIndex As Long
Dim i As Long
' get handle of active layer
lngLayerHandle = colLayers(Me.lstProject.SelectedItem.Key).layerHandle
' create layerobject
Set objShape = Me.mapMain.GetObject(lngLayerHandle)
' create index on the first column
REM this line produces an out of stack space error with large files
objShape.Categories.Generate 0, ctUniqueValues, 0
' get selected items
objShape.SelectShapes Me.mapMain.Extents, 0, INTERSECTION, varShapeIDs
objShape.Categories.ApplyExpressions
' iterate over selected items
For i = 0 To UBound(varShapeIDs)
' get shapeindex of current item
lngShapeIndex = objShape.ShapeCategory(varShapeIDs(i))
' reset fill color
objShape.Categories.Item(lngShapeIndex).DrawingOptions.fillColor = _
colLayers(Me.lstProject.SelectedItem.Key).fillColor
Next i
Me.mapMain.Redraw
End Sub
If the shapefile has a large number of Elements, in one case nearly 46,000 elements, the line:objShape.Categories.Generate 0, ctUniqueValues, 0
leads to an error (28 - out of stack space). objShape.SelectNone
does the trick.' ...
' Create a shapefile object
Set objShape = Forms(strMap).mapMain.GetObject(lngHandle)
' Create the index
objShape.Categories.Generate 0, ctUniqueValues, 0
objShape.Categories.ApplyExpressions
' iterate over shapes
For i = 0 To objShape.NumShapes - 1
' Check for correct value
If objShape.CellValue(1, i) = correctValue Then
' This is Where the Index seems to be needed
lngShpIndex = objShape.ShapeCategory(i)
' Here I simply Change the fillColor
objShape.Categories.Item(lngShpIndex).DrawingOptions.fillColor = Me.txtColor.BackColor
End If
Next i
As stated before, the application crashes with very large Shapefiles. So here are two more questions:objShape.Categories.Generate intIndexField, ctNaturalBreaks, 0
The Code works. I use for Velsto INO setup which works fine and is also used for Mapwindow installers. Use the MapwinGis only installer (call it from your INO script) it saves you a lot of trouble.
Greetings Maurits