2016-06-14 18 views
0

私はクラスを定義し、それを使ってレイヤーを作成しますが、エラーがあります。しかし、どこが間違っていたのでしょうか?jsaTypeError:GoogleTiledMapはコンストラクタではありません

define(["dojo/_base/declare","esri/SpatialReference","esri/layers/TiledMapServiceLayer","esri/geometry/webMercatorUtils","esri/geometry/Extent", 
"esri/layers/TileInfo"],function(declare,SpatialReference,TiledMapServiceLayer,webMercatorUtils,Extent,TileInfo){ 
declare("extras.layer.GoogleTiledMap", [TiledMapServiceLayer], { 
    online: false, 
    mapStyle: "roadmap", 
    constructor: function(a) { 
     this.spatialReference = new esri.SpatialReference({ 
      wkid: 102113 
     }); 
     this.online = a.online || false; 
     this.mapStyle = a.mapStyle || "roadmap"; 
     this.layerId = a.layerId; 
     this.suffix = a.suffix || ".png"; 
     this.tile_url = a.tile_url; 
     this.fullExtent = new Extent(- 20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference); 
     this.initialExtent = new Extent(12557877.595482401, 2596928.9267310356, 12723134.450635016, 2688653.360673282); 
     this.tileInfo = new TileInfo({ 
      "rows": 256, 
      "cols": 256, 
      "compressionQuality": 0, 
      "origin": { 
       "x": -20037508.342787, 
       "y": 20037508.342787 
      }, 
      "spatialReference": { 
       "wkid": 102113 
      }, 
      "lods": [{ 
       "level": 3, 
       "scale": 73957190.948944, 
       "resolution": 19567.8792409999 
      }, 
      { ... 

私はhtmlファイルで使用します。

require([ 
    "esri/map", 
    "extras/layer/GoogleTiledMap", 
    "dojo/domReady!" 
], function(map,GoogleTiledMap) { 
    var layer=new GoogleTiledMap({ 
      "id": "100", 
      "layerId":"GXX_XXXXX", 
      "online":false, 
      "name": "谷歌电子地图", 
      "suffix": "png", 
      "tileSize": "256", 
      "tileType": "googlemap", 
      "mapStyle":"roadmap", 
      "tile_url": "127.0.0.1:8080" 
    }); 

答えて

0

宣言だけでは十分ではありません。また、それを返す必要があります。以下のように

define(["dojo/_base/declare",...], function(declare,...){ 
    return declare([...], { 
     //you module here 
    }); 
}); 
関連する問題