Commit 50231e08 by wanghao

同步代码 v3.5.10

parent da9dc897
......@@ -63,7 +63,6 @@
"vite": "^4.3.9",
"terser": "^5.16.1",
"vite-plugin-eslint": "^1.3.0",
"vite-plugin-mars3d": "^3.0.0",
"vite-plugin-monaco-editor": "^1.1.0",
"vite-plugin-style-import": "^2.0.0"
},
......
......@@ -19,7 +19,7 @@ window.configLibs = {
"cesium-comp": [
//cesium版本间兼容处理
"mars3d/plugins/compatible/cesium-version.js",
"mars3d/plugins/compatible/cesium-when.js",
"mars3d/plugins/compatible/cesium-when.js"
],
"mars3d-space": [
// 卫星插件
......@@ -63,17 +63,22 @@ window.configLibs = {
"mars3d/thirdParty/pbf-ol/ol.js",
"mars3d/thirdParty/pbf-ol/olms.js",
"mars3d/thirdParty/pbf-ol/style/MapboxStreetsV6.js",
"mars3d/thirdParty/pbf-ol/PbfolLayer.js",
"mars3d/thirdParty/pbf-ol/PbfolLayer.js"
],
"cesium-pbf-mapbox": [
// pbf矢量瓦片支持(基于mapbox渲染)
"mars3d/thirdParty/pbf-mapbox/mapbox-gl.js",
"mars3d/thirdParty/pbf-mapbox/PbfLayer.js",
"mars3d/thirdParty/pbf-mapbox/PbfLayer.js"
],
"cesium-pbf-protomaps": [
// pbf矢量瓦片支持(基于protomaps解析)
"mars3d/thirdParty/pbf-protomaps/protomaps.min.js",
"mars3d/thirdParty/pbf-protomaps/ArcGISPbfLayer.js"
],
"cesium-weiVectorTile": [
// 项目矢量瓦片方式加载GeoJson插件
"mars3d/thirdParty/weiVectorTile/CesiumVectorTile.js",
"mars3d/thirdParty/weiVectorTile/WeiVectorTileLayer.js",
"mars3d/thirdParty/weiVectorTile/WeiVectorTileLayer.js"
],
"cesium-meshVisualizer": [
// ammo物理引擎支持
......@@ -93,6 +98,9 @@ window.configLibs = {
"ol/ol.js",
"ol/ol-cesium/olcesium.js"
],
"cesium-networkPlug": [
"mars3d/thirdParty/networkPlug/CesiumNetworkPlug.js"
],
//////////////////////////mars2d及其插件////////////////////////
'mars2d': [//地图 主库
......@@ -136,6 +144,8 @@ window.configLibs = {
three: ["three/three.js"],
'hls': ["video/hls/hls.js"],
'flv': ["video/flv/flv.min.js"],
tween: ["tween/Tween.js"]
tween: ["tween/Tween.js"],
'localforage': [
"localforage/localforage.min.js"
],
}
源码:https://github.com/localForage/localForage
教程:https://localforage.docschina.org/
# localForage
[![Build Status](https://travis-ci.org/localForage/localForage.svg?branch=master)](http://travis-ci.org/localForage/localForage)
[![NPM version](https://badge.fury.io/js/localforage.svg)](http://badge.fury.io/js/localforage)
[![Dependency Status](https://img.shields.io/david/localForage/localForage.svg)](https://david-dm.org/localForage/localForage)
[![npm](https://img.shields.io/npm/dm/localforage.svg?maxAge=2592000)](https://npmcharts.com/compare/localforage?minimal=true)
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/localforage/badge?style=rounded)](https://www.jsdelivr.com/package/npm/localforage)
[![minzipped size](https://badgen.net/bundlephobia/minzip/localforage)](https://bundlephobia.com/result?p=localforage@1.9.0)
localForage is a fast and simple storage library for JavaScript. localForage
improves the offline experience of your web app by using asynchronous storage
(IndexedDB or WebSQL) with a simple, `localStorage`-like API.
localForage uses localStorage in browsers with no IndexedDB or
WebSQL support. See [the wiki for detailed compatibility info][supported browsers].
To use localForage, just drop a single JavaScript file into your page:
```html
<script src="localforage/dist/localforage.js"></script>
<script>localforage.getItem('something', myCallback);</script>
```
Try the [live example](http://codepen.io/thgreasi/pen/ojYKeE).
Download the [latest localForage from GitHub](https://github.com/localForage/localForage/releases/latest), or install with
[npm](https://www.npmjs.com/):
```bash
npm install localforage
```
[supported browsers]: https://github.com/localForage/localForage/wiki/Supported-Browsers-Platforms
## Support
Lost? Need help? Try the
[localForage API documentation](https://localforage.github.io/localForage). [localForage API文档也有中文版。](https://localforage.docschina.org)
If you're having trouble using the library, running the tests, or want to contribute to localForage, please look through the [existing issues](https://github.com/localForage/localForage/issues) for your problem first before creating a new one. If you still need help, [feel free to file an issue](https://github.com/localForage/localForage/issues/new).
# How to use localForage
## Callbacks vs Promises
Because localForage uses async storage, it has an async API.
It's otherwise exactly the same as the
[localStorage API](https://hacks.mozilla.org/2009/06/localstorage/).
localForage has a dual API that allows you to either use Node-style callbacks
or [Promises](https://www.promisejs.org/). If you are unsure which one is right for you, it's recommended to use Promises.
Here's an example of the Node-style callback form:
```js
localforage.setItem('key', 'value', function (err) {
// if err is non-null, we got an error
localforage.getItem('key', function (err, value) {
// if err is non-null, we got an error. otherwise, value is the value
});
});
```
And the Promise form:
```js
localforage.setItem('key', 'value').then(function () {
return localforage.getItem('key');
}).then(function (value) {
// we got our value
}).catch(function (err) {
// we got an error
});
```
Or, use `async`/`await`:
```js
try {
const value = await localforage.getItem('somekey');
// This code runs once the value has been loaded
// from the offline store.
console.log(value);
} catch (err) {
// This code runs if there were any errors.
console.log(err);
}
```
For more examples, please visit [the API docs](https://localforage.github.io/localForage).
## Storing Blobs, TypedArrays, and other JS objects
You can store any type in localForage; you aren't limited to strings like in
localStorage. Even if localStorage is your storage backend, localForage
automatically does `JSON.parse()` and `JSON.stringify()` when getting/setting
values.
localForage supports storing all native JS objects that can be serialized to
JSON, as well as ArrayBuffers, Blobs, and TypedArrays. Check the
[API docs][api] for a full list of types supported by localForage.
All types are supported in every storage backend, though storage limits in
localStorage make storing many large Blobs impossible.
[api]: https://localforage.github.io/localForage/#data-api-setitem
## Configuration
You can set database information with the `config()` method.
Available options are `driver`, `name`, `storeName`, `version`, `size`, and
`description`.
Example:
```javascript
localforage.config({
driver : localforage.WEBSQL, // Force WebSQL; same as using setDriver()
name : 'myApp',
version : 1.0,
size : 4980736, // Size of database, in bytes. WebSQL-only for now.
storeName : 'keyvaluepairs', // Should be alphanumeric, with underscores.
description : 'some description'
});
```
**Note:** you must call `config()` _before_ you interact with your data. This
means calling `config()` before using `getItem()`, `setItem()`, `removeItem()`,
`clear()`, `key()`, `keys()` or `length()`.
## Multiple instances
You can create multiple instances of localForage that point to different stores
using `createInstance`. All the configuration options used by
[`config`](#configuration) are supported.
``` javascript
var store = localforage.createInstance({
name: "nameHere"
});
var otherStore = localforage.createInstance({
name: "otherName"
});
// Setting the key on one of these doesn't affect the other.
store.setItem("key", "value");
otherStore.setItem("key", "value2");
```
## RequireJS
You can use localForage with [RequireJS](http://requirejs.org/):
```javascript
define(['localforage'], function(localforage) {
// As a callback:
localforage.setItem('mykey', 'myvalue', console.log);
// With a Promise:
localforage.setItem('mykey', 'myvalue').then(console.log);
});
```
## TypeScript
If you have the [`allowSyntheticDefaultImports` compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) set to `true` in your [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (supported in TypeScript v1.8+), you should use:
```javascript
import localForage from "localforage";
```
Otherwise you should use one of the following:
```javascript
import * as localForage from "localforage";
// or, in case that the typescript version that you are using
// doesn't support ES6 style imports for UMD modules like localForage
import localForage = require("localforage");
```
## Framework Support
If you use a framework listed, there's a localForage storage driver for the
models in your framework so you can store data offline with localForage. We
have drivers for the following frameworks:
* [AngularJS](https://github.com/ocombe/angular-localForage)
* [Angular 4 and up](https://github.com/Alorel/ngforage/)
* [Backbone](https://github.com/localForage/localForage-backbone)
* [Ember](https://github.com/genkgo/ember-localforage-adapter)
* [Vue](https://github.com/dmlzj/vlf)
* [NuxtJS](https://github.com/nuxt-community/localforage-module)
If you have a driver you'd like listed, please
[open an issue](https://github.com/localForage/localForage/issues/new) to have it
added to this list.
## Custom Drivers
You can create your own driver if you want; see the
[`defineDriver`](https://localforage.github.io/localForage/#driver-api-definedriver) API docs.
There is a [list of custom drivers on the wiki][custom drivers].
[custom drivers]: https://github.com/localForage/localForage/wiki/Custom-Drivers
# Working on localForage
You'll need [node/npm](http://nodejs.org/) and
[bower](http://bower.io/#installing-bower).
To work on localForage, you should start by
[forking it](https://github.com/localForage/localForage/fork) and installing its
dependencies. Replace `USERNAME` with your GitHub username and run the
following:
```bash
# Install bower globally if you don't have it:
npm install -g bower
# Replace USERNAME with your GitHub username:
git clone git@github.com:USERNAME/localForage.git
cd localForage
npm install
bower install
```
Omitting the bower dependencies will cause the tests to fail!
## Running Tests
You need PhantomJS installed to run local tests. Run `npm test` (or,
directly: `grunt test`). Your code must also pass the
[linter](http://jshint.com/).
localForage is designed to run in the browser, so the tests explicitly require
a browser environment. Local tests are run on a headless WebKit (using
[PhantomJS](http://phantomjs.org)).
When you submit a pull request, tests will be run against all browsers that
localForage supports on Travis CI using [Sauce Labs](https://saucelabs.com/).
## Library Size
As of version 1.7.3 the payload added to your app is rather small. Served using gzip compression, localForage will add less than 10k to your total bundle size:
<dl>
<dt>minified</dt><dd>`~29kB`</dd>
<dt>gzipped</dt><dd>`~8.8kB`</dd>
<dt>brotli'd</dt><dd>`~7.8kB`</dd>
</dl>
# License
This program is free software; it is distributed under an
[Apache License](https://github.com/localForage/localForage/blob/master/LICENSE).
---
Copyright (c) 2013-2016 [Mozilla](https://mozilla.org)
([Contributors](https://github.com/localForage/localForage/graphs/contributors)).
/**
* Mars3D三维可视化平台 mars3d
*
* 版本信息:v3.5.9
* 编译日期:2023-05-29 18:07:23
* 版本信息:v3.5.10
* 编译日期:2023-06-05 18:30:23
* 版权所有:Copyright by 火星科技 http://mars3d.cn
* 使用单位:免费公开版 ,2023-03-17
*/
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -54,8 +54,8 @@ export function onMounted(mapInstance) {
// 相机原地左一直旋转
// setInterval(function () {
// map.keyboardRoam.rotateCamera(mars3d.KeyboardType.LEFT_ROTATE);
// }, 100);
// map.keyboardRoam.rotateCamera(mars3d.MoveType.LEFT_ROTATE)
// }, 100)
}
/**
......
......@@ -110,6 +110,7 @@ function addDemoGraphic1(graphicLayer) {
function addDemoGraphic2(graphicLayer) {
const graphic = new mars3d.graphic.PathEntity({
// maxCacheCount: -1,
style: {
width: 2,
color: "#00ffff",
......
......@@ -21,6 +21,17 @@ export function onMounted(mapInstance) {
map = mapInstance // 记录map
map.basemap = 2017 // 切换至蓝色底图
globalNotify("已知问题提示", `(1)Tetrahedron与OutlineEffect特效shader冲突,暂时无法共用`)
// 添加特效 【已知冲突问题】
// const outlineEffect = new mars3d.effect.OutlineEffect({
// color: "#FFFF00",
// width: 4,
// eventType: mars3d.EventType.click,
// showPlane: true
// })
// map.addEffect(outlineEffect)
// 添加参考三维模型;
const tiles3dLayer = new mars3d.layer.TilesetLayer({
name: "合肥市建筑物",
......
......@@ -63,6 +63,13 @@ export function onMounted(mapInstance) {
// mars3d.Lang["_右击删除点"][0] = "中键单击完成绘制"
// map.on(mars3d.EventType.mouseOver, function (event) {
// console.log("mouseover")
// })
map.on(mars3d.EventType.mouseOut, function (event) {
map.closeSmallTooltip()
})
// 在layer上绑定监听事件
graphicLayer.on(mars3d.EventType.click, function (event) {
console.log("监听layer,单击了矢量对象", event)
......
......@@ -29,9 +29,71 @@ export function onUnmounted() {
map = null
}
// ImageLayer的方式
// ImageLayer的方式,直接替换
function showImages() {
const urlArr = [
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522145400_0c972b7abe4f4b4fbdbe909f5c1ca17a.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522150000_55c4adac7ac8460db3d893866897bd6d.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522150600_ca075253d90e40049f069d22a1a3ce3d.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522151200_afe188f5892d4dd8a4d09d94c746ce1f.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522151800_b10b132f2d52424e9ab55a61896e86b0.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522152400_4ad54289d6f64f5aaa160f453a99b14a.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522153000_cf72453eba0b4b33966f69899771ba16.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522153600_c3aac59805ec433bae08bc8d77d25d20.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522154200_42a885bb66144e698190c38d02b3be96.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522154800_4564689c557e43ff993ad0113363bd6d.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522155400_4742e31563464542a533a43d5414a7ae.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522160000_487da64a0f384795848e60f2ed343500.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522160600_9a1cf5da2f2c46158f113c057b9bb079.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522161200_76861453df20413fa1eff57c8c938758.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522161800_767d25a128e94d968522badfaf071a66.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522162400_8b949a9d47fd4f289bd51afe9e009ab9.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522163000_9f234335ae2c42ac91d5dfc62b72f3db.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522163600_a808919c4a5a4142b188520a74dacf75.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522164200_248688f96cfd438eb5229812dfb748c3.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522164800_797dd13e0a304fbe934fee1902b7fc21.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522165400_0be5ef511d6c467288ec9f7b961821bd.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522170000_a1820b8d4527467a85db7fee3b352bbb.png",
"//data.mars3d.cn/file/img/radar_water/20200522145400_20200522170600_964ada943fcf4a13aa59364b1efd0b1b.png"
]
const arrTileLayer = []
for (let i = 0, len = urlArr.length; i < len; i++) {
const tileLayer = new mars3d.layer.ImageLayer({
url: urlArr[i],
rectangle: { xmin: 63.8148899733, xmax: 143.536486117, ymin: 12.7700338517, ymax: 56.3833398551 },
crs: mars3d.CRS.EPSG3857,
alpha: 0
})
map.addLayer(tileLayer)
arrTileLayer.push(tileLayer)
}
let current = 0
function play() {
if (current > arrTileLayer.length) {
current = 0
}
current++
const layer1 = arrTileLayer[current - 1]
if (layer1) {
layer1.alpha = 0
}
const layer2 = arrTileLayer[current]
if (layer2) {
layer2.alpha = 1
}
setTimeout(play, 500)
}
play()
}
// ImageLayer的方式,渐变方式
function showImagesByAlpha() {
const urlArr = [
"//data.mars3d.cn/file/img/radar/201906211112.PNG",
"//data.mars3d.cn/file/img/radar/201906211124.PNG",
"//data.mars3d.cn/file/img/radar/201906211130.PNG",
......@@ -44,6 +106,7 @@ function showImages() {
const tileLayer = new mars3d.layer.ImageLayer({
url: urlArr[i],
rectangle: { xmin: 73.16895, xmax: 134.86816, ymin: 12.2023, ymax: 54.11485 },
crs: mars3d.CRS.EPSG3857,
alpha: 0
})
map.addLayer(tileLayer)
......
import { useEffect, useRef, useState } from "react"
import * as mapWork from "./map.js"
import { MarsButton, MarsPannel } from "@mars/components/MarsUI"
import { Space } from "antd"
function UIComponent(props) {
return (
<MarsPannel visible={true} right="10" top="10">
<Space>
<MarsButton
onClick={() => {
mapWork.pauseCameraViewList()
}}
>
暂停
</MarsButton>
<MarsButton
onClick={() => {
mapWork.proceedCameraViewList()
}}
>
继续
</MarsButton>
</Space>
</MarsPannel>
)
}
export default UIComponent
......@@ -41,6 +41,16 @@ export function onMounted(mapInstance) {
// showCameraRoute(viewPoints) // 显示相机点的位置方向和路线,便于对比查看
}
export function pauseCameraViewList() {
map.pauseCameraViewList()
}
export function proceedCameraViewList() {
map.proceedCameraViewList()
}
/**
* 释放当前地图业务的生命周期函数
* @returns {void} 无
......
......@@ -22,15 +22,14 @@ let roaming
export function onMounted(mapInstance) {
map = mapInstance // 记录map
const tiles3dLayer = new mars3d.layer.TilesetLayer({
url: "//data.mars3d.cn/3dtiles/max-ditiezhan/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
popup: "all"
})
map.addLayer(tiles3dLayer)
// const tiles3dLayer = new mars3d.layer.TilesetLayer({
// url: "//data.mars3d.cn/3dtiles/max-ditiezhan/tileset.json",
// maximumScreenSpaceError: 1,
// maximumMemoryUsage: 1024,
// popup: "all"
// })
// map.addLayer(tiles3dLayer)
// 108.380053,22.736443,-1
const viewPoints = [
{ id: 0, name: "地铁口", lat: 22.7407925, lng: 108.3793365, alt: 89.7, heading: 37.4, pitch: -7.1, duration: 2 },
......
......@@ -29,7 +29,7 @@ export function onUnmounted() {
}
function addSlope() {
// 度坡向
// 度坡向
slope = new mars3d.thing.Slope({
arrow: {
scale: 0.3, // 箭头长度的比例(范围0.1-0.9)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论