{"id":304,"date":"2014-12-02T02:27:05","date_gmt":"2014-12-01T18:27:05","guid":{"rendered":"http:\/\/www.hightopo.com\/blog\/?p=304"},"modified":"2014-12-02T03:02:05","modified_gmt":"2014-12-01T19:02:05","slug":"ht-for-web%e6%95%b4%e5%90%88openlayers%e5%ae%9e%e7%8e%b0gis%e5%9c%b0%e5%9b%be%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.hightopo.com\/blog\/304.html","title":{"rendered":"HT for Web\u6574\u5408OpenLayers\u5b9e\u73b0GIS\u5730\u56fe\u5e94\u7528"},"content":{"rendered":"<p><a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4f5c\u4e3a\u903b\u8f91\u62d3\u6251\u56fe\u5f62\u7ec4\u4ef6\u81ea\u8eab\u6ca1\u6709GIS\u529f\u80fd\uff0c\u4f46\u53ef\u4ee5\u4e0e\u5404\u79cdGIS\u5f15\u64ce\u5373\u5176\u5ba2\u6237\u7aef\u7ec4\u4ef6\u8fdb\u884c\u878d\u5408\uff0c\u5404\u53d6\u6240\u957f\u5b9e\u73b0\u903b\u8f91\u62d3\u6251\u548c\u7269\u7406\u62d3\u6251\u7684\u65e0\u7f1d\u878d\u5408\uff0c\u672c\u7ae0\u5c06\u5177\u4f53\u4ecb\u7ecd<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4e0e\u5f00\u53d1\u514d\u8d39\u7684<a href=\"http:\/\/openlayers.org\/\">OpenLayers<\/a>\u5730\u56fe\u7ed3\u5408\u5e94\u7528\u7684\u5173\u952e\u6280\u672f\u70b9\uff0c\u8be5\u6587\u4ecb\u7ecd\u7684\u7ed3\u5408\u7684\u539f\u7406\uff0c\u5176\u5b9e\u8fd8\u53ef\u63a8\u5e7f\u5230\u4e0eArcGIS\u3001\u767e\u5ea6\u5730\u56fe\u4ee5\u53caGoogleMap\u7b49\u4f17\u591aGIS\u5730\u56fe\u5f15\u64ce\u878d\u5408\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-306\" alt=\"Screen Shot 2014-12-02 at 1.15.33 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1.png\" width=\"700\" height=\"473\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1-300x202.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1-200x135.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>\u4ee5\u4e0a\u6293\u56fe\u4e3a\u672c\u6587\u4ecb\u7ecd\u7684\u4f8b\u5b50\u6700\u7ec8\u8fd0\u884c\u6548\u679c\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u4e00\u6b65\u6b65\u6765\u5b9e\u73b0\uff0c\u9996\u9009\u663e\u793a\u5730\u56fe\u4fe1\u606f\u9700\u8981\u6709\u57ce\u5e02\u7ecf\u7eac\u5ea6\u6570\u636e\uff0c\u641c\u7d22\u4e86\u4e0b<a href=\"http:\/\/www.cnblogs.com\/zhangqs008\/archive\/2011\/05\/09\/2341138.html\">\u611f\u8c22\u6b64\u7bc7\u535a\u5ba2\u63d0\u4f9b\u7684\u6570\u636e<\/a>\u3002\u8fd9\u4e48\u5927\u91cf\u7684\u6570\u636e\u6211\u91c7\u7528\u7684\u662f\u300a<a href=\"http:\/\/www.hightopo.com\/blog\/229.html\">HT\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u4e4b\u9053\uff08\u56db\uff09<\/a>\u300b\u4e2d\u4ecb\u7ecd\u7684getRawText\u51fd\u6570\u65b9\u5f0f\uff0c\u6709\u4e86\u6570\u636e\u4e4b\u540e\u5269\u4e0b\u5c31\u662f\u5448\u73b0\u7684\u95ee\u9898\u4e86\uff0c\u6211\u4eec\u9700\u8981\u5c06<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684GraphView\u7ec4\u4ef6\u4e0eOpenLayers\u7684map\u5730\u56fe\u7ec4\u4ef6\u53e0\u52a0\u5728\u4e00\u8d77\uff0c\u4e5f\u5c31\u662f<a href=\"http:\/\/openlayers.org\/\">OpenLayers<\/a>\u7684tile\u5730\u56fe\u56fe\u7247\u5728\u4e0b\u65b9\uff0cGraphView\u7684\u7ec4\u4ef6\u5728\u4e0a\u65b9\uff0c\u7531\u4e8eGraphView\u9ed8\u8ba4\u662f\u900f\u660e\u7684\uff0c\u56e0\u6b64\u975e\u56fe\u5143\u90e8\u5206\u7528\u6237\u53ef\u7a7f\u900f\u770b\u5230\u5730\u56fe\u5185\u5bb9\u3002\u627e\u5230\u5408\u9002\u7684\u7ec4\u4ef6\u63d2\u5165\u4f4d\u7f6e\u662f\u5934\u75bc\u7684\u4e8b\u60c5\uff0cArcGIS\u3001\u767e\u5ea6\u5730\u56fe\u5305\u62ecGoogleMap\u51e0\u4e4e\u6bcf\u4e2a\u4e0d\u540c\u7684GIS\u7ec4\u4ef6\u90fd\u9700\u8981\u5c1d\u8bd5\u4e00\u756a\u624d\u80fd\u627e\u5230\u5408\u9002\u7684\u63d2\u5165\u4f4d\u7f6e\uff0c\u5176\u4ed6GIS\u5f15\u64ce\u7ec4\u4ef6\u7684\u6574\u5408\u4ee5\u540e\u7ae0\u8282\u518d\u4ecb\u7ecd\uff0c\u672c\u6587\u6211\u4eec\u5173\u6ce8\u7684OpenLayers\u7684\u63d2\u5165\u65b9\u5f0f\u4e3amap.viewPortDiv.appendChild(graphView.getView())\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u548cOpenLayers\u7ec4\u4ef6\u53e0\u52a0\u5728\u4e00\u8d77\u4e4b\u540e\uff0c\u5269\u4e0b\u5c31\u662f\u62d3\u6251\u91cc\u9762\u56fe\u5143\u7684\u6446\u653e\u4f4d\u7f6e\u4e0e\u7ecf\u7eac\u5ea6\u7ed3\u5408\u7684\u95ee\u9898\uff0c\u5e38\u89c4\u7f51\u7edc\u62d3\u6251\u56fe\u4e2d\u5b58\u50a8\u5728ht.Node\u56fe\u5143\u7684position\u662f\u903b\u8f91\u4f4d\u7f6e\uff0c\u548c\u7ecf\u7eac\u5ea6\u6ca1\u6709\u4efb\u4f55\u5173\u7cfb\uff0c\u56e0\u6b64\u5728GIS\u5e94\u7528\u4e2d\u6211\u4eec\u9700\u8981\u6839\u636e\u56fe\u5143\u7684\u7ecf\u7eac\u5ea6\u4fe1\u606f\u6362\u7b97\u51faposition\u7684\u5c4f\u5e55\u903b\u8f91\u5750\u6807\u4fe1\u606f\uff0c\u5982\u679c\u4f60\u77e5\u9053\u6295\u5f71\u7b97\u6cd5\u4e5f\u53ef\u4ee5\u81ea\u5df1\u63d0\u4f9b\u51fd\u6570\u5904\u7406\uff0c\u4f46\u6240\u6709GIS\u7ec4\u4ef6\u90fd\u63d0\u4f9b\u4e86\u7c7b\u4f3c\u7684API\u51fd\u6570\u4f9b\u8c03\u7528\uff0c\u5f53\u7136\u8fd9\u90e8\u5206\u4e5f\u6ca1\u6709\u6807\u51c6\u5316\uff0c\u4e0d\u540c\u7684GIS\u7ec4\u4ef6\u9700\u8981\u8c03\u7528\u7684API\u90fd\u6709\u5dee\u5f02\uff0c\u4f46\u57fa\u672c\u539f\u7406\u662f\u4e00\u81f4\u7684\uff0c\u5bf9\u4e8eOpenLayers\u6211\u4eec\u901a\u8fc7map.getPixelFromLonLat(data.lonLat)\u53ef\u4ee5\u5c06\u7ecf\u7eac\u5ea6\u4fe1\u606f\u8f6c\u6362\u6210\u5c4f\u5e55\u50cf\u7d20\u903b\u8f91\u5750\u6807\uff0c\u4e5f\u5c31\u662fht.Node\u9700\u8981\u7684position\u5750\u6807\u4fe1\u606f\u3002<\/p>\n<p>\u7ec6\u5fc3\u7684\u540c\u5b66\u4f1a\u60f3\u5230\u8f6c\u6362\u662f\u53cc\u5411\u7684\uff0c\u6709\u53ef\u80fd\u7528\u6237\u9700\u8981\u62d6\u52a8\u56fe\u5143\u8282\u70b9\u6539\u53d8\u5176\u7ecf\u7eac\u5ea6\u4fe1\u606f\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u5c31\u9700\u8981\u53e6\u5916\u4e00\u4e2a\u65b9\u5411\u51fd\u6570\uff0c\u5373\u6839\u636e\u5c4f\u5e55\u903b\u8f91\u5750\u6807\u8f6c\u6362\u6210\u5f53\u524d\u5750\u6807\u5bf9\u5e94\u7684\u7ecf\u7eac\u5ea6\uff0c\u5728OpenLayers\u4e2d\u6211\u4eec\u901a\u8fc7map.getLonLatFromPixel(new OpenLayers.Pixel(x, y));\u53ef\u4ee5\u641e\u5b9a\u3002<\/p>\n<p>\u663e\u793a\u641e\u5b9a\u540e\u5269\u4e0b\u5c31\u662f\u4ea4\u4e92\u7684\u95ee\u9898\u4e86\uff0c<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u81ea\u5df1\u6709\u5957\u4ea4\u4e92\u4f53\u7cfb\uff0cOpenLayers\u4e5f\u9700\u8981\u5730\u56fe\u6f2b\u6e38\u548c\u7f29\u653e\u7684\u4ea4\u4e92\uff0c\u4e24\u8005\u5982\u4f55\u7ed3\u5408\u5462\uff1f\u5982\u679c\u80fd\u4fdd\u7559\u4f4f\u4e24\u8005\u7684\u529f\u80fd\u90a3\u5c31\u6700\u597d\u4e86\uff0c\u7b54\u6848\u65f6\u80af\u5b9a\u7684\uff0c\u6211\u4eec\u53ea\u9700\u8981\u6dfb\u52a0mousedown\u6216touchstart\u4e8b\u4ef6\u76d1\u542c\uff0c\u5982\u679cgraphView.getDataAt(e)\u9009\u4e2d\u4e86\u56fe\u5143\u6211\u4eec\u5c31\u901a\u8fc7e.stopPropagation();\u505c\u6b62\u4e8b\u4ef6\u7684\u4f20\u64ad\uff0c\u8fd9\u6837map\u5730\u56fe\u5c31\u4e0d\u4f1a\u54cd\u5e94\uff0c\u8fd9\u65f6\u5019<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u63a5\u7ba1\u4e86\u4ea4\u4e92\uff0c\u5982\u679c\u6ca1\u6709\u9009\u4e2d\u56fe\u5143\u5219map\u63a5\u7ba1\u5730\u56fe\u64cd\u4f5c\u7684\u4ea4\u4e92\u3002<\/p>\n<p>\u4ee5\u4e0a\u4ea4\u4e92\u8bbe\u8ba1\u4f3c\u4e4e\u5f88\u5b8c\u7f8e\u4e86\uff0c\u7ed3\u679c\u8fd0\u884c\u65f6\u53d1\u73b0\u4e86\u51e0\u5904\u6298\u817e\u4e86\u6211\u5f88\u4e45\u624d\u627e\u5230\u89e3\u51b3\u65b9\u6848\u7684\u5751\uff1a<\/p>\n<ol>\n<li>\u8bbe\u7f6emap.events.fallThrough = true;\u5426\u5219map\u4e0d\u4f1a\u5c06\u4e8b\u4ef6\u900f\u4f20\u5230<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684GraphView\u7ec4\u4ef6<\/li>\n<li>graphView.getView().style.zIndex = 999; \u9700\u8981\u6307\u5b9a\u4e00\u5b9a\u7684zIndex\u5426\u5219\u4f1a\u88ab\u906e\u6321<\/li>\n<li>graphView.getView().className = &#8216;olScrollable&#8217;; \u5426\u5219\u6eda\u8f6e\u4e0d\u4f1a\u54cd\u5e94\u5730\u56fe\u7f29\u653e<\/li>\n<li>\u8bbe\u7f6eht.Default.baseZIndex: 1000 \u5426\u5219ToolTip\u4f1a\u88ab\u906e\u6321<\/li>\n<\/ol>\n<p>\u4e3a\u4e86\u8ba9\u8fd9\u4e2a\u4f8b\u5b50\u7528\u6237\u4f53\u9a8c\u66f4\u53cb\u597d\uff0c\u6211\u8fd8\u7528\u5fc3\u6298\u817e\u4e86\u4e9b\u6280\u672f\u70b9\u4f9b\u53c2\u8003\uff1a<\/p>\n<ol>\n<li>\u91c7\u7528\u5f00\u6e90\u514d\u8d39\u7684<a href=\"http:\/\/llllll.li\/randomColor\/\">http:\/\/llllll.li\/randomColor\/<\/a>\u968f\u673a\u989c\u8272\u7c7b\u5e93\uff0c\u8be5\u7c7b\u5e93\u8fd8\u6709\u5f88\u591a\u975e\u5e38\u68d2\u7684\u989c\u8272\u83b7\u53d6\u51fd\u6570\uff0c\u6211\u53ea\u662f\u7b80\u5355\u7684\u4e3a\u6bcf\u4e2a\u7701\u4efd\u663e\u793a\u4e0d\u4e00\u6837\u7684\u989c\u8272<\/li>\n<li>\u91cd\u8f7d\u4e86isVisible\u3001isNoteVisible\u548cisLabelVisible\u4ec5\u5728\u7f29\u653e\u8fbe\u5230\u4e00\u5b9a\u7ea7\u522b\u624d\u663e\u793a\u66f4\u8be6\u7ec6\u7684\u5185\u5bb9\uff0c\u5426\u5219\u7f29\u5c0f\u65f6\u6240\u6709\u57ce\u5e02\u4fe1\u606f\u90fd\u663e\u793a\u5b8c\u5168\u65e0\u6cd5\u67e5\u770b\uff0c\u591a\u5c11\u4e5f\u80fd\u63d0\u9ad8\u663e\u793a\u6027\u80fd<\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u4e3a\u6700\u7ec8\u6548\u679c\u7684\u6293\u56fe\u3001\u89c6\u9891\u548c\u6e90\u4ee3\u7801\uff1a<\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XODM5Njk0NTU2\" height=\"498\" width=\"510\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-307\" alt=\"Screen Shot 2014-12-02 at 1.15.33 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2.png\" width=\"700\" height=\"473\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2-300x202.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2-200x135.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a> <a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-308\" alt=\"Screen Shot 2014-12-02 at 1.16.18 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM.png\" width=\"700\" height=\"473\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM-300x202.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM-200x135.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a> <a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-309\" alt=\"Screen Shot 2014-12-02 at 1.16.47 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM.png\" width=\"700\" height=\"470\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM-300x201.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM-200x134.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a> <a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-310\" alt=\"Screen Shot 2014-12-02 at 1.17.30 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM.png\" width=\"700\" height=\"470\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM-300x201.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM-200x134.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<pre class=\"&quot;brush:javascript\u201d\">function init(){                \r\n\tgraphView = new ht.graph.GraphView();\r\n\tvar view = graphView.getView();                 \r\n\r\n\tmap = new OpenLayers.Map(\"map\");\r\n\tvar ol_wms = new OpenLayers.Layer.WMS(\r\n\t\t\"OpenLayers WMS\",\r\n\t\t\"http:\/\/vmap0.tiles.osgeo.org\/wms\/vmap0\",\r\n\t\t{layers: \"basic\"}\r\n\t);\r\n\tmap.addLayers([ol_wms]);\r\n\tmap.addControl(new OpenLayers.Control.LayerSwitcher());\r\n\tmap.zoomToMaxExtent();                \r\n\tmap.events.fallThrough = true;\r\n\r\n\tmap.zoomToProxy = map.zoomTo;\r\n\tmap.zoomTo =  function (zoom,xy){\r\n\t\tview.style.opacity = 0;\r\n\t\tmap.zoomToProxy(zoom, xy);    \r\n\t\tconsole.log(zoom);\r\n\t};                \r\n\r\n\tmap.events.register(\"movestart\", this, function() {\r\n\t});\r\n\tmap.events.register(\"move\", this, function() {                   \r\n\t});\r\n\tmap.events.register(\"moveend\", this, function() {\r\n\t\tview.style.opacity = 1;\r\n\t\treset();\r\n\t});                \r\n\r\n\tgraphView.getView().className = 'olScrollable';\r\n\tgraphView.setScrollBarVisible(false);\r\n\tgraphView.setAutoScrollZone(-1);\r\n\tgraphView.handleScroll = function(){};\r\n\tgraphView.handlePinch = function(){};     \r\n\tgraphView.mi(function(e){\r\n\t\tif(e.kind === 'endMove'){\r\n\t\t\tgraphView.sm().each(function(data){\r\n\t\t\t\tif(data instanceof ht.Node){\r\n\t\t\t\t   var position = data.getPosition(),\r\n\t\t\t\t\t   x = position.x + graphView.tx(),\r\n\t\t\t\t\t   y = position.y + graphView.ty();  \r\n\r\n\t\t\t\t   data.lonLat = map.getLonLatFromPixel(new OpenLayers.Pixel(x, y));                                                                     \r\n\t\t\t\t}                            \r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\tgraphView.enableToolTip();\r\n\tgraphView.getToolTip = function(event){\r\n\t\tvar data = this.getDataAt(event);\r\n\t\tif(data){\r\n\t\t\treturn '\u57ce\u5e02\uff1a' + data.s('note') + '\r\n\u7ecf\u5ea6\uff1a' + data.lonLat.lon + '\r\n\u7ef4\u5ea6\uff1a' + data.lonLat.lat;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\tgraphView.isVisible = function(data){\r\n\t\treturn map.zoom &gt; 1 || this.isSelected(data);\r\n\t};\r\n\tgraphView.isNoteVisible = function(data){\r\n\t\treturn map.zoom &gt; 6 || this.isSelected(data);\r\n\t}; \r\n\tgraphView.getLabel = function(data){\r\n\t\treturn '\u7ecf\u5ea6\uff1a' + data.lonLat.lon + '\\n\u7ef4\u5ea6\uff1a' + data.lonLat.lat;\r\n\t};\r\n\tgraphView.isLabelVisible = function(data){\r\n\t\treturn map.zoom &gt; 7 || this.isSelected(data);\r\n\t};                 \r\n\r\n\tview.addEventListener(\"ontouchend\" in document ? 'touchstart' : 'mousedown', function(e){\r\n\t\tvar data = graphView.getDataAt(e);\r\n\t\tif(data || e.metaKey || e.ctrlKey){\r\n\t\t\te.stopPropagation();\r\n\t\t}                      \r\n\t}, false); \r\n\tview.style.position = 'absolute';\r\n\tview.style.top = '0';\r\n\tview.style.left = '0';\r\n\tview.style.right = '0';\r\n\tview.style.bottom = '0';                \r\n\tview.style.zIndex = 999;\r\n\tmap.viewPortDiv.appendChild(view);\r\n\r\n\tvar color = randomColor();\r\n\tlines = china.split('\\n');\r\n\tfor(var i=0; i&lt;lines.length; i++) {\r\n\t\tline = lines[i].trim();\r\n\t\tif(line.indexOf('\u3010') === 0){\r\n\t\t\t\/\/province = line.substring(1, line.length-1);                \r\n\t\t\tcolor = randomColor();\r\n\t\t}else{\r\n\t\t\tvar ss = line.split(' ');\r\n\t\t\tif(ss.length === 3){\r\n\t\t\t\tcreateNode(parseFloat(ss[1].substr(3)), parseFloat(ss[2].substr(3)), ss[0].substr(3), color);                                                      \r\n\t\t\t}\r\n\t\t}\r\n\t}                                \r\n}\r\n\r\nfunction reset(){\r\n\tgraphView.tx(0);\r\n\tgraphView.ty(0);\r\n\tgraphView.dm().each(function(data){                    \r\n\t\tif(data.lonLat){                            \r\n\t\t\tdata.setPosition(map.getPixelFromLonLat(data.lonLat));                           \r\n\t\t}\r\n\t});\r\n\tgraphView.validate();\r\n}\r\n\r\nfunction createNode(lon, lat, name, color){\r\n\tvar node = new ht.Node();\r\n\tnode.s({\r\n\t\t'shape': 'circle',\r\n\t\t'shape.background': color,\r\n\t\t'note': name,                    \r\n\t\t'label.background': 'rgba(255, 255, 0, 0.5)',                    \r\n\t\t'select.type': 'circle'\r\n\t});\r\n\tnode.setSize(10, 10);\r\n\tvar lonLat = new OpenLayers.LonLat(lon, lat);\r\n\tlonLat.transform('EPSG:4326', map.getProjectionObject());\r\n\tnode.setPosition(map.getPixelFromLonLat(lonLat));\r\n\tnode.lonLat = lonLat;\r\n\tgraphView.dm().add(node);\r\n\treturn node;\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4f5c\u4e3a\u903b\u8f91\u62d3\u6251\u56fe\u5f62\u7ec4\u4ef6\u81ea\u8eab\u6ca1\u6709GIS\u529f\u80fd\uff0c\u4f46\u53ef\u4ee5\u4e0e\u5404\u79cdGIS\u5f15\u64ce\u5373\u5176\u5ba2\u6237\u7aef\u7ec4\u4ef6\u8fdb\u884c\u878d\u5408\uff0c\u5404\u53d6\u6240\u957f\u5b9e\u73b0\u903b\u8f91\u62d3\u6251\u548c\u7269\u7406\u62d3\u6251\u7684\u65e0\u7f1d\u878d\u5408\uff0c\u672c\u7ae0\u5c06\u5177\u4f53\u4ecb\u7ecd<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4e0e\u5f00\u53d1\u514d\u8d39\u7684<a href=\"http:\/\/openlayers.org\/\">OpenLayers<\/a>\u5730\u56fe\u7ed3\u5408\u5e94\u7528\u7684\u5173\u952e\u6280\u672f\u70b9\uff0c\u8be5\u6587\u4ecb\u7ecd\u7684\u7ed3\u5408\u7684\u539f\u7406\uff0c\u5176\u5b9e\u8fd8\u53ef\u63a8\u5e7f\u5230\u4e0eArcGIS\u3001\u767e\u5ea6\u5730\u56fe\u4ee5\u53caGoogleMap\u7b49\u4f17\u591aGIS\u5730\u56fe\u5f15\u64ce\u878d\u5408\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-306\" alt=\"Screen Shot 2014-12-02 at 1.15.33 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1.png\" width=\"700\" height=\"473\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1-300x202.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM1-200x135.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>\u4ee5\u4e0a\u6293\u56fe\u4e3a\u672c\u6587\u4ecb\u7ecd\u7684\u4f8b\u5b50\u6700\u7ec8\u8fd0\u884c\u6548\u679c\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u4e00\u6b65\u6b65\u6765\u5b9e\u73b0\uff0c\u9996\u9009\u663e\u793a\u5730\u56fe\u4fe1\u606f\u9700\u8981\u6709\u57ce\u5e02\u7ecf\u7eac\u5ea6\u6570\u636e\uff0c\u641c\u7d22\u4e86\u4e0b<a href=\"http:\/\/www.cnblogs.com\/zhangqs008\/archive\/2011\/05\/09\/2341138.html\">\u611f\u8c22\u6b64\u7bc7\u535a\u5ba2\u63d0\u4f9b\u7684\u6570\u636e<\/a>\u3002\u8fd9\u4e48\u5927\u91cf\u7684\u6570\u636e\u6211\u91c7\u7528\u7684\u662f\u300a<a href=\"http:\/\/www.hightopo.com\/blog\/229.html\">HT\u56fe\u5f62\u7ec4\u4ef6\u8bbe\u8ba1\u4e4b\u9053\uff08\u56db\uff09<\/a>\u300b\u4e2d\u4ecb\u7ecd\u7684getRawText\u51fd\u6570\u65b9\u5f0f\uff0c\u6709\u4e86\u6570\u636e\u4e4b\u540e\u5269\u4e0b\u5c31\u662f\u5448\u73b0\u7684\u95ee\u9898\u4e86\uff0c\u6211\u4eec\u9700\u8981\u5c06<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684GraphView\u7ec4\u4ef6\u4e0eOpenLayers\u7684map\u5730\u56fe\u7ec4\u4ef6\u53e0\u52a0\u5728\u4e00\u8d77\uff0c\u4e5f\u5c31\u662f<a href=\"http:\/\/openlayers.org\/\">OpenLayers<\/a>\u7684tile\u5730\u56fe\u56fe\u7247\u5728\u4e0b\u65b9\uff0cGraphView\u7684\u7ec4\u4ef6\u5728\u4e0a\u65b9\uff0c\u7531\u4e8eGraphView\u9ed8\u8ba4\u662f\u900f\u660e\u7684\uff0c\u56e0\u6b64\u975e\u56fe\u5143\u90e8\u5206\u7528\u6237\u53ef\u7a7f\u900f\u770b\u5230\u5730\u56fe\u5185\u5bb9\u3002\u627e\u5230\u5408\u9002\u7684\u7ec4\u4ef6\u63d2\u5165\u4f4d\u7f6e\u662f\u5934\u75bc\u7684\u4e8b\u60c5\uff0cArcGIS\u3001\u767e\u5ea6\u5730\u56fe\u5305\u62ecGoogleMap\u51e0\u4e4e\u6bcf\u4e2a\u4e0d\u540c\u7684GIS\u7ec4\u4ef6\u90fd\u9700\u8981\u5c1d\u8bd5\u4e00\u756a\u624d\u80fd\u627e\u5230\u5408\u9002\u7684\u63d2\u5165\u4f4d\u7f6e\uff0c\u5176\u4ed6GIS\u5f15\u64ce\u7ec4\u4ef6\u7684\u6574\u5408\u4ee5\u540e\u7ae0\u8282\u518d\u4ecb\u7ecd\uff0c\u672c\u6587\u6211\u4eec\u5173\u6ce8\u7684OpenLayers\u7684\u63d2\u5165\u65b9\u5f0f\u4e3amap.viewPortDiv.appendChild(graphView.getView())\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u548cOpenLayers\u7ec4\u4ef6\u53e0\u52a0\u5728\u4e00\u8d77\u4e4b\u540e\uff0c\u5269\u4e0b\u5c31\u662f\u62d3\u6251\u91cc\u9762\u56fe\u5143\u7684\u6446\u653e\u4f4d\u7f6e\u4e0e\u7ecf\u7eac\u5ea6\u7ed3\u5408\u7684\u95ee\u9898\uff0c\u5e38\u89c4\u7f51\u7edc\u62d3\u6251\u56fe\u4e2d\u5b58\u50a8\u5728ht.Node\u56fe\u5143\u7684position\u662f\u903b\u8f91\u4f4d\u7f6e\uff0c\u548c\u7ecf\u7eac\u5ea6\u6ca1\u6709\u4efb\u4f55\u5173\u7cfb\uff0c\u56e0\u6b64\u5728GIS\u5e94\u7528\u4e2d\u6211\u4eec\u9700\u8981\u6839\u636e\u56fe\u5143\u7684\u7ecf\u7eac\u5ea6\u4fe1\u606f\u6362\u7b97\u51faposition\u7684\u5c4f\u5e55\u903b\u8f91\u5750\u6807\u4fe1\u606f\uff0c\u5982\u679c\u4f60\u77e5\u9053\u6295\u5f71\u7b97\u6cd5\u4e5f\u53ef\u4ee5\u81ea\u5df1\u63d0\u4f9b\u51fd\u6570\u5904\u7406\uff0c\u4f46\u6240\u6709GIS\u7ec4\u4ef6\u90fd\u63d0\u4f9b\u4e86\u7c7b\u4f3c\u7684API\u51fd\u6570\u4f9b\u8c03\u7528\uff0c\u5f53\u7136\u8fd9\u90e8\u5206\u4e5f\u6ca1\u6709\u6807\u51c6\u5316\uff0c\u4e0d\u540c\u7684GIS\u7ec4\u4ef6\u9700\u8981\u8c03\u7528\u7684API\u90fd\u6709\u5dee\u5f02\uff0c\u4f46\u57fa\u672c\u539f\u7406\u662f\u4e00\u81f4\u7684\uff0c\u5bf9\u4e8eOpenLayers\u6211\u4eec\u901a\u8fc7map.getPixelFromLonLat(data.lonLat)\u53ef\u4ee5\u5c06\u7ecf\u7eac\u5ea6\u4fe1\u606f\u8f6c\u6362\u6210\u5c4f\u5e55\u50cf\u7d20\u903b\u8f91\u5750\u6807\uff0c\u4e5f\u5c31\u662fht.Node\u9700\u8981\u7684position\u5750\u6807\u4fe1\u606f\u3002<\/p>\n<p>\u7ec6\u5fc3\u7684\u540c\u5b66\u4f1a\u60f3\u5230\u8f6c\u6362\u662f\u53cc\u5411\u7684\uff0c\u6709\u53ef\u80fd\u7528\u6237\u9700\u8981\u62d6\u52a8\u56fe\u5143\u8282\u70b9\u6539\u53d8\u5176\u7ecf\u7eac\u5ea6\u4fe1\u606f\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u5c31\u9700\u8981\u53e6\u5916\u4e00\u4e2a\u65b9\u5411\u51fd\u6570\uff0c\u5373\u6839\u636e\u5c4f\u5e55\u903b\u8f91\u5750\u6807\u8f6c\u6362\u6210\u5f53\u524d\u5750\u6807\u5bf9\u5e94\u7684\u7ecf\u7eac\u5ea6\uff0c\u5728OpenLayers\u4e2d\u6211\u4eec\u901a\u8fc7map.getLonLatFromPixel(new OpenLayers.Pixel(x, y));\u53ef\u4ee5\u641e\u5b9a\u3002<\/p>\n<p>\u663e\u793a\u641e\u5b9a\u540e\u5269\u4e0b\u5c31\u662f\u4ea4\u4e92\u7684\u95ee\u9898\u4e86\uff0c<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u81ea\u5df1\u6709\u5957\u4ea4\u4e92\u4f53\u7cfb\uff0cOpenLayers\u4e5f\u9700\u8981\u5730\u56fe\u6f2b\u6e38\u548c\u7f29\u653e\u7684\u4ea4\u4e92\uff0c\u4e24\u8005\u5982\u4f55\u7ed3\u5408\u5462\uff1f\u5982\u679c\u80fd\u4fdd\u7559\u4f4f\u4e24\u8005\u7684\u529f\u80fd\u90a3\u5c31\u6700\u597d\u4e86\uff0c\u7b54\u6848\u65f6\u80af\u5b9a\u7684\uff0c\u6211\u4eec\u53ea\u9700\u8981\u6dfb\u52a0mousedown\u6216touchstart\u4e8b\u4ef6\u76d1\u542c\uff0c\u5982\u679cgraphView.getDataAt(e)\u9009\u4e2d\u4e86\u56fe\u5143\u6211\u4eec\u5c31\u901a\u8fc7e.stopPropagation();\u505c\u6b62\u4e8b\u4ef6\u7684\u4f20\u64ad\uff0c\u8fd9\u6837map\u5730\u56fe\u5c31\u4e0d\u4f1a\u54cd\u5e94\uff0c\u8fd9\u65f6\u5019<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u63a5\u7ba1\u4e86\u4ea4\u4e92\uff0c\u5982\u679c\u6ca1\u6709\u9009\u4e2d\u56fe\u5143\u5219map\u63a5\u7ba1\u5730\u56fe\u64cd\u4f5c\u7684\u4ea4\u4e92\u3002<\/p>\n<p>\u4ee5\u4e0a\u4ea4\u4e92\u8bbe\u8ba1\u4f3c\u4e4e\u5f88\u5b8c\u7f8e\u4e86\uff0c\u7ed3\u679c\u8fd0\u884c\u65f6\u53d1\u73b0\u4e86\u51e0\u5904\u6298\u817e\u4e86\u6211\u5f88\u4e45\u624d\u627e\u5230\u89e3\u51b3\u65b9\u6848\u7684\u5751\uff1a<\/p>\n<ol>\n<li>\u8bbe\u7f6emap.events.fallThrough = true;\u5426\u5219map\u4e0d\u4f1a\u5c06\u4e8b\u4ef6\u900f\u4f20\u5230<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684GraphView\u7ec4\u4ef6<\/li>\n<li>graphView.getView().style.zIndex = 999; \u9700\u8981\u6307\u5b9a\u4e00\u5b9a\u7684zIndex\u5426\u5219\u4f1a\u88ab\u906e\u6321<\/li>\n<li>graphView.getView().className = &#8216;olScrollable&#8217;; \u5426\u5219\u6eda\u8f6e\u4e0d\u4f1a\u54cd\u5e94\u5730\u56fe\u7f29\u653e<\/li>\n<li>\u8bbe\u7f6eht.Default.baseZIndex: 1000 \u5426\u5219ToolTip\u4f1a\u88ab\u906e\u6321<\/li>\n<\/ol>\n<p>\u4e3a\u4e86\u8ba9\u8fd9\u4e2a\u4f8b\u5b50\u7528\u6237\u4f53\u9a8c\u66f4\u53cb\u597d\uff0c\u6211\u8fd8\u7528\u5fc3\u6298\u817e\u4e86\u4e9b\u6280\u672f\u70b9\u4f9b\u53c2\u8003\uff1a<\/p>\n<ol>\n<li>\u91c7\u7528\u5f00\u6e90\u514d\u8d39\u7684<a href=\"http:\/\/llllll.li\/randomColor\/\">http:\/\/llllll.li\/randomColor\/<\/a>\u968f\u673a\u989c\u8272\u7c7b\u5e93\uff0c\u8be5\u7c7b\u5e93\u8fd8\u6709\u5f88\u591a\u975e\u5e38\u68d2\u7684\u989c\u8272\u83b7\u53d6\u51fd\u6570\uff0c\u6211\u53ea\u662f\u7b80\u5355\u7684\u4e3a\u6bcf\u4e2a\u7701\u4efd\u663e\u793a\u4e0d\u4e00\u6837\u7684\u989c\u8272<\/li>\n<li>\u91cd\u8f7d\u4e86isVisible\u3001isNoteVisible\u548cisLabelVisible\u4ec5\u5728\u7f29\u653e\u8fbe\u5230\u4e00\u5b9a\u7ea7\u522b\u624d\u663e\u793a\u66f4\u8be6\u7ec6\u7684\u5185\u5bb9\uff0c\u5426\u5219\u7f29\u5c0f\u65f6\u6240\u6709\u57ce\u5e02\u4fe1\u606f\u90fd\u663e\u793a\u5b8c\u5168\u65e0\u6cd5\u67e5\u770b\uff0c\u591a\u5c11\u4e5f\u80fd\u63d0\u9ad8\u663e\u793a\u6027\u80fd<\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u4e3a\u6700\u7ec8\u6548\u679c\u7684\u6293\u56fe\u3001\u89c6\u9891\u548c\u6e90\u4ee3\u7801\uff1a<\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XODM5Njk0NTU2\" height=\"498\" width=\"510\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-307\" alt=\"Screen Shot 2014-12-02 at 1.15.33 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2.png\" width=\"700\" height=\"473\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2-300x202.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.15.33-AM2-200x135.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a> <a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-308\" alt=\"Screen Shot 2014-12-02 at 1.16.18 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM.png\" width=\"700\" height=\"473\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM-300x202.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.18-AM-200x135.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a> <a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-309\" alt=\"Screen Shot 2014-12-02 at 1.16.47 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM.png\" width=\"700\" height=\"470\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM-300x201.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.16.47-AM-200x134.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a> <a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-310\" alt=\"Screen Shot 2014-12-02 at 1.17.30 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM.png\" width=\"700\" height=\"470\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM.png 700w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM-300x201.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-02-at-1.17.30-AM-200x134.png 200w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<pre class=\"&quot;brush:javascript\u201d\">function init(){                \r\n\tgraphView = new ht.graph.GraphView();\r\n\tvar view = graphView.getView();                 \r\n\r\n\tmap = new OpenLayers.Map(\"map\");\r\n\tvar ol_wms = new OpenLayers.Layer.WMS(\r\n\t\t\"OpenLayers WMS\",\r\n\t\t\"http:\/\/vmap0.tiles.osgeo.org\/wms\/vmap0\",\r\n\t\t{layers: \"basic\"}\r\n\t);\r\n\tmap.addLayers([ol_wms]);\r\n\tmap.addControl(new OpenLayers.Control.LayerSwitcher());\r\n\tmap.zoomToMaxExtent();                \r\n\tmap.events.fallThrough = true;\r\n\r\n\tmap.zoomToProxy = map.zoomTo;\r\n\tmap.zoomTo =  function (zoom,xy){\r\n\t\tview.style.opacity = 0;\r\n\t\tmap.zoomToProxy(zoom, xy);    \r\n\t\tconsole.log(zoom);\r\n\t};                \r\n\r\n\tmap.events.register(\"movestart\", this, function() {\r\n\t});\r\n\tmap.events.register(\"move\", this, function() {                   \r\n\t});\r\n\tmap.events.register(\"moveend\", this, function() {\r\n\t\tview.style.opacity = 1;\r\n\t\treset();\r\n\t});                \r\n\r\n\tgraphView.getView().className = 'olScrollable';\r\n\tgraphView.setScrollBarVisible(false);\r\n\tgraphView.setAutoScrollZone(-1);\r\n\tgraphView.handleScroll = function(){};\r\n\tgraphView.handlePinch = function(){};     \r\n\tgraphView.mi(function(e){\r\n\t\tif(e.kind === 'endMove'){\r\n\t\t\tgraphView.sm().each(function(data){\r\n\t\t\t\tif(data instanceof ht.Node){\r\n\t\t\t\t   var position = data.getPosition(),\r\n\t\t\t\t\t   x = position.x + graphView.tx(),\r\n\t\t\t\t\t   y = position.y + graphView.ty();  \r\n\r\n\t\t\t\t   data.lonLat = map.getLonLatFromPixel(new OpenLayers.Pixel(x, y));                                                                     \r\n\t\t\t\t}                            \r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\tgraphView.enableToolTip();\r\n\tgraphView.getToolTip = function(event){\r\n\t\tvar data = this.getDataAt(event);\r\n\t\tif(data){\r\n\t\t\treturn '\u57ce\u5e02\uff1a' + data.s('note') + '\r\n\u7ecf\u5ea6\uff1a' + data.lonLat.lon + '\r\n\u7ef4\u5ea6\uff1a' + data.lonLat.lat;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\tgraphView.isVisible = function(data){\r\n\t\treturn map.zoom &gt; 1 || this.isSelected(data);\r\n\t};\r\n\tgraphView.isNoteVisible = function(data){\r\n\t\treturn map.zoom &gt; 6 || this.isSelected(data);\r\n\t}; \r\n\tgraphView.getLabel = function(data){\r\n\t\treturn '\u7ecf\u5ea6\uff1a' + data.lonLat.lon + '\\n\u7ef4\u5ea6\uff1a' + data.lonLat.lat;\r\n\t};\r\n\tgraphView.isLabelVisible = function(data){\r\n\t\treturn map.zoom &gt; 7 || this.isSelected(data);\r\n\t};                 \r\n\r\n\tview.addEventListener(\"ontouchend\" in document ? 'touchstart' : 'mousedown', function(e){\r\n\t\tvar data = graphView.getDataAt(e);\r\n\t\tif(data || e.metaKey || e.ctrlKey){\r\n\t\t\te.stopPropagation();\r\n\t\t}                      \r\n\t}, false); \r\n\tview.style.position = 'absolute';\r\n\tview.style.top = '0';\r\n\tview.style.left = '0';\r\n\tview.style.right = '0';\r\n\tview.style.bottom = '0';                \r\n\tview.style.zIndex = 999;\r\n\tmap.viewPortDiv.appendChild(view);\r\n\r\n\tvar color = randomColor();\r\n\tlines = china.split('\\n');\r\n\tfor(var i=0; i&lt;lines.length; i++) {\r\n\t\tline = lines[i].trim();\r\n\t\tif(line.indexOf('\u3010') === 0){\r\n\t\t\t\/\/province = line.substring(1, line.length-1);                \r\n\t\t\tcolor = randomColor();\r\n\t\t}else{\r\n\t\t\tvar ss = line.split(' ');\r\n\t\t\tif(ss.length === 3){\r\n\t\t\t\tcreateNode(parseFloat(ss[1].substr(3)), parseFloat(ss[2].substr(3)), ss[0].substr(3), color);                                                      \r\n\t\t\t}\r\n\t\t}\r\n\t}                                \r\n}\r\n\r\nfunction reset(){\r\n\tgraphView.tx(0);\r\n\tgraphView.ty(0);\r\n\tgraphView.dm().each(function(data){                    \r\n\t\tif(data.lonLat){                            \r\n\t\t\tdata.setPosition(map.getPixelFromLonLat(data.lonLat));                           \r\n\t\t}\r\n\t});\r\n\tgraphView.validate();\r\n}\r\n\r\nfunction createNode(lon, lat, name, color){\r\n\tvar node = new ht.Node();\r\n\tnode.s({\r\n\t\t'shape': 'circle',\r\n\t\t'shape.background': color,\r\n\t\t'note': name,                    \r\n\t\t'label.background': 'rgba(255, 255, 0, 0.5)',                    \r\n\t\t'select.type': 'circle'\r\n\t});\r\n\tnode.setSize(10, 10);\r\n\tvar lonLat = new OpenLayers.LonLat(lon, lat);\r\n\tlonLat.transform('EPSG:4326', map.getProjectionObject());\r\n\tnode.setPosition(map.getPixelFromLonLat(lonLat));\r\n\tnode.lonLat = lonLat;\r\n\tgraphView.dm().add(node);\r\n\treturn node;\r\n}<\/pre>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/304"}],"collection":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/comments?post=304"}],"version-history":[{"count":5,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/304\/revisions"}],"predecessor-version":[{"id":315,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/304\/revisions\/315"}],"wp:attachment":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/media?parent=304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/categories?post=304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/tags?post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}