MapWindow Developer Team : MapWindow Discussion Forum
------ Problem ------- line width of layer (LineOrPointSize) is not updated when project is read ------ description ~~~~~~~~~ in clsLayers newObject is set to nothing after layer is added to map. later, when updating the renderer for the layer,
clsLayers problem?
Posted by: jlkittle ()
Date: June 27, 2005 10:11AM

------ Problem -------
line width of layer (LineOrPointSize) is not updated when project is read

------ description ~~~~~~~~~

in clsLayers newObject is set to nothing after layer is added to map.

later, when updating the renderer for the layer, the following conditional is checked:
TypeOf newObject Is MapWinGIS.Shapefile

this fails, and properties like LineOrPointSize are not updated!


----- code excerpt ------
'now add the object (created or passed) to the Map
'this function actually returns the layer handle, not position
mapHandle = frmMain.Legend.Layers.Add(newObject, LayerVisible)
newObject = Nothing

' this lets the legend know we are working with a grid.
' The lyrType is ignored for all other types other than grid
' (the legend is smart enough to figure the others out by itself)
If lyrType = Interfaces.eLayerType.Grid Then
m_Grids.Add(mapHandle, newGrid)
frmMain.Legend.Layers.ItemByHandle(mapHandle).Type = lyrType
End If

If lyrType = Interfaces.eLayerType.Grid AndAlso GrdColorScheme Is Nothing Then
GrdColorScheme = CType(ImportScheme(mapHandle, IO.Path.ChangeExtension(lyrFilename, ".mwleg")), MapWinGIS.GridColorScheme)
End If

If Not GrdColorScheme Is Nothing Then
frmMain.MapMain.SetImageLayerColorScheme(mapHandle, GrdColorScheme)
frmMain.MapMain.set_GridFileName(mapHandle, lyrFilename)
frmMain.Legend.Layers.ItemByHandle(mapHandle).Refresh()
mPublics.ExportScheme(mapHandle, IO.Path.ChangeExtension(imgName, ".mwleg"))
End If

If NewPos < 0 Then 'it didn't open successfully
MsgBox("Failed to open file", , "MapWin.Layers.AddLayer")
GoTo ENDFUNC

Else
NewPos = frmMain.MapMain.get_LayerPosition(mapHandle) 'now get the actual position by the handle

Dim topBound As Integer

newLyr.Handle = mapHandle

With newLyr
.Name = lyrName
.DrawFill = DrawFill
If Color = -1 Then
.Color = IntegerToColor(MakeRandomColor())
Else
.Color = IntegerToColor(Color)
End If
If OutlineColor = -1 Then
.OutlineColor = IntegerToColor(MakeRandomColor())
Else
.OutlineColor = IntegerToColor(OutlineColor)
End If

If TypeOf newObject Is MapWinGIS.Shapefile Then
Dim sf As MapWinGIS.Shapefile
sf = CType(newObject, MapWinGIS.Shapefile)
Select Case sf.ShapefileType

Options: ReplyQuote
Re: clsLayers problem [fixed]
Posted by: cmichaelis ()
Date: June 30, 2005 07:34PM

Thanks for pointing this out - I've just fixed it and commited the change up to SVN.

I also found and fixed a problem with the "Recent Projects" menu where it doesn't like spaces in a directory name, e.g. "c:\Documents and Settings\Christopher\Desktop\temp.mwprj". I've got a few more fixes on my list which I'll commit as I get them done.

Thanks again!
--Chris M

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: