<template>
|
<div class="menuPop">
|
<div style="padding: 5px">
|
<el-form
|
:inline="true"
|
:model="ruleForm"
|
class="demo-form-inline"
|
>
|
<el-form-item>
|
<el-input
|
size="small"
|
style="width:47vh"
|
v-model="ruleForm.fileName"
|
disabled
|
placeholder="请输入..."
|
></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
@click="conditionVisible = true"
|
size="small"
|
type="success"
|
>新增</el-button>
|
<el-button
|
size="small"
|
@click="resetForm"
|
>重置</el-button>
|
</el-form-item>
|
<el-form-item v-if="spaceLayer == 'sexplorationpoint'">
|
<el-button
|
size="small"
|
@click="spaceHistogram( )"
|
plain
|
>柱状图</el-button>
|
<!-- <el-button
|
plain
|
size="small"
|
>剖切图</el-button> -->
|
</el-form-item>
|
</el-form>
|
<!-- <el-form
|
:inline="true"
|
:model="formInline"
|
class="demo-form-inline"
|
>
|
<el-form-item>
|
<el-select
|
v-model="formInline.name"
|
style="width: 150px"
|
placeholder="...."
|
@change="changeValue($event)"
|
>
|
<el-option
|
v-for="item in optionx"
|
:key="item.field"
|
:label="item.alias"
|
:value="item.field"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-select
|
v-model="formInline.region"
|
style="width: 100px"
|
placeholder="...."
|
>
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-input
|
style="width: 150px"
|
v-model="formInline.input"
|
placeholder="请输入..."
|
></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
size="small"
|
plain
|
@click="setSpaceTableLayer"
|
>查询</el-button>
|
<el-button
|
plain
|
size="small"
|
@click="restSpacePopLayer"
|
>重置</el-button>
|
</el-form-item>
|
|
<el-form-item v-if="spaceLayer == 'sexplorationpoint'">
|
<el-button
|
size="small"
|
@click="spaceHistogram( )"
|
plain
|
>柱状图</el-button>
|
<!-- <el-button
|
plain
|
size="small"
|
>剖切图</el-button>
|
</el-form-item>
|
</el-form> -->
|
<div class="centTable">
|
<el-table
|
:data="tableData"
|
border
|
height="100%"
|
ref="filterTable"
|
style="width: 100%"
|
>
|
<el-table-column
|
align="center"
|
type="index"
|
label="序号"
|
width="50"
|
/>
|
<el-table-column
|
label="定位"
|
width="100"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-button
|
icon="el-icon-map-location"
|
size="small"
|
@click="spaceLocation(scope.$index, scope.row)"
|
></el-button>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column
|
label="柱状图"
|
width="100"
|
align="center"
|
v-if="spaceLayer == 'sexplorationpoint'"
|
>
|
<template slot-scope="scope">
|
<el-button
|
icon="el-icon-map-location"
|
size="small"
|
@click="spaceHistogram(scope.$index, scope.row)"
|
></el-button>
|
</template>
|
</el-table-column> -->
|
<el-table-column
|
v-for="(item, index) in attributeData"
|
:key="index"
|
:label="item.alias"
|
:prop="item.field"
|
show-overflow-tooltip
|
align="center"
|
:fit="true"
|
></el-table-column>
|
</el-table>
|
</div>
|
|
<div class="bottomPage pagination_box">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="listdata.pageIndex"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="listdata.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
<el-dialog
|
:visible.sync="conditionVisible"
|
title="高级查询"
|
width="44%"
|
:close-on-click-modal="false"
|
:modal="false"
|
>
|
|
<el-form
|
:inline=" true"
|
:model="formSql"
|
class="demo-form-inline"
|
label-position="top"
|
>
|
|
<el-form-item>
|
<el-select
|
@change="fieldChange($event)"
|
v-model="formSql.field"
|
:popper-append-to-body="false"
|
>
|
<el-option
|
v-for="item in filedsOption"
|
:key="item.field"
|
:label="item.alias"
|
:value="item.field"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-select
|
:popper-append-to-body="false"
|
v-model="formSql.condition"
|
>
|
<el-option
|
v-for="item in condOption"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item v-show="!fromSqlflag">
|
<el-input v-model="formSql.value"></el-input>
|
</el-form-item>
|
<el-form-item v-show="fromSqlflag">
|
<el-date-picker
|
v-model="formSql.date"
|
type="date"
|
placeholder="选择日期"
|
value-format="yyyy-MM-dd"
|
>
|
</el-date-picker>
|
</el-form-item>
|
|
</el-form>
|
|
<span
|
slot="footer"
|
class="dialog-footer"
|
>
|
<el-button
|
size="small"
|
@click="startFiledAndcondition"
|
>取 消</el-button>
|
<el-button
|
class="primaries"
|
size="small"
|
@click="appendQueryFilter"
|
>确 定</el-button>
|
</span>
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import {
|
dataQuerySelectByPage,
|
dataQuerySelectWktById,
|
inquiry_selectFields,
|
inquiry_selectDomains,
|
decr,
|
encr,
|
} from "../../api/api.js"
|
import * as turf from "@turf/turf"
|
import { conditions } from "../../views/Archive/Archive.js";
|
export default {
|
computed: {
|
storeTime() {
|
return this.$store.state.mapSpaceQueryLayer
|
},
|
},
|
data() {
|
return {
|
conditionVisible: false,
|
filedsOption: [],
|
condOption: [],
|
ruleForm: {
|
fileName: "",
|
},
|
fromSqlflag: false,
|
count: 0,
|
listdata: {
|
pageIndex: 1,
|
pageSize: 10,
|
name: null,
|
srid: 4326,
|
wkt: null,
|
filter: null,
|
},
|
formInline: {
|
name: "",
|
region: "",
|
},
|
attributeData: [],
|
optionx: [],
|
options: [],
|
conditions: [
|
["=", "<>", "like"],
|
[">=", ">", " =", "<=", "<", "<>"],
|
[">=", ">", " =", "<=", "<", "<>"],
|
],
|
options1: [
|
{
|
value: "=",
|
label: "=",
|
},
|
{
|
value: "like",
|
label: "like",
|
},
|
{
|
value: "<>",
|
label: "<>",
|
},
|
],
|
options2: [
|
{
|
value: "=",
|
label: "=",
|
},
|
{
|
value: "<>",
|
label: "<>",
|
},
|
{
|
value: "<=",
|
label: "<=",
|
},
|
{
|
value: "<",
|
label: "<",
|
},
|
{
|
value: ">=",
|
label: ">=",
|
},
|
{
|
value: ">",
|
label: ">",
|
},
|
],
|
value: "",
|
tableData: [],
|
spaceLayer: "",
|
imagePoint: null,
|
domainsLayer: null,
|
querytype: null,
|
|
formSql: {
|
field: "",
|
condition: "",
|
value: "",
|
type: "",
|
date: "",
|
},
|
}
|
},
|
watch: {
|
async storeTime(index) {
|
this.spaceLayer = index
|
this.resetForm();
|
// this.getDomainsLayer()
|
// this.getTableselectFields();
|
// this.restSpacePopLayer();
|
},
|
},
|
created() {
|
this.spaceLayer = this.$store.state.mapSpaceQueryLayer
|
// this.showSpacePopLayer();
|
// this.getTableselectFields();
|
this.resetForm();
|
// this.getDomainsLayer()
|
},
|
|
methods: {
|
fieldChange(value) {
|
var obj = {};
|
obj = this.filedsOption.find(function (item) {
|
return item.field === value;
|
});
|
this.conditionChange(obj);
|
},
|
conditionChange(res) {
|
this.formSql.field = res.field;
|
this.formSql.type = res.type;
|
if (res.type == "date" || res.type == "datetime") {
|
this.fromSqlflag = true;
|
} else {
|
this.fromSqlflag = false;
|
}
|
var std = [];
|
this.condOption = [];
|
if (res.type == "text" || res.type == "blob") {
|
std = conditions[0];
|
} else if (res.type == "date" || res.type == "datetime") {
|
std = conditions[2];
|
} else {
|
std = conditions[1];
|
}
|
for (var i in std) {
|
this.condOption.push({
|
label: std[i],
|
value: std[i],
|
});
|
}
|
this.formSql.condition = this.condOption[0].value;
|
},
|
closeSpaceBox() {
|
if (this.imagePoint != null) {
|
sgworld.Creator.DeleteObject(this.imagePoint)
|
this.imagePoint = null
|
}
|
this.$store.state.mapPopBoolean = false
|
this.$store.state.mapPopBoxFlag = null
|
},
|
setSpaceTableLayer() {
|
this.setListDataStart()
|
this.getSpaceTableLayer()
|
},
|
restSpacePopLayer() {
|
this.formInline.input = null
|
this.showSpacePopLayer()
|
},
|
changeValue(value) {
|
var obj = {}
|
obj = this.optionx.find(function (item) {
|
return item.field === value
|
})
|
|
// if (obj.type == 'serial' || obj.type == 'int') {
|
// this.options = this.options2;
|
// } else {
|
// this.options = this.options1;
|
// }
|
this.options = []
|
|
var std = []
|
this.querytype = obj.type
|
if (obj.type == "text" || obj.type == "blob") {
|
std = this.conditions[0]
|
} else if (obj.type == "date" || obj.type == "datetime") {
|
std = this.conditions[2]
|
} else {
|
std = this.conditions[1]
|
}
|
for (var i in std) {
|
this.options.push({
|
label: std[i],
|
value: std[i],
|
})
|
}
|
|
this.formInline.region = this.options[0].value
|
},
|
setListDataStart() {
|
this.listdata.pageSize = 10
|
this.listdata.pageIndex = 1
|
this.tableData = []
|
},
|
//初始化查询条件
|
showSpacePopLayer() {
|
let val_date = this.optionx[0]
|
if (val_date == null || val_date == undefined) {
|
return
|
}
|
this.formInline.name = val_date.field
|
this.options = []
|
var std = []
|
this.querytype = val_date.type
|
if (val_date.type == "text" || val_date.type == "blob") {
|
std = this.conditions[0]
|
} else if (val_date.type == "date" || val_date.type == "datetime") {
|
std = this.conditions[2]
|
} else {
|
std = this.conditions[1]
|
}
|
for (var i in std) {
|
this.options.push({
|
label: std[i],
|
value: std[i],
|
})
|
}
|
|
this.formInline.region = this.options[0].value
|
this.getSpaceTableLayer()
|
},
|
//初始化查询表的字段
|
async getTableselectFields() {
|
const data = await inquiry_selectFields({ name: this.spaceLayer })
|
if (data.code != 200) {
|
this.$message.error("列表调用失败")
|
}
|
this.filedsOption = [];
|
this.optionx = []
|
var valadata = data.result
|
for (var i in valadata) {
|
if (valadata[i].showtype == 1) {
|
if (
|
valadata[i].domainNa != null &&
|
valadata[i].domainNa != undefined
|
) {
|
valadata[i].domainNa = this.getMatchDomainNa(valadata[i].domainNa)
|
}
|
this.optionx.push(valadata[i])
|
this.filedsOption.push(valadata[i])
|
this.attributeData.push(valadata[i])
|
}
|
}
|
this.startFiledAndcondition();
|
this.showSpacePopLayer()
|
},
|
appendQueryFilter() {
|
if (this.formSql.type == "date" || this.formSql.type == "datetime") {
|
if (this.formSql.date == null) {
|
this.$message.error("请输入要查询的信息!");
|
return;
|
}
|
} else {
|
if (this.formSql.value == "") {
|
this.$message.error("请输入要查询的信息!");
|
return;
|
}
|
}
|
|
if (this.ruleForm.fileName != "") {
|
this.ruleForm.fileName += " and ";
|
}
|
var val;
|
|
if (this.formSql.type == "long" || this.formSql.type == "integer") {
|
val = parseInt(this.formSql.value);
|
} else if (this.formSql.type == "double") {
|
if (this.formSql.value.indexOf(".") != -1) {
|
val = this.formSql.value;
|
} else {
|
val = parseFloat(this.formSql.value).toFixed(1);
|
}
|
} else if (
|
this.formSql.type == "date" ||
|
this.formSql.type == "datetime"
|
) {
|
var time = new Date(this.formSql.date);
|
var m = time.getMonth() + 1;
|
var d = time.getDate();
|
var y = time.getFullYear();
|
val = "'" + y + "-" + this.add0(m) + "-" + this.add0(d) + "'";
|
} else {
|
val = "'" + this.formSql.value + "'";
|
}
|
this.ruleForm.fileName +=
|
this.formSql.field + " " + this.formSql.condition + " " + val;
|
|
this.startFiledAndcondition();
|
this.getSpaceTableLayer();
|
},
|
|
startFiledAndcondition() {
|
this.conditionVisible = false;
|
this.conditionChange(this.filedsOption[0]);
|
this.formSql.value = "";
|
this.formSql.date = new Date();
|
},
|
getMatchDomainNa(res) {
|
var std = null
|
for (var i in this.domainsLayer) {
|
if (this.domainsLayer[i].domName == res) {
|
return (std = this.domainsLayer[i].codeDesc)
|
}
|
}
|
return std
|
},
|
//初始化查询阈值表
|
async getDomainsLayer() {
|
const data = await inquiry_selectDomains({ name: this.spaceLayer })
|
if (data.code != 200) {
|
this.$message.error("列表调用失败")
|
}
|
this.domainsLayer = data.result
|
|
this.setListDataStart()
|
this.getTableselectFields()
|
},
|
|
|
|
resetForm() {
|
this.ruleForm.fileName = "";
|
this.listdata.pageIndex = 1;
|
this.listdata.pageSize = 10;
|
//获取table信息
|
this.getDomainsLayer()
|
},
|
|
//初始化查询表格信息
|
async getSpaceTableLayer() {
|
|
this.listdata.name = this.spaceLayer
|
if (this.ruleForm.fileName != "") {
|
this.listdata.filter = this.ruleForm.fileName;
|
} else {
|
this.listdata.filter = null;
|
}
|
|
|
const data = await dataQuerySelectByPage(this.listdata)
|
if (data.code != 200) {
|
this.$message.error("列表调用失败")
|
}
|
var val = data.result;
|
val = val.filter((res) => {
|
|
if (res.dirName) {
|
res.dirid = res.dirName
|
}
|
if (res.depName) {
|
res.depid = res.depName
|
}
|
if (res.verName) {
|
res.verid = res.verName
|
}
|
if (res.updateName) {
|
res.updateuser = res.updateName
|
}
|
if (res.createName) {
|
res.createuser = res.createName
|
}
|
|
if (res.createtime) {
|
res.createtime = this.format(res.createtime)
|
}
|
if (res.updatetime) {
|
res.createtime = this.format(res.updatetime)
|
}
|
return res
|
})
|
|
|
var val_Data = data.result
|
this.count = data.count
|
|
for (var i in val_Data) {
|
var valste = val_Data[i]
|
for (var j in this.optionx) {
|
if (
|
this.optionx[j].domainNa != null &&
|
this.optionx[j].domainNa != undefined
|
) {
|
valste[this.optionx[j].field] = this.optionx[j].domainNa
|
}
|
}
|
}
|
|
|
this.tableData = val
|
this.$refs.filterTable.doLayout()
|
},
|
|
async setCartesianToEightFour(entities) {
|
var east = Cesium.Math.toDegrees(
|
entities.rectangle.coordinates.getValue().east
|
);
|
var north = Cesium.Math.toDegrees(
|
entities.rectangle.coordinates.getValue().north
|
);
|
var west = Cesium.Math.toDegrees(
|
entities.rectangle.coordinates.getValue().west
|
);
|
var south = Cesium.Math.toDegrees(
|
entities.rectangle.coordinates.getValue().south
|
);
|
var line = turf.polygon([
|
[
|
[east, north],
|
[west, north],
|
[west, south],
|
[east, south],
|
[east, north],
|
],
|
]);
|
var wkt = this.$wkt.convert(line.geometry);
|
this.listdata.pageIndex = 1;
|
this.listdata.pageSize = 10;
|
this.listdata.wkt = encr(wkt)
|
|
const data = await dataQuerySelectByPage(this.listdata)
|
|
if (data.code != 200) {
|
return this.$message.error("列表调用失败")
|
}
|
|
this.count = data.count;
|
if (data.result.length == 0) {
|
return this.$message({
|
message: '未查询到转孔点数据',
|
type: 'warning'
|
});
|
} else {
|
this.$message({
|
message: '柱状图查询成功',
|
type: 'success'
|
});
|
setTimeout(() => {
|
var val = data.result;
|
val = val.filter((res) => {
|
|
if (res.dirName) {
|
res.dirid = res.dirName
|
}
|
if (res.depName) {
|
res.depid = res.depName
|
}
|
if (res.verName) {
|
res.verid = res.verName
|
}
|
if (res.updateName) {
|
res.updateuser = res.updateName
|
}
|
if (res.createName) {
|
res.createuser = res.createName
|
}
|
|
if (res.createtime) {
|
res.createtime = this.format(res.createtime)
|
}
|
if (res.updatetime) {
|
res.createtime = this.format(res.updatetime)
|
}
|
return res
|
})
|
|
|
|
this.tableData = val;
|
|
this.showHistogramLayer(data.count)
|
this.$refs.filterTable.doLayout();
|
var that = this;
|
|
window.histogramHandler = new Cesium.ScreenSpaceEventHandler(
|
sgworld.Viewer.scene.canvas
|
)
|
window.histogramHandler.setInputAction((event) => {
|
var pick = sgworld.Viewer.scene.pick(event.endPosition);
|
|
var propertiesFlag = that.$store.state.propertiesFlag
|
|
if (Cesium.defined(pick)) {
|
if (pick && pick.id && pick.id.tag && pick.id.tag == "Histogram") {
|
that.$store.state.propertiesInfo = {
|
title: pick.id.properties._exppointid._value,
|
name: pick.id.properties._geoname._value,
|
type: pick.id.properties.geotype._value,
|
botdepth: pick.id.properties._botdepth._value,
|
describe: pick.id.properties._describe._value,
|
}
|
that.$store.state.propertiesFlag = "2"
|
} else {
|
if (propertiesFlag == 1) {
|
that.$store.state.propertiesFlag = propertiesFlag
|
} else {
|
that.$store.state.propertiesFlag = null
|
}
|
}
|
} else {
|
if (propertiesFlag == 1) {
|
that.$store.state.propertiesFlag = propertiesFlag
|
} else {
|
that.$store.state.propertiesFlag = null
|
}
|
}
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
|
}, 500);
|
}
|
|
|
},
|
async showHistogramLayer(res) {
|
var obj = {
|
pageIndex: 1,
|
pageSize: res,
|
wkt: this.listdata.wkt,
|
name: this.listdata.name
|
}
|
const data = await dataQuerySelectByPage(obj)
|
if (data.code != 200) {
|
return
|
}
|
var val = data.result;
|
for (var i in val) {
|
this.setShowHistogramLayer(val[i])
|
}
|
},
|
async setShowHistogramLayer(res) {
|
var param = {
|
gid: res.gid,
|
name: this.spaceLayer,
|
}
|
const data1 = await dataQuerySelectWktById(param)
|
if (data1.code != 200) {
|
this.$message.error("列表调用失败")
|
}
|
var val1 = decr(data1.result)
|
var wkt = this.$wkt.parse(val1)
|
var coord = wkt.coordinates
|
var obj = {
|
pageIndex: 1,
|
pageSize: 10,
|
name: 'sexplorationpointstratum',
|
filter: "exppointid = '" + res.exppointid + "'"
|
}
|
var data = await dataQuerySelectByPage(obj)
|
if (data.code != 200) { return }
|
if (data.result.length != 0) {
|
var val = data.result;
|
//冒泡排序
|
for (var i = 0; i < val.length; i++) {
|
for (var u = i + 1; u < val.length; u++) {
|
if (val[i].botdepth > val[u].botdepth) {
|
var num = val[i];
|
val[i] = val[u];
|
val[u] = num;
|
}
|
}
|
}
|
|
var outlineList = [
|
{ 'name': '粉质黏土', 'color': 'rgba(139,106,77,1)' },
|
{ 'name': '淤泥质粉土', 'color': 'rgba(141,85,69,1)' },
|
{ 'name': '圆砾', 'color': 'rgba(102,166,184,1)' },
|
{ 'name': '卵石', 'color': 'rgba(54,83,173,1)' },
|
{ 'name': '泥岩', 'color': 'rgba(47,30,13,1)' },
|
{ 'name': '细砂', 'color': 'rgba(93,88,15,1)' },
|
{ 'name': '中砂', 'color': 'rgba(164,140,21,1)' }
|
]
|
var num = res.elev;
|
var height = 0;
|
for (var i = 0; i < val.length; i++) {
|
var line;
|
|
var geoname = val[i].geoname;
|
var col = outlineList.filter((res) => {
|
if (res.name == geoname) {
|
return res
|
}
|
})
|
|
line = col[0].color
|
|
var height = num - val[i].botdepth
|
var layer = Viewer.entities.add({
|
position: Cesium.Cartesian3.fromDegrees(coord[0], coord[1]),
|
tag: 'Histogram',
|
properties: val[i],
|
ellipse: {
|
semiMinorAxis: 1.0, //短轴
|
semiMajorAxis: 1.0, //长轴
|
height: height, //拉伸高度 elev gwaterdep
|
extrudedHeight: num, //离地高度
|
rotation: Cesium.Math.toRadians(0), //旋转
|
fill: true, //是否显示圆的填充
|
material: Cesium.Color.fromCssColorString(line), //圆的颜色,
|
outline: false, //是否显示圆轮廓
|
|
},
|
});
|
num -= val[i].botdepth;
|
this.$store.state.histogramLayer.push(layer)
|
}
|
}
|
this.$store.state.histLenged = true;
|
},
|
|
|
|
|
spaceHistogram() {
|
this.resetForm();
|
if (this.$store.state.histogramLayer.length != 0) {
|
for (var i in this.$store.state.histogramLayer) {
|
Viewer.entities.remove(this.$store.state.histogramLayer[i])
|
}
|
}
|
if (window.histogramHandler != null && Cesium.defined(window.histogramHandler)) {
|
window.histogramHandler.removeInputAction(
|
Cesium.ScreenSpaceEventType.MOUSE_MOVE
|
)
|
window.histogramHandler = null
|
}
|
var that = this;
|
sgworld.Creator.createSimpleGraphic('rectangle', { showSize: false }, function (entity) {
|
sgworld.Creator.SimpleGraphic.remove(entity.id);
|
that.setCartesianToEightFour(entity)
|
});
|
|
},
|
async spaceLocation(index, row) {
|
var param = {
|
gid: row.gid,
|
name: this.spaceLayer,
|
}
|
const data = await dataQuerySelectWktById(param)
|
if (data.code != 200) {
|
this.$message.error("列表调用失败")
|
}
|
|
var val1 = decr(data.result)
|
if (val1) {
|
if (this.$store.state.primitLayer != null) {
|
sgworld.Viewer.entities.remove(this.$store.state.primitLayer)
|
sgworld.Creator.DeleteObject(this.$store.state.primitLayer)
|
this.$store.state.primitLayer = null
|
}
|
var wkt = this.$wkt.parse(val1)
|
|
this.setMapLoaction(wkt, row)
|
}
|
},
|
handleSizeChange(val) {
|
this.listdata.pageSize = val
|
this.getSpaceTableLayer()
|
},
|
handleCurrentChange(val) {
|
this.listdata.pageIndex = val
|
this.getSpaceTableLayer()
|
},
|
setMapLoaction(res, properties) {
|
if (this.$store.state.primitLayer != null) {
|
sgworld.Creator.DeleteObject(this.$store.state.primitLayer)
|
// this.$store.state.primitLayer = null;
|
sgworld.Viewer.entities.remove(this.$store.state.primitLayer)
|
this.$store.state.primitLayer = null
|
}
|
var coord = res.coordinates
|
|
switch (res.type) {
|
case "Point":
|
var val = Cesium.Cartesian3.fromDegrees(
|
res.coordinates[0],
|
res.coordinates[1]
|
)
|
var point = Viewer.entities.add({
|
properties: properties,
|
tag: "properties_point",
|
position: val,
|
billboard: {
|
// 图像地址,URI或Canvas的属性
|
image: SmartEarthRootUrl + "Workers/image/mark.png",
|
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
// 大小是否以米为单位
|
sizeInMeters: false,
|
// 相对于坐标的垂直位置
|
verticalOrigin: Cesium.VerticalOrigin.CENTER,
|
// 相对于坐标的水平位置
|
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
|
// 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。
|
scale: 1.0,
|
// 是否显示
|
show: true,
|
},
|
})
|
point.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY
|
this.$store.state.queryInfo.push(point)
|
sgworld.Navigate.flyToObj(point)
|
this.$store.state.primitLayer = point
|
|
break
|
case "LineString":
|
case "MultiLineString":
|
var line = res.coordinates[0]
|
var std = []
|
for (var i in line) {
|
std.push(line[i][0], line[i][1])
|
}
|
var polyline = Viewer.entities.add({
|
properties: properties,
|
tag: "properties_line",
|
polyline: {
|
positions: Cesium.Cartesian3.fromDegreesArray(std),
|
width: 5,
|
material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
|
clampToGround: true,
|
},
|
})
|
this.$store.state.queryInfo.push(polyline)
|
sgworld.Navigate.flyToObj(polyline)
|
this.$store.state.primitLayer = polyline
|
break
|
case "MultiPolygon":
|
var val = res.coordinates[0][0]
|
var std = []
|
for (var i in val) {
|
std.push(val[i][0], val[i][1])
|
}
|
var entity = Viewer.entities.add({
|
properties: properties,
|
tag: "properties_polygon",
|
polygon: {
|
hierarchy: Cesium.Cartesian3.fromDegreesArray(std),
|
//height : 100000,
|
material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
|
outline: true,
|
outlineColor: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
|
},
|
})
|
this.$store.state.queryInfo.push(entity)
|
sgworld.Navigate.flyToObj(entity)
|
this.$store.state.primitLayer = entity
|
break
|
}
|
this.setMapHandler()
|
},
|
setMapHandler() {
|
var that = this;
|
window.propertieshandler = new Cesium.ScreenSpaceEventHandler(
|
sgworld.Viewer.scene.canvas
|
)
|
window.propertieshandler.setInputAction(event => {
|
let pick = sgworld.Viewer.scene.pick(event.position)
|
if (
|
pick &&
|
pick.id &&
|
pick.id.tag &&
|
pick.id.tag.includes("properties_")
|
) {
|
this.$store.state.propertiesFlag = "1"
|
let properties = pick.id.properties
|
let propertyNames = pick.id.properties.propertyNames
|
let obj = {}
|
obj["eventid"] = properties["_eventid"]._value
|
//
|
this.attributeData.forEach(item => {
|
propertyNames.forEach(itemElement => {
|
if (itemElement == item.field) {
|
obj[item.alias] = properties[itemElement]._value
|
}
|
})
|
})
|
if (obj['更新时间']) {
|
obj['更新时间'] = that.format(obj['更新时间'])
|
}
|
if (obj['创建时间']) {
|
|
|
obj['创建时间'] = that.format(obj['创建时间'])
|
}
|
|
this.$store.state.propertiesInfo = obj
|
}
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
|
},
|
//格式化时间
|
format(shijianchuo) {
|
//shijianchuo是整数,否则要parseInt转换
|
var time = new Date(shijianchuo);
|
var y = time.getFullYear();
|
var m = time.getMonth() + 1;
|
var d = time.getDate();
|
var h = time.getHours();
|
var mm = time.getMinutes();
|
var s = time.getSeconds();
|
return y + "-" + this.add0(m) + "-" + this.add0(d);
|
},
|
//格式化时间
|
add0(m) {
|
return m < 10 ? "0" + m : m;
|
},
|
|
},
|
|
destroyed() {
|
this.$store.state.propertiesFlag = null
|
if (window.propertieshandler != null && Cesium.defined(window.propertieshandler)) {
|
window.propertieshandler.removeInputAction(
|
Cesium.ScreenSpaceEventType.LEFT_CLICK
|
)
|
window.propertieshandler = null
|
}
|
},
|
}
|
</script>
|
|
<style lang="less" scoped>
|
.menuPop {
|
width: calc(100% - 1px);
|
height: calc(100% - 1px);
|
margin: 0;
|
padding: 0;
|
overflow: hidden;
|
border: 1px solid gray;
|
float: left;
|
.centTable {
|
position: absolute;
|
height: 66%;
|
width: 98%;
|
}
|
.rightTitle {
|
padding: 5px;
|
|
width: 100%;
|
.boxClose {
|
float: right;
|
margin-right: 20px;
|
}
|
}
|
.bottomPage {
|
position: absolute;
|
bottom: 3%;
|
}
|
/deep/.el-form-item {
|
margin-bottom: 0px;
|
}
|
}
|
</style>
|