[mapguide-users] how to set selected feature at client in fusion???

foolfish xjimmyshcn at sohu.com
Mon Jun 9 21:49:13 EDT 2008


at server in CreateSelectionXML() ,i add  the following line:
selection.Save(resService, map_name); 

at client i  use the following line to refresh the map:
parent.document.getElementById('Map').widget.aMaps[0].drawMap(); 

then it's OK。

thank's a lot, Paul~:handshake:


Paul Spencer-5 wrote:
> 
> Hi,
> 
> Fusion works with selections somewhat differently, you should be able  
> to just save() the selection on the server side and Fusion will pick  
> it up (at least that is how the query stuff works).
> 
> I believe Mike did add something for selection xml but I don't know  
> what it was - perhaps he will comment :)
> 
> Cheers
> 
> Paul
> 
> On 8-Jun-08, at 10:17 PM, foolfish wrote:
> 
>>
>> my problem is in tradition method (not use fusion), i can select  
>> feature at
>> server, and display the selected feature at client。
>>
>> but in fusion,the follow line is failed:
>> parent.parent.SetSelectionXML(selectionXML);
>> parent.parent.mapFrame.Refresh();
>>
>> my question is how to setSelection at client in fusion?:confused:
>>
>> -------------------------------------------------------------
>> [at server]:i define a function to select Feature,and return a  
>> selectionXML
>> public void CreateSelectionXML(String queryLayer, String  
>> queryString,String
>> map_name)
>>    {
>>        MgResourceService resService =
>> (MgResourceService 
>> )siteConnection.CreateService(MgServiceType.ResourceService);
>>        MgFeatureService featureService =
>> (MgFeatureService 
>> )siteConnection.CreateService(MgServiceType.FeatureService);
>>      MgMap map = new MgMap();
>>        map.Open(resService, map_name);
>>        MgLayer layer = (MgLayer)map.GetLayers().GetItem(queryLayer);
>>      MgResourceIdentifier resId = new
>> MgResourceIdentifier(layer.GetFeatureSourceId());
>>        MgFeatureQueryOptions queryOption = new  
>> MgFeatureQueryOptions();
>>        queryOption.SetFilter(queryString);
>>        MgFeatureReader featureReader =  
>> featureService.SelectFeatures(resId,
>> queryLayer, queryOption);
>>      MgSelection selection = new MgSelection(map);
>>        selection.AddFeatures(layer, featureReader, 0);
>>        OutputSelectionInHTML(selection, featureService, queryLayer);
>>        selectionXML = selection.ToXml();
>>    }
>>
>> -------------------------------------------------------------
>> [at client]:
>> <%
>>    string sessionID = Request.Form.Get("SESSION");;
>>     String queryString = "ID='"+ Request.Form.Get("ID"); +"'";
>>     String queryLayer =  Request.Form.Get("LAYER_NAME");
>>     String map_name = Request.Form.Get("MAP_NAME");
>>
>>     InitializeWebTier(Request);
>>     onnectToServer(sessionID);
>>     CreateSelectionXML(queryLayer,queryString,map_name );
>>     String selectionXML = utility.SelectionXML;
>> %>
>> ...
>> <script type="text/javascript" >
>>        function onPageLoad() {
>>            var selectionXML = '<% = selectionXML  %>';
>>            parent.parent.SetSelectionXML(selectionXML);
>>        }
>> parent.parent.SetSelectionXML(selectionXML);
>> parent.parent.mapFrame.Refresh();
>>
>> </script>
>> ...
>> <body onload="onPageLoad()" >
>> ...
>> </body>
>> -------------------------------------------------------------
>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/how-to-set-selected-feature-at-client-in-fusion----tp17725343p17725343.html
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-set-selected-feature-at-client-in-fusion----tp17725343p17746146.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list