(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("vue"), require("@kq_npm/client_common_vue/_utils/gis-utils"), require("@kq_npm/client_common_vue/init.js"));
	else if(typeof define === 'function' && define.amd)
		define(["vue", "@kq_npm/client_common_vue/_utils/gis-utils", "@kq_npm/client_common_vue/init.js"], factory);
	else {
		var a = typeof exports === 'object' ? factory(require("vue"), require("@kq_npm/client_common_vue/_utils/gis-utils"), require("@kq_npm/client_common_vue/init.js")) : factory(root["Vue"], root["@kq_npm/client_common_vue/_utils/gis-utils"], root["@kq_npm/client_common_vue/init.js"]);
		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
	}
})(this, function(__WEBPACK_EXTERNAL_MODULE__1895__, __WEBPACK_EXTERNAL_MODULE__7135__, __WEBPACK_EXTERNAL_MODULE__7997__) {
return /******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ 9520:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": function() { return /* binding */ CompassViewModel; }
/* harmony export */ });
/* harmony import */ var _Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8270);

// 重置视图
class CompassViewModel {
  //三维viewer对象
  constructor(viewer) {
    (0,_Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(this, "_viewer", null);

    this._viewer = viewer;
  } //重置方向


  resetOrientation() {
    var camera = this._viewer.camera;
    var scene = this._viewer.scene;
    var depthTestAgainstTerrain = scene.globe.depthTestAgainstTerrain;

    if (!depthTestAgainstTerrain) {
      scene.globe.depthTestAgainstTerrain = true;
    }

    var canvas = scene.canvas;
    var windowCenter = new Cesium.Cartesian2(canvas.clientWidth / 2, canvas.clientHeight / 2);
    setTimeout(() => {
      var center = scene.pickPosition(windowCenter);

      if (!center) {
        center = scene.camera.pickEllipsoid(windowCenter, scene.globe.ellipsoid);
      }

      scene.globe.depthTestAgainstTerrain = depthTestAgainstTerrain;
      var distance = Cesium.Cartesian3.distance(center, camera.positionWC);
      var heading = 6.28319;
      var pitch = camera.pitch;
      var hpr = new Cesium.HeadingPitchRange(heading, pitch, distance);
      camera.lookAt(center, hpr);
      camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
    }, 300);
  } //绑定指南针


  bindCompassEvent(heading) {
    var camera = this._viewer.camera;
    this._removeEventListener = camera.changed.addEventListener(function () {
      heading.value = camera.heading;
    });
  } // 注销事件


  destroy() {
    if (this._removeEventListener) {
      this._removeEventListener();

      this._removeEventListener = null;
    }

    this._viewer = null;
  }

}

/***/ }),

/***/ 348:
/***/ (function(module) {

module.exports = require("@kq_npm/client_icons_vue");

/***/ }),

/***/ 7080:
/***/ (function(module) {

module.exports = require("vue-i18n/dist/vue-i18n.cjs.js");

/***/ }),

/***/ 7135:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__7135__;

/***/ }),

/***/ 7997:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__7997__;

/***/ }),

/***/ 1895:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__1895__;

/***/ }),

/***/ 8270:
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": function() { return /* binding */ _defineProperty; }
/* harmony export */ });
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
}

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "CompassViewModel": function() { return /* reexport */ CompassViewModel/* default */.Z; },
  "default": function() { return /* reexport */ Compass; }
});

// EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(1895);
// EXTERNAL MODULE: external "@kq_npm/client_icons_vue"
var client_icons_vue_ = __webpack_require__(348);
// EXTERNAL MODULE: ./src/webgl/compass/CompassViewModel.js
var CompassViewModel = __webpack_require__(9520);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/_utils/gis-utils"
var gis_utils_ = __webpack_require__(7135);
// EXTERNAL MODULE: external "vue-i18n/dist/vue-i18n.cjs.js"
var vue_i18n_cjs_js_ = __webpack_require__(7080);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[0]!./src/webgl/compass/Compass.vue?vue&type=script&setup=true&lang=js





 // 获取组件传参

const __default__ = {
  name: "Kq3dCompass"
};
/* harmony default export */ var Compassvue_type_script_setup_true_lang_js = (/*#__PURE__*/Object.assign(__default__, {
  props: {
    // 指定组件绑定的scence对象的div的id
    mapTarget: String,
    // 按钮图标大小
    iconSize: {
      type: Number,
      default: 16
    },
    // 组件大小
    size: {
      type: Number,
      default: 32
    },
    showShadow: {
      type: Boolean,
      default: false
    }
  },

  setup(__props) {
    const props = __props;
    let language = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)({});
    let viewModel = null;
    let heading = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(0); // 国际化

    let {
      locale,
      messages
    } = (0,vue_i18n_cjs_js_.useI18n)();
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.watch)(() => locale.value, (newVal, oldVal) => {
      language.value = messages.value[newVal]["webgl"];
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onMounted)(() => {
      gis_utils_.utils.getWebMap(props.mapTarget, scenceView => {
        if (scenceView) {
          viewModel = new CompassViewModel/* default */.Z(scenceView._viewer); //绑定指南针事件

          viewModel.bindCompassEvent(heading);
        }
      });
    }); // 按钮点击事件

    function btnClick(e) {
      viewModel && viewModel.resetOrientation();
    } // 销毁


    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onBeforeUnmount)(() => {
      viewModel && viewModel.destroy();
    });
    return (_ctx, _cache) => {
      const _component_kq_icon = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-icon");

      const _component_kq_button = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-button");

      return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createBlock)(_component_kq_button, {
        onClick: btnClick,
        class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeClass)([{
          'kq-light-shadow': __props.showShadow
        }]),
        title: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).resetOrientation,
        style: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeStyle)('clip-path: circle(50%);width:' + __props.size + 'px;height:' + __props.size + 'px;')
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_icon, {
          size: __props.size / 2,
          style: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeStyle)('transform: rotate(-' + (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(heading) + 'rad);-webkit-transform: rotate(-' + (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(heading) + 'rad)')
        }, {
          default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(client_icons_vue_.IconCompass3D))]),
          _: 1
          /* STABLE */

        }, 8
        /* PROPS */
        , ["size", "style"])]),
        _: 1
        /* STABLE */

      }, 8
      /* PROPS */
      , ["class", "title", "style"]);
    };
  }

}));
;// CONCATENATED MODULE: ./src/webgl/compass/Compass.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/webgl/compass/Compass.vue



const __exports__ = Compassvue_type_script_setup_true_lang_js;

/* harmony default export */ var Compass = (__exports__);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/init.js"
var init_js_ = __webpack_require__(7997);
var init_js_default = /*#__PURE__*/__webpack_require__.n(init_js_);
;// CONCATENATED MODULE: ./src/webgl/compass/index.js




Compass.install = (Vue, opts) => {
  init_js_default()(Vue, opts);
  Vue.component(Compass.name, Compass);
};


}();
/******/ 	return __webpack_exports__;
/******/ })()
;
});