- function USGSOverlay(bounds, image, map, opacidade) {
- // Now initialize all properties.
- this.bounds_ = bounds;
- this.image_ = image;
- this.map_ = map;
- this.opaciadade_ = opacidade;
- // We define a property to hold the image's
- // div. We'll actually create this div
- // upon receipt of the add() method so we'll
- // leave it null for now.
- this.div_ = null;
- this.img_ = null;
- // Explicitly call setMap() on this overlay
- this.setMap(map);
- // this.onAdd();
- }
- USGSOverlay.prototype = new google.maps.OverlayView();
- //inicializar uma sobreposição
- £o
- USGSOverlay.prototype.onAdd = function() {
- // Note: an overlay's receipt of onAdd() indicates that
- hat
- // the map's panes are now available for attaching
- ing
- // the overlay to the map via the DOM.
- OM.
- // Create the DIV and set some basic attributes.
- es.
- var div = document.createElement(');
- div.style.border = "none";
- div.style.borderWidth = "0px";
- div.style.position = "absolute";
- div.style.visibility = "hidden";
- div.style.opacity = "1";
- // Create an IMG element and attach it to the DIV.
- var img = document.createElement("img");
- img.src = this.image_;
- img.style.width = "100%";
- img.style.height = "100%";
- if (this.opaciadade_) {
- img.style.opacity = this.opaciadade_ / 100;
- img.style.filter = "alpha(opacity=" + this.opaciadade_ + ")";
- } else {
- img.style.opacity = "0.75";
- img.style.filter = "alpha(opacity=75)";
- }
- div.appendChild(img);
- // Set the overlay'lay's div_ property to this DIV
- this.div_ = div;
- this.img_ = img;
- // We add an overlay to a map via one of the map's panes.
- es.
- // We'll add this overlay to the overlayImage pane.
- ne.
- var panes = this.getPanes();
- panes.overlayLayer.appendChild(div);
- }
- USGSOverlay.prototype.Add = function() {
- // Note: an overlay's receipt of onAdd() indicates that
- hat
- // the map's panes are now available for attaching
- ing
- // the overlay to the map via the DOM.
- OM.
- // Create the DIV and set some basic attributes.
- es.
- var div = document.createElement(');
- div.style.border = "none";
- div.style.borderWidth = "0px";
- div.style.position = "absolute";
- div.style.visibility = "hidden";
- div.style.opacity = "1";
- div.style.width = ' = '253px';
- // Create an IMG element and attach it to the DIV.
- IV.
- var img = document.createElement(");
- img.src = this.image_;
- img.style.width = " = "100%";
- img.style.height = "100%";
- img.style.opacity = "0.75";
- img.style.filter = "alpha(opacity=75)";
- div.appendChild(img);
- // Set the overlay's div_ property to this DIV
- DIV
- this.div_ = div;
- this.img_ = img;
- // We add an overlay to a map via one of the map's panes.
- es.
- // We'll add this overlay to the overlayImage pane.
- ne.
- document.getElementById('map_canvas').appendChild(div);
- //panes.appendChild(div);
- v);
- };
- USGSOverlay.prototype.AddNe = function() {
- // Note: an overlay's receipt of onAdd() indicates that
- hat
- // the map's panes are now available for attaching
- ing
- // the overlay to the map via the DOM.
- OM.
- // Create the DIV and set some basic attributes.
- es.
- var div = document.createElement(');
- div.style.border = "none";
- div.style.borderWidth = "0px";
- div.style.position = "absolute";
- div.style.visibility = "hidden";
- div.style.opacity = "1";
- // Create an IMG element and attach it to the DIV.
- var img = document.createElement("img");
- img.src = this.image_;
- img.style.width = "252px";
- img.style.height = "262px";
- img.style.opacity = "0.75";
- div.appendChild(img);
- // Set the overlay'lay's div_ property to this DIV
- this.div_ = div;
- this.img_ = img;
- // We add an overlay to a map via one of the map's panes.
- es.
- // We'll add this overlay to the overlayImage pane.
- ne.
- document.getElementById('map_canvas').appendChild(di//panes.appendChild(div);
- v);
- }//desenhar uma sobreposição
- §Ã£o
- USGSOverlay.prototype.draw = function()// Size and position the overlay. We use a southwest and northeast
- rthe// position of the overlay to peg it to the correct position and size.
- d si// We need to retrieve the projection from this overlay to do this.
- o this.
- var overlayProjection = this.getProjection()// Retrieve the southwest and northeast coordinates of this overlay
- over// in latlngs and convert them to pixels coordinates.
- inat// We'll use these coordinates to resize the DIV.
- he DIV.
- var sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest());
- var ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast())// Resize the image's DIV to fit the indicated dimensions.
- nsions.
- var div = this.div_;
- div.style.left = sw.x + 'px';
- div.style.top = ne.y + 'px';
- div.style.width = (ne.x - sw.x) + 'px';
- div.style.height = (sw.y - ne.y) + 'px';
- }
- USGSOverlay.prototype.onRemove = function()
- {
- this.div_.parentNode.removeChild(this.div_);
- this.div_ = null;
- }
- USGSOverlay.prototype.setOpacity = function(opacity)
- {
- var img = this.img_;
- img.style.opacity = opacity / 100;
- img.style.filter = "alpha(opacity=" + opacity +