<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD><TITLE>FW: Remove layers at runtime</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR><BASE
href=https://nngowa.nngco.com/exchange/Shane.Buscher/Drafts/RE:%20%5bMapguide_users%5d%20FW:%20Remove%20layers%20at%20runtime.EML/1_text.htm><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
.shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: Tahoma;
}
@font-face {
        font-family: StoneSans;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
font-face {
        FONT-FAMILY: Tahoma
}
font-face {
        FONT-FAMILY: StoneSans
}
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
P {
        FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: "Times New Roman"; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
SPAN.emailstyle18 {
        COLOR: navy; FONT-FAMILY: Arial
}
SPAN.emailstyle19 {
        COLOR: navy; FONT-FAMILY: Arial
}
SPAN.EmailStyle20 {
        COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=903320518-15012007><FONT face=Arial
color=#0000ff size=2>Hi Shane,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=903320518-15012007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=903320518-15012007><FONT face=Arial
color=#0000ff size=2>Hmm... I wonder if the viewer is not bothering to request
the map overlay image again? That would explain the behaviour you are
seeing.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=903320518-15012007><FONT face=Arial
color=#0000ff size=2>Are you using a Windows box as a client? Are you
familiar with Fiddler?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=903320518-15012007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=903320518-15012007><FONT face=Arial
color=#0000ff size=2>Fiddler is an HTTP proxy that captures HTTP requests and
responses. If you install and use it, you should be able to see all the
traffic between the client and Web Extensions / MapAgent. There should be
a GETDYNAMICMAPOVERLAY request generated by the client. This request
should refresh the map and show the added/removed layers.</FONT></SPAN></DIV>
<DIV><SPAN class=903320518-15012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=903320518-15012007><FONT face=Arial color=#0000ff size=2>Also,
are you using Base Map layers (ie. tiled images)? Base Map layers should
not be changed on the fly. They should be considered static. This is
probably not an issue since you are adding dynamic layers but I just figured I
would check.</FONT></SPAN></DIV>
<DIV><SPAN class=903320518-15012007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=903320518-15012007><FONT face=Arial color=#0000ff
size=2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=903320518-15012007><FONT face=Arial color=#0000ff
size=2>Trevor</FONT></SPAN></DIV>
<DIV dir=ltr align=left><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Buscher, Shane
[mailto:Shane.Buscher@nngco.com] <BR><B>Sent:</B> Monday, January 15, 2007 11:04
AM<BR><B>To:</B> Trevor Wekel; Mapguide_users@lists.osgeo.org<BR><B>Subject:</B>
RE: [Mapguide_users] FW: Remove layers at runtime<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Trevor,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I think I found a big
hint after testing what you suggested. When the layers I’m trying to
remove are within the map view extent, they do not ‘disappear’ upon removing
them. However, If the layers are completely outside the map view extent
they indeed get removed with the same code. It doesn’t matter if it’s one
layer or multiples. Hopefully this gives you something to work with.
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<DIV>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Trevor
Wekel [mailto:trevor.wekel@autodesk.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, January 15, 2007 11:18
AM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">My
bad. I've been working with the Mapguide 1.1.x and trunk branches.
You are working on the released 1.0.x branch. Sorry for the
confusion. 1.0.x does not have the boolean
return.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Is there
any difference if you try to remove only one layer so there are still
layers on the map?</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Trevor</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Buscher,
Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Saturday, January 13, 2007 1:31
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Trevor Wekel;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<DIV id=idOWAReplyText61961>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=black
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Trevor,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">MgLayerCollection.Remove doesn't
return a boolean according to the api documentation, and also doesn't indicate
it in the intellisense. </SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P></DIV></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Trevor
Wekel [mailto:trevor.wekel@autodesk.com]<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Fri 1/12/2007 5:18 PM<BR><B><SPAN
style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Remove()
should returns a boolean true or false. false indicates that the layer was
not removed. Can you see if the remove was successful? (just trying to
debug a bit)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,<BR>Trevor</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Buscher,
Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 12, 2007 4:13
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Trevor Wekel;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Trevor,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Thanks for
the response. I think I’m doing everything you suggested correctly, but
have provided the snippets below. When the page loads the
ConnectToMapGuide() method gets called, which opens up the MgMap and sets it to
a module level variable (map). Then, Button1 is clicked which successfully
adds two layers to the map. When Button2 gets invoked, I try to remove the
layers but the layers still persist in the map.
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I’m not
sure where to go from here. Do you need to copy the layers in session,
then add them from there in order to have the ability to remove them? Just
reaching…</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">‘class
vars</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Private</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> resourceService <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT>
MgResourceService</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Private</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> map <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> MgMap</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Private</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT>
ConnectToMapGuide()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'Connect to MapGuide
site</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> userInfo <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT> MgUserInformation(Session.Item(<FONT
color=maroon><SPAN
style="COLOR: maroon">"mgSessionId"</SPAN></FONT>))</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> siteConn <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT>
MgSiteConnection</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
siteConn.Open(userInfo)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'set resource
service</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
resourceService =
siteConn.CreateService(MgServiceType.ResourceService)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'Open
map</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map = <FONT color=blue><SPAN style="COLOR: blue">New</SPAN></FONT>
MgMap</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Open(resourceService, Session.Item(<FONT color=maroon><SPAN
style="COLOR: maroon">"mgMapName"</SPAN></FONT>))</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Protected</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT> Button1_Click(<FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> sender <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">Object</SPAN></FONT>, <FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> e <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> System.EventArgs) <FONT color=blue><SPAN
style="COLOR: blue">Handles</SPAN></FONT>
Button1.Click</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">‘add dwf
layer</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-INDENT: 0.5in"><FONT
face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">
Dim</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> schematicId <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT>MgResourceIdentifier _
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in; TEXT-INDENT: 0.5in"><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">(<FONT color=maroon><SPAN
style="COLOR: maroon">"Library://VST/Layers/SouthOmahaTeamSchematic.LayerDefinition"</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> schematic <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
CreateLayer(schematicId, <FONT color=blue><SPAN
style="COLOR: blue">False</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Insert(index, schematic)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">‘add sdf
layer</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Courier New" color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">
Dim</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> valveId <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT> MgResourceIdentifier _
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in; TEXT-INDENT: 0.5in"><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">(<FONT color=maroon><SPAN
style="COLOR: maroon">"Library://VST/Layers/SouthOmahaValves.LayerDefinition"</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> valves <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
CreateLayer(valveId, <FONT color=blue><SPAN
style="COLOR: blue">True</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Insert(index, valves)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Save(resourceService)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'emit javascript to refresh
map</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Protected</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT> Button2_Click(<FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> sender <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">Object</SPAN></FONT>, <FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> e <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> System.EventArgs) <FONT color=blue><SPAN
style="COLOR: blue">Handles</SPAN></FONT>
Button2.Click</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> lyr0 <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
map.GetLayers.GetItem(0)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> lyr1 <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
map.GetLayers.GetItem(1)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Remove(lyr0)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Remove(lyr1)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Save(resourceService)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'emit javascript to refresh
map</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<DIV>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Trevor
Wekel [mailto:trevor.wekel@autodesk.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 12, 2007 3:37
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">This
should work. During your setup, are you calling MgMap.Open() or
MgMap.Create()? The MgMap.Open() should set up the resource identifier
correctly so that Save() will have the map to the correct session
repository.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Is the
session id being propagated correctly? If you can do the following and the
layer appears in the viewer then the session should be
ok.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Open()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.GetLayers().Insert(layer)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Save()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">If the
Insert() works and Remove() doesn't</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Open()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.GetLayers().Remove(layer)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Save()</SPAN></FONT><o:p></o:p></P>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Then this
is probably a bug. Also, does the behaviour depend on the number remaining
layers?</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Trevor</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 1in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Buscher,
Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 12, 2007 7:16
AM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I haven’t
got any feedback yet, but I have been trying desperately to make this
work. To recap, I’m finding that adding a layer to a map at runtime with
MgLayerCollection.Add works fine. However, when I try to remove layer(s)
with MgLayerCollection.Clear, MgLayerCollection.Remove, or
MgLayerCollection.RemoveAt the layer(s) are indeed removed from the collection-
but <I><SPAN style="FONT-STYLE: italic">not the map</SPAN></I>. I am
saving the map and refreshing the map after removal.
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">So why
does inserting a layer into the MgMapCollection work, but removing not?
Looking at the developers guide on page 56 there is a note for getting a layer
collection from the map (MgMap.GetLayers): </SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><I><FONT face=StoneSans size=1><SPAN
style="FONT-SIZE: 9pt; FONT-STYLE: italic; FONT-FAMILY: StoneSans">In the
MapGuide API, getting a collection returns a reference to the collection. So
adding the layer to the layer collection immediately updates the
map.</SPAN></FONT></I><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I am get
the impression that adding a layer to the collection automatically updates the
map, this doesn’t apply for removing a layer. I can’t figure out what I
need to do to mimic what the api does for you when inserting a layer when trying
to remove a layer. Or is this a bug?</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Thanks for
any help in advance. </SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
mapguide_users-bounces@lists.osgeo.org
[mailto:mapguide_users-bounces@lists.osgeo.org] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Buscher, Shane<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tuesday, January 09, 2007 4:49
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B>
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> [Mapguide_users] FW: Remove layers
at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I’ve run into issues with removing
all layers from the map at runtime. See the code snippet below. All
the layers get removed from the layerCollection, but the layers still
display. I’ve successfully used the same code to insert layers, except I
execute the</SPAN></FONT> <FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">layerCollection.Insert(index,
layer) method. I don’t know why the same code wouldn’t work for clearing
layers. </SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">I have multiple layers
stored in a library repository that users need to add and remove at
runtime. Do I need to copy each layer in indvidual session repositories to
add and reomove them? If I don’t, will one user adding/removing layers
affect other user sessions? I know this is the case when you edit data,
but these layers are view only. </SPAN></FONT> <o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">‘</SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">Connect to
site server, set resource service, and open map</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">ConnectToMapGuide()
</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">'Clear all
layers in the map</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Dim</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
layerCollection</SPAN></FONT> <FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">As</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> MgLayerCollection =
map.GetLayers()</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> layerCollection.GetCount
> 0</SPAN></FONT> <FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Then</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
layerCollection.Clear()</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">map.Save(resourceService)</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">'emit
javascript to refresh map</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Dim</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> scriptKey</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">As</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">String</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> =</SPAN></FONT> <FONT
face="Courier New" color=maroon size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: maroon; FONT-FAMILY: 'Courier New'">"ForceRefresh"</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Not</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
Page.ClientScript.IsStartupScriptRegistered(<FONT color=blue><SPAN
style="COLOR: blue">Me</SPAN></FONT>.GetType, scriptKey)</SPAN></FONT> <FONT
face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Then</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> </SPAN></FONT> <FONT
face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Dim</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> javaScript</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">As</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">String</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> =</SPAN></FONT> <FONT
face="Courier New" color=maroon size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: maroon; FONT-FAMILY: 'Courier New'">"refreshMap("</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> & MapAction.RefreshMap
&</SPAN></FONT> <FONT face="Courier New" color=maroon size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: maroon; FONT-FAMILY: 'Courier New'">");"</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
Page.ClientScript.RegisterStartupScript(<FONT color=blue><SPAN
style="COLOR: blue">Me</SPAN></FONT>.GetType, scriptKey,
javaScript,</SPAN></FONT> <FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">True</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">)</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><A name=""><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Regards,</SPAN></FONT></A><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: Arial">Operations
IT</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: Arial">Northern Natural
Gas</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: Arial">402.398.7841</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><I><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-STYLE: italic; FONT-FAMILY: Arial">We
think in generalities, but live in detail.
</SPAN></FONT></I><o:p></o:p></P>
<P style="MARGIN-LEFT: 1.5in"><I><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-STYLE: italic; FONT-FAMILY: Arial">-Alred
North Whitehead</SPAN></FONT></I><o:p></o:p></P></DIV></DIV></BODY></HTML>