[mapguide-users] Reference Map

Adrià amptarraco at hotmail.com
Tue Apr 17 04:03:02 EDT 2007


I have been searching the list and found some ideas to add a reference map to
the web layout. We made a first approach that can be seen in action 
http://213.195.75.242:8008/mapguide/viewertest/ here . It is not intended to
be stable or in its final form, so comments, ideas and criticism will be
appreciated. We hope it would be helpful.

This is a summary of the steps we followed to add it, :

 

Copies of mapframe.php and ajaxmappane.templ were made (mapframeref.php and
ajaxmappaneref.templ). In ajaxmappaneref.templ everything except the map
image was hidden (legend, properties, slider, etc.) and a couple of
functions were added:

function drawMainMapExtent(X1,Y1,X2,Y2) {
	var p1,p2;
	p1 = MapToScreenUnits(X1,Y1);
	p2 = MapToScreenUnits(X2,Y2);
	
	return ShowMainMapExtent(p1.X,p1.Y,p2.X,p2.Y,true);
}
function ShowMainMapExtent(x1,y1,x2,y2,show) {
    var rcFrame = document.getElementById("rcFrame");
    if(show){
			try {
	        rcFrame.style.position = "absolute";
	        rcFrame.style.left = (x1 + mapPosX) + "px";
	        rcFrame.style.top = y1 + "px";
	        rcFrame.style.width = (x2 - x1) + "px";
	        rcFrame.style.height = (y2 - y1) + "px";
	        rcFrame.style.visibility = "visible";
	        rcFrame.zIndex = 20;
	        return true;
	    } catch (e) {
	    	return false;
	    }
    } else {
    	rcFrame.style.visibility = "hidden";
    	return true;
    }
}


A new frame was added in framesettaskbar.templ, in the top of the task area.
mainframe.php was modified to receive a new parameter, the MapDefinition
used in the reference map. When building the viewer, mainframe.php loads
mapframeref.php in this frame, with the Map definition passed as parameter
and false values for SHOWLEGEND, SHOWPROP, etc
In mainframe.templ a function was added to fire the extent drawing in the
reference map:

 function OnExtentChanged(X1,Y1,X2,Y2) {
  	if (X1 && Y1 && X2 && Y2) refMap.drawMainMapExtent(X1,Y1,X2,Y2);
  }


Finally, in ajaxmappane.templ, on at the end of the OnMapRequested()
function, we call OnExtentChanged()

parent.OnExtentChanged(extX1, extY1, extX2, extY2);



-- 
View this message in context: http://www.nabble.com/Reference-Map-tf3589380s16610.html#a10031010
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070417/c019a17c/attachment.html


More information about the mapguide-users mailing list