wv-business-components-demo
Version:
1,374 lines (1,369 loc) • 295 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@arcgis/core/assets/esri/themes/light/main.css'), require('vue-class-component'), require('wiscomv'), require('@arcgis/core/geometry/Point'), require('@arcgis/core/geometry/support/webMercatorUtils'), require('@arcgis/core/symbols/PictureMarkerSymbol'), require('@arcgis/core/Graphic'), require('@arcgis/core/widgets/Sketch'), require('@arcgis/core/widgets/Sketch/SketchViewModel'), require('@arcgis/core/Map'), require('@arcgis/core/views/MapView'), require('@arcgis/core/core/watchUtils'), require('@arcgis/core/geometry/Extent'), require('@arcgis/core/layers/GraphicsLayer'), require('@arcgis/core/geometry/Circle'), require('@arcgis/core/geometry/Polygon'), require('@arcgis/core/symbols/SimpleFillSymbol'), require('@arcgis/core/symbols/SimpleLineSymbol'), require('@arcgis/core/geometry/geometryEngine'), require('@arcgis/core/core/urlUtils'), require('@arcgis/core/layers/TileLayer'), require('@arcgis/core/Basemap'), require('@arcgis/core/symbols/CIMSymbol'), require('@arcgis/core/geometry/Polyline'), require('@arcgis/core/symbols/Font'), require('@arcgis/core/config'), require('@arcgis/core/widgets/Editor'), require('@arcgis/core/widgets/Feature'), require('@arcgis/core/layers/support/LOD'), require('@arcgis/core/layers/WMTSLayer'), require('@arcgis/core/layers/WebTileLayer'), require('@arcgis/core/geometry/SpatialReference'), require('@arcgis/core/layers/support/TileInfo'), require('@arcgis/core/renderers/HeatmapRenderer'), require('@arcgis/core/layers/FeatureLayer'), require('@arcgis/core/Color'), require('@arcgis/core/symbols/SimpleMarkerSymbol'), require('@arcgis/core/PopupTemplate'), require('@arcgis/core/views/draw/Draw'), require('@arcgis/core/layers/MapImageLayer'), require('@arcgis/core/symbols/TextSymbol'), require('@arcgis/core/renderers/ClassBreaksRenderer'), require('axios'), require('jquery'), require('vue-property-decorator'), require('vue')) :
typeof define === 'function' && define.amd ? define(['exports', '@arcgis/core/assets/esri/themes/light/main.css', 'vue-class-component', 'wiscomv', '@arcgis/core/geometry/Point', '@arcgis/core/geometry/support/webMercatorUtils', '@arcgis/core/symbols/PictureMarkerSymbol', '@arcgis/core/Graphic', '@arcgis/core/widgets/Sketch', '@arcgis/core/widgets/Sketch/SketchViewModel', '@arcgis/core/Map', '@arcgis/core/views/MapView', '@arcgis/core/core/watchUtils', '@arcgis/core/geometry/Extent', '@arcgis/core/layers/GraphicsLayer', '@arcgis/core/geometry/Circle', '@arcgis/core/geometry/Polygon', '@arcgis/core/symbols/SimpleFillSymbol', '@arcgis/core/symbols/SimpleLineSymbol', '@arcgis/core/geometry/geometryEngine', '@arcgis/core/core/urlUtils', '@arcgis/core/layers/TileLayer', '@arcgis/core/Basemap', '@arcgis/core/symbols/CIMSymbol', '@arcgis/core/geometry/Polyline', '@arcgis/core/symbols/Font', '@arcgis/core/config', '@arcgis/core/widgets/Editor', '@arcgis/core/widgets/Feature', '@arcgis/core/layers/support/LOD', '@arcgis/core/layers/WMTSLayer', '@arcgis/core/layers/WebTileLayer', '@arcgis/core/geometry/SpatialReference', '@arcgis/core/layers/support/TileInfo', '@arcgis/core/renderers/HeatmapRenderer', '@arcgis/core/layers/FeatureLayer', '@arcgis/core/Color', '@arcgis/core/symbols/SimpleMarkerSymbol', '@arcgis/core/PopupTemplate', '@arcgis/core/views/draw/Draw', '@arcgis/core/layers/MapImageLayer', '@arcgis/core/symbols/TextSymbol', '@arcgis/core/renderers/ClassBreaksRenderer', 'axios', 'jquery', 'vue-property-decorator', 'vue'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["wv-business-components-demo"] = {}, null, global.vueClassComponent, global.wiscomv, global.Point, global.webMercatorUtils, global.PictureMarkerSymbol, global.Graphic, global.Sketch, global.SketchViewModel, global.Map, global.MapView, global.watchUtils, global.Extent, global.GraphicsLayer, global.Circle, global.Polygon, global.SimpleFillSymbol, global.SimpleLineSymbol, global.geometryEngine, global.urlUtils, global.TileLayer, global.Basemap, global.CIMSymbol, global.Polyline, global.Font, global.config, null, null, null, global.WMTSLayer, global.WebTileLayer, global.SpatialReference, global.TileInfo, null, global.FeatureLayer, global.Color, global.SimpleMarkerSymbol, global.PopupTemplate, global.Draw, global.MapImageLayer, global.TextSymbol, global.ClassBreaksRenderer, global.axios, global.$, global.vuePropertyDecorator, global.Vue));
})(this, (function (exports, main_css, vueClassComponent, wiscomv, Point, webMercatorUtils, PictureMarkerSymbol, Graphic, Sketch, SketchViewModel, Map, MapView, watchUtils, Extent, GraphicsLayer, Circle, Polygon, SimpleFillSymbol, SimpleLineSymbol, geometryEngine, urlUtils, TileLayer, Basemap, CIMSymbol, Polyline, Font, config, Editor, Feature, LOD, WMTSLayer, WebTileLayer, SpatialReference, TileInfo, HeatmapRenderer, FeatureLayer, Color, SimpleMarkerSymbol, PopupTemplate, Draw, MapImageLayer, TextSymbol, ClassBreaksRenderer, axios, $, vuePropertyDecorator, vue) { 'use strict';
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var webMercatorUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(webMercatorUtils);
var watchUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(watchUtils);
var geometryEngine__namespace = /*#__PURE__*/_interopNamespaceDefault(geometryEngine);
var urlUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(urlUtils);
let ScreenPoint = {};
let OverviewMap = {};
let ClusterLayer = {};
let Units = {};
let CartographicLineSymbol = {};
function getPointData(map, getExtentData) {
let centerPoint = map.extent.center;
let point = {
type: "point",
longitude: map.extent.xmax,
latitude: map.extent.ymax
};
let point1 = {
type: "point",
longitude: map.extent.xmin,
latitude: map.extent.ymin
};
let minPoint = new Point(point1);
let maxPoint = new Point(point);
if (centerPoint.spatialReference.isWebMercator) {
centerPoint = webMercatorUtils__namespace.webMercatorToGeographic(centerPoint);
minPoint = webMercatorUtils__namespace.webMercatorToGeographic(minPoint);
maxPoint = webMercatorUtils__namespace.webMercatorToGeographic(maxPoint);
}
let minLongitude = minPoint.x;
let minLatitude = minPoint.y;
let maxLongitude = maxPoint.x;
let maxLatitude = maxPoint.y;
let level = Math.round(map.zoom);
let urlPrams = {
minLongitude,
minLatitude,
maxLongitude,
maxLatitude,
level
};
getExtentData && getExtentData(urlPrams);
}
let timer = null;
function debounce(fn, wait) {
return function() {
if (timer !== null) {
clearTimeout(timer);
}
timer = setTimeout(fn, wait);
};
}
class GisBase {
static initMap(mapContainer, mode, Id, callback, config, getExtentData, popCloseFn) {
window[Id + "mapObj"] = {};
window[Id + "mapObj"][Id + "mapconfig"] = config;
if (mode == "ARCGIS") {
if (Number(config.mapServerProxyEnable)) {
urlUtils__namespace.addProxyRule({
urlPrefix: config.urlPrefix,
proxyUrl: config.proxyUrl
});
}
let layer = new TileLayer({
url: config.mapServeUrl
});
let basemap = new Basemap({
baseLayers: [layer],
title: "basemap",
id: Id + "map"
});
window[Id + "mapObj"][Id + "Basemap"] = basemap;
let map = new Map({ basemap });
window[Id + "mapObj"][Id + "map"] = map;
let view = new MapView({
container: mapContainer,
map,
center: config.center,
zoom: config.level
});
window[Id + "mapObj"][Id + "view"] = view;
console.log(view);
view.ui.empty("top-left");
let graphicsLayer = new GraphicsLayer({ id: "DrawCircle" });
map.add(graphicsLayer, 1);
let graphicsLayer1 = new GraphicsLayer({ id: "DrawCircle1" });
map.add(graphicsLayer1, 2);
let graphicsLayer9 = new GraphicsLayer({ id: "TDrawCircle" });
map.add(graphicsLayer9, 4);
let graphicsLayer4 = new GraphicsLayer({ id: "EventLayer" });
map.add(graphicsLayer4, 5);
let PointLayer = map.findLayerById("EventLayer");
PointLayer.visible = false;
let graphicsLayer8 = new GraphicsLayer({
id: "EventResultLayer"
});
map.add(graphicsLayer8, 6);
let fixedBillboardLayer = new GraphicsLayer({
id: "fixedBillboardLayer"
});
map.add(fixedBillboardLayer, 100);
let fixedBillboardLayerP = new GraphicsLayer({
id: "fixedBillboardLayerP"
});
map.add(fixedBillboardLayerP, 108);
let graphicsLayer2 = new GraphicsLayer({ id: "MoveLayer1" });
map.add(graphicsLayer2, 102);
let graphicsLayer3 = new GraphicsLayer({ id: "MoveLayer" });
map.add(graphicsLayer3, 101);
let graphicsLayer5 = new GraphicsLayer({ id: "MoveLayerText" });
map.add(graphicsLayer5, 106);
let graphicsLayer6 = new GraphicsLayer({
id: "MoveLayerText1"
});
map.add(graphicsLayer6, 107);
let fixedBillboardLayerPC = new GraphicsLayer({
id: "fixedBillboardLayerPC"
});
map.add(fixedBillboardLayerPC, 110);
view.when(() => {
window[Id + "mapObj"][Id + "view"].popup = {
collapseEnabled: false,
dockOptions: {
buttonEnabled: false
},
highlightEnabled: false
};
watchUtils__namespace.whenTrue(view.popup, "visible", function() {
watchUtils__namespace.whenFalseOnce(view.popup, "visible", function() {
if (popCloseFn) {
popCloseFn();
}
});
});
callback();
});
watchUtils__namespace.watch(
view,
"extent",
debounce((extent) => {
if (view.stationary) ;
let level = Math.round(view.zoom);
if (level > window[Id + "mapObj"][Id + "mapconfig"].maxlevel) {
wiscomv.WvMessage({
message: "\u5DF2\u8FBE\u5230\u6700\u5927\u5C42\u7EA7!",
type: "error",
duration: "1000"
});
view.goTo({
center: view.center,
zoom: level - 1
});
}
if (level < window[Id + "mapObj"][Id + "mapconfig"].minlevel) {
wiscomv.WvMessage({
message: "\u5DF2\u8FBE\u5230\u6700\u5C0F\u5C42\u7EA7!",
type: "error",
duration: "1000"
});
view.goTo({
center: view.center,
zoom: level + 1
});
}
if (view.extent && getExtentData) {
getPointData(view, getExtentData);
}
if (config.mapExtentLimitEnable) {
return;
}
let getNumFloat = (num) => {
let x = String(num).indexOf(".") + 1;
let y = String(num).length - x;
if (y > 0) {
return y;
}
};
let XMin = config.XMin * 1;
let YMin = config.YMin * 1;
let XMax = config.XMax * 1;
let YMax = config.YMax * 1;
let viewE;
if (view.extent.spatialReference.isWebMercator) {
viewE = webMercatorUtils__namespace.webMercatorToGeographic(view.extent);
}
let mapXmin = Number(viewE.extent.xmin);
let mapXmax = Number(viewE.extent.xmax);
let mapYmin = Number(viewE.extent.ymin);
let mapYmax = Number(viewE.extent.ymax);
let xdifference = mapXmax - mapXmin;
let ydifference = mapYmax - mapYmin;
let cM = Number(mapXmax.toFixed(getNumFloat(XMax)));
if (cM > XMax) {
mapXmax = XMax;
mapXmin = XMax - xdifference;
if (mapYmax > YMax) {
mapYmax = YMax;
mapYmin = mapYmax - ydifference;
}
if (mapYmin < YMin) {
mapYmin = YMin;
mapYmax = mapYmin + ydifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
let cX = Number(mapXmin.toFixed(getNumFloat(XMin)));
if (cX < XMin) {
mapXmin = XMin;
mapXmax = XMin + xdifference;
if (mapYmax > YMax) {
mapYmax = YMax;
mapYmin = mapYmax - ydifference;
}
if (mapYmin < YMin) {
mapYmin = YMin;
mapYmax = mapYmin + ydifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
let cMY = Number(mapYmax.toFixed(getNumFloat(YMax)));
if (cMY > YMax) {
mapYmax = YMax;
mapYmin = YMax - ydifference;
if (mapXmax > XMax) {
mapXmax = XMax;
mapXmin = mapXmax - xdifference;
}
if (mapXmin < XMin) {
mapXmin = XMin;
mapXmax = mapXmin + xdifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
let cMM = Number(mapYmin.toFixed(getNumFloat(YMin)));
if (cMM < YMin) {
mapYmin = YMin;
mapYmax = YMin + ydifference;
if (mapXmax > XMax) {
mapXmax = XMax;
mapXmin = mapXmax - xdifference;
}
if (mapXmin < XMin) {
mapXmin = XMin;
mapXmax = mapXmin + xdifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
}, 500)
);
} else {
if (Number(config.mapServerProxyEnable)) {
urlUtils__namespace.addProxyRule({
urlPrefix: config.urlPrefix,
proxyUrl: config.proxyUrl
});
}
axios.get("/static/config/MapInfoParams2.json").then(function(res) {
let layer1 = new TileLayer({
url: config.mapServeUrl
});
let layer = new WMTSLayer({
url: config.mapServeUrl1
});
let basemap = new Basemap({
baseLayers: [layer1, layer],
title: "basemap",
id: Id + "map"
});
window[Id + "mapObj"][Id + "Basemap"] = basemap;
const map = new Map({
basemap
});
window[Id + "mapObj"][Id + "map"] = map;
let wmtsParam;
let param = res.data;
if (typeof param == "object") {
wmtsParam = param.WMTS;
} else if (typeof param == "string") {
wmtsParam = JSON.parse(param).WMTS;
}
if (!wmtsParam) {
alert("\u8BF7\u6B63\u786E\u914D\u7F6E\u53C2\u6570\uFF01");
return;
}
new TileInfo({
dpi: wmtsParam.dpi,
origin: wmtsParam.origin,
spatialReference: {
wkid: wmtsParam.wkid
},
lods: wmtsParam.lods
});
const view = new MapView({
container: mapContainer,
map,
center: config.center,
zoom: config.level
});
window[Id + "mapObj"][Id + "view"] = view;
console.log(view);
view.ui.empty("top-left");
let graphicsLayer = new GraphicsLayer({ id: "DrawCircle" });
map.add(graphicsLayer, 1);
let graphicsLayer1 = new GraphicsLayer({ id: "DrawCircle1" });
map.add(graphicsLayer1, 2);
let graphicsLayer9 = new GraphicsLayer({ id: "TDrawCircle" });
map.add(graphicsLayer9, 4);
let graphicsLayer4 = new GraphicsLayer({ id: "EventLayer" });
map.add(graphicsLayer4, 5);
let PointLayer = map.findLayerById("EventLayer");
PointLayer.visible = false;
let graphicsLayer8 = new GraphicsLayer({
id: "EventResultLayer"
});
map.add(graphicsLayer8, 6);
let fixedBillboardLayer = new GraphicsLayer({
id: "fixedBillboardLayer"
});
map.add(fixedBillboardLayer, 100);
let fixedBillboardLayerP = new GraphicsLayer({
id: "fixedBillboardLayerP"
});
map.add(fixedBillboardLayerP, 108);
let graphicsLayer2 = new GraphicsLayer({ id: "MoveLayer1" });
map.add(graphicsLayer2, 102);
let graphicsLayer3 = new GraphicsLayer({ id: "MoveLayer" });
map.add(graphicsLayer3, 101);
let graphicsLayer5 = new GraphicsLayer({
id: "MoveLayerText"
});
map.add(graphicsLayer5, 106);
let graphicsLayer6 = new GraphicsLayer({
id: "MoveLayerText1"
});
map.add(graphicsLayer6, 107);
let fixedBillboardLayerPC = new GraphicsLayer({
id: "fixedBillboardLayerPC"
});
map.add(fixedBillboardLayerPC, 110);
view.when(() => {
window[Id + "mapObj"][Id + "view"].popup = {
collapseEnabled: false,
dockOptions: {
buttonEnabled: false
},
highlightEnabled: false
};
watchUtils__namespace.whenTrue(view.popup, "visible", function() {
watchUtils__namespace.whenFalseOnce(view.popup, "visible", function() {
if (popCloseFn) {
popCloseFn();
}
});
});
callback();
});
watchUtils__namespace.watch(
view,
"extent",
debounce((extent) => {
if (view.stationary) ;
let level = Math.round(view.zoom);
if (level > window[Id + "mapObj"][Id + "mapconfig"].maxlevel) {
wiscomv.WvMessage({
message: "\u5DF2\u8FBE\u5230\u6700\u5927\u5C42\u7EA7!",
type: "error",
duration: "1000"
});
view.goTo({
center: view.center,
zoom: level - 1
});
}
if (level < window[Id + "mapObj"][Id + "mapconfig"].minlevel) {
wiscomv.WvMessage({
message: "\u5DF2\u8FBE\u5230\u6700\u5C0F\u5C42\u7EA7!",
type: "error",
duration: "1000"
});
view.goTo({
center: view.center,
zoom: level + 1
});
}
if (view.extent) {
getPointData(view, getExtentData);
}
if (config.mapExtentLimitEnable) {
return;
}
let getNumFloat = (num) => {
let x = String(num).indexOf(".") + 1;
let y = String(num).length - x;
if (y > 0) {
return y;
}
};
let XMin = config.XMin * 1;
let YMin = config.YMin * 1;
let XMax = config.XMax * 1;
let YMax = config.YMax * 1;
let viewE;
if (view.extent.spatialReference.isWebMercator) {
viewE = webMercatorUtils__namespace.webMercatorToGeographic(view.extent);
}
let mapXmin = Number(viewE.extent.xmin);
let mapXmax = Number(viewE.extent.xmax);
let mapYmin = Number(viewE.extent.ymin);
let mapYmax = Number(viewE.extent.ymax);
let xdifference = mapXmax - mapXmin;
let ydifference = mapYmax - mapYmin;
let cM = Number(mapXmax.toFixed(getNumFloat(XMax)));
if (cM > XMax) {
mapXmax = XMax;
mapXmin = XMax - xdifference;
if (mapYmax > YMax) {
mapYmax = YMax;
mapYmin = mapYmax - ydifference;
}
if (mapYmin < YMin) {
mapYmin = YMin;
mapYmax = mapYmin + ydifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
let cX = Number(mapXmin.toFixed(getNumFloat(XMin)));
if (cX < XMin) {
mapXmin = XMin;
mapXmax = XMin + xdifference;
if (mapYmax > YMax) {
mapYmax = YMax;
mapYmin = mapYmax - ydifference;
}
if (mapYmin < YMin) {
mapYmin = YMin;
mapYmax = mapYmin + ydifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
let cMY = Number(mapYmax.toFixed(getNumFloat(YMax)));
if (cMY > YMax) {
mapYmax = YMax;
mapYmin = YMax - ydifference;
if (mapXmax > XMax) {
mapXmax = XMax;
mapXmin = mapXmax - xdifference;
}
if (mapXmin < XMin) {
mapXmin = XMin;
mapXmax = mapXmin + xdifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
let cMM = Number(mapYmin.toFixed(getNumFloat(YMin)));
if (cMM < YMin) {
mapYmin = YMin;
mapYmax = YMin + ydifference;
if (mapXmax > XMax) {
mapXmax = XMax;
mapXmin = mapXmax - xdifference;
}
if (mapXmin < XMin) {
mapXmin = XMin;
mapXmax = mapXmin + xdifference;
}
let startExtent = new Extent(
{
xmin: mapXmin,
ymin: mapYmin,
xmax: mapXmax,
ymax: mapYmax
}
);
view.extent = startExtent;
}
}, 500)
);
});
}
}
}
let dpr = document.documentElement.clientHeight / 1080;
let mapI = 2;
config.assetsPath = "/static/";
config.fontsUrl = "/static/font/";
let EventmouseClick;
let EventmouseMove;
let tempObj = {};
let lineObj = {};
let lineObj1 = {};
let timeObjC = {};
let mouseClick = {};
let mouseClick1 = {};
let mouseOn = {};
let mouseOn1 = {};
let CCmouseClick = 0;
let PolygonmouseClick = 0;
let hoverFlag = "1";
let roundShow = 1;
let arctiveFlag = 1;
let ViewMoving;
function hoverStyleShow1(map, evt, ele) {
let obj = evt.graphic.attributes;
if (!obj)
return;
let wid = 0;
wid = $(ele).width();
let p = {
type: "point",
longitude: obj.x,
latitude: obj.y
};
let pt = new Point(p);
if (map.spatialReference.isWebMercator) {
pt = webMercatorUtils__namespace.geographicToWebMercator(pt);
}
let scrPt = map.toScreen(pt);
if (hoverFlag !== obj.data.id) {
$(ele).css({
display: "block",
left: scrPt.x - wid * 0.65 + "px",
top: scrPt.y - 50 * dpr + "px"
});
}
}
function hoverStyleShow2(map, evt, ele) {
let obj = evt.graphic.attributes;
if (!obj)
return;
let wid = 0;
wid = $(ele).width();
let p = {
type: "point",
longitude: obj.apeLongitude,
latitude: obj.apeLatitude
};
let pt = new Point(p);
if (map.spatialReference.isWebMercator) {
pt = webMercatorUtils__namespace.geographicToWebMercator(pt);
}
let scrPt = map.toScreen(pt);
if (hoverFlag !== obj.id) {
$(ele).css({
display: "block",
left: scrPt.x - wid * 0.65 + "px",
top: scrPt.y - 50 * dpr + "px"
});
}
}
function hoverStyleShow3(map, evt, ele, text) {
let obj = evt;
if (!obj)
return;
let wid = 0;
wid = $(ele).width();
let text1 = "\u5355\u51FB\u5730\u56FE\u4EFB\u610F\u4F4D\u7F6E\u6807\u70B9,\u53F3\u51FB\u9F20\u6807\u53D6\u6D88.";
$(ele).css({
display: "block",
left: evt.x + wid * 0.26 + "px",
top: evt.y - 30 * dpr + "px"
});
if (text) {
text1 = text;
}
$(ele).html(text1);
}
function hoverStyleShow5(map, evt, ele, ele1, text) {
let obj = evt.graphic.attributes;
if (!obj)
return;
let wid = 0;
let wid1 = 0;
wid1 = $(ele1).width();
wid = $(ele).width();
let p = {
type: "point",
longitude: obj.x,
latitude: obj.y
};
let pt = new Point(p);
if (map.spatialReference.isWebMercator) {
pt = webMercatorUtils__namespace.geographicToWebMercator(pt);
}
let scrPt = map.toScreen(pt);
let text1 = text || "\u70B9\u51FB\u6444\u50CF\u673A\u8FDB\u5165\u5168\u666F\u8FFD\u8E2A";
$(ele1).css({
display: "block",
left: scrPt.x - wid1 * -0.2 + "px",
top: scrPt.y + 6 * dpr + "px"
});
if (text) {
text1 = text;
}
$(ele1).html(text1);
if (hoverFlag !== obj.data.id) {
$(ele).css({
display: "block",
left: scrPt.x - wid * 0.65 + "px",
top: scrPt.y - 50 * dpr + "px"
});
}
}
function setEvent(view1, gl, markPointFn) {
let view = view1;
let idName = gl.id;
if (mouseOn[idName]) {
mouseOn[idName].remove();
}
if (mouseClick[idName]) {
mouseClick[idName].remove();
}
mouseOn[idName] = view.on("pointer-move", function(event) {
$(".hoverBgStyle").css({
display: "none"
});
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
if (results.length > 0 && !results[0].graphic.attributes.cluster) {
if (!results[0]) {
return;
}
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
let obj = "";
obj = results[0].graphic.attributes.data.devicename + "";
$(".hoverBgStyle").html(obj);
hoverStyleShow1(view, results[0], ".hoverBgStyle");
}
} else {
$(".hoverBgStyle").css({
display: "none"
});
}
});
});
mouseClick[idName] = view.on("immediate-click", function(event) {
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
if (!results[0]) {
return;
}
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
if (!results[0].graphic.attributes.cluster || results[0].graphic.attributes.overLap) {
markPointFn(results[0].graphic.attributes);
}
}
});
});
gl.on("layerview-destroy", function(event) {
mouseOn[idName].remove();
mouseClick[idName].remove();
});
}
function setVideoEvent(view1, gl, markPointFn, text) {
let view = view1;
let idName = gl.id;
if (mouseOn[idName]) {
mouseOn[idName].remove();
}
if (mouseClick[idName]) {
mouseClick[idName].remove();
}
mouseOn[idName] = view.on("pointer-move", function(event) {
$(".hoverBgStyle").css({
display: "none"
});
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
if (results.length > 0 && !results[0].graphic.attributes.cluster) {
if (!results[0]) {
return;
}
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
let obj = "";
obj = results[0].graphic.attributes.data.devicename + "";
$(".hoverBgStyle").html(obj);
if (text) {
hoverStyleShow5(view, results[0], ".hoverBgStyle", ".hoverVideoBgStyle", text);
} else {
hoverStyleShow5(view, results[0], ".hoverBgStyle", ".hoverVideoBgStyle");
}
}
} else {
$(".hoverBgStyle").css({
display: "none"
});
$(".hoverVideoBgStyle").css({
display: "none"
});
}
});
});
mouseClick[idName] = view.on("immediate-click", function(event) {
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
if (!results[0]) {
return;
}
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
if (!results[0].graphic.attributes.cluster || results[0].graphic.attributes.overLap) {
markPointFn(results[0].graphic.attributes);
}
}
});
});
gl.on("layerview-destroy", function(event) {
mouseOn[idName].remove();
mouseClick[idName].remove();
});
}
function setEvent1(view1, gl, markPointFn) {
let view = view1;
let idName = gl.id;
if (mouseOn1[idName]) {
mouseOn1[idName].remove();
}
if (mouseClick1[idName]) {
mouseClick1[idName].remove();
}
mouseOn1[idName] = view.on("pointer-move", function(event) {
$(".hoverBgStyle").css({
display: "none"
});
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
if (results.length > 0 && !results[0].graphic.attributes.cluster) {
if (!results[0]) {
return;
}
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
let obj = "";
obj = results[0].graphic.attributes.devicename + "";
$(".hoverBgStyle").html(obj);
hoverStyleShow2(view, results[0], ".hoverBgStyle");
}
} else {
$(".hoverBgStyle").css({
display: "none"
});
}
});
});
mouseClick1[idName] = view.on("immediate-click", function(event) {
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
if (!results[0].graphic.attributes.cluster) {
markPointFn(results[0].graphic.attributes);
}
}
});
});
gl.on("layerview-destroy", function(event) {
mouseOn1[idName].remove();
mouseClick1[idName].remove();
});
}
function setEvent2(view1, gl, markPointFn) {
let view = view1;
let idName = gl.id;
if (mouseOn1[idName]) {
mouseOn1[idName].remove();
}
if (mouseClick1[idName]) {
mouseClick1[idName].remove();
}
mouseOn1[idName] = view.on("pointer-move", function(event) {
$(".hoverBgStyle").css({
display: "none"
});
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
if (results.length > 0 && !results[0].graphic.attributes.cluster) {
if (!results[0]) {
return;
}
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
let obj = "";
obj = results[0].graphic.attributes.apeName + "";
$(".hoverBgStyle").html(obj);
}
} else {
$(".hoverBgStyle").css({
display: "none"
});
}
});
});
mouseClick1[idName] = view.on("immediate-click", function(event) {
view.hitTest(event).then((res) => {
if (res.results.length) {
let results = res.results.filter((result) => {
return result.graphic && result.graphic.layer && result.graphic.layer.id === idName;
});
let g = results[0].graphic;
let geo = g.geometry;
let p = {
type: "point",
longitude: geo.x,
latitude: geo.y
};
let point = new Point(p);
if (view.spatialReference.isWebMercator) {
point = webMercatorUtils__namespace.webMercatorToGeographic(point);
}
if (!results[0].graphic.attributes.cluster) {
markPointFn(results[0].graphic.attributes);
}
}
});
});
gl.on("layerview-destroy", function(event) {
mouseOn1[idName].remove();
mouseClick1[idName].remove();
});
}
function getPoints(center, radius, startAngle, endAngle, pointNum) {
let sin, cos, x, y, angle;
let points = [];
points[0] = center;
for (let i = 1; pointNum && i <= pointNum; i++) {
angle = startAngle + (endAngle - startAngle) * i / pointNum;
sin = Math.sin(angle * Math.PI / 180);
cos = Math.cos(angle * Math.PI / 180);
x = center[0] + radius * 1141e-8 * sin;
y = center[1] + radius * 959e-8 * cos;
points[i] = [x, y];
}
points[points.length] = points[0];
return points;
}
class arcgisObj {
static getPointOn(mapId, mapLyerName, pointIcon, Fn, Fn2) {
let view = window[mapId + "mapObj"][mapId + "view"];
let PointLayer = window[mapId + "mapObj"][mapId + "map"].findLayerById(mapLyerName);
PointLayer.visible = true;
EventmouseClick = view.on("immediate-click", function(event) {
if (event.button == 0) {
$(".MapmessageBox").css({
display: "none"
});
if (EventmouseMove) {
EventmouseMove.remove();
}
Fn(event.mapPoint);
} else if (event.button == 2) {
$(".MapmessageBox").css({
display: "none"
});
if (EventmouseMove) {
EventmouseMove.remove();
}
if (Fn2) {
Fn2();
}
if (EventmouseClick) {
EventmouseClick.remove();
}
}
});
console.log("object");
PointLayer.on("layerview-destroy", function(event) {
EventmouseClick.remove();
});
}
static getPointOff() {
if (EventmouseClick) {
EventmouseClick.remove();
}
}
static getExtentNum(mapId, fn) {
let view = window[mapId + "mapObj"][mapId + "view"];
watchUtils__namespace.watch(view, "extent", (extent) => {
let level = Math.round(view.zoom);
let center = [view.center.longitude, view.center.latitude];
if (view.extent) {
fn({ level, center });
}
});
}
static eventPointMark(mapId, mapLyerName, pointIcon, point, html, dragFn) {
let view = window[mapId + "mapObj"][mapId + "view"];
let PointLayer = window[mapId + "mapObj"][mapId + "map"].findLayerById(mapLyerName);
PointLayer.visible = true;
if (PointLayer) {
PointLayer.removeAll();
}
let p = {
type: "point",
longitude: point.longitude || 0,
latitude: point.latitude || 0
};
let pt = new Point(p);
let symbol2 = {
type: "CIMPointSymbol",
symbolLayers: [
{
type: "CIMPictureMarker",
enable: true,
anchorPoint: {
x: 0,
y: 0
},
anchorPointUnits: "Relative",
size: 26,
scaleX: 1,
textureFilter: "Picture",
url: pointIcon.url
}
]
};
let aa1 = {
data: {
type: "CIMSymbolReference",
symbol: symbol2
}
};
let symbol3 = new CIMSymbol(aa1);
let cc = {
geometry: pt,
symbol: symbol3
};
let circleGraphic1 = new Graphic(cc);
PointLayer.add(circleGraphic1);
console.log(PointLayer);
if (html) {
window[mapId + "mapObj"][mapId + "view"].popup.autoOpenEnabled = false;
window[mapId + "mapObj"][mapId + "view"].popup.open({
title: "\u786E\u8BA4\u7F16\u8F91",
content: html,
overwriteActions: true,
location: pt,
fetchFeatures: false,
collapseEnabled: false,
dockOptions: {
buttonEnabled: false
},
highlightEnabled: false,
includeDefaultActions: false
});
$(".hoverBgStyle").css({
display: "none"
});
}
let graphicMove;
let graphicMove1;
function stopEvtPropagation(event) {
event.stopPropagation();
}
let endP;
view.on("pointer-down", function(event1) {
view.hitTest(event1).then((res) => {
if (graphicMove) {
graphicMove.remove();
}
if (res.results.length) {
if (!res.results[0].graphic) {
return;
}
view.popup.close();
graphicMove = view.on("drag", stopEvtPropagation);
graphicMove1 = view.on("pointer-move", function(event2) {
let screenPoint = view.toMap({ x: event2.x, y: event2.y });
endP = screenPoint;
let symbol22 = {
type: "CIMPointSymbol",
symbolLayers: [
{
type: "CIMPictureMarker",
enable: true,
anchorPoint: {
x: 0,
y: 0
},
anchorPointUnits: "Relative",
size: 26,
scaleX: 1,
textureFilter: "Picture",
url: pointIcon.url
}
]
};
let aa12 = {
data: {
type: "CIMSymbolReference",
symbol: symbol22
}
};
let symbol32 = new CIMSymbol(aa12);
let cc2 = {
geometry: screenPoint,
symbol: symbol32
};
let circleGraphic12 = new Graphic(cc2);
PointLayer.removeAll();
PointLayer.add(circleGraphic12);
});
}
});
});
view.on("pointer-up", function(event) {
console.log("object1");
if (graphicMove1) {
console.log(graphicMove1);
graphicMove1.remove();
if (html) {
window[mapId + "mapObj"][mapId + "view"].popup.autoOpenEnabled = false;
window[mapId + "mapObj"][mapId + "view"].popup.open({
title: "\u786E\u8BA4\u7F16\u8F91",
content: html,
overwriteActions: true,
location: endP,
fetchFeatures: false,
collapseEnabled: false,
dockOptions: {
buttonEnabled: false
},
highlightEnabled: false,
includeDefaultActions: false
});
$(".hoverBgStyle").css({
display: "none"
});
}
dragFn(endP);
} else {
return;
}
});
}
static getMoveOn(mapId, mapLyerName, text) {
let view = window[mapId + "mapObj"][mapId + "view"];
let PointLayer = window[mapId + "mapObj"][mapId + "map"].findLayerById(mapLyerName);
PointLayer.visible = true;
EventmouseMove = view.on("pointer-move", function(event) {
hoverStyleShow3(view, event, ".MapmessageBox", text);
});
PointLayer.on("layerview-destroy", function(event) {
EventmouseMove.remove();
});
}
static getMoveOff() {
if (EventmouseMove) {
EventmouseMove.remove();
$(".MapmessageBox").css({
display: "none"
});
}
}
static pPopup(data, mapId, html, title, flag) {
if (!data) {
return;
}
let webMercator;
if (data.longitude && data.latitude) {
if (window[mapId + "mapObj"][mapId + "map"].spatialReference && window[mapId + "mapObj"][mapId + "map"].spatialReference.isWebMercator()) {
webMercator = webMercatorUtils__namespace.lngLatToXY(
Number(data.longitude),
Number(data.latitude)
);
} else {
webMercator = [data.longitude, data.latitude];
}
let point = {
type: "point",
longitude: webMercator[0],
latitude: webMercator[1]
};
let pt = new Point(point);
let popupTemplate = {
title,
content: html || "",
overwriteActions: true
};
if (html) {
window[mapId + "mapObj"][mapId + "view"].popup.open({
title,
content: popupTemplate.content,
overwriteActions: true,
location: pt,
fetchFeatures: false,
collapseEnabled: false,
dockOptions: {
buttonEnabled: false
},
highlightEnabled: false,
includeDefaultActions: false
});
hoverFlag = data.id;
$(".hoverBgStyle").css({
display: "none"
});
setTimeout(() => {
$(".esri-popup__button").on("click", function() {
hoverFlag = "1";
});
if (!flag) {
window[mapId + "mapObj"][mapId + "view"].goTo(pt);
} else {
let level = Math.round(window[mapId + "mapObj"][mapId + "view"].zoom);
let center = [
window[mapId + "mapObj"][mapId + "view"].center.longitude,
window[mapId + "mapObj"][mapId + "view"].center.latitude
];
window[mapId + "mapObj"][mapId + "view"].goTo({
center,
zoom: level
});
}
}, 200);
}
}
}
static pointIconCenter(imgObj, data, id, mapId, html) {
let obj = {
img: imgObj.imgUrl,
width: imgObj.width * dpr,
height: imgObj.height * dpr
};
if (!data || !id) {
return;
}
let fixedLayer = window[mapId + "mapObj"][mapId + "map"].findLayerById(id);
if (fixedLayer) {
fixedLayer.removeAll();
}
let webMercator;
if (data.longitude && data.latitude) {
if (window[mapId + "mapObj"][mapId + "map"].spatialReference && window[mapId + "mapObj"][mapId + "map"].spatialReference.isWebMercator()) {
webMercator = webMercatorUtils__namespace.lngLatToXY(
Number(data.longitude),
Number(data.latitude)
);
} else {
webMercator = [data.longitude, data.latitude];
}
let point = {
type: "point",
longitude: webMercator[0],
latitude: webMercator[1]
};
let markPoint1 = {
type: "point",
longitude: webMercator[0],
latitude: webMercator[1]
};
let pt = new Point(point);
let pt1 = new Point(markPoint1);
let symbol = {
url: obj.img,
width: obj.width,
height: obj.height,
yoffset: -12
};
let PictureMarkerSymbols = new PictureMarkerSymbol(symbol);
let popupTemplate = {
title: "",
content: html || "",
overwriteActions: true
};
let Graphic$1 = {
geometry: pt,
symbol: PictureMarkerSymbols,
attributes: data,
popupTemplate
};
let g = new Graphic(Graphic$1);
fixedLayer.add(g);
window[mapId + "mapObj"][mapId + "view"].goTo(pt);
if (html) {
window[mapId + "mapObj"][mapId + "view"].popup.open({
title: "",
content: popupTemplate.content,
overwriteActions: true,
location: pt1,
fetchFeatures: false,
features: g,
collapseEnabled: false,
dockOptions: {
buttonEnabled: false
},
highlightEnabled: false,
includeDefaultActions: false
});
}
}
}
static pointIconCenterS(imgObj, data, id, mapId, html) {
let obj = {
img: imgObj.imgUrl,
width: imgObj.width * dpr,
height: imgObj.height * dpr
};
if (!data || !id) {
return;
}
let fixedLayer = window[mapId + "mapObj"][mapId + "map"].findLayerById(id);
if (fixedLayer) {
fixedLayer.removeAll();
}
let webMercator;
if (data.longitude && data.latitude) {
if (window[mapId + "mapObj"][mapId + "map"].spatialReference && window[mapId + "mapObj"][mapId + "map"].spatialReference.isWebMer