Creating Google Maps' interface in Dojo
I am trying to use the ArcGIS 2.1 JS API to create a custom interface that looks similar to Google Maps.
What is confusing me (partic开发者_如何转开发ularly with Dojo's layout scheme) is how Google Maps has a map pane that extends the whole width of the page and has a left search results panel that seems to be floating above the map pane.
How does this work in terms of Dojo layouts? I have frustratingly worked with BorderContainers and looked at the documentation for a FloatingPane with no avail.
Any direction is appreciated.
Not sure what problem you're running into - either troubleshooting or design, but, here is a rigid construct example that might work:
<html>
<head>
<title>dojo/google map example</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/resources/dojo.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dijit/themes/claro/claro.css" type="text/css" media="all" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script djConfig="parseOnLoad:true" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
dojo.require( "dijit.layout.BorderContainer" );
dojo.require( "dijit.layout.ContentPane" );
dojo.addOnLoad( function() {
var myLatlng = new google.maps.LatLng(38.887, -77.016);
var myOptions = {
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Hello World!"
});
});
</script>
</head>
<body class="claro" style="height:100%;padding:0;margin:0; overflow:hidden">
<div dojoType="dijit.layout.BorderContainer" style="height:100%">
<div dojoType="dijit.layout.ContentPane" region="left" splitter="true" style="width:200px">
Left search thing
</div>
<div dojoType="dijit.layout.ContentPane" region="top" style="height:100px">
Top
</div>
<div dojoType="dijit.layout.ContentPane" region="center" style="overflow:hidden">
<div id="map_canvas" style="height:100%; width:100%"></div>
</div>
</div>
</body>
</html>
You can substitute components for expando panes, and other gizmos, but this should technically work and look like:
http://imgur.com/ASlGG.png
Or you could just use the ArcGIS Extension for Google Maps :)
http://resources.esri.com/arcgisserver/apis/javascript/gmaps/
精彩评论