| | |
| | | position = new global.DC.Position(Number(position[0]), Number(position[1])) |
| | | let label = new global.DC.Label(position, item.name) |
| | | label.attrParams = { 'id': item.id, item } |
| | | console.log(item, `${item.width}px`, 123) |
| | | label.setStyle({ |
| | | 'fillColor': color, |
| | | "font": `${item.width}px sans-serif`, |
| | |
| | | } |
| | | |
| | | if ('width' in params) { |
| | | if (overlay.attrParams && overlay.attrParams.data && overlay.attrParams.data.type && overlay.attrParams.data.type == 3) return |
| | | let linePosition = '' |
| | | if ('position' in params) { |
| | | linePosition = params.position.replace(/,/g, ";").replace(/ /g, ",") |
| | | if (overlay.attrParams && overlay.attrParams.data && overlay.attrParams.data.type && overlay.attrParams.data.type == 3) { |
| | | overlay.attrParams.data.width = params.width |
| | | } else { |
| | | linePosition = overlay.attrParams.linePositionStr |
| | | } |
| | | let coords = global.DC.GeoTools.polylineBuffer(linePosition, params.width) |
| | | let positionStr = '' |
| | | coords.forEach((item, index) => { |
| | | if (!(index == coords.length - 1)) { |
| | | positionStr += item[0] + ',' + item[1] + ';' |
| | | let linePosition = '' |
| | | if ('position' in params) { |
| | | linePosition = params.position.replace(/,/g, ";").replace(/ /g, ",") |
| | | } else { |
| | | linePosition = overlay.attrParams.linePositionStr |
| | | } |
| | | }) |
| | | positionStr = positionStr.slice(0, positionStr.length - 1) |
| | | // 面颜色 |
| | | let color = '' |
| | | // 线颜色 |
| | | let lineColor = '' |
| | | if (params.color == '') { |
| | | color = global.DC.Namespace.Cesium.Color.fromBytes(255, 0, 0, 150) |
| | | } else { |
| | | let r = parseInt(params.color.slice(1, 3), 16) |
| | | let g = parseInt(params.color.slice(3, 5), 16) |
| | | let b = parseInt(params.color.slice(5, 7), 16) |
| | | color = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 150) |
| | | lineColor = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 255) |
| | | } |
| | | overlay.attrParams.lineObj.setStyle({ |
| | | "material": lineColor, |
| | | 'width': 3 |
| | | }) |
| | | overlay.attrParams.linePositionStr = linePosition |
| | | overlay.attrParams.polygonPositionStr = positionStr |
| | | overlay.attrParams.color = params.color |
| | | let coords = global.DC.GeoTools.polylineBuffer(linePosition, params.width) |
| | | let positionStr = '' |
| | | coords.forEach((item, index) => { |
| | | if (!(index == coords.length - 1)) { |
| | | positionStr += item[0] + ',' + item[1] + ';' |
| | | } |
| | | }) |
| | | positionStr = positionStr.slice(0, positionStr.length - 1) |
| | | // 面颜色 |
| | | let color = '' |
| | | // 线颜色 |
| | | let lineColor = '' |
| | | if (params.color == '') { |
| | | color = global.DC.Namespace.Cesium.Color.fromBytes(255, 0, 0, 150) |
| | | } else { |
| | | let r = parseInt(params.color.slice(1, 3), 16) |
| | | let g = parseInt(params.color.slice(3, 5), 16) |
| | | let b = parseInt(params.color.slice(5, 7), 16) |
| | | color = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 150) |
| | | lineColor = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 255) |
| | | } |
| | | overlay.attrParams.lineObj.setStyle({ |
| | | "material": lineColor, |
| | | 'width': 3 |
| | | }) |
| | | overlay.attrParams.linePositionStr = linePosition |
| | | overlay.attrParams.polygonPositionStr = positionStr |
| | | overlay.attrParams.color = params.color |
| | | overlay.attrParams.width = params.width |
| | | |
| | | let areaPolygon = new global.DC.Polygon(positionStr) |
| | | drawLayers.addOverlay(areaPolygon) |
| | | areaPolygon.setStyle({ |
| | | 'material': color, |
| | | 'height': 0.01, |
| | | }) |
| | | areaPolygon.attrParams = overlay.attrParams |
| | | areaPolygon.on(global.DC.MouseEventType.CLICK, this.$parent.lineOverlayTypeClick) |
| | | overlay.remove() |
| | | let areaPolygon = new global.DC.Polygon(positionStr) |
| | | drawLayers.addOverlay(areaPolygon) |
| | | areaPolygon.setStyle({ |
| | | 'material': color, |
| | | 'height': 0.01, |
| | | }) |
| | | areaPolygon.attrParams = overlay.attrParams |
| | | areaPolygon.on(global.DC.MouseEventType.CLICK, this.$parent.lineOverlayTypeClick) |
| | | overlay.remove() |
| | | } |
| | | } |
| | | }, |
| | | |