From 663ee0fc2106115da7d705f600c997334dc3e077 Mon Sep 17 00:00:00 2001 From: "scott.sun" <scott.sun@topibd.com> Date: Wed, 13 May 2020 17:55:45 +0800 Subject: [PATCH] s --- test/test.js | 102 +-------------------------------------------------- 1 file changed, 2 insertions(+), 100 deletions(-) diff --git a/test/test.js b/test/test.js index 9974151..1505ba2 100644 --- a/test/test.js +++ b/test/test.js @@ -1,102 +1,4 @@ -function getFeaturesSurface(arr) { - var surface_index = 1; - var surface = {}; - var tmp_array = arr - var surface_points = [] - for(var i=0; i<tmp_array.length;i++) { - if(/^#S\s+P/.test(tmp_array[i])){ - var tmp = tmp_array[i].split(/\,/) - if(!surface[surface_index]){surface[surface_index] = {}} - surface[surface_index]["attributes"] = tmp - } - if(/^#\d+\s+#S\s+P/.test(tmp_array[i])){ - var tmp = tmp_array[i].split(/\,/) - if(!surface[surface_index]){surface[surface_index] = {}} - surface[surface_index]["attributes"] = tmp - surface[surface_index]["serial"] = /#(\d+)/.exec(tmp_array[i])[1] - } - var tmp=tmp_array[i].split(/\s+/) - console.log(tmp); - if(tmp[0]==="#" || /^#\d+$/.test(tmp[0])){ - tmp = tmp.slice(1) - } - if (/^#OB|^#\s+#OB/.test(tmp_array[i]) || /^#OS|^#\s+#OS/.test(tmp_array[i])) { - if (/^#OB|^#\s+#OB/.test(tmp_array[i])) { - if(!surface[surface_index]){surface[surface_index] = {}} - surface[surface_index].type = tmp[3] - } - surface_points.push({x:tmp[1],y:tmp[2],arcx:undefined,arcy:undefined,arcdir:undefined}) - }else if (/^#OC|^#\s+#OC/.test(tmp_array[i])) { - surface_points.push({x:tmp[1],y:tmp[2],arcx:tmp[3],arcy:tmp[4],arcdir:tmp[5]}) - } - if (/^#OE|^#\s+#OE/.test(tmp_array[i])) { - if(!surface[surface_index]){surface[surface_index] = {}} - surface[surface_index].coordinates = surface_points - surface[surface_index].points_num = surface_points.length - surface_index++; - surface_points = [] - } - } - return surface -} -// #OB #OS #OE -console.log(getFeaturesSurface( - [ - "### Layer - tmp features data ###", - "#26 #S P 0", - "# #OB 5.687356102362 3.734867322835 I", - "# #OS 5.687356102362 4.881030511811", - "# #OS 6.477813484252 4.881030511811", - "# #OS 6.477813484252 3.734867322835", - "# #OS 5.687356102362 3.734867322835", - "# #OE", - "#27 #S P 0", - "# #OB 4.514844389764 4.459453248031 I", - "# #OS 4.64658730315 3.91930738189", - "# #OS 4.751981594488 3.418684350394", - "# #OS 4.264532874016 2.66774980315", - "# #OS 2.933929625984 3.892958759843", - "# #OS 4.514844389764 4.459453248031", - "# #OE", - ] -)) -/* -#28 #S P 0 -# #OB 1.063180511811 6.119413681102 I -# #OS 2.775838188976 5.236736318898 -# #OS 2.670443799213 4.354058858268 -# #OS 0.694300393701 5.104993405512 -# #OS 1.063180511811 6.119413681102 -# #OE - -#29 #S P 0 -# #OB 1.695546456693 2.628226968504 I -# #OS 1.985380807087 1.468889468504 -# #OS 1.326666338583 1.626981003937 -# #OS 1.695546456693 2.628226968504 -# #OE - -#30 #S P 0 -# #OB 5.357998917323 1.798246751969 I -# #OS 5.753227559055 1.205403740157 -# #OS 4.896898818898 1.086835137795 -# #OS 5.357998917323 1.798246751969 -# #OE - -#31 #S P 0 -# #OB 7.966508267717 2.812667027559 I -# #OS 7.768893897638 2.24617253937 -# #OS 7.347316633858 2.746795570866 -# #OS 7.966508267717 2.812667027559 -# #OE - -#32 #S P 0 -# #OB 7.729371062992 5.737359251969 I -# #OS 7.492233759843 5.289433464567 -# #OS 7.479059547244 5.671487893701 -# #OS 7.729371062992 5.737359251969 -# #OE - -*/ \ No newline at end of file +var tmp = {} +console.log(tmp instanceof Object) \ No newline at end of file -- 2.21.0