[mapguide-users] Select and zoom to feature in Mapguide+Fusion

alba a.penitente at gepaspa.com
Thu Apr 23 11:13:13 EDT 2009


hi Traian,

You excuse me for this email, but I see that you have sent many posts, then
maybe you can help

I have the problem to select and to zoom objects on map

I use mgos 2.0.1 with IIS and fusion
I insert the function

<script language="javascript" >

In my procedure I insert

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


...
function Selezione_oggetto(){

var resultSelect = document.getElementById("resultSelect");
var k=0;
var valoreCercato=dati_ord[resultSelect.value];
while(valoreCercato!=dati[k]){
  k=k+1;
  }
            //alert(k);
            reqParams = "COMMAND=GETSELECTIONXML";
			reqParams += "&SESSION=" + encodeURIComponent(session);
            reqParams += "&MAPNAME=" + encodeURIComponent(mapName);
			reqParams += "&LAYERNAME=" + encodeURIComponent("Catastali");
			reqParams += "&IDLIST=" + results[k].idList.toJSONString();
            if (msie)
                reqHandler = new ActiveXObject("Microsoft.XMLHTTP");
            else
                reqHandler = new XMLHttpRequest();

            reqHandler.open("POST", "querycontroller.php", false);
            reqHandler.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
			reqHandler.send(reqParams);
			selectionXml = reqHandler.responseText;
            alert(mapName);

// ?????????? problem----------------------

//parent.parent.mapFrame.SetSelectionXML(TrimString(selectionXml));// old
for mg 1.2

var map = GetParent().Fusion.getMapByName(mapName);  // ??????????

map.SetSelectionXML(selectionXml);// ??????????
}


function Zoom_oggetto()
{//alert("ZoomToFeature");
var resultSelect = document.getElementById("resultSelect");
var scaleInput = document.getElementById("scaleInput");
scale = scaleInput.value;
scale = (scale == 0) ? 10000 : scale;
scale = scale*1.0;
var k=0;
var valoreCercato=dati_ord[resultSelect.value];
while(valoreCercato!=dati[k]){
    k=k+1;
  }

feature = results[k];

// ?????????? problem----------------------
//parent.parent.mapFrame.ZoomToView(feature.centerX, feature.centerY, scale,
true);// ??????????

var map = GetParent().Fusion.getMapByName(mapName);// ??????????
map.ZoomToView(feature.centerX, feature.centerY, scale, true);// ??????????

}


</script>

all from example ..www\phpviewersample\query

but it does not work!

Can you help me, please?

Thank Alba

-- 
View this message in context: http://n2.nabble.com/Changing-current-selection-colour-tp1805368p2683842.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list