0.6.300 • Published 2 years ago

gisviewer-vue-ftest1 v0.6.300

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

gisviewer-vue

地图容器

安装

npm install gisviewer-vue -S

使用

main.js

import Vue from 'vue';
import App from './App.vue';
import GisViewer from 'gisviewer-vue';
import 'gisviewer-vue/lib/gis-viewer.css';

Vue.config.productionTip = false;
Vue.use(GisViewer);

new Vue({
  render: (h) => h(App)
}).$mount('#app');

App.vue

<template>
  <div id="app">
    <gis-viewer />
  </div>
</template>

<script>
export default {
  name: 'App'
};
</script>

<style>
#app {
  height: 100vh;
}
</style>

配置

Props

namedescriptiontypedefaltvalues
platform地图平台Stringarcgis3Darcgis2Darcgis3Ddugis(百度内网)mapabc(高德内网)bmap(百度)amap(高德)
map-config地图配置object依据 platform 不同有不同的配置内容

arcgis 地图配置

namedescriptiontyperequireddefaultvalues
arcgis_api本地 arcgis js api 地址Stringfalsearcgis online 上的最新 api 地址
theme地图主题样式Stringfalselightlightdarklight-bluedark-bluelight-greendark-greenlight-purpledark-purplelight-reddark-red
baseLayers底图Arraytrue

Events

namedescriptionparameters
map-loaded地图创建完成
showGisDeviceInfo撒点点击事件

接口说明

addoverlays 地图撒点接口

namedescriptiontypedefault
defaultType默认类型string
defaultSymbol默认符号string
overlays覆盖物属性object[]
  id覆盖物编号, 用于按编号删除string
  type覆盖物类型, 用于按类型删除string
  symbol覆盖物符号object
   type覆盖物符号类型 2d 或 3dstringpoint-2d/point-3d
   url覆盖物符号地址string
   primitive覆盖物的图元类型string2D 图元:"circle","square", "cross", "x","kite" ,"triangle"3D 图元:"sphere","cylinder", "cube","cone","inverted-cone","diamond","tetrahedron"
   color图元颜色number/string/number[]
   outline图元边框object
    size图元边框大小number
    color图元边框颜色number/string
   size覆盖物大小Array<number/string>/ number/string;
   anchor覆盖物锚点string"center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"
   rotation旋转角度number[]在 point-3d 时可用,x 轴角度, y 轴角度, z 轴角度
  geometry覆盖物几何属性object
   xx 坐标number
   yy 坐标number
   zz 坐标number
  fields覆盖物业务属性object
  buttons覆盖物弹出框的默认按钮,会覆盖 defaultButtonsobject[]
autoPopup是否自动显示弹出框, 只添加一个覆盖物时有效booleanfalse
showPopup点击后是否显示弹出框booleanfalse
defaultInfoTemplate配置 infoTemplate 需要显示的内容object
  title标题string
  content内容string
defaultButtons弹出框的默认按钮object[]
  label按钮文本string
  typejs 函数 mapFeatureClicked 的 type 参数string
showToolTip是否显示飞行提示booleanfalse
toolTipContent飞行提示内容string

deleteOverlays 删除撒点接口

deleteAllOverlays 删除全部撒点接口

addOverlaysCluster 点聚合接口

namedescriptiontypedefault
type图层类型string
defaultSymbol点图片样式object
overlays聚合点位集合object[]
showPopup是否点击显示弹窗boolean
custom非聚合点位上方显示文本object
textStyle聚合数字样式object
zoom在该层级取消聚合number

deleteOverlaysCluster 删除点聚合接口

deleteAllOverlaysCluster 删除全部点聚合接口

addHeatMap 热力图接口

namedescriptiontypedefault
points热力图点位集合string
options热力图配置object

deleteHeatMap 删除热力图接口

showLayer 显示图层

namedescriptiontypedefault
label图层名称string
type图层类型string

hideLayer 隐藏图层

namedescriptiontypedefault
label图层名称string
type图层类型string

findFeature 查找定位

setMapCenter 定位坐标

setMapCenterAndLevel 定位坐标层级

showJurisdiction()显示辖区

hideJurisdiction()隐藏辖区

showDistrictMask() 显示边界蒙层

namedescriptiontypedefault
name区县名称string
showMask是否显示外部蒙层boolean

hideDistrictMask() 显示边界蒙层

setMapStyle()高德设置地图样式

routeSearch()高德路径规划

clearRouteSearch()清除路径规划

showCustomTip()显示自定义弹窗

stopPlaySelectedRoute ()

startDrawOverlays ()手动画区域

namedescriptiontypedefault
 drawType绘制类型string
id绘制图形idstring
symbol绘制样式object
model编辑/新增stringadd,edit
callback完成绘制后回调function

stopDrawOverlays ()清除区域

getDrawOverlays ()得到手画区域

startGeometrySearch()区域搜索

namedescriptiontypedefault
drawType搜索图形类型stringpoint;polygon,需要自己手绘
 types搜索图层类型string[]
 radius搜素半径string
showResult是否显示搜索结果object
showGeometry是否显示搜素范围stringadd,edit
center搜索中心点function
repeat是否重复搜素function
clickHandle搜索结果回调function

clearGeometrySearch ()清除区域搜索

showMigrateChart()显示迁徙图

hideMigrateChart ()隐藏迁徙图