2014-10-20 55 views
0

我在10/17/2014更新了Chrome瀏覽器。之後,我無法在Chrome中的Google Maps v3 Javascript上看到多邊形。在IE瀏覽器中它運行良好,在Chrome最新更新之前,Chrome瀏覽器也能正常工作。谷歌地圖API v3在Chrome更新38.0.2125.104後未顯示多邊形m

請讓我知道,如果我需要把任何修復程序顯示在Chrome中。

以下代碼正在用於創建半徑環的多邊形。 Json對象被傳遞給該方法,它正被用於在Google Map的mapInstance上繪製多邊形。

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); } 

};

+0

您的網站上的任何鏈接? – Sasa 2014-10-20 14:41:12

+0

@Sasa:PFB the link.http://webqa.edrnet.com/ordering/lightbox/lightbox.aspx?pguid = 3b4c8e1b-43a5-4658-a26d-38a771f00ba4&lsessguid = 400489a7-777f-4148-9d03-5baa350d9b3b – Piyush 2014-10-20 14:42:01

+0

@Sasa :另一個鏈接,如果您無法訪問上述內容:http://www.web.edrnet.com/ordering/lightbox/lightbox.aspx?pguid=8a33e0d2-d7a9-4f0a-8418-e82c0e8bade7&lsessguid=2eb16165-c554- 46d7-a7bd-ee94cb2da2c7 – Piyush 2014-10-20 14:53:12

回答

1

我得到了問題。謝謝大家。只是想分享它,因爲這是新的Chrome更新後發生的事情。

google.maps.Polyline.apply(this, arguments);正在Chrome中打破並給出只讀的例外。我刪除了'申請'並使用'通話',它的工作。這意味着Chrome瀏覽器正在申請Polyline。

google.maps.Polyline.call(this, arguments);