Select an object in MapGuide 2.0.2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Select an object in MapGuide 2.0.2

alba
hi all,

I use mapguide open source 2.0.2 on Windows XP and IIS
I have to select an object after the extraction, but
I tried in three different alternative ways but  doesn't work
I use the following code.
Anyone can help me? My work is stopped!
thanks Alba


//************************************
var mapWidgetId = 'Map';
var Fusion = window.top.Fusion;
var mapWidget = Fusion.getWidgetById(mapWidgetId);

function SelectFeature(){
        ..............................
        .............................
            selectionXml = reqHandler.responseText;
            sel=TrimString(selectionXml);

           //-- first mode-----------
             var map = GetParent().Fusion.getMapByName(mapName);
             map.setSelection(sel, true, true);
            //----------------

           //-- second mode----------
            GetParent().SetSelectionXML(sel);
            //----------------

           //-- third mode----------
            mapWidget.setSelection(sel, z);
            //----------------

           alert(mapWidget.hasSelection());

        }

function SetSelectionXML(selectionXml) {
    var Fusion = window.top.Fusion;
    var mapWidget = Fusion.getWidgetById('Map');
    if (mapWidget && mapWidget.isMapLoaded()) {
        mapWidget.setSelection(selectionXml, true, true);
    }
}

  function GetParent()
  {
    if(popup) {
        return opener;
    } else {
        return parent.parent;
    }
  }

 function TrimString(responseString)
        {
            responseString = responseString.replace( /^\s+/g, "" );
            return responseString.replace( /\s+$/g, "" );
        }
//*************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Select an object in MapGuide 2.0.2

Kenneth Skovhede, GEOGRAF A/S
Are you certain that the xml you use is correct?

Do you remember to refresh the map?

Regards, Kenneth Skovhede, GEOGRAF A/S



alba skrev:

> hi all,
>
> I use mapguide open source 2.0.2 on Windows XP and IIS
> I have to select an object after the extraction, but
> I tried in three different alternative ways but  doesn't work
> I use the following code.
> Anyone can help me? My work is stopped!
> thanks Alba
>
>
> //************************************
> var mapWidgetId = 'Map';
> var Fusion = window.top.Fusion;
> var mapWidget = Fusion.getWidgetById(mapWidgetId);
>
> function SelectFeature(){
> ..............................
> .............................
>    selectionXml = reqHandler.responseText;
>             sel=TrimString(selectionXml);
>
>            //-- first mode-----------
>              var map = GetParent().Fusion.getMapByName(mapName);
>              map.setSelection(sel, true, true);
>             //----------------
>
>            //-- second mode----------
>             GetParent().SetSelectionXML(sel);
>             //----------------
>
>            //-- third mode----------
>             mapWidget.setSelection(sel, z);
>             //----------------
>
>            alert(mapWidget.hasSelection());
>
>         }
>
> function SetSelectionXML(selectionXml) {
>     var Fusion = window.top.Fusion;
>     var mapWidget = Fusion.getWidgetById('Map');
>     if (mapWidget && mapWidget.isMapLoaded()) {
>         mapWidget.setSelection(selectionXml, true, true);
>     }
> }
>
>   function GetParent()
>   {
>     if(popup) {
>         return opener;
>     } else {
>         return parent.parent;
>     }
>   }
>
>  function TrimString(responseString)
>         {
>             responseString = responseString.replace( /^\s+/g, "" );
>             return responseString.replace( /\s+$/g, "" );
>         }
> //*************************************************
>  
_______________________________________________
mapguide-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: Select an object in MapGuide 2.0.2

alba
thank for your answer

my xml is in the insert image

and I refresh always the map, perhaps there are the errors in MapGuideViewerApi.js
I apply the MapGuideViewerApi.js.patch ticket # 213

I use

<script language="javascript" src="../../viewerfiles/browserdetect.js"></script><script language="javascript" src="../json.js"></script><script language="javascript" src="../../fusion/MapGuide/MapGuideViewerApi.js"></script>