瀏覽代碼

init

tags/3.0.0
Caven Chen 2 年之前
父節點
當前提交
d236e97aca
共有 61 個文件被更改,包括 839 次插入464 次删除
  1. 7
    41
      README.md
  2. 134
    0
      examples/index.html
  3. 328
    0
      examples/jquery.accordion.js
  4. 34
    0
      examples/list.js
  5. 0
    30
      examples/test.html
  6. 1
    2
      package.json
  7. 1
    3
      server.js
  8. 12
    5
      src/modules/exts/BaseLayerPicker.js
  9. 3
    3
      src/modules/exts/Viewer.js
  10. 39
    26
      src/modules/imagery/ImageryLayerFactory.js
  11. 1
    1
      src/modules/imagery/provider/AmapImageryProvider.js
  12. 9
    102
      src/modules/imagery/provider/BaiduImageryProvider.js
  13. 29
    0
      src/modules/imagery/provider/GeoVisImageryProvider.js
  14. 5
    1
      src/modules/index.js
  15. 1
    1
      src/modules/material/property/polyline/PolylineLightingMaterialProperty.js
  16. 1
    1
      src/modules/material/property/polyline/PolylineLightingTrailMaterialProperty.js
  17. 1
    1
      src/modules/material/property/polyline/PolylineTrailMaterialProperty.js
  18. 1
    1
      src/modules/material/property/radar/RadarLineMaterialProperty.js
  19. 1
    1
      src/modules/material/property/radar/RadarSweepMaterialProperty.js
  20. 1
    1
      src/modules/material/property/radar/RadarWaveMaterialProperty.js
  21. 1
    1
      src/modules/material/property/wall/WallImageTrailMaterialProperty.js
  22. 1
    1
      src/modules/material/property/wall/WallLineTrailMaterialProperty.js
  23. 1
    1
      src/modules/material/property/wall/WallTrailMaterialProperty.js
  24. 1
    1
      src/modules/material/property/water/WaterMaterialProperty.js
  25. 24
    24
      src/modules/material/type/polyline.js
  26. 12
    12
      src/modules/material/type/radar.js
  27. 47
    47
      src/modules/material/type/thirdpart.js
  28. 16
    16
      src/modules/material/type/wall.js
  29. 3
    3
      src/modules/math/curve.js
  30. 1
    1
      src/modules/measure/Measure.js
  31. 6
    6
      src/modules/measure/MeasureBase.js
  32. 1
    1
      src/modules/measure/MeasureType.js
  33. 5
    5
      src/modules/measure/edit/EditPolygon.js
  34. 5
    5
      src/modules/measure/edit/EditPolyline.js
  35. 4
    5
      src/modules/measure/type/Area.js
  36. 5
    5
      src/modules/measure/type/AreaHeight.js
  37. 6
    7
      src/modules/measure/type/AreaSurface.js
  38. 5
    5
      src/modules/measure/type/Distance.js
  39. 6
    6
      src/modules/measure/type/DistanceSurface.js
  40. 5
    5
      src/modules/measure/type/Heading.js
  41. 9
    9
      src/modules/measure/type/Height.js
  42. 14
    14
      src/modules/measure/type/TriangleHeight.js
  43. 27
    13
      src/modules/viewer/Viewer.js
  44. 2
    2
      src/modules/widget/Widget.js
  45. 1
    1
      src/modules/widget/index.js
  46. 1
    1
      src/modules/widget/type/Compass.js
  47. 1
    1
      src/modules/widget/type/ContextMenu.js
  48. 1
    1
      src/modules/widget/type/DistanceLegend.js
  49. 1
    1
      src/modules/widget/type/HawkeyeMap.js
  50. 1
    1
      src/modules/widget/type/LoadingMask.js
  51. 1
    1
      src/modules/widget/type/LocationBar.js
  52. 1
    1
      src/modules/widget/type/MapSplit.js
  53. 2
    2
      src/modules/widget/type/MapSwitch.js
  54. 1
    1
      src/modules/widget/type/Popup.js
  55. 1
    1
      src/modules/widget/type/SceneSplit.js
  56. 1
    1
      src/modules/widget/type/TilesetSplit.js
  57. 1
    1
      src/modules/widget/type/Tooltip.js
  58. 1
    1
      src/modules/widget/type/ZoomController.js
  59. 1
    1
      src/modules/wind/WindCanvas.js
  60. 1
    0
      src/themes/index.js
  61. 6
    33
      src/themes/index.scss

+ 7
- 41
README.md 查看文件

@@ -47,37 +47,8 @@ npm install @dvgis/dc-sdk
```

```js
import DC from '@dvgis/dc-sdk/dist/dc.base.min'
import DcCore from '@dvgis/dc-sdk/dist/dc.core.min'
import DcChart from '@dvgis/dc-sdk/dist/dc.chart.min'
import DcMapv from '@dvgis/dc-sdk/dist/dc.mapv.min'
import DcS3M from '@dvgis/dc-sdk/dist/dc.s3m.min'
import '@dvgis/dc-sdk/dist/dc.core.min.css'
```

`NPM / YARN` **_`(On-demand)`_**

```shell
yarn add @dvgis/dc-base
yarn add @dvgis/dc-core
yarn add @dvgis/dc-chart
yarn add @dvgis/dc-mapv
yarn add @dvgis/dc-s3m
-------------------------
npm install @dvgis/dc-base
npm install @dvgis/dc-core
npm install @dvgis/dc-chart
npm install @dvgis/dc-mapv
npm install @dvgis/dc-s3m
```

```js
import DC from '@dvgis/dc-base'
import DcCore from '@dvgis/dc-core'
import DcChart from '@dvgis/dc-chart'
import DcMapv from '@dvgis/dc-mapv'
import DcS3M from '@dvgis/dc-s3m'
import '@dvgis/dc-core/dist/dc.core.min.css'
import * as DC from '@dvgis/dc-sdk'
import '@dvgis/dc-sdk/dist/dc.min.css'
```

`CDN`
@@ -85,13 +56,9 @@ import '@dvgis/dc-core/dist/dc.core.min.css'
[Resources](https://github.com/dvgis/dc-sdk/releases)

```html
<script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.base.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.mapv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.s3m.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.min.js"></script>
<link
href="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.core.min.css"
href="https://cdn.jsdelivr.net/npm/@dvgis/dc-sdk/dist/dc.min.css"
rel="stylesheet"
type="text/css"
/>
@@ -105,7 +72,7 @@ Please put the resources in the project root directory libs/dc-sdk, if you put i

> The configuration is mainly used in the `NPM / YARN` way

Since the `DC` framework sets `CESIUM_BASE_URL` to `./libs/dc-sdk/resources/` , you need to copy `Cesium` related static resources files: `Assets` , `Workers` , `ThirdParty `to `libs/dc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly. You can also use `DC.baseUrl` to set the static resource base related to `Cesium` .
Since the `DC` framework sets `CESIUM_BASE_URL` to `./libs/dc-sdk/resources/` , you need to copy `Cesium` related static resources files: `Assets` , `Workers` , `ThirdParty `to `libs/dc-sdk/resources` directory of the project to ensure that the 3D scene can be rendered properly. You can also use `DC.config.baseUrl` to set the static resource base related to `Cesium` .

`Webpack`

@@ -182,9 +149,8 @@ module.exports = {

```js
global.DC = DC
DC.use(DcCore) // node
DC.ready(() => {
let viewer = new DC.Viewer(divId) // divId is the Id attribute value of a div node. If it is not passed in, the 3D scene cannot be initialized
DC.ready({}).then(()=>{
let viewer = new DC.Viewer()
})
```


+ 134
- 0
examples/index.html 查看文件

@@ -0,0 +1,134 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="./jquery.min.js"></script>
<script src="./jquery.accordion.js"></script>
<style>

* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}
.container{
display: flex;
height: 100%;
}
.nav{
width: 300px;
height: 100%;
overflow: hidden;
background: #222;
color: #fff;
}
.example{
flex: 1;
height: 100%;
overflow: hidden;
}

iframe{
width: 100%;
height: 100%;
overflow: hidden;
}

.nav .banner{
padding: 20px 20px 0 20px;
color:#1e80ff;
font-weight: bold;
font-style: italic;
}
.example-list-wrapper{
overflow: hidden;
overflow-y: auto;
user-select: none;
margin-top: 15px;
}

.example-list h4{
padding-left: 20px;
padding-top: 20px;
margin: 10px 0;
border-top: 1px solid #444 ;
}

.example-list h4:hover,.example-list ul li:hover{
cursor: pointer;
}

.example-list ul{
padding-left: 33px;
list-style: none;
}

.example-list ul li{
margin: 10px 0;
font-size: 15px;
}

.example-list ul li:hover,.example-list ul li.active{
color: #1e80ff;
}




</style>
</head>
<body>

<div class="container">
<div class="nav">
<div class="banner"> DC-SDK v3.0.0 </div>
<div class="example-list-wrapper">
<div id="example-list" class="example-list" data-accordion-group> </div>
</div>
</div>
<div class="example">
<iframe id="inner-page" src="info/start.html" style="border: 0"></iframe>
</div>

<script src="./list.js"></script>
<script type="text/javascript">
$(document).ready(function() {
let $currentPage = undefined
EXAMPLE_LIST.forEach(item => {
let $section = $('<div data-accordion ></div>')
let $title = $('<h4 data-control ></h4>').text(item.name)
$title.appendTo($section)
let $pageWrapper= $('<ul data-content></ul>')
$pageWrapper.appendTo($section)
if(item.children){
item.children.forEach(child => {
let $page = $('<li>'+ child.name +'</li>')
$page.bind('click',e=>{
if($currentPage){
$currentPage.removeClass('active')
}
$('#inner-page').attr('src',item.folder+'/'+child.page)
$page.addClass('active')
$currentPage =$page
})
$pageWrapper.append($page)
})
}
$section.appendTo($('#example-list'))

})
$('#example-list [data-accordion]').accordion();
});
</script>
</div>
</body>
</html>

+ 328
- 0
examples/jquery.accordion.js 查看文件

@@ -0,0 +1,328 @@
;(function ($, window, document, undefined) {
var pluginName = 'accordion',
defaults = {
transitionSpeed: 300,
transitionEasing: 'ease',
controlElement: '[data-control]',
contentElement: '[data-content]',
groupElement: '[data-accordion-group]',
singleOpen: true,
}

function Accordion(element, options) {
this.element = element
this.options = $.extend({}, defaults, options)
this._defaults = defaults
this._name = pluginName
this.init()
}

Accordion.prototype.init = function () {
var self = this,
opts = self.options

var $accordion = $(self.element),
$controls = $accordion.find('> ' + opts.controlElement),
$content = $accordion.find('> ' + opts.contentElement)

var accordionParentsQty = $accordion.parents('[data-accordion]').length,
accordionHasParent = accordionParentsQty > 0

var closedCSS = { 'max-height': 0, overflow: 'hidden' }

var CSStransitions = supportsTransitions()

function debounce(func, threshold, execAsap) {
var timeout

return function debounced() {
var obj = this,
args = arguments

function delayed() {
if (!execAsap) func.apply(obj, args)
timeout = null
}

if (timeout) clearTimeout(timeout)
else if (execAsap) func.apply(obj, args)

timeout = setTimeout(delayed, threshold || 100)
}
}

function supportsTransitions() {
var b = document.body || document.documentElement,
s = b.style,
p = 'transition'

if (typeof s[p] == 'string') {
return true
}

var v = ['Moz', 'webkit', 'Webkit', 'Khtml', 'O', 'ms']

p = 'Transition'

for (var i = 0; i < v.length; i++) {
if (typeof s[v[i] + p] == 'string') {
return true
}
}

return false
}

function requestAnimFrame(cb) {
if (window.requestAnimationFrame) {
requestAnimationFrame(cb)
} else if (window.webkitRequestAnimationFrame) {
webkitRequestAnimationFrame(cb)
} else if (window.mozRequestAnimationFrame) {
mozRequestAnimationFrame(cb)
} else {
setTimeout(cb, 1000 / 60)
}
}

function toggleTransition($el, remove) {
if (!remove) {
$content.css({
'-webkit-transition':
'max-height ' +
opts.transitionSpeed +
'ms ' +
opts.transitionEasing,
transition:
'max-height ' +
opts.transitionSpeed +
'ms ' +
opts.transitionEasing,
})
} else {
$content.css({
'-webkit-transition': '',
transition: '',
})
}
}

function calculateHeight($el) {
var height = 0

$el.children().each(function () {
height = height + $(this).outerHeight(true)
})

$el.data('oHeight', height)
}

function updateParentHeight(
$parentAccordion,
$currentAccordion,
qty,
operation
) {
var $content = $parentAccordion.filter('.open').find('> [data-content]'),
$childs = $content.find('[data-accordion].open > [data-content]'),
$matched

if (!opts.singleOpen) {
$childs = $childs.not(
$currentAccordion
.siblings('[data-accordion].open')
.find('> [data-content]')
)
}

$matched = $content.add($childs)

if ($parentAccordion.hasClass('open')) {
$matched.each(function () {
var currentHeight = $(this).data('oHeight')

switch (operation) {
case '+':
$(this).data('oHeight', currentHeight + qty)
break
case '-':
$(this).data('oHeight', currentHeight - qty)
break
default:
throw 'updateParentHeight method needs an operation'
}

$(this).css('max-height', $(this).data('oHeight'))
})
}
}

function refreshHeight($accordion) {
if ($accordion.hasClass('open')) {
var $content = $accordion.find('> [data-content]'),
$childs = $content.find('[data-accordion].open > [data-content]'),
$matched = $content.add($childs)

calculateHeight($matched)

$matched.css('max-height', $matched.data('oHeight'))
}
}

function closeAccordion($accordion, $content) {
$accordion.trigger('accordion.close')

if (CSStransitions) {
if (accordionHasParent) {
var $parentAccordions = $accordion.parents('[data-accordion]')

updateParentHeight(
$parentAccordions,
$accordion,
$content.data('oHeight'),
'-'
)
}

$content.css(closedCSS)

$accordion.removeClass('open')
} else {
$content.css('max-height', $content.data('oHeight'))

$content.animate(closedCSS, opts.transitionSpeed)

$accordion.removeClass('open')
}
}

function openAccordion($accordion, $content) {
$accordion.trigger('accordion.open')
if (CSStransitions) {
toggleTransition($content)

if (accordionHasParent) {
var $parentAccordions = $accordion.parents('[data-accordion]')

updateParentHeight(
$parentAccordions,
$accordion,
$content.data('oHeight'),
'+'
)
}

requestAnimFrame(function () {
$content.css('max-height', $content.data('oHeight'))
})

$accordion.addClass('open')
} else {
$content.animate(
{
'max-height': $content.data('oHeight'),
},
opts.transitionSpeed,
function () {
$content.css({ 'max-height': 'none' })
}
)

$accordion.addClass('open')
}
}

function closeSiblingAccordions($accordion) {
var $accordionGroup = $accordion.closest(opts.groupElement)

var $siblings = $accordion.siblings('[data-accordion]').filter('.open'),
$siblingsChildren = $siblings.find('[data-accordion]').filter('.open')

var $otherAccordions = $siblings.add($siblingsChildren)

$otherAccordions.each(function () {
var $accordion = $(this),
$content = $accordion.find(opts.contentElement)

closeAccordion($accordion, $content)
})

$otherAccordions.removeClass('open')
}

function toggleAccordion() {
var isAccordionGroup = opts.singleOpen
? $accordion.parents(opts.groupElement).length > 0
: false

calculateHeight($content)

if (isAccordionGroup) {
closeSiblingAccordions($accordion)
}

if ($accordion.hasClass('open')) {
closeAccordion($accordion, $content)
} else {
openAccordion($accordion, $content)
}
}

function addEventListeners() {
$controls.on('click', toggleAccordion)

$controls.on('accordion.toggle', function () {
if (opts.singleOpen && $controls.length > 1) {
return false
}

toggleAccordion()
})

$controls.on('accordion.refresh', function () {
refreshHeight($accordion)
})

$(window).on(
'resize',
debounce(function () {
refreshHeight($accordion)
})
)
}

function setup() {
$content.each(function () {
var $curr = $(this)

if ($curr.css('max-height') != 0) {
if (!$curr.closest('[data-accordion]').hasClass('open')) {
$curr.css({ 'max-height': 0, overflow: 'hidden' })
} else {
toggleTransition($curr)
calculateHeight($curr)

$curr.css('max-height', $curr.data('oHeight'))
}
}
})

if (!$accordion.attr('data-accordion')) {
$accordion.attr('data-accordion', '')
$accordion.find(opts.controlElement).attr('data-control', '')
$accordion.find(opts.contentElement).attr('data-content', '')
}
}

setup()
addEventListeners()
}

$.fn[pluginName] = function (options) {
return this.each(function () {
if (!$.data(this, 'plugin_' + pluginName)) {
$.data(this, 'plugin_' + pluginName, new Accordion(this, options))
}
})
}
})(jQuery, window, document)

+ 34
- 0
examples/list.js 查看文件

@@ -0,0 +1,34 @@
const EXAMPLE_LIST = [
{
name: '基础',
folder: 'info',
children: [
{
name: '开始',
page: 'start.html',
},
{
name: '坐标参考',
page: 'coord.html',
},
],
},
{
name: '地图',
folder: 'baselayer',
children: [
{
name: '高德地图',
page: 'amap.html',
},
{
name: '高德地图(偏移)',
page: 'amap_no_offset.html',
},
{
name: 'Arcgis',
page: 'arcgis.html',
},
],
},
]

+ 0
- 30
examples/test.html 查看文件

@@ -1,30 +0,0 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>demo</title>
<script src='/libs/dc-sdk/dc.min.js'></script>
<link href='/libs/dc-sdk/dc.min.css' type='text/css' rel='stylesheet'>
<style>
*{
padding: 0;
margin: 0;
}
html,body,#map-container{
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<div id="map-container">
</div>
</body>
<script>
DC.ready().then(()=>{
new DC.Viewer('map-container')
})
</script>

+ 1
- 2
package.json 查看文件

@@ -1,6 +1,6 @@
{
"name": "@dvgis/dc-sdk",
"version": "3.0.3",
"version": "3.0.0",
"license": "MIT",
"description": "The SDK is based on Cesium for secondary development of 2, 3D all-in-one WebGis application framework, the framework optimizes the use of Cesium and add some additional features, designed for developers to quickly build WebGis applications.",
"repository": "https://github.com/dvgis/dc-sdk.git",
@@ -37,7 +37,6 @@
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.1",
"@turf/turf": "^6.5.0",
"chalk": "^5.2.0",
"esbuild": "^0.17.18",
"esbuild-plugin-glsl": "^1.2.1",

+ 1
- 3
server.js 查看文件

@@ -17,9 +17,7 @@ export default function start() {
if (exists) {
portfinder.getPort((err, port) => {
server.listen(port)
shell.echo(
chalk.yellow(`the url is : http://localhost:${port}/test.html`)
)
shell.echo(chalk.yellow(`the url is : http://localhost:${port}`))
server.use('/libs/dc-sdk/', express.static(dist))
server.use(express.static('examples'))
})

+ 12
- 5
src/modules/exts/BaseLayerPicker.js 查看文件

@@ -3,8 +3,7 @@
**/

import { Cesium } from '../../namespace'

const { EllipsoidTerrainProvider } = Cesium
const { EllipsoidTerrainProvider, ImageryLayer } = Cesium

class BaseLayerPicker {
constructor(options) {
@@ -26,7 +25,10 @@ class BaseLayerPicker {
let imageryLayers = this._globe.imageryLayers
if (!this._selectedImageryLayer) {
for (let i = imageryLayer.layers.length - 1; i >= 0; i--) {
imageryLayers.add(imageryLayer.layers[i], 0)
imageryLayers.add(
new ImageryLayer(imageryLayer.layers[i], imageryLayer.options),
0
)
}
} else if (
this._selectedImageryLayer &&
@@ -34,7 +36,10 @@ class BaseLayerPicker {
) {
imageryLayers.removeAll()
for (let i = imageryLayer.layers.length - 1; i >= 0; i--) {
imageryLayers.addImageryProvider(imageryLayer.layers[i], 0)
imageryLayers.add(
new ImageryLayer(imageryLayer.layers[i], imageryLayer.options),
0
)
}
}
this._selectedImageryLayer = imageryLayer
@@ -61,9 +66,10 @@ class BaseLayerPicker {
/**
*
* @param imageryLayer
* @param options
* @returns {BaseLayerPicker}
*/
addImageryLayer(imageryLayer) {
addImageryLayer(imageryLayer, options = {}) {
let imageryLayers = []
if (Array.isArray(imageryLayer)) {
imageryLayers = imageryLayer.slice(0)
@@ -74,6 +80,7 @@ class BaseLayerPicker {
this._imageryLayers.push({
id: `dc-imagery-${this._count}`,
layers: imageryLayers,
options: options,
})
return this
}

+ 3
- 3
src/modules/exts/Viewer.js 查看文件

@@ -1,9 +1,9 @@
/**
@author : Caven Chen
@date : 2023-05-23
@date : 2023-05-26
*/
import { Cesium } from '../../namespace'

import { Cesium } from '../../namespace'
const {
BoundingSphere,
BoundingSphereState,
@@ -203,7 +203,7 @@ function Viewer(container, options) {
)
}

cesiumWidget.creditViewport.className = 'dc-viewer-canvas'
cesiumWidget.creditViewport.className = 'viewer-canvas'

let dataSourceCollection = options.dataSources
let destroyDataSourceCollection = false

+ 39
- 26
src/modules/imagery/ImageryLayerFactory.js 查看文件

@@ -7,13 +7,14 @@ import { Cesium } from '../../namespace'
import ImageryType from './ImageryType'
import AmapImageryProvider from './provider/AmapImageryProvider'
import BaiduImageryProvider from './provider/BaiduImageryProvider'
import GeoVisImageryProvider from './provider/GeoVisImageryProvider.js'
import GoogleImageryProvider from './provider/GoogleImageryProvider'
import TdtImageryProvider from './provider/TdtImageryProvider'
import TencentImageryProvider from './provider/TencentImageryProvider'

class ImageryLayerFactory {
/**
* Create amap image layer
* Create amap imagery layer
* @param options
* @returns {AmapImageryProvider}
*/
@@ -22,7 +23,7 @@ class ImageryLayerFactory {
}

/**
* Create baidu image layer
* Create baidu imagery layer
* @param options
* @returns {BaiduImageryProvider}
*/
@@ -31,7 +32,16 @@ class ImageryLayerFactory {
}

/**
* Create google image layer
* Create geoVis imagery layer
* @param options
* @returns {GeoVisImageryProvider}
*/
static createGeoVisImageryLayer(options) {
return new GeoVisImageryProvider(options)
}

/**
* Create google imagery layer
* @param options
* @returns {GoogleImageryProvider}
*/
@@ -40,7 +50,7 @@ class ImageryLayerFactory {
}

/**
* Create tdt image layer
* Create tdt imagery layer
* @param options
* @returns {TdtImageryProvider}
*/
@@ -49,7 +59,7 @@ class ImageryLayerFactory {
}

/**
* Create tencent image layer
* Create tencent imagery layer
* @param options
* @returns {TencentImageryProvider}
*/
@@ -58,97 +68,97 @@ class ImageryLayerFactory {
}

/**
* Create arcgis image layer
* Create arcgis imagery layer
* @param options
* @returns {module:cesium.ArcGisMapServerImageryProvider}
* @returns {ImageryProvider}
*/
static createArcGisImageryLayer(options) {
return new Cesium.ArcGisMapServerImageryProvider(options)
}

/**
* Create single tile image layer
* Create single tile imagery layer
* @param options
* @returns {module:cesium.SingleTileImageryProvider}
* @returns {ImageryProvider}
*/
static createSingleTileImageryLayer(options) {
return new Cesium.SingleTileImageryProvider(options)
}

/**
* Create WMS image layer
* Create WMS imagery layer
* @param options
* @returns {module:cesium.WebMapServiceImageryProvider}
* @returns {ImageryProvider}
*/
static createWMSImageryLayer(options) {
return new Cesium.WebMapServiceImageryProvider(options)
}

/**
* Create WMTS image layer
* Create WMTS imagery layer
* @param options
* @returns {module:cesium.WebMapTileServiceImageryProvider}
* @returns {ImageryProvider}
*/
static createWMTSImageryLayer(options) {
return new Cesium.WebMapTileServiceImageryProvider(options)
}

/**
* Create xyz image layer
* Create xyz imagery layer
* @param options
* @returns {module:cesium.UrlTemplateImageryProvider}
* @returns {ImageryProvider}
*/
static createXYZImageryLayer(options) {
return new Cesium.UrlTemplateImageryProvider(options)
}

/**
* Create coord image layer
* Create coord imagery layer
* @param options
* @returns {module:cesium.TileCoordinatesImageryProvider}
* @returns {ImageryProvider}
*/
static createCoordImageryLayer(options) {
return new Cesium.TileCoordinatesImageryProvider(options)
}

/**
* Create grid image layer
* Create grid imagery layer
* @param options
* @returns {module:cesium.GridImageryProvider}
* @returns {ImageryProvider}
*/
static createGridImageryLayer(options) {
return new Cesium.GridImageryProvider(options)
}

/**
* Create mapbox image layer
* Create mapbox imagery layer
* @param options
* @returns {module:cesium.MapboxImageryProvider}
* @returns {ImageryProvider}
*/
static createMapboxImageryLayer(options) {
return new Cesium.MapboxImageryProvider(options)
}

/**
* Create mapbox style image layer
* Create mapbox style imagery layer
* @param options
* @returns {module:cesium.MapboxStyleImageryProvider}
* @returns {ImageryProvider}
*/
static createMapboxStyleImageryLayer(options) {
return new Cesium.MapboxStyleImageryProvider(options)
}

/**
* Create TMS image layer
* Create TMS imagery layer
* @param options
* @returns {module:cesium.TileMapServiceImageryProvider}
* @returns {ImageryProvider}
*/
static createTMSImageryLayer(options) {
return new Cesium.TileMapServiceImageryProvider(options)
}

/**
* Create Imagery Layer
* Create Imagery Layer by Type
* @param type
* @param options
* @returns {any}
@@ -162,6 +172,9 @@ class ImageryLayerFactory {
case ImageryType.BAIDU:
imageryLayer = this.createBaiduImageryLayer(options)
break
case ImageryType.GEO_VIS:
imageryLayer = this.createGeoVisImageryLayer(options)
break
case ImageryType.GOOGLE:
imageryLayer = this.createGoogleImageryLayer(options)
break

+ 1
- 1
src/modules/imagery/provider/AmapImageryProvider.js 查看文件

@@ -3,7 +3,7 @@
* @Date: 2020-01-15 20:31:28
*/

import { Cesium } from '@dc-modules/namespace'
import { Cesium } from '../../../namespace'
import ImageryType from '../ImageryType'
import AmapMercatorTilingScheme from '../tiling-scheme/AmapMercatorTilingScheme'


+ 9
- 102
src/modules/imagery/provider/BaiduImageryProvider.js 查看文件

@@ -16,25 +16,21 @@ const TILE_URL = {
'//its.map.baidu.com:8002/traffic/TrafficTileService?time={time}&label={labelStyle}&v=016&level={z}&x={x}&y={y}&scaler=2',
}

class BaiduImageryProvider {
class BaiduImageryProvider extends Cesium.UrlTemplateImageryProvider {
constructor(options = {}) {
this._url =
options['url'] =
options.url ||
[
options.protocol || '',
TILE_URL[options.style] || TILE_URL['custom'],
].join('')
this._labelStyle = options.labelStyle || 'web2D'
this._tileWidth = 256
this._tileHeight = 256
this._maximumLevel = 18
this._crs = options.crs || 'BD09'

if (options.crs === 'WGS84') {
let resolutions = []
for (let i = 0; i < 19; i++) {
resolutions[i] = 256 * Math.pow(2, 18 - i)
}
this._tilingScheme = new BaiduMercatorTilingScheme({
options['tilingScheme'] = new BaiduMercatorTilingScheme({
resolutions,
rectangleSouthwestInMeters: new Cesium.Cartesian2(
-20037726.37,
@@ -46,105 +42,19 @@ class BaiduImageryProvider {
),
})
} else {
this._tilingScheme = new Cesium.WebMercatorTilingScheme({
options['tilingScheme'] = new Cesium.WebMercatorTilingScheme({
rectangleSouthwestInMeters: new Cesium.Cartesian2(-33554054, -33746824),
rectangleNortheastInMeters: new Cesium.Cartesian2(33554054, 33746824),
})
}
options['maximumLevel'] = 18
super(options)
this._rectangle = this._tilingScheme.rectangle
this._credit = undefined
this._token = undefined
this._url = options.url
this._crs = options.crs || 'BD09'
this._style = options.style || 'normal'
this._errorEvent = new Cesium.Event()
}

get url() {
return this._url
}

get token() {
return this._token
}

get tileWidth() {
if (!this.ready) {
throw new Cesium.DeveloperError(
'tileWidth must not be called before the imagery provider is ready.'
)
}
return this._tileWidth
}

get tileHeight() {
if (!this.ready) {
throw new Cesium.DeveloperError(
'tileHeight must not be called before the imagery provider is ready.'
)
}
return this._tileHeight
}

get maximumLevel() {
if (!this.ready) {
throw new Cesium.DeveloperError(
'maximumLevel must not be called before the imagery provider is ready.'
)
}
return this._maximumLevel
}

get minimumLevel() {
if (!this.ready) {
throw new Cesium.DeveloperError(
'minimumLevel must not be called before the imagery provider is ready.'
)
}
return 0
}

get tilingScheme() {
if (!this.ready) {
throw new Cesium.DeveloperError(
'tilingScheme must not be called before the imagery provider is ready.'
)
}
return this._tilingScheme
}

get rectangle() {
if (!this.ready) {
throw new Cesium.DeveloperError(
'rectangle must not be called before the imagery provider is ready.'
)
}
return this._rectangle
}

get ready() {
return !!this._url
}

get credit() {
return this._credit
}

get hasAlphaChannel() {
return true
}

get errorEvent() {
return this._errorEvent
}

getTileCredits(x, y, level) {}

/**
* Request Image
* @param x
* @param y
* @param level
* @returns {Promise<HTMLImageElement | HTMLCanvasElement>}
*/
requestImage(x, y, level) {
if (!this.ready) {
throw new Cesium.DeveloperError(
@@ -157,9 +67,6 @@ class BaiduImageryProvider {
.replace('{z}', level)
.replace('{s}', String(1))
.replace('{style}', this._style)
.replace('{labelStyle}', this._labelStyle)
.replace('{time}', String(new Date().getTime()))

if (this._crs === 'WGS84') {
url = url.replace('{x}', String(x)).replace('{y}', String(-y))
} else {

+ 29
- 0
src/modules/imagery/provider/GeoVisImageryProvider.js 查看文件

@@ -0,0 +1,29 @@
/**
@author : Caven Chen
@date : 2023-05-18
*/

import { Cesium } from '../../../namespace'
import ImageryType from '../ImageryType'

const TILE_URL =
'//tiles{s}.geovisearth.com/base/v1/{style}/{z}/{x}/{y}?format={format}&tmsIds=w&token={key}'

class GeoVisImageryProvider extends Cesium.UrlTemplateImageryProvider {
constructor(options = {}) {
options['url'] =
options.url ||
[
options.protocol || '',
TILE_URL.replace(/\{style\}/g, options.style || 'vec')
.replace(/\{format\}/g, options.format || 'png')
.replace(/\{key\}/g, options.key || ''),
].join('')
options['subdomains'] = options.subdomains || ['1', '2', '3']
super(options)
}
}

ImageryType.GEO_VIS = 'geoVis'

export default GeoVisImageryProvider

+ 5
- 1
src/modules/index.js 查看文件

@@ -3,4 +3,8 @@
@date : 2023-05-08
*/

export { default as Viewer } from './viewer/Viewer.js'
export { default as Viewer } from './viewer/Viewer'

export { ImageryType, ImageryLayerFactory } from './imagery'

export { default as Position } from './position/Position'

+ 1
- 1
src/modules/material/property/polyline/PolylineLightingMaterialProperty.js 查看文件

@@ -40,7 +40,7 @@ class PolylineLightingMaterialProperty extends MaterialProperty {

Object.defineProperties(PolylineLightingMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
image: Cesium.createPropertyDescriptor('image')
image: Cesium.createPropertyDescriptor('image'),
})

export default PolylineLightingMaterialProperty

+ 1
- 1
src/modules/material/property/polyline/PolylineLightingTrailMaterialProperty.js 查看文件

@@ -43,7 +43,7 @@ class PolylineLightingTrailMaterialProperty extends MaterialProperty {
Object.defineProperties(PolylineLightingTrailMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed'),
image: Cesium.createPropertyDescriptor('image')
image: Cesium.createPropertyDescriptor('image'),
})

export default PolylineLightingTrailMaterialProperty

+ 1
- 1
src/modules/material/property/polyline/PolylineTrailMaterialProperty.js 查看文件

@@ -36,7 +36,7 @@ class PolylineTrailMaterialProperty extends MaterialProperty {

Object.defineProperties(PolylineTrailMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed')
speed: Cesium.createPropertyDescriptor('speed'),
})

export default PolylineTrailMaterialProperty

+ 1
- 1
src/modules/material/property/radar/RadarLineMaterialProperty.js 查看文件

@@ -34,7 +34,7 @@ class RadarLineMaterialProperty extends MaterialProperty {

Object.defineProperties(RadarLineMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed')
speed: Cesium.createPropertyDescriptor('speed'),
})

export default RadarLineMaterialProperty

+ 1
- 1
src/modules/material/property/radar/RadarSweepMaterialProperty.js 查看文件

@@ -34,7 +34,7 @@ class RadarSweepMaterialProperty extends MaterialProperty {

Object.defineProperties(RadarSweepMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed')
speed: Cesium.createPropertyDescriptor('speed'),
})

export default RadarSweepMaterialProperty

+ 1
- 1
src/modules/material/property/radar/RadarWaveMaterialProperty.js 查看文件

@@ -34,7 +34,7 @@ class RadarWaveMaterialProperty extends MaterialProperty {

Object.defineProperties(RadarWaveMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed')
speed: Cesium.createPropertyDescriptor('speed'),
})

export default RadarWaveMaterialProperty

+ 1
- 1
src/modules/material/property/wall/WallImageTrailMaterialProperty.js 查看文件

@@ -49,7 +49,7 @@ Object.defineProperties(WallImageTrailMaterialProperty.prototype, {
image: Cesium.createPropertyDescriptor('image'),
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed'),
repeat: Cesium.createPropertyDescriptor('repeat')
repeat: Cesium.createPropertyDescriptor('repeat'),
})

export default WallImageTrailMaterialProperty

+ 1
- 1
src/modules/material/property/wall/WallLineTrailMaterialProperty.js 查看文件

@@ -51,7 +51,7 @@ Object.defineProperties(WallLineTrailMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
image: Cesium.createPropertyDescriptor('image'),
repeat: Cesium.createPropertyDescriptor('repeat'),
speed: Cesium.createPropertyDescriptor('speed')
speed: Cesium.createPropertyDescriptor('speed'),
})

export default WallLineTrailMaterialProperty

+ 1
- 1
src/modules/material/property/wall/WallTrailMaterialProperty.js 查看文件

@@ -43,7 +43,7 @@ class WallTrailMaterialProperty extends MaterialProperty {
Object.defineProperties(WallTrailMaterialProperty.prototype, {
color: Cesium.createPropertyDescriptor('color'),
speed: Cesium.createPropertyDescriptor('speed'),
image: Cesium.createPropertyDescriptor('image')
image: Cesium.createPropertyDescriptor('image'),
})

export default WallTrailMaterialProperty

+ 1
- 1
src/modules/material/property/water/WaterMaterialProperty.js 查看文件

@@ -81,7 +81,7 @@ Object.defineProperties(WaterMaterialProperty.prototype, {
baseWaterColor: Cesium.createPropertyDescriptor('baseWaterColor'),
blendColor: Cesium.createPropertyDescriptor('blendColor'),
specularMap: Cesium.createPropertyDescriptor('specularMap'),
normalMap: Cesium.createPropertyDescriptor('normalMap')
normalMap: Cesium.createPropertyDescriptor('normalMap'),
})

export default WaterMaterialProperty

+ 24
- 24
src/modules/material/type/polyline.js 查看文件

@@ -24,13 +24,13 @@ Cesium.Material._materialCache.addMaterial(
type: Cesium.Material.PolylineFlickerType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
speed: 1
speed: 1,
},
source: LineFlickerMaterial
source: LineFlickerMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
}
)

@@ -46,13 +46,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineFlowType, {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
speed: 1,
percent: 0.03,
gradient: 0.1
gradient: 0.1,
},
source: LineFlowMaterial
source: LineFlowMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

/**
@@ -69,13 +69,13 @@ Cesium.Material._materialCache.addMaterial(
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
image: Cesium.Material.DefaultImageId,
speed: 1,
repeat: new Cesium.Cartesian2(1, 1)
repeat: new Cesium.Cartesian2(1, 1),
},
source: LineImageTrailMaterial
source: LineImageTrailMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
}
)

@@ -91,13 +91,13 @@ Cesium.Material._materialCache.addMaterial(
type: Cesium.Material.PolylineLightingType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
image: Cesium.Material.DefaultImageId
image: Cesium.Material.DefaultImageId,
},
source: LineLightingMaterial
source: LineLightingMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
}
)

@@ -114,13 +114,13 @@ Cesium.Material._materialCache.addMaterial(
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
image: Cesium.Material.DefaultImageId,
speed: 3.0
speed: 3.0,
},
source: LineLightingTrailMaterial
source: LineLightingTrailMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
}
)

@@ -136,11 +136,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailType, {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
image: Cesium.Material.DefaultImageId,
speed: 1,
repeat: new Cesium.Cartesian2(1, 1)
repeat: new Cesium.Cartesian2(1, 1),
},
source: LineTrailMaterial
source: LineTrailMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

+ 12
- 12
src/modules/material/type/radar.js 查看文件

@@ -19,13 +19,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.RadarLineType, {
type: Cesium.Material.RadarLineType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
speed: 3.0
speed: 3.0,
},
source: RadarLineMaterial
source: RadarLineMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

/**
@@ -38,13 +38,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.RadarSweepType, {
type: Cesium.Material.RadarSweepType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
speed: 3.0
speed: 3.0,
},
source: RadarSweepMaterial
source: RadarSweepMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

/**
@@ -57,11 +57,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.RadarWaveType, {
type: Cesium.Material.RadarWaveType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
speed: 3.0
speed: 3.0,
},
source: RadarWaveMaterial
source: RadarWaveMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

+ 47
- 47
src/modules/material/type/thirdpart.js 查看文件

@@ -34,13 +34,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.AsphaltType, {
uniforms: {
asphaltColor: new Cesium.Color(0.15, 0.15, 0.15, 1.0),
bumpSize: 0.02,
roughness: 0.2
roughness: 0.2,
},
source: AsphaltMaterial
source: AsphaltMaterial,
},
translucent: function(material) {
translucent: function (material) {
return material.uniforms.asphaltColor.alpha < 1.0
}
},
})

/**
@@ -54,14 +54,14 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.BlobType, {
uniforms: {
lightColor: new Cesium.Color(1.0, 1.0, 1.0, 0.5),
darkColor: new Cesium.Color(0.0, 0.0, 1.0, 0.5),
frequency: 10.0
frequency: 10.0,
},
source: BlobMaterial
source: BlobMaterial,
},
translucent: function(material) {
translucent: function (material) {
var uniforms = material.uniforms
return uniforms.lightColor.alpha < 1.0 || uniforms.darkColor.alpha < 0.0
}
},
})

/**
@@ -78,14 +78,14 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.BrickType, {
brickSize: new Cesium.Cartesian2(0.3, 0.15),
brickPct: new Cesium.Cartesian2(0.9, 0.85),
brickRoughness: 0.2,
mortarRoughness: 0.1
mortarRoughness: 0.1,
},
source: BrickMaterial
source: BrickMaterial,
},
translucent: function(material) {
translucent: function (material) {
var uniforms = material.uniforms
return uniforms.brickColor.alpha < 1.0 || uniforms.mortarColor.alpha < 1.0
}
},
})

/**
@@ -99,13 +99,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CementType, {
uniforms: {
cementColor: new Cesium.Color(0.95, 0.95, 0.85, 1.0),
grainScale: 0.01,
roughness: 0.3
roughness: 0.3,
},
source: CementMaterial
source: CementMaterial,
},
translucent: function(material) {
translucent: function (material) {
return material.uniforms.cementColor.alpha < 1.0
}
},
})

/**
@@ -118,13 +118,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.ErosionType, {
type: Cesium.Material.ErosionType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.5),
time: 1.0
time: 1.0,
},
source: ErosionMaterial
source: ErosionMaterial,
},
translucent: function(material) {
translucent: function (material) {
return material.uniforms.color.alpha < 1.0
}
},
})

/**
@@ -138,14 +138,14 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.FacetType, {
uniforms: {
lightColor: new Cesium.Color(0.25, 0.25, 0.25, 0.75),
darkColor: new Cesium.Color(0.75, 0.75, 0.75, 0.75),
frequency: 10.0
frequency: 10.0,
},
source: FacetMaterial
source: FacetMaterial,
},
translucent: function(material) {
translucent: function (material) {
var uniforms = material.uniforms
return uniforms.lightColor.alpha < 1.0 || uniforms.darkColor.alpha < 0.0
}
},
})

/**
@@ -158,15 +158,15 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.FresnelType, {
type: Cesium.Material.FresnelType,
materials: {
reflection: {
type: Cesium.Material.ReflectionType
type: Cesium.Material.ReflectionType,
},
refraction: {
type: Cesium.Material.RefractionType
}
type: Cesium.Material.RefractionType,
},
},
source: FresnelMaterial
source: FresnelMaterial,
},
translucent: false
translucent: false,
})

/**
@@ -180,14 +180,14 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.GrassType, {
uniforms: {
grassColor: new Cesium.Color(0.25, 0.4, 0.1, 1.0),
dirtColor: new Cesium.Color(0.1, 0.1, 0.1, 1.0),
patchiness: 1.5
patchiness: 1.5,
},
source: GrassMaterial
source: GrassMaterial,
},
translucent: function(material) {
translucent: function (material) {
var uniforms = material.uniforms
return uniforms.grassColor.alpha < 1.0 || uniforms.dirtColor.alpha < 1.0
}
},
})

/**
@@ -200,11 +200,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.ReflectionType, {
type: Cesium.Material.ReflectionType,
uniforms: {
cubeMap: Cesium.Material.DefaultCubeMapId,
channels: 'rgb'
channels: 'rgb',
},
source: ReflectionMaterial
source: ReflectionMaterial,
},
translucent: false
translucent: false,
})

/**
@@ -218,11 +218,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.RefractionType, {
uniforms: {
cubeMap: Cesium.Material.DefaultCubeMapId,
channels: 'rgb',
indexOfRefractionRatio: 0.9
indexOfRefractionRatio: 0.9,
},
source: RefractionMaterial
source: RefractionMaterial,
},
translucent: false
translucent: false,
})

/**
@@ -236,14 +236,14 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.TyeDyeType, {
uniforms: {
lightColor: new Cesium.Color(1.0, 1.0, 0.0, 0.75),
darkColor: new Cesium.Color(1.0, 0.0, 0.0, 0.75),
frequency: 5.0
frequency: 5.0,
},
source: TieDyeMaterial
source: TieDyeMaterial,
},
translucent: function(material) {
translucent: function (material) {
var uniforms = material.uniforms
return uniforms.lightColor.alpha < 1.0 || uniforms.darkColor.alpha < 0.0
}
},
})

/**
@@ -259,14 +259,14 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.WoodType, {
darkWoodColor: new Cesium.Color(0.4, 0.2, 0.07, 1.0),
ringFrequency: 3.0,
noiseScale: new Cesium.Cartesian2(0.7, 0.5),
grainFrequency: 27.0
grainFrequency: 27.0,
},
source: WoodMaterial
source: WoodMaterial,
},
translucent: function(material) {
translucent: function (material) {
let uniforms = material.uniforms
return (
uniforms.lightWoodColor.alpha < 1.0 || uniforms.darkWoodColor.alpha < 1.0
)
}
},
})

+ 16
- 16
src/modules/material/type/wall.js 查看文件

@@ -19,13 +19,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.WallDiffuseType, {
fabric: {
type: Cesium.Material.WallDiffuseType,
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7)
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
},
source: WallDiffuseMaterial
source: WallDiffuseMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

/**
@@ -40,13 +40,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.WallImageTrailType, {
image: Cesium.Material.DefaultImageId,
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
speed: 3.0,
repeat: new Cesium.Cartesian2(1, 1)
repeat: new Cesium.Cartesian2(1, 1),
},
source: WallImageTrailMaterial
source: WallImageTrailMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

/**
@@ -61,13 +61,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.WallLineTrailType, {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
image: Cesium.Material.DefaultImageId,
repeat: new Cesium.Cartesian2(1, 1),
speed: 3.0
speed: 3.0,
},
source: WallLineTrailMaterial
source: WallLineTrailMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

/**
@@ -81,11 +81,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.WallTrailType, {
uniforms: {
color: new Cesium.Color(1.0, 0.0, 0.0, 0.7),
image: Cesium.Material.DefaultImageId,
speed: 1
speed: 1,
},
source: WallTrailMaterial
source: WallTrailMaterial,
},
translucent: function(material) {
translucent: function (material) {
return true
}
},
})

+ 3
- 3
src/modules/math/curve.js 查看文件

@@ -32,13 +32,13 @@ function getCurveByTwoPoints(obj1, obj2, count) {
}
let curveCoordinates = []
count = count || 40 // 曲线是由一些小的线段组成的,这个表示这个曲线所有到的折线的个数
let B1 = function(x) {
let B1 = function (x) {
return 1 - 2 * x + x * x
}
let B2 = x => {
let B2 = (x) => {
return 2 * x - 2 * x * x
}
let B3 = x => {
let B3 = (x) => {
return x * x
}


+ 1
- 1
src/modules/measure/Measure.js 查看文件

@@ -127,7 +127,7 @@ class Measure {
this._viewer.dataSources.add(this._layer)
Object.defineProperty(viewer, 'measure', {
value: this,
writable: false
writable: false,
})
}


+ 6
- 6
src/modules/measure/MeasureBase.js 查看文件

@@ -15,16 +15,16 @@ class MeasureBase {
font: '12px',
pixelOffset: { x: 0, y: -15 },
disableDepthTestDistance: Number.POSITIVE_INFINITY,
showBackground: true
}
showBackground: true,
},
})
this._resultLabel = new Cesium.Entity({
label: {
font: '12px',
pixelOffset: { x: 0, y: -15 },
disableDepthTestDistance: Number.POSITIVE_INFINITY,
showBackground: true
}
showBackground: true,
},
})
this._options = {}
}
@@ -41,10 +41,10 @@ class MeasureBase {
!(this._viewer.terrainProvider instanceof Cesium.EllipsoidTerrainProvider)
? Cesium.sampleTerrainMostDetailed(
this._viewer.terrainProvider,
positions.map(item => Cesium.Cartographic.fromCartesian(item))
positions.map((item) => Cesium.Cartographic.fromCartesian(item))
)
: Promise.resolve(
positions.map(item => Cesium.Cartographic.fromCartesian(item))
positions.map((item) => Cesium.Cartographic.fromCartesian(item))
)

let modelPromise =

+ 1
- 1
src/modules/measure/MeasureType.js 查看文件

@@ -12,7 +12,7 @@ const MeasureType = {
DISTANCE_SURFACE: 'diatance_surface',
HEADING: 'heading',
HEIGHT: 'height',
TRIANGLE_HEIGHT: 'triangle_height'
TRIANGLE_HEIGHT: 'triangle_height',
}

export default MeasureType

+ 5
- 5
src/modules/measure/edit/EditPolygon.js 查看文件

@@ -19,7 +19,7 @@ class EditPolygon extends Edit {
*/
_mountedHook() {
this.editTool.tooltipMess = '点击锚点移动,右击结束编辑'
this._delegate.polygon.hierarchy = new Cesium.CallbackProperty(time => {
this._delegate.polygon.hierarchy = new Cesium.CallbackProperty((time) => {
if (this._positions.length > 2) {
return new Cesium.PolygonHierarchy(this._positions)
} else {
@@ -48,7 +48,7 @@ class EditPolygon extends Edit {
this.editTool.fire(PlotEventType.CREATE_ANCHOR, {
position: item,
index: index,
isMid: index % 2 !== 0
isMid: index % 2 !== 0,
})
})
this._layer.entities.remove(this._overlay)
@@ -99,7 +99,7 @@ class EditPolygon extends Edit {
this.editTool.fire(PlotEventType.CREATE_ANCHOR, {
position: item,
index: index,
isMid: index % 2 !== 0
isMid: index % 2 !== 0,
})
})
}
@@ -149,11 +149,11 @@ class EditPolygon extends Edit {
this._positions[nextMidAnchorIndex] = nextMidPosition
this.editTool.fire(PlotEventType.UPDATE_ANCHOR, {
index: preMidAnchorIndex,
position: preMidPosition
position: preMidPosition,
})
this.editTool.fire(PlotEventType.UPDATE_ANCHOR, {
index: nextMidAnchorIndex,
position: nextMidPosition
position: nextMidPosition,
})
}
this._options.onCalc && this._options.onCalc(this._positions)

+ 5
- 5
src/modules/measure/edit/EditPolyline.js 查看文件

@@ -48,7 +48,7 @@ class EditPolyline extends Edit {
this.editTool.fire(PlotEventType.CREATE_ANCHOR, {
position: item,
index: index,
isMid: index % 2 !== 0
isMid: index % 2 !== 0,
})
})
} else {
@@ -56,7 +56,7 @@ class EditPolyline extends Edit {
this._positions.forEach((item, index) => {
this.editTool.fire(PlotEventType.CREATE_ANCHOR, {
position: item,
index: index
index: index,
})
})
}
@@ -94,7 +94,7 @@ class EditPolyline extends Edit {
this.editTool.fire(PlotEventType.CREATE_ANCHOR, {
position: item,
index: index,
isMid: index % 2 !== 0
isMid: index % 2 !== 0,
})
})
}
@@ -138,7 +138,7 @@ class EditPolyline extends Edit {
this._positions[preMidAnchorIndex] = preMidPosition
this.editTool.fire(PlotEventType.UPDATE_ANCHOR, {
index: preMidAnchorIndex,
position: preMidPosition
position: preMidPosition,
})
}

@@ -150,7 +150,7 @@ class EditPolyline extends Edit {
this._positions[nextMidAnchorIndex] = nextMidPosition
this.editTool.fire(PlotEventType.UPDATE_ANCHOR, {
index: nextMidAnchorIndex,
position: nextMidPosition
position: nextMidPosition,
})
}
}

+ 4
- 5
src/modules/measure/type/Area.js 查看文件

@@ -23,7 +23,7 @@ class Area extends MeasureBase {
new EditPolygon(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
this._options
)
@@ -36,9 +36,8 @@ class Area extends MeasureBase {
*/
_onCalc(positions) {
if (positions.length > 2) {
this._resultLabel.position = Cesium.BoundingSphere.fromPoints(
positions
)?.center
this._resultLabel.position =
Cesium.BoundingSphere.fromPoints(positions)?.center
this._resultLabel.label.text = `面积:${area(positions).toFixed(
2
)} 平方米`
@@ -55,7 +54,7 @@ class Area extends MeasureBase {
this._startHook(measure, options)
new DrawPolygon({
material: options.material || Cesium.Color.YELLOW.withAlpha(0.6),
perPositionHeight: true
perPositionHeight: true,
}).start(measure, this._options)
return this
}

+ 5
- 5
src/modules/measure/type/AreaHeight.js 查看文件

@@ -22,7 +22,7 @@ class AreaHeight extends MeasureBase {
new EditPolygon(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
this._options
)
@@ -79,14 +79,14 @@ class AreaHeight extends MeasureBase {
? Cesium.Cartographic.fromCartesian(updatedCartesians[index])
.height
: 0
)
),
}
})
})
.then(positions => {
.then((positions) => {
let max = 0
let position = undefined
positions.forEach(item => {
positions.forEach((item) => {
if (item.alt > max) {
max = item.alt
position = item
@@ -113,7 +113,7 @@ class AreaHeight extends MeasureBase {
start(measure, options) {
this._startHook(measure, options)
new DrawPolygon({
material: options.material || Cesium.Color.YELLOW.withAlpha(0.6)
material: options.material || Cesium.Color.YELLOW.withAlpha(0.6),
}).start(measure, this._options)
return this
}

+ 6
- 7
src/modules/measure/type/AreaSurface.js 查看文件

@@ -50,7 +50,7 @@ class AreaSurface extends MeasureBase {
new EditPolygon(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
this._options
)
@@ -63,9 +63,8 @@ class AreaSurface extends MeasureBase {
*/
_onCalc(positions) {
if (positions.length > 2) {
this._resultLabel.position = Cesium.BoundingSphere.fromPoints(
positions
)?.center
this._resultLabel.position =
Cesium.BoundingSphere.fromPoints(positions)?.center

let lerpPositions = this._lerp(
Cesium.Rectangle.fromCartesianArray(positions),
@@ -74,7 +73,7 @@ class AreaSurface extends MeasureBase {

this._getSampledHeight(lerpPositions.concat(positions), false)
.then(([updatedCartographics]) => {
return updatedCartographics.map(item =>
return updatedCartographics.map((item) =>
Cesium.Cartesian3.fromDegrees(
Cesium.Math.toDegrees(item.longitude),
Cesium.Math.toDegrees(item.latitude),
@@ -82,7 +81,7 @@ class AreaSurface extends MeasureBase {
)
)
})
.then(positions => {
.then((positions) => {
this._resultLabel.label.text = `面积:${area(positions).toFixed(
2
)} 平方米`
@@ -99,7 +98,7 @@ class AreaSurface extends MeasureBase {
start(measure, options) {
this._startHook(measure, options)
new DrawPolygon({
material: options.material || Cesium.Color.YELLOW.withAlpha(0.6)
material: options.material || Cesium.Color.YELLOW.withAlpha(0.6),
}).start(measure, this._options)
return this
}

+ 5
- 5
src/modules/measure/type/Distance.js 查看文件

@@ -23,11 +23,11 @@ class Distance extends MeasureBase {
new EditPolyline(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
{
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
}
)
}
@@ -68,13 +68,13 @@ class Distance extends MeasureBase {
depthFailMaterial:
options.depthFailMaterial ||
new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.YELLOW.withAlpha(0.6)
color: Cesium.Color.YELLOW.withAlpha(0.6),
}),
width: options.width || 2,
clampToGround: false
clampToGround: false,
}).start(measure, {
...options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
})
return this
}

+ 6
- 6
src/modules/measure/type/DistanceSurface.js 查看文件

@@ -44,11 +44,11 @@ class DistanceSurface extends MeasureBase {
new EditPolyline(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
{
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
}
)
}
@@ -87,7 +87,7 @@ class DistanceSurface extends MeasureBase {
)
)
})
.then(positions => {
.then((positions) => {
let sum = 0
for (let i = 0; i < positions.length - 1; i++) {
let s = Cesium.Cartesian3.distance(positions[i], positions[i + 1])
@@ -118,13 +118,13 @@ class DistanceSurface extends MeasureBase {
depthFailMaterial:
options.depthFailMaterial ||
new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.YELLOW.withAlpha(0.6)
color: Cesium.Color.YELLOW.withAlpha(0.6),
}),
width: options.width || 2,
clampToGround: true
clampToGround: true,
}).start(measure, {
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
})
return this
}

+ 5
- 5
src/modules/measure/type/Heading.js 查看文件

@@ -24,11 +24,11 @@ class Heading extends MeasureBase {
new EditPolyline(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
{
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
}
)
}
@@ -63,12 +63,12 @@ class Heading extends MeasureBase {
depthFailMaterial:
options.depthFailMaterial ||
new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.YELLOW.withAlpha(0.6)
color: Cesium.Color.YELLOW.withAlpha(0.6),
}),
width: options.width || 2
width: options.width || 2,
}).start(measure, {
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
})
return this
}

+ 9
- 9
src/modules/measure/type/Height.js 查看文件

@@ -21,8 +21,8 @@ class Height extends MeasureBase {
} else {
return null
}
}, false)
}
}, false),
},
})
}

@@ -35,11 +35,11 @@ class Height extends MeasureBase {
new EditPolyline(entity).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
{
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
}
)
}
@@ -70,7 +70,7 @@ class Height extends MeasureBase {
positions[1],
new Cesium.Cartesian3()
),
positions[1]
positions[1],
]

let hegiht = Math.abs(Cesium.Plane.getPointDistance(plane, positions[1]))
@@ -88,7 +88,7 @@ class Height extends MeasureBase {
start(measure, options) {
this._startHook(measure, options)
let helpLineMaterial = new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.GREENYELLOW
color: Cesium.Color.GREENYELLOW,
})
this._helpLine.polyline.material = helpLineMaterial
this._helpLine.polyline.depthFailMaterial = helpLineMaterial
@@ -98,12 +98,12 @@ class Height extends MeasureBase {
depthFailMaterial:
options.depthFailMaterial ||
new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.YELLOW.withAlpha(0.6)
color: Cesium.Color.YELLOW.withAlpha(0.6),
}),
width: options.width || 2
width: options.width || 2,
}).start(measure, {
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
})
return this
}

+ 14
- 14
src/modules/measure/type/TriangleHeight.js 查看文件

@@ -21,32 +21,32 @@ class TriangleHeight extends MeasureBase {
} else {
return null
}
}, false)
}
}, false),
},
})
this._lengthLabel = new Cesium.Entity({
label: {
font: '12px',
pixelOffset: { x: 0, y: -15 },
disableDepthTestDistance: Number.POSITIVE_INFINITY,
showBackground: true
}
showBackground: true,
},
})
this._heightLabel = new Cesium.Entity({
label: {
font: '12px',
pixelOffset: { x: 0, y: -15 },
disableDepthTestDistance: Number.POSITIVE_INFINITY,
showBackground: true
}
showBackground: true,
},
})
this._distanceLabel = new Cesium.Entity({
label: {
font: '12px',
pixelOffset: { x: 0, y: -15 },
disableDepthTestDistance: Number.POSITIVE_INFINITY,
showBackground: true
}
showBackground: true,
},
})
}

@@ -59,11 +59,11 @@ class TriangleHeight extends MeasureBase {
new EditPolyline(delegate).start(
{
viewer: this._viewer,
layer: this._layer
layer: this._layer,
},
{
...this._options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
}
)
}
@@ -141,7 +141,7 @@ class TriangleHeight extends MeasureBase {
start(measure, options) {
this._startHook(measure, options)
let helpLineMaterial = new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.GREENYELLOW
color: Cesium.Color.GREENYELLOW,
})
this._helpLine.polyline.material = helpLineMaterial
this._helpLine.polyline.depthFailMaterial = helpLineMaterial
@@ -154,13 +154,13 @@ class TriangleHeight extends MeasureBase {
depthFailMaterial:
options.depthFailMaterial ||
new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.YELLOW.withAlpha(0.6)
color: Cesium.Color.YELLOW.withAlpha(0.6),
}),
width: options.width || 2,
clampToGround: false
clampToGround: false,
}).start(measure, {
...options,
...{ maxAnchorSize: this._maxAnchorSize }
...{ maxAnchorSize: this._maxAnchorSize },
})
return this
}

+ 27
- 13
src/modules/viewer/Viewer.js 查看文件

@@ -49,11 +49,17 @@ class Viewer {
this._viewerOption = new ViewerOption(this) // Initialize the viewer option
this._cameraOption = new CameraOption(this) // Initialize the camera option

this._dcContainer = DomUtil.create(
this._widgetContainer = DomUtil.create(
'div',
'dc-container',
'viewer-widgets',
typeof id === 'string' ? document.getElementById(id) : id
) //Register the custom container
) //Register the widgets container

this._layerContainer = DomUtil.create(
'div',
'viewer-layers',
typeof id === 'string' ? document.getElementById(id) : id
) //Register the layers container

this._baseLayerPicker = new BaseLayerPicker({
globe: this._delegate.scene.globe,
@@ -83,8 +89,16 @@ class Viewer {
return this._delegate
}

get dcContainer() {
return this._dcContainer
get container() {
return this._delegate.container
}

get widgetContainer() {
return this._widgetContainer
}

get layerContainer() {
return this._layerContainer
}

get scene() {
@@ -284,19 +298,19 @@ class Viewer {
* Adds the baseLayer .
* The baseLayer can be a single or an array,
* and when the baseLayer is an array, the baseLayer will be loaded together
* @param baseLayers
* @param baseLayer
* @param options
* @returns {Viewer}
*/
addBaseLayer(baseLayers, options = {}) {
if (!baseLayers) {
addBaseLayer(baseLayer, options = {}) {
if (!baseLayer) {
return this
}
this._baseLayerPicker.addImageryProvider(baseLayers)
if (!this._baseLayerPicker.selectedImagery) {
this._baseLayerPicker.changeImagery(0)
this._baseLayerPicker.addImageryLayer(baseLayer)
if (!this._baseLayerPicker.selectedImageryLayer) {
this._baseLayerPicker.changeImageryLayer(0)
}
this.mapSwitch && this.mapSwitch.addMap(options)
this['mapSwitch'] && this['mapSwitch'].addMap(options)
return this
}

@@ -306,7 +320,7 @@ class Viewer {
* @returns {Viewer}
*/
changeBaseLayer(index) {
this._baseLayerPicker.changeImagery(index)
this._baseLayerPicker.changeImageryLayer(index)
return this
}


+ 2
- 2
src/modules/widget/Widget.js 查看文件

@@ -57,12 +57,12 @@ class Widget {
!this._ready && this._mountContent()
if (this._enable) {
!this._wrapper.parentNode &&
this._viewer.dcContainer.appendChild(this._wrapper)
this._viewer.widgetContainer.appendChild(this._wrapper)
this._bindEvent()
} else {
this._unbindEvent()
this._wrapper.parentNode &&
this._viewer.dcContainer.removeChild(this._wrapper)
this._viewer.widgetContainer.removeChild(this._wrapper)
}
}


+ 1
- 1
src/modules/widget/index.js 查看文件

@@ -31,6 +31,6 @@ export default function createWidgets() {
zoomController: new ZoomController(),
loadingMask: new LoadingMask(),
tilesetSplit: new TilesetSplit(),
sceneSplit: new SceneSplit()
sceneSplit: new SceneSplit(),
}
}

+ 1
- 1
src/modules/widget/type/Compass.js 查看文件

@@ -13,7 +13,7 @@ import Widget from '../Widget'
class Compass extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', `dc-compass`)
this._wrapper = DomUtil.create('div', `widget compass`)
this._compassRectangle = undefined
this._outRing = undefined
this._gyro = undefined

+ 1
- 1
src/modules/widget/type/ContextMenu.js 查看文件

@@ -11,7 +11,7 @@ import Widget from '../Widget'
class ContextMenu extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-context-menu')
this._wrapper = DomUtil.create('div', 'widget context-menu')
this._ulEl = undefined
this._handler = undefined
this._overlay = undefined

+ 1
- 1
src/modules/widget/type/DistanceLegend.js 查看文件

@@ -26,7 +26,7 @@ const DIS = [
class DistanceLegend extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-distance-legend')
this._wrapper = DomUtil.create('div', 'widget distance-legend')
this._labelEl = undefined
this._scaleBarEl = undefined
this._lastUpdate = Cesium.getTimestamp()

+ 1
- 1
src/modules/widget/type/HawkeyeMap.js 查看文件

@@ -28,7 +28,7 @@ const DEF_OPTS = {
class HawkeyeMap extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-hawkeye-map', null)
this._wrapper = DomUtil.create('div', 'widget hawkeye-map', null)
this._wrapper.setAttribute('id', Util.uuid())
this._baseLayers = []
this._map = undefined

+ 1
- 1
src/modules/widget/type/LoadingMask.js 查看文件

@@ -10,7 +10,7 @@ import { DomUtil } from '../../utils'
class LoadingMask extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-loading-mask')
this._wrapper = DomUtil.create('div', 'widget loading-mask')
this._state = State.INITIALIZED
}


+ 1
- 1
src/modules/widget/type/LocationBar.js 查看文件

@@ -12,7 +12,7 @@ import { MouseEventType, SceneEventType } from '../../event'
class LocationBar extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-location-bar')
this._wrapper = DomUtil.create('div', 'widget location-bar')
this._mouseEl = undefined
this._cameraEl = undefined
this._fpsEl = undefined

+ 1
- 1
src/modules/widget/type/MapSplit.js 查看文件

@@ -12,7 +12,7 @@ import Widget from '../Widget'
class MapSplit extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-slider')
this._wrapper = DomUtil.create('div', 'widget slider')
this._baseLayer = undefined
this._moveActive = false
this._state = State.INITIALIZED

+ 2
- 2
src/modules/widget/type/MapSwitch.js 查看文件

@@ -10,7 +10,7 @@ import { DomUtil } from '../../utils'
class MapSwitch extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-map-switch')
this._wrapper = DomUtil.create('div', 'widget map-switch')
this._config = undefined
this._cache = []
this._state = State.INITIALIZED
@@ -27,7 +27,7 @@ class MapSwitch extends Widget {
_enableHook() {
!this._wrapper.parentNode &&
this._viewer &&
this._viewer.dcContainer.appendChild(this._wrapper)
this._viewer.widgetContainer.appendChild(this._wrapper)
}

/**

+ 1
- 1
src/modules/widget/type/Popup.js 查看文件

@@ -11,7 +11,7 @@ import { DomUtil } from '../../utils'
class Popup extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-popup')
this._wrapper = DomUtil.create('div', 'widget popup')
this._config = { customClass: '' }
this._position = undefined
this._state = State.INITIALIZED

+ 1
- 1
src/modules/widget/type/SceneSplit.js 查看文件

@@ -12,7 +12,7 @@ import { DomUtil } from '../../utils'
class SceneSplit extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-slider')
this._wrapper = DomUtil.create('div', 'widget slider')
this._tileset = undefined
this._baseLayer = undefined
this._moveActive = false

+ 1
- 1
src/modules/widget/type/TilesetSplit.js 查看文件

@@ -12,7 +12,7 @@ import { DomUtil } from '../../utils'
class TilesetSplit extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-slider')
this._wrapper = DomUtil.create('div', 'widget slider')
this._tileset = undefined
this._moveActive = false
this._state = State.INITIALIZED

+ 1
- 1
src/modules/widget/type/Tooltip.js 查看文件

@@ -10,7 +10,7 @@ import { DomUtil } from '../../utils'
class Tooltip extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-tool-tip')
this._wrapper = DomUtil.create('div', 'widget tool-tip')
this._ready = true
this._state = State.INITIALIZED
}

+ 1
- 1
src/modules/widget/type/ZoomController.js 查看文件

@@ -12,7 +12,7 @@ import { DomUtil } from '../../utils'
class ZoomController extends Widget {
constructor() {
super()
this._wrapper = DomUtil.create('div', 'dc-zoom-controller')
this._wrapper = DomUtil.create('div', 'widget zoom-controller')
this._zoomInEl = undefined
this._zoomOutEl = undefined
this._refreshEl = undefined

+ 1
- 1
src/modules/wind/WindCanvas.js 查看文件

@@ -223,7 +223,7 @@ class WindCanvas {
particles.push(
this.field.randomize(
{
age: Math.floor(Math.random() * this.options.maxAge)
age: Math.floor(Math.random() * this.options.maxAge),
},
width,
height,

+ 1
- 0
src/themes/index.js 查看文件

@@ -4,3 +4,4 @@
*/

import './index.scss'
import './map-switch.scss'

+ 6
- 33
src/themes/index.scss 查看文件

@@ -1,51 +1,21 @@
@charset "UTF-8";

* {
padding: 0;
margin: 0;
}

.dc-container {
overflow: hidden;
display: block;
}

.dc-viewer {
font-family: sans-serif;
font-size: 16px;
overflow: hidden;
display: block;
.viewer-canvas {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

.dc-viewer-widget-container {
width: 100%;
height: 100%;
}

.dc-widget {
font-family: sans-serif;
font-size: 16px;
overflow: hidden;
display: block;
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

.dc-widget,
.dc-widget canvas {
.viewer-canvas canvas {
width: 100%;
height: 100%;
touch-action: none;
}


.div-icon {
user-select: none;
background-color: #fff;
@@ -55,3 +25,6 @@
cursor: pointer;
}
}




Loading…
取消
儲存