shuishen
2021-06-08 599f0458111446d39b250e8abc2e71b3f7fc213b
widgets/SceneMode/Widget.js
@@ -1,42 +1,80 @@
///////////////////////////////////////////////////////////////////////////
// Copyright © 2018 NarutoGIS. All Rights Reserved.
// 模块描述:控制地图二三维模式切换
// Copyright © 2019 zhongsong. All Rights Reserved.
// 模块描述:显示坐标
///////////////////////////////////////////////////////////////////////////
define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'jimu/BaseWidget',
    'dojo/_base/html',
    'dojo/dom-construct',
    'dojo/topic',
    'dojo/on'
  ],
  function(
    declare,
    lang,
    BaseWidget,
    html,
    domConstruct,
    topic,
    on) {
    var clazz = declare([BaseWidget], {
      'dojo/_base/declare',
      'dojo/_base/lang',
      'dojo/_base/array',
      'dojo/_base/html',
      'dojo/topic',
      'jimu/BaseWidget',
      'jimu/utils',
      'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
      'libs/zTree_v3/js/jquery.ztree.all'
   ],
   function (declare,
      lang,
      array,
      html,
      topic,
      BaseWidget,
      aspect,
      string,
      utils
   ) {
      return declare([BaseWidget], {
         baseClass: 'jimu-widget-SceneMode',
         name: 'SceneMode',
         layers: {},
         startup: function () {
            var that = this;
            console.log(that.map, 213)
            $(".jimu-widget-SceneMode button").html("<img src='../../../images/2D.png' alt='' title='2D'>");
      name: 'SceneMode',
      baseClass: 'jimu-widget-SceneMode',
            $(".jimu-widget-SceneMode button").click(function () {
               if ($(".jimu-widget-SceneMode button img").attr('title') == "2D") {
                  $(".jimu-widget-SceneMode button").html("<img src='../../../images/3D.png' alt='' title='3D'>");
                  that.map.scene.morphTo2D(0);
               } else {
                  $(".jimu-widget-SceneMode button").html("<img src='../../../images/2D.png' alt='' title='2D'>");
                  that.map.scene.morphTo3D(0);
      postCreate: function() {
          this.inherited(arguments);
      },
               }
            })
         },
      startup: function() {
        this.inherited(arguments);
        new Cesium.SceneModePicker(this.domNode, this.map.scene);
         closeToolBox: function (item) {
         },
        $('.cesium-sceneModePicker-button3D').next().next().next().css({'right': 95, 'bottom': 75})
         onOpen: function () {
            //面板打开的时候触发 (when open this panel trigger)
         },
        $('.cesium-sceneModePicker-button3D').attr('title','三维视图');
      }
         onClose: function () {
            //面板关闭的时候触发 (when this panel is closed trigger)
         },
    });
    return clazz;
  });
         onMinimize: function () {
            this.resize();
         },
         onMaximize: function () {
            this.resize();
         },
         resize: function () {
         },
         destroy: function () {
            //销毁的时候触发
            //todo
            //do something before this func
            this.inherited(arguments);
         }
      });
   });