{"id":316,"date":"2014-12-04T00:23:35","date_gmt":"2014-12-03T16:23:35","guid":{"rendered":"http:\/\/www.hightopo.com\/blog\/?p=316"},"modified":"2014-12-04T00:45:51","modified_gmt":"2014-12-03T16:45:51","slug":"%e7%99%be%e5%ba%a6%e5%9c%b0%e5%9b%be%e4%b8%8eht-for-web%e7%bb%93%e5%90%88%e7%9a%84gis%e7%bd%91%e7%bb%9c%e6%8b%93%e6%89%91%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.hightopo.com\/blog\/316.html","title":{"rendered":"\u767e\u5ea6\u5730\u56fe\u4e0eHT for Web\u7ed3\u5408\u7684GIS\u7f51\u7edc\u62d3\u6251\u5e94\u7528"},"content":{"rendered":"<p>\u5728\u300a<a href=\"http:\/\/www.hightopo.com\/blog\/304.html\">HT for Web\u6574\u5408OpenLayers\u5b9e\u73b0GIS\u5730\u56fe\u5e94\u7528<\/a>\u300b\u7bc7\u4e2d\u4ecb\u7ecd\u4e86<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4e0eOpenLayers\u7684\u6574\u5408\uff0c\u4e0d\u5c11\u670b\u53cb\u53cd\u5e94\u56fd\u5185\u7528\u5f97\u6bd4\u8f83\u591a\u7684\u8fd8\u662f<a href=\"http:\/\/developer.baidu.com\/map\/\">\u767e\u5ea6\u5730\u56fe<\/a>\uff0c\u867d\u7136<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u6574\u5408\u767e\u5ea6\u5730\u56fe\u539f\u7406\u4e0eOpenLayers\u4e00\u81f4\uff0c\u4f46\u4e0d\u540cGIS\u5f15\u64ce\u5ba2\u6237\u7aef\u7ed3\u5408\u4ee3\u7801\u7ec6\u8282\u8fd8\u662f\u6709\u4e0d\u5c11\u5dee\u5f02\uff0c\u81ea\u5b9a\u4e49\u5730\u56fe\u98ce\u683c\u66f4\u662f\u5b8c\u5168\u4e0d\u4e00\u6837\uff0c\u4e3a\u6b64\u6211\u518d\u5f00\u7bc7\u4ecb\u7ecd\u4e0b<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u4e0e\u767e\u5ea6\u5730\u56fe\u6574\u5408\u7684\u65b9\u6848\uff0c\u8fd9\u6b21\u6211\u4eec\u5c06\u6539\u8fdb\u4ee5\u524d\u7684\u4f8b\u5b50\uff0c\u9664\u4e86\u4ee3\u8868\u57ce\u5e02\u7684\u62d3\u6251\u8282\u70b9\u5916\uff0c\u518d\u589e\u52a0\u8fde\u7ebf\u8fde\u63a5\u7701\u4f1a\u548c\u57ce\u5e02\uff0c\u5b9e\u73b0\u7f51\u7edc\u62d3\u6251\u94fe\u8def\u7684\u6d41\u52a8\u6548\u679c\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-322\" alt=\"Screen Shot 2014-12-03 at 11.43.05 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM.png\" width=\"900\" height=\"562\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM.png 900w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM-300x187.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM-200x124.png 200w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><img loading=\"lazy\" class=\"alignnone size-full wp-image-317\" alt=\"Screen Shot 2014-12-03 at 11.18.02 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM.png\" width=\"910\" height=\"569\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM.png 910w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM-300x187.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM-200x125.png 200w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-318\" alt=\"Screen Shot 2014-12-03 at 11.16.55 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM.png\" width=\"872\" height=\"714\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM.png 872w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM-300x245.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM-200x163.png 200w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/a><\/p>\n<p>\u767e\u5ea6\u5730\u56fe\u6709\u591a\u79cd\u5ba2\u6237\u7aefSDK\uff0c\u6211\u4eec\u8fd9\u91cc\u7528\u7684\u81ea\u7136\u662f<a href=\"http:\/\/developer.baidu.com\/map\/\">JavaScript\u7248\u7684API<\/a>\uff0c\u767e\u5ea6\u5730\u56fe\u76842.0\u7248\u589e\u52a0\u4e86\u4e0d\u5c11\u65b0\u529f\u80fd\uff0c\u4f8b\u5982\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5730\u56fe\u6837\u5f0f\u6a21\u677f\uff0c\u672c\u4f8b\u4e2d\u6211\u4eec\u7279\u610f\u8bbe\u7f6e\u6210style:&#8217;midnight&#8217;\u7684\u6df1\u8272\u80cc\u666f\u98ce\u683c\u3002\u63d2\u5165map\u7684\u4f4d\u7f6e\u4e0eOpenLayers\u4e5f\u4e0d\u4e00\u6837\uff0c\u901a\u8fc7mapDiv.firstChild.firstChild.appendChild(view);\u63d2\u5165\uff0czIndex\u8fd9\u4e9b\u5c5e\u6027\u90fd\u8fd8\u597d\u4e0d\u9700\u8981\u8bbe\u7f6e\u3002<\/p>\n<p>\u5750\u6807\u8f6c\u6362\u65b9\u9762\u4ece\u7ecf\u7eac\u5ea6\u8f6c\u6362\u6210\u5e73\u9762\u5750\u6807\u662fmap.pointToPixel\u51fd\u6570\uff0c\u901a\u8fc7node.setPosition(map.pointToPixel(new BMap.Point(lon, lat)));\u53ef\u8bbe\u7f6eht.Node\u5bf9\u5e94\u7684\u5e73\u9762\u903b\u8f91\u5750\u6807\uff0c\u901a\u8fc7map.pixelToPoint(new BMap.Pixel(x,y))\u53ef\u5c06\u5e73\u9762\u5750\u6807\u8f6c\u6362\u6210\u7ecf\u7eac\u5ea6\u5750\u6807\uff0c\u6211\u4eec\u5728\u76d1\u542c\u8282\u70b9\u56fe\u5143\u88ab\u62d6\u62fd\u7ed3\u675f\u7684endMove\u9700\u8981\u91cd\u65b0\u8ba1\u7b97\u5f53\u524d\u4f4d\u7f6e\u7684\u7ecf\u7eac\u5ea6\u65f6\u7528\u5230\u3002<\/p>\n<p>\u5730\u56fe\u6570\u636e\u65b9\u9762\u6bcf\u4e2a\u7701\u7684\u7701\u4f1a\u57ce\u5e02\u90fd\u662f\u7b2c\u4e00\u4e2a\u51fa\u73b0\uff0c\u56e0\u6b64\u6211\u4eec\u6784\u5efa\u4e86size\u5927\u4e00\u70b9\u7684\u5e26\u6e10\u8fdb\u8272\u7684\u56fe\u5143\u4ee3\u8868\u7701\u4f1a\u57ce\u5e02\uff0c\u5176\u4ed6\u57ce\u5e02\u6784\u5efa\u65f6\u540c\u65f6\u6784\u5efaht.Edge\u7684\u8fde\u7ebf\u4e0e\u7701\u4f1a\u8282\u70b9\u8fde\u63a5\uff0c\u540c\u65f6\u5f15\u5165<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">ht-flow.js<\/a>\u63d2\u4ef6\uff0c\u53ea\u9700\u8981graphView.enableFlow(60);\u4e00\u53e5\u8bdd\u5c31\u53ef\u4ee5\u542f\u52a8\u6d41\u52a8\u8fde\u7ebf\u529f\u80fd\uff0c\u6bcf\u6761edge\u8fde\u7ebf\u8fd8\u53ef\u4ee5\u6709\u5f88\u591aflow.*\u76f8\u5173\u7684\u6d41\u52a8\u53c2\u8003\u53ef\u63a7\u5236\u6d41\u52a8\u6548\u679c\uff0c\u8fd9\u91cc\u7684\u7b80\u5355\u4f8b\u5b50\u6211\u4eec\u4e0d\u9700\u8981\u505a\u5b9a\u5236\uff0c\u4fdd\u6301<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u9ed8\u8ba4\u7684\u6d41\u52a8\u53c2\u6570\u5c31\u8db3\u591f\u9177\u4e86\u3002<\/p>\n<p>\u53e6\u5916\u901a\u8fc7graphView.setLayers([&#8216;edgeLayer&#8217;, &#8216;nodeLayer&#8217;]);\u6211\u4eec\u4e3a\u62d3\u6251\u8bbe\u7f6e\u4e86\u4e24\u4e2a\u5c42\uff0cnode.setLayer(&#8216;nodeLayer&#8217;);\u548cedge.setLayer(&#8216;edgeLayer&#8217;)\u4f7f\u5f97\u56fe\u5143\u8282\u70b9\u5168\u90e8\u5448\u73b0\u4e8e\u8fde\u7ebf\u4e4b\u4e0a\uff0c\u4ece\u8fd9\u4e2a\u7ec6\u8282\u5927\u5bb6\u53ef\u4ee5\u53d1\u73b0\uff0c\u4ee5\u524d\u9700\u8981\u5728GIS\u7684SDK\u6269\u5c55\u7684\u529f\u80fd\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">GraphView<\/a>\u5b9e\u73b0\uff0c\u5730\u56fe\u4ec5\u4ec5\u662f\u4f5c\u4e3a\u80cc\u666f\uff0c\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u5b8c\u5168\u5728\u66f4\u7075\u6d3b\u5f3a\u5927\u7684<a href=\"http:\/\/www.hightopo.com\/\">HT\u6a21\u578b<\/a>\u4e2d\u8fdb\u884c\u3002<\/p>\n<p>\u5176\u4ed6\u65b9\u9762\u7ec6\u8282\u8fd8\u7531\u76d1\u542cmap\u7684\u7f29\u653e\u7b49\u64cd\u4f5c\u5bf9\u62d3\u6251\u56fe\u5143\u91cd\u65b0\u5b9a\u4f4d\uff0c\u4ee5\u53ca\u76d1\u542c\u4ea4\u4e92\u51b3\u5b9aGraphView\u8fd8\u662fMap\u8fdb\u884c\u63a7\u5236\u7b49\u90fd\u4e0e\u4ee5\u524d\u7684\u6587\u7ae0\u7c7b\u4f3c\uff0c\u8fd9\u91cc\u5c31\u4e0d\u518d\u4ecb\u7ecd\u4e86\uff0c\u4ee5\u4e0b\u4e3a\u64cd\u4f5c\u89c6\u9891\u3001\u6293\u56fe\u548c\u6e90\u4ee3\u7801\u4f9b\u5927\u5bb6\u53c2\u8003\uff0c\u8fd9\u6837\u7684\u7ed3\u5408\u53ef\u5b8c\u7f8e\u7684\u5c06\u767e\u5ea6\u5730\u56fe\u4e30\u5bcc\u7684\u5730\u56fe\u6570\u636e\u4fe1\u606f\uff0c\u4e0e<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u5f3a\u5927\u7684\u903b\u8f91\u62d3\u6251\u529f\u80fd\u76f8\u7ed3\u5408\uff0c\u5426\u5219\u5149\u9760\u767e\u5ea6\u5730\u56feSDK\u7684API\u7684\u6269\u5c55\u65b9\u5f0f\uff0c\u7528\u6237\u53ea\u80fd\u505a\u4e9b\u7b80\u5355\u7684\u6548\u679c\uff0c\u4f8b\u5982\u8fde\u7ebf\u6d41\u52a8\u7b49\u6548\u679c\u90fd\u8fdc\u4e0d\u5982HT\u8fd9\u6837\u4e00\u884c\u4ee3\u7801\u5c31\u641e\u5b9a\u6765\u7684\u5bb9\u6613\u3002<a href=\"http:\/\/v.youku.com\/v_show\/id_XODQxMDcwNjQ0.html\">http:\/\/v.youku.com\/v_show\/id_XODQxMDcwNjQ0.html<\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XODQxMDcwNjQ0\" 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-03-at-11.12.43-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-320\" alt=\"Screen Shot 2014-12-03 at 11.12.43 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM.png\" width=\"900\" height=\"637\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM.png 900w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM-300x212.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM-200x141.png 200w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-319\" alt=\"Screen Shot 2014-12-03 at 9.43.40 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM.png\" width=\"911\" height=\"675\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM.png 911w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM-300x222.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM-200x148.png 200w\" sizes=\"(max-width: 911px) 100vw, 911px\" \/><\/a><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-324\" alt=\"Screen Shot 2014-12-04 at 12.31.13 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM.png\" width=\"903\" height=\"219\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM.png 903w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM-300x72.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM-200x48.png 200w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/a><\/p>\n<pre class=\"&quot;brush:javascript\u201d\">var dataModel = new ht.DataModel();\r\nvar graphView = new ht.graph.GraphView(dataModel);              \r\nvar map = null;   \r\n\r\nfunction init() {\r\n\tmap = new BMap.Map(\"map\");   \r\n\tvar point = new BMap.Point(116.404, 39.915);                          \r\n\tmap.addTileLayer(new BMap.TrafficLayer());                    \r\n\tmap.centerAndZoom(point, 4);                    \r\n\tmap.enableScrollWheelZoom();                       \r\n\tmap.addControl(new BMap.NavigationControl());                               \r\n\r\n\tmap.setMapStyle({\r\n\t\tfeatures: [\"road\", \"building\",\"water\",\"land\"],\r\n\t\tstyle:'midnight'\r\n\t});\r\n\r\n\tvar view = graphView.getView();\r\n\tview.className = 'graphView'; \r\n\tvar mapDiv = document.getElementById('map');\r\n\tmapDiv.firstChild.firstChild.appendChild(view);\r\n\r\n\tmap.addEventListener('movestart', function(e){                   \r\n\t   view.style.opacity = 0;\r\n\t});\r\n\tmap.addEventListener('moveend', function(e){\r\n\t   view.style.opacity = 1; \r\n\t   resetPosition(); \r\n\t});\r\n\tmap.addEventListener('dragstart', function(e){\r\n\t   view.style.opacity = 0;                \r\n\t});\r\n\tmap.addEventListener('dragend', function(e){\r\n\t   view.style.opacity = 1; \r\n\t   resetPosition(); \r\n\t});                                \r\n\tmap.addEventListener('zoomstart', function(e){\r\n\t\tview.style.opacity = 0;\r\n\t});                \r\n\tmap.addEventListener('zoomend', function(e){\r\n\t\tview.style.opacity = 1;    \r\n\t\tresetPosition(); \r\n\t});                \r\n\r\n\tgraphView.setLayers(['edgeLayer', 'nodeLayer']);\r\n\tgraphView.enableFlow(60);\r\n\tgraphView.enableToolTip();\r\n\tgraphView.getToolTip = function(event){\r\n\t\tvar data = this.getDataAt(event);\r\n\t\tif(data instanceof ht.Node){\r\n\t\t\treturn '\u57ce\u5e02\uff1a' + data.s('note') + '\r\n\u7ecf\u5ea6\uff1a' + data.lonLat.lng + '\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.getZoom() &gt; 1 || this.isSelected(data);\r\n\t};\r\n\tgraphView.isNoteVisible = function(data){\r\n\t\treturn map.getZoom() &gt; 8 || this.isSelected(data);\r\n\t}; \r\n\tgraphView.getLabel = function(data){\r\n\t\tif(data instanceof ht.Node){\r\n\t\t\treturn '\u7ecf\u5ea6\uff1a' + data.lonLat.lng + '\\n\u7ef4\u5ea6\uff1a' + data.lonLat.lat;\r\n\t\t}                    \r\n\t};\r\n\tgraphView.isLabelVisible = function(data){\r\n\t\treturn map.getZoom() &gt; 9 || this.isSelected(data);\r\n\t}; \r\n\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\t\t\t\t   data.lonLat = map.pixelToPoint(new BMap.Pixel(x,y)); \r\n\t\t\t\t}                            \r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\tgraphView.setAutoScrollZone(-1);\r\n\tgraphView.handleScroll = function(){};\r\n\tgraphView.handlePinch = function(){};\r\n\r\n\tvar handleClick = function(e){\r\n\t\tvar data = graphView.getDataAt(e);\r\n\t\tif(data){\r\n\t\t\te.stopPropagation();\r\n\t\t}\r\n\t\telse if(e.metaKey || e.ctrlKey){\r\n\t\t\te.stopPropagation();\r\n\t\t}\r\n\t};\r\n\tgraphView.getView().addEventListener('click', handleClick, false);                \r\n\tgraphView.getView().addEventListener('dblclick', handleClick, false);\r\n\tgraphView.getView().addEventListener(ht.Default.isTouchable ? 'touchstart' : 'mousedown', handleClick, false);\r\n\r\n\twindow.addEventListener(\"resize\", function(e) {\r\n\t\tgraphView.invalidate();\r\n\t}, false);                 \r\n\r\n\tvar color = randomColor(),\r\n\t\tprovince = null;\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\tcolor = randomColor();\r\n\t\t\tprovince = null;\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\tvar node = createNode(parseFloat(ss[1].substr(3)), parseFloat(ss[2].substr(3)), ss[0].substr(3), color); \r\n\t\t\t\tif(province){\r\n\t\t\t\t\tvar edge = new ht.Edge(province, node);\r\n\t\t\t\t\tedge.s({\r\n\t\t\t\t\t\t'edge.center': true,\r\n\t\t\t\t\t\t'edge.width': 1,                                    \r\n\t\t\t\t\t\t'flow': true\r\n\t\t\t\t\t});\r\n\t\t\t\t\tedge.setLayer('edgeLayer');\r\n\t\t\t\t\tdataModel.add(edge);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tprovince = node;\r\n\t\t\t\t\tnode.s({                                   \r\n\t\t\t\t\t\t'shape.gradient': 'radial.center',                                    \r\n\t\t\t\t\t\t'border.type': 'circle',\r\n\t\t\t\t\t\t'border.width': 1,\r\n\t\t\t\t\t\t'border.color': 'rgba(200, 200, 200, 0.5)'                                    \r\n\t\t\t\t\t});\r\n\t\t\t\t\tnode.setSize(15, 15);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}                \r\n\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.setLayer('nodeLayer');\r\n\tnode.setSize(10, 10);\r\n\tvar lonLat = new BMap.Point(lon, lat); \r\n\tnode.setPosition(map.pointToPixel(lonLat));\r\n\tnode.lonLat = lonLat;\r\n\tgraphView.dm().add(node);\r\n\treturn node;\r\n}            \r\n\r\nfunction resetPosition(e){\r\n\tgraphView.tx(0);\r\n\tgraphView.ty(0);\r\n\tdataModel.each(function(data){\r\n\t\tif(data instanceof ht.Node){\r\n\t\t\tvar lonLat = data.lonLat,\r\n\t\t\t\tposition = map.pointToPixel(lonLat);   \r\n\t\t\tdata.setPosition(position.x,position.y);                           \r\n\t\t}\r\n\t});            \r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u300a<a href=\"http:\/\/www.hightopo.com\/blog\/304.html\">HT for Web\u6574\u5408OpenLayers\u5b9e\u73b0GIS\u5730\u56fe\u5e94\u7528<\/a>\u300b\u7bc7\u4e2d\u4ecb\u7ecd\u4e86<a href=\"http:\/\/www.hightopo.com\/\">HT for Web<\/a>\u4e0eOpenLayers\u7684\u6574\u5408\uff0c\u4e0d\u5c11\u670b\u53cb\u53cd\u5e94\u56fd\u5185\u7528\u5f97\u6bd4\u8f83\u591a\u7684\u8fd8\u662f<a href=\"http:\/\/developer.baidu.com\/map\/\">\u767e\u5ea6\u5730\u56fe<\/a>\uff0c\u867d\u7136<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u6574\u5408\u767e\u5ea6\u5730\u56fe\u539f\u7406\u4e0eOpenLayers\u4e00\u81f4\uff0c\u4f46\u4e0d\u540cGIS\u5f15\u64ce\u5ba2\u6237\u7aef\u7ed3\u5408\u4ee3\u7801\u7ec6\u8282\u8fd8\u662f\u6709\u4e0d\u5c11\u5dee\u5f02\uff0c\u81ea\u5b9a\u4e49\u5730\u56fe\u98ce\u683c\u66f4\u662f\u5b8c\u5168\u4e0d\u4e00\u6837\uff0c\u4e3a\u6b64\u6211\u518d\u5f00\u7bc7\u4ecb\u7ecd\u4e0b<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u4e0e\u767e\u5ea6\u5730\u56fe\u6574\u5408\u7684\u65b9\u6848\uff0c\u8fd9\u6b21\u6211\u4eec\u5c06\u6539\u8fdb\u4ee5\u524d\u7684\u4f8b\u5b50\uff0c\u9664\u4e86\u4ee3\u8868\u57ce\u5e02\u7684\u62d3\u6251\u8282\u70b9\u5916\uff0c\u518d\u589e\u52a0\u8fde\u7ebf\u8fde\u63a5\u7701\u4f1a\u548c\u57ce\u5e02\uff0c\u5b9e\u73b0\u7f51\u7edc\u62d3\u6251\u94fe\u8def\u7684\u6d41\u52a8\u6548\u679c\u3002<\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-322\" alt=\"Screen Shot 2014-12-03 at 11.43.05 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM.png\" width=\"900\" height=\"562\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM.png 900w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM-300x187.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.43.05-PM-200x124.png 200w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><img loading=\"lazy\" class=\"alignnone size-full wp-image-317\" alt=\"Screen Shot 2014-12-03 at 11.18.02 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM.png\" width=\"910\" height=\"569\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM.png 910w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM-300x187.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.18.02-PM-200x125.png 200w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-318\" alt=\"Screen Shot 2014-12-03 at 11.16.55 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM.png\" width=\"872\" height=\"714\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM.png 872w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM-300x245.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.16.55-PM-200x163.png 200w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/a><\/p>\n<p>\u767e\u5ea6\u5730\u56fe\u6709\u591a\u79cd\u5ba2\u6237\u7aefSDK\uff0c\u6211\u4eec\u8fd9\u91cc\u7528\u7684\u81ea\u7136\u662f<a href=\"http:\/\/developer.baidu.com\/map\/\">JavaScript\u7248\u7684API<\/a>\uff0c\u767e\u5ea6\u5730\u56fe\u76842.0\u7248\u589e\u52a0\u4e86\u4e0d\u5c11\u65b0\u529f\u80fd\uff0c\u4f8b\u5982\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5730\u56fe\u6837\u5f0f\u6a21\u677f\uff0c\u672c\u4f8b\u4e2d\u6211\u4eec\u7279\u610f\u8bbe\u7f6e\u6210style:&#8217;midnight&#8217;\u7684\u6df1\u8272\u80cc\u666f\u98ce\u683c\u3002\u63d2\u5165map\u7684\u4f4d\u7f6e\u4e0eOpenLayers\u4e5f\u4e0d\u4e00\u6837\uff0c\u901a\u8fc7mapDiv.firstChild.firstChild.appendChild(view);\u63d2\u5165\uff0czIndex\u8fd9\u4e9b\u5c5e\u6027\u90fd\u8fd8\u597d\u4e0d\u9700\u8981\u8bbe\u7f6e\u3002<\/p>\n<p>\u5750\u6807\u8f6c\u6362\u65b9\u9762\u4ece\u7ecf\u7eac\u5ea6\u8f6c\u6362\u6210\u5e73\u9762\u5750\u6807\u662fmap.pointToPixel\u51fd\u6570\uff0c\u901a\u8fc7node.setPosition(map.pointToPixel(new BMap.Point(lon, lat)));\u53ef\u8bbe\u7f6eht.Node\u5bf9\u5e94\u7684\u5e73\u9762\u903b\u8f91\u5750\u6807\uff0c\u901a\u8fc7map.pixelToPoint(new BMap.Pixel(x,y))\u53ef\u5c06\u5e73\u9762\u5750\u6807\u8f6c\u6362\u6210\u7ecf\u7eac\u5ea6\u5750\u6807\uff0c\u6211\u4eec\u5728\u76d1\u542c\u8282\u70b9\u56fe\u5143\u88ab\u62d6\u62fd\u7ed3\u675f\u7684endMove\u9700\u8981\u91cd\u65b0\u8ba1\u7b97\u5f53\u524d\u4f4d\u7f6e\u7684\u7ecf\u7eac\u5ea6\u65f6\u7528\u5230\u3002<\/p>\n<p>\u5730\u56fe\u6570\u636e\u65b9\u9762\u6bcf\u4e2a\u7701\u7684\u7701\u4f1a\u57ce\u5e02\u90fd\u662f\u7b2c\u4e00\u4e2a\u51fa\u73b0\uff0c\u56e0\u6b64\u6211\u4eec\u6784\u5efa\u4e86size\u5927\u4e00\u70b9\u7684\u5e26\u6e10\u8fdb\u8272\u7684\u56fe\u5143\u4ee3\u8868\u7701\u4f1a\u57ce\u5e02\uff0c\u5176\u4ed6\u57ce\u5e02\u6784\u5efa\u65f6\u540c\u65f6\u6784\u5efaht.Edge\u7684\u8fde\u7ebf\u4e0e\u7701\u4f1a\u8282\u70b9\u8fde\u63a5\uff0c\u540c\u65f6\u5f15\u5165<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">ht-flow.js<\/a>\u63d2\u4ef6\uff0c\u53ea\u9700\u8981graphView.enableFlow(60);\u4e00\u53e5\u8bdd\u5c31\u53ef\u4ee5\u542f\u52a8\u6d41\u52a8\u8fde\u7ebf\u529f\u80fd\uff0c\u6bcf\u6761edge\u8fde\u7ebf\u8fd8\u53ef\u4ee5\u6709\u5f88\u591aflow.*\u76f8\u5173\u7684\u6d41\u52a8\u53c2\u8003\u53ef\u63a7\u5236\u6d41\u52a8\u6548\u679c\uff0c\u8fd9\u91cc\u7684\u7b80\u5355\u4f8b\u5b50\u6211\u4eec\u4e0d\u9700\u8981\u505a\u5b9a\u5236\uff0c\u4fdd\u6301<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u9ed8\u8ba4\u7684\u6d41\u52a8\u53c2\u6570\u5c31\u8db3\u591f\u9177\u4e86\u3002<\/p>\n<p>\u53e6\u5916\u901a\u8fc7graphView.setLayers([&#8216;edgeLayer&#8217;, &#8216;nodeLayer&#8217;]);\u6211\u4eec\u4e3a\u62d3\u6251\u8bbe\u7f6e\u4e86\u4e24\u4e2a\u5c42\uff0cnode.setLayer(&#8216;nodeLayer&#8217;);\u548cedge.setLayer(&#8216;edgeLayer&#8217;)\u4f7f\u5f97\u56fe\u5143\u8282\u70b9\u5168\u90e8\u5448\u73b0\u4e8e\u8fde\u7ebf\u4e4b\u4e0a\uff0c\u4ece\u8fd9\u4e2a\u7ec6\u8282\u5927\u5bb6\u53ef\u4ee5\u53d1\u73b0\uff0c\u4ee5\u524d\u9700\u8981\u5728GIS\u7684SDK\u6269\u5c55\u7684\u529f\u80fd\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u7684<a href=\"http:\/\/www.hightopo.com\/\">GraphView<\/a>\u5b9e\u73b0\uff0c\u5730\u56fe\u4ec5\u4ec5\u662f\u4f5c\u4e3a\u80cc\u666f\uff0c\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u5b8c\u5168\u5728\u66f4\u7075\u6d3b\u5f3a\u5927\u7684<a href=\"http:\/\/www.hightopo.com\/\">HT\u6a21\u578b<\/a>\u4e2d\u8fdb\u884c\u3002<\/p>\n<p>\u5176\u4ed6\u65b9\u9762\u7ec6\u8282\u8fd8\u7531\u76d1\u542cmap\u7684\u7f29\u653e\u7b49\u64cd\u4f5c\u5bf9\u62d3\u6251\u56fe\u5143\u91cd\u65b0\u5b9a\u4f4d\uff0c\u4ee5\u53ca\u76d1\u542c\u4ea4\u4e92\u51b3\u5b9aGraphView\u8fd8\u662fMap\u8fdb\u884c\u63a7\u5236\u7b49\u90fd\u4e0e\u4ee5\u524d\u7684\u6587\u7ae0\u7c7b\u4f3c\uff0c\u8fd9\u91cc\u5c31\u4e0d\u518d\u4ecb\u7ecd\u4e86\uff0c\u4ee5\u4e0b\u4e3a\u64cd\u4f5c\u89c6\u9891\u3001\u6293\u56fe\u548c\u6e90\u4ee3\u7801\u4f9b\u5927\u5bb6\u53c2\u8003\uff0c\u8fd9\u6837\u7684\u7ed3\u5408\u53ef\u5b8c\u7f8e\u7684\u5c06\u767e\u5ea6\u5730\u56fe\u4e30\u5bcc\u7684\u5730\u56fe\u6570\u636e\u4fe1\u606f\uff0c\u4e0e<a href=\"http:\/\/www.hightopo.com\/\">HT<\/a>\u5f3a\u5927\u7684\u903b\u8f91\u62d3\u6251\u529f\u80fd\u76f8\u7ed3\u5408\uff0c\u5426\u5219\u5149\u9760\u767e\u5ea6\u5730\u56feSDK\u7684API\u7684\u6269\u5c55\u65b9\u5f0f\uff0c\u7528\u6237\u53ea\u80fd\u505a\u4e9b\u7b80\u5355\u7684\u6548\u679c\uff0c\u4f8b\u5982\u8fde\u7ebf\u6d41\u52a8\u7b49\u6548\u679c\u90fd\u8fdc\u4e0d\u5982HT\u8fd9\u6837\u4e00\u884c\u4ee3\u7801\u5c31\u641e\u5b9a\u6765\u7684\u5bb9\u6613\u3002<a href=\"http:\/\/v.youku.com\/v_show\/id_XODQxMDcwNjQ0.html\">http:\/\/v.youku.com\/v_show\/id_XODQxMDcwNjQ0.html<\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.youku.com\/embed\/XODQxMDcwNjQ0\" 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-03-at-11.12.43-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-320\" alt=\"Screen Shot 2014-12-03 at 11.12.43 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM.png\" width=\"900\" height=\"637\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM.png 900w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM-300x212.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-11.12.43-PM-200x141.png 200w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-319\" alt=\"Screen Shot 2014-12-03 at 9.43.40 PM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM.png\" width=\"911\" height=\"675\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM.png 911w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM-300x222.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-03-at-9.43.40-PM-200x148.png 200w\" sizes=\"(max-width: 911px) 100vw, 911px\" \/><\/a><a href=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-324\" alt=\"Screen Shot 2014-12-04 at 12.31.13 AM\" src=\"http:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM.png\" width=\"903\" height=\"219\" srcset=\"https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM.png 903w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM-300x72.png 300w, https:\/\/www.hightopo.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-04-at-12.31.13-AM-200x48.png 200w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/a><\/p>\n<pre class=\"&quot;brush:javascript\u201d\">var dataModel = new ht.DataModel();\r\nvar graphView = new ht.graph.GraphView(dataModel);              \r\nvar map = null;   \r\n\r\nfunction init() {\r\n\tmap = new BMap.Map(\"map\");   \r\n\tvar point = new BMap.Point(116.404, 39.915);                          \r\n\tmap.addTileLayer(new BMap.TrafficLayer());                    \r\n\tmap.centerAndZoom(point, 4);                    \r\n\tmap.enableScrollWheelZoom();                       \r\n\tmap.addControl(new BMap.NavigationControl());                               \r\n\r\n\tmap.setMapStyle({\r\n\t\tfeatures: [\"road\", \"building\",\"water\",\"land\"],\r\n\t\tstyle:'midnight'\r\n\t});\r\n\r\n\tvar view = graphView.getView();\r\n\tview.className = 'graphView'; \r\n\tvar mapDiv = document.getElementById('map');\r\n\tmapDiv.firstChild.firstChild.appendChild(view);\r\n\r\n\tmap.addEventListener('movestart', function(e){                   \r\n\t   view.style.opacity = 0;\r\n\t});\r\n\tmap.addEventListener('moveend', function(e){\r\n\t   view.style.opacity = 1; \r\n\t   resetPosition(); \r\n\t});\r\n\tmap.addEventListener('dragstart', function(e){\r\n\t   view.style.opacity = 0;                \r\n\t});\r\n\tmap.addEventListener('dragend', function(e){\r\n\t   view.style.opacity = 1; \r\n\t   resetPosition(); \r\n\t});                                \r\n\tmap.addEventListener('zoomstart', function(e){\r\n\t\tview.style.opacity = 0;\r\n\t});                \r\n\tmap.addEventListener('zoomend', function(e){\r\n\t\tview.style.opacity = 1;    \r\n\t\tresetPosition(); \r\n\t});                \r\n\r\n\tgraphView.setLayers(['edgeLayer', 'nodeLayer']);\r\n\tgraphView.enableFlow(60);\r\n\tgraphView.enableToolTip();\r\n\tgraphView.getToolTip = function(event){\r\n\t\tvar data = this.getDataAt(event);\r\n\t\tif(data instanceof ht.Node){\r\n\t\t\treturn '\u57ce\u5e02\uff1a' + data.s('note') + '\r\n\u7ecf\u5ea6\uff1a' + data.lonLat.lng + '\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.getZoom() &gt; 1 || this.isSelected(data);\r\n\t};\r\n\tgraphView.isNoteVisible = function(data){\r\n\t\treturn map.getZoom() &gt; 8 || this.isSelected(data);\r\n\t}; \r\n\tgraphView.getLabel = function(data){\r\n\t\tif(data instanceof ht.Node){\r\n\t\t\treturn '\u7ecf\u5ea6\uff1a' + data.lonLat.lng + '\\n\u7ef4\u5ea6\uff1a' + data.lonLat.lat;\r\n\t\t}                    \r\n\t};\r\n\tgraphView.isLabelVisible = function(data){\r\n\t\treturn map.getZoom() &gt; 9 || this.isSelected(data);\r\n\t}; \r\n\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\t\t\t\t   data.lonLat = map.pixelToPoint(new BMap.Pixel(x,y)); \r\n\t\t\t\t}                            \r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\tgraphView.setAutoScrollZone(-1);\r\n\tgraphView.handleScroll = function(){};\r\n\tgraphView.handlePinch = function(){};\r\n\r\n\tvar handleClick = function(e){\r\n\t\tvar data = graphView.getDataAt(e);\r\n\t\tif(data){\r\n\t\t\te.stopPropagation();\r\n\t\t}\r\n\t\telse if(e.metaKey || e.ctrlKey){\r\n\t\t\te.stopPropagation();\r\n\t\t}\r\n\t};\r\n\tgraphView.getView().addEventListener('click', handleClick, false);                \r\n\tgraphView.getView().addEventListener('dblclick', handleClick, false);\r\n\tgraphView.getView().addEventListener(ht.Default.isTouchable ? 'touchstart' : 'mousedown', handleClick, false);\r\n\r\n\twindow.addEventListener(\"resize\", function(e) {\r\n\t\tgraphView.invalidate();\r\n\t}, false);                 \r\n\r\n\tvar color = randomColor(),\r\n\t\tprovince = null;\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\tcolor = randomColor();\r\n\t\t\tprovince = null;\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\tvar node = createNode(parseFloat(ss[1].substr(3)), parseFloat(ss[2].substr(3)), ss[0].substr(3), color); \r\n\t\t\t\tif(province){\r\n\t\t\t\t\tvar edge = new ht.Edge(province, node);\r\n\t\t\t\t\tedge.s({\r\n\t\t\t\t\t\t'edge.center': true,\r\n\t\t\t\t\t\t'edge.width': 1,                                    \r\n\t\t\t\t\t\t'flow': true\r\n\t\t\t\t\t});\r\n\t\t\t\t\tedge.setLayer('edgeLayer');\r\n\t\t\t\t\tdataModel.add(edge);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tprovince = node;\r\n\t\t\t\t\tnode.s({                                   \r\n\t\t\t\t\t\t'shape.gradient': 'radial.center',                                    \r\n\t\t\t\t\t\t'border.type': 'circle',\r\n\t\t\t\t\t\t'border.width': 1,\r\n\t\t\t\t\t\t'border.color': 'rgba(200, 200, 200, 0.5)'                                    \r\n\t\t\t\t\t});\r\n\t\t\t\t\tnode.setSize(15, 15);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}                \r\n\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.setLayer('nodeLayer');\r\n\tnode.setSize(10, 10);\r\n\tvar lonLat = new BMap.Point(lon, lat); \r\n\tnode.setPosition(map.pointToPixel(lonLat));\r\n\tnode.lonLat = lonLat;\r\n\tgraphView.dm().add(node);\r\n\treturn node;\r\n}            \r\n\r\nfunction resetPosition(e){\r\n\tgraphView.tx(0);\r\n\tgraphView.ty(0);\r\n\tdataModel.each(function(data){\r\n\t\tif(data instanceof ht.Node){\r\n\t\t\tvar lonLat = data.lonLat,\r\n\t\t\t\tposition = map.pointToPixel(lonLat);   \r\n\t\t\tdata.setPosition(position.x,position.y);                           \r\n\t\t}\r\n\t});            \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\/316"}],"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=316"}],"version-history":[{"count":5,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hightopo.com\/blog\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}