12-4
This commit is contained in:
@ -76,6 +76,15 @@ function accordingToCameraHeight() {
|
||||
}
|
||||
|
||||
function startDraw(sdk, showData) {
|
||||
if(!sdk || !sdk.viewer) {
|
||||
return
|
||||
}
|
||||
if (showData) {
|
||||
let terrainAvailability = sdk.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
return '未加载地形数据!'
|
||||
}
|
||||
}
|
||||
show = showData
|
||||
|
||||
Object.keys(paramData).forEach(item => {
|
||||
|
||||
@ -1434,9 +1434,12 @@ class MapPrint {
|
||||
document.body.appendChild(downloadElement);
|
||||
downloadElement.click();
|
||||
document.body.removeChild(downloadElement);
|
||||
setTimeout(() => {
|
||||
exporting = false;
|
||||
exportBtn.innerHTML = '打印';
|
||||
}, 100);
|
||||
}, 'image/png', 0.95);
|
||||
exporting = false;
|
||||
exportBtn.innerHTML = '打印';
|
||||
|
||||
// canvas2.toBlob(function (blob) {
|
||||
// let imgBlobData = URL.createObjectURL(blob);
|
||||
// let downloadElement = document.createElement('a');
|
||||
|
||||
@ -434,7 +434,7 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
||||
sdk2D.viewer.imageryLayers.lowerToBottom(layer2d)
|
||||
}
|
||||
// 移到最高层
|
||||
else if (newindxe === sdk3D.viewer.imageryLayers._layers.length - 1) {
|
||||
else if (newindxe >= sdk3D.viewer.imageryLayers._layers.length - 1) {
|
||||
sdk2D.viewer.imageryLayers.raiseToTop(layer2d)
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1067,7 +1067,7 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
||||
sdkD.viewer.imageryLayers.lowerToBottom(layerD)
|
||||
}
|
||||
// 移到最高层
|
||||
else if (newindxe === sdkD.viewer.imageryLayers._layers.length - 1) {
|
||||
else if (newindxe >= sdkD.viewer.imageryLayers._layers.length - 1) {
|
||||
sdkD.viewer.imageryLayers.raiseToTop(layerD)
|
||||
}
|
||||
else {
|
||||
|
||||
@ -16,17 +16,13 @@ class Layer extends BaseLayer {
|
||||
super(sdk, options)
|
||||
this.object = {}
|
||||
this.options.host = this.options.host || getHost()
|
||||
this.on()
|
||||
this.loadLayer(this.options)
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "layer"
|
||||
}
|
||||
|
||||
on() {
|
||||
return this.loadLayer(this.options)
|
||||
}
|
||||
|
||||
async loadLayer(data) {
|
||||
this.object = { ...data }
|
||||
let url = ""
|
||||
|
||||
@ -482,6 +482,9 @@ class CurvelineObject extends Base {
|
||||
return this.options.heightMode ? this.options.heightMode : 0
|
||||
}
|
||||
set heightMode(v) {
|
||||
if (!this._isNodeEdit) {
|
||||
this._lastHeightMode = null
|
||||
}
|
||||
this.positionEditing = false
|
||||
this.options.heightMode = (v || v == 0) ? v : 2
|
||||
let heightModeName = ''
|
||||
@ -556,7 +559,7 @@ class CurvelineObject extends Base {
|
||||
alt: fromDegreesArray[2]
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
get extend() {
|
||||
@ -2051,7 +2054,11 @@ class CurvelineObject extends Base {
|
||||
}
|
||||
let positions = JSON.parse(JSON.stringify(positionsArray))
|
||||
let ground
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
ground = false
|
||||
@ -2592,13 +2599,19 @@ class CurvelineObject extends Base {
|
||||
// }
|
||||
|
||||
nodeEdit(cd) {
|
||||
if(this._isNodeEdit) {
|
||||
return
|
||||
}
|
||||
this.closeNodeEdit()
|
||||
let lastHeightMode = this.heightMode
|
||||
this._isNodeEdit = true
|
||||
this.positionEditing = false
|
||||
this.heightMode = 0
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
} else {
|
||||
this.closeNodeEdit()
|
||||
this._lastHeightMode = lastHeightMode
|
||||
if (!this._lastHeightMode && this._lastHeightMode != 0) {
|
||||
this._lastHeightMode = lastHeightMode
|
||||
}
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
@ -2679,7 +2692,7 @@ class CurvelineObject extends Base {
|
||||
|
||||
this.entity.polyline.positions = new Cesium.CallbackProperty( () => {
|
||||
let fromDegreesArray = this.renewPositions(this.options.positions)
|
||||
this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
this._nodeEditCallback && this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
return Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray)
|
||||
}, false)
|
||||
|
||||
@ -2702,10 +2715,12 @@ class CurvelineObject extends Base {
|
||||
})
|
||||
this.nodePoints.push(entity)
|
||||
}
|
||||
this._isNodeEdit = true
|
||||
}
|
||||
}
|
||||
|
||||
closeNodeEdit() {
|
||||
this._isNodeEdit = false
|
||||
let _lastHeightMode = this._lastHeightMode
|
||||
this._lastHeightMode = null
|
||||
if(_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||
@ -2936,7 +2951,11 @@ class CurvelineObject extends Base {
|
||||
)
|
||||
this.renewPolygon(fromDegreesArray)
|
||||
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
case 1:
|
||||
|
||||
@ -1240,7 +1240,7 @@ class GroundSvg extends Base {
|
||||
* 拖动
|
||||
* @param {boolean} status=false 状态
|
||||
*/
|
||||
drag(status, cd) {
|
||||
drag(status, dragCallback, endCallback) {
|
||||
if (!this._loaded || !this.sdk || !this.sdk.viewer) {
|
||||
return
|
||||
}
|
||||
@ -1322,7 +1322,7 @@ class GroundSvg extends Base {
|
||||
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
||||
angleW = bearing2 - bearingW
|
||||
angleH = bearing2 - bearingH
|
||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
||||
if ((angleW > -270 && angleW < -90) || (angleW < 270 && angleW > 90)) {
|
||||
angleW = angleW + 180
|
||||
flag = true
|
||||
}
|
||||
@ -1370,8 +1370,7 @@ class GroundSvg extends Base {
|
||||
case 'svg-control-points_8':
|
||||
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
|
||||
angleH = bearing2 - bearingH
|
||||
|
||||
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
|
||||
if ((angleH > -270 && angleH < -90) || (angleH < 270 && angleH > 90)) {
|
||||
angleH = angleH + 180
|
||||
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
@ -1534,7 +1533,7 @@ class GroundSvg extends Base {
|
||||
}
|
||||
|
||||
this.scale = { ...scale }
|
||||
|
||||
dragCallback && dragCallback(this.options)
|
||||
}
|
||||
else {
|
||||
let pickedObjectArray = this.sdk.viewer.scene.drillPick(movement.endPosition);
|
||||
@ -1601,7 +1600,7 @@ class GroundSvg extends Base {
|
||||
this.ScreenSpaceEventHandler.setInputAction((movement) => {
|
||||
this.drag(false)
|
||||
// if (!this._DialogObject) {
|
||||
cd && cd(this.options)
|
||||
endCallback && endCallback(this.options)
|
||||
syncData(this.sdk, this.options.id)
|
||||
syncSplitData(this.sdk, this.options.id)
|
||||
// }
|
||||
|
||||
@ -178,8 +178,10 @@ class LabelObject extends Base {
|
||||
lng: v[0],
|
||||
lat: v[1]
|
||||
}, objectsToExclude).then(height => {
|
||||
v[2] = height
|
||||
this.options.position = [...v]
|
||||
if(this.ground) {
|
||||
v[2] = height
|
||||
this.options.position = [...v]
|
||||
}
|
||||
})
|
||||
// let point1 = Cesium.Cartesian3.fromDegrees(this.options.position[0], this.options.position[1], 0);
|
||||
// let point2 = Cesium.Cartesian3.fromDegrees(this.options.position[0], this.options.position[1], 10000000);
|
||||
@ -275,7 +277,9 @@ class LabelObject extends Base {
|
||||
lng: this.options.position[0],
|
||||
lat: this.options.position[1]
|
||||
}, objectsToExclude).then(height => {
|
||||
this.options.position[2] = height
|
||||
if(this.ground) {
|
||||
this.options.position[2] = height
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -514,6 +514,9 @@ class PolylineObject extends Base {
|
||||
return this.options.heightMode ? this.options.heightMode : 0
|
||||
}
|
||||
set heightMode(v) {
|
||||
if (!this._isNodeEdit) {
|
||||
this._lastHeightMode = null
|
||||
}
|
||||
this.positionEditing = false
|
||||
this.options.heightMode = (v || v == 0) ? v : 2
|
||||
let heightModeName = ''
|
||||
@ -548,6 +551,7 @@ class PolylineObject extends Base {
|
||||
}
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
if (ground) {
|
||||
this.label.ground = ground
|
||||
@ -570,7 +574,7 @@ class PolylineObject extends Base {
|
||||
alt: fromDegreesArray[2]
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
get extend() {
|
||||
@ -2077,7 +2081,11 @@ class PolylineObject extends Base {
|
||||
}
|
||||
let positions = JSON.parse(JSON.stringify(positionsArray))
|
||||
let ground
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
ground = false
|
||||
@ -2587,15 +2595,21 @@ class PolylineObject extends Base {
|
||||
// }
|
||||
|
||||
nodeEdit(cb) {
|
||||
if(this._isNodeEdit) {
|
||||
return
|
||||
}
|
||||
this.closeNodeEdit()
|
||||
let lastHeightMode = this.heightMode
|
||||
this._isNodeEdit = true
|
||||
this.positionEditing = false
|
||||
this.noseToTail = false
|
||||
// this.smooth = false
|
||||
this.heightMode = 0
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
} else {
|
||||
this.closeNodeEdit()
|
||||
this._lastHeightMode = lastHeightMode
|
||||
if (!this._lastHeightMode && this._lastHeightMode != 0) {
|
||||
this._lastHeightMode = lastHeightMode
|
||||
}
|
||||
YJ.Measure.SetMeasureStatus(true)
|
||||
this._nodeEditCallback = cb
|
||||
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
|
||||
@ -2676,7 +2690,7 @@ class PolylineObject extends Base {
|
||||
|
||||
this.entity.polyline.positions = new Cesium.CallbackProperty(() => {
|
||||
let fromDegreesArray = this.renewPositions(this.options.positions)
|
||||
this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
this._nodeEditCallback && this._nodeEditCallback(this.options.positions, this.lengthByMeter)
|
||||
return Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray)
|
||||
}, false)
|
||||
|
||||
@ -2699,10 +2713,12 @@ class PolylineObject extends Base {
|
||||
})
|
||||
this.nodePoints.push(entity)
|
||||
}
|
||||
this._isNodeEdit = true
|
||||
}
|
||||
}
|
||||
|
||||
closeNodeEdit() {
|
||||
this._isNodeEdit = false
|
||||
let _lastHeightMode = this._lastHeightMode
|
||||
this._lastHeightMode = null
|
||||
if (_lastHeightMode && _lastHeightMode !== 0 && _lastHeightMode !== '0') {
|
||||
@ -2925,7 +2941,11 @@ class PolylineObject extends Base {
|
||||
)
|
||||
this.renewPolygon(fromDegreesArray)
|
||||
|
||||
switch (this.heightMode) {
|
||||
let heightMode = this.heightMode
|
||||
if (this._isNodeEdit) {
|
||||
heightMode = 0
|
||||
}
|
||||
switch (heightMode) {
|
||||
case 0:
|
||||
case '0':
|
||||
case 1:
|
||||
|
||||
@ -45,11 +45,11 @@ class Vector extends Base {
|
||||
this.options.headTables = options.headTables || []
|
||||
this.options.name = options.name || '未命名对象'
|
||||
|
||||
if (!this.options.path.endsWith('.kml')) {
|
||||
; (this.options.color = options.color || 'rgba(0,255,184,0.5)'),
|
||||
(this.options.opacity =
|
||||
options.opacity || options.opacity === 0 ? options.opacity : 1)
|
||||
}
|
||||
// if (!this.options.path.endsWith('.kml')) {
|
||||
// ; (this.options.color = options.color || 'rgba(0,255,184,0.5)'),
|
||||
// (this.options.opacity =
|
||||
// options.opacity || options.opacity === 0 ? options.opacity : 1)
|
||||
// }
|
||||
|
||||
this.options.show =
|
||||
options.show || options.show === false ? options.show : true
|
||||
@ -620,16 +620,26 @@ class Vector extends Base {
|
||||
}
|
||||
})
|
||||
if (!that.options.field) {
|
||||
const properties = ['id', 'Id', 'ID', 'name', 'Name', 'NAME', 'address', 'Address', 'ADDRESS', 'text', 'Text', 'TEXT', 'label', 'Label', 'LABEL'];
|
||||
const properties = ['name', 'Name', 'NAME'];
|
||||
const field = properties.find(prop => that.geojson.features[0].properties[prop] !== undefined);
|
||||
if (field) {
|
||||
that.options.field = field;
|
||||
}
|
||||
else {
|
||||
for (let key in that.geojson.features[0].properties) {
|
||||
that.options.field = key;
|
||||
break;
|
||||
}
|
||||
const isChinese = (str) => /[\u4e00-\u9fa5]/.test(str);
|
||||
const sortedKeys = Object.keys(that.geojson.features[0].properties || {}).sort((a, b) => {
|
||||
const aIsCN = isChinese(a);
|
||||
const bIsCN = isChinese(b);
|
||||
|
||||
if (!aIsCN && bIsCN) return -1;
|
||||
if (aIsCN && !bIsCN) return 1;
|
||||
|
||||
// 非中文:纯字母序(不区分大小写);中文:拼音序
|
||||
return aIsCN
|
||||
? a.localeCompare(b, 'zh-CN')
|
||||
: a.toUpperCase().localeCompare(b.toUpperCase());
|
||||
});
|
||||
that.options.field = sortedKeys[0]
|
||||
}
|
||||
}
|
||||
// for (let i = 0; i < that.#textEntity.length; i++) {
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
|
||||
.cesium-viewer-cesiumWidgetContainer {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.cesium-viewer-cesiumWidgetContainer .cesium-widget:nth-of-type(1) {
|
||||
@ -1502,7 +1503,8 @@
|
||||
display: flex;
|
||||
padding-left: 0;
|
||||
position: relative;
|
||||
left: 80px;
|
||||
left: 50% !important;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.YJ-custom-base-dialog>.content .pagination .pageTips {
|
||||
|
||||
Reference in New Issue
Block a user