我正在尝试自定义在geojson地图上叠加图像。当我尝试运行ionic时,以下代码遇到错误。该错误表明呼叫目标不包含任何签名。但是当我做离子服务时,有时代码会给我完美的工作应用程序。请帮我。我一直坚持下去。以下是我的代码。我在堆栈上回答说安装@ types / react,但是当我这样做时,我遇到了另一个问题。
constructor() {}
USGSOverlay = class extends google.maps.OverlayView {
bounds_: any;
image_: any;
map_: any;
div_: any;
constructor(bounds, image, private map, opts) {
super(bounds, image,map, opts);
this.bounds_ = bounds;
this.image_ = image;
this.map_ = map;
this.percentOpacity_ = opts.percentOpacity || 60;
this.div_ = null;
this.setMap(map);
this.set
}
onAdd() {
const div = document.createElement('div');
div.style.borderStyle = 'none';
div.style.borderWidth = '0px';
div.style.position = 'absolute';
const img = document.createElement('img');
img.src = this.image_;
img.style.width = '100%';
img.style.height = '100%';
img.style.position = 'absolute';
img.style.opacity = '60%';
div.appendChild(img);
this.div_ = div;
if( this.percentOpacity_ )
{
this.setOpacity(this.percentOpacity_) ;
}
if ( this.rotation_ )
{
this.setRotation(this.rotation_) ;
}
const panes = this.getPanes();
panes.overlayLayer.appendChild(div);
};
draw() {
const overlayProjection = this.getProjection();
const sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest());
const ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast());
const 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';
};
onRemove() {
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
};
setOpacity(opacity){
if (opacity < 0)
{
opacity = 0 ;
}
if(opacity > 100)
{
opacity = 100 ;
}
var c = opacity/100 ;
if (typeof(this.div_.style.filter) =='string')
{
this.div_.style.filter = 'alpha(opacity:' + opacity + ')' ;
}
if (typeof(this.div_.style.KHTMLOpacity) == 'string' )
{
this.div_.style.KHTMLOpacity = c ;
}
if (typeof(this.div_.style.MozOpacity) == 'string')
{
this.div_.style.MozOpacity = c ;
}
if (typeof(this.div_.style.opacity) == 'string')
{
this.div_.style.opacity = c ;
}
};
};