I'm not sure if this is the proper way to do this, but the following
works for me.
Basically, I define a simple "map" variable outside of all Exhibit
javascript, so it's accessible to all of your own code. Then, override
the Exhibit function that produces the Google Map and assign it to the
"map" variable. So, in your Exhibit, add the following AFTER
referencing the exhibit and map extensions js files.
<script type="text/javascript">
var map;
var oldMapViewReconstruct = Exhibit.MapView.prototype._reconstruct;
Exhibit.MapView.prototype._reconstruct = function() {
oldMapViewReconstruct.call(this);
map = this._map;
};
</script>
You can then do things like:
<a href=
"javascript:maptest();">Test GMap</a>
function maptest() {
//to add a marker
var cpoint = new GLatLng(39.823,-75.723);
var cmarker = new GMarker(cpoint,{draggable: true});
map.addOverlay(cmarker);
//to pan/move to a location
map.panTo(new GLatLng(37.4569, -75.1569));
}
- John