@mapgis/webclient-common 17.2.6 → 17.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2142,7 +2142,7 @@ const lineString = new Feature({
2142
2142
  //可填空或者和数据库中的表结构一一对应
2143
2143
  attributes: {},
2144
2144
  //可填空或者和系统库中的样式一一对应
2145
- symbol: {},
2145
+ styleInfo: {},
2146
2146
  //设置几何
2147
2147
  geometry: new zondy.geometry.LineString({
2148
2148
  coordinates: [
@@ -2206,21 +2206,7 @@ resourceServer.queryGDBPInfo({
2206
2206
  "mpLayer": "0"
2207
2207
  },
2208
2208
  //设置样式
2209
- symbol: {
2210
- SymID": 43,
2211
- SymHeight": 3.200000047683716,
2212
- SymWidth": 3.200000047683716,
2213
- Angle": 0,
2214
- Color": 1467,
2215
- Color1": 4,
2216
- Color2": 3,
2217
- Space": 1,
2218
- OutPenW": [
2219
- 0.1,
2220
- 0.05,
2221
- 0.05
2222
- ]
2223
- }
2209
+ styleInfo: {}
2224
2210
  })
2225
2211
  // 创建新增要素的结构体
2226
2212
  const featureSet = {
@@ -2285,21 +2271,7 @@ resourceServer.queryGDBPInfo({
2285
2271
  "mpLayer": "0"
2286
2272
  },
2287
2273
  // 设置样式
2288
- symbol: {
2289
- "SymID": 43,
2290
- "SymHeight": 3.200000047683716,
2291
- "SymWidth": 3.200000047683716,
2292
- "Angle": 0,
2293
- "Color": 1467,
2294
- "Color1": 4,
2295
- "Color2": 3,
2296
- "Space": 1,
2297
- "OutPenW": [
2298
- 0.1,
2299
- 0.05,
2300
- 0.05
2301
- ]
2302
- }
2274
+ styleInfo: {}
2303
2275
  })
2304
2276
 
2305
2277
  // 创建新增要素的结构体
@@ -6941,8 +6913,6 @@ import { Feature } from "@mapgis/webclient-common"
6941
6913
  const lineString = new Feature({
6942
6914
  // 更新要素时需要传一个FID来指定要素,其他的属性值可以根据需求来盖面
6943
6915
  attributes: { FID:'0' },
6944
- // 更新样式
6945
- symbol: {},
6946
6916
  // 更新几何,注意几何一定要是GDBP表对应的几何类型
6947
6917
  geometry: new LineString({
6948
6918
  coordinates: [
@@ -7001,22 +6971,6 @@ resourceServer.queryGDBPInfo({
7001
6971
  "CODE": "1",
7002
6972
  "NAME": "新的神龙架林区",
7003
6973
  "mpLayer": "0"
7004
- },
7005
- //更新样式
7006
- symbol: {
7007
- SymID": 43,
7008
- SymHeight": 3.200000047683716,
7009
- SymWidth": 3.200000047683716,
7010
- Angle": 0,
7011
- Color": 1467,
7012
- Color1": 4,
7013
- Color2": 3,
7014
- Space": 1,
7015
- OutPenW": [
7016
- 0.1,
7017
- 0.05,
7018
- 0.05
7019
- ]
7020
6974
  }
7021
6975
  })
7022
6976
  // 创建更新要素的结构体
@@ -7081,22 +7035,6 @@ resourceServer.queryGDBPInfo({
7081
7035
  "CODE": "0",
7082
7036
  "Name": "多点",
7083
7037
  "mpLayer": "0"
7084
- },
7085
- // 更新样式
7086
- symbol: {
7087
- "SymID": 43,
7088
- "SymHeight": 3.200000047683716,
7089
- "SymWidth": 3.200000047683716,
7090
- "Angle": 0,
7091
- "Color": 1467,
7092
- "Color1": 4,
7093
- "Color2": 3,
7094
- "Space": 1,
7095
- "OutPenW": [
7096
- 0.1,
7097
- 0.05,
7098
- 0.05
7099
- ]
7100
7038
  }
7101
7039
  })
7102
7040
 
@@ -7129,6 +7067,87 @@ resourceServer.queryGDBPInfo({
7129
7067
  })</code></pre>
7130
7068
 
7131
7069
 
7070
+ <p class="code-caption"><h5>更新要素样式</h5></p>
7071
+
7072
+
7073
+ <pre class="prettyprint"><code>// ES5引入方式
7074
+ const { ResourceServer, FeatureServer } = zondy.service
7075
+ const { Polygon } = zondy.geometry
7076
+ const { Feature } = zondy
7077
+ // ES6引入方式
7078
+ import { ResourceServer, FeatureServer, Polygon, Feature } from "@mapgis/webclient-common"
7079
+
7080
+ // 初始化资源服务对象
7081
+ const resourceServer = new ResourceServer({
7082
+ url: 'http://{ip}:{port}/igs/rest/services/system/ResourceServer'
7083
+ })
7084
+
7085
+ // 初始化要素服务对象
7086
+ const featureServer = new FeatureServer({
7087
+ url: 'http://{ip}:{port}/igs/rest/services/{要素服务名}/FeatureServer'
7088
+ })
7089
+
7090
+ // 查询要素图层信息
7091
+ featureServer.queryLayerInfo({
7092
+ // 要素图层ID
7093
+ layerId: '0'
7094
+ }).then(function (layerInfo) {
7095
+ // 通过gdbp地址查询系统库
7096
+ resourceServer.queryTempDataInfo({
7097
+ // gdbp地址
7098
+ url: layerInfo.data.url
7099
+ }).then(function (tempDataInfo) {
7100
+ // 获取系统库名称
7101
+ const systemLibGuid = tempDataInfo.data.systemLibGuid
7102
+ // 查询要素
7103
+ featureServer.queryFeaturesInLayers({
7104
+ // 图层id
7105
+ layerId: '0',
7106
+ // 返回要素样式
7107
+ returnStyle: true
7108
+ }).then(function (featureInfo) {
7109
+ // 获取要素
7110
+ const featureData = featureInfo.data.layers[0].features[0]
7111
+ // 当通过颜色查找色号时,MapGIS桌面会通过颜色值的模糊匹配去查找色号,两个不同的颜色,查找出的色号可能会一样,因此无法通过颜色查找色号
7112
+ // 因此推荐用户通过querySystemColorList查询到指定系统库的颜色列表,然后再前端根据自己的项目实际情况,写一个调色板来选择色号,注意该接口需要设置翻页参数
7113
+ // 此步骤是可选项,也可以像下方代码,直接更改色号
7114
+ resourceServer.querySystemColorList({
7115
+ // 系统库ID
7116
+ sysLib: systemLibGuid,
7117
+ // 查询第几页
7118
+ page: 1,
7119
+ // 每页数量
7120
+ pageSize: 20,
7121
+ }).then(function (colorList) {
7122
+ console.log("色号列表:", colorList)
7123
+ })
7124
+ // 直接更改色号
7125
+ featureData.styleInfo.fillColor = 112
7126
+ // 构造要更新的要素对象
7127
+ const feature = new Feature({
7128
+ // 更新属性,可以更新部分属性,但是FID是必选项,{FID:'xxx'}
7129
+ attributes: featureData.attributes,
7130
+ // 更新几何,必须更新几何
7131
+ geometry: new Polygon({
7132
+ coordinates: featureData.geometry.coordinates
7133
+ }),
7134
+ // 更新样式,可选项
7135
+ styleInfo: featureData.styleInfo
7136
+ })
7137
+ // 更新要素对象
7138
+ featureServer.updateFeature({
7139
+ // 请求方式
7140
+ method: 'POST',
7141
+ // 要更新的图层ID
7142
+ layerId: '0',
7143
+ // 要更新要素对象
7144
+ features: [feature]
7145
+ })
7146
+ })
7147
+ })
7148
+ })</code></pre>
7149
+
7150
+
7132
7151
 
7133
7152
  </div>
7134
7153
 
@@ -354,7 +354,7 @@ if(layer.loadStatus === 'loaded') {<br/>
354
354
  </td>
355
355
 
356
356
 
357
- <td class="description last"><p>渲染模式,分为客户端渲染'client'和服务器端渲染'server'</p></td>
357
+ <td class="description last"><p>渲染模式,分为客户端渲染'client'和服务器端渲染'server',目前仅当gdbp存在时,server模式生效。</p></td>
358
358
  </tr>
359
359
 
360
360