Commit ada8912c authored by zhengjiangtao's avatar zhengjiangtao

新增站端页面及离线地图

parent deb27ef9
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
Amos.config = { Amos.config = {
// 普通http // 普通http
httpURI: { httpURI: {
baseURI: 'http://127.0.0.1:10005/', baseURI: 'http://127.0.0.1:10005/'
//设计器数据绑定 //设计器数据绑定
// dataBindUrl: 'http://172.16.10.91:8083/api/visual/common/dataBind' // dataBindUrl: 'http://172.16.10.91:8083/api/visual/common/dataBind'
}, },
// websocket 地址 // websocket 地址
wsURI: { wsURI: {
baseURI: 'ws://172.16.10.91:10600/', baseURI: 'ws://172.16.10.91:10600/',
ruleURI: 'ws://172.16.3.63:8083/', ruleURI: 'ws://172.16.3.63:8083/'
}, },
// 外部链接地址 // 外部链接地址
outterURI: { outterURI: {
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
isAutoOpenBussiness: true, isAutoOpenBussiness: true,
//是否全景监控显示ue4 //是否全景监控显示ue4
is3dUe4: false, is3dUe4: false,
//内外部地图加载,outMap是true 使用离线地图, false使用在线地图
outMap: true,
convertor: { convertor: {
// 设置3d页面统计配置 // 设置3d页面统计配置
mapLevelconfig: { mapLevelconfig: {
...@@ -103,7 +105,14 @@ ...@@ -103,7 +105,14 @@
code: 2, code: 2,
value: 1 value: 1
} }
} },
//地图中心点
mapCenter: [108.90771484, 35.93184115],
//地图zoom显示级别
showZoom: [7, 13, 18],
//离线地图地址
picURI: 'http://172.16.3.121:8001/'
}; };
// 配置日志系统 // 配置日志系统
......
# 高德地图离线API
1. 将整个amap目录拷贝到tomcat/webapps目录下
2. 下载瓦片,将瓦片拷贝到amap/tiles目录下
3. 启动tomcat,访问[http://localhost:8080/amap/index.html](http://localhost:8080/amap/index.html)
备注:
高德地图离线版本version: 1.4.6 <br>
插件下载地址: <br>
http://webapi.amap.com/maps/modules?v=1.4.6&key=YOUR_KEY&vrs=1525262380887&m=AMap.IndoorMap3D <br>
样式表下载地址: <br>
http://vdata.amap.com/style?v=1.4.6&key=YOUR_KEY&mapstyle=normal <br>
图片下载域名: <br>
http://webapi.amap.com <br>
http://vdata.amap.com <br>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>amap</display-name>
<!--CORS 跨域资源访问
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.preflight.maxage</param-name>
<param-value>10</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
</web-app>
\ No newline at end of file
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/Const", [], function() {
return {
BBRFLAG: {
I: 1,
S: 2
},
ADCODES: {
COUNTRY: 1e5
}
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/geomUtils", [], function() {
function polygonClip(subjectPolygon, clipPolygon) {
var cp1, cp2, s, e, outputList = subjectPolygon;
cp1 = clipPolygon[clipPolygon.length - 2];
for (var j = 0, jlen = clipPolygon.length - 1; j < jlen; j++) {
cp2 = clipPolygon[j];
var inputList = outputList;
outputList = [];
s = inputList[inputList.length - 1];
for (var i = 0, len = inputList.length; i < len; i++) {
e = inputList[i];
if (clipInside(e, cp1, cp2)) {
clipInside(s, cp1, cp2) || outputList.push(clipIntersection(cp1, cp2, s, e));
outputList.push(e);
} else clipInside(s, cp1, cp2) && outputList.push(clipIntersection(cp1, cp2, s, e));
s = e;
}
cp1 = cp2;
}
if (outputList.length < 3) return [];
outputList.push(outputList[0]);
return outputList;
}
function pointOnSegment(p, p1, p2) {
var tx = (p2[1] - p1[1]) / (p2[0] - p1[0]) * (p[0] - p1[0]) + p1[1];
return Math.abs(tx - p[1]) < 1e-6 && p[0] >= p1[0] && p[0] <= p2[0];
}
function pointOnPolygon(point, vs) {
for (var i = 0, len = vs.length; i < len - 1; i++) if (pointOnSegment(point, vs[i], vs[i + 1])) return !0;
return !1;
}
function pointInPolygon(point, vs) {
for (var x = point[0], y = point[1], inside = !1, i = 0, len = vs.length, j = len - 1; i < len; j = i++) {
var xi = vs[i][0], yi = vs[i][1], xj = vs[j][0], yj = vs[j][1], intersect = yi > y != yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
intersect && (inside = !inside);
}
return inside;
}
function getClosestPointOnSegment(p, p1, p2) {
var t, x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y, dot = dx * dx + dy * dy;
if (dot > 0) {
t = ((p[0] - x) * dx + (p[1] - y) * dy) / dot;
if (t > 1) {
x = p2[0];
y = p2[1];
} else if (t > 0) {
x += dx * t;
y += dy * t;
}
}
return [ x, y ];
}
function sqClosestDistanceToSegment(p, p1, p2) {
var p3 = getClosestPointOnSegment(p, p1, p2), dx = p[0] - p3[0], dy = p[1] - p3[1];
return dx * dx + dy * dy;
}
function sqClosestDistanceToPolygon(p, points) {
for (var minSq = Number.MAX_VALUE, i = 0, len = points.length; i < len - 1; i++) {
var sq = sqClosestDistanceToSegment(p, points[i], points[i + 1]);
sq < minSq && (minSq = sq);
}
return minSq;
}
var clipInside = function(p, cp1, cp2) {
return (cp2[0] - cp1[0]) * (p[1] - cp1[1]) > (cp2[1] - cp1[1]) * (p[0] - cp1[0]);
}, clipIntersection = function(cp1, cp2, s, e) {
var dc = [ cp1[0] - cp2[0], cp1[1] - cp2[1] ], dp = [ s[0] - e[0], s[1] - e[1] ], n1 = cp1[0] * cp2[1] - cp1[1] * cp2[0], n2 = s[0] * e[1] - s[1] * e[0], n3 = 1 / (dc[0] * dp[1] - dc[1] * dp[0]);
return [ (n1 * dp[0] - n2 * dc[0]) * n3, (n1 * dp[1] - n2 * dc[1]) * n3 ];
};
return {
sqClosestDistanceToPolygon: sqClosestDistanceToPolygon,
sqClosestDistanceToSegment: sqClosestDistanceToSegment,
pointOnSegment: pointOnSegment,
pointOnPolygon: pointOnPolygon,
pointInPolygon: pointInPolygon,
polygonClip: polygonClip
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/bbIdxBuilder", [ "./Const", "./geomUtils" ], function(Const, geomUtils) {
function parseRanges(ranges, radix) {
for (var nums = [], i = 0, len = ranges.length; i < len; i++) {
var parts = ranges[i].split("-"), start = parts[0], end = parts.length > 1 ? parts[1] : start;
start = parseInt(start, radix);
end = parseInt(end, radix);
for (var j = start; j <= end; j++) nums.push(j);
}
return nums;
}
function add2BBList(bbList, seqIdx, result) {
if (bbList[seqIdx]) throw new Error("Alreay exists: ", bbList[seqIdx]);
bbList[seqIdx] = result;
}
function getFlagI(idx) {
flagIList[idx] || (flagIList[idx] = [ BBRFLAG.I, idx ]);
return flagIList[idx];
}
function parseILine(line, radix, bbList) {
if (line) for (var parts = line.split(":"), fIdx = parseInt(parts[0], radix), bIdxes = parseRanges(parts[1].split(","), radix), item = getFlagI(fIdx), i = 0, len = bIdxes.length; i < len; i++) add2BBList(bbList, bIdxes[i], item);
}
function parseSLine(line, radix, bbList) {
if (line) {
for (var item, parts = line.split(":"), bIdx = parseInt(parts[0], radix), fList = parts[1].split(";"), secList = [], i = 0, len = fList.length; i < len; i++) {
parts = fList[i].split(",");
item = [ parseInt(parts[0], radix), 0 ];
parts.length > 1 && (item[1] = parseInt(parts[1], radix));
secList.push(item);
}
add2BBList(bbList, bIdx, [ BBRFLAG.S, secList ]);
}
}
function parseMaxRect(l, radix) {
if (!l) return null;
for (var parts = l.split(","), rect = [], i = 0, len = parts.length; i < len; i++) {
var n = parseInt(parts[i], radix);
if (n < 0) return null;
rect.push(parseInt(parts[i], radix));
}
return rect;
}
function parseMultiMaxRect(l, radix) {
if (!l) return null;
for (var parts = l.split(";"), rectList = [], i = 0, len = parts.length; i < len; i++) rectList.push(parseMaxRect(parts[i], radix));
return rectList;
}
function buildIdxList(res) {
var i, len, radix = res.r, bbList = [], inList = res.idx.i.split("|");
res.idx.i = null;
for (i = 0, len = inList.length; i < len; i++) parseILine(inList[i], radix, bbList);
inList.length = 0;
var secList = res.idx.s.split("|");
res.idx.s = null;
for (i = 0, len = secList.length; i < len; i++) parseSLine(secList[i], radix, bbList);
secList.length = 0;
res.idx = null;
res.idxList = bbList;
if (res.mxr) {
res.maxRect = parseMaxRect(res.mxr, radix);
res.mxr = null;
}
if (res.mxsr) {
res.maxSubRect = parseMultiMaxRect(res.mxsr, radix);
res.mxsr = null;
}
}
function buildRectFeatureClip(data, rect, ringIdxList) {
for (var features = data.geoData.sub.features, i = 0, len = ringIdxList.length; i < len; i++) {
var idxItem = ringIdxList[i], feature = features[idxItem[0]], ring = feature.geometry.coordinates[idxItem[1]][0], clipedRing = geomUtils.polygonClip(ring, rect);
!clipedRing || clipedRing.length < 4 ? console.warn("Cliped ring length werid: " + clipedRing) : idxItem[2] = clipedRing;
}
return !0;
}
function prepareGridFeatureClip(data, x, y) {
var bbIdx = data.bbIndex, step = bbIdx.s;
(x < 0 || y < 0 || y >= bbIdx.h || x >= bbIdx.w) && console.warn("Wrong x,y", x, y, bbIdx);
var seqIdx = y * bbIdx.w + x, idxItem = bbIdx.idxList[seqIdx];
if (idxItem[0] !== BBRFLAG.S) return !1;
var ringIdxList = idxItem[1];
if (ringIdxList[0].length > 2) return !1;
var rectX = x * step + bbIdx.l, rectY = y * step + bbIdx.t;
buildRectFeatureClip(data, [ [ rectX, rectY ], [ rectX + step, rectY ], [ rectX + step, rectY + step ], [ rectX, rectY + step ], [ rectX, rectY ] ], ringIdxList);
return !0;
}
var BBRFLAG = Const.BBRFLAG, flagIList = [];
return {
prepareGridFeatureClip: prepareGridFeatureClip,
buildIdxList: buildIdxList
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/BoundsItem", [ "lib/utils" ], function(utils) {
function BoundsItem(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
utils.extend(BoundsItem, {
getBoundsItemToExpand: function() {
return new BoundsItem(Number.MAX_VALUE, Number.MAX_VALUE, -1, -1);
},
boundsContainPoint: function(b, p) {
return b.x <= p.x && b.x + b.width >= p.x && b.y <= p.y && b.y + b.height >= p.y;
},
boundsContain: function(b1, b2) {
return b1.x <= b2.x && b1.x + b1.width >= b2.x + b2.width && b1.y <= b2.y && b1.y + b1.height >= b2.y + b2.height;
},
boundsIntersect: function(b1, b2) {
return b1.x <= b2.x + b2.width && b2.x <= b1.x + b1.width && b1.y <= b2.y + b2.height && b2.y <= b1.y + b1.height;
}
});
utils.extend(BoundsItem.prototype, {
containBounds: function(b) {
return BoundsItem.boundsContain(this, b);
},
containPoint: function(p) {
return BoundsItem.boundsContainPoint(this, p);
},
clone: function() {
return new BoundsItem(this.x, this.y, this.width, this.height);
},
isEmpty: function() {
return this.width < 0;
},
getMin: function() {
return {
x: this.x,
y: this.y
};
},
getMax: function() {
return {
x: this.x + this.width,
y: this.y + this.height
};
},
expandByPoint: function(x, y) {
var minX, minY, maxX, maxY;
if (this.isEmpty()) {
minX = maxX = x;
minY = maxY = y;
} else {
minX = this.x;
minY = this.y;
maxX = this.x + this.width;
maxY = this.y + this.height;
x < minX ? minX = x : x > maxX && (maxX = x);
y < minY ? minY = y : y > maxY && (maxY = y);
}
this.x = minX;
this.y = minY;
this.width = maxX - minX;
this.height = maxY - minY;
},
expandByBounds: function(bounds) {
if (!bounds.isEmpty()) {
var minX = this.x, minY = this.y, maxX = this.x + this.width, maxY = this.y + this.height, newMinX = bounds.x, newMaxX = bounds.x + bounds.width, newMinY = bounds.y, newMaxY = bounds.y + bounds.height;
if (this.isEmpty()) {
minX = newMinX;
minY = newMinY;
maxX = newMaxX;
maxY = newMaxY;
} else {
newMinX < minX && (minX = newMinX);
newMaxX > maxX && (maxX = newMaxX);
newMinY < minY && (minY = newMinY);
newMaxY > maxY && (maxY = newMaxY);
}
this.x = minX;
this.y = minY;
this.width = maxX - minX;
this.height = maxY - minY;
}
},
getTopLeft: function() {
return {
x: this.x,
y: this.y
};
},
getTopRight: function() {
return {
x: this.x + this.width,
y: this.y
};
},
getBottomLeft: function() {
return {
x: this.x,
y: this.y + this.height
};
},
getBottomRight: function() {
return {
x: this.x + this.width,
y: this.y + this.height
};
}
});
return BoundsItem;
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/ext/topojson-client", [ "exports" ], function(exports) {
"use strict";
function feature$1(topology, o) {
var id = o.id, bbox = o.bbox, properties = null == o.properties ? {} : o.properties, geometry = object(topology, o);
return null == id && null == bbox ? {
type: "Feature",
properties: properties,
geometry: geometry
} : null == bbox ? {
type: "Feature",
id: id,
properties: properties,
geometry: geometry
} : {
type: "Feature",
id: id,
bbox: bbox,
properties: properties,
geometry: geometry
};
}
function object(topology, o) {
function arc(i, points) {
points.length && points.pop();
for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) points.push(transformPoint(a[k], k));
i < 0 && reverse(points, n);
}
function point(p) {
return transformPoint(p);
}
function line(arcs) {
for (var points = [], i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);
points.length < 2 && points.push(points[0]);
return points;
}
function ring(arcs) {
for (var points = line(arcs); points.length < 4; ) points.push(points[0]);
return points;
}
function polygon(arcs) {
return arcs.map(ring);
}
function geometry(o) {
var coordinates, type = o.type;
switch (type) {
case "GeometryCollection":
return {
type: type,
geometries: o.geometries.map(geometry)
};
case "Point":
coordinates = point(o.coordinates);
break;
case "MultiPoint":
coordinates = o.coordinates.map(point);
break;
case "LineString":
coordinates = line(o.arcs);
break;
case "MultiLineString":
coordinates = o.arcs.map(line);
break;
case "Polygon":
coordinates = polygon(o.arcs);
break;
case "MultiPolygon":
coordinates = o.arcs.map(polygon);
break;
default:
return null;
}
return {
type: type,
coordinates: coordinates
};
}
var transformPoint = transform(topology.transform), arcs = topology.arcs;
return geometry(o);
}
function meshArcs(topology, object$$1, filter) {
var arcs, i, n;
if (arguments.length > 1) arcs = extractArcs(topology, object$$1, filter); else for (i = 0,
arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;
return {
type: "MultiLineString",
arcs: stitch(topology, arcs)
};
}
function extractArcs(topology, object$$1, filter) {
function extract0(i) {
var j = i < 0 ? ~i : i;
(geomsByArc[j] || (geomsByArc[j] = [])).push({
i: i,
g: geom
});
}
function extract1(arcs) {
arcs.forEach(extract0);
}
function extract2(arcs) {
arcs.forEach(extract1);
}
function extract3(arcs) {
arcs.forEach(extract2);
}
function geometry(o) {
switch (geom = o, o.type) {
case "GeometryCollection":
o.geometries.forEach(geometry);
break;
case "LineString":
extract1(o.arcs);
break;
case "MultiLineString":
case "Polygon":
extract2(o.arcs);
break;
case "MultiPolygon":
extract3(o.arcs);
}
}
var geom, arcs = [], geomsByArc = [];
geometry(object$$1);
geomsByArc.forEach(null == filter ? function(geoms) {
arcs.push(geoms[0].i);
} : function(geoms) {
filter(geoms[0].g, geoms[geoms.length - 1].g) && arcs.push(geoms[0].i);
});
return arcs;
}
function planarRingArea(ring) {
for (var a, i = -1, n = ring.length, b = ring[n - 1], area = 0; ++i < n; ) a = b,
b = ring[i], area += a[0] * b[1] - a[1] * b[0];
return Math.abs(area);
}
function mergeArcs(topology, objects) {
function geometry(o) {
switch (o.type) {
case "GeometryCollection":
o.geometries.forEach(geometry);
break;
case "Polygon":
extract(o.arcs);
break;
case "MultiPolygon":
o.arcs.forEach(extract);
}
}
function extract(polygon) {
polygon.forEach(function(ring) {
ring.forEach(function(arc) {
(polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);
});
});
polygons.push(polygon);
}
function area(ring) {
return planarRingArea(object(topology, {
type: "Polygon",
arcs: [ ring ]
}).coordinates[0]);
}
var polygonsByArc = {}, polygons = [], groups = [];
objects.forEach(geometry);
polygons.forEach(function(polygon) {
if (!polygon._) {
var group = [], neighbors = [ polygon ];
polygon._ = 1;
groups.push(group);
for (;polygon = neighbors.pop(); ) {
group.push(polygon);
polygon.forEach(function(ring) {
ring.forEach(function(arc) {
polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {
if (!polygon._) {
polygon._ = 1;
neighbors.push(polygon);
}
});
});
});
}
}
});
polygons.forEach(function(polygon) {
delete polygon._;
});
return {
type: "MultiPolygon",
arcs: groups.map(function(polygons) {
var n, arcs = [];
polygons.forEach(function(polygon) {
polygon.forEach(function(ring) {
ring.forEach(function(arc) {
polygonsByArc[arc < 0 ? ~arc : arc].length < 2 && arcs.push(arc);
});
});
});
arcs = stitch(topology, arcs);
if ((n = arcs.length) > 1) for (var ki, t, i = 1, k = area(arcs[0]); i < n; ++i) (ki = area(arcs[i])) > k && (t = arcs[0],
arcs[0] = arcs[i], arcs[i] = t, k = ki);
return arcs;
})
};
}
var identity = function(x) {
return x;
}, transform = function(transform) {
if (null == transform) return identity;
var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1];
return function(input, i) {
i || (x0 = y0 = 0);
var j = 2, n = input.length, output = new Array(n);
output[0] = (x0 += input[0]) * kx + dx;
output[1] = (y0 += input[1]) * ky + dy;
for (;j < n; ) output[j] = input[j], ++j;
return output;
};
}, bbox = function(topology) {
function bboxPoint(p) {
p = t(p);
p[0] < x0 && (x0 = p[0]);
p[0] > x1 && (x1 = p[0]);
p[1] < y0 && (y0 = p[1]);
p[1] > y1 && (y1 = p[1]);
}
function bboxGeometry(o) {
switch (o.type) {
case "GeometryCollection":
o.geometries.forEach(bboxGeometry);
break;
case "Point":
bboxPoint(o.coordinates);
break;
case "MultiPoint":
o.coordinates.forEach(bboxPoint);
}
}
var key, t = transform(topology.transform), x0 = 1 / 0, y0 = x0, x1 = -x0, y1 = -x0;
topology.arcs.forEach(function(arc) {
for (var p, i = -1, n = arc.length; ++i < n; ) {
p = t(arc[i], i);
p[0] < x0 && (x0 = p[0]);
p[0] > x1 && (x1 = p[0]);
p[1] < y0 && (y0 = p[1]);
p[1] > y1 && (y1 = p[1]);
}
});
for (key in topology.objects) bboxGeometry(topology.objects[key]);
return [ x0, y0, x1, y1 ];
}, reverse = function(array, n) {
for (var t, j = array.length, i = j - n; i < --j; ) t = array[i], array[i++] = array[j],
array[j] = t;
}, feature = function(topology, o) {
return "GeometryCollection" === o.type ? {
type: "FeatureCollection",
features: o.geometries.map(function(o) {
return feature$1(topology, o);
})
} : feature$1(topology, o);
}, stitch = function(topology, arcs) {
function ends(i) {
var p1, arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0];
topology.transform ? (p1 = [ 0, 0 ], arc.forEach(function(dp) {
p1[0] += dp[0], p1[1] += dp[1];
})) : p1 = arc[arc.length - 1];
return i < 0 ? [ p1, p0 ] : [ p0, p1 ];
}
function flush(fragmentByEnd, fragmentByStart) {
for (var k in fragmentByEnd) {
var f = fragmentByEnd[k];
delete fragmentByStart[f.start];
delete f.start;
delete f.end;
f.forEach(function(i) {
stitchedArcs[i < 0 ? ~i : i] = 1;
});
fragments.push(f);
}
}
var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1;
arcs.forEach(function(i, j) {
var t, arc = topology.arcs[i < 0 ? ~i : i];
arc.length < 3 && !arc[1][0] && !arc[1][1] && (t = arcs[++emptyIndex], arcs[emptyIndex] = i,
arcs[j] = t);
});
arcs.forEach(function(i) {
var f, g, e = ends(i), start = e[0], end = e[1];
if (f = fragmentByEnd[start]) {
delete fragmentByEnd[f.end];
f.push(i);
f.end = end;
if (g = fragmentByStart[end]) {
delete fragmentByStart[g.start];
var fg = g === f ? f : f.concat(g);
fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;
} else fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
} else if (f = fragmentByStart[end]) {
delete fragmentByStart[f.start];
f.unshift(i);
f.start = start;
if (g = fragmentByEnd[start]) {
delete fragmentByEnd[g.end];
var gf = g === f ? f : g.concat(f);
fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;
} else fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
} else {
f = [ i ];
fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;
}
});
flush(fragmentByEnd, fragmentByStart);
flush(fragmentByStart, fragmentByEnd);
arcs.forEach(function(i) {
stitchedArcs[i < 0 ? ~i : i] || fragments.push([ i ]);
});
return fragments;
}, mesh = function(topology) {
return object(topology, meshArcs.apply(this, arguments));
}, merge = function(topology) {
return object(topology, mergeArcs.apply(this, arguments));
}, bisect = function(a, x) {
for (var lo = 0, hi = a.length; lo < hi; ) {
var mid = lo + hi >>> 1;
a[mid] < x ? lo = mid + 1 : hi = mid;
}
return lo;
}, neighbors = function(objects) {
function line(arcs, i) {
arcs.forEach(function(a) {
a < 0 && (a = ~a);
var o = indexesByArc[a];
o ? o.push(i) : indexesByArc[a] = [ i ];
});
}
function polygon(arcs, i) {
arcs.forEach(function(arc) {
line(arc, i);
});
}
function geometry(o, i) {
"GeometryCollection" === o.type ? o.geometries.forEach(function(o) {
geometry(o, i);
}) : o.type in geometryType && geometryType[o.type](o.arcs, i);
}
var indexesByArc = {}, neighbors = objects.map(function() {
return [];
}), geometryType = {
LineString: line,
MultiLineString: polygon,
Polygon: polygon,
MultiPolygon: function(arcs, i) {
arcs.forEach(function(arc) {
polygon(arc, i);
});
}
};
objects.forEach(geometry);
for (var i in indexesByArc) for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) for (var k = j + 1; k < m; ++k) {
var n, ij = indexes[j], ik = indexes[k];
(n = neighbors[ij])[i = bisect(n, ik)] !== ik && n.splice(i, 0, ik);
(n = neighbors[ik])[i = bisect(n, ij)] !== ij && n.splice(i, 0, ij);
}
return neighbors;
}, untransform = function(transform) {
if (null == transform) return identity;
var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1];
return function(input, i) {
i || (x0 = y0 = 0);
var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky);
output[0] = x1 - x0, x0 = x1;
output[1] = y1 - y0, y0 = y1;
for (;j < n; ) output[j] = input[j], ++j;
return output;
};
}, quantize = function(topology, transform) {
function quantizePoint(point) {
return t(point);
}
function quantizeGeometry(input) {
var output;
switch (input.type) {
case "GeometryCollection":
output = {
type: "GeometryCollection",
geometries: input.geometries.map(quantizeGeometry)
};
break;
case "Point":
output = {
type: "Point",
coordinates: quantizePoint(input.coordinates)
};
break;
case "MultiPoint":
output = {
type: "MultiPoint",
coordinates: input.coordinates.map(quantizePoint)
};
break;
default:
return input;
}
null != input.id && (output.id = input.id);
null != input.bbox && (output.bbox = input.bbox);
null != input.properties && (output.properties = input.properties);
return output;
}
function quantizeArc(input) {
var p, i = 0, j = 1, n = input.length, output = new Array(n);
output[0] = t(input[0], 0);
for (;++i < n; ) ((p = t(input[i], i))[0] || p[1]) && (output[j++] = p);
1 === j && (output[j++] = [ 0, 0 ]);
output.length = j;
return output;
}
if (topology.transform) throw new Error("already quantized");
if (transform && transform.scale) box = topology.bbox; else {
if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be ≥2");
box = topology.bbox || bbox(topology);
var n, x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3];
transform = {
scale: [ x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1 ],
translate: [ x0, y0 ]
};
}
var box, key, t = untransform(transform), inputs = topology.objects, outputs = {};
for (key in inputs) outputs[key] = quantizeGeometry(inputs[key]);
return {
type: "Topology",
bbox: box,
transform: transform,
objects: outputs,
arcs: topology.arcs.map(quantizeArc)
};
};
exports.bbox = bbox;
exports.feature = feature;
exports.mesh = mesh;
exports.meshArcs = meshArcs;
exports.merge = merge;
exports.mergeArcs = mergeArcs;
exports.neighbors = neighbors;
exports.quantize = quantize;
exports.transform = transform;
exports.untransform = untransform;
Object.defineProperty(exports, "__esModule", {
value: !0
});
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/distDataParser", [ "./bbIdxBuilder", "./BoundsItem", "../ext/topojson-client" ], function(bbIdxBuilder, BoundsItem, topojson) {
function parseTopo(topo) {
var result = {}, objects = topo.objects;
for (var k in objects) objects.hasOwnProperty(k) && (result[k] = topojson.feature(topo, objects[k]));
return result;
}
function filterSub(geoData) {
for (var features = geoData.sub ? geoData.sub.features : [], parentProps = geoData.parent.properties, subAcroutes = (parentProps.acroutes || []).concat([ parentProps.adcode ]), i = 0, len = features.length; i < len; i++) {
features[i].properties.subFeatureIndex = i;
features[i].properties.acroutes = subAcroutes;
}
}
function buildData(data) {
if (!data._isBuiled) {
bbIdxBuilder.buildIdxList(data.bbIndex);
data.geoData = parseTopo(data.topo);
data.geoData.sub && filterSub(data.geoData);
var bbox = data.topo.bbox;
data.bounds = new BoundsItem(bbox[0], bbox[1], bbox[2] - bbox[0], bbox[3] - bbox[1]);
data.topo = null;
data._isBuiled = !0;
}
return data;
}
return {
buildData: buildData
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/AreaNode", [ "lib/utils", "lib/SphericalMercator", "./Const", "./geomUtils", "./bbIdxBuilder" ], function(utils, SphericalMercator, Const, geomUtils, bbIdxBuilder) {
function AreaNode(adcode, data, opts) {
this.adcode = adcode;
this._data = data;
this._sqScaleFactor = data.scale * data.scale;
this._opts = utils.extend({
nearTolerance: 2
}, opts);
this.setNearTolerance(this._opts.nearTolerance);
}
var staticMethods = {
getPropsOfFeature: function(f) {
return f && f.properties ? f.properties : null;
},
getAdcodeOfFeature: function(f) {
return f ? f.properties.adcode : null;
},
doesFeatureHasChildren: function(f) {
return !!f && f.properties.childrenNum > 0;
}
};
utils.extend(AreaNode, staticMethods);
utils.extend(AreaNode.prototype, staticMethods, {
setNearTolerance: function(t) {
this._opts.nearTolerance = t;
this._sqNearTolerance = t * t;
},
getIdealZoom: function() {
return this._data.idealZoom;
},
_getEmptySubFeatureGroupItem: function(idx) {
return {
subFeatureIndex: idx,
subFeature: this.getSubFeatureByIndex(idx),
pointsIndexes: [],
points: []
};
},
groupByPosition: function(points, getPosition) {
var i, len, groupMap = {}, outsideItem = null;
for (i = 0, len = points.length; i < len; i++) {
var idx = this.getLocatedSubFeatureIndex(getPosition.call(null, points[i], i));
groupMap[idx] || (groupMap[idx] = this._getEmptySubFeatureGroupItem(idx));
groupMap[idx].pointsIndexes.push(i);
groupMap[idx].points.push(points[i]);
idx < 0 && (outsideItem = groupMap[idx]);
}
var groupList = [];
if (this._data.geoData.sub) for (i = 0, len = this._data.geoData.sub.features.length; i < len; i++) groupList.push(groupMap[i] || this._getEmptySubFeatureGroupItem(i));
outsideItem && groupList.push(outsideItem);
groupMap = null;
return groupList;
},
getLocatedSubFeature: function(lngLat) {
var fIdx = this.getLocatedSubFeatureIndex(lngLat);
return this.getSubFeatureByIndex(fIdx);
},
getLocatedSubFeatureIndex: function(lngLat) {
return this._getLocatedSubFeatureIndexByPixel(this.lngLatToPixel(lngLat, this._data.pz));
},
getSubFeatureByIndex: function(fIdx) {
if (fIdx >= 0) {
var features = this.getSubFeatures();
return features[fIdx];
}
return null;
},
getSubFeatureByAdcode: function(adcode) {
adcode = parseInt(adcode, 10);
for (var features = this.getSubFeatures(), i = 0, len = features.length; i < len; i++) if (this.getAdcodeOfFeature(features[i]) === adcode) return features[i];
return null;
},
_getLocatedSubFeatureIndexByPixel: function(pixel) {
if (!this._data.geoData.sub) return -1;
var data = this._data, bbIdx = data.bbIndex, offX = pixel[0] - bbIdx.l, offY = pixel[1] - bbIdx.t, y = Math.floor(offY / bbIdx.s), x = Math.floor(offX / bbIdx.s);
if (x < 0 || y < 0 || y >= bbIdx.h || x >= bbIdx.w) return -1;
var seqIdx = y * bbIdx.w + x, idxItem = bbIdx.idxList[seqIdx];
if (!idxItem) return -1;
var BBRFLAG = Const.BBRFLAG;
switch (idxItem[0]) {
case BBRFLAG.I:
return idxItem[1];
case BBRFLAG.S:
bbIdxBuilder.prepareGridFeatureClip(data, x, y, idxItem[1]);
return this._calcLocatedFeatureIndexOfSList(pixel, idxItem[1]);
default:
throw new Error("Unknown BBRFLAG: " + idxItem[0]);
}
},
_calcNearestFeatureIndexOfSList: function(pixel, list) {
var features = [];
this._data.geoData.sub && (features = this._data.geoData.sub.features);
for (var closest = {
sq: Number.MAX_VALUE,
idx: -1
}, i = 0, len = list.length; i < len; i++) {
var idxItem = list[i], feature = features[idxItem[0]], ring = idxItem[2] || feature.geometry.coordinates[idxItem[1]][0], sqDistance = geomUtils.sqClosestDistanceToPolygon(pixel, ring);
if (sqDistance < closest.sq) {
closest.sq = sqDistance;
closest.idx = idxItem[0];
}
}
return closest.sq / this._sqScaleFactor < this._sqNearTolerance ? closest.idx : -1;
},
_calcLocatedFeatureIndexOfSList: function(pixel, list) {
for (var features = this._data.geoData.sub.features, i = 0, len = list.length; i < len; i++) {
var idxItem = list[i], feature = features[idxItem[0]], ring = idxItem[2] || feature.geometry.coordinates[idxItem[1]][0];
if (geomUtils.pointInPolygon(pixel, ring) || geomUtils.pointOnPolygon(pixel, ring)) return idxItem[0];
}
return this._calcNearestFeatureIndexOfSList(pixel, list);
},
pixelToLngLat: function(x, y) {
return SphericalMercator.pointToLngLat([ x, y ], this._data.pz);
},
lngLatToPixel: function(lngLat) {
lngLat instanceof AMap.LngLat && (lngLat = [ lngLat.getLng(), lngLat.getLat() ]);
var pMx = SphericalMercator.lngLatToPoint(lngLat, this._data.pz);
return [ Math.round(pMx[0]), Math.round(pMx[1]) ];
},
_convertRingCoordsToLngLats: function(ring) {
for (var list = [], i = 0, len = ring.length; i < len; i++) list[i] = this.pixelToLngLat(ring[i][0], ring[i][1]);
return list;
},
_convertPolygonCoordsToLngLats: function(poly) {
for (var list = [], i = 0, len = poly.length; i < len; i++) list[i] = this._convertRingCoordsToLngLats(poly[i]);
return list;
},
_convertMultiPolygonCoordsToLngLats: function(polys) {
for (var list = [], i = 0, len = polys.length; i < len; i++) list[i] = this._convertPolygonCoordsToLngLats(polys[i]);
return list;
},
_convertCoordsToLngLats: function(type, coordinates) {
switch (type) {
case "MultiPolygon":
return this._convertMultiPolygonCoordsToLngLats(coordinates);
default:
throw new Error("Unknown type", type);
}
},
_createLngLatFeature: function(f, extraProps) {
var newNode = utils.extend({}, f);
extraProps && utils.extend(newNode.properties, extraProps);
newNode.geometry = utils.extend({}, newNode.geometry);
newNode.geometry.coordinates = this._convertCoordsToLngLats(newNode.geometry.type, newNode.geometry.coordinates);
return newNode;
},
getAdcode: function() {
return this.getProps("adcode");
},
getName: function() {
return this.getProps("name");
},
getChildrenNum: function() {
return this.getProps("childrenNum");
},
getProps: function(key) {
var props = AreaNode.getPropsOfFeature(this._data.geoData.parent);
return props ? key ? props[key] : props : null;
},
getParentFeature: function() {
var geoData = this._data.geoData;
geoData.lngLatParent || (geoData.lngLatParent = this._createLngLatFeature(geoData.parent));
return geoData.lngLatParent;
},
getParentFeatureInPixel: function() {
return this._data.geoData.parent;
},
getSubFeatures: function() {
var geoData = this._data.geoData;
if (!geoData.sub) return [];
if (!geoData.lngLatSubList) {
for (var features = geoData.sub.features, newFList = [], i = 0, len = features.length; i < len; i++) newFList[i] = this._createLngLatFeature(features[i]);
geoData.lngLatSubList = newFList;
}
return [].concat(geoData.lngLatSubList);
},
getSubFeaturesInPixel: function() {
return this._data.geoData.sub ? [].concat(this._data.geoData.sub.features) : [];
},
getBounds: function() {
var data = this._data;
if (!data.lngLatBounds) {
var nodeBounds = this._data.bounds;
data.lngLatBounds = new AMap.Bounds(this.pixelToLngLat(nodeBounds.x, nodeBounds.y + nodeBounds.height), this.pixelToLngLat(nodeBounds.x + nodeBounds.width, nodeBounds.y));
}
return data.lngLatBounds;
}
});
return AreaNode;
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/main", [ "require", "lib/event", "lib/utils", "./lib/Const", "./lib/distDataParser", "./lib/AreaNode" ], function(require, EventCls, utils, Const, distDataParser, AreaNode) {
function DistrictExplorer(opts) {
this._opts = utils.extend({
distDataLoc: "./assets/d_v2",
eventSupport: !1,
keepFeaturePolygonReference: !0,
mouseEventNames: [ "click" ],
mousemoveDebounceWait: -1
}, opts);
DistrictExplorer.__super__.constructor.call(this, this._opts);
this._hoverFeature = null;
this._areaNodesForLocating = null;
this._areaNodeCache = globalAreaNodeCache;
this._renderedPolygons = [];
this._opts.preload && this.loadMultiAreaNodes(this._opts.preload);
this._debouncedHandleMousemove = this._opts.mousemoveDebounceWait > 1 ? utils.debounce(this._handleMousemove, this._opts.mousemoveDebounceWait) : this._handleMousemove;
this._opts.map && this._opts.eventSupport && this._bindMapEvents(!0);
}
var globalAreaNodeCache = {};
utils.inherit(DistrictExplorer, EventCls);
utils.extend(DistrictExplorer.prototype, {
setAreaNodesForLocating: function(areaNodes) {
areaNodes ? utils.isArray(areaNodes) || (areaNodes = [ areaNodes ]) : areaNodes = [];
this._areaNodesForLocating = areaNodes || [];
},
getLocatedSubFeature: function(position) {
var areaNodes = this._areaNodesForLocating;
if (!areaNodes) return null;
for (var i = 0, len = areaNodes.length; i < len; i++) {
var feature = areaNodes[i].getLocatedSubFeature(position);
if (feature) return feature;
}
return null;
},
setMap: function(map) {
var oldMap = this._opts.map;
if (oldMap !== map) {
this.offMapEvents();
this._opts.map = map;
this._opts.map && this._opts.eventSupport && this._bindMapEvents(!0);
}
},
offMapEvents: function() {
this._bindMapEvents(!1);
},
_bindMapEvents: function(on) {
for (var map = this._opts.map, action = on ? "on" : "off", mouseEventNames = this._opts.mouseEventNames, i = 0, len = mouseEventNames.length; i < len; i++) map[action](mouseEventNames[i], this._handleMouseEvent, this);
AMap.UA.mobile || map[action]("mousemove", this._debouncedHandleMousemove, this);
},
_handleMouseEvent: function(e) {
var feature = this.getLocatedSubFeature(e.lnglat);
this.triggerWithOriginalEvent((feature ? "feature" : "outside") + utils.ucfirst(e.type), e, feature);
},
_handleMousemove: function(e) {
var feature = this.getLocatedSubFeature(e.lnglat);
this.setHoverFeature(feature, e);
feature && this.triggerWithOriginalEvent("featureMousemove", e, feature);
},
setHoverFeature: function(feature, e) {
var oldHoverFeature = this._hoverFeature;
if (feature !== oldHoverFeature) {
oldHoverFeature && this.triggerWithOriginalEvent("featureMouseout", e, oldHoverFeature);
this._hoverFeature = feature;
feature && this.triggerWithOriginalEvent("featureMouseover", e, feature, oldHoverFeature);
this.triggerWithOriginalEvent("hoverFeatureChanged", e, feature, oldHoverFeature);
}
},
_loadJson: function(src, callback) {
var self = this;
return require([ "json!" + src ], function(data) {
callback && callback.call(self, null, data);
}, function(error) {
if (!callback) throw error;
callback(error);
});
},
_getAreaNodeDataFileName: function(adcode) {
return "an_" + adcode + ".json";
},
_getAreaNodeDataSrc: function(adcode) {
return this._opts.distDataLoc + "/" + this._getAreaNodeDataFileName(adcode);
},
_isAreaNodeJsonId: function(id, adcode) {
return id.indexOf(!1) && id.indexOf(this._getAreaNodeDataFileName(adcode)) > 0;
},
_undefAreaNodeJson: function(adcode) {
var id = AMapUI.findDefinedId(function(id) {
return this._isAreaNodeJsonId(id, adcode);
}, this);
if (id) {
AMapUI.require.undef(id);
return !0;
}
return !1;
},
loadAreaTree: function(callback) {
this._loadJson(this._opts.distDataLoc + "/area_tree.json", callback);
},
loadCountryNode: function(callback) {
this.loadAreaNode(Const.ADCODES.COUNTRY, callback);
},
loadMultiAreaNodes: function(adcodes, callback) {
function buildCallback(i) {
return function(error, areaNode) {
if (!done) {
left--;
if (error) {
callback && callback(error);
done = !0;
} else {
results[i] = areaNode;
0 === left && callback && callback(null, results);
}
}
};
}
if (adcodes && adcodes.length) for (var len = adcodes.length, left = len, results = [], done = !1, i = 0; i < len; i++) this.loadAreaNode(adcodes[i], callback ? buildCallback(i) : null); else callback && callback(null, []);
},
loadAreaNode: function(adcode, callback, thisArg, canSync) {
thisArg = thisArg || this;
if (this._areaNodeCache[adcode]) {
if (callback) {
var areaNode = this._areaNodeCache[adcode];
canSync ? callback.call(thisArg, null, areaNode, !0) : setTimeout(function() {
callback.call(thisArg, null, areaNode);
}, 0);
}
} else this._loadJson(this._getAreaNodeDataSrc(adcode), function(err, data) {
if (err) callback && callback.call(thisArg, err); else {
this._buildAreaNode(adcode, data);
callback && callback.call(thisArg, null, this._areaNodeCache[adcode]);
}
});
},
getLocalAreaNode: function(adcode) {
return this._areaNodeCache[adcode] || null;
},
locatePosition: function(lngLat, callback, opts) {
opts = utils.extend({
levelLimit: 10
}, opts);
var parentNode = opts.parentNode;
parentNode ? this._routeLocate(lngLat, parentNode, [], callback, opts) : this.loadCountryNode(function(err, countryNode) {
err ? callback && callback(err) : this._routeLocate(lngLat, countryNode, [], callback, opts);
});
},
_routeLocate: function(lngLat, parentNode, routes, callback, opts) {
var subFeature = parentNode.getLocatedSubFeature(lngLat), gotChildren = !1;
if (subFeature) {
routes.pop();
routes.push(parentNode.getParentFeature());
routes.push(subFeature);
gotChildren = parentNode.doesFeatureHasChildren(subFeature);
}
gotChildren && routes.length < opts.levelLimit ? this.loadAreaNode(parentNode.getAdcodeOfFeature(subFeature), function(err, subNode) {
err ? callback && callback(err) : this._routeLocate(lngLat, subNode, routes, callback, opts);
}) : callback && callback.call(this, null, routes.slice(0, opts.levelLimit));
},
_buildAreaNode: function(adcode, distData) {
if (!this._areaNodeCache[adcode]) {
if (!distData) throw new Error("Empty distData: " + adcode);
var areaNode = new AreaNode(adcode, distDataParser.buildData(distData), this._opts);
this._areaNodeCache[adcode] = areaNode;
this._areaNodesForLocating || (this._areaNodesForLocating = [ areaNode ]);
}
},
_renderMultiPolygon: function(coords, styleOptions, attchedData) {
for (var polygons = [], i = 0, len = coords.length; i < len; i++) styleOptions && polygons.push(this._renderPolygon(coords[i], styleOptions[i] || styleOptions, attchedData));
return polygons;
},
_renderPolygon: function(coords, styleOptions, attchedData) {
if (!styleOptions) return null;
var polygon = new AMap.Polygon(utils.extend({
bubble: !0,
lineJoin: "round",
map: this._opts.map
}, styleOptions, {
path: coords
}));
attchedData && (polygon._attched = attchedData);
this._opts.keepFeaturePolygonReference && this._renderedPolygons.push(polygon);
return polygon;
},
getAdcodeOfFeaturePolygon: function(polygon) {
return polygon._attched ? polygon._attched.adcode : null;
},
findFeaturePolygonsByAdcode: function(adcode) {
var list = this._renderedPolygons, polys = [];
adcode = parseInt(adcode, 10);
for (var i = 0, len = list.length; i < len; i++) this.getAdcodeOfFeaturePolygon(list[i]) === adcode && polys.push(list[i]);
return polys;
},
getAllFeaturePolygons: function() {
return this._renderedPolygons;
},
clearFeaturePolygons: function() {
for (var list = this._renderedPolygons, i = 0, len = list.length; i < len; i++) list[i].setMap(null);
list.length = 0;
},
removeFeaturePolygonsByAdcode: function(adcode) {
this.removeFeaturePolygons(this.findFeaturePolygonsByAdcode(adcode));
},
removeFeaturePolygons: function(polygons) {
for (var list = this._renderedPolygons, i = 0, len = list.length; i < len; i++) if (polygons.indexOf(list[i]) >= 0) {
list[i].setMap(null);
list.splice(i, 1);
i--;
len--;
}
},
clearAreaNodeCacheByAdcode: function(adcode) {
var nodeCache = this._areaNodeCache;
if (this._undefAreaNodeJson(adcode)) {
delete nodeCache[adcode];
return !0;
}
console.warn("Failed undef: ", adcode);
return !1;
},
clearAreaNodeCache: function(match) {
if (match) return this.clearAreaNodeCacheByAdcode(match);
var nodeCache = this._areaNodeCache;
for (var adcode in nodeCache) nodeCache.hasOwnProperty(adcode) && this.clearAreaNodeCacheByAdcode(adcode);
},
renderFeature: function(feature, styleOptions) {
if (!styleOptions) return null;
var geometry = feature.geometry;
if (!geometry) return null;
var coords = geometry.coordinates, attchedData = feature.properties, results = [];
switch (geometry.type) {
case "MultiPolygon":
results = this._renderMultiPolygon(coords, styleOptions, attchedData);
break;
case "Polygon":
results = [ this._renderPolygon(coords, styleOptions, attchedData) ];
break;
default:
throw new Error("Unknow geometry: " + geometry.type);
}
return results;
},
renderSubFeatures: function(areaNode, subStyleOption) {
for (var features = areaNode.getSubFeatures(), isSubStyleFunc = utils.isFunction(subStyleOption), results = [], i = 0, len = features.length; i < len; i++) {
var feature = features[i];
results.push(this.renderFeature(feature, isSubStyleFunc ? subStyleOption.call(this, feature, i) : subStyleOption));
}
return results;
},
renderParentFeature: function(areaNode, parentStyleOption) {
return this.renderFeature(areaNode.getParentFeature(), parentStyleOption);
}
});
return DistrictExplorer;
});
AMapUI.weakDefine("ui/geo/DistrictExplorer", [ "ui/geo/DistrictExplorer/main" ], function(m) {
return m;
});
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
(function(window){
window.AMapUI_DEBUG = false;
!function(global) {
if (!global.AMap) throw new Error("请前置引入高德地图api,参见http://lbs.amap.com/api/javascript-api/gettingstarted/");
}(window);
var AMapUI;!function(){if(!AMapUI||!AMapUI.requirejs){AMapUI?require=AMapUI:AMapUI={};var requirejs,require,define;!function(global,setTimeout){function commentReplace(e,t){return t||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var r;for(r=0;r<e.length&&(!e[r]||!t(e[r],r,e));r+=1);}}function eachReverse(e,t){if(e){var r;for(r=e.length-1;r>-1&&(!e[r]||!t(e[r],r,e));r-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var r;for(r in e)if(hasProp(e,r)&&t(e[r],r))break}function mixin(e,t,r,n){return t&&eachProp(t,function(t,i){!r&&hasProp(e,i)||(!n||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[i]=t:(e[i]||(e[i]={}),mixin(e[i],t,r,n)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,r,n){var i=new Error(t+"\nhttp://10.56.28.228/requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=n,r&&(i.originalError=r),i}function newContext(e){function t(e){var t,r;for(t=0;t<e.length;t++)if(r=e[t],"."===r)e.splice(t,1),t-=1;else if(".."===r){if(0===t||1===t&&".."===e[2]||".."===e[t-1])continue;t>0&&(e.splice(t-1,2),t-=2)}}function r(e,r,n){var i,o,a,s,u,c,f,p,d,l,h,m,g=r&&r.split("/"),v=w.map,x=v&&v["*"];if(e&&(e=e.split("/"),f=e.length-1,w.nodeIdCompat&&jsSuffixRegExp.test(e[f])&&(e[f]=e[f].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&g&&(m=g.slice(0,g.length-1),e=m.concat(e)),t(e),e=e.join("/")),n&&v&&(g||x)){a=e.split("/");e:for(s=a.length;s>0;s-=1){if(c=a.slice(0,s).join("/"),g)for(u=g.length;u>0;u-=1)if(o=getOwn(v,g.slice(0,u).join("/")),o&&(o=getOwn(o,c))){p=o,d=s;break e}!l&&x&&getOwn(x,c)&&(l=getOwn(x,c),h=s)}!p&&l&&(p=l,d=h),p&&(a.splice(0,d,p),e=a.join("/"))}return i=getOwn(w.pkgs,e),i?i:e}function n(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===q.contextName)return t.parentNode.removeChild(t),!0})}function i(e){var t=getOwn(w.paths,e);if(t&&isArray(t)&&t.length>1)return t.shift(),q.require.undef(e),q.makeRequire(null,{skipMap:!0})([e]),!0}function o(e){var t,r=e?e.indexOf("!"):-1;return r>-1&&(t=e.substring(0,r),e=e.substring(r+1,e.length)),[t,e]}function a(e,t,n,i){var a,s,u,c,f=null,p=t?t.name:null,d=e,l=!0,h="";return e||(l=!1,e="_@r"+(C+=1)),c=o(e),f=c[0],e=c[1],f&&(f=r(f,p,i),s=getOwn(k,f)),e&&(f?h=s&&s.normalize?s.normalize(e,function(e){return r(e,p,i)}):e.indexOf("!")===-1?r(e,p,i):e:(h=r(e,p,i),c=o(h),f=c[0],h=c[1],n=!0,a=q.nameToUrl(h))),u=!f||s||n?"":"_unnormalized"+(T+=1),{prefix:f,name:h,parentMap:t,unnormalized:!!u,url:a,originalName:d,isDefine:l,id:(f?f+"!"+h:h)+u}}function s(e){var t=e.id,r=getOwn(M,t);return r||(r=M[t]=new q.Module(e)),r}function u(e,t,r){var n=e.id,i=getOwn(M,n);!hasProp(k,n)||i&&!i.defineEmitComplete?(i=s(e),i.error&&"error"===t?r(i.error):i.on(t,r)):"defined"===t&&r(k[n])}function c(e,t){var r=e.requireModules,n=!1;t?t(e):(each(r,function(t){var r=getOwn(M,t);r&&(r.error=e,r.events.error&&(n=!0,r.emit("error",e)))}),n||req.onError(e))}function f(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(q.defQueueMap[t]=!0),O.push(e)}),globalDefQueue=[])}function p(e){delete M[e],delete S[e]}function d(e,t,r){var n=e.map.id;e.error?e.emit("error",e.error):(t[n]=!0,each(e.depMaps,function(n,i){var o=n.id,a=getOwn(M,o);!a||e.depMatched[i]||r[o]||(getOwn(t,o)?(e.defineDep(i,k[o]),e.check()):d(a,t,r))}),r[n]=!0)}function l(){var e,t,r=1e3*w.waitSeconds,o=r&&q.startTime+r<(new Date).getTime(),a=[],s=[],u=!1,f=!0;if(!x){if(x=!0,eachProp(S,function(e){var r=e.map,c=r.id;if(e.enabled&&(r.isDefine||s.push(e),!e.error))if(!e.inited&&o)i(c)?(t=!0,u=!0):(a.push(c),n(c));else if(!e.inited&&e.fetched&&r.isDefine&&(u=!0,!r.prefix))return f=!1}),o&&a.length)return e=makeError("timeout","Load timeout for modules: "+a,null,a),e.contextName=q.contextName,c(e);f&&each(s,function(e){d(e,{},{})}),o&&!t||!u||!isBrowser&&!isWebWorker||E||(E=setTimeout(function(){E=0,l()},50)),x=!1}}function h(e){hasProp(k,e[0])||s(a(e[0],null,!0)).init(e[1],e[2])}function m(e,t,r,n){e.detachEvent&&!isOpera?n&&e.detachEvent(n,t):e.removeEventListener(r,t,!1)}function g(e){var t=e.currentTarget||e.srcElement;return m(t,q.onScriptLoad,"load","onreadystatechange"),m(t,q.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(f();O.length;){if(e=O.shift(),null===e[0])return c(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));h(e)}q.defQueueMap={}}var x,b,q,y,E,w={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},M={},S={},A={},O=[],k={},j={},I={},C=1,T=1;return y={require:function(e){return e.require?e.require:e.require=q.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?k[e.map.id]=e.exports:e.exports=k[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(w.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(A,e.id)||{},this.map=e,this.shim=getOwn(w.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,r,n){n=n||{},this.inited||(this.factory=t,r?this.on("error",r):this.events.error&&(r=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=r,this.inited=!0,this.ignore=n.ignore,n.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,q.startTime=(new Date).getTime();var e=this.map;return this.shim?void q.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;j[e]||(j[e]=!0,q.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,r=this.map.id,n=this.depExports,i=this.exports,o=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{i=q.execCb(r,o,n,i)}catch(t){e=t}else i=q.execCb(r,o,n,i);if(this.map.isDefine&&void 0===i&&(t=this.module,t?i=t.exports:this.usingExports&&(i=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",c(this.error=e)}else i=o;if(this.exports=i,this.map.isDefine&&!this.ignore&&(k[r]=i,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(q,this.map,a)}p(r),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(q.defQueueMap,r)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,n=a(e.prefix);this.depMaps.push(n),u(n,"defined",bind(this,function(n){var i,o,f,d=getOwn(I,this.map.id),l=this.map.name,h=this.map.parentMap?this.map.parentMap.name:null,m=q.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(n.normalize&&(l=n.normalize(l,function(e){return r(e,h,!0)})||""),o=a(e.prefix+"!"+l,this.map.parentMap),u(o,"defined",bind(this,function(e){this.map.normalizedMap=o,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),f=getOwn(M,o.id),void(f&&(this.depMaps.push(o),this.events.error&&f.on("error",bind(this,function(e){this.emit("error",e)})),f.enable()))):d?(this.map.url=q.nameToUrl(d),void this.load()):(i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(M,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&p(e.map.id)}),c(e)}),i.fromText=bind(this,function(r,n){var o=e.name,u=a(o),f=useInteractive;n&&(r=n),f&&(useInteractive=!1),s(u),hasProp(w.config,t)&&(w.config[o]=w.config[t]);try{req.exec(r)}catch(e){return c(makeError("fromtexteval","fromText eval for "+t+" failed: "+e,e,[t]))}f&&(useInteractive=!0),this.depMaps.push(u),q.completeLoad(o),m([o],i)}),void n.load(e.name,m,i,w))})),q.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){S[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var r,n,i;if("string"==typeof e){if(e=a(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,i=getOwn(y,e.id))return void(this.depExports[t]=i(this));this.depCount+=1,u(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?u(e,"error",bind(this,this.errback)):this.events.error&&u(e,"error",bind(this,function(e){this.emit("error",e)}))}r=e.id,n=M[r],hasProp(y,r)||!n||n.enabled||q.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(M,e.id);t&&!t.enabled&&q.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var r=this.events[e];r||(r=this.events[e]=[]),r.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},q={config:w,contextName:e,registry:M,defined:k,urlFetched:j,defQueue:O,defQueueMap:{},Module:b,makeModuleMap:a,nextTick:req.nextTick,onError:c,configure:function(e){if(e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/"),"string"==typeof e.urlArgs){var t=e.urlArgs;e.urlArgs=function(e,r){return(r.indexOf("?")===-1?"?":"&")+t}}var r=w.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(w[t]||(w[t]={}),mixin(w[t],e,!0,!0)):w[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(I[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=q.makeShimExports(e)),r[t]=e}),w.shim=r),e.packages&&each(e.packages,function(e){var t,r;e="string"==typeof e?{name:e}:e,r=e.name,t=e.location,t&&(w.paths[r]=e.location),w.pkgs[r]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(M,function(e,t){e.inited||e.map.unnormalized||(e.map=a(t,null,!0))}),(e.deps||e.callback)&&q.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,i){function o(r,n,u){var f,p,d;return i.enableBuildCallback&&n&&isFunction(n)&&(n.__requireJsBuild=!0),"string"==typeof r?isFunction(n)?c(makeError("requireargs","Invalid require call"),u):t&&hasProp(y,r)?y[r](M[t.id]):req.get?req.get(q,r,t,o):(p=a(r,t,!1,!0),f=p.id,hasProp(k,f)?k[f]:c(makeError("notloaded",'Module name "'+f+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),q.nextTick(function(){v(),d=s(a(null,t)),d.skipMap=i.skipMap,d.init(r,n,u,{enabled:!0}),l()}),o)}return i=i||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var n,i=e.lastIndexOf("."),o=e.split("/")[0],a="."===o||".."===o;return i!==-1&&(!a||i>1)&&(n=e.substring(i,e.length),e=e.substring(0,i)),q.nameToUrl(r(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(k,a(e,t,!1,!0).id)},specified:function(e){return e=a(e,t,!1,!0).id,hasProp(k,e)||hasProp(M,e)}}),t||(o.undef=function(e){f();var r=a(e,t,!0),i=getOwn(M,e);i.undefed=!0,n(e),delete k[e],delete j[r.url],delete A[e],eachReverse(O,function(t,r){t[0]===e&&O.splice(r,1)}),delete q.defQueueMap[e],i&&(i.events.defined&&(A[e]=i.events),p(e))}),o},enable:function(e){var t=getOwn(M,e.id);t&&s(e).enable()},completeLoad:function(e){var t,r,n,o=getOwn(w.shim,e)||{},a=o.exports;for(f();O.length;){if(r=O.shift(),null===r[0]){if(r[0]=e,t)break;t=!0}else r[0]===e&&(t=!0);h(r)}if(q.defQueueMap={},n=getOwn(M,e),!t&&!hasProp(k,e)&&n&&!n.inited){if(!(!w.enforceDefine||a&&getGlobal(a)))return i(e)?void 0:c(makeError("nodefine","No define call for "+e,null,[e]));h([e,o.deps||[],o.exportsFn])}l()},nameToUrl:function(e,t,r){var n,i,o,a,s,u,c,f=getOwn(w.pkgs,e);if(f&&(e=f),c=getOwn(I,e))return q.nameToUrl(c,t,r);if(req.jsExtRegExp.test(e))s=e+(t||"");else{for(n=w.paths,i=e.split("/"),o=i.length;o>0;o-=1)if(a=i.slice(0,o).join("/"),u=getOwn(n,a)){isArray(u)&&(u=u[0]),i.splice(0,o,u);break}s=i.join("/"),s+=t||(/^data\:|^blob\:|\?/.test(s)||r?"":".js"),s=("/"===s.charAt(0)||s.match(/^[\w\+\.\-]+:/)?"":w.baseUrl)+s}return w.urlArgs&&!/^blob\:/.test(s)?s+w.urlArgs(e,s):s},load:function(e,t){req.load(q,e,t)},execCb:function(e,t,r,n){return t.apply(n,r)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=g(e);q.completeLoad(t.id)}},onScriptError:function(e){var t=g(e);if(!i(t.id)){var r=[];return eachProp(M,function(e,n){0!==n.indexOf("_@r")&&each(e.depMaps,function(e){if(e.id===t.id)return r.push(n),!0})}),c(makeError("scripterror",'Script error for "'+t.id+(r.length?'", needed by: '+r.join(", "):'"'),e,[t.id]))}}},q.require=q.makeRequire(),q}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){if("interactive"===e.readyState)return interactiveScript=e}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.2",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,r,n){var i,o,a=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=r,r=n):e=[]),o&&o.context&&(a=o.context),i=getOwn(contexts,a),i||(i=contexts[a]=req.s.newContext(a)),o&&i.configure(o),i.require(e,t,r)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,r){var n=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return n.type=e.scriptType||"text/javascript",n.charset="utf-8",n.async=!0,n},req.load=function(e,t,r){var n,i=e&&e.config||{};if(isBrowser)return n=req.createNode(i,t,r),n.setAttribute("data-requirecontext",e.contextName),n.setAttribute("data-requiremodule",t),!n.attachEvent||n.attachEvent.toString&&n.attachEvent.toString().indexOf("[native code")<0||isOpera?(n.addEventListener("load",e.onScriptLoad,!1),n.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,n.attachEvent("onreadystatechange",e.onScriptLoad)),n.src=r,i.onNodeCreated&&i.onNodeCreated(n,i,t,r),currentlyAddingScript=n,baseElement?head.insertBefore(n,baseElement):head.appendChild(n),currentlyAddingScript=null,n;if(isWebWorker)try{setTimeout(function(){},0),importScripts(r),e.completeLoad(t)}catch(n){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+r,n,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){if(head||(head=e.parentNode),dataMain=e.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||mainScript.indexOf("!")!==-1||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,t,r){var n,i;"string"!=typeof e&&(r=t,t=e,e=null),isArray(t)||(r=t,t=null),!t&&isFunction(r)&&(t=[],r.length&&(r.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(e,r){t.push(r)}),t=(1===r.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(n=currentlyAddingScript||getInteractiveScript(),n&&(e||(e=n.getAttribute("data-requiremodule")),i=contexts[n.getAttribute("data-requirecontext")])),i?(i.defQueue.push([e,t,r]),i.defQueueMap[e]=!0):globalDefQueue.push([e,t,r])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this,"undefined"==typeof setTimeout?void 0:setTimeout),AMapUI.requirejs=requirejs,AMapUI.require=require,AMapUI.define=define}}(),AMapUI.define("polyfill/require/require",function(){}),AMapUI.define("polyfill/require/require-css/css",[],function(){if("undefined"==typeof window)return{load:function(e,t,r){r()}};var e=document.getElementsByTagName("head")[0],t=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,r=!1,n=!0;t[1]||t[7]?r=parseInt(t[1])<6||parseInt(t[7])<=9:t[2]||t[8]?n=!1:t[4]&&(r=parseInt(t[4])<18);var i={};i.pluginBuilder="./css-builder";var o,a,s,u=function(){o=document.createElement("style"),e.appendChild(o),a=o.styleSheet||o.sheet},c=0,f=[],p=function(e){a.addImport(e),o.onload=function(){d()},c++,31==c&&(u(),c=0)},d=function(){s();var e=f.shift();return e?(s=e[1],void p(e[0])):void(s=null)},l=function(e,t){if(a&&a.addImport||u(),a&&a.addImport)s?f.push([e,t]):(p(e),s=t);else{o.textContent='@import "'+e+'";';var r=setInterval(function(){try{o.sheet.cssRules,clearInterval(r),t()}catch(e){}},10)}},h=function(t,r){var i=document.createElement("link");if(i.type="text/css",i.rel="stylesheet",n)i.onload=function(){i.onload=function(){},setTimeout(r,7)};else var o=setInterval(function(){for(var e=0;e<document.styleSheets.length;e++){var t=document.styleSheets[e];if(t.href==i.href)return clearInterval(o),r()}},10);i.href=t,e.appendChild(i)};return i.normalize=function(e,t){return".css"==e.substr(e.length-4,4)&&(e=e.substr(0,e.length-4)),t(e)},i.load=function(e,t,n,i){(r?l:h)(t.toUrl(e+".css"),n)},i}),AMapUI.define("polyfill/require/require-css/normalize",[],function(){function e(e,n,i){if(e.match(s)||e.match(a))return e;e=o(e);var u=i.match(a),c=n.match(a);return!c||u&&u[1]==c[1]&&u[2]==c[2]?r(t(e,n),i):t(e,n)}function t(e,t){if("./"==e.substr(0,2)&&(e=e.substr(2)),e.match(s)||e.match(a))return e;var r=t.split("/"),n=e.split("/");for(r.pop();curPart=n.shift();)".."==curPart?r.pop():r.push(curPart);return r.join("/")}function r(e,t){var r=t.split("/");for(r.pop(),t=r.join("/")+"/",i=0;t.substr(i,1)==e.substr(i,1);)i++;for(;"/"!=t.substr(i,1);)i--;t=t.substr(i+1),e=e.substr(i+1),r=t.split("/");var n=e.split("/");for(out="";r.shift();)out+="../";for(;curPart=n.shift();)out+=curPart+"/";return out.substr(0,out.length-1)}var n=/([^:])\/+/g,o=function(e){return e.replace(n,"$1/")},a=/[^\:\/]*:\/\/([^\/])*/,s=/^(\/|data:)/,u=function(r,n,i,a){n=o(n),i=o(i);for(var s,u,r,c=/@import\s*("([^"]*)"|'([^']*)')|url\s*\((?!#)\s*(\s*"([^"]*)"|'([^']*)'|[^\)]*\s*)\s*\)/gi;s=c.exec(r);){u=s[3]||s[2]||s[5]||s[6]||s[4];var f;f=e(u,n,i),f!==u&&a&&(f=t(f,a));var p=s[5]||s[6]?1:0;r=r.substr(0,c.lastIndex-u.length-p-1)+f+r.substr(c.lastIndex-p-1),c.lastIndex=c.lastIndex+(f.length-u.length)}return r};return u.convertURIBase=e,u.absoluteURI=t,u.relativeURI=r,u}),AMapUI.define("polyfill/require/require-text/text",["module"],function(e){"use strict";function t(e,t){return void 0===e||""===e?t:e}function r(e,r,n,i){if(r===i)return!0;if(e===n){if("http"===e)return t(r,"80")===t(i,"80");if("https"===e)return t(r,"443")===t(i,"443")}return!1}var n,i,o,a,s,u=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],c=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,f=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,p="undefined"!=typeof location&&location.href,d=p&&location.protocol&&location.protocol.replace(/\:/,""),l=p&&location.hostname,h=p&&(location.port||void 0),m={},g=e.config&&e.config()||{};return n={version:"2.0.15",strip:function(e){if(e){e=e.replace(c,"");var t=e.match(f);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:g.createXhr||function(){var e,t,r;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;t<3;t+=1){r=u[t];try{e=new ActiveXObject(r)}catch(e){}if(e){u=[r];break}}return e},parseName:function(e){var t,r,n,i=!1,o=e.lastIndexOf("."),a=0===e.indexOf("./")||0===e.indexOf("../");return o!==-1&&(!a||o>1)?(t=e.substring(0,o),r=e.substring(o+1)):t=e,n=r||t,o=n.indexOf("!"),o!==-1&&(i="strip"===n.substring(o+1),n=n.substring(0,o),r?r=n:t=n),{moduleName:t,ext:r,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,t,i,o){var a,s,u,c=n.xdRegExp.exec(e);return!c||(a=c[2],s=c[3],s=s.split(":"),u=s[1],s=s[0],(!a||a===t)&&(!s||s.toLowerCase()===i.toLowerCase())&&(!u&&!s||r(a,u,t,o)))},finishLoad:function(e,t,r,i){r=t?n.strip(r):r,g.isBuild&&(m[e]=r),i(r)},load:function(e,t,r,i){if(i&&i.isBuild&&!i.inlineText)return void r();g.isBuild=i&&i.isBuild;var o=n.parseName(e),a=o.moduleName+(o.ext?"."+o.ext:""),s=t.toUrl(a),u=g.useXhr||n.useXhr;return 0===s.indexOf("empty:")?void r():void(!p||u(s,d,l,h)?n.get(s,function(t){n.finishLoad(e,o.strip,t,r)},function(e){r.error&&r.error(e)}):t([a],function(e){n.finishLoad(o.moduleName+"."+o.ext,o.strip,e,r)}))},write:function(e,t,r,i){if(m.hasOwnProperty(t)){var o=n.jsEscape(m[t]);r.asModule(e+"!"+t,"define(function () { return '"+o+"';});\n")}},writeFile:function(e,t,r,i,o){var a=n.parseName(t),s=a.ext?"."+a.ext:"",u=a.moduleName+s,c=r.toUrl(a.moduleName+s)+".js";n.load(u,r,function(t){var r=function(e){return i(c,e)};r.asModule=function(e,t){return i.asModule(e,c,t)},n.write(e,u,r,o)},o)}},"node"===g.env||!g.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]&&!process.versions["atom-shell"]?(i=require.nodeRequire("fs"),n.get=function(e,t,r){try{var n=i.readFileSync(e,"utf8");"\ufeff"===n[0]&&(n=n.substring(1)),t(n)}catch(e){r&&r(e)}}):"xhr"===g.env||!g.env&&n.createXhr()?n.get=function(e,t,r,i){var o,a=n.createXhr();if(a.open("GET",e,!0),i)for(o in i)i.hasOwnProperty(o)&&a.setRequestHeader(o.toLowerCase(),i[o]);g.onXhr&&g.onXhr(a,e),a.onreadystatechange=function(n){var i,o;4===a.readyState&&(i=a.status||0,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=a,r&&r(o)):t(a.responseText),g.onXhrComplete&&g.onXhrComplete(a,e))},a.send(null)}:"rhino"===g.env||!g.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?n.get=function(e,t){var r,n,i="utf-8",o=new java.io.File(e),a=java.lang.System.getProperty("line.separator"),s=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o),i)),u="";try{for(r=new java.lang.StringBuffer,n=s.readLine(),n&&n.length()&&65279===n.charAt(0)&&(n=n.substring(1)),null!==n&&r.append(n);null!==(n=s.readLine());)r.append(a),r.append(n);u=String(r.toString())}finally{s.close()}t(u)}:("xpconnect"===g.env||!g.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(o=Components.classes,a=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in o,n.get=function(e,t){var r,n,i,u={};s&&(e=e.replace(/\//g,"\\")),i=new FileUtils.File(e);try{r=o["@mozilla.org/network/file-input-stream;1"].createInstance(a.nsIFileInputStream),r.init(i,1,0,!1),n=o["@mozilla.org/intl/converter-input-stream;1"].createInstance(a.nsIConverterInputStream),n.init(r,"utf-8",r.available(),a.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),n.readString(r.available(),u),n.close(),r.close(),t(u.value)}catch(e){throw new Error((i&&i.path||"")+": "+e)}}),n}),AMapUI.define("polyfill/require/require-json/json",["text"],function(text){function cacheBust(e){return e=e.replace(CACHE_BUST_FLAG,""),e+=e.indexOf("?")<0?"?":"&",e+CACHE_BUST_QUERY_PARAM+"="+Math.round(2147483647*Math.random())}var CACHE_BUST_QUERY_PARAM="bust",CACHE_BUST_FLAG="!bust",jsonParse="undefined"!=typeof JSON&&"function"==typeof JSON.parse?JSON.parse:function(val){return eval("("+val+")")},buildMap={};return{load:function(e,t,r,n){n.isBuild&&(n.inlineJSON===!1||e.indexOf(CACHE_BUST_QUERY_PARAM+"=")!==-1)||0===t.toUrl(e).indexOf("empty:")?r(null):text.get(t.toUrl(e),function(t){var i;if(n.isBuild)buildMap[e]=t,r(t);else{try{i=jsonParse(t)}catch(e){r.error(e)}r(i)}},r.error,{accept:"application/json"})},normalize:function(e,t){return e.indexOf(CACHE_BUST_FLAG)!==-1&&(e=cacheBust(e)),t(e)},write:function(e,t,r){if(t in buildMap){var n=buildMap[t];r('define("'+e+"!"+t+'", function(){ return '+n+";});\n")}}}}),AMapUI.define("_auto/req-lib",function(){});
AMapUI.define("lib/utils", [], function() {
function setLogger(logger) {
logger.debug || (logger.debug = logger.info);
utils.logger = utils.log = logger;
}
var utils, defaultLogger = console, emptyfunc = function() {}, slientLogger = {
log: emptyfunc,
error: emptyfunc,
warn: emptyfunc,
info: emptyfunc,
debug: emptyfunc,
trace: emptyfunc
};
utils = {
slientLogger: slientLogger,
setLogger: setLogger,
mergeArray: function(target, source) {
if (source.length < 1e5) target.push.apply(target, source); else for (var i = 0, len = source.length; i < len; i += 1) target.push(source[i]);
},
setDebugMode: function(on) {
setLogger(on ? defaultLogger : slientLogger);
},
now: Date.now || function() {
return new Date().getTime();
},
bind: function(fn, thisArg) {
return fn.bind ? fn.bind(thisArg) : function() {
return fn.apply(thisArg, arguments);
};
},
domReady: function(callback) {
/complete|loaded|interactive/.test(document.readyState) ? callback() : document.addEventListener("DOMContentLoaded", function() {
callback();
}, !1);
},
forEach: function(array, callback, thisArg) {
if (array.forEach) return array.forEach(callback, thisArg);
for (var i = 0, len = array.length; i < len; i++) callback.call(thisArg, array[i], i);
},
keys: function(obj) {
if (Object.keys) return Object.keys(obj);
var keys = [];
for (var k in obj) obj.hasOwnProperty(k) && keys.push(k);
return keys;
},
map: function(array, callback, thisArg) {
if (array.map) return array.map(callback, thisArg);
for (var newArr = [], i = 0, len = array.length; i < len; i++) newArr[i] = callback.call(thisArg, array[i], i);
return newArr;
},
arrayIndexOf: function(array, searchElement, fromIndex) {
if (array.indexOf) return array.indexOf(searchElement, fromIndex);
var k, o = array, len = o.length >>> 0;
if (0 === len) return -1;
var n = 0 | fromIndex;
if (n >= len) return -1;
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
for (;k < len; ) {
if (k in o && o[k] === searchElement) return k;
k++;
}
return -1;
},
extend: function(dst) {
dst || (dst = {});
return utils.extendObjs(dst, Array.prototype.slice.call(arguments, 1));
},
nestExtendObjs: function(dst, objs) {
dst || (dst = {});
for (var i = 0, len = objs.length; i < len; i++) {
var source = objs[i];
if (source) for (var prop in source) source.hasOwnProperty(prop) && (utils.isObject(dst[prop]) && utils.isObject(source[prop]) ? dst[prop] = utils.nestExtendObjs({}, [ dst[prop], source[prop] ]) : dst[prop] = source[prop]);
}
return dst;
},
extendObjs: function(dst, objs) {
dst || (dst = {});
for (var i = 0, len = objs.length; i < len; i++) {
var source = objs[i];
if (source) for (var prop in source) source.hasOwnProperty(prop) && (dst[prop] = source[prop]);
}
return dst;
},
subset: function(props) {
var sobj = {};
if (!props || !props.length) return sobj;
this.isArray(props) || (props = [ props ]);
utils.forEach(Array.prototype.slice.call(arguments, 1), function(source) {
if (source) for (var i = 0, len = props.length; i < len; i++) source.hasOwnProperty(props[i]) && (sobj[props[i]] = source[props[i]]);
});
return sobj;
},
isArray: function(obj) {
return Array.isArray ? Array.isArray(obj) : "[object Array]" === Object.prototype.toString.call(obj);
},
isObject: function(obj) {
return "[object Object]" === Object.prototype.toString.call(obj);
},
isFunction: function(obj) {
return "[object Function]" === Object.prototype.toString.call(obj);
},
isNumber: function(obj) {
return "[object Number]" === Object.prototype.toString.call(obj);
},
isString: function(obj) {
return "[object String]" === Object.prototype.toString.call(obj);
},
isHTMLElement: function(n) {
return window["HTMLElement"] || window["Element"] ? n instanceof (window["HTMLElement"] || window["Element"]) : n && "object" == typeof n && 1 === n.nodeType && "string" == typeof n.nodeName;
},
isSVGElement: function(n) {
return window["SVGElement"] && n instanceof window["SVGElement"];
},
isDefined: function(v) {
return "undefined" != typeof v;
},
random: function(length) {
var str = "", chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", clen = chars.length;
length || (length = 6);
for (var i = 0; i < length; i++) str += chars.charAt(this.randomInt(0, clen - 1));
return str;
},
randomInt: function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
},
inherit: function(child, parent) {
function Ctor() {
this.constructor = child;
}
for (var key in parent) parent.hasOwnProperty(key) && (child[key] = parent[key]);
Ctor.prototype = parent.prototype;
child.prototype = new Ctor();
child.__super__ = parent.prototype;
return child;
},
trim: function(s) {
return s ? s.trim ? s.trim() : s.replace(/^\s+|\s+$/gm, "") : "";
},
trigger: function(el, evt, detail) {
if (el) {
detail = detail || {};
var e, opt = {
bubbles: !0,
cancelable: !0,
detail: detail
};
if ("undefined" != typeof CustomEvent) {
e = new CustomEvent(evt, opt);
el.dispatchEvent(e);
} else try {
e = document.createEvent("CustomEvent");
e.initCustomEvent(evt, !0, !0, detail);
el.dispatchEvent(e);
} catch (exp) {
this.log.error(exp);
}
return !0;
}
this.log.error("emply element passed in");
},
nextTick: function(f) {
("object" == typeof process && process.nextTick ? process.nextTick : function(task) {
setTimeout(task, 0);
})(f);
},
removeFromArray: function(arr, val) {
var index = arr.indexOf(val);
index > -1 && arr.splice(index, 1);
return index;
},
debounce: function(func, wait, immediate) {
var timeout, args, context, timestamp, result, later = function() {
var last = utils.now() - timestamp;
if (last < wait && last >= 0) timeout = setTimeout(later, wait - last); else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
timeout || (context = args = null);
}
}
};
return function() {
context = this;
args = arguments;
timestamp = utils.now();
var callNow = immediate && !timeout;
timeout || (timeout = setTimeout(later, wait));
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
},
throttle: function(func, wait, options) {
var context, args, result, timeout = null, previous = 0;
options || (options = {});
var later = function() {
previous = options.leading === !1 ? 0 : utils.now();
timeout = null;
result = func.apply(context, args);
timeout || (context = args = null);
};
return function() {
var now = utils.now();
previous || options.leading !== !1 || (previous = now);
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
previous = now;
result = func.apply(context, args);
timeout || (context = args = null);
} else timeout || options.trailing === !1 || (timeout = setTimeout(later, remaining));
return result;
};
},
ucfirst: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
escapeHtml: function(text) {
var map = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
return (text + "").replace(/[&<>"']/g, function(m) {
return map[m];
});
}
};
utils.setDebugMode(!1);
return utils;
});
AMapUI.define("lib/detect-global", [ "./utils" ], function(utils) {
var global = this;
return {
load: function(name, req, onLoad, config) {
for (var parts = name.split("|"), gVars = parts[0].split(","), finalMod = parts[1], i = 0, len = gVars.length; i < len; i++) {
var vname = utils.trim(gVars[i]);
if (global[vname]) {
onLoad(global[vname]);
return;
}
}
if (!finalMod) throw new Error("can't find: " + name);
req([ finalMod ], function(value) {
onLoad(value);
});
}
};
});
AMapUI.define("lib/$", [ "lib/detect-global!jQuery,Zepto|" + (AMap.UA.mobile ? "zepto" : "jquery") ], function($) {
return $;
});
AMapUI.define("lib/conf", [ "module" ], function(mod) {
return mod.config();
});
AMapUI.define("lib/dom.utils", [], function() {
var domUtils = {
isCanvasSupported: function() {
var elem = document.createElement("canvas");
return !!(elem && elem.getContext && elem.getContext("2d"));
},
toggleClass: function(el, name, add) {
add ? domUtils.addClass(el, name) : domUtils.removeClass(el, name);
},
addClass: function(el, name) {
el && name && (domUtils.hasClassName(el, name) || (el.className += (el.className ? " " : "") + name));
},
removeClass: function(el, name) {
function replaceFn(w, match) {
return match === name ? "" : w;
}
el && name && (el.className = el.className.replace(/(\S+)\s*/g, replaceFn).replace(/(^\s+|\s+$)/, ""));
},
hasClassName: function(ele, className) {
var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
return testClass.test(ele.className);
},
getElementsByClassName: function(className, tag, parent) {
tag = tag || "*";
parent = parent || document;
if (parent.getElementsByClassName) return parent.getElementsByClassName(className);
for (var current, elements = parent.getElementsByTagName(tag), returnElements = [], i = 0; i < elements.length; i++) {
current = elements[i];
domUtils.hasClassName(current, className) && returnElements.push(current);
}
return returnElements;
}
};
return domUtils;
});
AMapUI.define("lib/event", [ "lib/utils" ], function(utils) {
"use strict";
function Event() {
this.__evHash = {};
}
utils.extend(Event.prototype, {
on: function(ev, listener, priority) {
if (this.__multiCall(ev, listener, this.on)) return this;
if (!ev) return this;
var evHash = this.__evHash;
evHash[ev] || (evHash[ev] = []);
var list = evHash[ev], index = this.__index(list, listener);
if (index < 0) {
"number" != typeof priority && (priority = 10);
for (var inps = list.length, i = 0, len = list.length; i < len; i++) if (priority > list[i].priority) {
inps = i;
break;
}
list.splice(inps, 0, {
listener: listener,
priority: priority
});
}
return this;
},
once: function(ev, listener, priority) {
function oncefunc() {
self.__callListenser(listener, arguments);
self.off(ev, oncefunc);
}
if (this.__multiCall(ev, listener, this.once)) return this;
var self = this;
this.on(ev, oncefunc, priority);
return this;
},
offAll: function() {
for (var ev in this.__evHash) this.off(ev);
this.__evHash = {};
return this;
},
off: function(ev, listener) {
if (this.__multiCall(ev, listener, this.off)) return this;
var evHash = this.__evHash;
if (evHash[ev]) {
var list = evHash[ev];
if ("undefined" == typeof listener) {
var c = list.length;
list.length = 0;
return c;
}
var index = this.__index(list, listener);
if (index >= 0) {
list.splice(index, 1);
return 1;
}
return 0;
}
},
listenerLength: function(ev) {
var evHash = this.__evHash, list = evHash[ev];
return list ? list.length : 0;
},
emit: function(ev) {
var args, list, evHash = this.__evHash, count = 0;
list = evHash[ev];
if (list && list.length) {
args = Array.prototype.slice.call(arguments, 1);
count += this.__callListenerList(list, args);
}
list = evHash["*"];
if (list && list.length) {
args = Array.prototype.slice.call(arguments);
count += this.__callListenerList(list, args);
}
return count;
},
trigger: function(ev) {
var args = Array.prototype.slice.call(arguments, 0);
args.splice(1, 0, {
type: ev,
target: this
});
this.emit.apply(this, args);
},
triggerWithOriginalEvent: function(ev, originalEvent) {
var args = Array.prototype.slice.call(arguments, 0);
args[1] = {
type: ev,
target: originalEvent ? originalEvent.target : this,
originalEvent: originalEvent
};
this.emit.apply(this, args);
},
onDestroy: function(cb, priority) {
this.on("__destroy", cb, priority);
return this;
},
destroy: function() {
if (!this.__destroying) {
this.__destroying = 1;
this.emit("__destroy", this);
this.offAll();
return this;
}
},
__multiCall: function(ev, listener, func) {
if (!ev) return !0;
if (utils.isObject(ev) && "undefined" == typeof listener) {
for (var k in ev) func.call(this, k, ev[k]);
return !0;
}
var evs;
utils.isArray(ev) ? evs = ev : "string" == typeof ev && (evs = ev.split(/[\s,]+/));
if (evs && evs.length > 1) {
for (var i = 0, len = evs.length; i < len; i++) evs[i] && func.call(this, evs[i], listener);
return !0;
}
return !1;
},
__index: function(list, listener) {
for (var index = -1, i = 0, len = list.length; i < len; i++) {
var ele = list[i];
if (ele.listener === listener) {
index = i;
break;
}
}
return index;
},
__callListenser: function(listener, args) {
var func = null, contxt = null;
if ("function" == typeof listener) {
func = listener;
contxt = this;
} else if (2 == listener.length) {
func = listener[1];
contxt = listener[0];
}
return func ? [ 1, func.apply(contxt, args) ] : [ 0, void 0 ];
},
__callListenerList: function(list, args) {
if (!list || !list.length) return 0;
list = [].concat(list);
for (var cres, count = 0, i = 0, len = list.length; i < len; i++) {
cres = this.__callListenser(list[i].listener, args);
count += cres[0];
if (cres[1] === !1) break;
}
return count;
}
});
return Event;
});
AMapUI.define("lib/underscore-tpl", [], function() {
function escapeHtml(text) {
var map = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
return (text + "").replace(/[&<>"']/g, function(m) {
return map[m];
});
}
function tmpl(text, data) {
var settings = templateSettings, matcher = new RegExp([ (settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source ].join("|") + "|$", "g"), index = 0, source = "__p+='";
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
index = offset + match.length;
escape ? source += "'+\n((__t=(" + escape + "))==null?'':" + innerContextVarName + ".escape(__t))+\n'" : interpolate ? source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'" : evaluate && (source += "';\n" + evaluate + "\n__p+='");
return match;
});
source += "';\n";
settings.variable || (source = "with(obj||{}){\n" + source + "}\n");
source = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + source + "return __p;\n";
var render;
try {
render = new Function(settings.variable || "obj", innerContextVarName, source);
} catch (e) {
e.source = source;
throw e;
}
var template = function(data) {
return render.call(this, data, {
escape: escapeHtml,
template: tmpl
});
}, argument = settings.variable || "obj";
template.source = "function(" + argument + "){\n" + source + "}";
return data ? template(data) : template;
}
var templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
}, noMatch = /(.)^/, escapes = {
"'": "'",
"\\": "\\",
"\r": "r",
"\n": "n",
"\u2028": "u2028",
"\u2029": "u2029"
}, escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g, escapeChar = function(match) {
return "\\" + escapes[match];
}, innerContextVarName = "_amapui_tpl_cxt_";
return tmpl;
});
AMapUI.define("lib/SphericalMercator", [], function() {
function getScale(level) {
scaleCache[level] || (scaleCache[level] = 256 * Math.pow(2, level));
return scaleCache[level];
}
function project(lnglat) {
var lat = Math.max(Math.min(maxLat, lnglat[1]), -maxLat), x = lnglat[0] * deg2rad, y = lat * deg2rad;
y = Math.log(Math.tan(quadPI + y / 2));
return [ x, y ];
}
function transform(point, scale) {
scale = scale || 1;
var a = half2PI, b = .5, c = -a, d = .5;
return [ scale * (a * point[0] + b), scale * (c * point[1] + d) ];
}
function unproject(point) {
var lng = point[0] * rad2deg, lat = (2 * Math.atan(Math.exp(point[1])) - Math.PI / 2) * rad2deg;
return [ parseFloat(lng.toFixed(6)), parseFloat(lat.toFixed(6)) ];
}
function untransform(point, scale) {
var a = half2PI, b = .5, c = -a, d = .5;
return [ (point[0] / scale - b) / a, (point[1] / scale - d) / c ];
}
function lngLatToPointByScale(lnglat, scale, round) {
var p = transform(project(lnglat), scale);
if (round) {
p[0] = Math.round(p[0]);
p[1] = Math.round(p[1]);
}
return p;
}
function lngLatToPoint(lnglat, level, round) {
return lngLatToPointByScale(lnglat, getScale(level), round);
}
function pointToLngLat(point, level) {
var scale = getScale(level), untransformedPoint = untransform(point, scale);
return unproject(untransformedPoint);
}
function haversineDistance(point1, point2) {
var cos = Math.cos, lat1 = point1[1] * deg2rad, lon1 = point1[0] * deg2rad, lat2 = point2[1] * deg2rad, lon2 = point2[0] * deg2rad, dLat = lat2 - lat1, dLon = lon2 - lon1, a = (1 - cos(dLat) + (1 - cos(dLon)) * cos(lat1) * cos(lat2)) / 2;
return earthDiameter * Math.asin(Math.sqrt(a));
}
var scaleCache = {}, earthDiameter = 12756274, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI, quadPI = Math.PI / 4, maxLat = 85.0511287798, half2PI = .5 / Math.PI;
return {
haversineDistance: haversineDistance,
getScale: getScale,
lngLatToPointByScale: lngLatToPointByScale,
pointToLngLat: pointToLngLat,
lngLatToPoint: lngLatToPoint
};
});
AMapUI.define("_auto/lib", function() {});
AMapUI.requireConf = {
"skipDataMain": true,
"config": {
"lib/conf": {
"productWebRoot": "//10.56.28.228/webapi.amap.com/ui",
"mainVersion": "1.0",
"patchVersion": "11",
"fullVersion": "1.0.11"
}
},
"map": {
"*": {
"css": "polyfill/require/require-css/css",
"text": "polyfill/require/require-text/text",
"json": "polyfill/require/require-json/json"
}
},
"shim": {
"jquery": {
"exports": "$"
},
"zepto": {
"exports": "$"
}
},
"paths": {
"jquery": "plug/ext/jquery-1.12.4.min",
"zepto": "plug/ext/zepto-1.2.0.min"
},
"baseUrl": "//10.56.28.228/webapi.amap.com/ui/1.0/",
"baseUrlProtocol": null
};
AMapUI.libConf = AMapUI.requireConf.config["lib/conf"];
AMapUI.uiMods = [
"ui/control/BasicControl",
"ui/geo/DistrictCluster",
"ui/geo/DistrictExplorer",
"ui/misc/MarkerList",
"ui/misc/MobiCityPicker",
"ui/misc/PathSimplifier",
"ui/misc/PoiPicker",
"ui/misc/PointSimplifier",
"ui/misc/PointSimplifr",
"ui/misc/PositionPicker",
"ui/overlay/AwesomeMarker",
"ui/overlay/SimpleInfoWindow",
"ui/overlay/SimpleMarker",
"ui/overlay/SvgMarker"
];
!function(ns, window) {
function getParameterByName(name) {
var match = new RegExp("[?&]" + name + "=([^&]*)").exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
}
function getAMapKey() {
return AMap.User ? AMap.User.key : "";
}
function arrForEach(array, callback, thisArg) {
if (array.forEach) return array.forEach(callback, thisArg);
for (var i = 0, len = array.length; i < len; i++) callback.call(thisArg, array[i], i);
}
function extendObj(dst) {
dst || (dst = {});
arrForEach(Array.prototype.slice.call(arguments, 1), function(source) {
if (source) for (var prop in source) source.hasOwnProperty(prop) && (dst[prop] = source[prop]);
});
return dst;
}
var libConf = ns.libConf, reqConf = ns.requireConf, uiMods = ns.uiMods || [];
ns.docProtocol = "https:" === document.location.protocol ? "https:" : "http:";
window.AMapUIProtocol && (ns.docProtocol = window.AMapUIProtocol);
window.AMapUIBaseUrl && (reqConf.baseUrl = window.AMapUIBaseUrl);
0 === reqConf.baseUrl.indexOf("//") && (reqConf.baseUrl = ns.docProtocol + reqConf.baseUrl);
var getAbsoluteUrl = function() {
var div = document.createElement("div");
div.innerHTML = "<a></a>";
return function(url) {
div.firstChild.href = url;
div.innerHTML = div.innerHTML;
return div.firstChild.href;
};
}();
ns.getAbsoluteUrl = getAbsoluteUrl;
getParameterByName("debugAMapUI") && (libConf.debugMode = !0);
var isDebugMode = !!libConf.debugMode;
ns.version = libConf.version = libConf.mainVersion + "." + libConf.patchVersion;
if (!isDebugMode) {
reqConf.bundles || (reqConf.bundles = {});
for (var reqBundles = reqConf.bundles, i = 0, len = uiMods.length; i < len; i++) {
var uiModId = uiMods[i];
reqBundles[uiModId] || (reqBundles[uiModId] = []);
reqBundles[uiModId].push(uiMods[i] + "/main");
}
}
ns.getBaseUrl = function() {
return reqConf.baseUrl;
};
reqConf.urlArgs = function(id, url) {
var args = [];
args.push("v=" + ns.version);
isDebugMode && args.push("_t=" + Date.now());
if (0 === id.indexOf("ui/")) {
var parts = id.split("/");
(3 === parts.length || 4 === parts.length && "main" === parts[3]) && args.push("mt=ui");
args.push("key=" + getAMapKey());
}
return (url.indexOf("?") < 0 ? "?" : "&") + args.join("&");
};
var requireContentName = "amap-ui-" + ns.version;
ns.require = ns.requirejs.config(extendObj({
context: requireContentName
}, reqConf));
ns.UI = ns.UI || {};
ns.findDefinedId = function(test, thisArg) {
var requirejs = ns.requirejs;
if (!requirejs.s || !requirejs.s.contexts) return null;
var contexts = requirejs.s.contexts[requireContentName];
if (!contexts) return null;
var defined = contexts.defined;
for (var k in defined) if (defined.hasOwnProperty(k) && test.call(thisArg, k)) return k;
return null;
};
ns.weakDefine = function(name) {
return ("string" != typeof name || !ns.require.defined(name)) && ns.define.apply(ns, arguments);
};
ns.defineTpl = function(name) {
if ("string" != typeof name) throw new Error("tpl name is supposed to be a string");
var args = Array.prototype.slice.call(arguments, 0);
args[0] = "polyfill/require/require-text/text!" + args[0];
return ns.define.apply(ns, args);
};
ns.setDomLibrary = function($) {
ns.require.undef("lib/$");
ns.define("lib/$", [], function() {
return $;
});
};
ns.inspectDomLibrary = function($) {
var isJQuery = $.fn && $.fn.jquery, isZepto = $ === window.Zepto;
return {
isJQuery: !!isJQuery,
isZepto: isZepto,
version: isJQuery ? $.fn.jquery : "unknown"
};
};
ns.versionCompare = function(left, right) {
if (typeof left + typeof right != "stringstring") return !1;
for (var a = left.split("."), b = right.split("."), i = 0, len = Math.max(a.length, b.length); i < len; i++) {
if (a[i] && !b[i] && parseInt(a[i], 10) > 0 || parseInt(a[i], 10) > parseInt(b[i], 10)) return 1;
if (b[i] && !a[i] && parseInt(b[i], 10) > 0 || parseInt(a[i], 10) < parseInt(b[i], 10)) return -1;
}
return 0;
};
ns.checkDomLibrary = function($, opts) {
opts = extendObj({
minJQueryVersion: "1.3"
}, opts);
var libInfo = ns.inspectDomLibrary($);
return !(libInfo.isJQuery && ns.versionCompare(libInfo.version, opts.minJQueryVersion) < 0) || "jQuery当前版本(" + libInfo.version + ")过低,请更新到 " + opts.minJQueryVersion + " 或以上版本!";
};
ns.setDebugMode = function(on) {
on = !!on;
ns.debugMode = on;
window.AMapUI_DEBUG = on;
ns.require([ "lib/utils" ], function(utils) {
utils.setDebugMode(ns.debugMode);
ns.debugMode && utils.logger.warn("Debug mode!");
});
};
ns.setDebugMode(isDebugMode);
ns.load = function(unames, callback, opts) {
ns.require([ "lib/utils" ], function(utils) {
utils.isArray(unames) || (unames = [ unames ]);
for (var uname, mods = [], modNameFilter = opts && opts.modNameFilter, i = 0, len = unames.length; i < len; i++) {
uname = unames[i];
modNameFilter && (uname = modNameFilter.call(null, uname));
ns.debugMode && 0 === uname.indexOf("ui/") && 3 === uname.split("/").length && (uname += "/main");
mods.push(uname);
}
ns.require(mods, callback);
});
};
ns.loadCss = function(urls, cb) {
ns.load(urls, cb, {
modNameFilter: function(url) {
return "css!" + getAbsoluteUrl(url);
}
});
};
ns.loadJs = function(urls, cb) {
ns.load(urls, cb, {
modNameFilter: function(url) {
return getAbsoluteUrl(url);
}
});
};
ns.loadText = function(urls, cb) {
ns.load(urls, cb, {
modNameFilter: function(url) {
return "text!" + getAbsoluteUrl(url);
}
});
};
ns.loadUI = function(unames, cb) {
ns.load(unames, cb, {
modNameFilter: function(uname) {
return "ui/" + uname;
}
});
};
ns.loadTpl = function(url, data, cb) {
ns.require([ "lib/underscore-tpl", "text!" + getAbsoluteUrl(url) ], function(template, text) {
cb(template(text, data), {
template: template,
text: text
});
});
};
isDebugMode || setTimeout(function() {
ns.loadJs(ns.docProtocol + "//10.56.28.228/webapi.amap.com/count?type=UIInit&k=" + getAMapKey());
}, 0);
}(AMapUI, window);
window.AMapUI = AMapUI;
}(window));
\ No newline at end of file
(function(window){
window.AMapUI_DEBUG = false;
!(function(global) {
if (!global.AMap) {throw new Error('请前置引入高德地图api,参见http://lbs.amap.com/api/javascript-api/gettingstarted/');}
})(window);
var AMapUI;!(function(){if (!AMapUI || !AMapUI.requirejs){AMapUI ? require = AMapUI : AMapUI = {};var requirejs,require,define;!(function(global,setTimeout){function commentReplace(e,t){return t || '';} function isFunction(e){return '[object Function]' === ostring.call(e);} function isArray(e){return '[object Array]' === ostring.call(e);} function each(e,t){if (e){var r;for (r = 0;r < e.length && (!e[r] || !t(e[r],r,e));r += 1){;}}} function eachReverse(e,t){if (e){var r;for (r = e.length - 1;r > -1 && (!e[r] || !t(e[r],r,e));r -= 1){;}}} function hasProp(e,t){return hasOwn.call(e,t);} function getOwn(e,t){return hasProp(e,t) && e[t];} function eachProp(e,t){var r;for (r in e){if(hasProp(e,r)&&t(e[r],r))break};} function mixin(e,t,r,n){return t && eachProp(t,(t,i) => {!r && hasProp(e,i) || (!n || 'object' != typeof t || !t || isArray(t) || isFunction(t) || t instanceof RegExp ? e[i] = t:(e[i] || (e[i] = {}),mixin(e[i],t,r,n)));}),e;} function bind(e,t){return function(){return t.apply(e,arguments);};} function scripts(){return document.getElementsByTagName('script');} function defaultOnError(e){throw e;} function getGlobal(e){if (!e) {return e;}var t = global;return each(e.split('.'),(e) => {t = t[e];}),t;} function makeError(e,t,r,n){var i = new Error(`${t}\nhttp://requirejs.org/docs/errors.html#${e}`);return i.requireType = e,i.requireModules = n,r && (i.originalError = r),i;} function newContext(e){function t(e){var t,r;for (t = 0;t < e.length;t++){if(r=e[t],"."===r)e.splice(t,1),t-=1;else if(".."===r){if(0===t||1===t&&".."===e[2]||".."===e[t-1])continue;t>0&&(e.splice(t-1,2),t-=2)}}} function r(e,r,n){var i,o,a,s,u,c,f,p,d,l,h,m,g = r && r.split('/'),v = w.map,x = v && v['*'];if (e && (e = e.split('/'),f = e.length - 1,w.nodeIdCompat && jsSuffixRegExp.test(e[f]) && (e[f] = e[f].replace(jsSuffixRegExp,'')),'.' === e[0].charAt(0) && g && (m = g.slice(0,g.length - 1),e = m.concat(e)),t(e),e = e.join('/')),n && v && (g || x)){a = e.split('/');e:for (s = a.length;s > 0;s -= 1){if (c = a.slice(0,s).join('/'),g){for(u=g.length;u>0;u-=1)if(o=getOwn(v,g.slice(0,u).join("/")),o&&(o=getOwn(o,c))){p=o,d=s;break e}}!l && x && getOwn(x,c) && (l = getOwn(x,c),h = s);}!p && l && (p = l,d = h),p && (a.splice(0,d,p),e = a.join('/'));} return i = getOwn(w.pkgs,e),i ? i:e;} function n(e){isBrowser && each(scripts(),(t) => {if (t.getAttribute('data-requiremodule') === e && t.getAttribute('data-requirecontext') === q.contextName) {return t.parentNode.removeChild(t),!0};});} function i(e){var t = getOwn(w.paths,e);if (t && isArray(t) && t.length > 1) {return t.shift(),q.require.undef(e),q.makeRequire(null,{skipMap:!0})([e]),!0};} function o(e){var t,r = e ? e.indexOf('!'):-1;return r > -1 && (t = e.substring(0,r),e = e.substring(r + 1,e.length)),[t,e];} function a(e,t,n,i){var a,s,u,c,f = null,p = t ? t.name:null,d = e,l = !0,h = '';return e || (l = !1,e = '_@r' + (C += 1)),c = o(e),f = c[0],e = c[1],f && (f = r(f,p,i),s = getOwn(k,f)),e && (f ? h = s && s.normalize ? s.normalize(e,(e) => {return r(e,p,i);}):e.indexOf('!') === -1 ? r(e,p,i):e:(h = r(e,p,i),c = o(h),f = c[0],h = c[1],n = !0,a = q.nameToUrl(h))),u = !f || s || n ? '':'_unnormalized' + (T += 1),{ prefix: f,name: h,parentMap: t,unnormalized: !!u,url: a,originalName: d,isDefine: l,id: (f ? `${f}!${h}`:h) + u };} function s(e){var t = e.id,r = getOwn(M,t);return r || (r = M[t] = new q.Module(e)),r;} function u(e,t,r){var n = e.id,i = getOwn(M,n);!hasProp(k,n) || i && !i.defineEmitComplete ? (i = s(e),i.error && 'error' === t ? r(i.error):i.on(t,r)):'defined' === t && r(k[n]);} function c(e,t){var r = e.requireModules,n = !1;t ? t(e):(each(r,(t) => {var r = getOwn(M,t);r && (r.error = e,r.events.error && (n = !0,r.emit('error',e)));}),n || req.onError(e));} function f(){globalDefQueue.length && (each(globalDefQueue,(e) => {var t = e[0];'string' == typeof t && (q.defQueueMap[t] = !0),O.push(e);}),globalDefQueue = []);} function p(e){delete M[e],delete S[e];} function d(e,t,r){var n = e.map.id;e.error ? e.emit('error',e.error):(t[n] = !0,each(e.depMaps,(n,i) => {var o = n.id,a = getOwn(M,o);!a || e.depMatched[i] || r[o] || (getOwn(t,o) ? (e.defineDep(i,k[o]),e.check()):d(a,t,r));}),r[n] = !0);} function l(){var e,t,r = 1e3 * w.waitSeconds,o = r && q.startTime + r < (new Date).getTime(),a = [],s = [],u = !1,f = !0;if (!x){if (x = !0,eachProp(S,(e) => {var r = e.map,c = r.id;if (e.enabled && (r.isDefine || s.push(e),!e.error)){if(!e.inited&&o)i(c)?(t=!0,u=!0):(a.push(c),n(c));else if(!e.inited&&e.fetched&&r.isDefine&&(u=!0,!r.prefix))return f=!1};}),o && a.length) {return e=makeError("timeout","Load timeout for modules: "+a,null,a),e.contextName=q.contextName,c(e);}f && each(s,(e) => {d(e,{},{});}),o && !t || !u || !isBrowser && !isWebWorker || E || (E = setTimeout(() => {E = 0,l();},50)),x = !1;}} function h(e){hasProp(k,e[0]) || s(a(e[0],null,!0)).init(e[1],e[2]);} function m(e,t,r,n){e.detachEvent && !isOpera ? n && e.detachEvent(n,t):e.removeEventListener(r,t,!1);} function g(e){var t = e.currentTarget || e.srcElement;return m(t,q.onScriptLoad,'load','onreadystatechange'),m(t,q.onScriptError,'error'),{ node: t,id: t && t.getAttribute('data-requiremodule') };} function v(){var e;for (f();O.length;){if (e = O.shift(),null === e[0]) {return c(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));}h(e);}q.defQueueMap = {};} var x,b,q,y,E,w = { waitSeconds: 7,baseUrl: './',paths: {},bundles: {},pkgs: {},shim: {},config: {} },M = {},S = {},A = {},O = [],k = {},j = {},I = {},C = 1,T = 1;return y = { require(e){return e.require?e.require:e.require=q.makeRequire(e.map)},exports(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?k[e.map.id]=e.exports:e.exports=k[e.map.id]={}},module(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(w.config,e.map.id)||{}},exports:e.exports||(e.exports={})}} },b = function(e){this.events = getOwn(A,e.id) || {},this.map = e,this.shim = getOwn(w.shim,e.id),this.depExports = [],this.depMaps = [],this.depMatched = [],this.pluginMaps = {},this.depCount = 0;},b.prototype = { init(e,t,r,n){n=n||{},this.inited||(this.factory=t,r?this.on("error",r):this.events.error&&(r=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=r,this.inited=!0,this.ignore=n.ignore,n.enabled||this.enabled?this.enable():this.check())},defineDep(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch(){if(!this.fetched){this.fetched=!0,q.startTime=(new Date).getTime();var e=this.map;return this.shim?void q.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load(){var e=this.map.url;j[e]||(j[e]=!0,q.load(this.map.id,e))},check(){if(this.enabled&&!this.enabling){var e,t,r=this.map.id,n=this.depExports,i=this.exports,o=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{i=q.execCb(r,o,n,i)}catch(t){e=t}else i=q.execCb(r,o,n,i);if(this.map.isDefine&&void 0===i&&(t=this.module,t?i=t.exports:this.usingExports&&(i=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",c(this.error=e)}else i=o;if(this.exports=i,this.map.isDefine&&!this.ignore&&(k[r]=i,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(q,this.map,a)}p(r),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(q.defQueueMap,r)||this.fetch()}},callPlugin(){var e=this.map,t=e.id,n=a(e.prefix);this.depMaps.push(n),u(n,"defined",bind(this,function(n){var i,o,f,d=getOwn(I,this.map.id),l=this.map.name,h=this.map.parentMap?this.map.parentMap.name:null,m=q.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(n.normalize&&(l=n.normalize(l,function(e){return r(e,h,!0)})||""),o=a(e.prefix+"!"+l,this.map.parentMap),u(o,"defined",bind(this,function(e){this.map.normalizedMap=o,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),f=getOwn(M,o.id),void(f&&(this.depMaps.push(o),this.events.error&&f.on("error",bind(this,function(e){this.emit("error",e)})),f.enable()))):d?(this.map.url=q.nameToUrl(d),void this.load()):(i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(M,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&p(e.map.id)}),c(e)}),i.fromText=bind(this,function(r,n){var o=e.name,u=a(o),f=useInteractive;n&&(r=n),f&&(useInteractive=!1),s(u),hasProp(w.config,t)&&(w.config[o]=w.config[t]);try{req.exec(r)}catch(e){return c(makeError("fromtexteval","fromText eval for "+t+" failed: "+e,e,[t]))}f&&(useInteractive=!0),this.depMaps.push(u),q.completeLoad(o),m([o],i)}),void n.load(e.name,m,i,w))})),q.enable(n,this),this.pluginMaps[n.id]=n},enable(){S[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var r,n,i;if("string"==typeof e){if(e=a(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,i=getOwn(y,e.id))return void(this.depExports[t]=i(this));this.depCount+=1,u(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?u(e,"error",bind(this,this.errback)):this.events.error&&u(e,"error",bind(this,function(e){this.emit("error",e)}))}r=e.id,n=M[r],hasProp(y,r)||!n||n.enabled||q.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(M,e.id);t&&!t.enabled&&q.enable(e,this)})),this.enabling=!1,this.check()},on(e,t){var r=this.events[e];r||(r=this.events[e]=[]),r.push(t)},emit(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]} },q = { config: w,contextName: e,registry: M,defined: k,urlFetched: j,defQueue: O,defQueueMap: {},Module: b,makeModuleMap: a,nextTick: req.nextTick,onError: c,configure(e){if(e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/"),"string"==typeof e.urlArgs){var t=e.urlArgs;e.urlArgs=function(e,r){return(r.indexOf("?")===-1?"?":"&")+t}}var r=w.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(w[t]||(w[t]={}),mixin(w[t],e,!0,!0)):w[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(I[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=q.makeShimExports(e)),r[t]=e}),w.shim=r),e.packages&&each(e.packages,function(e){var t,r;e="string"==typeof e?{name:e}:e,r=e.name,t=e.location,t&&(w.paths[r]=e.location),w.pkgs[r]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(M,function(e,t){e.inited||e.map.unnormalized||(e.map=a(t,null,!0))}),(e.deps||e.callback)&&q.require(e.deps||[],e.callback)},makeShimExports(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire(t,i){function o(r,n,u){var f,p,d;return i.enableBuildCallback&&n&&isFunction(n)&&(n.__requireJsBuild=!0),"string"==typeof r?isFunction(n)?c(makeError("requireargs","Invalid require call"),u):t&&hasProp(y,r)?y[r](M[t.id]):req.get?req.get(q,r,t,o):(p=a(r,t,!1,!0),f=p.id,hasProp(k,f)?k[f]:c(makeError("notloaded",'Module name "'+f+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),q.nextTick(function(){v(),d=s(a(null,t)),d.skipMap=i.skipMap,d.init(r,n,u,{enabled:!0}),l()}),o)}return i=i||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var n,i=e.lastIndexOf("."),o=e.split("/")[0],a="."===o||".."===o;return i!==-1&&(!a||i>1)&&(n=e.substring(i,e.length),e=e.substring(0,i)),q.nameToUrl(r(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(k,a(e,t,!1,!0).id)},specified:function(e){return e=a(e,t,!1,!0).id,hasProp(k,e)||hasProp(M,e)}}),t||(o.undef=function(e){f();var r=a(e,t,!0),i=getOwn(M,e);i.undefed=!0,n(e),delete k[e],delete j[r.url],delete A[e],eachReverse(O,function(t,r){t[0]===e&&O.splice(r,1)}),delete q.defQueueMap[e],i&&(i.events.defined&&(A[e]=i.events),p(e))}),o},enable(e){var t=getOwn(M,e.id);t&&s(e).enable()},completeLoad(e){var t,r,n,o=getOwn(w.shim,e)||{},a=o.exports;for(f();O.length;){if(r=O.shift(),null===r[0]){if(r[0]=e,t)break;t=!0}else r[0]===e&&(t=!0);h(r)}if(q.defQueueMap={},n=getOwn(M,e),!t&&!hasProp(k,e)&&n&&!n.inited){if(!(!w.enforceDefine||a&&getGlobal(a)))return i(e)?void 0:c(makeError("nodefine","No define call for "+e,null,[e]));h([e,o.deps||[],o.exportsFn])}l()},nameToUrl(e,t,r){var n,i,o,a,s,u,c,f=getOwn(w.pkgs,e);if(f&&(e=f),c=getOwn(I,e))return q.nameToUrl(c,t,r);if(req.jsExtRegExp.test(e))s=e+(t||"");else{for(n=w.paths,i=e.split("/"),o=i.length;o>0;o-=1)if(a=i.slice(0,o).join("/"),u=getOwn(n,a)){isArray(u)&&(u=u[0]),i.splice(0,o,u);break}s=i.join("/"),s+=t||(/^data\:|^blob\:|\?/.test(s)||r?"":".js"),s=("/"===s.charAt(0)||s.match(/^[\w\+\.\-]+:/)?"":w.baseUrl)+s}return w.urlArgs&&!/^blob\:/.test(s)?s+w.urlArgs(e,s):s},load(e,t){req.load(q,e,t)},execCb(e,t,r,n){return t.apply(n,r)},onScriptLoad(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=g(e);q.completeLoad(t.id)}},onScriptError(e){var t=g(e);if(!i(t.id)){var r=[];return eachProp(M,function(e,n){0!==n.indexOf("_@r")&&each(e.depMaps,function(e){if(e.id===t.id)return r.push(n),!0})}),c(makeError("scripterror",'Script error for "'+t.id+(r.length?'", needed by: '+r.join(", "):'"'),e,[t.id]))}} },q.require = q.makeRequire(),q;} function getInteractiveScript(){return interactiveScript && 'interactive' === interactiveScript.readyState ? interactiveScript:(eachReverse(scripts(),(e) => {if ('interactive' === e.readyState) {return interactiveScript=e};}),interactiveScript);} var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version = '2.3.2',commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp = /\.js$/,currDirRegExp = /^\.\//,op = Object.prototype,ostring = op.toString,hasOwn = op.hasOwnProperty,isBrowser = !('undefined' == typeof window || 'undefined' == typeof navigator || !window.document),isWebWorker = !isBrowser && 'undefined' != typeof importScripts,readyRegExp = isBrowser && 'PLAYSTATION 3' === navigator.platform ? /^complete$/:/^(complete|loaded)$/,defContextName = '_',isOpera = 'undefined' != typeof opera && '[object Opera]' === opera.toString(),contexts = {},cfg = {},globalDefQueue = [],useInteractive = !1;if ('undefined' == typeof define){if ('undefined' != typeof requirejs){if (isFunction(requirejs)) {return;}cfg = requirejs,requirejs = void 0;}'undefined' == typeof require || isFunction(require) || (cfg = require,require = void 0),req = requirejs = function(e,t,r,n){var i,o,a = defContextName;return isArray(e) || 'string' == typeof e || (o = e,isArray(t) ? (e = t,t = r,r = n):e = []),o && o.context && (a = o.context),i = getOwn(contexts,a),i || (i = contexts[a] = req.s.newContext(a)),o && i.configure(o),i.require(e,t,r);},req.config = function(e){return req(e);},req.nextTick = 'undefined' != typeof setTimeout ? function(e){setTimeout(e,4);}:function(e){e();},require || (require = req),req.version = version,req.jsExtRegExp = /^\/|:|\?|\.js$/,req.isBrowser = isBrowser,s = req.s = { contexts,newContext },req({}),each(['toUrl','undef','defined','specified'],(e) => {req[e] = function(){var t = contexts[defContextName];return t.require[e].apply(t,arguments);};}),isBrowser && (head = s.head = document.getElementsByTagName('head')[0],baseElement = document.getElementsByTagName('base')[0],baseElement && (head = s.head = baseElement.parentNode)),req.onError = defaultOnError,req.createNode = function(e,t,r){var n = e.xhtml ? document.createElementNS('http://www.w3.org/1999/xhtml','html:script'):document.createElement('script');return n.type = e.scriptType || 'text/javascript',n.charset = 'utf-8',n.async = !0,n;},req.load = function(e,t,r){var n,i = e && e.config || {};if (isBrowser) {return n=req.createNode(i,t,r),n.setAttribute("data-requirecontext",e.contextName),n.setAttribute("data-requiremodule",t),!n.attachEvent||n.attachEvent.toString&&n.attachEvent.toString().indexOf("[native code")<0||isOpera?(n.addEventListener("load",e.onScriptLoad,!1),n.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,n.attachEvent("onreadystatechange",e.onScriptLoad)),n.src=r,i.onNodeCreated&&i.onNodeCreated(n,i,t,r),currentlyAddingScript=n,baseElement?head.insertBefore(n,baseElement):head.appendChild(n),currentlyAddingScript=null,n;}if (isWebWorker){try{setTimeout(function(){},0),importScripts(r),e.completeLoad(t)}catch(n){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+r,n,[t]))}}},isBrowser && !cfg.skipDataMain && eachReverse(scripts(),(e) => {if (head || (head = e.parentNode),dataMain = e.getAttribute('data-main')) {return mainScript=dataMain,cfg.baseUrl||mainScript.indexOf("!")!==-1||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0};}),define = function(e,t,r){var n,i;'string' != typeof e && (r = t,t = e,e = null),isArray(t) || (r = t,t = null),!t && isFunction(r) && (t = [],r.length && (r.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,(e,r) => {t.push(r);}),t = (1 === r.length ? ['require']:['require','exports','module']).concat(t))),useInteractive && (n = currentlyAddingScript || getInteractiveScript(),n && (e || (e = n.getAttribute('data-requiremodule')),i = contexts[n.getAttribute('data-requirecontext')])),i ? (i.defQueue.push([e,t,r]),i.defQueueMap[e] = !0):globalDefQueue.push([e,t,r]);},define.amd = { jQuery: !0 },req.exec = function(text){return eval(text);},req(cfg);}})(this,'undefined' == typeof setTimeout ? void 0 : setTimeout),AMapUI.requirejs = requirejs,AMapUI.require = require,AMapUI.define = define;}})(),AMapUI.define('polyfill/require/require',() => {}),AMapUI.define('polyfill/require/require-css/css',[],() => {if ('undefined' == typeof window) {return { load(e,t,r){r();} };} var e = document.getElementsByTagName('head')[0],t = window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/) || 0,r = !1,n = !0;t[1] || t[7] ? r = parseInt(t[1]) < 6 || parseInt(t[7]) <= 9 : t[2] || t[8] ? n = !1 : t[4] && (r = parseInt(t[4]) < 18);var i = {};i.pluginBuilder = './css-builder';var o,a,s,u = function(){o = document.createElement('style'),e.appendChild(o),a = o.styleSheet || o.sheet;},c = 0,f = [],p = function(e){a.addImport(e),o.onload = function(){d();},c++,31 == c && (u(),c = 0);},d = function(){s();var e = f.shift();return e ? (s = e[1],void p(e[0])) : void (s = null);},l = function(e,t){if (a && a.addImport || u(),a && a.addImport){s ? f.push([e,t]) : (p(e),s = t);} else {o.textContent = `@import "${e}";`;var r = setInterval(() => {try {o.sheet.cssRules,clearInterval(r),t();} catch (e){}},10);}},h = function(t,r){var i = document.createElement('link');if (i.type = 'text/css',i.rel = 'stylesheet',n){i.onload = function(){i.onload = function(){},setTimeout(r,7);};} else {var o = setInterval(() => {for (var e = 0;e < document.styleSheets.length;e++){var t = document.styleSheets[e];if (t.href == i.href) {return clearInterval(o),r();}}},10);}i.href = t,e.appendChild(i);};return i.normalize = function(e,t){return '.css' == e.substr(e.length - 4,4) && (e = e.substr(0,e.length - 4)),t(e);},i.load = function(e,t,n,i){(r ? l : h)(t.toUrl(`${e}.css`),n);},i;}),AMapUI.define('polyfill/require/require-css/normalize',[],() => {function e(e,n,i){if (e.match(s) || e.match(a)) {return e;}e = o(e);var u = i.match(a),c = n.match(a);return !c || u && u[1] == c[1] && u[2] == c[2] ? r(t(e,n),i) : t(e,n);} function t(e,t){if ('./' == e.substr(0,2) && (e = e.substr(2)),e.match(s) || e.match(a)) {return e;} var r = t.split('/'),n = e.split('/');for (r.pop();curPart = n.shift();){'..' == curPart ? r.pop() : r.push(curPart);} return r.join('/');} function r(e,t){var r = t.split('/');for (r.pop(),t = `${r.join('/')}/`,i = 0;t.substr(i,1) == e.substr(i,1);){i++;} for (;'/' != t.substr(i,1);){i--;}t = t.substr(i + 1),e = e.substr(i + 1),r = t.split('/');var n = e.split('/');for (out = '';r.shift();){out += '../';} for (;curPart = n.shift();){out += `${curPart}/`;} return out.substr(0,out.length - 1);} var n = /([^:])\/+/g,o = function(e){return e.replace(n,'$1/');},a = /[^\:\/]*:\/\/([^\/])*/,s = /^(\/|data:)/,u = function(r,n,i,a){n = o(n),i = o(i);for (var s,u,r,c = /@import\s*("([^"]*)"|'([^']*)')|url\s*\((?!#)\s*(\s*"([^"]*)"|'([^']*)'|[^\)]*\s*)\s*\)/gi;s = c.exec(r);){u = s[3] || s[2] || s[5] || s[6] || s[4];var f;f = e(u,n,i),f !== u && a && (f = t(f,a));var p = s[5] || s[6] ? 1 : 0;r = r.substr(0,c.lastIndex - u.length - p - 1) + f + r.substr(c.lastIndex - p - 1),c.lastIndex = c.lastIndex + (f.length - u.length);} return r;};return u.convertURIBase = e,u.absoluteURI = t,u.relativeURI = r,u;}),AMapUI.define('polyfill/require/require-text/text',['module'],(e) => {'use strict';function t(e,t){return void 0 === e || '' === e ? t : e;} function r(e,r,n,i){if (r === i) {return !0;} if (e === n){if ('http' === e) {return t(r,'80') === t(i,'80');} if ('https' === e) {return t(r,'443') === t(i,'443');}} return !1;} var n,i,o,a,s,u = ['Msxml2.XMLHTTP','Microsoft.XMLHTTP','Msxml2.XMLHTTP.4.0'],c = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,f = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,p = 'undefined' != typeof location && location.href,d = p && location.protocol && location.protocol.replace(/\:/,''),l = p && location.hostname,h = p && (location.port || void 0),m = {},g = e.config && e.config() || {};return n = { version: '2.0.15',strip(e){if (e){e = e.replace(c,'');var t = e.match(f);t && (e = t[1]);} else {e = '';} return e;},jsEscape(e){return e.replace(/(['\\])/g,'\\$1').replace(/[\f]/g,'\\f').replace(/[\b]/g,'\\b').replace(/[\n]/g,'\\n').replace(/[\t]/g,'\\t').replace(/[\r]/g,'\\r').replace(/[\u2028]/g,'\\u2028').replace(/[\u2029]/g,'\\u2029');},createXhr: g.createXhr || function(){var e,t,r;if ('undefined' != typeof XMLHttpRequest) {return new XMLHttpRequest;} if ('undefined' != typeof ActiveXObject){for (t = 0;t < 3;t += 1){r = u[t];try {e = new ActiveXObject(r);} catch (e){} if (e){u = [r];break;}}} return e;},parseName(e){var t,r,n,i = !1,o = e.lastIndexOf('.'),a = 0 === e.indexOf('./') || 0 === e.indexOf('../');return o !== -1 && (!a || o > 1) ? (t = e.substring(0,o),r = e.substring(o + 1)) : t = e,n = r || t,o = n.indexOf('!'),o !== -1 && (i = 'strip' === n.substring(o + 1),n = n.substring(0,o),r ? r = n : t = n),{ moduleName: t,ext: r,strip: i };},xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,useXhr(e,t,i,o){var a,s,u,c = n.xdRegExp.exec(e);return !c || (a = c[2],s = c[3],s = s.split(':'),u = s[1],s = s[0],(!a || a === t) && (!s || s.toLowerCase() === i.toLowerCase()) && (!u && !s || r(a,u,t,o)));},finishLoad(e,t,r,i){r = t ? n.strip(r) : r,g.isBuild && (m[e] = r),i(r);},load(e,t,r,i){if (i && i.isBuild && !i.inlineText) {return void r();}g.isBuild = i && i.isBuild;var o = n.parseName(e),a = o.moduleName + (o.ext ? `.${ o.ext}` : ''),s = t.toUrl(a),u = g.useXhr || n.useXhr;return 0 === s.indexOf('empty:') ? void r() : void (!p || u(s,d,l,h) ? n.get(s,(t) => {n.finishLoad(e,o.strip,t,r);},(e) => {r.error && r.error(e);}) : t([a],(e) => {n.finishLoad(`${o.moduleName}.${o.ext}`,o.strip,e,r);}));},write(e,t,r,i){if (m.hasOwnProperty(t)){var o = n.jsEscape(m[t]);r.asModule(`${e}!${t}`,`define(function () { return '${ o }';});\n`);}},writeFile(e,t,r,i,o){var a = n.parseName(t),s = a.ext ? `.${ a.ext}` : '',u = a.moduleName + s,c = `${r.toUrl(a.moduleName + s)}.js`;n.load(u,r,(t) => {var r = function(e){return i(c,e);};r.asModule = function(e,t){return i.asModule(e,c,t);},n.write(e,u,r,o);},o);} },'node' === g.env || !g.env && 'undefined' != typeof process && process.versions && process.versions.node && !process.versions['node-webkit'] && !process.versions['atom-shell'] ? (i = require.nodeRequire('fs'),n.get = function(e,t,r){try {var n = i.readFileSync(e,'utf8');'\ufeff' === n[0] && (n = n.substring(1)),t(n);} catch (e){r && r(e);}}) : 'xhr' === g.env || !g.env && n.createXhr() ? n.get = function(e,t,r,i){var o,a = n.createXhr();if (a.open('GET',e,!0),i) {for (o in i){i.hasOwnProperty(o) && a.setRequestHeader(o.toLowerCase(),i[o]);}}g.onXhr && g.onXhr(a,e),a.onreadystatechange = function(n){var i,o;4 === a.readyState && (i = a.status || 0,i > 399 && i < 600 ? (o = new Error(`${e} HTTP status: ${i}`),o.xhr = a,r && r(o)) : t(a.responseText),g.onXhrComplete && g.onXhrComplete(a,e));},a.send(null);} : 'rhino' === g.env || !g.env && 'undefined' != typeof Packages && 'undefined' != typeof java ? n.get = function(e,t){var r,n,i = 'utf-8',o = new java.io.File(e),a = java.lang.System.getProperty('line.separator'),s = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o),i)),u = '';try {for (r = new java.lang.StringBuffer,n = s.readLine(),n && n.length() && 65279 === n.charAt(0) && (n = n.substring(1)),null !== n && r.append(n);null !== (n = s.readLine());){r.append(a),r.append(n);}u = String(r.toString());} finally {s.close();}t(u);} : ('xpconnect' === g.env || !g.env && 'undefined' != typeof Components && Components.classes && Components.interfaces) && (o = Components.classes,a = Components.interfaces,Components.utils['import']('resource://gre/modules/FileUtils.jsm'),s = '@mozilla.org/windows-registry-key;1' in o,n.get = function(e,t){var r,n,i,u = {};s && (e = e.replace(/\//g,'\\')),i = new FileUtils.File(e);try {r = o['@mozilla.org/network/file-input-stream;1'].createInstance(a.nsIFileInputStream),r.init(i,1,0,!1),n = o['@mozilla.org/intl/converter-input-stream;1'].createInstance(a.nsIConverterInputStream),n.init(r,'utf-8',r.available(),a.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),n.readString(r.available(),u),n.close(),r.close(),t(u.value);} catch (e){throw new Error(`${i && i.path || ''}: ${e}`);}}),n;}),AMapUI.define('polyfill/require/require-json/json',['text'],(text) => {function cacheBust(e){return e = e.replace(CACHE_BUST_FLAG,''),e += e.indexOf('?') < 0 ? '?' : '&',`${e + CACHE_BUST_QUERY_PARAM}=${Math.round(2147483647 * Math.random())}`;} var CACHE_BUST_QUERY_PARAM = 'bust',CACHE_BUST_FLAG = '!bust',jsonParse = 'undefined' != typeof JSON && 'function' == typeof JSON.parse ? JSON.parse : function(val){return eval(`(${val})`);},buildMap = {};return { load(e,t,r,n){n.isBuild && (n.inlineJSON === !1 || e.indexOf(`${CACHE_BUST_QUERY_PARAM}=`) !== -1) || 0 === t.toUrl(e).indexOf('empty:') ? r(null) : text.get(t.toUrl(e),(t) => {var i;if (n.isBuild){buildMap[e] = t,r(t);} else {try {i = jsonParse(t);} catch (e){r.error(e);}r(i);}},r.error,{ accept: 'application/json' });},normalize(e,t){return e.indexOf(CACHE_BUST_FLAG) !== -1 && (e = cacheBust(e)),t(e);},write(e,t,r){if (t in buildMap){var n = buildMap[t];r(`define("${e}!${t}", function(){ return ${n};});\n`);}} };}),AMapUI.define('_auto/req-lib',() => {});
AMapUI.define('lib/utils', [], () => {
function setLogger(logger) {
logger.debug || (logger.debug = logger.info);
utils.logger = utils.log = logger;
}
var utils, defaultLogger = console, emptyfunc = function() {}, slientLogger = {
log: emptyfunc,
error: emptyfunc,
warn: emptyfunc,
info: emptyfunc,
debug: emptyfunc,
trace: emptyfunc
};
utils = {
slientLogger,
setLogger,
mergeArray(target, source) {
if (source.length < 1e5) {target.push.apply(target, source);} else {for (var i = 0, len = source.length; i < len; i += 1) {target.push(source[i]);}}
},
setDebugMode(on) {
setLogger(on ? defaultLogger : slientLogger);
},
now: Date.now || function() {
return new Date().getTime();
},
bind(fn, thisArg) {
return fn.bind ? fn.bind(thisArg) : function() {
return fn.apply(thisArg, arguments);
};
},
domReady(callback) {
/complete|loaded|interactive/.test(document.readyState) ? callback() : document.addEventListener('DOMContentLoaded', () => {
callback();
}, !1);
},
forEach(array, callback, thisArg) {
if (array.forEach) {return array.forEach(callback, thisArg);}
for (var i = 0, len = array.length; i < len; i++) {callback.call(thisArg, array[i], i);}
},
keys(obj) {
if (Object.keys) {return Object.keys(obj);}
var keys = [];
for (var k in obj) {obj.hasOwnProperty(k) && keys.push(k);}
return keys;
},
map(array, callback, thisArg) {
if (array.map) {return array.map(callback, thisArg);}
for (var newArr = [], i = 0, len = array.length; i < len; i++) {newArr[i] = callback.call(thisArg, array[i], i);}
return newArr;
},
arrayIndexOf(array, searchElement, fromIndex) {
if (array.indexOf) {return array.indexOf(searchElement, fromIndex);}
var k, o = array, len = o.length >>> 0;
if (0 === len) {return -1;}
var n = 0 | fromIndex;
if (n >= len) {return -1;}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
for (;k < len; ) {
if (k in o && o[k] === searchElement) {return k;}
k++;
}
return -1;
},
extend(dst) {
dst || (dst = {});
return utils.extendObjs(dst, Array.prototype.slice.call(arguments, 1));
},
nestExtendObjs(dst, objs) {
dst || (dst = {});
for (var i = 0, len = objs.length; i < len; i++) {
var source = objs[i];
if (source) {for (var prop in source) {source.hasOwnProperty(prop) && (utils.isObject(dst[prop]) && utils.isObject(source[prop]) ? dst[prop] = utils.nestExtendObjs({}, [ dst[prop], source[prop] ]) : dst[prop] = source[prop]);}}
}
return dst;
},
extendObjs(dst, objs) {
dst || (dst = {});
for (var i = 0, len = objs.length; i < len; i++) {
var source = objs[i];
if (source) {for (var prop in source) {source.hasOwnProperty(prop) && (dst[prop] = source[prop]);}}
}
return dst;
},
subset(props) {
var sobj = {};
if (!props || !props.length) {return sobj;}
this.isArray(props) || (props = [props]);
utils.forEach(Array.prototype.slice.call(arguments, 1), (source) => {
if (source) {for (var i = 0, len = props.length; i < len; i++) {source.hasOwnProperty(props[i]) && (sobj[props[i]] = source[props[i]]);}}
});
return sobj;
},
isArray(obj) {
return Array.isArray ? Array.isArray(obj) : '[object Array]' === Object.prototype.toString.call(obj);
},
isObject(obj) {
return '[object Object]' === Object.prototype.toString.call(obj);
},
isFunction(obj) {
return '[object Function]' === Object.prototype.toString.call(obj);
},
isNumber(obj) {
return '[object Number]' === Object.prototype.toString.call(obj);
},
isString(obj) {
return '[object String]' === Object.prototype.toString.call(obj);
},
isHTMLElement(n) {
return window['HTMLElement'] || window['Element'] ? n instanceof (window['HTMLElement'] || window['Element']) : n && 'object' == typeof n && 1 === n.nodeType && 'string' == typeof n.nodeName;
},
isSVGElement(n) {
return window['SVGElement'] && n instanceof window['SVGElement'];
},
isDefined(v) {
return 'undefined' != typeof v;
},
random(length) {
var str = '', chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz', clen = chars.length;
length || (length = 6);
for (var i = 0; i < length; i++) {str += chars.charAt(this.randomInt(0, clen - 1));}
return str;
},
randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
},
inherit(child, parent) {
function Ctor() {
this.constructor = child;
}
for (var key in parent) {parent.hasOwnProperty(key) && (child[key] = parent[key]);}
Ctor.prototype = parent.prototype;
child.prototype = new Ctor();
child.__super__ = parent.prototype;
return child;
},
trim(s) {
return s ? s.trim ? s.trim() : s.replace(/^\s+|\s+$/gm, '') : '';
},
trigger(el, evt, detail) {
if (el) {
detail = detail || {};
var e, opt = {
bubbles: !0,
cancelable: !0,
detail
};
if ('undefined' != typeof CustomEvent) {
e = new CustomEvent(evt, opt);
el.dispatchEvent(e);
} else {try {
e = document.createEvent('CustomEvent');
e.initCustomEvent(evt, !0, !0, detail);
el.dispatchEvent(e);
} catch (exp) {
this.log.error(exp);
}}
return !0;
}
this.log.error('emply element passed in');
},
nextTick(f) {
('object' == typeof process && process.nextTick ? process.nextTick : function(task) {
setTimeout(task, 0);
})(f);
},
removeFromArray(arr, val) {
var index = arr.indexOf(val);
index > -1 && arr.splice(index, 1);
return index;
},
debounce(func, wait, immediate) {
var timeout, args, context, timestamp, result, later = function() {
var last = utils.now() - timestamp;
if (last < wait && last >= 0) {timeout = setTimeout(later, wait - last);} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
timeout || (context = args = null);
}
}
};
return function() {
context = this;
args = arguments;
timestamp = utils.now();
var callNow = immediate && !timeout;
timeout || (timeout = setTimeout(later, wait));
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
},
throttle(func, wait, options) {
var context, args, result, timeout = null, previous = 0;
options || (options = {});
var later = function() {
previous = options.leading === !1 ? 0 : utils.now();
timeout = null;
result = func.apply(context, args);
timeout || (context = args = null);
};
return function() {
var now = utils.now();
previous || options.leading !== !1 || (previous = now);
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
previous = now;
result = func.apply(context, args);
timeout || (context = args = null);
} else {timeout || options.trailing === !1 || (timeout = setTimeout(later, remaining));}
return result;
};
},
ucfirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
escapeHtml(text) {
var map = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#x27;',
'`': '&#x60;'
};
return `${text }`.replace(/[&<>"']/g, (m) => {
return map[m];
});
}
};
utils.setDebugMode(!1);
return utils;
});
AMapUI.define('lib/detect-global', ['./utils'], function(utils) {
var global = this;
return {
load(name, req, onLoad, config) {
for (var parts = name.split('|'), gVars = parts[0].split(','), finalMod = parts[1], i = 0, len = gVars.length; i < len; i++) {
var vname = utils.trim(gVars[i]);
if (global[vname]) {
onLoad(global[vname]);
return;
}
}
if (!finalMod) {throw new Error('can\'t find: ' + name);}
req([finalMod], (value) => {
onLoad(value);
});
}
};
});
AMapUI.define('lib/$', [`lib/detect-global!jQuery,Zepto|${AMap.UA.mobile ? 'zepto' : 'jquery'}`], ($) => {
return $;
});
AMapUI.define('lib/conf', ['module'], (mod) => {
return mod.config();
});
AMapUI.define('lib/dom.utils', [], () => {
var domUtils = {
isCanvasSupported() {
var elem = document.createElement('canvas');
return !!(elem && elem.getContext && elem.getContext('2d'));
},
toggleClass(el, name, add) {
add ? domUtils.addClass(el, name) : domUtils.removeClass(el, name);
},
addClass(el, name) {
el && name && (domUtils.hasClassName(el, name) || (el.className += (el.className ? ' ' : '') + name));
},
removeClass(el, name) {
function replaceFn(w, match) {
return match === name ? '' : w;
}
el && name && (el.className = el.className.replace(/(\S+)\s*/g, replaceFn).replace(/(^\s+|\s+$)/, ''));
},
hasClassName(ele, className) {
var testClass = new RegExp(`(^|\\s)${ className }(\\s|$)`);
return testClass.test(ele.className);
},
getElementsByClassName(className, tag, parent) {
tag = tag || '*';
parent = parent || document;
if (parent.getElementsByClassName) {return parent.getElementsByClassName(className);}
for (var current, elements = parent.getElementsByTagName(tag), returnElements = [], i = 0; i < elements.length; i++) {
current = elements[i];
domUtils.hasClassName(current, className) && returnElements.push(current);
}
return returnElements;
}
};
return domUtils;
});
AMapUI.define('lib/event', ['lib/utils'], (utils) => {
'use strict';
function Event() {
this.__evHash = {};
}
utils.extend(Event.prototype, {
on(ev, listener, priority) {
if (this.__multiCall(ev, listener, this.on)) {return this;}
if (!ev) {return this;}
var evHash = this.__evHash;
evHash[ev] || (evHash[ev] = []);
var list = evHash[ev], index = this.__index(list, listener);
if (index < 0) {
'number' != typeof priority && (priority = 10);
for (var inps = list.length, i = 0, len = list.length; i < len; i++) {if (priority > list[i].priority) {
inps = i;
break;
}}
list.splice(inps, 0, {
listener,
priority
});
}
return this;
},
once(ev, listener, priority) {
function oncefunc() {
self.__callListenser(listener, arguments);
self.off(ev, oncefunc);
}
if (this.__multiCall(ev, listener, this.once)) {return this;}
var self = this;
this.on(ev, oncefunc, priority);
return this;
},
offAll() {
for (var ev in this.__evHash) {this.off(ev);}
this.__evHash = {};
return this;
},
off(ev, listener) {
if (this.__multiCall(ev, listener, this.off)) {return this;}
var evHash = this.__evHash;
if (evHash[ev]) {
var list = evHash[ev];
if ('undefined' == typeof listener) {
var c = list.length;
list.length = 0;
return c;
}
var index = this.__index(list, listener);
if (index >= 0) {
list.splice(index, 1);
return 1;
}
return 0;
}
},
listenerLength(ev) {
var evHash = this.__evHash, list = evHash[ev];
return list ? list.length : 0;
},
emit(ev) {
var args, list, evHash = this.__evHash, count = 0;
list = evHash[ev];
if (list && list.length) {
args = Array.prototype.slice.call(arguments, 1);
count += this.__callListenerList(list, args);
}
list = evHash['*'];
if (list && list.length) {
args = Array.prototype.slice.call(arguments);
count += this.__callListenerList(list, args);
}
return count;
},
trigger(ev) {
var args = Array.prototype.slice.call(arguments, 0);
args.splice(1, 0, {
type: ev,
target: this
});
this.emit.apply(this, args);
},
triggerWithOriginalEvent(ev, originalEvent) {
var args = Array.prototype.slice.call(arguments, 0);
args[1] = {
type: ev,
target: originalEvent ? originalEvent.target : this,
originalEvent
};
this.emit.apply(this, args);
},
onDestroy(cb, priority) {
this.on('__destroy', cb, priority);
return this;
},
destroy() {
if (!this.__destroying) {
this.__destroying = 1;
this.emit('__destroy', this);
this.offAll();
return this;
}
},
__multiCall: function(ev, listener, func) {
if (!ev) {return !0;}
if (utils.isObject(ev) && 'undefined' == typeof listener) {
for (var k in ev) {func.call(this, k, ev[k]);}
return !0;
}
var evs;
utils.isArray(ev) ? evs = ev : 'string' == typeof ev && (evs = ev.split(/[\s,]+/));
if (evs && evs.length > 1) {
for (var i = 0, len = evs.length; i < len; i++) {evs[i] && func.call(this, evs[i], listener);}
return !0;
}
return !1;
},
__index: function(list, listener) {
for (var index = -1, i = 0, len = list.length; i < len; i++) {
var ele = list[i];
if (ele.listener === listener) {
index = i;
break;
}
}
return index;
},
__callListenser: function(listener, args) {
var func = null, contxt = null;
if ('function' == typeof listener) {
func = listener;
contxt = this;
} else if (2 == listener.length) {
func = listener[1];
contxt = listener[0];
}
return func ? [1, func.apply(contxt, args)] : [0, void 0];
},
__callListenerList: function(list, args) {
if (!list || !list.length) {return 0;}
list = [].concat(list);
for (var cres, count = 0, i = 0, len = list.length; i < len; i++) {
cres = this.__callListenser(list[i].listener, args);
count += cres[0];
if (cres[1] === !1) {break;}
}
return count;
}
});
return Event;
});
AMapUI.define('lib/underscore-tpl', [], () => {
function escapeHtml(text) {
var map = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#x27;',
'`': '&#x60;'
};
return `${text}`.replace(/[&<>"']/g, (m) => {
return map[m];
});
}
function tmpl(text, data) {
var settings = templateSettings, matcher = new RegExp(`${[(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join('|')}|$`, 'g'), index = 0, source = '__p+=\'';
text.replace(matcher, (match, escape, interpolate, evaluate, offset) => {
source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
index = offset + match.length;
escape ? source += `'+\n((__t=(${escape}))==null?'':${innerContextVarName}.escape(__t))+\n'` : interpolate ? source += `'+\n((__t=(${interpolate}))==null?'':__t)+\n'` : evaluate && (source += `';\n${evaluate}\n__p+='`);
return match;
});
source += '\';\n';
settings.variable || (source = `with(obj||{}){\n${source}}\n`);
source = `var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n${source}return __p;\n`;
var render;
try {
render = new Function(settings.variable || 'obj', innerContextVarName, source);
} catch (e) {
e.source = source;
throw e;
}
var template = function(data) {
return render.call(this, data, {
escape: escapeHtml,
template: tmpl
});
}, argument = settings.variable || 'obj';
template.source = `function(${argument}){\n${source}}`;
return data ? template(data) : template;
}
var templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
}, noMatch = /(.)^/, escapes = {
'\'': '\'',
'\\': '\\',
'\r': 'r',
'\n': 'n',
'\u2028': 'u2028',
'\u2029': 'u2029'
}, escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g, escapeChar = function(match) {
return `\\${escapes[match]}`;
}, innerContextVarName = '_amapui_tpl_cxt_';
return tmpl;
});
AMapUI.define('lib/SphericalMercator', [], () => {
function getScale(level) {
scaleCache[level] || (scaleCache[level] = 256 * Math.pow(2, level));
return scaleCache[level];
}
function project(lnglat) {
var lat = Math.max(Math.min(maxLat, lnglat[1]), -maxLat), x = lnglat[0] * deg2rad, y = lat * deg2rad;
y = Math.log(Math.tan(quadPI + y / 2));
return [x, y];
}
function transform(point, scale) {
scale = scale || 1;
var a = half2PI, b = .5, c = -a, d = .5;
return [scale * (a * point[0] + b), scale * (c * point[1] + d)];
}
function unproject(point) {
var lng = point[0] * rad2deg, lat = (2 * Math.atan(Math.exp(point[1])) - Math.PI / 2) * rad2deg;
return [parseFloat(lng.toFixed(6)), parseFloat(lat.toFixed(6))];
}
function untransform(point, scale) {
var a = half2PI, b = .5, c = -a, d = .5;
return [(point[0] / scale - b) / a, (point[1] / scale - d) / c];
}
function lngLatToPointByScale(lnglat, scale, round) {
var p = transform(project(lnglat), scale);
if (round) {
p[0] = Math.round(p[0]);
p[1] = Math.round(p[1]);
}
return p;
}
function lngLatToPoint(lnglat, level, round) {
return lngLatToPointByScale(lnglat, getScale(level), round);
}
function pointToLngLat(point, level) {
var scale = getScale(level), untransformedPoint = untransform(point, scale);
return unproject(untransformedPoint);
}
function haversineDistance(point1, point2) {
var cos = Math.cos, lat1 = point1[1] * deg2rad, lon1 = point1[0] * deg2rad, lat2 = point2[1] * deg2rad, lon2 = point2[0] * deg2rad, dLat = lat2 - lat1, dLon = lon2 - lon1, a = (1 - cos(dLat) + (1 - cos(dLon)) * cos(lat1) * cos(lat2)) / 2;
return earthDiameter * Math.asin(Math.sqrt(a));
}
var scaleCache = {}, earthDiameter = 12756274, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI, quadPI = Math.PI / 4, maxLat = 85.0511287798, half2PI = .5 / Math.PI;
return {
haversineDistance,
getScale,
lngLatToPointByScale,
pointToLngLat,
lngLatToPoint
};
});
AMapUI.define('_auto/lib', () => {});
AMapUI.requireConf = {
'skipDataMain': true,
'config': {
'lib/conf': {
'productWebRoot': '/extra/amap/js/mapUI',
'mainVersion': '1.0',
'patchVersion': '11',
'fullVersion': '1.0.11'
}
},
'map': {
'*': {
'css': 'polyfill/require/require-css/css',
'text': 'polyfill/require/require-text/text',
'json': 'polyfill/require/require-json/json'
}
},
'shim': {
'jquery': {
'exports': '$'
},
'zepto': {
'exports': '$'
}
},
'paths': {
'jquery': 'plug/ext/jquery-1.12.4.min',
'zepto': 'plug/ext/zepto-1.2.0.min'
},
'baseUrl': '/extra/amap/js/mapUI/',
'baseUrlProtocol': null
};
AMapUI.libConf = AMapUI.requireConf.config['lib/conf'];
AMapUI.uiMods = [
'ui/control/BasicControl',
'ui/geo/DistrictCluster',
'ui/geo/DistrictExplorer',
'ui/misc/MarkerList',
'ui/misc/MobiCityPicker',
'ui/misc/PathSimplifier',
'ui/misc/PoiPicker',
'ui/misc/PointSimplifier',
'ui/misc/PointSimplifr',
'ui/misc/PositionPicker',
'ui/overlay/AwesomeMarker',
'ui/overlay/SimpleInfoWindow',
'ui/overlay/SimpleMarker',
'ui/overlay/SvgMarker'
];
!(function(ns, window) {
function getParameterByName(name) {
var match = new RegExp(`[?&]${ name }=([^&]*)`).exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
function getAMapKey() {
return AMap.User ? AMap.User.key : '';
}
function arrForEach(array, callback, thisArg) {
if (array.forEach) {return array.forEach(callback, thisArg);}
for (var i = 0, len = array.length; i < len; i++) {callback.call(thisArg, array[i], i);}
}
function extendObj(dst) {
dst || (dst = {});
arrForEach(Array.prototype.slice.call(arguments, 1), (source) => {
if (source) {for (var prop in source) {source.hasOwnProperty(prop) && (dst[prop] = source[prop]);}}
});
return dst;
}
var libConf = ns.libConf, reqConf = ns.requireConf, uiMods = ns.uiMods || [];
ns.docProtocol = 'https:' === document.location.protocol ? 'https:' : 'http:';
window.AMapUIProtocol && (ns.docProtocol = window.AMapUIProtocol);
window.AMapUIBaseUrl && (reqConf.baseUrl = window.AMapUIBaseUrl);
0 === reqConf.baseUrl.indexOf('//') && (reqConf.baseUrl = ns.docProtocol + reqConf.baseUrl);
var getAbsoluteUrl = (function() {
var div = document.createElement('div');
div.innerHTML = '<a></a>';
return function(url) {
div.firstChild.href = url;
div.innerHTML = div.innerHTML;
return div.firstChild.href;
};
})();
ns.getAbsoluteUrl = getAbsoluteUrl;
getParameterByName('debugAMapUI') && (libConf.debugMode = !0);
var isDebugMode = !!libConf.debugMode;
ns.version = libConf.version = `${libConf.mainVersion}.${libConf.patchVersion}`;
if (!isDebugMode) {
reqConf.bundles || (reqConf.bundles = {});
for (var reqBundles = reqConf.bundles, i = 0, len = uiMods.length; i < len; i++) {
var uiModId = uiMods[i];
reqBundles[uiModId] || (reqBundles[uiModId] = []);
reqBundles[uiModId].push(`${uiMods[i]}/main`);
}
}
ns.getBaseUrl = function() {
return reqConf.baseUrl;
};
reqConf.urlArgs = function(id, url) {
var args = [];
args.push(`v=${ ns.version}`);
isDebugMode && args.push(`_t=${ Date.now()}`);
if (0 === id.indexOf('ui/')) {
var parts = id.split('/');
(3 === parts.length || 4 === parts.length && 'main' === parts[3]) && args.push('mt=ui');
args.push(`key=${ getAMapKey()}`);
}
return (url.indexOf('?') < 0 ? '?' : '&') + args.join('&');
};
var requireContentName = `amap-ui-${ ns.version}`;
ns.require = ns.requirejs.config(extendObj({
context: requireContentName
}, reqConf));
ns.UI = ns.UI || {};
ns.findDefinedId = function(test, thisArg) {
var requirejs = ns.requirejs;
if (!requirejs.s || !requirejs.s.contexts) {return null;}
var contexts = requirejs.s.contexts[requireContentName];
if (!contexts) {return null;}
var defined = contexts.defined;
for (var k in defined) {if (defined.hasOwnProperty(k) && test.call(thisArg, k)) {return k;}}
return null;
};
ns.weakDefine = function(name) {
return ('string' != typeof name || !ns.require.defined(name)) && ns.define.apply(ns, arguments);
};
ns.defineTpl = function(name) {
if ('string' != typeof name) {throw new Error('tpl name is supposed to be a string');}
var args = Array.prototype.slice.call(arguments, 0);
args[0] = `polyfill/require/require-text/text!${ args[0]}`;
return ns.define.apply(ns, args);
};
ns.setDomLibrary = function($) {
ns.require.undef('lib/$');
ns.define('lib/$', [], () => {
return $;
});
};
ns.inspectDomLibrary = function($) {
var isJQuery = $.fn && $.fn.jquery, isZepto = $ === window.Zepto;
return {
isJQuery: !!isJQuery,
isZepto,
version: isJQuery ? $.fn.jquery : 'unknown'
};
};
ns.versionCompare = function(left, right) {
if (typeof left + typeof right != 'stringstring') {return !1;}
for (var a = left.split('.'), b = right.split('.'), i = 0, len = Math.max(a.length, b.length); i < len; i++) {
if (a[i] && !b[i] && parseInt(a[i], 10) > 0 || parseInt(a[i], 10) > parseInt(b[i], 10)) {return 1;}
if (b[i] && !a[i] && parseInt(b[i], 10) > 0 || parseInt(a[i], 10) < parseInt(b[i], 10)) {return -1;}
}
return 0;
};
ns.checkDomLibrary = function($, opts) {
opts = extendObj({
minJQueryVersion: '1.3'
}, opts);
var libInfo = ns.inspectDomLibrary($);
return !(libInfo.isJQuery && ns.versionCompare(libInfo.version, opts.minJQueryVersion) < 0) || `jQuery当前版本(${ libInfo.version })过低,请更新到 ${ opts.minJQueryVersion } 或以上版本!`;
};
ns.setDebugMode = function(on) {
on = !!on;
ns.debugMode = on;
window.AMapUI_DEBUG = on;
ns.require(['lib/utils'], (utils) => {
utils.setDebugMode(ns.debugMode);
ns.debugMode && utils.logger.warn('Debug mode!');
});
};
ns.setDebugMode(isDebugMode);
ns.load = function(unames, callback, opts) {
ns.require(['lib/utils'], (utils) => {
utils.isArray(unames) || (unames = [unames]);
for (var uname, mods = [], modNameFilter = opts && opts.modNameFilter, i = 0, len = unames.length; i < len; i++) {
uname = unames[i];
modNameFilter && (uname = modNameFilter.call(null, uname));
ns.debugMode && 0 === uname.indexOf('ui/') && 3 === uname.split('/').length && (uname += '/main');
mods.push(uname);
}
ns.require(mods, callback);
});
};
ns.loadCss = function(urls, cb) {
ns.load(urls, cb, {
modNameFilter(url) {
return 'css!' + getAbsoluteUrl(url);
}
});
};
ns.loadJs = function(urls, cb) {
ns.load(urls, cb, {
modNameFilter(url) {
return getAbsoluteUrl(url);
}
});
};
ns.loadText = function(urls, cb) {
ns.load(urls, cb, {
modNameFilter(url) {
return 'text!' + getAbsoluteUrl(url);
}
});
};
ns.loadUI = function(unames, cb) {
ns.load(unames, cb, {
modNameFilter(uname) {
return 'ui/' + uname;
}
});
};
ns.loadTpl = function(url, data, cb) {
ns.require(['lib/underscore-tpl', `text!${ getAbsoluteUrl(url)}`], (template, text) => {
cb(template(text, data), {
template,
text
});
});
};
isDebugMode || setTimeout(() => {
ns.loadJs(`${ns.docProtocol}//webapi.amap.com/count?type=UIInit&k=${getAMapKey()}`);
}, 0);
})(AMapUI, window);
window.AMapUI = AMapUI;
})(window);
\ No newline at end of file
AMapUI.define([], function() {
function getScale(level) {
scaleCache[level] || (scaleCache[level] = 256 * Math.pow(2, level));
return scaleCache[level];
}
function project(lnglat) {
var lat = Math.max(Math.min(maxLat, lnglat[1]), -maxLat), x = lnglat[0] * deg2rad, y = lat * deg2rad;
y = Math.log(Math.tan(quadPI + y / 2));
return [ x, y ];
}
function transform(point, scale) {
scale = scale || 1;
var a = half2PI, b = .5, c = -a, d = .5;
return [ scale * (a * point[0] + b), scale * (c * point[1] + d) ];
}
function unproject(point) {
var lng = point[0] * rad2deg, lat = (2 * Math.atan(Math.exp(point[1])) - Math.PI / 2) * rad2deg;
return [ parseFloat(lng.toFixed(6)), parseFloat(lat.toFixed(6)) ];
}
function untransform(point, scale) {
var a = half2PI, b = .5, c = -a, d = .5;
return [ (point[0] / scale - b) / a, (point[1] / scale - d) / c ];
}
function lngLatToPointByScale(lnglat, scale, round) {
var p = transform(project(lnglat), scale);
if (round) {
p[0] = Math.round(p[0]);
p[1] = Math.round(p[1]);
}
return p;
}
function lngLatToPoint(lnglat, level, round) {
return lngLatToPointByScale(lnglat, getScale(level), round);
}
function pointToLngLat(point, level) {
var scale = getScale(level), untransformedPoint = untransform(point, scale);
return unproject(untransformedPoint);
}
function haversineDistance(point1, point2) {
var cos = Math.cos, lat1 = point1[1] * deg2rad, lon1 = point1[0] * deg2rad, lat2 = point2[1] * deg2rad, lon2 = point2[0] * deg2rad, dLat = lat2 - lat1, dLon = lon2 - lon1, a = (1 - cos(dLat) + (1 - cos(dLon)) * cos(lat1) * cos(lat2)) / 2;
return earthDiameter * Math.asin(Math.sqrt(a));
}
var scaleCache = {}, earthDiameter = 12756274, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI, quadPI = Math.PI / 4, maxLat = 85.0511287798, half2PI = .5 / Math.PI;
return {
haversineDistance: haversineDistance,
getScale: getScale,
lngLatToPointByScale: lngLatToPointByScale,
pointToLngLat: pointToLngLat,
lngLatToPoint: lngLatToPoint
};
});
\ No newline at end of file
AMapUI.define([ "lib/utils" ], function(utils) {
"use strict";
function Event() {
this.__evHash = {};
}
utils.extend(Event.prototype, {
on: function(ev, listener, priority) {
if (this.__multiCall(ev, listener, this.on)) return this;
if (!ev) return this;
var evHash = this.__evHash;
evHash[ev] || (evHash[ev] = []);
var list = evHash[ev], index = this.__index(list, listener);
if (index < 0) {
"number" != typeof priority && (priority = 10);
for (var inps = list.length, i = 0, len = list.length; i < len; i++) if (priority > list[i].priority) {
inps = i;
break;
}
list.splice(inps, 0, {
listener: listener,
priority: priority
});
}
return this;
},
once: function(ev, listener, priority) {
function oncefunc() {
self.__callListenser(listener, arguments);
self.off(ev, oncefunc);
}
if (this.__multiCall(ev, listener, this.once)) return this;
var self = this;
this.on(ev, oncefunc, priority);
return this;
},
offAll: function() {
for (var ev in this.__evHash) this.off(ev);
this.__evHash = {};
return this;
},
off: function(ev, listener) {
if (this.__multiCall(ev, listener, this.off)) return this;
var evHash = this.__evHash;
if (evHash[ev]) {
var list = evHash[ev];
if ("undefined" == typeof listener) {
var c = list.length;
list.length = 0;
return c;
}
var index = this.__index(list, listener);
if (index >= 0) {
list.splice(index, 1);
return 1;
}
return 0;
}
},
listenerLength: function(ev) {
var evHash = this.__evHash, list = evHash[ev];
return list ? list.length : 0;
},
emit: function(ev) {
var args, list, evHash = this.__evHash, count = 0;
list = evHash[ev];
if (list && list.length) {
args = Array.prototype.slice.call(arguments, 1);
count += this.__callListenerList(list, args);
}
list = evHash["*"];
if (list && list.length) {
args = Array.prototype.slice.call(arguments);
count += this.__callListenerList(list, args);
}
return count;
},
trigger: function(ev) {
var args = Array.prototype.slice.call(arguments, 0);
args.splice(1, 0, {
type: ev,
target: this
});
this.emit.apply(this, args);
},
triggerWithOriginalEvent: function(ev, originalEvent) {
var args = Array.prototype.slice.call(arguments, 0);
args[1] = {
type: ev,
target: originalEvent ? originalEvent.target : this,
originalEvent: originalEvent
};
this.emit.apply(this, args);
},
onDestroy: function(cb, priority) {
this.on("__destroy", cb, priority);
return this;
},
destroy: function() {
if (!this.__destroying) {
this.__destroying = 1;
this.emit("__destroy", this);
this.offAll();
return this;
}
},
__multiCall: function(ev, listener, func) {
if (!ev) return !0;
if (utils.isObject(ev) && "undefined" == typeof listener) {
for (var k in ev) func.call(this, k, ev[k]);
return !0;
}
var evs;
utils.isArray(ev) ? evs = ev : "string" == typeof ev && (evs = ev.split(/[\s,]+/));
if (evs && evs.length > 1) {
for (var i = 0, len = evs.length; i < len; i++) evs[i] && func.call(this, evs[i], listener);
return !0;
}
return !1;
},
__index: function(list, listener) {
for (var index = -1, i = 0, len = list.length; i < len; i++) {
var ele = list[i];
if (ele.listener === listener) {
index = i;
break;
}
}
return index;
},
__callListenser: function(listener, args) {
var func = null, contxt = null;
if ("function" == typeof listener) {
func = listener;
contxt = this;
} else if (2 == listener.length) {
func = listener[1];
contxt = listener[0];
}
return func ? [ 1, func.apply(contxt, args) ] : [ 0, void 0 ];
},
__callListenerList: function(list, args) {
if (!list || !list.length) return 0;
list = [].concat(list);
for (var cres, count = 0, i = 0, len = list.length; i < len; i++) {
cres = this.__callListenser(list[i].listener, args);
count += cres[0];
if (cres[1] === !1) break;
}
return count;
}
});
return Event;
});
\ No newline at end of file
AMapUI.define([], function() {
function setLogger(logger) {
logger.debug || (logger.debug = logger.info);
utils.logger = utils.log = logger;
}
var utils, defaultLogger = console, emptyfunc = function() {}, slientLogger = {
log: emptyfunc,
error: emptyfunc,
warn: emptyfunc,
info: emptyfunc,
debug: emptyfunc,
trace: emptyfunc
};
utils = {
slientLogger: slientLogger,
setLogger: setLogger,
mergeArray: function(target, source) {
if (source.length < 1e5) target.push.apply(target, source); else for (var i = 0, len = source.length; i < len; i += 1) target.push(source[i]);
},
setDebugMode: function(on) {
setLogger(on ? defaultLogger : slientLogger);
},
now: Date.now || function() {
return new Date().getTime();
},
bind: function(fn, thisArg) {
return fn.bind ? fn.bind(thisArg) : function() {
return fn.apply(thisArg, arguments);
};
},
domReady: function(callback) {
/complete|loaded|interactive/.test(document.readyState) ? callback() : document.addEventListener("DOMContentLoaded", function() {
callback();
}, !1);
},
forEach: function(array, callback, thisArg) {
if (array.forEach) return array.forEach(callback, thisArg);
for (var i = 0, len = array.length; i < len; i++) callback.call(thisArg, array[i], i);
},
keys: function(obj) {
if (Object.keys) return Object.keys(obj);
var keys = [];
for (var k in obj) obj.hasOwnProperty(k) && keys.push(k);
return keys;
},
map: function(array, callback, thisArg) {
if (array.map) return array.map(callback, thisArg);
for (var newArr = [], i = 0, len = array.length; i < len; i++) newArr[i] = callback.call(thisArg, array[i], i);
return newArr;
},
arrayIndexOf: function(array, searchElement, fromIndex) {
if (array.indexOf) return array.indexOf(searchElement, fromIndex);
var k, o = array, len = o.length >>> 0;
if (0 === len) return -1;
var n = 0 | fromIndex;
if (n >= len) return -1;
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
for (;k < len; ) {
if (k in o && o[k] === searchElement) return k;
k++;
}
return -1;
},
extend: function(dst) {
dst || (dst = {});
return utils.extendObjs(dst, Array.prototype.slice.call(arguments, 1));
},
nestExtendObjs: function(dst, objs) {
dst || (dst = {});
for (var i = 0, len = objs.length; i < len; i++) {
var source = objs[i];
if (source) for (var prop in source) source.hasOwnProperty(prop) && (utils.isObject(dst[prop]) && utils.isObject(source[prop]) ? dst[prop] = utils.nestExtendObjs({}, [ dst[prop], source[prop] ]) : dst[prop] = source[prop]);
}
return dst;
},
extendObjs: function(dst, objs) {
dst || (dst = {});
for (var i = 0, len = objs.length; i < len; i++) {
var source = objs[i];
if (source) for (var prop in source) source.hasOwnProperty(prop) && (dst[prop] = source[prop]);
}
return dst;
},
subset: function(props) {
var sobj = {};
if (!props || !props.length) return sobj;
this.isArray(props) || (props = [ props ]);
utils.forEach(Array.prototype.slice.call(arguments, 1), function(source) {
if (source) for (var i = 0, len = props.length; i < len; i++) source.hasOwnProperty(props[i]) && (sobj[props[i]] = source[props[i]]);
});
return sobj;
},
isArray: function(obj) {
return Array.isArray ? Array.isArray(obj) : "[object Array]" === Object.prototype.toString.call(obj);
},
isObject: function(obj) {
return "[object Object]" === Object.prototype.toString.call(obj);
},
isFunction: function(obj) {
return "[object Function]" === Object.prototype.toString.call(obj);
},
isNumber: function(obj) {
return "[object Number]" === Object.prototype.toString.call(obj);
},
isString: function(obj) {
return "[object String]" === Object.prototype.toString.call(obj);
},
isHTMLElement: function(n) {
return window["HTMLElement"] || window["Element"] ? n instanceof (window["HTMLElement"] || window["Element"]) : n && "object" == typeof n && 1 === n.nodeType && "string" == typeof n.nodeName;
},
isSVGElement: function(n) {
return window["SVGElement"] && n instanceof window["SVGElement"];
},
isDefined: function(v) {
return "undefined" != typeof v;
},
random: function(length) {
var str = "", chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", clen = chars.length;
length || (length = 6);
for (var i = 0; i < length; i++) str += chars.charAt(this.randomInt(0, clen - 1));
return str;
},
randomInt: function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
},
inherit: function(child, parent) {
function Ctor() {
this.constructor = child;
}
for (var key in parent) parent.hasOwnProperty(key) && (child[key] = parent[key]);
Ctor.prototype = parent.prototype;
child.prototype = new Ctor();
child.__super__ = parent.prototype;
return child;
},
trim: function(s) {
return s ? s.trim ? s.trim() : s.replace(/^\s+|\s+$/gm, "") : "";
},
trigger: function(el, evt, detail) {
if (el) {
detail = detail || {};
var e, opt = {
bubbles: !0,
cancelable: !0,
detail: detail
};
if ("undefined" != typeof CustomEvent) {
e = new CustomEvent(evt, opt);
el.dispatchEvent(e);
} else try {
e = document.createEvent("CustomEvent");
e.initCustomEvent(evt, !0, !0, detail);
el.dispatchEvent(e);
} catch (exp) {
this.log.error(exp);
}
return !0;
}
this.log.error("emply element passed in");
},
nextTick: function(f) {
("object" == typeof process && process.nextTick ? process.nextTick : function(task) {
setTimeout(task, 0);
})(f);
},
removeFromArray: function(arr, val) {
var index = arr.indexOf(val);
index > -1 && arr.splice(index, 1);
return index;
},
debounce: function(func, wait, immediate) {
var timeout, args, context, timestamp, result, later = function() {
var last = utils.now() - timestamp;
if (last < wait && last >= 0) timeout = setTimeout(later, wait - last); else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
timeout || (context = args = null);
}
}
};
return function() {
context = this;
args = arguments;
timestamp = utils.now();
var callNow = immediate && !timeout;
timeout || (timeout = setTimeout(later, wait));
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
},
throttle: function(func, wait, options) {
var context, args, result, timeout = null, previous = 0;
options || (options = {});
var later = function() {
previous = options.leading === !1 ? 0 : utils.now();
timeout = null;
result = func.apply(context, args);
timeout || (context = args = null);
};
return function() {
var now = utils.now();
previous || options.leading !== !1 || (previous = now);
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
previous = now;
result = func.apply(context, args);
timeout || (context = args = null);
} else timeout || options.trailing === !1 || (timeout = setTimeout(later, remaining));
return result;
};
},
ucfirst: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
escapeHtml: function(text) {
var map = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
return (text + "").replace(/[&<>"']/g, function(m) {
return map[m];
});
}
};
utils.setDebugMode(!1);
return utils;
});
\ No newline at end of file
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/Const", [], function() {
return {
BBRFLAG: {
I: 1,
S: 2
},
ADCODES: {
COUNTRY: 1e5
}
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/geomUtils", [], function() {
function polygonClip(subjectPolygon, clipPolygon) {
var cp1, cp2, s, e, outputList = subjectPolygon;
cp1 = clipPolygon[clipPolygon.length - 2];
for (var j = 0, jlen = clipPolygon.length - 1; j < jlen; j++) {
cp2 = clipPolygon[j];
var inputList = outputList;
outputList = [];
s = inputList[inputList.length - 1];
for (var i = 0, len = inputList.length; i < len; i++) {
e = inputList[i];
if (clipInside(e, cp1, cp2)) {
clipInside(s, cp1, cp2) || outputList.push(clipIntersection(cp1, cp2, s, e));
outputList.push(e);
} else clipInside(s, cp1, cp2) && outputList.push(clipIntersection(cp1, cp2, s, e));
s = e;
}
cp1 = cp2;
}
if (outputList.length < 3) return [];
outputList.push(outputList[0]);
return outputList;
}
function pointOnSegment(p, p1, p2) {
var tx = (p2[1] - p1[1]) / (p2[0] - p1[0]) * (p[0] - p1[0]) + p1[1];
return Math.abs(tx - p[1]) < 1e-6 && p[0] >= p1[0] && p[0] <= p2[0];
}
function pointOnPolygon(point, vs) {
for (var i = 0, len = vs.length; i < len - 1; i++) if (pointOnSegment(point, vs[i], vs[i + 1])) return !0;
return !1;
}
function pointInPolygon(point, vs) {
for (var x = point[0], y = point[1], inside = !1, i = 0, len = vs.length, j = len - 1; i < len; j = i++) {
var xi = vs[i][0], yi = vs[i][1], xj = vs[j][0], yj = vs[j][1], intersect = yi > y != yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
intersect && (inside = !inside);
}
return inside;
}
function getClosestPointOnSegment(p, p1, p2) {
var t, x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y, dot = dx * dx + dy * dy;
if (dot > 0) {
t = ((p[0] - x) * dx + (p[1] - y) * dy) / dot;
if (t > 1) {
x = p2[0];
y = p2[1];
} else if (t > 0) {
x += dx * t;
y += dy * t;
}
}
return [ x, y ];
}
function sqClosestDistanceToSegment(p, p1, p2) {
var p3 = getClosestPointOnSegment(p, p1, p2), dx = p[0] - p3[0], dy = p[1] - p3[1];
return dx * dx + dy * dy;
}
function sqClosestDistanceToPolygon(p, points) {
for (var minSq = Number.MAX_VALUE, i = 0, len = points.length; i < len - 1; i++) {
var sq = sqClosestDistanceToSegment(p, points[i], points[i + 1]);
sq < minSq && (minSq = sq);
}
return minSq;
}
var clipInside = function(p, cp1, cp2) {
return (cp2[0] - cp1[0]) * (p[1] - cp1[1]) > (cp2[1] - cp1[1]) * (p[0] - cp1[0]);
}, clipIntersection = function(cp1, cp2, s, e) {
var dc = [ cp1[0] - cp2[0], cp1[1] - cp2[1] ], dp = [ s[0] - e[0], s[1] - e[1] ], n1 = cp1[0] * cp2[1] - cp1[1] * cp2[0], n2 = s[0] * e[1] - s[1] * e[0], n3 = 1 / (dc[0] * dp[1] - dc[1] * dp[0]);
return [ (n1 * dp[0] - n2 * dc[0]) * n3, (n1 * dp[1] - n2 * dc[1]) * n3 ];
};
return {
sqClosestDistanceToPolygon: sqClosestDistanceToPolygon,
sqClosestDistanceToSegment: sqClosestDistanceToSegment,
pointOnSegment: pointOnSegment,
pointOnPolygon: pointOnPolygon,
pointInPolygon: pointInPolygon,
polygonClip: polygonClip
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/bbIdxBuilder", [ "./Const", "./geomUtils" ], function(Const, geomUtils) {
function parseRanges(ranges, radix) {
for (var nums = [], i = 0, len = ranges.length; i < len; i++) {
var parts = ranges[i].split("-"), start = parts[0], end = parts.length > 1 ? parts[1] : start;
start = parseInt(start, radix);
end = parseInt(end, radix);
for (var j = start; j <= end; j++) nums.push(j);
}
return nums;
}
function add2BBList(bbList, seqIdx, result) {
if (bbList[seqIdx]) throw new Error("Alreay exists: ", bbList[seqIdx]);
bbList[seqIdx] = result;
}
function getFlagI(idx) {
flagIList[idx] || (flagIList[idx] = [ BBRFLAG.I, idx ]);
return flagIList[idx];
}
function parseILine(line, radix, bbList) {
if (line) for (var parts = line.split(":"), fIdx = parseInt(parts[0], radix), bIdxes = parseRanges(parts[1].split(","), radix), item = getFlagI(fIdx), i = 0, len = bIdxes.length; i < len; i++) add2BBList(bbList, bIdxes[i], item);
}
function parseSLine(line, radix, bbList) {
if (line) {
for (var item, parts = line.split(":"), bIdx = parseInt(parts[0], radix), fList = parts[1].split(";"), secList = [], i = 0, len = fList.length; i < len; i++) {
parts = fList[i].split(",");
item = [ parseInt(parts[0], radix), 0 ];
parts.length > 1 && (item[1] = parseInt(parts[1], radix));
secList.push(item);
}
add2BBList(bbList, bIdx, [ BBRFLAG.S, secList ]);
}
}
function parseMaxRect(l, radix) {
if (!l) return null;
for (var parts = l.split(","), rect = [], i = 0, len = parts.length; i < len; i++) {
var n = parseInt(parts[i], radix);
if (n < 0) return null;
rect.push(parseInt(parts[i], radix));
}
return rect;
}
function parseMultiMaxRect(l, radix) {
if (!l) return null;
for (var parts = l.split(";"), rectList = [], i = 0, len = parts.length; i < len; i++) rectList.push(parseMaxRect(parts[i], radix));
return rectList;
}
function buildIdxList(res) {
var i, len, radix = res.r, bbList = [], inList = res.idx.i.split("|");
res.idx.i = null;
for (i = 0, len = inList.length; i < len; i++) parseILine(inList[i], radix, bbList);
inList.length = 0;
var secList = res.idx.s.split("|");
res.idx.s = null;
for (i = 0, len = secList.length; i < len; i++) parseSLine(secList[i], radix, bbList);
secList.length = 0;
res.idx = null;
res.idxList = bbList;
if (res.mxr) {
res.maxRect = parseMaxRect(res.mxr, radix);
res.mxr = null;
}
if (res.mxsr) {
res.maxSubRect = parseMultiMaxRect(res.mxsr, radix);
res.mxsr = null;
}
}
function buildRectFeatureClip(data, rect, ringIdxList) {
for (var features = data.geoData.sub.features, i = 0, len = ringIdxList.length; i < len; i++) {
var idxItem = ringIdxList[i], feature = features[idxItem[0]], ring = feature.geometry.coordinates[idxItem[1]][0], clipedRing = geomUtils.polygonClip(ring, rect);
!clipedRing || clipedRing.length < 4 ? console.warn("Cliped ring length werid: " + clipedRing) : idxItem[2] = clipedRing;
}
return !0;
}
function prepareGridFeatureClip(data, x, y) {
var bbIdx = data.bbIndex, step = bbIdx.s;
(x < 0 || y < 0 || y >= bbIdx.h || x >= bbIdx.w) && console.warn("Wrong x,y", x, y, bbIdx);
var seqIdx = y * bbIdx.w + x, idxItem = bbIdx.idxList[seqIdx];
if (idxItem[0] !== BBRFLAG.S) return !1;
var ringIdxList = idxItem[1];
if (ringIdxList[0].length > 2) return !1;
var rectX = x * step + bbIdx.l, rectY = y * step + bbIdx.t;
buildRectFeatureClip(data, [ [ rectX, rectY ], [ rectX + step, rectY ], [ rectX + step, rectY + step ], [ rectX, rectY + step ], [ rectX, rectY ] ], ringIdxList);
return !0;
}
var BBRFLAG = Const.BBRFLAG, flagIList = [];
return {
prepareGridFeatureClip: prepareGridFeatureClip,
buildIdxList: buildIdxList
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/BoundsItem", [ "lib/utils" ], function(utils) {
function BoundsItem(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
utils.extend(BoundsItem, {
getBoundsItemToExpand: function() {
return new BoundsItem(Number.MAX_VALUE, Number.MAX_VALUE, -1, -1);
},
boundsContainPoint: function(b, p) {
return b.x <= p.x && b.x + b.width >= p.x && b.y <= p.y && b.y + b.height >= p.y;
},
boundsContain: function(b1, b2) {
return b1.x <= b2.x && b1.x + b1.width >= b2.x + b2.width && b1.y <= b2.y && b1.y + b1.height >= b2.y + b2.height;
},
boundsIntersect: function(b1, b2) {
return b1.x <= b2.x + b2.width && b2.x <= b1.x + b1.width && b1.y <= b2.y + b2.height && b2.y <= b1.y + b1.height;
}
});
utils.extend(BoundsItem.prototype, {
containBounds: function(b) {
return BoundsItem.boundsContain(this, b);
},
containPoint: function(p) {
return BoundsItem.boundsContainPoint(this, p);
},
clone: function() {
return new BoundsItem(this.x, this.y, this.width, this.height);
},
isEmpty: function() {
return this.width < 0;
},
getMin: function() {
return {
x: this.x,
y: this.y
};
},
getMax: function() {
return {
x: this.x + this.width,
y: this.y + this.height
};
},
expandByPoint: function(x, y) {
var minX, minY, maxX, maxY;
if (this.isEmpty()) {
minX = maxX = x;
minY = maxY = y;
} else {
minX = this.x;
minY = this.y;
maxX = this.x + this.width;
maxY = this.y + this.height;
x < minX ? minX = x : x > maxX && (maxX = x);
y < minY ? minY = y : y > maxY && (maxY = y);
}
this.x = minX;
this.y = minY;
this.width = maxX - minX;
this.height = maxY - minY;
},
expandByBounds: function(bounds) {
if (!bounds.isEmpty()) {
var minX = this.x, minY = this.y, maxX = this.x + this.width, maxY = this.y + this.height, newMinX = bounds.x, newMaxX = bounds.x + bounds.width, newMinY = bounds.y, newMaxY = bounds.y + bounds.height;
if (this.isEmpty()) {
minX = newMinX;
minY = newMinY;
maxX = newMaxX;
maxY = newMaxY;
} else {
newMinX < minX && (minX = newMinX);
newMaxX > maxX && (maxX = newMaxX);
newMinY < minY && (minY = newMinY);
newMaxY > maxY && (maxY = newMaxY);
}
this.x = minX;
this.y = minY;
this.width = maxX - minX;
this.height = maxY - minY;
}
},
getTopLeft: function() {
return {
x: this.x,
y: this.y
};
},
getTopRight: function() {
return {
x: this.x + this.width,
y: this.y
};
},
getBottomLeft: function() {
return {
x: this.x,
y: this.y + this.height
};
},
getBottomRight: function() {
return {
x: this.x + this.width,
y: this.y + this.height
};
}
});
return BoundsItem;
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/ext/topojson-client", [ "exports" ], function(exports) {
"use strict";
function feature$1(topology, o) {
var id = o.id, bbox = o.bbox, properties = null == o.properties ? {} : o.properties, geometry = object(topology, o);
return null == id && null == bbox ? {
type: "Feature",
properties: properties,
geometry: geometry
} : null == bbox ? {
type: "Feature",
id: id,
properties: properties,
geometry: geometry
} : {
type: "Feature",
id: id,
bbox: bbox,
properties: properties,
geometry: geometry
};
}
function object(topology, o) {
function arc(i, points) {
points.length && points.pop();
for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) points.push(transformPoint(a[k], k));
i < 0 && reverse(points, n);
}
function point(p) {
return transformPoint(p);
}
function line(arcs) {
for (var points = [], i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);
points.length < 2 && points.push(points[0]);
return points;
}
function ring(arcs) {
for (var points = line(arcs); points.length < 4; ) points.push(points[0]);
return points;
}
function polygon(arcs) {
return arcs.map(ring);
}
function geometry(o) {
var coordinates, type = o.type;
switch (type) {
case "GeometryCollection":
return {
type: type,
geometries: o.geometries.map(geometry)
};
case "Point":
coordinates = point(o.coordinates);
break;
case "MultiPoint":
coordinates = o.coordinates.map(point);
break;
case "LineString":
coordinates = line(o.arcs);
break;
case "MultiLineString":
coordinates = o.arcs.map(line);
break;
case "Polygon":
coordinates = polygon(o.arcs);
break;
case "MultiPolygon":
coordinates = o.arcs.map(polygon);
break;
default:
return null;
}
return {
type: type,
coordinates: coordinates
};
}
var transformPoint = transform(topology.transform), arcs = topology.arcs;
return geometry(o);
}
function meshArcs(topology, object$$1, filter) {
var arcs, i, n;
if (arguments.length > 1) arcs = extractArcs(topology, object$$1, filter); else for (i = 0,
arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;
return {
type: "MultiLineString",
arcs: stitch(topology, arcs)
};
}
function extractArcs(topology, object$$1, filter) {
function extract0(i) {
var j = i < 0 ? ~i : i;
(geomsByArc[j] || (geomsByArc[j] = [])).push({
i: i,
g: geom
});
}
function extract1(arcs) {
arcs.forEach(extract0);
}
function extract2(arcs) {
arcs.forEach(extract1);
}
function extract3(arcs) {
arcs.forEach(extract2);
}
function geometry(o) {
switch (geom = o, o.type) {
case "GeometryCollection":
o.geometries.forEach(geometry);
break;
case "LineString":
extract1(o.arcs);
break;
case "MultiLineString":
case "Polygon":
extract2(o.arcs);
break;
case "MultiPolygon":
extract3(o.arcs);
}
}
var geom, arcs = [], geomsByArc = [];
geometry(object$$1);
geomsByArc.forEach(null == filter ? function(geoms) {
arcs.push(geoms[0].i);
} : function(geoms) {
filter(geoms[0].g, geoms[geoms.length - 1].g) && arcs.push(geoms[0].i);
});
return arcs;
}
function planarRingArea(ring) {
for (var a, i = -1, n = ring.length, b = ring[n - 1], area = 0; ++i < n; ) a = b,
b = ring[i], area += a[0] * b[1] - a[1] * b[0];
return Math.abs(area);
}
function mergeArcs(topology, objects) {
function geometry(o) {
switch (o.type) {
case "GeometryCollection":
o.geometries.forEach(geometry);
break;
case "Polygon":
extract(o.arcs);
break;
case "MultiPolygon":
o.arcs.forEach(extract);
}
}
function extract(polygon) {
polygon.forEach(function(ring) {
ring.forEach(function(arc) {
(polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);
});
});
polygons.push(polygon);
}
function area(ring) {
return planarRingArea(object(topology, {
type: "Polygon",
arcs: [ ring ]
}).coordinates[0]);
}
var polygonsByArc = {}, polygons = [], groups = [];
objects.forEach(geometry);
polygons.forEach(function(polygon) {
if (!polygon._) {
var group = [], neighbors = [ polygon ];
polygon._ = 1;
groups.push(group);
for (;polygon = neighbors.pop(); ) {
group.push(polygon);
polygon.forEach(function(ring) {
ring.forEach(function(arc) {
polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {
if (!polygon._) {
polygon._ = 1;
neighbors.push(polygon);
}
});
});
});
}
}
});
polygons.forEach(function(polygon) {
delete polygon._;
});
return {
type: "MultiPolygon",
arcs: groups.map(function(polygons) {
var n, arcs = [];
polygons.forEach(function(polygon) {
polygon.forEach(function(ring) {
ring.forEach(function(arc) {
polygonsByArc[arc < 0 ? ~arc : arc].length < 2 && arcs.push(arc);
});
});
});
arcs = stitch(topology, arcs);
if ((n = arcs.length) > 1) for (var ki, t, i = 1, k = area(arcs[0]); i < n; ++i) (ki = area(arcs[i])) > k && (t = arcs[0],
arcs[0] = arcs[i], arcs[i] = t, k = ki);
return arcs;
})
};
}
var identity = function(x) {
return x;
}, transform = function(transform) {
if (null == transform) return identity;
var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1];
return function(input, i) {
i || (x0 = y0 = 0);
var j = 2, n = input.length, output = new Array(n);
output[0] = (x0 += input[0]) * kx + dx;
output[1] = (y0 += input[1]) * ky + dy;
for (;j < n; ) output[j] = input[j], ++j;
return output;
};
}, bbox = function(topology) {
function bboxPoint(p) {
p = t(p);
p[0] < x0 && (x0 = p[0]);
p[0] > x1 && (x1 = p[0]);
p[1] < y0 && (y0 = p[1]);
p[1] > y1 && (y1 = p[1]);
}
function bboxGeometry(o) {
switch (o.type) {
case "GeometryCollection":
o.geometries.forEach(bboxGeometry);
break;
case "Point":
bboxPoint(o.coordinates);
break;
case "MultiPoint":
o.coordinates.forEach(bboxPoint);
}
}
var key, t = transform(topology.transform), x0 = 1 / 0, y0 = x0, x1 = -x0, y1 = -x0;
topology.arcs.forEach(function(arc) {
for (var p, i = -1, n = arc.length; ++i < n; ) {
p = t(arc[i], i);
p[0] < x0 && (x0 = p[0]);
p[0] > x1 && (x1 = p[0]);
p[1] < y0 && (y0 = p[1]);
p[1] > y1 && (y1 = p[1]);
}
});
for (key in topology.objects) bboxGeometry(topology.objects[key]);
return [ x0, y0, x1, y1 ];
}, reverse = function(array, n) {
for (var t, j = array.length, i = j - n; i < --j; ) t = array[i], array[i++] = array[j],
array[j] = t;
}, feature = function(topology, o) {
return "GeometryCollection" === o.type ? {
type: "FeatureCollection",
features: o.geometries.map(function(o) {
return feature$1(topology, o);
})
} : feature$1(topology, o);
}, stitch = function(topology, arcs) {
function ends(i) {
var p1, arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0];
topology.transform ? (p1 = [ 0, 0 ], arc.forEach(function(dp) {
p1[0] += dp[0], p1[1] += dp[1];
})) : p1 = arc[arc.length - 1];
return i < 0 ? [ p1, p0 ] : [ p0, p1 ];
}
function flush(fragmentByEnd, fragmentByStart) {
for (var k in fragmentByEnd) {
var f = fragmentByEnd[k];
delete fragmentByStart[f.start];
delete f.start;
delete f.end;
f.forEach(function(i) {
stitchedArcs[i < 0 ? ~i : i] = 1;
});
fragments.push(f);
}
}
var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1;
arcs.forEach(function(i, j) {
var t, arc = topology.arcs[i < 0 ? ~i : i];
arc.length < 3 && !arc[1][0] && !arc[1][1] && (t = arcs[++emptyIndex], arcs[emptyIndex] = i,
arcs[j] = t);
});
arcs.forEach(function(i) {
var f, g, e = ends(i), start = e[0], end = e[1];
if (f = fragmentByEnd[start]) {
delete fragmentByEnd[f.end];
f.push(i);
f.end = end;
if (g = fragmentByStart[end]) {
delete fragmentByStart[g.start];
var fg = g === f ? f : f.concat(g);
fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;
} else fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
} else if (f = fragmentByStart[end]) {
delete fragmentByStart[f.start];
f.unshift(i);
f.start = start;
if (g = fragmentByEnd[start]) {
delete fragmentByEnd[g.end];
var gf = g === f ? f : g.concat(f);
fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;
} else fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
} else {
f = [ i ];
fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;
}
});
flush(fragmentByEnd, fragmentByStart);
flush(fragmentByStart, fragmentByEnd);
arcs.forEach(function(i) {
stitchedArcs[i < 0 ? ~i : i] || fragments.push([ i ]);
});
return fragments;
}, mesh = function(topology) {
return object(topology, meshArcs.apply(this, arguments));
}, merge = function(topology) {
return object(topology, mergeArcs.apply(this, arguments));
}, bisect = function(a, x) {
for (var lo = 0, hi = a.length; lo < hi; ) {
var mid = lo + hi >>> 1;
a[mid] < x ? lo = mid + 1 : hi = mid;
}
return lo;
}, neighbors = function(objects) {
function line(arcs, i) {
arcs.forEach(function(a) {
a < 0 && (a = ~a);
var o = indexesByArc[a];
o ? o.push(i) : indexesByArc[a] = [ i ];
});
}
function polygon(arcs, i) {
arcs.forEach(function(arc) {
line(arc, i);
});
}
function geometry(o, i) {
"GeometryCollection" === o.type ? o.geometries.forEach(function(o) {
geometry(o, i);
}) : o.type in geometryType && geometryType[o.type](o.arcs, i);
}
var indexesByArc = {}, neighbors = objects.map(function() {
return [];
}), geometryType = {
LineString: line,
MultiLineString: polygon,
Polygon: polygon,
MultiPolygon: function(arcs, i) {
arcs.forEach(function(arc) {
polygon(arc, i);
});
}
};
objects.forEach(geometry);
for (var i in indexesByArc) for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) for (var k = j + 1; k < m; ++k) {
var n, ij = indexes[j], ik = indexes[k];
(n = neighbors[ij])[i = bisect(n, ik)] !== ik && n.splice(i, 0, ik);
(n = neighbors[ik])[i = bisect(n, ij)] !== ij && n.splice(i, 0, ij);
}
return neighbors;
}, untransform = function(transform) {
if (null == transform) return identity;
var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1];
return function(input, i) {
i || (x0 = y0 = 0);
var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky);
output[0] = x1 - x0, x0 = x1;
output[1] = y1 - y0, y0 = y1;
for (;j < n; ) output[j] = input[j], ++j;
return output;
};
}, quantize = function(topology, transform) {
function quantizePoint(point) {
return t(point);
}
function quantizeGeometry(input) {
var output;
switch (input.type) {
case "GeometryCollection":
output = {
type: "GeometryCollection",
geometries: input.geometries.map(quantizeGeometry)
};
break;
case "Point":
output = {
type: "Point",
coordinates: quantizePoint(input.coordinates)
};
break;
case "MultiPoint":
output = {
type: "MultiPoint",
coordinates: input.coordinates.map(quantizePoint)
};
break;
default:
return input;
}
null != input.id && (output.id = input.id);
null != input.bbox && (output.bbox = input.bbox);
null != input.properties && (output.properties = input.properties);
return output;
}
function quantizeArc(input) {
var p, i = 0, j = 1, n = input.length, output = new Array(n);
output[0] = t(input[0], 0);
for (;++i < n; ) ((p = t(input[i], i))[0] || p[1]) && (output[j++] = p);
1 === j && (output[j++] = [ 0, 0 ]);
output.length = j;
return output;
}
if (topology.transform) throw new Error("already quantized");
if (transform && transform.scale) box = topology.bbox; else {
if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be ≥2");
box = topology.bbox || bbox(topology);
var n, x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3];
transform = {
scale: [ x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1 ],
translate: [ x0, y0 ]
};
}
var box, key, t = untransform(transform), inputs = topology.objects, outputs = {};
for (key in inputs) outputs[key] = quantizeGeometry(inputs[key]);
return {
type: "Topology",
bbox: box,
transform: transform,
objects: outputs,
arcs: topology.arcs.map(quantizeArc)
};
};
exports.bbox = bbox;
exports.feature = feature;
exports.mesh = mesh;
exports.meshArcs = meshArcs;
exports.merge = merge;
exports.mergeArcs = mergeArcs;
exports.neighbors = neighbors;
exports.quantize = quantize;
exports.transform = transform;
exports.untransform = untransform;
Object.defineProperty(exports, "__esModule", {
value: !0
});
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/distDataParser", [ "./bbIdxBuilder", "./BoundsItem", "../ext/topojson-client" ], function(bbIdxBuilder, BoundsItem, topojson) {
function parseTopo(topo) {
var result = {}, objects = topo.objects;
for (var k in objects) objects.hasOwnProperty(k) && (result[k] = topojson.feature(topo, objects[k]));
return result;
}
function filterSub(geoData) {
for (var features = geoData.sub ? geoData.sub.features : [], parentProps = geoData.parent.properties, subAcroutes = (parentProps.acroutes || []).concat([ parentProps.adcode ]), i = 0, len = features.length; i < len; i++) {
features[i].properties.subFeatureIndex = i;
features[i].properties.acroutes = subAcroutes;
}
}
function buildData(data) {
if (!data._isBuiled) {
bbIdxBuilder.buildIdxList(data.bbIndex);
data.geoData = parseTopo(data.topo);
data.geoData.sub && filterSub(data.geoData);
var bbox = data.topo.bbox;
data.bounds = new BoundsItem(bbox[0], bbox[1], bbox[2] - bbox[0], bbox[3] - bbox[1]);
data.topo = null;
data._isBuiled = !0;
}
return data;
}
return {
buildData: buildData
};
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/lib/AreaNode", [ "lib/utils", "lib/SphericalMercator", "./Const", "./geomUtils", "./bbIdxBuilder" ], function(utils, SphericalMercator, Const, geomUtils, bbIdxBuilder) {
function AreaNode(adcode, data, opts) {
this.adcode = adcode;
this._data = data;
this._sqScaleFactor = data.scale * data.scale;
this._opts = utils.extend({
nearTolerance: 2
}, opts);
this.setNearTolerance(this._opts.nearTolerance);
}
var staticMethods = {
getPropsOfFeature: function(f) {
return f && f.properties ? f.properties : null;
},
getAdcodeOfFeature: function(f) {
return f ? f.properties.adcode : null;
},
doesFeatureHasChildren: function(f) {
return !!f && f.properties.childrenNum > 0;
}
};
utils.extend(AreaNode, staticMethods);
utils.extend(AreaNode.prototype, staticMethods, {
setNearTolerance: function(t) {
this._opts.nearTolerance = t;
this._sqNearTolerance = t * t;
},
getIdealZoom: function() {
return this._data.idealZoom;
},
_getEmptySubFeatureGroupItem: function(idx) {
return {
subFeatureIndex: idx,
subFeature: this.getSubFeatureByIndex(idx),
pointsIndexes: [],
points: []
};
},
groupByPosition: function(points, getPosition) {
var i, len, groupMap = {}, outsideItem = null;
for (i = 0, len = points.length; i < len; i++) {
var idx = this.getLocatedSubFeatureIndex(getPosition.call(null, points[i], i));
groupMap[idx] || (groupMap[idx] = this._getEmptySubFeatureGroupItem(idx));
groupMap[idx].pointsIndexes.push(i);
groupMap[idx].points.push(points[i]);
idx < 0 && (outsideItem = groupMap[idx]);
}
var groupList = [];
if (this._data.geoData.sub) for (i = 0, len = this._data.geoData.sub.features.length; i < len; i++) groupList.push(groupMap[i] || this._getEmptySubFeatureGroupItem(i));
outsideItem && groupList.push(outsideItem);
groupMap = null;
return groupList;
},
getLocatedSubFeature: function(lngLat) {
var fIdx = this.getLocatedSubFeatureIndex(lngLat);
return this.getSubFeatureByIndex(fIdx);
},
getLocatedSubFeatureIndex: function(lngLat) {
return this._getLocatedSubFeatureIndexByPixel(this.lngLatToPixel(lngLat, this._data.pz));
},
getSubFeatureByIndex: function(fIdx) {
if (fIdx >= 0) {
var features = this.getSubFeatures();
return features[fIdx];
}
return null;
},
getSubFeatureByAdcode: function(adcode) {
adcode = parseInt(adcode, 10);
for (var features = this.getSubFeatures(), i = 0, len = features.length; i < len; i++) if (this.getAdcodeOfFeature(features[i]) === adcode) return features[i];
return null;
},
_getLocatedSubFeatureIndexByPixel: function(pixel) {
if (!this._data.geoData.sub) return -1;
var data = this._data, bbIdx = data.bbIndex, offX = pixel[0] - bbIdx.l, offY = pixel[1] - bbIdx.t, y = Math.floor(offY / bbIdx.s), x = Math.floor(offX / bbIdx.s);
if (x < 0 || y < 0 || y >= bbIdx.h || x >= bbIdx.w) return -1;
var seqIdx = y * bbIdx.w + x, idxItem = bbIdx.idxList[seqIdx];
if (!idxItem) return -1;
var BBRFLAG = Const.BBRFLAG;
switch (idxItem[0]) {
case BBRFLAG.I:
return idxItem[1];
case BBRFLAG.S:
bbIdxBuilder.prepareGridFeatureClip(data, x, y, idxItem[1]);
return this._calcLocatedFeatureIndexOfSList(pixel, idxItem[1]);
default:
throw new Error("Unknown BBRFLAG: " + idxItem[0]);
}
},
_calcNearestFeatureIndexOfSList: function(pixel, list) {
var features = [];
this._data.geoData.sub && (features = this._data.geoData.sub.features);
for (var closest = {
sq: Number.MAX_VALUE,
idx: -1
}, i = 0, len = list.length; i < len; i++) {
var idxItem = list[i], feature = features[idxItem[0]], ring = idxItem[2] || feature.geometry.coordinates[idxItem[1]][0], sqDistance = geomUtils.sqClosestDistanceToPolygon(pixel, ring);
if (sqDistance < closest.sq) {
closest.sq = sqDistance;
closest.idx = idxItem[0];
}
}
return closest.sq / this._sqScaleFactor < this._sqNearTolerance ? closest.idx : -1;
},
_calcLocatedFeatureIndexOfSList: function(pixel, list) {
for (var features = this._data.geoData.sub.features, i = 0, len = list.length; i < len; i++) {
var idxItem = list[i], feature = features[idxItem[0]], ring = idxItem[2] || feature.geometry.coordinates[idxItem[1]][0];
if (geomUtils.pointInPolygon(pixel, ring) || geomUtils.pointOnPolygon(pixel, ring)) return idxItem[0];
}
return this._calcNearestFeatureIndexOfSList(pixel, list);
},
pixelToLngLat: function(x, y) {
return SphericalMercator.pointToLngLat([ x, y ], this._data.pz);
},
lngLatToPixel: function(lngLat) {
lngLat instanceof AMap.LngLat && (lngLat = [ lngLat.getLng(), lngLat.getLat() ]);
var pMx = SphericalMercator.lngLatToPoint(lngLat, this._data.pz);
return [ Math.round(pMx[0]), Math.round(pMx[1]) ];
},
_convertRingCoordsToLngLats: function(ring) {
for (var list = [], i = 0, len = ring.length; i < len; i++) list[i] = this.pixelToLngLat(ring[i][0], ring[i][1]);
return list;
},
_convertPolygonCoordsToLngLats: function(poly) {
for (var list = [], i = 0, len = poly.length; i < len; i++) list[i] = this._convertRingCoordsToLngLats(poly[i]);
return list;
},
_convertMultiPolygonCoordsToLngLats: function(polys) {
for (var list = [], i = 0, len = polys.length; i < len; i++) list[i] = this._convertPolygonCoordsToLngLats(polys[i]);
return list;
},
_convertCoordsToLngLats: function(type, coordinates) {
switch (type) {
case "MultiPolygon":
return this._convertMultiPolygonCoordsToLngLats(coordinates);
default:
throw new Error("Unknown type", type);
}
},
_createLngLatFeature: function(f, extraProps) {
var newNode = utils.extend({}, f);
extraProps && utils.extend(newNode.properties, extraProps);
newNode.geometry = utils.extend({}, newNode.geometry);
newNode.geometry.coordinates = this._convertCoordsToLngLats(newNode.geometry.type, newNode.geometry.coordinates);
return newNode;
},
getAdcode: function() {
return this.getProps("adcode");
},
getName: function() {
return this.getProps("name");
},
getChildrenNum: function() {
return this.getProps("childrenNum");
},
getProps: function(key) {
var props = AreaNode.getPropsOfFeature(this._data.geoData.parent);
return props ? key ? props[key] : props : null;
},
getParentFeature: function() {
var geoData = this._data.geoData;
geoData.lngLatParent || (geoData.lngLatParent = this._createLngLatFeature(geoData.parent));
return geoData.lngLatParent;
},
getParentFeatureInPixel: function() {
return this._data.geoData.parent;
},
getSubFeatures: function() {
var geoData = this._data.geoData;
if (!geoData.sub) return [];
if (!geoData.lngLatSubList) {
for (var features = geoData.sub.features, newFList = [], i = 0, len = features.length; i < len; i++) newFList[i] = this._createLngLatFeature(features[i]);
geoData.lngLatSubList = newFList;
}
return [].concat(geoData.lngLatSubList);
},
getSubFeaturesInPixel: function() {
return this._data.geoData.sub ? [].concat(this._data.geoData.sub.features) : [];
},
getBounds: function() {
var data = this._data;
if (!data.lngLatBounds) {
var nodeBounds = this._data.bounds;
data.lngLatBounds = new AMap.Bounds(this.pixelToLngLat(nodeBounds.x, nodeBounds.y + nodeBounds.height), this.pixelToLngLat(nodeBounds.x + nodeBounds.width, nodeBounds.y));
}
return data.lngLatBounds;
}
});
return AreaNode;
});
AMapUI.weakDefine("ui/geo/DistrictExplorer/main", [ "require", "lib/event", "lib/utils", "./lib/Const", "./lib/distDataParser", "./lib/AreaNode" ], function(require, EventCls, utils, Const, distDataParser, AreaNode) {
function DistrictExplorer(opts) {
this._opts = utils.extend({
distDataLoc: "./assets/d_v2",
eventSupport: !1,
keepFeaturePolygonReference: !0,
mouseEventNames: [ "click" ],
mousemoveDebounceWait: -1
}, opts);
DistrictExplorer.__super__.constructor.call(this, this._opts);
this._hoverFeature = null;
this._areaNodesForLocating = null;
this._areaNodeCache = globalAreaNodeCache;
this._renderedPolygons = [];
this._opts.preload && this.loadMultiAreaNodes(this._opts.preload);
this._debouncedHandleMousemove = this._opts.mousemoveDebounceWait > 1 ? utils.debounce(this._handleMousemove, this._opts.mousemoveDebounceWait) : this._handleMousemove;
this._opts.map && this._opts.eventSupport && this._bindMapEvents(!0);
}
var globalAreaNodeCache = {};
utils.inherit(DistrictExplorer, EventCls);
utils.extend(DistrictExplorer.prototype, {
setAreaNodesForLocating: function(areaNodes) {
areaNodes ? utils.isArray(areaNodes) || (areaNodes = [ areaNodes ]) : areaNodes = [];
this._areaNodesForLocating = areaNodes || [];
},
getLocatedSubFeature: function(position) {
var areaNodes = this._areaNodesForLocating;
if (!areaNodes) return null;
for (var i = 0, len = areaNodes.length; i < len; i++) {
var feature = areaNodes[i].getLocatedSubFeature(position);
if (feature) return feature;
}
return null;
},
setMap: function(map) {
var oldMap = this._opts.map;
if (oldMap !== map) {
this.offMapEvents();
this._opts.map = map;
this._opts.map && this._opts.eventSupport && this._bindMapEvents(!0);
}
},
offMapEvents: function() {
this._bindMapEvents(!1);
},
_bindMapEvents: function(on) {
for (var map = this._opts.map, action = on ? "on" : "off", mouseEventNames = this._opts.mouseEventNames, i = 0, len = mouseEventNames.length; i < len; i++) map[action](mouseEventNames[i], this._handleMouseEvent, this);
AMap.UA.mobile || map[action]("mousemove", this._debouncedHandleMousemove, this);
},
_handleMouseEvent: function(e) {
var feature = this.getLocatedSubFeature(e.lnglat);
this.triggerWithOriginalEvent((feature ? "feature" : "outside") + utils.ucfirst(e.type), e, feature);
},
_handleMousemove: function(e) {
var feature = this.getLocatedSubFeature(e.lnglat);
this.setHoverFeature(feature, e);
feature && this.triggerWithOriginalEvent("featureMousemove", e, feature);
},
setHoverFeature: function(feature, e) {
var oldHoverFeature = this._hoverFeature;
if (feature !== oldHoverFeature) {
oldHoverFeature && this.triggerWithOriginalEvent("featureMouseout", e, oldHoverFeature);
this._hoverFeature = feature;
feature && this.triggerWithOriginalEvent("featureMouseover", e, feature, oldHoverFeature);
this.triggerWithOriginalEvent("hoverFeatureChanged", e, feature, oldHoverFeature);
}
},
_loadJson: function(src, callback) {
var self = this;
return require([ "json!" + src ], function(data) {
callback && callback.call(self, null, data);
}, function(error) {
if (!callback) throw error;
callback(error);
});
},
_getAreaNodeDataFileName: function(adcode) {
return "an_" + adcode + ".json";
},
_getAreaNodeDataSrc: function(adcode) {
return this._opts.distDataLoc + "/" + this._getAreaNodeDataFileName(adcode);
},
_isAreaNodeJsonId: function(id, adcode) {
return id.indexOf(!1) && id.indexOf(this._getAreaNodeDataFileName(adcode)) > 0;
},
_undefAreaNodeJson: function(adcode) {
var id = AMapUI.findDefinedId(function(id) {
return this._isAreaNodeJsonId(id, adcode);
}, this);
if (id) {
AMapUI.require.undef(id);
return !0;
}
return !1;
},
loadAreaTree: function(callback) {
this._loadJson(this._opts.distDataLoc + "/area_tree.json", callback);
},
loadCountryNode: function(callback) {
this.loadAreaNode(Const.ADCODES.COUNTRY, callback);
},
loadMultiAreaNodes: function(adcodes, callback) {
function buildCallback(i) {
return function(error, areaNode) {
if (!done) {
left--;
if (error) {
callback && callback(error);
done = !0;
} else {
results[i] = areaNode;
0 === left && callback && callback(null, results);
}
}
};
}
if (adcodes && adcodes.length) for (var len = adcodes.length, left = len, results = [], done = !1, i = 0; i < len; i++) this.loadAreaNode(adcodes[i], callback ? buildCallback(i) : null); else callback && callback(null, []);
},
loadAreaNode: function(adcode, callback, thisArg, canSync) {
thisArg = thisArg || this;
if (this._areaNodeCache[adcode]) {
if (callback) {
var areaNode = this._areaNodeCache[adcode];
canSync ? callback.call(thisArg, null, areaNode, !0) : setTimeout(function() {
callback.call(thisArg, null, areaNode);
}, 0);
}
} else this._loadJson(this._getAreaNodeDataSrc(adcode), function(err, data) {
if (err) callback && callback.call(thisArg, err); else {
this._buildAreaNode(adcode, data);
callback && callback.call(thisArg, null, this._areaNodeCache[adcode]);
}
});
},
getLocalAreaNode: function(adcode) {
return this._areaNodeCache[adcode] || null;
},
locatePosition: function(lngLat, callback, opts) {
opts = utils.extend({
levelLimit: 10
}, opts);
var parentNode = opts.parentNode;
parentNode ? this._routeLocate(lngLat, parentNode, [], callback, opts) : this.loadCountryNode(function(err, countryNode) {
err ? callback && callback(err) : this._routeLocate(lngLat, countryNode, [], callback, opts);
});
},
_routeLocate: function(lngLat, parentNode, routes, callback, opts) {
var subFeature = parentNode.getLocatedSubFeature(lngLat), gotChildren = !1;
if (subFeature) {
routes.pop();
routes.push(parentNode.getParentFeature());
routes.push(subFeature);
gotChildren = parentNode.doesFeatureHasChildren(subFeature);
}
gotChildren && routes.length < opts.levelLimit ? this.loadAreaNode(parentNode.getAdcodeOfFeature(subFeature), function(err, subNode) {
err ? callback && callback(err) : this._routeLocate(lngLat, subNode, routes, callback, opts);
}) : callback && callback.call(this, null, routes.slice(0, opts.levelLimit));
},
_buildAreaNode: function(adcode, distData) {
if (!this._areaNodeCache[adcode]) {
if (!distData) throw new Error("Empty distData: " + adcode);
var areaNode = new AreaNode(adcode, distDataParser.buildData(distData), this._opts);
this._areaNodeCache[adcode] = areaNode;
this._areaNodesForLocating || (this._areaNodesForLocating = [ areaNode ]);
}
},
_renderMultiPolygon: function(coords, styleOptions, attchedData) {
for (var polygons = [], i = 0, len = coords.length; i < len; i++) styleOptions && polygons.push(this._renderPolygon(coords[i], styleOptions[i] || styleOptions, attchedData));
return polygons;
},
_renderPolygon: function(coords, styleOptions, attchedData) {
if (!styleOptions) return null;
var polygon = new AMap.Polygon(utils.extend({
bubble: !0,
lineJoin: "round",
map: this._opts.map
}, styleOptions, {
path: coords
}));
attchedData && (polygon._attched = attchedData);
this._opts.keepFeaturePolygonReference && this._renderedPolygons.push(polygon);
return polygon;
},
getAdcodeOfFeaturePolygon: function(polygon) {
return polygon._attched ? polygon._attched.adcode : null;
},
findFeaturePolygonsByAdcode: function(adcode) {
var list = this._renderedPolygons, polys = [];
adcode = parseInt(adcode, 10);
for (var i = 0, len = list.length; i < len; i++) this.getAdcodeOfFeaturePolygon(list[i]) === adcode && polys.push(list[i]);
return polys;
},
getAllFeaturePolygons: function() {
return this._renderedPolygons;
},
clearFeaturePolygons: function() {
for (var list = this._renderedPolygons, i = 0, len = list.length; i < len; i++) list[i].setMap(null);
list.length = 0;
},
removeFeaturePolygonsByAdcode: function(adcode) {
this.removeFeaturePolygons(this.findFeaturePolygonsByAdcode(adcode));
},
removeFeaturePolygons: function(polygons) {
for (var list = this._renderedPolygons, i = 0, len = list.length; i < len; i++) if (polygons.indexOf(list[i]) >= 0) {
list[i].setMap(null);
list.splice(i, 1);
i--;
len--;
}
},
clearAreaNodeCacheByAdcode: function(adcode) {
var nodeCache = this._areaNodeCache;
if (this._undefAreaNodeJson(adcode)) {
delete nodeCache[adcode];
return !0;
}
console.warn("Failed undef: ", adcode);
return !1;
},
clearAreaNodeCache: function(match) {
if (match) return this.clearAreaNodeCacheByAdcode(match);
var nodeCache = this._areaNodeCache;
for (var adcode in nodeCache) nodeCache.hasOwnProperty(adcode) && this.clearAreaNodeCacheByAdcode(adcode);
},
renderFeature: function(feature, styleOptions) {
if (!styleOptions) return null;
var geometry = feature.geometry;
if (!geometry) return null;
var coords = geometry.coordinates, attchedData = feature.properties, results = [];
switch (geometry.type) {
case "MultiPolygon":
results = this._renderMultiPolygon(coords, styleOptions, attchedData);
break;
case "Polygon":
results = [ this._renderPolygon(coords, styleOptions, attchedData) ];
break;
default:
throw new Error("Unknow geometry: " + geometry.type);
}
return results;
},
renderSubFeatures: function(areaNode, subStyleOption) {
for (var features = areaNode.getSubFeatures(), isSubStyleFunc = utils.isFunction(subStyleOption), results = [], i = 0, len = features.length; i < len; i++) {
var feature = features[i];
results.push(this.renderFeature(feature, isSubStyleFunc ? subStyleOption.call(this, feature, i) : subStyleOption));
}
return results;
},
renderParentFeature: function(areaNode, parentStyleOption) {
return this.renderFeature(areaNode.getParentFeature(), parentStyleOption);
}
});
return DistrictExplorer;
});
AMapUI.weakDefine("ui/geo/DistrictExplorer", [ "ui/geo/DistrictExplorer/main" ], function(m) {
return m;
});
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
localStorage.clear();
window.offlineMap = {
}
var scripts = document.getElementsByTagName("script");
var curScript = scripts[scripts.length - 1].getAttribute("src");
offlineMap.baseUrl = curScript.substr(0, curScript.lastIndexOf("/")+1);
offlineMap.domain = offlineMap.baseUrl.substr(offlineMap.baseUrl.indexOf("://"), offlineMap.baseUrl.length);
document.write('<script type="text/javascript" src="' + offlineMap.baseUrl + 'js/amap.1.4.6.js?rnd= ' + Math.random() + '"></script>');
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -126,11 +126,9 @@ export const FscSerUrl = { ...@@ -126,11 +126,9 @@ export const FscSerUrl = {
export const FasSerUrl = { export const FasSerUrl = {
//====================================新加 //====================================新加
regionSelectUrl: completePrefix(baseURI, 'safeuser/save/curCompany'), //保存登录用户信息 regionSelectUrl: completePrefix(baseURI, 'safeuser/save/curCompany'), //保存登录用户信息
selectedOrgInfoUrl: completePrefix(baseURI, 'api/region/current'),//获取选择的公司 selectedOrgInfoUrl: completePrefix(baseURI, 'api/region/current'),//获取选择的公司
//******************************************************************************* //*******************************************************************************
// 换流站视图 // 换流站视图
...@@ -260,19 +258,26 @@ selectedOrgInfoUrl: completePrefix(baseURI, 'api/region/current'),//获取选择 ...@@ -260,19 +258,26 @@ selectedOrgInfoUrl: completePrefix(baseURI, 'api/region/current'),//获取选择
queryTopographyByTypeUrl: completePrefix(baseURI, 'api/Topography/query/{type}'),//获取Topo图数据 type queryTopographyByTypeUrl: completePrefix(baseURI, 'api/Topography/query/{type}'),//获取Topo图数据 type
updateTopographyUrl: completePrefix(baseURI, 'api/Topography/updateTopo'),//更新Topo图数据 updateTopographyUrl: completePrefix(baseURI, 'api/Topography/updateTopo'),//更新Topo图数据
queryNodeDetailUrl: completePrefix(baseURI, 'api/Topography/detail/{id}'),//获取node节点详情 queryNodeDetailUrl: completePrefix(baseURI, 'api/Topography/detail/{id}'),//获取node节点详情
saveNodeDetailUrl:completePrefix(baseURI, 'api/Topography/detail'),//保存nodeDetail详情 saveNodeDetailUrl: completePrefix(baseURI, 'api/Topography/detail'),//保存nodeDetail详情
deleteTopoUrl:completePrefix(baseURI, 'api/Topography/{type}/{id}'),//删除点/线 deleteTopoUrl: completePrefix(baseURI, 'api/Topography/{type}/{id}'),//删除点/线
manageLevelEumListUrl: completePrefix(baseURI, 'api/riskLevel/manageLevel/list')//查询管控级别 manageLevelEumListUrl: completePrefix(baseURI, 'api/riskLevel/manageLevel/list'),//查询管控级别
dictionaryUrl: completePrefix(baseURI, 'systemctl/v1/dictionary/{code}/values'), // 根据code查询字典
regionProvinceUrl: completePrefix(baseURI, 'systemctl/v1/region/province'), // 字典查询
regionChildren: completePrefix(baseURI, 'systemctl/v1/region/children?parentId={value}'), // 查询省级行政区划数据
saveStationMainten: completePrefix(baseURI, 'api/stationMainten/save'), // 保存站端信息
loadStationMainten: completePrefix(baseURI, 'api/stationMainten/detail') // 获取站端详情
}; };
export const ModuleEditUrl = { export const ModuleEditUrl = {
getAreaTreeUrl:completePrefix(baseURI, 'api/view3d/region/tree'),// getAreaTreeUrl: completePrefix(baseURI, 'api/view3d/region/tree'),//
getPointTreeUrl:completePrefix(baseURI, 'api/view3d/point/tree'), getPointTreeUrl: completePrefix(baseURI, 'api/view3d/point/tree'),
saveAreaDataUrl:completePrefix(baseURI, 'api/view3d/region/bind'),// saveAreaDataUrl: completePrefix(baseURI, 'api/view3d/region/bind'),//
getPointTypeUrl:completePrefix(baseURI, 'api/view3d/point/type'), getPointTypeUrl: completePrefix(baseURI, 'api/view3d/point/type'),
getPointListUrl:completePrefix(baseURI, 'api/view3d/init3dViewNode'),//获取初始三维点 type=impEquipment&riskSourceId=1 getPointListUrl: completePrefix(baseURI, 'api/view3d/init3dViewNode'),//获取初始三维点 type=impEquipment&riskSourceId=1
savePointListUrl:completePrefix(baseURI, 'api/view3d/point/bind'),//批量保存点绑定关系 savePointListUrl: completePrefix(baseURI, 'api/view3d/point/bind'),//批量保存点绑定关系
}; };
/** /**
......
...@@ -55,6 +55,7 @@ const AsyncXJCtrlModel = props => <AsyncLoader load={import('../view/bizview/xun ...@@ -55,6 +55,7 @@ const AsyncXJCtrlModel = props => <AsyncLoader load={import('../view/bizview/xun
const AsyncDifferentiate = props => <AsyncLoader load={import('./../view/bizview/intelligentDifferentiate/DifferentiateView')} componentProps={props} />; const AsyncDifferentiate = props => <AsyncLoader load={import('./../view/bizview/intelligentDifferentiate/DifferentiateView')} componentProps={props} />;
const AsyncAlarmVideoMonitor = props => <AsyncLoader load={import('./../view/bizview/alarmVideoMonitor')} componentProps={props} />; const AsyncAlarmVideoMonitor = props => <AsyncLoader load={import('./../view/bizview/alarmVideoMonitor')} componentProps={props} />;
const AsyncAlarmTestView = props => <AsyncLoader load={import('./../view/bizview/alarm')} componentProps={props} />; const AsyncAlarmTestView = props => <AsyncLoader load={import('./../view/bizview/alarm')} componentProps={props} />;
const AsyncStationMainten = props => <AsyncLoader load={import('./../view/bizview/stationMainten')} componentProps={props} />;
const AsyncEquipmentAlarmTestView = props => <AsyncLoader load={import('./../view/bizview/situation/equipmentAlarm')} componentProps={props} />; const AsyncEquipmentAlarmTestView = props => <AsyncLoader load={import('./../view/bizview/situation/equipmentAlarm')} componentProps={props} />;
const AsyncCusVizLib = props => <AsyncLoader load={import('./../view/planMgmt/cusVizLib')} componentProps={props} />; const AsyncCusVizLib = props => <AsyncLoader load={import('./../view/planMgmt/cusVizLib')} componentProps={props} />;
const AsyncGraph3DModel = props => <AsyncLoader load={import('amos-iot-3dgraph/lib/view/modelMgmt')} componentProps={props} />; const AsyncGraph3DModel = props => <AsyncLoader load={import('amos-iot-3dgraph/lib/view/modelMgmt')} componentProps={props} />;
...@@ -112,6 +113,7 @@ const Routes = { ...@@ -112,6 +113,7 @@ const Routes = {
differentiate: AsyncDifferentiate, differentiate: AsyncDifferentiate,
alarmVideoMonitor: AsyncAlarmVideoMonitor, alarmVideoMonitor: AsyncAlarmVideoMonitor,
alarmTest: AsyncAlarmTestView, alarmTest: AsyncAlarmTestView,
stationMainten: AsyncStationMainten,
equipmentAlarm: AsyncEquipmentAlarmTestView, equipmentAlarm: AsyncEquipmentAlarmTestView,
vizlib: AsyncCusVizLib, vizlib: AsyncCusVizLib,
modelManage: AsyncGraph3DModel, modelManage: AsyncGraph3DModel,
......
...@@ -57,6 +57,7 @@ import PanoramicMonitor from './../view/panoramicMonitor'; ...@@ -57,6 +57,7 @@ import PanoramicMonitor from './../view/panoramicMonitor';
import LeaderStruct from './../view/planMgmt/view/leaderStruct'; import LeaderStruct from './../view/planMgmt/view/leaderStruct';
import UserModel from '../view/bizview/user'; import UserModel from '../view/bizview/user';
import FireRectification from '../view/bizview/fireRectification'; import FireRectification from '../view/bizview/fireRectification';
import StationMainten from './../view/bizview/stationMainten/index';
const Routes = { const Routes = {
// 添加 rules 路由 // 添加 rules 路由
...@@ -101,6 +102,7 @@ const Routes = { ...@@ -101,6 +102,7 @@ const Routes = {
differentiate: DifferentiateView, differentiate: DifferentiateView,
alarmVideoMonitor: AlarmVideoMonitor, alarmVideoMonitor: AlarmVideoMonitor,
alarmTest: alarmTestView, alarmTest: alarmTestView,
stationMainten: StationMainten,
vizlib: CusVizLib, vizlib: CusVizLib,
planDrill: PublishView, planDrill: PublishView,
modelManage: Graph3DModel, modelManage: Graph3DModel,
......
import formatUrl from 'amos-processor/lib/utils/urlFormat';
import { FasSerUrl } from './../consts/urlConsts';
import { commonGet, commonPost } from './../utils/request';
export const queryDictsByCode = (code) => {
return commonGet(formatUrl(FasSerUrl.dictionaryUrl, { code }));
};
export const queryProvinceData = () => {
return commonGet(formatUrl(FasSerUrl.regionProvinceUrl));
};
export const queryRegionChildrenData = value => {
return commonGet(formatUrl(FasSerUrl.regionChildren, { value }));
};
export const queryAllUserAction = () => {
return commonGet(FasSerUrl.getAllUserUrl);
};
export const addStationMaintenAction = (param) => {
return commonPost(FasSerUrl.saveStationMainten, param );
};
export const loadStationMaintenAction = () => {
return commonPost(FasSerUrl.loadStationMainten);
}
.stationMainten-body-left {
width: 100%;
.colspanlab span {
font-size: 14px;
font-weight: 600;
}
.colspanlabV2 span {
font-size: 14px;
}
.left-input {
min-width: 400px;
}
.left-select {
min-width: 200px;
}
.left-textArea {
min-width: 400px;
padding-top: 4px;
padding-bottom: 4px;
}
.left-address-select {
min-width: 105px;
}
.left-address-span {
margin: 0 5px;
font-size: 14px;
}
.left-position-input {
max-width: 150px;
}
.left-btn {
height: 27px;
margin: 0 20px;
font-size: 13px;
font-weight: 600;
background-color: rgba(22, 155, 213, 1);
border-radius: 4px;
}
.left-station-select {
max-width: 150px;
min-width: 145px;
}
}
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Form, Input, Row, Col, Select, Radio, Button, AmosAlert, Connect } from 'amos-framework';
import loadScripts from 'dt2react/lib/utils/loadScripts';
import '../../../styles/view/console/stationMainten/StationMainten.scss';
import {
queryDictsByCode,
queryProvinceData,
queryRegionChildrenData,
queryAllUserAction,
addStationMaintenAction,
loadStationMaintenAction } from '../../../services/stationMaintenService';
import * as endConf from 'amos-processor/lib/config/endconf';
const eventConnect = Connect.eventConnect;
const FormItem = Form.Item;
const Option = Select.Option;
const TextArea = Input.TextArea;
const RadioGroup = Radio.Group;
const timeout2000 = 2000;
const timeOut3000 = 3000;
const AmosConfig = endConf.AmosConfig;
const outMap = AmosConfig.sysConf.outMap;
@eventConnect
class StationMainten extends Component {
static propTypes = {
dataConfig: PropTypes.object,
routeState: PropTypes.object,
oauthConfig: PropTypes.object
};
static defaultProps = {
dataConfig: {},
oauthConfig: {}
};
constructor(props) {
super(props);
this.state = {
loadAmap: false,
BasicMap: null,
isClick: true,
form: {
name: '',
status: 0,
longitude: '', //经度
latitude: '', //纬度
elecType: ''
},
useTypeData: [],
editable: true,
provinceData: [],
cityData: [],
countyData: [],
allUserList: [],
rules: {
useType: [
{ required: true, message: '用途类型不能为空' }
],
name: [
{ required: true, message: '名称不能为空' },
{ max: 50, message: '名称不能大于50个字符' },
{ validator: (rule, value, callback) => {
const reg = new RegExp('^[a-zA-Z0-9_\u4e00-\u9fa5]*$');
if (!reg.test(value)) {
callback(new Error('非法字符'));
} else {
callback();
}
} }
],
address: [
{ max: 50, message: '详细地址不能大于50个字符' }
],
code: [
{ required: true, message: '编号不能为空' },
{ max: 3, message: '编号不能大于3位数字' },
{ validator: (rule, value, callback) => {
const reg = new RegExp('^[0-9]+$');
if (!reg.test(value)) {
callback('编号必须为数字');
} else {
new callback();
}
} }
],
districtCode: [
{ required: true, message: '位置不能为空' }
],
elecType: [
{ required: true, message: '站点类型不能为空' }
],
position3d: [{ validator: this.validPositon3d }]
}
};
}
componentWillMount = () => {
// this.initDict();
this.loadData();
}
componentDidMount = () => {
this.initMap();
}
onInputChange = (type, value) => {
const { form } = this.state;
if (type === 'name') {
form.name = value;
} else if (type === 'code') {
form.code = value;
} else if (type === 'address') {
form.address = value;
}
this.setState({ form });
}
onSelectChange = (value, item) => {
const { form } = this.state;
form.elecType = value;
}
// 用途类型选择
onChangeUseType = (value, item) => {
const { form } = this.state;
form.useType = value;
}
onRadioChange = value => {
const { form } = this.state;
form.status = value;
}
onSelectCharge = value => {
const { form } = this.state;
form.stationChargeUserId = value;
}
onSelectsaftyCharge = value => {
const { form } = this.state;
form.safetyChargeUserId = value;
}
// 行政划区选择
onChangeAddress = (value, item) => {
let _this = this;
const { form } = this.state;
if (item.level === '1') {
queryRegionChildrenData(item.sequenceNbr).then(data => {
_this.setState({ cityData: data });
});
form.provinceCode = value;
} else if (item.level === '2') {
queryRegionChildrenData(item.sequenceNbr).then(data => {
_this.setState({ countyData: data });
});
form.cityCode = value;
} else if ( item.level === '3' ) {
form.districtCode = value;
form.regionCode = item.regionCode;
}
}
initMap() {
let _this = this;
if (outMap) {
Object.keys(localStorage).map(e => {
if (e.indexOf('_AMap') === 0) {
localStorage.removeItem(e);
}
});
let script = null;
let mainUI = null;
script = {
key: 'amapscripts',
url: `/extra/amap/js/outamap.1.4.6.js`
};
mainUI = {
key: 'mainUI',
//url: '//10.56.28.228/webapi.amap.com/ui/1.0/main.js'
url: '/extra/amap/js/outmain.1.4.6.js'
};
loadScripts.asyncLoadScript(script, () => {
loadScripts.asyncLoadScript(mainUI, () => {
setTimeout(() => {
this.setState({
loadAmap: true,
BasicMap: require('./indexMap')
});
}, timeout2000);
console.log(this.state);
console.log(require('./indexMap'));
});
});
} else {
_this.setState({
loadAmap: true,
BasicMap: require('./indexMap')
});
}
}
// 预留经纬度
autoLocation = (longitude, latitude) => {
const { form } = this.state;
form.longitude = longitude;
form.latitude = latitude;
}
// 加载数据
loadData = async () => {
let _this = this;
await this.initDict();
loadStationMaintenAction().then(data => {
if (data.id > 0) {
_this.queryRegionChildrenBySequenceNbr(data);
if (data.status === 0) {
_this.setState({ editable: false });
}
}
});
}
queryRegionChildrenBySequenceNbr = async (data) => {
let _this = this;
await queryRegionChildrenData(data.provinceCode).then(data => {
_this.setState({ cityData: data });
});
await queryRegionChildrenData(data.cityCode).then(data => {
_this.setState({ countyData: data });
});
this.setState({ form: data });
}
// 返回上一个页面
goBack(){
}
handleMarkerMap = marker => {
const { form } = this.state;
form.longitude = marker.longitude;
form.latitude = marker.latitude;
console.log(marker);
this.setState({ form });
// autoLocation(marker.longitude, marker.latitude);
}
saveInfo = () => {
const { isClick } = this.state;
if (isClick) { //如果为true 开始执行
this.setState({ isClick: false }); //将isClick 变成false,将不会执行处理事件
this.model.validate((valid, dataValues) => {
if (valid) {
let param = dataValues;
addStationMaintenAction(param).then(
data => {
AmosAlert.success('提示', '保存成功');
// this.state.reload();
this.loadData();
},
error => {
AmosAlert.error('错误', error || '保存失败');
}
);
} else {
console.log('error submit!!');
return false;
}
});
const that = this; // 为定时器中的setState绑定this
setTimeout(() => { // 设置延迟事件,1秒后将执行
that.setState({ isClick: true }); // 将isClick设置为true
}, timeOut3000);
}
}
/**
* 初始化字典数据
*/
initDict = () => {
// this.autoLocation('1', '2');
let _this = this;
// 用途类型
queryDictsByCode('station_use_type').then(data => {
_this.setState({ useTypeData: data });
});
// 省市区县
queryProvinceData().then(data => {
_this.setState({ provinceData: data });
});
// 换流站负责人
queryAllUserAction().then(data => {
_this.setState({ allUserList: data });
});
}
indexViewChange = (status) => {
if (status.hasOwnProperty('flag')) {
this.setState({
city: status.city,
flag: status.flag,
pid: status.pid,
pointName: status.pointName,
pointAttrs: status.pointAttrs,
floor: status.floor,
pointtype: status.pointtype
});
} else {
this.setState({
is3DPage: status.is3DPage,
city: status.city,
orgCode: status.orgCode,
flag: 0
});
}
}
render() {
const { form, rules, editable, useTypeData, provinceData, cityData, countyData, allUserList, BasicMap } = this.state;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 7 },
className: 'colspanlab'
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
className: 'colspan'
}
};
const formItemV2Layout = {
labelCol: {
xs: { span: 1 },
sm: { span: 6 },
className: 'colspanlabV2'
},
wrapperCol: {
xs: { span: 1 },
sm: { span: 16 },
className: 'colspan'
}
};
const formItemV3Layout = {
labelCol: {
xs: { span: 1 },
sm: { span: 10 },
className: 'colspanlab'
},
wrapperCol: {
xs: { span: 1 },
sm: { span: 14 },
className: 'colspan'
}
};
return (
<div className="grid-case p-20">
<Row className="mb-5" style={{ height: '40px', lineHeight: '40px', backgroundColor: '#f3f3f3' }}>
<Col span={5}>
<span style={{ height: '40px', fontSize: '15px', paddingLeft: '20px' }}>站端维护</span>
</Col>
</Row>
<Row>
<Col span={12} className="p-10" style={{ }}>
<Form model={form} rules={rules} ref={component => this.model = component}>
<input type='hidden' name='id' value={form.id} />
<div className="stationMainten-body-left">
<FormItem label={<span>换流站名称</span>} field="name" {...formItemLayout}>
<Input className="left-input" required value={form.name} onChange={e => this.onInputChange('name', e.target.value)} />
</FormItem>
<FormItem label={<span>用途类型</span>} field="useType" {...formItemLayout}>
<Select data={useTypeData}
className="left-select"
disabled={!editable}
value={form.useType ? form.useType.toString() : form.useType}
renderOption={item => <Option value={item.dictDataKey}>{item.dictDataValue}</Option>}
defaultOption={<Option>请选择</Option>}
onChange={this.onChangeUseType}
/>
</FormItem>
<FormItem label={<span>位置</span>} field="districtCode" {...formItemLayout}>
<Select data={provinceData}
className="left-address-select"
disabled={!editable}
required
value={form.provinceCode}
renderOption={item => <Option value={item.sequenceNbr}>{item.regionName}</Option>}
defaultOption={<option>请选择</option>}
onChange={this.onChangeAddress}
/>
<span className="left-address-span"></span>
<Select data={cityData}
className="left-address-select"
disabled={!editable}
value={form.cityCode}
required
renderOption={item => <Option value={item.sequenceNbr}>{item.regionName}</Option>}
defaultOption={<Option>请选择</Option>}
onChange={this.onChangeAddress}
/>
<span className="left-address-span"></span>
<Select data={countyData}
className="left-address-select"
disabled={!editable}
required
value={form.districtCode}
renderOption={item => <Option value={item.sequenceNbr}>{item.regionName}</Option>}
defaultOption={<Option>请选择</Option>}
onChange={this.onChangeAddress}
/>
<span className="left-address-span">区县</span>
</FormItem>
<FormItem label={<span>详细地址</span>} field="address" {...formItemLayout}>
<TextArea rows={5}
className="left-textArea"
disabled={!editable}
value={form.address}
placeholder="详细地址"
onChange={e => this.onInputChange('address', e.target.value)}
/>
</FormItem>
<FormItem label={<span>地图定位</span>} field="position" {...formItemLayout}>
<Row style={{ width: '400px' }}>
<Col span={12}>
<FormItem label={<span>经度</span>} field="longitude" {...formItemV2Layout}>
<Input className="left-position-input"
disabled={!editable}
readOnly
value={form.longitude}
onChange={e => this.onInputChange('longitude', e.target.value)}
/>
</FormItem>
</Col>
<Col span={12}>
<FormItem label={<span>纬度</span>} field="latitude" {...formItemV2Layout}>
<Input className="left-position-input"
disabled={!editable}
value={form.latitude}
readOnly
onChange={e => this.onInputChange('latitude', e.target.value)}
/>
</FormItem>
</Col>
</Row>
</FormItem>
<FormItem label={<span>编号</span>} field="code" {...formItemLayout}>
<Input className="left-input" required disabled={!editable} value={form.code} onChange={e => this.onInputChange('code', e.target.value)} />
</FormItem>
<FormItem label={<span>站点类型</span>} field="elecType" {...formItemLayout}>
<Select onChange={this.onSelectChange} value={form.elecType} className="left-select" disabled={!editable}>
<Option value='' >请选择</Option>
<Option value={1}>输电</Option>
<Option value={2}>收电</Option>
</Select>
</FormItem>
<FormItem label={<span>状态</span>} field="status" {...formItemLayout}>
<RadioGroup disabled={!editable} value={form.status} onChange={this.onRadioChange}>
<Radio value={0} >启用</Radio>
<Radio value={1} >停用</Radio>
</RadioGroup>
</FormItem>
<FormItem label={<span>换流站负责人</span>} field="stationChargeUserName" {...formItemLayout}>
<Row style={{ width: '400px' }}>
<Col span={9}>
<Select data={allUserList}
className="left-station-select"
disabled={!editable}
value={form.stationChargeUserId}
renderOption={item => <Option value={item.userId}>{item.realName}</Option>}
defaultOption={<Option>请选择</Option>}
onChange={this.onSelectCharge}
/>
</Col>
<Col span={15}>
<FormItem label={<span>安全负责人</span>} field="safetyChargeUserName" {...formItemV3Layout}>
<Select data={allUserList}
className="left-station-select"
disabled={!editable}
value={form.safetyChargeUserId}
renderOption={item => <Option value={item.userId}>{item.realName}</Option>}
defaultOption={<Option>请选择</Option>}
onChange={this.onSelectsaftyCharge}
/>
</FormItem>
</Col>
</Row>
</FormItem>
<FormItem label={<span>换流站编码</span>} field="stationCode" {...formItemLayout}>
<Input className="left-input"
disabled={!editable}
readOnly
value={form.stationCode}
onChange={e => this.onInputChange('stationCode', e.target.value)}
/>
</FormItem>
<Row>
<Col span={20}>
<Button className="f-r left-btn" style={{ marginRight: '20%' }} onClick={this.goBack}>取消</Button>
<Button className="f-r left-btn" onClick={this.saveInfo}>保存</Button>
</Col>
</Row>
</div>
</Form>
</Col>
<Col span={12} style={{ height: '614px', border: '1px solid black' }}>
<div style={{ height: '614px' }}>
{ this.state.loadAmap && <BasicMap indexViewChange={this.indexViewChange} pushMarkerPoint={this.handleMarkerMap} /> }
</div>
</Col>
</Row>
</div>
);
}
}
StationMainten.propTypes = {
};
export default StationMainten;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { BaseMap, Marker } from 'amos-amap';
import * as endConf from 'amos-processor/lib/config/endconf';
// import TwoDimensionalMap from './../monitor/2d/index';
const AmosConfig = endConf.AmosConfig;
const outMap = AmosConfig.sysConf.outMap;
const _showZoom = AmosConfig.showZoom;
const _mapCenter = AmosConfig.mapCenter;
const _picURI = AmosConfig.picURI;
const mapConfig = {
zoom: _showZoom[0],
resizeEnable: true,
zoomEnable: true,
// plugins: ['Scale', 'MapType', 'OverView', 'ControlBar'],
plugins: ['Scale'],
zooms: [_showZoom[0], _showZoom[2]],
expandZoomRange: true,
doubleClickZoom: false,
showIndoorMap: false, //隐藏地图自带的室内地图图层
features: ['bg', 'road', 'point'] //隐藏默认楼块
};
const layers = [
new window.AMap.TileLayer({
getTileUrl(x, y, z) {
return `${_picURI}shanxi/amap/${z}/${x}/${y}.png`;
},
zIndex: 0
})
];
/**
* @class IndexMap
* @extends {Component}
* @description 首页地图
*/
class IndexMap extends Component {
static propTypes = {
pushMarkerPoint: PropTypes.func
};
constructor(props) {
super(props);
this.state = {
mapCenter: _mapCenter,
center: { longitude: 108.93984, latitude: 34.34127 },
marker: { longitude: 0, latitude: 0 },
// marker: { longitude: null, latitude: null },
visible: true,
style: { strokeColor: '#10A100', fillColor: '#10A100' },
city: 'xian',
type: 'small' //当前图层展示的末端marker标识
};
}
/**
* 加载全局地图
*/
setInstanceToGlobal = inst => {
this.map = inst;
window.map = inst;
};
/**
* 地图选点
* @memberof IndexMap
*/
handleClickMap = e => {
let { marker } = this.state;
marker.longitude = e.lnglat.lng;
marker.latitude = e.lnglat.lat;
this.setState({ marker });
this.props.pushMarkerPoint(marker);
}
render() {
const events = {
created: this.setInstanceToGlobal,
click: this.handleClickMap
};
let { mapCenter, marker } = this.state;
if (outMap) {
mapConfig.layers = layers;
}
return (
<div className="content indexPage" style={{ height: '614px' }}>
<BaseMap events={events} center={mapCenter} {...mapConfig} >
<Marker position={marker} key={marker.longitude} />
</BaseMap>
</div>
);
}
}
// IndexMap.PropTypes = {
// pushMarkerPoint: PropTypes.func
// };
export default IndexMap;
...@@ -7,7 +7,17 @@ ...@@ -7,7 +7,17 @@
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="application/javascript" src="/amos.config.js"></script> <script type="application/javascript" src="/amos.config.js"></script>
<!-- <script src="http://webapi.amap.com/maps?v=1.4.3&key=8afbcd8006fcd36a22136ef20a12456a"></script> -->
<title>IFC100消防指挥系统</title> <title>IFC100消防指挥系统</title>
<script>
window.offlineMap = {
}
var scripts = document.getElementsByTagName("script");
var curScript = scripts[0].getAttribute("src");
offlineMap.baseUrl = window.location.origin + '/';
offlineMap.domain = offlineMap.baseUrl.substr(offlineMap.baseUrl.indexOf("://"), offlineMap.baseUrl.length);
</script>
<style> <style>
.startload { .startload {
position: fixed; position: fixed;
......
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