<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I don't understand what you mean.<br>
Changes to the runtime map does not go into MGStudio.<br>
Only changes to the MapDefinition xml can be seen there.<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
sekko970 skrev:
<blockquote cite="mid:1232531635328-2191381.post@n2.nabble.com"
type="cite">
<pre wrap="">Dear Kenneth,
I need your help for a second problem:
I apparently save successfully the new layer into library repository (the
legend and the map are correctly updated, and from MGStudio the new layer is
visible in layers list), but in MGStudio 'Layer by group' view, my layer
doesn't appear, so that when I reload the map, the new layer is lost (but
it's present in MGStudio).
Have you some idea?
Thanks, Fabio
sekko970 wrote:
</pre>
<blockquote type="cite">
<pre wrap="">You are right!
Many thanks.
Fabio
sekko970 wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Dear all,
I need to add a layer to my map from XML definition.
This is my code:
Public Sub CreateLater(ByVal sessionID As String, ByVal mapName As
String, _
ByVal newLayerName As String, ByVal
groupName As String)
Dim userInfo As New MgUserInformation
userInfo.SetMgSessionId(sessionID)
Dim siteConn As New MgSiteConnection
siteConn.Open(userInfo)
Dim resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService)
Dim map As New MgMap()
map.Open(resourceSrvc, mapName)
'Loading XML layer
Dim newLayerXML As New XmlDocument
newLayerXML.Load(Me.MapPath("NewLayer.xml"))
'Saving new layer in session repository
Dim byteSource As New
MgByteSource(Encoding.UTF8.GetBytes(newLayerXML.OuterXml),
newLayerXML.OuterXml.Length)
byteSource.SetMimeType(MgMimeType.Xml)
Dim resID As New MgResourceIdentifier("Session:" & sessionID &
"//" & newLayerName & "." & MgResourceType.LayerDefinition)
resourceSrvc.SetResource(resID, byteSource.GetReader(), Nothing)
Dim newLayer As New MgLayerBase(resID, resourceSrvc)
'Add new layer to group
Dim layerGroup As MgLayerGroup = Nothing
If map.GetLayerGroups().Contains(groupName) Then
layerGroup = map.GetLayerGroups.GetItem(groupName)
Else
layerGroup = New MgLayerGroup(groupName)
layerGroup.SetVisible(True)
layerGroup.SetDisplayInLegend(True)
layerGroup.SetLegendLabel(groupName)
map.GetLayerGroups.Add(layerGroup)
End If
newLayer.SetGroup(layerGroup)
'Insert new layer to map
newLayer.SetName(newLayerName)
newLayer.SetVisible(True)
newLayer.SetLegendLabel(newLayerName)
newLayer.SetDisplayInLegend(True)
map.GetLayers.Insert(0, newLayer)
map.Save(resourceSrvc)
Saving the map, an MgNotImplementedException occurs.
Where is my mistake?
Thanks in advance for your help.
Fabio
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>