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

foolfish xjimmyshcn at sohu.com
Sun Jun 8 22:17:16 EDT 2008


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.



More information about the mapguide-users mailing list