123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- import { myBridge } from './map';
- import { handleRegionLayerWithOutLabel } from '@/utils/map/baseMethod.js';
- export function invokeParams(ActionName, params) {
- if (import.meta.env.VITE_OPEN_UE === 'open') return;
- console.log(ActionName, params);
- myBridge.bridgeContent.Invoke({
- ActionName: ActionName,
- Parameters: {
- ...params,
- },
- });
- }
- export function changeViewType(ViewType) {
- let d = ViewType || '2D';
- invokeParams('ChangeViewType', {
- type: d,
- });
- // if (d === '2D') {
- // addPointSearch();
- // }
- addPointSearch();
- }
- export function setCamera(params) {
- invokeParams(
- 'SetCamera',
- params,
- // ||{
- // position: {
- // spatialReference: {
- // wkid: 102100
- // },
- // x: 2598.4722313159023,
- // y: -927.2818635861828,
- // z: 73.09940296852281
- // },
- // heading: 266.84124349722583,
- // tilt: 70.95259138002815
- // }
- );
- }
- export function addMyGraph(params) {
- invokeParams('AddGraphic', params);
- }
- export function addMyGraphByData_TJ(params, bol = true) {
- // handleRegionLayerWithOutLabel(bol);
- invokeParams('AddGraphicByData_TJ', {
- ...params,
- status: bol,
- });
- }
- export function addPointMap(pointsArr) {
- invokeParams('AddGraphic', {
- is_clear: false,
- is_goto: true,
- is_edit: false,
- is_temp: true,
- type: 'points',
- data: pointsArr,
- attributes: [],
- symbol: {
- type: 'simple-marker',
- color: '#fff',
- size: 14,
- },
- });
- }
- export function addPointMapSingle(pointsArr, is_goto) {
- invokeParams('AddGraphic', {
- is_clear: true,
- is_goto: is_goto,
- type: 'point',
- data: pointsArr,
- attributes: [],
- symbol: {
- type: 'picture-marker',
- url: 'images/marker.png',
- width: '50px',
- height: '50px',
- },
- // layerID: 'tempLayer'
- });
- }
- export function gldbMap(isShow, leadingLayers, trailingLayers) {
- console.log('dasdasdassad', isShow, leadingLayers, trailingLayers);
- invokeParams('ChangeShowSwipe', {
- status: isShow ? 'show' : 'hide',
- leadingLayers: trailingLayers,
- trailingLayers: leadingLayers,
- direction: 'horizontal',
- });
- }
- export function emptyAllLayers() {
- invokeParams('ClearMapLayers', {});
- }
- export function SetExtent(params) {
- invokeParams('SetExtent', {
- ...params,
- });
- }
- export function addPolygons(geos, is_clear, layerID, symbol) {
- invokeParams('AddGraphic', {
- type: 'polygons',
- is_edit: false,
- is_temp: true,
- is_clear: is_clear,
- is_goto: false,
- layerID: layerID,
- data: geos,
- symbol: symbol || {
- type: 'simple-fill',
- color: [239, 132, 9, 0.7],
- outline: {
- color: [255, 255, 255, 1],
- width: 1,
- },
- },
- });
- }
- export function layerControl(layerID, visible, opacity = 1, where = '1=1') {
- invokeParams('LayerControl', {
- title: layerID,
- visible: visible,
- opacity: opacity,
- islegend: false,
- where: where,
- });
- }
- export function clearTownAndVillageMap() {
- clearMap();
- // layerControl('temp',false)
- }
- export function clearMap(params = {}) {
- invokeParams('ClearMap', {
- is_draw: true,
- is_search: true,
- is_position: true,
- ...params,
- });
- }
- export function addPointMarker(pointsArr, href, size) {
- invokeParams('AddGraphic', {
- is_clear: false,
- is_goto: false,
- type: 'point',
- data: pointsArr,
- attributes: [],
- symbol: {
- type: 'picture-marker',
- url: href,
- width: size,
- height: size,
- },
- is_temp: true,
- layerID: 'zhgc_temp',
- });
- }
- export function addPointMarkerImage(
- layerID,
- pointsArr = [],
- href = '',
- size = 20,
- is_clear = false,
- attributes = {},
- ) {
- invokeParams('AddGraphic', {
- is_clear: is_clear,
- is_goto: false,
- type: 'point',
- data: pointsArr,
- attributes: attributes,
- symbol: {
- type: 'picture-marker',
- url: href,
- width: size,
- height: size,
- },
- is_temp: true,
- layerID: layerID,
- });
- }
- export function addMultiPointsMarkerImage(params, href = '', size = 20) {
- invokeParams('AddGraphic', {
- is_clear: false,
- is_goto: false,
- type: 'points',
- data: [],
- attributes: null,
- symbol: {
- type: 'picture-marker',
- url: href,
- width: size,
- height: size,
- },
- is_temp: true,
- layerID: 'addImagePoint',
- ...params,
- });
- }
- export function layerDef(title, sql, type = 'feature') {
- invokeParams('LayerDefinitions', {
- title,
- sql,
- type,
- });
- }
- export function positionByPoint(x, y, is_goto = false, is_draw = true, size = 50, scale = 1000) {
- invokeParams('Position', {
- type: 'point',
- position: [
- {
- id: '4065',
- mapx: x,
- mapy: y,
- },
- ],
- is_draw: is_draw,
- is_clear: true,
- is_goto,
- size: size,
- scale: scale,
- heading: 360,
- tilt: 0,
- easing: 'ease',
- duration: 7000,
- });
- }
- export function resultGoto(layerID, id, scale = 2000) {
- invokeParams('ResultGoto', {
- layerID,
- id,
- scale,
- });
- }
- export function addPointSearch(status = true) {
- invokeParams('MapClickAll', {
- status,
- is_draw: false,
- is_code: false,
- });
- }
- export function layerControlNew(layerID, visible, opacity = 1, where) {
- console.log('我的opacity', opacity);
- invokeParams('LayerControl', {
- title: layerID,
- visible: visible,
- opacity: opacity,
- islegend: false,
- where: where,
- });
- }
- export function LayerStatistics(title, field) {
- invokeParams('LayerStatistics', {
- title: title,
- field: field,
- type: 'count',
- });
- }
- export function toolUploadSheepFileMap(shapeType, shapeData) {
- invokeParams('LoadSHPFile', {
- shapeType: shapeType,
- shapeData: shapeData,
- is_goto: true,
- });
- }
- export function setScale(scale) {
- invokeParams('SetScale', {
- scale: scale,
- });
- }
- export function addMapLayer(params) {
- invokeParams('AddLayer', {
- // scale: scale,
- // id: id,
- // title: id,
- // visible: visible,
- // opacity: 1,
- // url: url,
- // type: type,
- // is_goto: false,
- // is_legend: false,
- ...params,
- });
- }
- export function LayerQuery(params) {
- invokeParams('LayerQuery', {
- // geometry: {
- // type: 'polygon',
- // rings: [
- // [-829.6023411144151, 2768.940532081816],
- // [6106.907801275349, 2953.548570047385],
- // [5463.077127821732, -2051.867891674905],
- // [-570.7552398098007, -1867.805762451227],
- // [-829.6023411144151, 2768.940532081816],
- // ],
- // spatialReference: {
- // wkid: 102100,
- // },
- // },
- // spatialRelationship: 'disjoint',
- outFields: ['*'],
- returnGeometry: true,
- is_draw: true,
- is_goto: false,
- is_clear: false,
- symbol: {
- type: 'simple-fill',
- // style: 'circle',
- color: [255, 0, 0, 0],
- // size: 10,
- outline: {
- color: [255, 191, 0],
- // color: [1, 255, 1],
- width: 3,
- },
- },
- ...params,
- });
- }
- export function ClearMap(is_draw = true, is_search = true, is_position = true) {
- invokeParams('ClearMap', {
- is_draw: true,
- is_search: true,
- is_position: true,
- is_temp: true,
- });
- }
- export function ChangeBaseMap(type) {
- invokeParams('ChangeBaseMap', {
- title: type,
- opacity: 1,
- });
- }
- export function clearTongjiLayer() {
- invokeParams('RemoveMapLayers', {
- id: 'tongjiLayer',
- type: '',
- });
- }
- export function removeMapLayers(title) {
- invokeParams('RemoveMapLayers', {
- id: title,
- type: '',
- });
- }
- export function calculation() {
- invokeParams('Calculation', {
- type: 'polyline',
- is_show: false,
- is_dtzz: false,
- });
- }
- export function layerShade(title, where) {
- invokeParams('LayerShade', {
- "title": title,
- "where": where,
- "effect": "opacity(0.9) blur(5px)"
- });
- }
- export function drawCircle(point, radius, layerId, returnParams = false) {
- invokeParams('AddGraphic', {
- type: 'circle',
- is_edit: false,
- is_temp: true,
- is_clear: true,
- is_goto: false,
- is_return: returnParams,
- data: point,
- attributes: [],
- symbol: {
- type: 'simple-fill',
- color: [50, 205, 205, 0.5],
- outline: {
- width: 2,
- },
- },
- radius: radius,
- unit: 'meters',
- layerID: layerId,
- });
- }
- export function changeMapType(mapType) {
- invokeParams('ChangeMapType', {
- "mapType": mapType,
- "viewType": "2D"
- });
- }
- export function createMap() {
- invokeParams('CreateMap', {
- });
- }
- export function resultHighlight(layerId, objectId) {
- invokeParams('ResultHighlight', {
- "layerId": layerId,
- "objectId": objectId
- });
- }
- export function setHeatmap(show, data) {
- invokeParams('SetHeatmap', {
- "show": show,
- "data": data,
- "heatmapRenderer": {},
- "simpleRenderer": {}
- });
- }
- export function setDistrictResult(show, data) {
- invokeParams('SetDistrictResult', {
- "show": show,
- "data": data,
- // "renderer": {}
- });
- }
- export function draw(type) {
- invokeParams('Draw', {
- "type": type
- });
- }
- export function drawHistory(bol, data) {
- invokeParams('DrawHistory', {
- "show": bol,
- "data": data
- });
- }
- export function playHistory(status) {
- invokeParams('PlayHistory', {
- "status": status
- });
- }
|