diff --git a/src/views/gasOverview/gasOverviewSimple.vue b/src/views/gasOverview/gasOverviewSimple.vue index c7cfc9c..0084ad9 100644 --- a/src/views/gasOverview/gasOverviewSimple.vue +++ b/src/views/gasOverview/gasOverviewSimple.vue @@ -398,15 +398,50 @@ }) }, // 初始化街道、流向线 + // async initDrawLines() { + // axios.get('./static/position.json').then((result) => { + // const positions = result.data.positions + // flow = new mars3d.layer.GraphicLayer() + // window.map.addLayer(flow) + // street = new mars3d.layer.GraphicLayer() + // window.map.addLayer(street) + // for (let j = 0; j < positions.length; j++) { + // flow.addGraphic(this.addFlow(positions[j].items, positions[j].repeat)) + // street.addGraphic(this.addStreet(positions[j].items)) + // } + // flow.show = false + // }).catch((error) => { + // console.log('get position error...' + error) + // }) + // }, + // 流向线 + // addFlow(positions, repeat) { + // console.log(positions, repeat, '====---1230') + // var style = { + // width: 10, + // material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + // color: '#215bd9', + // repeat: new Cesium.Cartesian2(repeat, 1), + // image: '../static/images/line.png', + // speed: 15 + // }) + // } + // var graphic = new mars3d.graphic.PolylineEntity({ + // positions: positions, + // style: style + // }) + // return graphic + // }, + // 初始化街道、流向线 async initDrawLines() { - axios.get('./static/position.json').then((result) => { + axios.get('./static/position2.json').then((result) => { const positions = result.data.positions flow = new mars3d.layer.GraphicLayer() window.map.addLayer(flow) street = new mars3d.layer.GraphicLayer() window.map.addLayer(street) for (let j = 0; j < positions.length; j++) { - flow.addGraphic(this.addFlow(positions[j].items, positions[j].repeat)) + flow.addGraphic(this.addFlow(positions[j].items, positions[j].type)) street.addGraphic(this.addStreet(positions[j].items)) } flow.show = false @@ -414,6 +449,57 @@ console.log('get position error...' + error) }) }, + // 流向线 + addFlow(positions, repeat) { + console.log(positions, repeat, '====---1230') + var style = {} + if (repeat === 1) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'red', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } else if (repeat === 2) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'cyan', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } else if (repeat === 3) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'yellow', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } else if (repeat === 4) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'green', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } + var graphic = new mars3d.graphic.PolylineEntity({ + positions: positions, + style: style + }) + return graphic + }, // 初始化井,设备 async initPoints() { this.wellMode() @@ -465,6 +551,7 @@ } }) }, + // 远程水表(不展示) watchModel() { const params = '13' getMapping(params, this.listQuery.keywords).then(response => { @@ -658,23 +745,6 @@ } }) }, - // 流向线 - addFlow(positions, repeat) { - var style = { - width: 10, - material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { - color: '#217bd9', - repeat: new Cesium.Cartesian2(repeat, 1), - image: '../static/images/line.png', - speed: 15 - }) - } - var graphic = new mars3d.graphic.PolylineEntity({ - positions: positions, - style: style - }) - return graphic - }, // 道路线 addStreet(positions) { var graphic = new mars3d.graphic.PolylineEntity({ diff --git a/src/views/gasOverview/gasOverviewSimple.vue b/src/views/gasOverview/gasOverviewSimple.vue index c7cfc9c..0084ad9 100644 --- a/src/views/gasOverview/gasOverviewSimple.vue +++ b/src/views/gasOverview/gasOverviewSimple.vue @@ -398,15 +398,50 @@ }) }, // 初始化街道、流向线 + // async initDrawLines() { + // axios.get('./static/position.json').then((result) => { + // const positions = result.data.positions + // flow = new mars3d.layer.GraphicLayer() + // window.map.addLayer(flow) + // street = new mars3d.layer.GraphicLayer() + // window.map.addLayer(street) + // for (let j = 0; j < positions.length; j++) { + // flow.addGraphic(this.addFlow(positions[j].items, positions[j].repeat)) + // street.addGraphic(this.addStreet(positions[j].items)) + // } + // flow.show = false + // }).catch((error) => { + // console.log('get position error...' + error) + // }) + // }, + // 流向线 + // addFlow(positions, repeat) { + // console.log(positions, repeat, '====---1230') + // var style = { + // width: 10, + // material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + // color: '#215bd9', + // repeat: new Cesium.Cartesian2(repeat, 1), + // image: '../static/images/line.png', + // speed: 15 + // }) + // } + // var graphic = new mars3d.graphic.PolylineEntity({ + // positions: positions, + // style: style + // }) + // return graphic + // }, + // 初始化街道、流向线 async initDrawLines() { - axios.get('./static/position.json').then((result) => { + axios.get('./static/position2.json').then((result) => { const positions = result.data.positions flow = new mars3d.layer.GraphicLayer() window.map.addLayer(flow) street = new mars3d.layer.GraphicLayer() window.map.addLayer(street) for (let j = 0; j < positions.length; j++) { - flow.addGraphic(this.addFlow(positions[j].items, positions[j].repeat)) + flow.addGraphic(this.addFlow(positions[j].items, positions[j].type)) street.addGraphic(this.addStreet(positions[j].items)) } flow.show = false @@ -414,6 +449,57 @@ console.log('get position error...' + error) }) }, + // 流向线 + addFlow(positions, repeat) { + console.log(positions, repeat, '====---1230') + var style = {} + if (repeat === 1) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'red', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } else if (repeat === 2) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'cyan', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } else if (repeat === 3) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'yellow', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } else if (repeat === 4) { + style = { + width: 10, + material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { + color: 'green', + repeat: new Cesium.Cartesian2(repeat, 1), + image: '../static/images/line.png', + speed: 15 + }) + } + } + var graphic = new mars3d.graphic.PolylineEntity({ + positions: positions, + style: style + }) + return graphic + }, // 初始化井,设备 async initPoints() { this.wellMode() @@ -465,6 +551,7 @@ } }) }, + // 远程水表(不展示) watchModel() { const params = '13' getMapping(params, this.listQuery.keywords).then(response => { @@ -658,23 +745,6 @@ } }) }, - // 流向线 - addFlow(positions, repeat) { - var style = { - width: 10, - material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { - color: '#217bd9', - repeat: new Cesium.Cartesian2(repeat, 1), - image: '../static/images/line.png', - speed: 15 - }) - } - var graphic = new mars3d.graphic.PolylineEntity({ - positions: positions, - style: style - }) - return graphic - }, // 道路线 addStreet(positions) { var graphic = new mars3d.graphic.PolylineEntity({ diff --git a/static/position2.json b/static/position2.json new file mode 100644 index 0000000..35ce16e --- /dev/null +++ b/static/position2.json @@ -0,0 +1,172 @@ +{ + "positions": [ + { + "repeat": 1, + "type": 1, + "items": [ + [ + 120.24157461391228, + 35.987955250509984 + ], + [ + 120.24363848230408, + 35.98737610000488 + ] + ] + }, + { + "repeat": 1, + "type": 1, + "items": [ + [ + 120.24363848230408, + 35.98737610000488 + ], + [ + 120.24336324951909, + 35.98671934706044 + ] + ] + }, + { + "repeat": 1, + "type": 2, + "items": [ + [ + 120.24156050317183, + 35.98791847706515 + ], + [ + 120.24361221744445, + 35.98734680458454 + ] + ] + }, + { + "repeat": 1, + "type": 2, + "items": [ + [ + 120.24361221744445, + 35.98734680458454 + ], + [ + 120.24333793925, + 35.98673085172822 + ] + ] + }, + { + "repeat": 1, + "type": 3, + "items": [ + [ + 120.24155066841334, + 35.98788084842396 + ], + [ + 120.24357989146338, + 35.98733367215473 + ] + ] + }, + { + "repeat": 1, + "type": 3, + "items": [ + [ + 120.24357989146338, + 35.98733367215473 + ], + [ + 120.24332068224837, + 35.986737754528875 + ] + ] + }, + { + "repeat": 1, + "type": 4, + "items": [ + [ + 120.24153613007465, + 35.987844930175534 + ], + [ + 120.24355463679065, + 35.98732306519218 + ] + ] + }, + { + "repeat": 1, + "type": 4, + "items": [ + [ + 120.24355463679065, + 35.98732306519218 + ], + [ + 120.24330342524668, + 35.98674350686276 + ] + ] + }, + { + "repeat": 1, + "type": 1, + "items": [ + [ + 120.24262705949974, + 35.98508760781299 + ], + [ + 120.24217325929192, + 35.98397853421379 + ] + ] + }, + { + "repeat": 1, + "type": 2, + "items": [ + [ + 120.24268139412084, + 35.98507044951159 + ], + [ + 120.24221671458702, + 35.983964049115414 + ] + ] + }, + { + "repeat": 1, + "type": 3, + "items": [ + [ + 120.2427214301575, + 35.985056150927086 + ], + [ + 120.2422456847838, + 35.983952461036715 + ] + ] + }, + { + "repeat": 1, + "type": 4, + "items": [ + [ + 120.2427686154864, + 35.985044712059455 + ], + [ + 120.24228334603956, + 35.983946666997376 + ] + ] + } + ] +} \ No newline at end of file