<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
<META content="MSHTML 6.00.2900.3676" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV><FONT face=Arial color=#0000ff size=2></FONT><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> VOLZ Mark (FN) <BR><B>Sent:</B> Wednesday,
2 June 2010 2:21 PM<BR><B>To:</B>
'mapguide-internals@lists.osgeo.org'<BR><B>Subject:</B> Problem with programatic
changes of layers<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=779085103-02062010>Folks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=779085103-02062010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=779085103-02062010>I'm using the MGE
2010 (using a basic web layout) and I am having some problems when I
modifiy a layer via a piece of php (and I'm not getting much joy from
ADSK).</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=779085103-02062010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=779085103-02062010>The
scenerio;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=779085103-02062010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=779085103-02062010>1) From another app
the user launches a mapguide session via a url call which contains a unique
id for the particualar piece of plant they wish to view i.e. </SPAN></FONT><FONT
face=Arial size=2><A
href="http://<server_name>/mapguide2010/feederstat/navnet-switchzone.php?ParentId=60005615">http://<server_name>/mapguide2010/feederstat/navnet-switchzone.php?ParentId=60005615</A></FONT></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>2) The
navnet-switchzone.php creates and logs into a mapguide
session.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010></SPAN><SPAN class=779085103-02062010><FONT
face=Arial size=2>3) This page then calls another page passing the
ParentID, session id, & mapname variables. </FONT></SPAN><SPAN
class=779085103-02062010><FONT face=Arial size=2></FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>4) The second page
has 2 functions firstly to set a layer filter and secondly to make that layer
invisible in the layer legend.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>5) The first page
then zooms to the extents as calculated via an mbr query on Oracle
spatial.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>Simple
enough.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>My problem is the
second action of the second php page i.e. setting the layer to invisible in the
layer legend. It does do it after the user performs a zoom or pan command but it
is in the layer legend when the page first loads which I don't
want.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>Things I have
tried;</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>1) Adding the layer
to the library map with the filter set to -1 and turning off the layer
legend visiblity. - no luck</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial><FONT size=2>2) doing a
second zoom when the page is first loaded i.e. log into the seession zoom to a
scale of (truescale * 1.1) modify the layer then zoom to true scale. - no
luck<SPAN class=121331805-02062010><FONT
color=#0000ff> </FONT></SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial><FONT size=2><SPAN
class=121331805-02062010>3) After page loads running the ForceRefresh()
command</SPAN></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>Any
ideas?</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>Below is the code i
am using to modify the layer.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>Any help would be
greatly appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2>Mark</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2>// change
HV_isol_dev_parent layer<BR> $resId = new
MgResourceIdentifier('Library://FeederStat/Layers/HV_isol_dev_parent.LayerDefinition');<BR> $byteReader
= $resourceService->GetResourceContent($resId);<BR> $layerXML =
$byteReader->ToString();<BR> $doc =
DOMDocument::loadXML($layerXML);<BR> $GridNode =
$doc->getElementsByTagName('GridLayerDefinitionType');<BR> $FilterNode =
$doc->getElementsByTagName('Filter');<BR> $FilterNode->item(0)->nodeValue
= "ECORP_ASSET_ID = ".$parentId;</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2> $LayerDefinition = $doc->saveXML();<BR> $byteSource = new
MgByteSource($LayerDefinition,
strlen($LayerDefinition));<BR> $byteSource->SetMimeType(MgMimeType::Xml);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2> $layerName="HV_isol_dev_parent";<BR> $sessionLayer =
"Session:".$sessionId."//".$layerName.".LayerDefinition";<BR> $sessResId =
new
MgResourceIdentifier($sessionLayer);<BR> $resourceService->SetResource($sessResId,
$byteSource->GetReader(), null);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial size=2> $newLayer =
new
MgLayer($sessResId,$resourceService);<BR> $newLayer->SetName($layerName);<BR> $newLayer->SetVisible(true);<BR> $newLayer->SetLegendLabel($layerName);<BR> $newLayer->SetDisplayInLegend(false);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2> $layerCollection = $map->GetLayers();<BR> $layerCount =
$layerCollection->GetCount();<BR> $modelLayerIndex =
$layerCount-2;<BR> if
($layerCollection->Contains("HV_isol_dev_parent"))<BR> {<BR>
$selLayerIndex =
$layerCollection->IndexOf("HV_isol_dev_parent");<BR>
$modelLayerIndex = $selLayerIndex;<BR>
$layerCollection->RemoveAt($selLayerIndex);<BR> }<BR> // Add Model
layer to collection<BR> if (!
$layerCollection->Contains($layerName))<BR>
{<BR> $layerCollection->Insert($modelLayerIndex,$newLayer);<BR> //
$layerCollection->Insert($layerCount-2,$newLayer);<BR>
}</FONT></SPAN></DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=779085103-02062010><FONT face=Arial
size=2></FONT></SPAN> </DIV><p> <br />*************************************************************************<br />This e-mail (including any attachments) may contain confidential or<br />privileged information and is intended for the sole use of the person(s) to<br />whom it is addressed. If you are not the intended recipient, or the person<br />responsible for delivering this message to the intended recipient, please<br />notify the sender of the message or send an e-mail to<br /><a href="mailto:help.desk@ergon.com.au">mailto:help.desk@ergon.com.au</a> immediately, and delete all copies. Any<br />unauthorised review, use, alteration, disclosure or distribution of this<br />e-mail by an unintended recipient is prohibited. Ergon Energy accepts no<br />responsibility for the content of any e-mail sent by an employee which is of<br />a personal nature.</p><p>Ergon Energy Corporation Limited ABN 50 087 646 062<br />*************************************************************************</p>
</BODY></HTML>