Commit 44a337f3 authored by yuanchongyou's avatar yuanchongyou

stylev1

parent 015c12a8
...@@ -23,6 +23,7 @@ import SizeInput from './colorpage/SizeInput' ...@@ -23,6 +23,7 @@ import SizeInput from './colorpage/SizeInput'
export default { export default {
data() { data() {
return { return {
subObj:{},
visible: false, visible: false,
colorfill:{ colorfill:{
type:'stroke', type:'stroke',
...@@ -46,13 +47,17 @@ export default { ...@@ -46,13 +47,17 @@ export default {
if(item.type === 'stroke'){ if(item.type === 'stroke'){
this.colorfill.msg = item.msg this.colorfill.msg = item.msg
} }
this.$emit('styleLayer', item); let obj = {[item.type]:String(item.msg)}
Object.assign(this.subObj,obj)
this.$emit('styleLayer', this.subObj);
}, },
InputChange(item){ InputChange(item){
if(item.type === 'stroke-width'){ if(item.type === 'stroke-width'){
this.layerstroke.msg = item.msg this.layerstroke.msg = item.msg
} }
this.$emit('styleLayer', item); let obj = {[item.type]:String(item.msg)}
Object.assign(this.subObj,obj)
this.$emit('styleLayer', this.subObj);
} }
}, },
} }
......
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
}else{ }else{
this.layerradius.msg = item.msg this.layerradius.msg = item.msg
} }
let obj = {[item.type]:item.msg} let obj = {[item.type]:String(item.msg)}
Object.assign(this.subObj,obj) Object.assign(this.subObj,obj)
this.$emit('styleLayer', this.subObj); this.$emit('styleLayer', this.subObj);
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<simple-color :cfg="colorfill" @getColorfill="handleChange"></simple-color> <simple-color :cfg="colorfill" @getColorfill="handleChange"></simple-color>
</template> </template>
</a-popover> </a-popover>
<size-input label="注记大小" :cfg="layerstroke" :size="layerstroke.msg" :min="0" :max="5" :step="0.1" @getNumInput="InputChange"></size-input> <size-input label="注记大小" :cfg="layerstroke" :size="layerstroke.msg" :min="10" :max="25" :step="1" @getNumInput="InputChange"></size-input>
</div> </div>
</template> </template>
...@@ -24,6 +24,7 @@ import SizeInput from './colorpage/SizeInput' ...@@ -24,6 +24,7 @@ import SizeInput from './colorpage/SizeInput'
export default { export default {
data() { data() {
return { return {
subObj:{},
visible: false, visible: false,
colorfill:{ colorfill:{
type:'fill', type:'fill',
...@@ -31,7 +32,7 @@ export default { ...@@ -31,7 +32,7 @@ export default {
}, },
layerstroke:{ layerstroke:{
type:'size', type:'size',
msg:"0", msg:0,
} }
} }
}, },
...@@ -39,6 +40,9 @@ export default { ...@@ -39,6 +40,9 @@ export default {
SimpleColor, SimpleColor,
SizeInput SizeInput
}, },
mounted() {
this.textStyle()
},
methods: { methods: {
hide() { hide() {
this.visible = false; this.visible = false;
...@@ -49,15 +53,31 @@ export default { ...@@ -49,15 +53,31 @@ export default {
}else{ }else{
this.colorstroke.msg = item.msg this.colorstroke.msg = item.msg
} }
this.$emit('styleLayer', item); let obj = {[item.type]:item.msg}
Object.assign(this.subObj,obj)
this.$emit('styleLayer', this.subObj);
}, },
InputChange(item){ InputChange(item){
if(item.type === 'stroke-width'){ console.log(item,'注记')
if(item.type === 'size'){
this.layerstroke.msg = item.msg this.layerstroke.msg = item.msg
}else{ }else{
this.layerradius.msg = item.msg this.layerradius.msg = item.msg
} }
this.$emit('styleLayer', item); let obj = {[item.type]:String(item.msg)}
Object.assign(this.subObj,obj)
this.$emit('styleLayer', this.subObj);
},
textStyle(){
let a = 'face-name'
let b = 'Heiti SC Medium'
let obj = {[[a]]:b}
Object.assign(this.subObj,obj)
let c = 'allow-overlap'
let d = "true"
let obj2 = {[[c]]:d}
Object.assign(this.subObj,obj2)
this.$emit('styleLayer', this.subObj);
} }
}, },
} }
......
...@@ -5,10 +5,10 @@ Vue.use(Vuex) ...@@ -5,10 +5,10 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
layersData:['boul_g'], layersData:[],
layerStyle:{}, layerStyle:{},
setLayerStyle:{}, setLayerStyle:{},
addLayerData:['boul_g'] addLayerData:[]
}, },
mutations: { mutations: {
GET_LAYER_DATA(state,data){ GET_LAYER_DATA(state,data){
...@@ -19,6 +19,7 @@ export default new Vuex.Store({ ...@@ -19,6 +19,7 @@ export default new Vuex.Store({
}, },
SET_LAYER_STYLE(state,data){ SET_LAYER_STYLE(state,data){
Object.assign(state.setLayerStyle,data) Object.assign(state.setLayerStyle,data)
state.setLayerStyle = JSON.parse(JSON.stringify(state.setLayerStyle))
}, },
ADD_LAYER_DATA(state,data){ ADD_LAYER_DATA(state,data){
state.addLayerData = data state.addLayerData = data
...@@ -38,6 +39,11 @@ export default new Vuex.Store({ ...@@ -38,6 +39,11 @@ export default new Vuex.Store({
commit('ADD_LAYER_DATA', data) commit('ADD_LAYER_DATA', data)
} }
}, },
getters:{
showStyleLayer:state => {
return state.setLayerStyle
}
},
modules: { modules: {
} }
}) })
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
placement="right" placement="right"
:closable="true" :closable="true"
:visible="styleVisible" :visible="styleVisible"
:destroyOnClose="true"
:get-container="false" :get-container="false"
:wrap-style="{ position: 'absolute' }" :wrap-style="{ position: 'absolute' }"
@close="onClose" @close="onClose"
...@@ -127,17 +126,17 @@ export default { ...@@ -127,17 +126,17 @@ export default {
let _self= this let _self= this
let type let type
switch (this.endStyleLayer.type) { switch (this.endStyleLayer.type) {
case '点样式': case 'marker':
type = 'MarkersSymbolizer' type = 'MarkersSymbolizer'
break; break;
case '线样式': case 'line':
type = 'LineSymbolizer' type = 'LineSymbolizer'
break; break;
case '面样式': case 'Polygon':
type = 'PolygonSymbolizer' type = 'PolygonSymbolizer'
break; break;
case '注记样式': case 'text':
type = 'TextSymbolizet' type = 'TextSymbolizer'
break; break;
default: default:
break; break;
...@@ -151,9 +150,7 @@ export default { ...@@ -151,9 +150,7 @@ export default {
this.styleVisible = false this.styleVisible = false
}, },
styleData(item){ styleData(item){
if(item.type === ''){
item.type = this.drawerTitle.type item.type = this.drawerTitle.type
}
this.endStyleLayer = item this.endStyleLayer = item
}, },
showDeleteConfirm() { showDeleteConfirm() {
......
...@@ -18,7 +18,7 @@ import TileDebug from 'ol/source/TileDebug'; ...@@ -18,7 +18,7 @@ import TileDebug from 'ol/source/TileDebug';
import WMTSTileGrid from 'ol/tilegrid/WMTS'; import WMTSTileGrid from 'ol/tilegrid/WMTS';
import WMTS from 'ol/source/WMTS'; import WMTS from 'ol/source/WMTS';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
export default { export default {
data() { data() {
return { return {
...@@ -30,15 +30,17 @@ export default { ...@@ -30,15 +30,17 @@ export default {
this.initmap() this.initmap()
}, },
computed: { computed: {
...mapState(['layersData','setLayerStyle','addLayerData','setAddLayerStyle']), ...mapState(['layersData','setLayerStyle','addLayerData']),
...mapGetters(['showStyleLayer'])
}, },
watch:{ watch:{
setLayerStyle(val){ setLayerStyle(val){
console.log(val,'setLayerStyle')
let data = this.addLayerData let data = this.addLayerData
this.initbasemap.removeLayer(this.initbasemap.getLayers().array_[0]) this.initbasemap.removeLayer(this.initbasemap.getLayers().array_[0])
let mapXYZ = new WMTS({ let mapXYZ = new WMTS({
layer:data, layer:data,
style:JSON.stringify(val[1]), style:JSON.stringify(val),
tileGrid: this.tilegrid, tileGrid: this.tilegrid,
matrixSet:'alberts_china', matrixSet:'alberts_china',
format: 'image/png', format: 'image/png',
...@@ -48,13 +50,14 @@ export default { ...@@ -48,13 +50,14 @@ export default {
source: mapXYZ source: mapXYZ
}) })
this.initbasemap.addLayer(newLayer) this.initbasemap.addLayer(newLayer)
this.setaddlayerstyle(val[1])
}, },
addLayerData(val){ addLayerData(val){
let style = JSON.stringify(this.setLayerStyle)
//全选变动
this.initbasemap.removeLayer(this.initbasemap.getLayers().array_[0]) this.initbasemap.removeLayer(this.initbasemap.getLayers().array_[0])
let mapXYZ = new WMTS({ let mapXYZ = new WMTS({
layer:val, layer:val,
style:null, style:style,
tileGrid: this.tilegrid, tileGrid: this.tilegrid,
matrixSet:'alberts_china', matrixSet:'alberts_china',
format: 'image/png', format: 'image/png',
...@@ -66,10 +69,12 @@ export default { ...@@ -66,10 +69,12 @@ export default {
this.initbasemap.addLayer(newLayer) this.initbasemap.addLayer(newLayer)
}, },
layersData(val){ layersData(val){
let style = JSON.stringify(this.setLayerStyle)
//单个变动
this.initbasemap.removeLayer(this.initbasemap.getLayers().array_[0]) this.initbasemap.removeLayer(this.initbasemap.getLayers().array_[0])
let mapXYZ = new WMTS({ let mapXYZ = new WMTS({
layer:val, layer:val,
style:null, style:style,
tileGrid: this.tilegrid, tileGrid: this.tilegrid,
matrixSet:'alberts_china', matrixSet:'alberts_china',
format: 'image/png', format: 'image/png',
...@@ -82,7 +87,7 @@ export default { ...@@ -82,7 +87,7 @@ export default {
} }
}, },
methods: { methods: {
...mapActions(['clearlayerstyle','setaddlayerstyle']), ...mapActions(['clearlayerstyle']),
initmap(){ initmap(){
let _self = this let _self = this
//区域范围 //区域范围
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment