3d window.app-ol3-铯

3d window.app-ol3-铯,3d,openlayers,cesium,3d,Openlayers,Cesium,我有一个关于使用Window.app和ol3ceium的问题。 我的代码如下所示 window.app = {}; var app = window.app; var measuring = false; app.MeasureControl = function(opt_options) { var options = opt_options || {}; var button = document.createElement('button'); button.innerHTM

我有一个关于使用Window.app和ol3ceium的问题。 我的代码如下所示

window.app = {};
var app = window.app;

var measuring = false;
app.MeasureControl = function(opt_options) {
  var options = opt_options || {};
  var button = document.createElement('button');
  button.innerHTML = 'M';
  var this_ = this;
  var handleMeasure = function(e) {
    if (!measuring){
        this_.getMap().addInteraction(draw);
        createHelpTooltip();
        createMeasureTooltip();
        measuring = true;
    } else {
        this_.getMap().removeInteraction(draw);
        measuring = false;
        this_.getMap().removeOverlay(helpTooltip);
        this_.getMap().removeOverlay(measureTooltip);
    }
  }
  button.addEventListener('click', handleMeasure, false);
  button.addEventListener('touchstart', handleMeasure, false);
  var element = document.createElement('div');
  element.className = 'measure ol-unselectable ol-control button';
  element.appendChild(button);
  ol.control.Control.call(this, {
    element: element,
    target: options.target
  });
};
ol.inherits(app.MeasureControl, ol.control.Control);
这个应用程序可以正常工作。而且ol3d不起作用

var ol3d = false;
app.Cesium = function(opt_options) {
  var options = opt_options || {};
  var button = document.createElement('button');
  button.innerHTML = '3D';
  var this_ = this;

  var ol3d = function(e) {
    ol3d.setEnabled(!ol3d.getEnabled(e));
    var ol3d = new olcs.OLCesium({map: ol2d});
    var scene = ol3d.getCesiumScene();
    var terrainProvider = new Cesium.CesiumTerrainProvider({
      url : '//assets.agi.com/stk-terrain/world'
    });
    scene.terrainProvider = terrainProvider;
  };
  button.addEventListener('click', ol3d, false);
  button.addEventListener('touchstart', ol3d, false);
  var element = document.createElement('div');
  element.className = 'cesium ol-unselectable ol-control button';
  element.appendChild(button);
  ol.control.Control.call(this, {
    element: element,
    target: options.target
  });
};
ol.inherits(app.Cesium, ol.control.Control);

var ol2d = new ol.Map({    
    controls: ol.control.defaults({
    attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
      collapsible: false
    })
  }).extend([
        new app.MeasureControl(),
        new app.Cesium(),
        ]),
    target: 'map',
    layers: [],
    view: new ol.View({})
});
}))

测量控制,它起作用,铯不起作用。
臭虫在哪里?所有应用程序的属性都是相同的。

请在问题中添加更多关于您的问题的解释“ol3d.setEnabled(!ol3d.getEnabled(e));“bug是”未捕获类型错误:无法读取HtmlButtoneElement.ol3d未定义的属性“setEnabled”。确定我知道是错误:)谢谢