Giter Site home page Giter Site logo

richard1015 / cesium-navigation-es6 Goto Github PK

View Code? Open in Web Editor NEW
130.0 7.0 65.0 374 KB

仓库已迁移https://github.com/cesium-plugin/cesium-navigation-es6

Home Page: https://richard1015.github.io/cesium/

License: MIT License

JavaScript 55.82% CSS 18.29% HTML 2.58% Less 23.31%

cesium-navigation-es6's Introduction

cesium-navigation-es6

This is a Cesium plugin that adds to the Cesium map a user friendly compass, navigator (zoom in/out), and distance scale graphical user interface.

Demo

cesium plugin /demo

Code Demo

https://github.com/richard1015/cesium-vue-example /(cesium-print,cesium-navigation-es6)

预览

Why did you build it?

First of all the Cesiumjs sdk does not includes a compass, navigator (zoom in/out), and distance scale. You can use the mouse to navigate on the map, but this navigation plugin offers more navigation control and capabilities to the user. Some of the capabilities are: reset the compass to point to north, reset the orbit, and reset the view to a default bound.

为什么你建立cesium-navigation插件?

首先,所有的 Cesiumjs sdk 不包括罗盘,导航仪(放大/缩小)和距离刻度。您可以使用鼠标在地图上导航,但这个导航插件可为用户提供更多的导航控制和功能。其中一些功能是:将罗盘重置为指向北部,重置轨道,并将视图重置为默认边界。

How to use it?

QuickStart

$ npm install cesium-navigation-es6 --save

ES modules

<div id="cesiumContainer"></div>
import {  Viewer,Rectangle} from "cesium";
import 'cesium/Build/Cesium/Widgets/widgets.css';
import CesiumNavigation from "cesium-navigation-es6";

const viewer = new Viewer("cesiumContainer",{
    animation:false,
    timeline:false
});

const options = {};
// 用于在使用重置导航重置地图视图时设置默认视图控制。接受的值是Cesium.Cartographic 和 Cesium.Rectangle.
options.defaultResetView = Rectangle.fromDegrees(80, 22, 130, 50);
// 用于启用或禁用罗盘。true是启用罗盘,false是禁用罗盘。默认值为true。如果将选项设置为false,则罗盘将不会添加到地图中。
options.enableCompass= true;
// 用于启用或禁用缩放控件。true是启用,false是禁用。默认值为true。如果将选项设置为false,则缩放控件将不会添加到地图中。
options.enableZoomControls= true;
// 用于启用或禁用距离图例。true是启用,false是禁用。默认值为true。如果将选项设置为false,距离图例将不会添加到地图中。
options.enableDistanceLegend= true;
// 用于启用或禁用指南针外环。true是启用,false是禁用。默认值为true。如果将选项设置为false,则该环将可见但无效。
options.enableCompassOuterRing= true;

//修改重置视图的tooltip
options.resetTooltip = "重置视图";
//修改放大按钮的tooltip
options.zoomInTooltip = "放大";
//修改缩小按钮的tooltip
options.zoomOutTooltip = "缩小";

//如需自定义罗盘控件,请看下面的自定义罗盘控件
new CesiumNavigation(viewer, options);

Browser

<script src="/CesiumNavigation.umd.js"></script>
<div id="cesiumContainer"></div>
import {  Viewer,Rectangle} from "cesium";
import 'cesium/Build/Cesium/Widgets/widgets.css';

const viewer = new Viewer("cesiumContainer",{
    animation:false,
    timeline:false
});

const options = {};
// 用于在使用重置导航重置地图视图时设置默认视图控制。接受的值是Cesium.Cartographic 和 Cesium.Rectangle.
options.defaultResetView = Rectangle.fromDegrees(80, 22, 130, 50);
// 用于启用或禁用罗盘。true是启用罗盘,false是禁用罗盘。默认值为true。如果将选项设置为false,则罗盘将不会添加到地图中。
options.enableCompass= true;
// 用于启用或禁用缩放控件。true是启用,false是禁用。默认值为true。如果将选项设置为false,则缩放控件将不会添加到地图中。
options.enableZoomControls= true;
// 用于启用或禁用距离图例。true是启用,false是禁用。默认值为true。如果将选项设置为false,距离图例将不会添加到地图中。
options.enableDistanceLegend= true;
// 用于启用或禁用指南针外环。true是启用,false是禁用。默认值为true。如果将选项设置为false,则该环将可见但无效。
options.enableCompassOuterRing= true;

//修改重置视图的tooltip
options.resetTooltip = "重置视图";
//修改放大按钮的tooltip
options.zoomInTooltip = "放大";
//修改缩小按钮的tooltip
options.zoomOutTooltip = "缩小";

//如需自定义罗盘控件,请看下面的自定义罗盘控件
new CesiumNavigation(viewer, options);

自定义罗盘控件

1.重写样式

css请参考/github

less请参考/github

js请参考/github

  1. 自定义svg
options.compassOuterRingSvg = '<svg viewBox="0 0 1024 1024" height="125" width="125"><path d="M510.994963 1021.989926C228.781827 1021.989926 0 793.208099 0 511.001284 0 228.775506 228.781827 0 510.994963 0c282.213136 0 510.994963 228.781827 510.994963 510.994963 0 282.213136-228.781827 510.994963-510.988642 510.994963z m2.168099-171.052247c186.544988 0 337.774617-151.22963 337.774617-337.774617 0-186.551309-151.22963-337.780938-337.774617-337.780939-186.551309 0-337.780938 151.22963-337.780939 337.780939 0 186.544988 151.22963 337.774617 337.780939 337.774617z"  ></path><path d="M818.529975 808.783012m-9.746963 0a9.746963 9.746963 0 1 0 19.493926 0 9.746963 9.746963 0 1 0-19.493926 0Z" fill="#FFFFFF" ></path><path d="M818.529975 224.123259m-9.746963 0a9.746963 9.746963 0 1 0 19.493926 0 9.746963 9.746963 0 1 0-19.493926 0Z" fill="#FFFFFF" ></path><path d="M194.888691 808.783012m-9.746963 0a9.746963 9.746963 0 1 0 19.493926 0 9.746963 9.746963 0 1 0-19.493926 0Z" fill="#FFFFFF" ></path><path d="M194.888691 224.123259m-9.746963 0a9.746963 9.746963 0 1 0 19.493926 0 9.746963 9.746963 0 1 0-19.493926 0Z" fill="#FFFFFF" ></path><path d="M536.854123 146.166519v-63.159309h-14.98074v38.97521l-29.139753-38.97521H478.561975v63.159309h15.069235v-38.886717l29.051259 38.886717zM906.227358 519.016296h58.469136v-5.12h-58.469136zM58.469136 519.016296h58.469136v-5.12H58.469136zM513.896296 906.227358v58.469136h5.12v-58.469136z" fill="#FFFFFF" ></path></svg>'
options.compassRotationMarkerSvg = '<svg height="125" width="125" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><g id="#000000fe"><path  opacity="1.00" d=" M 493.42 0.00 L 528.50 0.00 C 529.86 0.78 531.41 1.07 532.98 1.02 C 558.91 1.32 584.63 5.22 610.11 9.75 C 686.00 24.72 758.57 56.91 819.99 104.02 C 838.75 118.42 857.23 133.51 873.12 151.06 C 852.34 172.59 830.81 193.46 809.75 214.75 C 790.09 234.12 770.97 254.08 751.00 273.10 C 711.38 234.16 662.29 204.75 608.90 189.13 C 545.25 170.28 476.14 171.23 412.73 190.59 C 360.53 206.58 313.00 236.14 274.02 274.19 C 251.77 252.75 230.24 230.49 208.25 208.75 C 188.88 189.09 168.91 169.97 149.90 150.00 C 159.46 138.85 171.04 129.70 182.05 120.05 C 263.97 50.32 368.79 8.45 476.01 1.15 C 481.81 0.78 487.70 1.39 493.42 0.00 Z" /></g></svg>'
options.compassGyroSvg = '<svg viewBox="0 0 17 17" height="26" width="26"><g id="compass-inner" fill-rule="nonzero"><path d="M8.5,16.5 C4.081722,16.5 0.5,12.918278 0.5,8.5 C0.5,4.081722 4.081722,0.5 8.5,0.5 C12.918278,0.5 16.5,4.081722 16.5,8.5 C16.5,12.918278 12.918278,16.5 8.5,16.5 Z M8.5,15.5 C12.3659932,15.5 15.5,12.3659932 15.5,8.5 C15.5,4.63400675 12.3659932,1.5 8.5,1.5 C4.63400675,1.5 1.5,4.63400675 1.5,8.5 C1.5,12.3659932 4.63400675,15.5 8.5,15.5 Z" id="Oval-96"></path><path d="M9.92599835,7.09066832 C12.7122872,9.87695712 14.3709388,12.5452228 13.4497471,13.4664145 C12.5285555,14.3876061 9.86028979,12.7289545 7.074001,9.94266568 C4.2877122,7.15637688 2.62906055,4.48811119 3.55025221,3.56691953 C4.47144386,2.64572788 7.13970955,4.30437952 9.92599835,7.09066832 Z M9.21889157,7.7977751 C6.92836458,5.50724811 4.52075769,4.01062761 4.25735899,4.27402631 C3.99396029,4.53742501 5.49058078,6.9450319 7.78110778,9.2355589 C10.0716348,11.5260859 12.4792417,13.0227064 12.7426404,12.7593077 C13.0060391,12.495909 11.5094186,10.0883021 9.21889157,7.7977751 Z" id="Oval-96-Copy-2"></path><path d="M9.92599835,9.94266568 C7.13970955,12.7289545 4.47144386,14.3876061 3.55025221,13.4664145 C2.62906055,12.5452228 4.2877122,9.87695712 7.074001,7.09066832 C9.86028979,4.30437952 12.5285555,2.64572788 13.4497471,3.56691953 C14.3709388,4.48811119 12.7122872,7.15637688 9.92599835,9.94266568 Z M9.21889157,9.2355589 C11.5094186,6.9450319 13.0060391,4.53742501 12.7426404,4.27402631 C12.4792417,4.01062761 10.0716348,5.50724811 7.78110778,7.7977751 C5.49058078,10.0883021 3.99396029,12.495909 4.25735899,12.7593077 C4.52075769,13.0227064 6.92836458,11.5260859 9.21889157,9.2355589 Z" id="Oval-96-Copy-3"></path><path d="M15.1464466,1.1464466 L14.3453364,1.94755684 L13.9608692,2.33202401 L14.667976,3.03913077 L15.0524431,2.65466362 L15.8535534,1.8535534 L15.1464466,1.1464466 Z M2.29760014,13.995293 L1.85311902,14.4397742 L1.004311,15.2885822 L1.71141776,15.995689 L2.56022581,15.146881 L3.00470698,14.7023998 L2.29760014,13.995293 Z" id="Line"></path><circle id="Oval-432" cx="16" cy="1" r="1"></circle><circle id="Oval-432-Copy" cx="1" cy="16" r="1"></circle></g></svg>'

Other Cesium Plugin

cesium-print /github

参考文章

https://www.jianshu.com/p/dd364b59b774

https://www.jianshu.com/p/fb237c7eb48c

https://blog.csdn.net/Prepared/article/details/68940997?locationNum=10&fps=1

cesium-navigation-es6's People

Contributors

richard1015 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cesium-navigation-es6's Issues

style problem

Environment

react、cesium1.60

Situation

After add import CesiumNavigation from "cesium-navigation-es6";
then add

var options = {};
// 用于在使用重置导航重置地图视图时设置默认视图控制。接受的值是Cesium.Cartographic 和 Cesium.Rectangle.
options.defaultResetView = Cesium.Rectangle.fromDegrees(80, 22, 130, 50);
// 用于启用或禁用罗盘。true是启用罗盘,false是禁用罗盘。默认值为true。如果将选项设置为false,则罗盘将不会添加到地图中。
options.enableCompass= true;
// 用于启用或禁用缩放控件。true是启用,false是禁用。默认值为true。如果将选项设置为false,则缩放控件将不会添加到地图中。
options.enableZoomControls= false;
// 用于启用或禁用距离图例。true是启用,false是禁用。默认值为true。如果将选项设置为false,距离图例将不会添加到地图中。
options.enableDistanceLegend= false;
// 用于启用或禁用指南针外环。true是启用,false是禁用。默认值为true。如果将选项设置为false,则该环将可见但无效。
options.enableCompassOuterRing= true;
CesiumNavigation(viewer, options);

Howerver I can't move and zoom .

resultPic
my react can‘t eject so does't support less. Is that the reason?

npm中cesium版本升级

你好,现在cesium版本是1.71.0,npm中cesium-navigation-es6包最新1.1.6,它package中使用的cesium是1.6.4,如果项目使用cesium版本是1.71.0,就无法使用cesium-navigation-es6包(除非手动改这个包的代码),npm中可以更新一下吗?使得cesium版本一致,非常感谢!

升级到最新版本时,运行服务出现找不到对应依赖:cesium/Source/Cesium.js

Cesium版本为:1.50

"cesium": "^1.50.0", "cesium-navigation-es6": "^1.1.6",

ERROR Failed to compile with 11 errors 11:04:53 AM
This dependency was not found:

  • cesium/Source/Cesium.js in ./node_modules/cesium-navigation-es6/viewerCesiumNavigationMixin.js, ./node_modules/cesium-navigation-es6/CesiumNavigation.js and 9 others

To install it, you can run: npm install --save cesium/Source/Cesium.js

ERROR CODE ERR_WEBPACK_MODULE_NOT_FOUND

使用defaultResetView,自定义**范围却显示到0,0坐标

代码两个都是定位到0,0,不能定位到下面坐标点的范围
options.defaultResetView = new Cesium.Cartographic.fromDegrees(117.704, 38.34, 9000)
// options.defaultResetView = Cesium.Rectangle.fromDegrees(80, 22, 130, 50)
但是我直接使用
this.camera.flyTo({
destination: this.scene.globe.ellipsoid.cartographicToCartesian(new Cesium.Cartographic.fromDegrees(117.704, 38.34, 9000)),
})
视图时可以跳到指定位置

Uncaught Error: Cannot find module 'entities/maps/entities.json'

./node_modules/cesium-navigation-es6/node_modules/entities/maps/entities.json
Module parse failed: Unexpected token e in JSON at position 0 while parsing near 'export default "data...'
File was processed with these loaders:

  • ./node_modules/url-loader/dist/cjs.js
    You may need an additional loader to handle the result of these loaders.
    SyntaxError: Unexpected token e in JSON at position 0 while parsing near 'export default "data...'
    at JSON.parse ()
    at parseJson (E:\docker\nginx\html\Ten3D\node_modules\json-parse-better-errors\index.js:7:17)
    at JsonParser.parse (E:\docker\nginx\html\Ten3D\node_modules\webpack\lib\JsonParser.js:16:16)
    at doBuild.err (E:\docker\nginx\html\Ten3D\node_modules\webpack\lib\NormalModule.js:482:32)
    at runLoaders (E:\docker\nginx\html\Ten3D\node_modules\webpack\lib\NormalModule.js:358:12)
    at E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at runSyncOrAsync (E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
    at iterateNormalLoaders (E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
    at Array. (E:\docker\nginx\html\Ten3D\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (E:\docker\nginx\html\Ten3D\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at provider (E:\docker\nginx\html\Ten3D\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9)
    at E:\docker\nginx\html\Ten3D\node_modules\graceful-fs\graceful-fs.js:115:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
    errors @ client:159
    (anonymous) @ socket.js:47
    sock.onmessage @ SockJSClient.js:63
    EventTarget.dispatchEvent @ sockjs.js:170
    (anonymous) @ sockjs.js:888
    SockJS._transportMessage @ sockjs.js:886
    EventEmitter.emit @ sockjs.js:86
    WebSocketTransport.ws.onmessage @ sockjs.js:2962

After the plug-in was introduced--ERROR in ./node_modules/cesium/Source/Core/Resource.js

The error statement:
var http = URL.protocol === "https:" ? require("https") : require("http");
var zlib = require("zlib");

ERROR in ./node_modules/zlib/lib/zlib.js
Module not found: Error: Can't resolve './zlib_bindings' in 'D:\Project\Cesium\scAPPFronted-Navigation\node_modules\zlib\lib'
ERROR in ./node_modules/cesium/Source/Core/Resource.js
Module not found: Error: Can't resolve 'http' in 'D:\Project\Cesium\scAPPFronted-Navigation\node_modules\cesium\Source\Core'
ERROR in ./node_modules/cesium/Source/Core/Resource.js
Module not found: Error: Can't resolve 'https' in 'D:\Project\Cesium\scAPPFronted-Navigation\node_modules\cesium\Source\Core'

Otherwise, my cesium project is build in angular

好像不支持babel7

老大,webpack4+babel7 下打包出错 ,有办法解决么?


 ERROR  Failed to compile with 11 errors                                                                                                                                                              11:04:15

This dependency was not found:

* cesium/Source/Cesium.js in ./node_modules/cesium-navigation-es6/viewerCesiumNavigationMixin.js, ./node_modules/cesium-navigation-es6/CesiumNavigation.js and 9 others

To install it, you can run: npm install --save cesium/Source/Cesium.js

package.json内容如下:

{
  "name": "cesium_vue",
  "version": "1.0.0",
  "description": "A Vue.js project",
  "author": "Dicky",
  "private": true,
  "scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "unit": "jest --config test/unit/jest.conf.js --coverage",
    "e2e": "node test/e2e/runner.js",
    "test": "npm run unit && npm run e2e",
    "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
    "build": "node build/build.js"
  },
  "dependencies": {
    "axios": "^0.19.2",
    "cesium": "^1.69.0",
    "cesium-navigation-es6": "^1.1.5",
    "cesium-print": "^1.0.6",
    "element-ui": "^2.13.1",
    "font-awesome": "^4.7.0",
    "sass-loader": "^8.0.2",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-function-sent": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-numeric-separator": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/plugin-syntax-jsx": "^7.0.0",
    "@babel/plugin-transform-modules-commonjs": "^7.0.0",
    "@babel/plugin-transform-runtime": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/register": "^7.0.0",
    "@babel/runtime-corejs2": "^7.9.6",
    "autoprefixer": "^7.1.2",
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^9.0.0",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-jest": "^23.4.2",
    "babel-loader": "^8.1.0",
    "babel-plugin-dynamic-import-node": "^1.2.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "chalk": "^2.0.1",
    "chromedriver": "^2.27.2",
    "copy-webpack-plugin": "^4.0.1",
    "cross-spawn": "^5.0.1",
    "css-loader": "^3.5.3",
    "eslint": "^4.15.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.2.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^3.0.1",
    "eslint-plugin-vue": "^6.2.2",
    "file-loader": "^6.0.0",
    "friendly-errors-webpack-plugin": "^1.7.0",
    "html-webpack-plugin": "^4.3.0",
    "jest": "^22.0.4",
    "jest-serializer-vue": "^0.3.0",
    "js-cookie": "^2.2.1",
    "mini-css-extract-plugin": "^0.9.0",
    "nightwatch": "^0.9.12",
    "node-notifier": "^5.1.2",
    "optimize-css-assets-webpack-plugin": "^5.0.3",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "rimraf": "^2.6.0",
    "selenium-server": "^3.0.1",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "url-loader": "^4.1.0",
    "vue-jest": "^1.0.2",
    "vue-loader": "^15.9.1",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^4.43.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-cli": "^3.3.11",
    "webpack-dev-server": "^3.10.3",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 6.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

微信反馈群,方便及时响应

微信交流群

由于邮件过多,来不及看,大家可以加群方便及时响应

请添加微信号: zpc1305780485 备注 申请加群 cesium-navigation-es6

🎉🎉欢迎大家使用 cesium-navigation-es6 库~ 🎉🎉

如果您在使用过程中遇到什么问题可通过 Issues 或邮件 [email protected] 联系我们。

您的支持是我开发的动力。

欢迎Star,欢迎PR~

Use with typescript

When I try to use this in my typescript project, I get the error:

Cannot find module 'cesium-navigation-es6' or its corresponding type declarations.
    34 | } from "cesium";
    35 | 
  > 36 | import { CesiumNavigation } from "cesium-navigation-es6"

How can I use this module with typescript?

样式问题

请教一下,指北针的 N的样式,可以修改吗?options没有找到文档

大佬,在cesium1.72中使用这个插件出现问题

我是vue+cesium1.72.0进行开发,当我引入大佬你写的这个插件的时候,出现如下错误:

./node_modules/cesium-navigation-es6/CesiumNavigation.js
Module not found: Error: Can't resolve 'cesium/Source/Cesium.js' in '/Users/adsionli/code/vue-cesium-test/node_modules/cesium-navigation-es6'

在main.js下,我是这样写的

import CesiumNavigation from 'cesium-navigation-es6'
Vue.prototype.CesiumNavigation = CesiumNavigation

cesium-navigation-es6参数控制

一直以来都在使用cesium-navigation-es6,想提一下建议,能否让enableCompass、enableZoomControls、enableDistanceLegend、enableCompassOuterRing这几个控制参数可以在初始化指北针对象之后,能以成员参数的形式进行控制?

依赖包引用问题

  • cesium/Source/Cesium.js in ./node_modules/cesium-navigation-es6/viewerCesiumNavigationMixin.js, ./node_modules/cesium-navigation-es6/core/registerKnockoutBindings.js and 1 other

该段提示即安装依赖后出现的问题,原因是无法在当前依赖包文件中找到对应的文件【cesium/Source/Cesium.js】
按理来说即使无法在本依赖文件中找不到也会往上一级一级的查找,此问题让本人百思不得其解,往看到此问题后能及时回复

Vue项目中无法使用

你好,我在Vue.js项目中安装的cesium 1.69,导航插件使用的最新版,在vue模板中使用时报错:

This dependency was not found:

* cesium in ./node_modules/cesium-navigation-es6/viewerCesiumNavigationMixin.js, ./node_modules/cesium-navigation-es6/CesiumNavigation.js and 9 others

To install it, you can run: npm install --save cesium

CesiumViewer.vue模板内容如下:

<template>
  <el-container style="height: 100%">
    <el-main style="padding: 0px;height:94%;">
      <div id="cesiumContainer"></div>
    </el-main>
  </el-container>
</template>
<script>
import * as Cesium from 'cesium/Cesium'
import CesiumNavigation from 'cesium-navigation-es6'

export default{
  name: 'cesiumContainer',
  data () {
    return {
      dialogVisible: false,
      viewer: null,
      cartesian: null,
    }
  },
  mounted () {
    var me = this
    me.viewer = new Cesium.Viewer('cesiumContainer')
   var options = {}
    options.defaultResetView = Cesium.Rectangle.fromDegrees(80, 22, 130, 50)
    options.enableCompass = true
    options.enableZoomControls = true
    options.enableDistanceLegend = true
    options.enableCompassOuterRing = true

    CesiumNavigation(me.viewer, options)
  }
}
</script>

请问该怎么办呢?

一个错误

你好:
当前在项目中引用cesium-navigation-es6时,发生以下错误:
捕获
我不知道怎么解决,麻烦您,帮忙看下,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.