Javascript 谷歌地图API v3没有';t在Chrome更新38.0.2125.104 m后显示多边形
我在2014年10月17日更新了Chrome浏览器。在此之后,我无法在Chrome中的Google Maps v3 Javascript上看到绘制的多边形。在IE中,它工作得很好,在Chrome最新更新之前,它在Chrome上也工作得很好 请让我知道,如果我需要把任何修复显示在铬 下面的代码用于创建半径环的多边形。Json对象被传递给该方法,并用于在google Map的mapInstance上绘制多边形Javascript 谷歌地图API v3没有';t在Chrome更新38.0.2125.104 m后显示多边形,javascript,google-maps,google-chrome,google-maps-api-3,Javascript,Google Maps,Google Chrome,Google Maps Api 3,我在2014年10月17日更新了Chrome浏览器。在此之后,我无法在Chrome中的Google Maps v3 Javascript上看到绘制的多边形。在IE中,它工作得很好,在Chrome最新更新之前,它在Chrome上也工作得很好 请让我知道,如果我需要把任何修复显示在铬 下面的代码用于创建半径环的多边形。Json对象被传递给该方法,并用于在google Map的mapInstance上绘制多边形 EDRV2.EDRMAPV3GOOGLEV3.Map.prototype.createPo
EDRV2.EDRMAPV3GOOGLEV3.Map.prototype.createPolylines = function(category, subcategory, polylineJSONObjects, showOnMap) {
var polylines = [];
var pts = null;
var rawPairs = null;
var rawLngLat = null;
try {
for (var i = 0; i < polylineJSONObjects.length; i++) {
var polygonType = null;
switch (category) {
case EDRV2.LIGHTBOX.INTERNAL.SiteCategoryTypes.CONTOUR:
polygonType = EDRV2.EDRMAPV3.EnumPolygonTypes.CONTOUR;
break;
case EDRV2.LIGHTBOX.INTERNAL.SiteCategoryTypes.RADIUSRING:
polygonType = EDRV2.EDRMAPV3.EnumPolygonTypes.RADIUSRING;
break;
case EDRV2.LIGHTBOX.INTERNAL.SiteCategoryTypes.QUICKSCREENQUADRANT:
polygonType = EDRV2.EDRMAPV3.EnumPolygonTypes.QUICKSCREENQUADRANT;
break;
}
polylines.push(new EDRV2.EDRMAPV3GOOGLEV3.Polyline(polygonType, this.mapInstance, polylineJSONObjects[i].coordinates, polylineJSONObjects[i].normalPolyAttributes, polylineJSONObjects[i].highlightPolyAttributes, polylineJSONObjects[i].normalPolyAttributes.mapLabelText));
}
var mapObjectCollection = this.mapObjectAddRange(category, subcategory, EDRV2.EDRMAPV3.EnumMapObjectTypes.POLYLINE, polylines);
mapObjectCollection.isActivated = true;
if (showOnMap == true) {
for (var j = 0; j < mapObjectCollection.mapObjects.length; j++) {
mapObjectCollection.mapObjects[j].setMap(this.mapInstance);
}
}
} catch (ex) {
throw new Error("Unable to create Polylines: " + ex.message);
}
};
EDRV2.EDRMAPV3GOOGLEV3.Polyline = function (polyType, googleMap, dvgCoordinatesString, normalPolyAttributes, highlightPolyAttributes, labelText) {
// Constructor
if (this instanceof EDRV2.EDRMAPV3GOOGLEV3.Polyline) {
try {
// inheritance
google.maps.Polyline.apply(this, arguments);
this.base = google.maps.Polyline.prototype;
var pts = null;
var rawPairs = null;
var rawLngLat = null;
// validate map
if ((typeof (googleMap) == 'undefined') || (googleMap == null)) throw new Error('Missing or invalid googleMap.');
if (!(googleMap instanceof google.maps.Map)) throw new Error('googleMap is not of google.maps.Map type.');
// validate coordinates
if ((typeof (dvgCoordinatesString) == 'undefined') || (dvgCoordinatesString == null)) throw new Error('Missing or invalid polyline coordinates.');
dvgCoordinatesString = EDRV2.trim(dvgCoordinatesString);
if (dvgCoordinatesString == '') throw new Error('Missing or invalid polyline coordinates.');
// Code to convert DVG coordinates to Google Map LatLng corodinates.
pts = new Array;
rawPairs = dvgCoordinatesString.split('|');
for (var i = 0; i < rawPairs.length; i++) {
rawLngLat = (rawPairs[i]).split(',');
if ((rawLngLat[0] != '') && (rawLngLat[1] != '')) { pts.push(new google.maps.LatLng(rawLngLat[1], rawLngLat[0])); }
}
// Now initialize all properties.
this.polyType = polyType;
this.googleMap = googleMap;
this.normalPolyOptions = this.convertEdrPolyAttributesToGooglePolylineOptions(normalPolyAttributes);
this.highlightPolyOptions = this.convertEdrPolyAttributesToGooglePolylineOptions(highlightPolyAttributes);
this.labelText = labelText;
// Call setPaths to define the paths of the polyline and then convert normalPolyAttributes to Google Polyline Options.
this.setPath(pts);
if ((typeof (this.normalPolyOptions) != 'undefined') && (this.normalPolyOptions != null)) {
this.setOptions(this.normalPolyOptions);
}
switch (this.polyType) {
case EDRV2.EDRMAPV3.EnumPolygonTypes.CONTOUR:
google.maps.event.addListener(this, 'mouseover', this.onMouseOver);
google.maps.event.addListener(this, 'mouseout', this.onMouseOut);
google.maps.event.addListener(this, 'click', function (e) { EDRV2.EventCollector.fire({ type: EDRV2.EDRMAPV3.EnumEventNames.EDRMAPV3_CONTOUR_POLYLINECLICK, clickLatLng: e.latLng }); });
break;
}
this.createLabels(labelText);
this.isUsable = true;
}
catch (ex) {
this.isUsable = false;
this.errorMessage = 'Unable to create Polyline object: ' + ex.message;
}
}
else { return new EDRV2.EDRMAPV3GOOGLEV3.Polyline(polyType, googleMap, dvgCoordinatesString, normalPolyAttributes, highlightPolyAttributes, labelText); }
EDRV2.EDRMAPV3GOOGLEV3.Map.prototype.createPolylines=函数(类别、子类别、polylineJSONObjects、shownmap){
var多段线=[];
var-pts=null;
var-rawPairs=null;
var rawLngLat=null;
试一试{
对于(var i=0;i
}) 我明白了。谢谢大家。只是想分享一下,因为这是新的Chrome更新后发生的事情
google.maps.Polyline.apply(这个,参数)代码>在Chrome中中断,并给出只读异常。我删除了“apply”并使用了“call”,效果很好。这意味着Chrome正在断开应用于多段线
google.maps.Polyline.call(这个,参数)代码>你的网站上有链接吗?@Sasa:PFB链接。@Sasa:如果你无法访问上面的链接,另一个链接是:@piyus,而不是涉水绘制多边形,你能提供一个演示如何尝试绘制一个不适用于色度的多边形的链接吗?你添加到问题中的代码是