From 9d3b2a2265997d65e75f85f41e2c639f617ea35e Mon Sep 17 00:00:00 2001
From: zmk <496160012@qq.com>
Date: 星期四, 16 五月 2024 18:39:50 +0800
Subject: [PATCH] 提交代码

---
 javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/beijing.json |    0 
 javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/add.html  |    4 +-
 javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/main.js      |   72 +++++++++++++++++++++++++++--------
 javaweb-plus/javaweb-admin/src/main/resources/templates/main.html           |   14 +++---
 4 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/beijing.geojson b/javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/beijing.json
similarity index 100%
rename from javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/beijing.geojson
rename to javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/beijing.json
diff --git a/javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/main.js b/javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/main.js
index ed593dd..95016c1 100644
--- a/javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/main.js
+++ b/javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/main.js
@@ -5,6 +5,9 @@
 	//bindEvent();
 })
 // 鍔犺浇鍦板浘
+var countries = [];
+var countriesOverlay = new T.D3Overlay(init,redraw);
+var countriesOverlay1 = new T.D3Overlay(init1,redraw1);
 function loadMap() {
 	let map = new T.Map('map_div');
 	map.centerAndZoom(new T.LngLat(116.38, 39.9), 11);
@@ -12,25 +15,60 @@
 	var control = new T.Control.Zoom();
 	control.setPosition(T_ANCHOR_TOP_RIGHT);
 	map.addControl(control);// 娣诲姞缂╂斁骞崇Щ鎺т欢
-
 	var scale = new T.Control.Scale();// 鍒涘缓姣斾緥灏烘帶浠跺璞�
-	// var ctrl = new T.Control.MapType();
-	// ctrl.setPosition(T_ANCHOR_BOTTOM_RIGHT);
-	// 娣诲姞鎺т欢
-	map.addControl(ctrl);
-
-
-	// const sourceGeoJson = new VectorSource({
-	// 	format: new GeoJSON(),
-	// 	url:'/beijing.geojson'
-	// });
-	//
-	// const layerGeoJson = new VectorLayer({
-	// 	source:sourceGeoJson,
-	// });
-	//
-	// map.addLayer(layerGeoJson);
+	d3.json("/bjfw/js/custom/beijing.json", function (data) {
+		countries = data.features;
+		map.addOverLay(countriesOverlay)
+		countriesOverlay.bringToBack();
+		map.addOverLay(countriesOverlay1)
+		countriesOverlay.bringToBack();
+	});
 }
+
+
+
+function init(sel, transform) {
+	var upd = sel.selectAll('path.geojson').data(countries);
+	upd.enter()
+		.append('path')
+		.attr("class", "geojson")
+		.attr('stroke', 'grey')
+		.attr('fill', function (d, i) {
+			//return d3.hsl(Math.random() * 360, 0.9, 0.5)
+			return "transparent"
+		})
+		.attr('fill-opacity', '0')
+}
+
+function redraw(sel, transform) {
+	sel.selectAll('path.geojson').each(
+		function (d, i) {
+			d3.select(this).attr('d', transform.pathFromGeojson)
+		}
+	)
+}
+
+
+function init1(sel, transform) {
+	var upd = sel.selectAll('path.geojson1').data(countries);
+	upd.enter()
+		.append('path')
+		.attr("class", "geojson1")
+		.attr('stroke', 'grey')
+		.attr('fill', function (d, i) {
+			return d3.hsl(Math.random() * 360, 0.9, 0.5)
+		})
+		.attr('fill-opacity', '0.1')
+}
+
+function redraw1(sel, transform) {
+	sel.selectAll('path.geojson1').each(
+		function (d, i) {
+			d3.select(this).attr('d', transform.pathFromGeojson)
+		}
+	)
+}
+
 // 鑾峰彇鏁版嵁搴撶湡瀹炴暟鎹�
 function getReallyData() {
 	let url = window.location.protocol + "//" + window.location.host + "/bjfw/geotdp/index/indexCollect";
diff --git a/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html b/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
index 339bbbf..0dd78b1 100644
--- a/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
+++ b/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
@@ -31,13 +31,7 @@
 
 					<div class="row">
 						<div class="col-sm-8">
-<!--							<div>-->
-<!--								<div class="col-md-4">-->
-<!--									<input type="text" class="form-control" placeholder="椤圭洰鍏抽敭璇嶆煡璇㈠畾浣�">-->
-<!--								</div>-->
-<!--							    <button type="button" class="btn btn-success">鏌ヨ</button>-->
-<!--							</div>-->
-							<div id="map_div" style="width: 100%;height: 570px;margin-top: 10px"></div>
+							<div id="map_div" style="width: 100%;height: 750px;"></div>
 						</div>
 
 						<div class="col-sm-4">
@@ -67,7 +61,13 @@
 	<script th:src="@{/ajax/libs/flot/jquery.flot.js}"></script>
 	<script th:src="@{/ajax/libs/report/echarts/echarts-all.js}"></script>
 	<script th:src="@{/js/tdt.js}" type="text/javascript"></script>
+
+	<script src="http://lbs.tianditu.gov.cn/js/lib/d3/d3.min.js" type="text/javascript"></script>
+	<script src="http://lbs.tianditu.gov.cn/api/js4.0/opensource/openlibrary/D3SvgOverlay.js" type="text/javascript"></script>
+
 	<script th:src="@{/js/custom/main.js}"></script>
+
+
 	<th:block th:include="include :: sparkline-js" />
 	
 	<th:block th:include="include :: footer" />
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/add.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/add.html
index bffd524..40d1431 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/add.html
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/add.html
@@ -55,13 +55,13 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">缁忓害锛�</label>
                 <div class="col-sm-8">
-                    <input name="lng" class="form-control" required type="text">
+                    <input name="lng" class="form-control" required type="text"  placeholder="璇峰~鍐欑粡搴︼紝缁忕含搴︽牸寮�">
                 </div>
             </div>
             <div class="form-group">
                 <label class="col-sm-3 control-label">绾害锛�</label>
                 <div class="col-sm-8">
-                    <input name="lat" class="form-control" required type="text">
+                    <input name="lat" class="form-control" required type="text"  placeholder="璇峰~鍐欑含搴︼紝缁忕含搴︽牸寮�">
                 </div>
             </div>
             <div class="form-group">

--
Gitblit v1.9.1