[mapguide-users] Running Search query from Task Pane in Fusion

foolfish xjimmyshcn at sohu.com
Tue Jun 10 03:00:20 EDT 2008


[the answer to your first question:]
in your pages of Task Panel,the following line can get the mapname you want:
 String mapName = Request.QueryString.Get("MAPNAME").Split(',')[0];

[the answer to your second question:]
the following procedure can do a select at server:

     string map_name = Request.QueryString.Get("MAPNAME").Split(',')[0];
     String queryString = "ID='123'";  // filter condition
     String queryLayer =  "Line";       //Layer Name
     CreateSelectionXML_fusion(queryLayer, queryString, map_name);  
//invoke CreateSelectionXML_fusion()
...
    public void CreateSelectionXML_fusion(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_fusion(selection, featureService, queryLayer);
        selectionXML = selection.ToXml();
        selection.Save(resService, map_name);  // this is the difference,
must be saved. 
        featureReader.Close();
    }


after finished runing the code above,when it return to client, the following
code should be run:
<script type="text/javascript" >
parent.document.getElementById('Map').widget.aMaps[0].drawMap(); 
</script>

----------------------------------------------------------------------------


max_samart wrote:
> 
> Hi, 
>                   Thanks for Lot of Details let me go through and try the
> steps to see how i can migarate the same application on Fusion+MapGuide.I
> have some more questions reagrding the same:
> 1. How to find the fusion name-like xyz_fusion4845627ed9705
> 2. Can you elaborate little bit more on the below-->
> At server(? Path), after selection.ToXml() ,you should add the follow
> line:
> selection.Save(resService, map_name); 
> At client, use  window.top.Fusion.getWidgetById('Map').drawMap()  to
> refresh the map.
> 
> Thks
> Max !
> 
> 
> ----- Original Message ----
> From: foolfish <xjimmyshcn at sohu.com>
> To: mapguide-users at lists.osgeo.org
> Sent: Tuesday, June 10, 2008 11:39:28 AM
> Subject: Re: [mapguide-users] Running Search query from Task Pane in
> Fusion
> 
> 
> 1)install mapguide studio 2009, then you can create flexible weblayout.
> it's
> for fusion.
> note: you can't use base layer in map.
> 
> 2)the map.open(map_name) might occrue error. the map_name is not the same
> as
> traditional method(not use fusion),suppose the map name is asiamap , in
> fusion it looks like asiamap_fusion4845627ed9705.
> 
> 3)the parent.parent.mapFrame might occrue error. but you can use 
> parent.document.getElementById('Map').
> 
> 4)parent.parent.mapFrame.Refresh() cann't be used, you can use
> window.top.Fusion.getWidgetById('Map').drawMap()  to refresh map.
> 
> 5)if you want to select feature,you should do:
> at server, after selection.ToXml() ,you should add the follow line:
>               selection.Save(resService, map_name); 
> at client, use  window.top.Fusion.getWidgetById('Map').drawMap()  to
> refresh the map.
> 
> 
> ------------------------------------------------------------------------
>         
> 
> 
> 
> max_samart wrote:
>> 
>> Hi All,
>>           I am trying to migrate my application onto fusion(MGOS2.0.1)
>> although  i managed to add maps and other basic functions ,overview map
>> etc but i like to add my different customized search code into the fusion
>> task pane which use to perform search and then return results in the same
>> task pane and when i click on zoom icon, it use to select the feature and
>> returns the info of the feature (Its working in the MGOS2.0.1 but i don't
>> know how to get going into the Fusion-I tried adding the task in the task
>> pane same as MapGuide Open Source and gave the path for the query file
>> but
>> it use to show file not found error).
>> Thks
>> Max !!
>> 
>> 
>> 
>> _______________________________________________
>> 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/Running-Search-query-from-Task-Pane-in-Fusion-tp17730192p17747649.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/Running-Search-query-from-Task-Pane-in-Fusion-tp17730192p17748986.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list