2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8"/>
    <link rel="stylesheet" type="text/css" th:href="@{${pubzyWebRoot} + 'arcgis_js_api/library/3.18/3.18/dijit/themes/tundra/tundra.css'}"/>
    <link rel="stylesheet" type="text/css" th:href="@{${pubzyWebRoot} + 'arcgis_js_api/library/3.18/3.18/esri/css/esri.css'}"/>
    <style type="text/css">
        body {
            margin: 0px;
        }
 
        .MapClass {
            width: 100%;
            height: 100%;
        }
    </style>
    <script th:inline="javascript">
        /*<![CDATA[*/
        var pubzyWebRoot = [[${pubzyWebRoot}]];
        var obtainExtentMapUrl = [[${obtainExtentMapUrl}]];
        var symbol = [[${symbol}]];
        var geotype = [[${geotype}]];
        /*]]>*/
        var dojoConfig = {
            api_url: pubzyWebRoot + "arcgis_js_api/library/3.18/3.18",
            async: false,
            isDebug: true,
            parseOnLoad: true,
            mblHideAddressBar: false
        };
    </script>
    <script type="text/javascript" th:src="@{${pubzyWebRoot} + 'arcgis_js_api/library/3.18/3.18/init.js'}"></script>
    <script type="text/javascript">
        var map;
        dojo.require("esri.map");
        dojo.addOnLoad(function () {
            var h = window.innerHeight;
            document.getElementById("map").style.height = h + "px";
            map = new esri.Map("map", {
                logo: false,
                slider: false,
                maxZoom: 19,
                minZoom: 19,
                extent: new esri.geometry.Extent({xmin:113.72534875,ymin:22.31658902,xmax:113.72638408,ymax:22.31739296,spatialReference:{wkid:4326}})
            });
            var basemap = new esri.layers.ArcGISTiledMapServiceLayer(obtainExtentMapUrl);
            map.addLayer(basemap);
            var uvrJson = {
                "type": "uniqueValue",
                "field1": "SUB_REGION",
                "defaultSymbol": {
                    "color": [0, 0, 0, 64],
                    "outline": {
                        "color": [0, 0, 0, 255],
                        "width": 1,
                        "type": "esriSLS",
                        "style": "esriSLSNull"
                    },
                    "type": "esriSFS",
                    "style": "esriSFSNull"
                },
                "uniqueValueInfos": [
                    {
                        "value": "Pacific",
                        "symbol": eval("(" + symbol + ")")
                    }
                ]
            }
            var renderer = new esri.renderer.UniqueValueRenderer(uvrJson);
 
            map.on("load", function(){
                map.disablePan();
                map.graphics.setRenderer(renderer);
                var geo = map.extent.getCenter();
                if(geotype == "线") {
                    geo = new esri.geometry.Polyline([[113.72646643, 22.31699099], [113.72426643, 22.31699099]]);
                }
                if(geotype == "面") {
                    geo = new esri.geometry.Polygon([[113.72552643, 22.31731099], [113.72620643, 22.31731099], [113.72620643, 22.31665099], [113.72552643,22.31665099]]);
                }
                map.graphics.add(new esri.Graphic(geo, null, {"SUB_REGION":"Pacific"}, null));
            });
        });
    </script>
</head>
<body class="tundra">
    <div id="map" class="MapClass"></div>
</body>
</html>