GisShareApp3DForTest.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
  6. <title>上海城地API</title>
  7. <style>
  8. html,
  9. body,
  10. #mapDiv {
  11. padding: 0;
  12. margin: 0;
  13. height: 100%;
  14. width: 100%;
  15. }
  16. </style>
  17. <script src="jquery/jquery-2.2.3.min.js"></script>
  18. <link rel="stylesheet" href="jquery/jquery-ui.min.css">
  19. <script src="jquery/jquery-ui.min.js"></script>
  20. <!--<script src="http://139.196.53.46/arcgis_js_api/library/4.12/init.js"></script>-->
  21. <!--<link rel="stylesheet" href="http://139.196.53.46/arcgis_js_api/library/4.12/esri/themes/light-blue/main.css">-->
  22. <script src="http://139.196.53.46/arcgis_js_api/library/4.12/init.js"></script>
  23. <link rel="stylesheet" href="http://139.196.53.46/arcgis_js_api/library/4.12/esri/themes/light-blue/main.css">
  24. <!--<script src="https://zw.zamplus.com/arcgis/arcgis_js_api/library/4.10/init.js"></script>-->
  25. <!--<link rel="stylesheet" href="https://zw.zamplus.com/arcgis/arcgis_js_api/library/4.10/esri/themes/light-blue/main.css">-->
  26. <!--<script src="http://localhost/arcgis_js_api/library/4.10/init.js"></script>-->
  27. <!--<link rel="stylesheet" href="http://localhost/arcgis_js_api/library/4.10/esri/themes/light-blue/main.css">-->
  28. <!--<script src="http://219.233.74.21/arcgis_js_api/library/4.10/init.js"></script>-->
  29. <!--<link rel="stylesheet" href="http://219.233.74.21/arcgis_js_api/library/4.10/esri/themes/light-blue/main.css">-->
  30. <!--<script src="http://localhost/arcgis_js_api/library/4.10/init.js"></script>-->
  31. <!--<link rel="stylesheet" href="http://localhost/arcgis_js_api/library/4.10/esri/themes/light-blue/main.css">-->
  32. <!--系统自定义JS-->
  33. <script src="Common/dataClass/XMLUtil.js"></script> <!--XML操作功能-->
  34. <script src="Common/dataClass/ConfigManager.js"></script>
  35. <script src="Common/dataClass/DataCommonClass.js"></script>
  36. <script src="Common/dataClass/MD5.js"></script>
  37. <script src="Common/dataClass/Base64.js"></script>
  38. <script src="Common/mapClass/MapClass4.js"></script>
  39. <script src="Common/WsCommonClass.js"></script>
  40. <script src="Common/mapClass/GSFunction.js"></script>
  41. <script>
  42. //监听message
  43. window.onmessage = function(e) {
  44. //alert(e.origin);
  45. //if (e.origin !== 'http://10.101.35.46/WJGisShare/')
  46. //return;
  47. var payload = JSON.parse(e.data);
  48. switch (payload.method) {
  49. case 'ZoomIn':
  50. //localStorage.setItem(payload.key, JSON.stringify(payload.data));
  51. ZoomIn(payload.data);
  52. break;
  53. case 'ZoomOut':
  54. ZoomOut(payload.data);
  55. break;
  56. case 'Clear':
  57. Clear(payload.data);
  58. break;
  59. case 'ViewChange':
  60. ViewChange();
  61. break;
  62. case 'fullExtent':
  63. toFullExtent();
  64. break;
  65. case 'doSetExtent':
  66. doSetExtent(parseInt(payload.data));
  67. break;
  68. case 'measureSquare':
  69. measureSquare();
  70. break;
  71. case 'measureLength':
  72. measureLength();
  73. break;
  74. case 'downLoadPicture':
  75. downLoadPicture();
  76. break;
  77. case 'doGetGraphicByJson':
  78. doGetGraphicByJson(payload.data[0],payload.data[1]);
  79. break;
  80. case 'drawSquare':
  81. drawSquare();
  82. break;
  83. case 'query':
  84. query(payload.data[0],payload.data[1]);
  85. break;
  86. case 'queryByWhereStr':
  87. querybyWhereStr(payload.data[0],payload.data[1]);
  88. break;
  89. case 'openFeatureLayer':
  90. OpenFeatureLayerByID(payload.data[0],payload.data[1]);
  91. break;
  92. case 'openFeatureLayerByName':
  93. // var isVisible=true;
  94. // if(parseInt(payload.data[1])==0)
  95. // {
  96. // isVisible=false;
  97. // }
  98. OpenMapImageLayerByName(payload.data[0],payload.data[1]);
  99. break;
  100. case 'openFeatureLayer0':
  101. var isVisible=true;
  102. if(parseInt(payload.data[0])==0)
  103. {
  104. isVisible=false;
  105. }
  106. OpenFeatureLayerByID1(0,isVisible);
  107. break;
  108. case 'openFeatureLayer1':
  109. var isVisible=true;
  110. if(parseInt(payload.data[0])==0)
  111. {
  112. isVisible=false;
  113. }
  114. OpenFeatureLayerByID1(1,isVisible);
  115. break;
  116. case 'openFeatureLayer2':
  117. var isVisible=true;
  118. if(parseInt(payload.data[0])==0)
  119. {
  120. isVisible=false;
  121. }
  122. OpenFeatureLayerByID1(2,isVisible);
  123. break;
  124. case 'openFeatureLayer3':
  125. var isVisible=true;
  126. if(parseInt(payload.data[0])==0)
  127. {
  128. isVisible=false;
  129. }
  130. OpenFeatureLayerByID1(3,isVisible);
  131. break;
  132. case 'openFeatureLayer4':
  133. var isVisible=true;
  134. if(parseInt(payload.data[0])==0)
  135. {
  136. isVisible=false;
  137. }
  138. OpenFeatureLayerByID1(4,isVisible);
  139. break;
  140. case 'openFeatureLayer5':
  141. var isVisible=true;
  142. if(parseInt(payload.data[0])==0)
  143. {
  144. isVisible=false;
  145. }
  146. OpenFeatureLayerByID1(5,isVisible);
  147. break;
  148. case 'openFeatureLayer6':
  149. var isVisible=true;
  150. if(parseInt(payload.data[0])==0)
  151. {
  152. isVisible=false;
  153. }
  154. OpenFeatureLayerByID1(6,isVisible);
  155. break;
  156. case 'openFeatureLayer7':
  157. var isVisible=true;
  158. if(parseInt(payload.data[0])==0)
  159. {
  160. isVisible=false;
  161. }
  162. OpenFeatureLayerByID1(7,isVisible);
  163. break;
  164. case 'openFeatureLayer8':
  165. var isVisible=true;
  166. if(parseInt(payload.data[0])==0)
  167. {
  168. isVisible=false;
  169. }
  170. OpenFeatureLayerByID1(8,isVisible);
  171. break;
  172. case 'openFeatureLayer9':
  173. var isVisible=true;
  174. if(parseInt(payload.data[0])==0)
  175. {
  176. isVisible=false;
  177. }
  178. OpenFeatureLayerByID1(9,isVisible);
  179. break;
  180. case 'openFeatureLayer10':
  181. var isVisible=true;
  182. if(parseInt(payload.data[0])==0)
  183. {
  184. isVisible=false;
  185. }
  186. OpenFeatureLayerByID1(10,isVisible);
  187. break;
  188. case 'setCenterExtent':
  189. setCenterExtent(payload.data[0],payload.data[1],payload.data[2]);
  190. break;
  191. case 'drawCircle':{
  192. drawCircle(payload.data[0]);
  193. break;
  194. }
  195. case 'queryByCircle':{
  196. queryByCircle(payload.data[0] ,payload.data[1] ,payload.data[2] ,payload.data[3] )
  197. break;
  198. }
  199. case 'doFlashStatus':{
  200. var flahLayerName=payload.data[0];
  201. switch(flahLayerName)
  202. {
  203. case "违章建筑":
  204. flashLayerStatus(fe0,"状态",1);
  205. break;
  206. case "电梯":
  207. flashLayerStatus(fe4,"状态",1);
  208. break;
  209. case "虹口烟感":
  210. flashLayerStatus(fe1,"状态",1);
  211. break;
  212. case "摄像头":
  213. flashLayerStatus(fe2,"状态",1);
  214. break;
  215. case "危险源":
  216. flashLayerStatus(fe3,"状态",1);
  217. break;
  218. case "门磁":
  219. flashLayerStatus(fe5,"状态",1);
  220. break;
  221. default:
  222. ClearLightLayerStatus();
  223. break;
  224. }
  225. break;
  226. }
  227. case "onLocation":{
  228. setPointBylonlat(payload.data[0],payload.data[1],payload.data[2],payload.data[3],payload.data[4],payload.data[5],payload.data[6]);
  229. break;
  230. }
  231. case "MeasureLengthByPoint":{
  232. //parent.eval(payload.backfun+"()");
  233. MeasureLengthByPoint(payload.data[0],payload.data[1],payload.data[2],payload.data[3],payload.backfun);
  234. break;
  235. }
  236. case "newQuery":{
  237. newQuerybyWhereStr(payload.data[0],payload.data[1],GetConfigDataByName("MYQueryLayer"));
  238. break;
  239. }
  240. case "onLocationforGrid" :{
  241. setPointBylonlatForGrid(payload.data[0],payload.data[1]);
  242. break;
  243. }
  244. case "onLocationforAddress":{
  245. setPointBylonlatForAddress(payload.data[0],payload.data[1]);
  246. break;
  247. }
  248. case "onQueryByPoint":{
  249. setPointBylonlatForGetBuffer(payload.data[0],payload.data[1],payload.data[2],payload.data[3],payload.data[4],payload.data[5]);
  250. break;
  251. }
  252. case "onQueryByGrid":{
  253. getGridGeometry(payload.data[0],payload.data[1]);
  254. break;
  255. }
  256. case "onMapCenter":{
  257. var mapcenter = m_view.center ;
  258. window.parent.postMessage(
  259. {
  260. method: "mapCenterCallback",
  261. data:[JSON.stringify(mapcenter).replace(/\"/g,'"')]
  262. },
  263. '*'
  264. );
  265. break;
  266. }
  267. case "onMapLevel":{
  268. var mapzoom = m_view.zoom;
  269. window.parent.postMessage(
  270. {
  271. method: "mapLevelCallback",
  272. data:[JSON.stringify(mapzoom).replace(/\"/g,'"')]
  273. },
  274. '*'
  275. );
  276. break;
  277. }
  278. case "onMapSetCenter":{
  279. // m_view.center = [0, 0]
  280. setPointBylonlatForSetCenter(payload.data[0],payload.data[1]);
  281. break;
  282. }
  283. case "onGetXYbyAddress":{
  284. getXYbyAddress(payload.data[0]);
  285. break;
  286. }
  287. case "onSetInitExtentByStr":{
  288. // getXYbyAddress(payload.data[0]);
  289. if(payload.data[0] == "区县边界")
  290. queryForExtent(payload.data[0],"区县名称=" +"'"+ payload.data[1]+"'",100);
  291. else
  292. queryForExtent(payload.data[0], "街道名称=" +"'"+ payload.data[1]+"'",100);
  293. break;
  294. }
  295. case "onQueryByCondition":{
  296. newQuerybyWhereStr(payload.data[0],payload.data[1],GetConfigDataByName("MYQueryLayer"),null,payload.data[2],payload.data[3]);
  297. break;
  298. }
  299. }
  300. };
  301. //初始化配置文件
  302. GetConfigData();
  303. require(["dojo/domReady!"
  304. ], function () {
  305. loadMap();
  306. });
  307. function loadMap() {
  308. //判断
  309. if (GetConfigDataByName("maptype") == "3D") {
  310. init3DScene();
  311. }
  312. else {
  313. initMap();
  314. }
  315. }
  316. function onMapLoadInfo(){
  317. alert(1)
  318. window.parent.postMessage(
  319. {
  320. method: "maploadCallback"
  321. },
  322. '*'
  323. );
  324. }
  325. function onMapLoaded()
  326. {
  327. removeLoadingDiv();
  328. onMapLoadInfo()
  329. // GetLayerMainRestInfo2(GetConfigDataByName("MYQueryLayer"));
  330. // setPointBylonlat(121,30);
  331. //alert("加载完成");
  332. }
  333. //--------------- 按钮事件 -----------------
  334. //切换二三维地图
  335. function onViewTestClick() {
  336. ViewChange()
  337. }
  338. function ViewChange() {
  339. m_view.container=null;
  340. showLoadingDiv("正在切换地图,请稍后...");
  341. if (currentMapMode == "2D") {
  342. switchTo3DMap();
  343. }
  344. else {
  345. switchTo2DMap();
  346. }
  347. }
  348. //清空地图
  349. function btClear_Click() {
  350. //Clear();
  351. }
  352. function Clear(type) {
  353. // var mtype = type | "all";
  354. switch(type){
  355. case "all":{
  356. GraphicsLayer_myLayer.removeAll();
  357. GraphicsLayer_DrawLayer.removeAll();
  358. GraphicsLayer_flyTipLayer.removeAll();
  359. xmlQueryExtend = null;
  360. queryExtent = null;
  361. break;
  362. }
  363. case "drawLayer":{
  364. GraphicsLayer_DrawLayer.removeAll();
  365. GraphicsLayer_flyTipLayer.removeAll();
  366. xmlQueryExtend = null;
  367. queryExtent = null;
  368. break;
  369. }
  370. case "queryLayer":{
  371. GraphicsLayer_myLayer.removeAll();
  372. GraphicsLayer_flyTipLayer.removeAll();
  373. xmlQueryExtend = null;
  374. queryExtent = null;
  375. break;
  376. }
  377. }
  378. }
  379. //查询
  380. function btSearch_Click() {
  381. // var dynamicLayerURL="https://services8.arcgis.com/wUIATpkD1eTGk5lC/arcgis/rest/services/CMRQTest2_WFL1/FeatureServer";
  382. // var QueryLayerID="13";
  383. var dynamicLayerURL ="http://139.196.105.31:6080/ArcGIS/rest/services/HKEMAP/MapServer";
  384. if(GetConfigDataByName("QueryLayer"))
  385. {
  386. dynamicLayerURL=GetConfigDataByName("QueryLayer");
  387. }
  388. var QueryLayerID = "13";
  389. var whereString = "";
  390. whereString = "HANDLE号 like '%" + document.getElementById("txtSearch").value + "%'";
  391. require([
  392. "esri/Graphic",
  393. "esri/tasks/QueryTask",
  394. "esri/tasks/support/Query",
  395. "esri/symbols/SimpleMarkerSymbol",
  396. "esri/symbols/SimpleLineSymbol",
  397. "esri/geometry/Point",
  398. "esri/geometry/Polyline",
  399. "esri/symbols/PointSymbol3D",
  400. "esri/renderers/SimpleRenderer",
  401. "esri/symbols/ObjectSymbol3DLayer",
  402. "esri/PopupTemplate",
  403. "dojo/_base/array"
  404. ], function (Graphic, QueryTask, Query, SimpleMarkerSymbol, SimpleLineSymbol, Point, Polyline, PointSymbol3D, SimpleRenderer, ObjectSymbol3DLayer, PopupTemplate, array) {
  405. var layerinfo = getLayerByLayerId(QueryLayerID);
  406. var queryTask = new QueryTask(dynamicLayerURL + "/" + QueryLayerID);
  407. var query = new Query();
  408. query.returnGeometry = true;
  409. query.outFields = ["*"];
  410. query.where = whereString;
  411. var defaultPointSymbol = new SimpleMarkerSymbol({
  412. color: [226, 119, 40],
  413. outline: { // autocasts as new SimpleLineSymbol()
  414. color: [255, 255, 255],
  415. width: 2
  416. }
  417. });
  418. var defaultLineSymbol = new SimpleLineSymbol({
  419. color: [255, 0, 255],
  420. width: 2
  421. });
  422. var objectSymbol = new PointSymbol3D({
  423. symbolLayers: [new ObjectSymbol3DLayer({
  424. width: 2,
  425. height: 3,
  426. resource: {
  427. primitive: "cone"
  428. },
  429. material: {
  430. color: "#FFD700"
  431. }
  432. })]
  433. });
  434. var objectSymbolRenderer = new SimpleRenderer({
  435. symbol: objectSymbol
  436. });
  437. //graphicsLayer.renderer = objectSymbolRenderer;
  438. queryTask.execute(query).then(function (results) {
  439. array.forEach(results.features, function (graphic, i) {
  440. var graphic2;
  441. var point2;
  442. switch (graphic.geometry.type) {
  443. case "point":
  444. {
  445. graphic.geometry.z = 1000;
  446. graphic.symbol = defaultPointSymbol;
  447. break;
  448. }
  449. case "polyline":
  450. var geo = Polyline(graphic.geometry);
  451. geo.hasZ = true;
  452. geo.hasM = false;
  453. var paths = geo.paths;
  454. for (var i = 0; i < paths.length; i++) {
  455. for (var j = 0; j < paths[i].length; j++) {
  456. paths[i][j] = [paths[i][j][0], paths[i][j][1], 50];
  457. }
  458. var middleNumber = Math.floor(paths[i].length / 2);
  459. point2 = new Point({
  460. x: paths[i][middleNumber][0],
  461. y: paths[i][middleNumber][1],
  462. z: 50,
  463. spatialReference: view.spatialReference
  464. });
  465. }
  466. graphic.symbol = defaultLineSymbol;
  467. graphic.geometry = geo;
  468. graphic2 = new Graphic();
  469. graphic2.attributes = graphic.attributes;
  470. graphic2.geometry = point2;
  471. graphic2.symbol = objectSymbol;
  472. graphic2.attributes = graphic.attributes;
  473. graphic2.popupTemplate = layerinfo.popupTemplate;
  474. graphic.popupTemplate = new PopupTemplate({
  475. title: "HANDLE号:{HANDLE号}"
  476. });
  477. break;
  478. }
  479. GraphicsLayer_myLayer.add(graphic);
  480. GraphicsLayer_myLayer.add(graphic2);
  481. });
  482. });
  483. })
  484. }
  485. var laylistshow=0;
  486. function layerOnOff() {
  487. if(laylistshow==0){
  488. laylistshow=1;
  489. m_view.ui.add(layerList, {
  490. position: "bottom-right"
  491. });
  492. }
  493. else
  494. {
  495. laylistshow=0;
  496. m_view.ui.remove(layerList);
  497. }
  498. }
  499. function doSetExtent(num) {
  500. var xmin,ymin,xmax,ymax;
  501. switch(num){
  502. case 1:
  503. xmin=-17221.816;
  504. ymin=-5450.66;
  505. xmax=-15189.445;
  506. ymax=-4297.402;
  507. break;
  508. case 2:
  509. xmin=-25930.782;
  510. ymin=-10527.042;
  511. xmax=-5599.259;
  512. ymax=647.995;
  513. break;
  514. case 3:
  515. xmin=-89836.648;
  516. ymin=-56485.216;
  517. xmax=70797.201;
  518. ymax=31738.557;
  519. break;
  520. }
  521. setExtent(xmin,ymin,xmax,ymax);
  522. }
  523. var myAttribute,myToolTip,myImgUrl,myImgWidth,myImgHeight;
  524. function setPointBylonlat(x,y,Attribute,ToolTip,ImgUrl,ImgWidth,ImgHeight){
  525. myAttribute = Attribute;
  526. myToolTip = ToolTip;
  527. myImgUrl = ImgUrl;
  528. myImgWidth = ImgWidth;
  529. myImgHeight = ImgHeight;
  530. var url = GetConfigDataByName("WebServiceConvertCoordinateURL");
  531. WsCommonClass("ConvertLonLatToXY",["lon","lat"],[x,y],getXYbylonlat,null,url);
  532. }
  533. function getXYbylonlat(evt){
  534. if(evt[0] == null) {
  535. console.log("经纬度转换失败 error");
  536. return;
  537. }
  538. // console.log(evt[0].textContent);
  539. var point = evt[0].textContent;
  540. var jsonStr = '{"ExChangeRoot": {"Features": [' +
  541. ' { "type": "point", "featureName": "兴趣点", "Feature":[ { "Geometry": { "Points":[ { "Point": "'+point+'" } ]},' +
  542. '"Attribute": '+myAttribute+', "ToolTip": "'+myToolTip+'",' +
  543. '"ImgUrl":"'+myImgUrl +'" ,"ImgWidth":"'+ myImgWidth +'","ImgHeight":"'+myImgHeight +'" } ] } ]}}';
  544. doGetGraphicByJson(jsonStr,false);
  545. console.log(jsonStr)
  546. }
  547. function setPointBylonlatForGrid(x,y){
  548. var url = GetConfigDataByName("WebServiceConvertCoordinateURL");
  549. WsCommonClass("ConvertLonLatToXY",["lon","lat"],[x,y],getXYbylonlatforGrid,null,url);
  550. }
  551. function getXYbylonlatforGrid(evt){
  552. if(evt[0] == null) {
  553. console.log("经纬度转换失败 error");
  554. return;
  555. }
  556. // console.log(evt[0].textContent);
  557. var point = evt[0].textContent;
  558. identifyTask(point,identifyTaskcallbackfun);
  559. }
  560. function identifyTaskcallbackfun(results){
  561. window.parent.postMessage(
  562. {
  563. method: "identifyTaskcallbackfun",
  564. data: [results]
  565. },
  566. '*'
  567. );
  568. }
  569. function setPointBylonlatForAddress(x,y){
  570. var url = GetConfigDataByName("WebServiceConvertCoordinateURL");
  571. WsCommonClass("ConvertLonLatToXY",["lon","lat"],[x,y],getXYbylonlatforAddress,null,url);
  572. }
  573. function getXYbylonlatforAddress(evt){
  574. if(evt[0] == null) {
  575. console.log("经纬度转换失败 error");
  576. return;
  577. }
  578. // console.log(evt[0].textContent);
  579. var point = evt[0].textContent;
  580. var url = GetConfigDataByName("WebServiceExtraURL");
  581. WsCommonClass("GetAddress",["x","y"],[point.split(',')[0],point.split(',')[1]],getAddressCallback,null,url);
  582. }
  583. function getAddressCallback(evt){
  584. if(evt[0] == null) {
  585. console.log("经纬度转换失败 error");
  586. return;
  587. }
  588. var address = evt[0].textContent;
  589. window.parent.postMessage(
  590. {
  591. method: "addressdataCallback",
  592. data: [address]
  593. },
  594. '*'
  595. );
  596. }
  597. var m_radius;
  598. var m_layername;
  599. var m_showGraphic;
  600. function setPointBylonlatForGetBuffer(x,y,layername,radius,isshow,isGoTo){
  601. m_radius = radius;
  602. m_layername = layername;
  603. m_showGraphic = isshow;
  604. var url = GetConfigDataByName("WebServiceConvertCoordinateURL");
  605. WsCommonClass("ConvertLonLatToXY",["lon","lat"],[x-0,y-0],getXYbylonlatforBuffer,isGoTo,url);
  606. }
  607. function getXYbylonlatforBuffer(evt,isGoTo){
  608. if(evt[0] == null) {
  609. console.log("经纬度转换失败 error");
  610. return;
  611. }
  612. var point = evt[0].textContent;
  613. // var buffer = getBufferByPoint(point.split(',')[0],point.split(',')[1],m_radius);
  614. getBufferByPoint(point.split(',')[0],point.split(',')[1],m_radius,m_layername,m_showGraphic,isGoTo);
  615. //m_layername;
  616. // queryByGeometryAndLayer(buffer,m_layername);
  617. }
  618. function getGridGeometry(grid,layername){
  619. getGridGeometryByGridID(grid,layername);
  620. }
  621. function setPointBylonlatForSetCenter(x,y){
  622. var url = GetConfigDataByName("WebServiceConvertCoordinateURL");
  623. WsCommonClass("ConvertLonLatToXY",["lon","lat"],[x-0,y-0],getPointBylonlatForSetCenterr,null,url);
  624. }
  625. function getPointBylonlatForSetCenterr(evt){
  626. if(evt[0] == null) {
  627. console.log("经纬度转换失败 error");
  628. return;
  629. }
  630. var point = evt[0].textContent;
  631. m_view.center.x = point.split(',')[0]-0;
  632. m_view.center.y = point.split(',')[1]-0;
  633. m_view.goTo({
  634. target: m_view.center
  635. });
  636. // m_view.center = [point.split(',')[0]-0,point.split(',')[1]-0];
  637. }
  638. var callMeasureLengthfun;
  639. function MeasureLengthByPoint(x,y,x1,y1,fun){
  640. callMeasureLengthfun = fun;
  641. var url = GetConfigDataByName("WebServiceConvertCoordinateURL");
  642. var sql="121,31;121,31.1";
  643. sql = x+","+y+";"+x1+","+y1;
  644. WsCommonClass("ConvertLonLatToXYMass",["lonAndLatGroup"],[sql],getXYbylonlatMass,null,url);
  645. }
  646. function getXYbylonlatMass(evt){
  647. console.log(evt[0].textContent);
  648. var points = evt[0].textContent.split(';');
  649. var x = points[0].split(',')[0];
  650. var y = points[0].split(',')[1];
  651. var x1 = points[1].split(',')[0];
  652. var y1 = points[1].split(',')[1];
  653. var len = measurePolylineByPoint(x,y,x1,y1);
  654. // parent.eval(callMeasureLengthfun+"("+ len+")");
  655. window.parent.postMessage(
  656. {
  657. method: callMeasureLengthfun,
  658. data: [len]
  659. },
  660. '*'
  661. );
  662. }
  663. function getXYbyAddress(str){
  664. var url = GetConfigDataByName("WebServiceExtraURL");
  665. WsCommonClass("GetStreetInfo",["address"],[str],getXYbyAddressCallback,null,url);
  666. }
  667. function getXYbyAddressCallback(evt){
  668. if(evt[0] == null) {
  669. console.log("error");
  670. return;
  671. }
  672. window.parent.postMessage(
  673. {
  674. method: "XYbyAddressCallback",
  675. data:[JSON.stringify(evt[0].textContent).replace(/\"/g,'"')]
  676. },
  677. '*'
  678. );
  679. }
  680. </script>
  681. </head>
  682. <body>
  683. <select></select>
  684. <div id="mapDiv">
  685. <!--<div id="viewTest">-->
  686. <!--<button onclick="layerOnOff();">图层开关</button>-->
  687. <!--</div>-->
  688. </div>
  689. <div id="infoDialog" style="float: right" title="详细信息">
  690. <div id="divShowResult"></div>
  691. </div>
  692. </body>
  693. </html>