Commit f522c40c99c9b67163de61544b350557a5da9d42
1 parent
a0472888
Exists in
master
and in
6 other branches
Remoção de arquivos não utilizados
Showing
18 changed files
with
40 additions
and
3946 deletions
Show diff stats
ms_configura.php
@@ -95,7 +95,6 @@ Exemplo de chave: def00000881f5d29aa8604e109797766cd26754c4cc06be02c09163810a78a | @@ -95,7 +95,6 @@ Exemplo de chave: def00000881f5d29aa8604e109797766cd26754c4cc06be02c09163810a78a | ||
95 | $i3geoKeys = array( | 95 | $i3geoKeys = array( |
96 | "salvaMapfile"=>"" | 96 | "salvaMapfile"=>"" |
97 | ); | 97 | ); |
98 | -//TODO documentar no moodle | ||
99 | /* | 98 | /* |
100 | Variable: $i3geoPermiteLogin | 99 | Variable: $i3geoPermiteLogin |
101 | 100 | ||
@@ -187,17 +186,8 @@ $i3geoEsquemasWL = array(); | @@ -187,17 +186,8 @@ $i3geoEsquemasWL = array(); | ||
187 | Tipo: | 186 | Tipo: |
188 | {array} | 187 | {array} |
189 | */ | 188 | */ |
190 | -$i3geoUploadDataWL = array( | ||
191 | - "arquivos" => array( | ||
192 | - "Pasta 1"=>"/tmp/ms_tmp" | ||
193 | - ), | ||
194 | - "postgis" => array( | ||
195 | - "esquemas"=>array("esquema1","i3geo_metaestat","public"), | ||
196 | - "conexao"=>array("user"=> "postgres", "password"=>"postgres", "dbname"=>"i3geosaude", "host"=>"localhost", "port"=>"5432") | ||
197 | - ) | ||
198 | -); | 189 | +$i3geoUploadDataWL = array(); |
199 | 190 | ||
200 | -//TODO documentar moodle | ||
201 | /* | 191 | /* |
202 | Variale: $logExec | 192 | Variale: $logExec |
203 | 193 | ||
@@ -262,7 +252,7 @@ No caso do SAIKU, verifique tambem se o programa i3geo/ferramentas/saiku/esquema | @@ -262,7 +252,7 @@ No caso do SAIKU, verifique tambem se o programa i3geo/ferramentas/saiku/esquema | ||
262 | abrir e verificar o inicio desse arquivo). Veja tambem: i3geo/ferramentas/saiku/install.txt | 252 | abrir e verificar o inicio desse arquivo). Veja tambem: i3geo/ferramentas/saiku/install.txt |
263 | */ | 253 | */ |
264 | $statusFerramentas = array( | 254 | $statusFerramentas = array( |
265 | - "saiku"=>true, | 255 | + "saiku"=>false, |
266 | "melhorcaminho"=>false | 256 | "melhorcaminho"=>false |
267 | ); | 257 | ); |
268 | /* | 258 | /* |
@@ -318,7 +308,7 @@ inseretxt,mostraexten,outputformat,perfil,tipoimagem | @@ -318,7 +308,7 @@ inseretxt,mostraexten,outputformat,perfil,tipoimagem | ||
318 | 308 | ||
319 | */ | 309 | */ |
320 | //$i3geoBlFerramentas = array("saiku"); | 310 | //$i3geoBlFerramentas = array("saiku"); |
321 | -$i3geoBlFerramentas = array(); | 311 | +$i3geoBlFerramentas = array("saiku"); |
322 | /* | 312 | /* |
323 | Variable: $ogrOutput | 313 | Variable: $ogrOutput |
324 | 314 |
pacotes/wicket/bower.json
pacotes/wicket/doc/arcgis.html
@@ -1,221 +0,0 @@ | @@ -1,221 +0,0 @@ | ||
1 | -<html> | ||
2 | -<head> | ||
3 | - <link rel="stylesheet" type="text/css" href="/static/font/Cabin.css" /> | ||
4 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
5 | - <!-- Conditional commenting for non-IE browsers --> | ||
6 | - <!--[if !IE]><!--> | ||
7 | - <link rel="stylesheet" type="text/css" href="/static/wicket/doc/index.css" /> | ||
8 | - <!--<![endif]--> | ||
9 | - <!-- Conditional commenting for IE 6.x --> | ||
10 | - <!--[if IE]> | ||
11 | - <link rel="stylesheet" type="text/css" href="/static/wicket/doc/index.ie.css" /> | ||
12 | - <![endif]--> | ||
13 | - <link rel="stylesheet" href="/static/leaflet/0.5.1/dist/leaflet.css" /> | ||
14 | - <!--[if lte IE 8]> | ||
15 | - <link rel="stylesheet" href="/static/leaflet/0.5.1/dist/leaflet.ie.css" /> | ||
16 | - <![endif]--> | ||
17 | -</head> | ||
18 | -<title>Wicket - Lightweight Javascript for WKT [ESRI ArcGIS Sandbox]</title> | ||
19 | -<link href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" > | ||
20 | -<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css" /> | ||
21 | -<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/" type="text/javascript"></script> | ||
22 | -<script src="../wicket.js" type="text/javascript"></script> | ||
23 | -<script src="../wicket-arcgis.js" type="text/javascript"></script> | ||
24 | -<script type="text/javascript"> | ||
25 | -var app = (function () { | ||
26 | - | ||
27 | - return { | ||
28 | - features: [], | ||
29 | - | ||
30 | - /** | ||
31 | - * Clears the map contents. | ||
32 | - */ | ||
33 | - clearMap: function () { | ||
34 | - var i; | ||
35 | - | ||
36 | - // Reset the remembered last string (so that we can clear the map, | ||
37 | - // paste the same string, and see it again) | ||
38 | - document.getElementById('wkt').last = ''; | ||
39 | - | ||
40 | - for (i = 0; i < this.features.length; i += 1) { | ||
41 | - this.map.graphics.remove(this.features[i]); | ||
42 | - } | ||
43 | - | ||
44 | - //this.features.length = 0; | ||
45 | - }, | ||
46 | - | ||
47 | - /** | ||
48 | - * Clears the current contents of the textarea. | ||
49 | - */ | ||
50 | - clearText: function () { | ||
51 | - document.getElementById('wkt').value = ''; | ||
52 | - }, | ||
53 | - | ||
54 | - /** | ||
55 | - * Maps the current contents of the textarea. | ||
56 | - * @param editable {Boolean} Indicates that the feature drawn should be editable | ||
57 | - * @param focus {Boolean} Indicates that the map should pan and/or zoom to new features | ||
58 | - * @return {Object} Some sort of geometry object | ||
59 | - */ | ||
60 | - mapIt: function (editable, focus) { | ||
61 | - var config, el, graphic, obj, symbol, wkt; | ||
62 | - | ||
63 | - // Indicates that the map should pan and/or zoom to new features | ||
64 | - focus = focus || false; | ||
65 | - | ||
66 | - if (editable === undefined) { | ||
67 | - editable = true; | ||
68 | - } | ||
69 | - | ||
70 | - el = document.getElementById('wkt'); | ||
71 | - wkt = new Wkt.Wkt(); | ||
72 | - | ||
73 | - if (el.last === el.value) { // Remember the last string | ||
74 | - return; // Do nothing if the WKT string hasn't changed | ||
75 | - } else { | ||
76 | - el.last = el.value; | ||
77 | - } | ||
78 | - | ||
79 | - try { // Catch any malformed WKT strings | ||
80 | - wkt.read(el.value); | ||
81 | - } catch (e1) { | ||
82 | - try { | ||
83 | - wkt.read(el.value.replace('\n', '').replace('\r', '').replace('\t', '')); | ||
84 | - } catch (e2) { | ||
85 | - if (e2.name === 'WKTError') { | ||
86 | - alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.'); | ||
87 | - return; | ||
88 | - } | ||
89 | - } | ||
90 | - } | ||
91 | - | ||
92 | - config = { | ||
93 | - spatialReference: { | ||
94 | - wkid: 4326 // WGS84 unprojected | ||
95 | - }, | ||
96 | - editable: editable | ||
97 | - }; | ||
98 | - | ||
99 | - obj = wkt.toObject(config); // Make an object | ||
100 | - | ||
101 | - switch (obj.type) { | ||
102 | - case "point": | ||
103 | - symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 1), new dojo.Color([0,255,0,0.25])); | ||
104 | - break; | ||
105 | - case "polyline": | ||
106 | - symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255,0,0]), 1); | ||
107 | - break; | ||
108 | - case "polygon": | ||
109 | - symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25])); | ||
110 | - break; | ||
111 | - case "extent": | ||
112 | - symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25])); | ||
113 | - break; | ||
114 | - case "multipoint": | ||
115 | - symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,0]), 1), new dojo.Color([255,255,0,0.5])); | ||
116 | - break; | ||
117 | - } | ||
118 | - | ||
119 | - graphic = new esri.Graphic(obj, symbol); | ||
120 | - this.map.graphics.add(graphic); // Add to map | ||
121 | - this.features.push(graphic); // Remember it for later | ||
122 | - | ||
123 | - return obj; | ||
124 | - }, | ||
125 | - | ||
126 | - /** | ||
127 | - * Updates the textarea based on the first available feature. | ||
128 | - */ | ||
129 | - updateText: function () { | ||
130 | - var wkt = new Wkt.Wkt(); | ||
131 | - wkt.fromObject(this.features[0]); | ||
132 | - document.getElementById('wkt').value = wkt.write(); | ||
133 | - }, | ||
134 | - | ||
135 | - /** | ||
136 | - * Formats the textarea contents for a URL. | ||
137 | - * @param checked {Boolean} The check state of the associated checkbox | ||
138 | - */ | ||
139 | - urlify: function (checked) { | ||
140 | - var wkt = new Wkt.Wkt(); | ||
141 | - wkt.read(document.getElementById('wkt').value); | ||
142 | - wkt.delimiter = (checked) ? '+' : ' '; | ||
143 | - document.getElementById('wkt').value = wkt.write(); | ||
144 | - return wkt; | ||
145 | - }, | ||
146 | - | ||
147 | - /** | ||
148 | - * Application entry point. | ||
149 | - * @return {<L.map>} The Leaflet instance | ||
150 | - */ | ||
151 | - init: function () { | ||
152 | - var map = new esri.Map('canvas', { | ||
153 | - center: [10, 20], | ||
154 | - zoom: 2, | ||
155 | - basemap: 'oceans' | ||
156 | - }); | ||
157 | - | ||
158 | - // Set event handlers ////////////////////////////////////////////// | ||
159 | - dojo.connect(map, 'onLoad', function() { | ||
160 | - document.getElementById('wkt').value = 'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20 25, 20 15, 30 20)))'; | ||
161 | - }); | ||
162 | - | ||
163 | - return map; | ||
164 | - } | ||
165 | - | ||
166 | - }; | ||
167 | - | ||
168 | -}()); | ||
169 | - | ||
170 | -dojo.require('esri.map'); | ||
171 | -//dojo.addOnLoad(app.init); // Not necessary; see <body> tag | ||
172 | - | ||
173 | -</script> | ||
174 | -<body onload="app.map=app.init();"><!--app.mapIt(false, false);">--> | ||
175 | - <div id="head"> | ||
176 | - <div class="wrapper"> | ||
177 | - </div> | ||
178 | - </div> | ||
179 | - <div id="ribbon"> | ||
180 | - <div class="wrapper"> | ||
181 | - <a href="http://github.com/arthur-e/Wicket"> | ||
182 | - <div id="forkme"> | ||
183 | - </div> | ||
184 | - </a> | ||
185 | - <div id="canvas"> | ||
186 | - </div> | ||
187 | - <div id="controls"> | ||
188 | - <div class="title"> | ||
189 | - <div class="brand">Wicket</div> | ||
190 | - It whispers WKT in your application's ear. | ||
191 | - </div> | ||
192 | - <div class="text"> | ||
193 | - Wicket is a lightweight Javascript library that reads and writes <a href="http://en.wikipedia.org/wiki/Well-known_text#Geometric_objects" target="_blaknk">Well-Known Text (WKT)</a> strings. It can also be extended to parse and to create geometric objects from various mapping frameworks, such as <a href="http://http://leafletjs.com/" target="_blank">Leaflet</a> and the Google Maps API. | ||
194 | - </div> | ||
195 | - <div id="form"> | ||
196 | - <textarea type="text" name="wkt" id="wkt"></textarea> | ||
197 | - <label><input type="checkbox" name="urlify" id="urlify" onchange="app.urlify(this.checked);" />Format for URLs</label> | ||
198 | - <input type="submit" id="submit" value="Map It!" onclick="app.clearMap();app.mapIt(true, true);" /> | ||
199 | - <input type="reset" id="reset" value="Clear Map" onclick="app.clearText();app.clearMap();" /> | ||
200 | - </div> | ||
201 | - </div> | ||
202 | - </div> | ||
203 | - </div> | ||
204 | - <div id="foot"> | ||
205 | - <div class="wrapper"> | ||
206 | - <div class="menu" id="nav"> | ||
207 | - <a href="/">Home</a> | ||
208 | - <a href="mailto:kaendsle@mtu.edu">Contact Me</a> | ||
209 | - <a href="http://github.com/arthur-e/Wicket">"Fork me on GitHub!"</a> | ||
210 | - </div> | ||
211 | - <div class="attribute"> | ||
212 | - Design © 2012-2013 <a href="mailto:kaendsle@mtu.edu">K. Arthur Endsley</a> | ||
213 | - <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB"> | ||
214 | - <img alt="Wicket is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License" style="float:right;border-width:0;vertical-align:middle;" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png" /> | ||
215 | - </a><br /> | ||
216 | - Wicket is released under the <a href="https://github.com/arthur-e/Wicket/blob/master/LICENSE" target="_blank">GPL v3</a> | ||
217 | - </div> | ||
218 | - </div> | ||
219 | - </div> | ||
220 | -</body> | ||
221 | -</html> |
pacotes/wicket/doc/dot_shadow.png
1.27 KB
pacotes/wicket/doc/index.css
@@ -1,85 +0,0 @@ | @@ -1,85 +0,0 @@ | ||
1 | -body {margin:0;padding:0;background:#CF6;border-top:5px solid #000;font-family:Helvetica,Arial,sans-serif;font-size:14px;} | ||
2 | -img {border:none;} | ||
3 | -label {color:#666;} | ||
4 | -label:hover {color:#333;} | ||
5 | -a:link, | ||
6 | -a:visited {color:#460;text-decoration:none;} | ||
7 | - | ||
8 | -.leaflet-container .leaflet-control-attribution {color:white;background:none !important;box-shadow:none !important;} | ||
9 | -.leaflet-container .leaflet-control-attribution a:link, | ||
10 | -.leaflet-container .leaflet-control-attribution a:visited {color:#8C0;} | ||
11 | - | ||
12 | -.attribute {width:290px;float:right;padding:10px 0;text-align:left;font-size:10px;line-height:16px;} | ||
13 | -.menu {float:left;margin:0;padding:0;list-style:none;} | ||
14 | -.menu a {display:inline-block;margin:0;padding:5px 0 10px;margin:0 25px 0 0;border-top:5px solid transparent;} | ||
15 | -.menu a:hover, | ||
16 | -.menu a:active {border-top:5px solid #999;color:#000;text-decoration:none;} | ||
17 | -.text {color:#333;} | ||
18 | -.wrapper {width:1000px;height:100%;margin:0 auto;} | ||
19 | - | ||
20 | -#canvas {width:698px;height:100%;background:#AAA;border-left:1px solid #999;border-right:1px solid #999;} | ||
21 | -#canvas, | ||
22 | -#controls {float:left;} | ||
23 | -#controls {width:290px;height:100%;padding:0 0 0 10px;text-align:justify;background:transparent;position:relative;top:-80px;} | ||
24 | -#controls .text {margin:90px 0 0;} | ||
25 | -#controls a:hover, | ||
26 | -#controls a:active {text-decoration:underline;} | ||
27 | -#forkme {width:141px;height:141px;z-index:9999;position:absolute;left:0;top:4px;background:transparent url(https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png) no-repeat left top;} | ||
28 | -#form {margin:10px 0 0;font-size:14px;color:#666;font-family:CabinItalic,sans-serif;} | ||
29 | -#form #wkt {width:100%;height:150px;border:1px solid #999;padding:3px;resize:none;} | ||
30 | -#form #urlify {vertical-align:baseline;margin:10px 5px 0 0;} | ||
31 | -#form #reset {margin:10px 10px 0 0; | ||
32 | - filter: progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc'); | ||
33 | - -ms-filter: "progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc')"; | ||
34 | - background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); | ||
35 | - background-image: -ms-linear-gradient(top, #eeeeee, #cccccc); | ||
36 | - background-image: -o-linear-gradient(top, #eeeeee, #cccccc); | ||
37 | - background-image: -webkit-gradient(linear, center top, center bottom, from(#eeeeee), to(#cccccc)); | ||
38 | - background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc); | ||
39 | - background-image: linear-gradient(top, #eeeeee, #cccccc); | ||
40 | - -moz-background-clip: padding; | ||
41 | - -webkit-background-clip: padding-box; | ||
42 | - background-clip: padding-box; | ||
43 | - } | ||
44 | -#form #reset, | ||
45 | -#form #submit {float:right;height:30px;margin-top:10px;padding:0 5px 2px 5px;font-family:CabinItalic,sans-serif;font-size:16px;color:#666; | ||
46 | - border: 1px solid #999999; | ||
47 | - -moz-border-radius: 5px; | ||
48 | - -webkit-border-radius: 5px; | ||
49 | - border-radius: 5px; | ||
50 | - } | ||
51 | -#form #submit {background-color: #EF9; | ||
52 | - filter: progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeffcc', endColorstr = '#ddff99'); | ||
53 | - -ms-filter: "progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeffcc', endColorstr = '#ddff99')"; | ||
54 | - background-image: -moz-linear-gradient(top, #eeffcc, #ddff99); | ||
55 | - background-image: -ms-linear-gradient(top, #eeffcc, #ddff99); | ||
56 | - background-image: -o-linear-gradient(top, #eeffcc, #ddff99); | ||
57 | - background-image: -webkit-gradient(linear, center top, center bottom, from(#eeffcc), to(#ddff99)); | ||
58 | - background-image: -webkit-linear-gradient(top, #eeffcc, #ddff99); | ||
59 | - background-image: linear-gradient(top, #eeffcc, #ddff99); | ||
60 | - -moz-background-clip: padding; | ||
61 | - -webkit-background-clip: padding-box; | ||
62 | - background-clip: padding-box; | ||
63 | - } | ||
64 | -#form #reset:hover, | ||
65 | -#form #submit:hover {color:#333;border-color:#666;text-shadow:1px 1px 0px #FFF; | ||
66 | - -moz-box-shadow: 0px 0px 2px #999999; | ||
67 | - -webkit-box-shadow: 0px 0px 2px #999999; | ||
68 | - box-shadow: 0px 0px 2px #999999; | ||
69 | - } | ||
70 | -#form #reset:active, | ||
71 | -#form #submit:active { | ||
72 | - -moz-box-shadow:inset 0px 0px 2px #999999; | ||
73 | - -webkit-box-shadow:inset 0px 0px 2px #999999; | ||
74 | - box-shadow:inset 0px 0px 2px #999999; | ||
75 | - } | ||
76 | -#foot {background:transparent url(white_spacer.gif) repeat-x top left;} | ||
77 | -#foot, | ||
78 | -#head {width:100%;height:20%;color:#333;} | ||
79 | -#head {background:transparent url(white_spacer.gif) repeat-x bottom left;} | ||
80 | -#nav {width:698px;text-align:left;} | ||
81 | -#ribbon {width:100%;height:60%;background:#EEE;} | ||
82 | -#ribbon .wrapper {} | ||
83 | -#ribbon .wrapper .title {float:right;width:300px;height:80px;font-family:CabinRegular,sans-serif;font-size:16px;color:#333;} | ||
84 | -#ribbon .wrapper .title .brand {font-family:CabinMediumItalic,sans-serif;font-size:36px;color:#000;text-shadow:1px 1px 1px #FFF;} | ||
85 | - |
pacotes/wicket/doc/index.html
@@ -1,327 +0,0 @@ | @@ -1,327 +0,0 @@ | ||
1 | -<html> | ||
2 | -<head> | ||
3 | - <link rel="stylesheet" type="text/css" href="/static/font/Cabin.css" /> | ||
4 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
5 | - <!-- Conditional commenting for non-IE browsers --> | ||
6 | - <!--[if !IE]><!--> | ||
7 | - <link rel="stylesheet" type="text/css" href="/static/wicket/doc/index.css" /> | ||
8 | - <!--<![endif]--> | ||
9 | - <!-- Conditional commenting for IE 6.x --> | ||
10 | - <!--[if IE]> | ||
11 | - <link rel="stylesheet" type="text/css" href="index.ie.css" /> | ||
12 | - <![endif]--> | ||
13 | - <!--<link rel="stylesheet" href="../lib/leaflet.css" />--> | ||
14 | - <!--[if lte IE 8]> | ||
15 | - <link rel="stylesheet" href="../lib/leaflet.ie.css" /> | ||
16 | - <![endif]--> | ||
17 | -</head> | ||
18 | -<title>Wicket - Lightweight Javascript for WKT [Sandbox]</title> | ||
19 | -<!--<script src="../lib/leaflet.js"></script>--> | ||
20 | -<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing" type="text/javascript"></script> | ||
21 | -<script src="../wicket.js" type="text/javascript"></script> | ||
22 | -<script src="../wicket-gmap3.js" type="text/javascript"></script> | ||
23 | -<script type="text/javascript"> | ||
24 | -var app = (function () { | ||
25 | - return { | ||
26 | - features: [], | ||
27 | - /** | ||
28 | - * Clears the map contents. | ||
29 | - */ | ||
30 | - clearMap: function () { | ||
31 | - var i; | ||
32 | - | ||
33 | - // Reset the remembered last string (so that we can clear the map, | ||
34 | - // paste the same string, and see it again) | ||
35 | - document.getElementById('wkt').last = ''; | ||
36 | - | ||
37 | - for (i in this.features) { | ||
38 | - if (this.features.hasOwnProperty(i)) { | ||
39 | - this.features[i].setMap(null); | ||
40 | - } | ||
41 | - } | ||
42 | - this.features.length = 0; | ||
43 | - }, | ||
44 | - /** | ||
45 | - * Clears the current contents of the textarea. | ||
46 | - */ | ||
47 | - clearText: function () { | ||
48 | - document.getElementById('wkt').value = ''; | ||
49 | - }, | ||
50 | - /** | ||
51 | - * Maps the current contents of the textarea. | ||
52 | - * @return {Object} Some sort of geometry object | ||
53 | - */ | ||
54 | - mapIt: function () { | ||
55 | - var el, obj, wkt; | ||
56 | - | ||
57 | - el = document.getElementById('wkt'); | ||
58 | - wkt = new Wkt.Wkt(); | ||
59 | - | ||
60 | - if (el.last === el.value) { // Remember the last string | ||
61 | - return; // Do nothing if the WKT string hasn't changed | ||
62 | - } else { | ||
63 | - el.last = el.value; | ||
64 | - } | ||
65 | - | ||
66 | - try { // Catch any malformed WKT strings | ||
67 | - wkt.read(el.value); | ||
68 | - } catch (e1) { | ||
69 | - try { | ||
70 | - wkt.read(el.value.replace('\n', '').replace('\r', '').replace('\t', '')); | ||
71 | - } catch (e2) { | ||
72 | - if (e2.name === 'WKTError') { | ||
73 | - alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.'); | ||
74 | - return; | ||
75 | - } | ||
76 | - } | ||
77 | - } | ||
78 | - | ||
79 | - obj = wkt.toObject(this.gmap.defaults); // Make an object | ||
80 | - | ||
81 | - // Add listeners for overlay editing events | ||
82 | - if (!Wkt.isArray(obj) && wkt.type !== 'point') { | ||
83 | - // New vertex is inserted | ||
84 | - google.maps.event.addListener(obj.getPath(), 'insert_at', function (n) { | ||
85 | - app.updateText(); | ||
86 | - }); | ||
87 | - // Existing vertex is removed (insertion is undone) | ||
88 | - google.maps.event.addListener(obj.getPath(), 'remove_at', function (n) { | ||
89 | - app.updateText(); | ||
90 | - }); | ||
91 | - // Existing vertex is moved (set elsewhere) | ||
92 | - google.maps.event.addListener(obj.getPath(), 'set_at', function (n) { | ||
93 | - app.updateText(); | ||
94 | - }); | ||
95 | - } else { | ||
96 | - if (obj.setEditable) {obj.setEditable(false);} | ||
97 | - } | ||
98 | - | ||
99 | - if (Wkt.isArray(obj)) { // Distinguish multigeometries (Arrays) from objects | ||
100 | - for (i in obj) { | ||
101 | - if (obj.hasOwnProperty(i) && !Wkt.isArray(obj[i])) { | ||
102 | - obj[i].setMap(this.gmap); | ||
103 | - } | ||
104 | - | ||
105 | - if (wkt.type !== 'point') { | ||
106 | - // New vertex is inserted | ||
107 | - google.maps.event.addListener(obj[i].getPath(), 'insert_at', function (n) { | ||
108 | - app.updateTextPart(); | ||
109 | - }); | ||
110 | - // Existing vertex is removed (insertion is undone) | ||
111 | - google.maps.event.addListener(obj[i].getPath(), 'remove_at', function (n) { | ||
112 | - app.updateTextPart(); | ||
113 | - }); | ||
114 | - // Existing vertex is moved (set elsewhere) | ||
115 | - google.maps.event.addListener(obj[i].getPath(), 'set_at', function (n) { | ||
116 | - app.updateTextPart(); | ||
117 | - }); | ||
118 | - } | ||
119 | - } | ||
120 | - | ||
121 | - this.features = this.features.concat(obj); | ||
122 | - } else { | ||
123 | - obj.setMap(this.gmap); // Add it to the map | ||
124 | - this.features.push(obj); | ||
125 | - } | ||
126 | - | ||
127 | - // Pan the map to the feature | ||
128 | - if (obj.getBounds !== undefined && typeof obj.getBounds === 'function') { | ||
129 | - // For objects that have defined bounds or a way to get them | ||
130 | - this.gmap.fitBounds(obj.getBounds()); | ||
131 | - } else { | ||
132 | - if (obj.getPath !== undefined && typeof obj.getPath === 'function') { | ||
133 | - // For Polygons and Polylines | ||
134 | - this.gmap.panTo(obj.getPath().getAt(0)); | ||
135 | - } else { // But points (Markers) are different | ||
136 | - if (obj.getPosition !== undefined && typeof obj.getPosition === 'function') { | ||
137 | - this.gmap.panTo(obj.getPosition()); | ||
138 | - } | ||
139 | - } | ||
140 | - } | ||
141 | - | ||
142 | - return obj; | ||
143 | - }, | ||
144 | - /** | ||
145 | - * Updates the textarea based on the first available feature. | ||
146 | - */ | ||
147 | - updateText: function () { | ||
148 | - var wkt = new Wkt.Wkt(); | ||
149 | - wkt.fromObject(this.features[0]); | ||
150 | - document.getElementById('wkt').value = wkt.write(); | ||
151 | - }, | ||
152 | - updateTextPart: function () { | ||
153 | - var i, w, v; | ||
154 | - | ||
155 | - w = new Wkt.Wkt(this.features[0]); | ||
156 | - | ||
157 | - i = 1; | ||
158 | - while (i < this.features.length) { | ||
159 | - v = new Wkt.Wkt(this.features[i]); | ||
160 | - w.merge(v); | ||
161 | - i += 1; | ||
162 | - } | ||
163 | - | ||
164 | - document.getElementById('wkt').value = w.write(); | ||
165 | - }, | ||
166 | - /** | ||
167 | - * Formats the textarea contents for a URL. | ||
168 | - * @param checked {Boolean} The check state of the associated checkbox | ||
169 | - */ | ||
170 | - urlify: function (checked) { | ||
171 | - var wkt = new Wkt.Wkt(); | ||
172 | - wkt.read(document.getElementById('wkt').value); | ||
173 | - wkt.delimiter = (checked) ? '+' : ' '; | ||
174 | - document.getElementById('wkt').value = wkt.write(); | ||
175 | - return wkt; | ||
176 | - }, | ||
177 | - /** | ||
178 | - * Application entry point. | ||
179 | - * @return {<google.maps.Map>} The Google Maps API instance | ||
180 | - */ | ||
181 | - init: function () { | ||
182 | - var gmap; | ||
183 | - | ||
184 | - gmap = new google.maps.Map(document.getElementById('canvas'), { | ||
185 | - center: new google.maps.LatLng(30, 10), | ||
186 | - defaults: { | ||
187 | - icon: 'red_dot.png', | ||
188 | - shadow: 'dot_shadow.png', | ||
189 | - editable: true, | ||
190 | - strokeColor: '#990000', | ||
191 | - fillColor: '#EEFFCC', | ||
192 | - fillOpacity: 0.6 | ||
193 | - }, | ||
194 | - disableDefaultUI: true, | ||
195 | - mapTypeControl: true, | ||
196 | - mapTypeId: google.maps.MapTypeId.ROADMAP, | ||
197 | - mapTypeControlOptions: { | ||
198 | - position: google.maps.ControlPosition.TOP_LEFT, | ||
199 | - style: google.maps.MapTypeControlStyle.DROPDOWN_MENU | ||
200 | - }, | ||
201 | - panControl: false, | ||
202 | - streetViewControl: false, | ||
203 | - zoom: 2, | ||
204 | - zoomControl: true, | ||
205 | - zoomControlOptions: { | ||
206 | - position: google.maps.ControlPosition.LEFT_TOP, | ||
207 | - style: google.maps.ZoomControlStyle.SMALL | ||
208 | - } | ||
209 | - }); | ||
210 | - | ||
211 | - google.maps.event.addListener(gmap, 'tilesloaded', function () { | ||
212 | - if (!this.loaded) { | ||
213 | - this.loaded = true; | ||
214 | - // NOTE: We start with a MULTIPOLYGON; these aren't easily deconstructed, so we won't set this object to be editable in this example | ||
215 | - document.getElementById('wkt').value = 'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20 25, 20 15, 30 20)))'; | ||
216 | - app.mapIt(); | ||
217 | - } | ||
218 | - }); | ||
219 | - | ||
220 | - gmap.drawingManager = new google.maps.drawing.DrawingManager({ | ||
221 | - drawingControlOptions: { | ||
222 | - position: google.maps.ControlPosition.TOP_CENTER, | ||
223 | - drawingModes: [ | ||
224 | - google.maps.drawing.OverlayType.MARKER, | ||
225 | - google.maps.drawing.OverlayType.POLYLINE, | ||
226 | - google.maps.drawing.OverlayType.POLYGON, | ||
227 | - google.maps.drawing.OverlayType.RECTANGLE | ||
228 | - ] | ||
229 | - }, | ||
230 | - markerOptions: gmap.defaults, | ||
231 | - polygonOptions: gmap.defaults, | ||
232 | - polylineOptions: gmap.defaults, | ||
233 | - rectangleOptions: gmap.defaults | ||
234 | - }); | ||
235 | - gmap.drawingManager.setMap(gmap); | ||
236 | - | ||
237 | - google.maps.event.addListener(gmap.drawingManager, 'overlaycomplete', function (event) { | ||
238 | - var wkt; | ||
239 | - | ||
240 | - app.clearText(); | ||
241 | - app.clearMap(); | ||
242 | - | ||
243 | - // Set the drawing mode to "pan" (the hand) so users can immediately edit | ||
244 | - this.setDrawingMode(null); | ||
245 | - | ||
246 | - // Polygon drawn | ||
247 | - if (event.type === google.maps.drawing.OverlayType.POLYGON || event.type === google.maps.drawing.OverlayType.POLYLINE) { | ||
248 | - // New vertex is inserted | ||
249 | - google.maps.event.addListener(event.overlay.getPath(), 'insert_at', function (n) { | ||
250 | - app.updateText(); | ||
251 | - }); | ||
252 | - | ||
253 | - // Existing vertex is removed (insertion is undone) | ||
254 | - google.maps.event.addListener(event.overlay.getPath(), 'remove_at', function (n) { | ||
255 | - app.updateText(); | ||
256 | - }); | ||
257 | - | ||
258 | - // Existing vertex is moved (set elsewhere) | ||
259 | - google.maps.event.addListener(event.overlay.getPath(), 'set_at', function (n) { | ||
260 | - app.updateText(); | ||
261 | - }); | ||
262 | - } else if (event.type === google.maps.drawing.OverlayType.RECTANGLE) { // Rectangle drawn | ||
263 | - // Listen for the 'bounds_changed' event and update the geometry | ||
264 | - google.maps.event.addListener(event.overlay, 'bounds_changed', function () { | ||
265 | - app.updateText(); | ||
266 | - }); | ||
267 | - } | ||
268 | - | ||
269 | - app.features.push(event.overlay); | ||
270 | - wkt = new Wkt.Wkt(); | ||
271 | - wkt.fromObject(event.overlay); | ||
272 | - document.getElementById('wkt').value = wkt.write(); | ||
273 | - }); | ||
274 | - | ||
275 | - return gmap; | ||
276 | - } | ||
277 | - }; | ||
278 | -}()); // Execute immediately | ||
279 | -</script> | ||
280 | -<body onload="app.gmap=app.init();"> | ||
281 | - <a href="http://github.com/arthur-e/Wicket"> | ||
282 | - <div id="forkme"> | ||
283 | - </div> | ||
284 | - </a> | ||
285 | - <div id="head"> | ||
286 | - <div class="wrapper"> | ||
287 | - </div> | ||
288 | - </div> | ||
289 | - <div id="ribbon"> | ||
290 | - <div class="wrapper"> | ||
291 | - <div id="canvas"> | ||
292 | - </div> | ||
293 | - <div id="controls"> | ||
294 | - <div class="title"> | ||
295 | - <div class="brand">Wicket</div> | ||
296 | - It whispers WKT in your application's ear. | ||
297 | - </div> | ||
298 | - <div class="text"> | ||
299 | - Wicket is a lightweight Javascript library that reads and writes <a href="http://en.wikipedia.org/wiki/Well-known_text#Geometric_objects" target="_blaknk">Well-Known Text (WKT)</a> strings. It can also be extended to parse and to create geometric objects from various mapping frameworks, such as <a href="http://http://leafletjs.com/" target="_blank">Leaflet</a> and the Google Maps API. | ||
300 | - </div> | ||
301 | - <div id="form"> | ||
302 | - <textarea type="text" name="wkt" id="wkt"></textarea> | ||
303 | - <label><input type="checkbox" name="urlify" id="urlify" onchange="app.urlify(this.checked);" />Format for URLs</label> | ||
304 | - <input type="submit" id="submit" value="Map It!" onclick="app.clearMap();app.mapIt();" /> | ||
305 | - <input type="reset" id="reset" value="Clear Map" onclick="app.clearText();app.clearMap();" /> | ||
306 | - </div> | ||
307 | - </div> | ||
308 | - </div> | ||
309 | - </div> | ||
310 | - <div id="foot"> | ||
311 | - <div class="wrapper"> | ||
312 | - <div class="menu" id="nav"> | ||
313 | - <a href="/">Home</a> | ||
314 | - <a href="mailto:kaendsle@mtu.edu">Contact Me</a> | ||
315 | - <a href="http://github.com/arthur-e/Wicket">"Fork me on GitHub!"</a> | ||
316 | - </div> | ||
317 | - <div class="attribute"> | ||
318 | - Design © 2012-2013 <a href="mailto:kaendsle@mtu.edu">K. Arthur Endsley</a> | ||
319 | - <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB"> | ||
320 | - <img alt="Wicket is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License" style="float:right;border-width:0;vertical-align:middle;" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png" /> | ||
321 | - </a><br /> | ||
322 | - Wicket is released under the <a href="https://github.com/arthur-e/Wicket/blob/master/LICENSE" target="_blank">GPL v3</a><br /> | ||
323 | - </div> | ||
324 | - </div> | ||
325 | - </div> | ||
326 | -</body> | ||
327 | -</html> |
pacotes/wicket/doc/index.ie.css
@@ -1,85 +0,0 @@ | @@ -1,85 +0,0 @@ | ||
1 | -body {margin:0;padding:0;background:#CF6;border-top:5px solid #000;font-family:Helvetica,Arial,sans-serif;font-size:14px;} | ||
2 | -img {border:none;} | ||
3 | -label {color:#666;} | ||
4 | -label:hover {color:#333;} | ||
5 | -a:link, | ||
6 | -a:visited {color:#460;text-decoration:none;} | ||
7 | - | ||
8 | -.leaflet-container .leaflet-control-attribution {color:white;background:none !important;box-shadow:none !important;} | ||
9 | -.leaflet-container .leaflet-control-attribution a:link, | ||
10 | -.leaflet-container .leaflet-control-attribution a:visited {color:#8C0;} | ||
11 | - | ||
12 | -.attribute {width:290px;float:right;padding:10px 0;text-align:left;font-size:10px;line-height:16px;} | ||
13 | -.menu {float:left;margin:0;padding:0;list-style:none;} | ||
14 | -.menu a {display:inline-block;margin:0;padding:5px 0 10px;margin:0 25px 0 0;border-top:5px solid transparent;} | ||
15 | -.menu a:hover, | ||
16 | -.menu a:active {border-top:5px solid #999;color:#000;text-decoration:none;} | ||
17 | -.text {color:#333;} | ||
18 | -.wrapper {width:1000px;height:100%;margin:0 auto;} | ||
19 | - | ||
20 | -#canvas {width:698px;height:100%;background:#AAA;border-left:1px solid #999;border-right:1px solid #999;} | ||
21 | -#canvas, | ||
22 | -#controls {float:left;} | ||
23 | -#controls {width:290px;height:100%;padding:0 0 0 10px;text-align:justify;background:transparent;position:relative;top:-80px;} | ||
24 | -#controls .text {margin:90px 0 0;} | ||
25 | -#controls a:hover, | ||
26 | -#controls a:active {text-decoration:underline;} | ||
27 | -#forkme {width:141px;height:141px;z-index:9999;position:absolute;left:0;top:4px;background:transparent url(https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png) no-repeat left top;} | ||
28 | -#form {margin:10px 0 0;font-size:14px;color:#666;font-family:CabinItalic,sans-serif;} | ||
29 | -#form #wkt {width:100%;height:150px;border:1px solid #999;padding:3px;resize:none;} | ||
30 | -#form #urlify {vertical-align:baseline;margin:10px 5px 0 0;} | ||
31 | -#form #reset {margin:10px 10px 0 0; | ||
32 | - filter: progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc'); | ||
33 | - -ms-filter: "progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc')"; | ||
34 | - background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); | ||
35 | - background-image: -ms-linear-gradient(top, #eeeeee, #cccccc); | ||
36 | - background-image: -o-linear-gradient(top, #eeeeee, #cccccc); | ||
37 | - background-image: -webkit-gradient(linear, center top, center bottom, from(#eeeeee), to(#cccccc)); | ||
38 | - background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc); | ||
39 | - background-image: linear-gradient(top, #eeeeee, #cccccc); | ||
40 | - -moz-background-clip: padding; | ||
41 | - -webkit-background-clip: padding-box; | ||
42 | - background-clip: padding-box; | ||
43 | - } | ||
44 | -#form #reset, | ||
45 | -#form #submit {float:right;height:30px;margin-top:10px;padding:0 5px 2px 5px;font-family:CabinItalic,sans-serif;font-size:16px;color:#666; | ||
46 | - border: 1px solid #999999; | ||
47 | - -moz-border-radius: 5px; | ||
48 | - -webkit-border-radius: 5px; | ||
49 | - border-radius: 5px; | ||
50 | - } | ||
51 | -#form #submit {background-color: #EF9; | ||
52 | - filter: progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeffcc', endColorstr = '#ddff99'); | ||
53 | - -ms-filter: "progid: DXImageTransform.Microsoft.gradient(startColorstr = '#eeffcc', endColorstr = '#ddff99')"; | ||
54 | - background-image: -moz-linear-gradient(top, #eeffcc, #ddff99); | ||
55 | - background-image: -ms-linear-gradient(top, #eeffcc, #ddff99); | ||
56 | - background-image: -o-linear-gradient(top, #eeffcc, #ddff99); | ||
57 | - background-image: -webkit-gradient(linear, center top, center bottom, from(#eeffcc), to(#ddff99)); | ||
58 | - background-image: -webkit-linear-gradient(top, #eeffcc, #ddff99); | ||
59 | - background-image: linear-gradient(top, #eeffcc, #ddff99); | ||
60 | - -moz-background-clip: padding; | ||
61 | - -webkit-background-clip: padding-box; | ||
62 | - background-clip: padding-box; | ||
63 | - } | ||
64 | -#form #reset:hover, | ||
65 | -#form #submit:hover {color:#333;border-color:#666;text-shadow:1px 1px 0px #FFF; | ||
66 | - -moz-box-shadow: 0px 0px 2px #999999; | ||
67 | - -webkit-box-shadow: 0px 0px 2px #999999; | ||
68 | - box-shadow: 0px 0px 2px #999999; | ||
69 | - } | ||
70 | -#form #reset:active, | ||
71 | -#form #submit:active { | ||
72 | - -moz-box-shadow:inset 0px 0px 2px #999999; | ||
73 | - -webkit-box-shadow:inset 0px 0px 2px #999999; | ||
74 | - box-shadow:inset 0px 0px 2px #999999; | ||
75 | - } | ||
76 | -#foot {background:transparent url(white_spacer.gif) repeat-x top left;} | ||
77 | -#foot, | ||
78 | -#head {width:100%;height:20%;color:#333;} | ||
79 | -#head {background:transparent url(white_spacer.gif) repeat-x bottom left;} | ||
80 | -#nav {width:698px;text-align:left;} | ||
81 | -#ribbon {width:100%;height:60%;background:#EEE;} | ||
82 | -#ribbon .wrapper {} | ||
83 | -#ribbon .wrapper .title {float:right;width:300px;height:80px;font-family:CabinRegular,sans-serif;font-size:16px;color:#333;} | ||
84 | -#ribbon .wrapper .title .brand {font-family:CabinMediumItalic,sans-serif;font-size:36px;color:#000;text-shadow:1px 1px 1px #FFF;} | ||
85 | - |
pacotes/wicket/doc/leaflet.html
@@ -1,266 +0,0 @@ | @@ -1,266 +0,0 @@ | ||
1 | -<html> | ||
2 | -<head> | ||
3 | - <link rel="stylesheet" type="text/css" href="/static/font/Cabin.css" /> | ||
4 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
5 | - <!-- Conditional commenting for non-IE browsers --> | ||
6 | - <!--[if !IE]><!--> | ||
7 | - <link rel="stylesheet" type="text/css" href="/static/wicket/doc/index.css" /> | ||
8 | - <!--<![endif]--> | ||
9 | - <!-- Conditional commenting for IE 6.x --> | ||
10 | - <!--[if IE]> | ||
11 | - <link rel="stylesheet" type="text/css" href="/static/wicket/doc/index.ie.css" /> | ||
12 | - <![endif]--> | ||
13 | - <link rel="stylesheet" href="/static/leaflet/0.5.1/dist/leaflet.css" /> | ||
14 | - <!--[if lte IE 8]> | ||
15 | - <link rel="stylesheet" href="/static/leaflet/0.5.1/dist/leaflet.ie.css" /> | ||
16 | - <![endif]--> | ||
17 | -</head> | ||
18 | -<title>Wicket - Lightweight Javascript for WKT [Leaflet Sandbox]</title> | ||
19 | -<script src="/static/leaflet/0.5.1/dist/leaflet.js"></script> | ||
20 | -<!--See https://github.com/seelmann/leaflet-providers for below--> | ||
21 | -<script src="/static/leaflet/plugins/leaflet-providers.js"></script> | ||
22 | -<script src="../wicket.js" type="text/javascript"></script> | ||
23 | -<script src="../wicket-leaflet.js" type="text/javascript"></script> | ||
24 | -<script type="text/javascript"> | ||
25 | -var app = (function () { | ||
26 | - return { | ||
27 | - features: [], | ||
28 | - | ||
29 | - /** | ||
30 | - * Clears the map contents. | ||
31 | - */ | ||
32 | - clearMap: function () { | ||
33 | - var i; | ||
34 | - | ||
35 | - // Reset the remembered last string (so that we can clear the map, | ||
36 | - // paste the same string, and see it again) | ||
37 | - document.getElementById('wkt').last = ''; | ||
38 | - | ||
39 | - for (i in this.features) { | ||
40 | - if (this.features.hasOwnProperty(i)) { | ||
41 | - this.map.removeLayer(this.features[i]); | ||
42 | - } | ||
43 | - } | ||
44 | - this.features.length = 0; | ||
45 | - }, | ||
46 | - | ||
47 | - /** | ||
48 | - * Clears the current contents of the textarea. | ||
49 | - */ | ||
50 | - clearText: function () { | ||
51 | - document.getElementById('wkt').value = ''; | ||
52 | - }, | ||
53 | - | ||
54 | - /** | ||
55 | - * Maps the current contents of the textarea. | ||
56 | - * @param editable {Boolean} Indicates that the feature drawn should be editable | ||
57 | - * @param focus {Boolean} Indicates that the map should pan and/or zoom to new features | ||
58 | - * @return {Object} Some sort of geometry object | ||
59 | - */ | ||
60 | - mapIt: function (editable, focus) { | ||
61 | - var config, el, obj, wkt; | ||
62 | - | ||
63 | - // Indicates that the map should pan and/or zoom to new features | ||
64 | - focus = focus || false; | ||
65 | - | ||
66 | - if (editable === undefined) { | ||
67 | - editable = true; | ||
68 | - } | ||
69 | - | ||
70 | - el = document.getElementById('wkt'); | ||
71 | - wkt = new Wkt.Wkt(); | ||
72 | - | ||
73 | - if (el.last === el.value) { // Remember the last string | ||
74 | - return; // Do nothing if the WKT string hasn't changed | ||
75 | - } else { | ||
76 | - el.last = el.value; | ||
77 | - } | ||
78 | - | ||
79 | - try { // Catch any malformed WKT strings | ||
80 | - wkt.read(el.value); | ||
81 | - } catch (e1) { | ||
82 | - try { | ||
83 | - wkt.read(el.value.replace('\n', '').replace('\r', '').replace('\t', '')); | ||
84 | - } catch (e2) { | ||
85 | - if (e2.name === 'WKTError') { | ||
86 | - alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.'); | ||
87 | - return; | ||
88 | - } | ||
89 | - } | ||
90 | - } | ||
91 | - | ||
92 | - config = this.map.defaults; | ||
93 | - config.editable = editable; | ||
94 | - | ||
95 | - obj = wkt.toObject(this.map.defaults); // Make an object | ||
96 | - | ||
97 | - // Add listeners for overlay editing events | ||
98 | - if (wkt.type === 'polygon' || wkt.type === 'linestring') { | ||
99 | - } | ||
100 | - | ||
101 | - if (Wkt.isArray(obj)) { // Distinguish multigeometries (Arrays) from objects | ||
102 | - for (i in obj) { | ||
103 | - if (obj.hasOwnProperty(i) && !Wkt.isArray(obj[i])) { | ||
104 | - obj[i].addTo(this.map); | ||
105 | - this.features.push(obj[i]); | ||
106 | - } | ||
107 | - } | ||
108 | - } else { | ||
109 | - obj.addTo(this.map); // Add it to the map | ||
110 | - this.features.push(obj); | ||
111 | - } | ||
112 | - | ||
113 | - // Pan the map to the feature | ||
114 | - if (focus && obj.getBounds !== undefined && typeof obj.getBounds === 'function') { | ||
115 | - // For objects that have defined bounds or a way to get them | ||
116 | - this.map.fitBounds(obj.getBounds()); | ||
117 | - } else { | ||
118 | - if (focus && obj.getLatLng !== undefined && typeof obj.getLatLng === 'function') { | ||
119 | - this.map.panTo(obj.getLatLng()); | ||
120 | - } | ||
121 | - } | ||
122 | - | ||
123 | - return obj; | ||
124 | - }, | ||
125 | - | ||
126 | - /** | ||
127 | - * Updates the textarea based on the first available feature. | ||
128 | - */ | ||
129 | - updateText: function () { | ||
130 | - var wkt = new Wkt.Wkt(); | ||
131 | - wkt.fromObject(this.features[0]); | ||
132 | - document.getElementById('wkt').value = wkt.write(); | ||
133 | - }, | ||
134 | - | ||
135 | - /** | ||
136 | - * Formats the textarea contents for a URL. | ||
137 | - * @param checked {Boolean} The check state of the associated checkbox | ||
138 | - */ | ||
139 | - urlify: function (checked) { | ||
140 | - var wkt = new Wkt.Wkt(); | ||
141 | - wkt.read(document.getElementById('wkt').value); | ||
142 | - wkt.delimiter = (checked) ? '+' : ' '; | ||
143 | - document.getElementById('wkt').value = wkt.write(); | ||
144 | - return wkt; | ||
145 | - }, | ||
146 | - | ||
147 | - /** | ||
148 | - * Application entry point. | ||
149 | - * @return {<L.map>} The Leaflet instance | ||
150 | - */ | ||
151 | - init: function () { | ||
152 | - var leaflet, that; | ||
153 | - | ||
154 | - that = this; | ||
155 | - | ||
156 | - leaflet = { | ||
157 | - baseLayers: undefined, | ||
158 | - overlays: undefined | ||
159 | - }; | ||
160 | - | ||
161 | - // Stamen ////////////////////////////////////////////////////////////////////// | ||
162 | - | ||
163 | - leaflet.baseLayers = { | ||
164 | - 'Stamen Toner Map': L.tileLayer.provider('Stamen.Toner') | ||
165 | - }; | ||
166 | - | ||
167 | - // Configure map /////////////////////////////////////////////////// | ||
168 | - leaflet.map = L.map('canvas', { | ||
169 | - zoomControl: true, | ||
170 | - attributionControl: true, | ||
171 | - layers: [ | ||
172 | - leaflet.baseLayers['Stamen Toner Map'], | ||
173 | - ] | ||
174 | - }); | ||
175 | - | ||
176 | - leaflet.map.defaults = { | ||
177 | - icon: new L.Icon({ | ||
178 | - iconUrl: 'red_dot.png', | ||
179 | - iconSize: [16, 16], | ||
180 | - iconAnchor: [8, 8], | ||
181 | - shadowUrl: 'dot_shadow.png', | ||
182 | - shadowSize: [16, 16], | ||
183 | - shadowAnchor: [8, 8] | ||
184 | - }), | ||
185 | - editable: true, | ||
186 | - color: '#AA0000', | ||
187 | - weight: 3, | ||
188 | - opacity: 1.0, | ||
189 | - editable: true, | ||
190 | - fillColor: '#AA0000', | ||
191 | - fillOpacity: 0.2 | ||
192 | - }; | ||
193 | - | ||
194 | - // Set event handlers ////////////////////////////////////////////// | ||
195 | - leaflet.map.loaded = false; | ||
196 | - leaflet.map.on('load', function () { | ||
197 | - if (!this.loaded) { | ||
198 | - this.loaded = true; | ||
199 | - document.getElementById('wkt').value = 'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20 25, 20 15, 30 20)))'; | ||
200 | - } | ||
201 | - }); | ||
202 | - | ||
203 | - // There are no 'edit' events, so let's catch editing at its most | ||
204 | - // fundamental: the mouseup event on the map | ||
205 | - leaflet.map.on('mouseup', function () { | ||
206 | - that.updateText() | ||
207 | - }); | ||
208 | - | ||
209 | - // Initialize the map ////////////////////////////////////////////// | ||
210 | - leaflet.map.setView([10, 20], 2); | ||
211 | - | ||
212 | - return leaflet.map; | ||
213 | - } | ||
214 | - | ||
215 | - }; | ||
216 | - | ||
217 | -}()); | ||
218 | -</script> | ||
219 | -<body onload="app.map=app.init();app.mapIt(true, false);"> | ||
220 | - <div id="head"> | ||
221 | - <div class="wrapper"> | ||
222 | - </div> | ||
223 | - </div> | ||
224 | - <div id="ribbon"> | ||
225 | - <div class="wrapper"> | ||
226 | - <a href="http://github.com/arthur-e/Wicket"> | ||
227 | - <div id="forkme"> | ||
228 | - </div> | ||
229 | - </a> | ||
230 | - <div id="canvas"> | ||
231 | - </div> | ||
232 | - <div id="controls"> | ||
233 | - <div class="title"> | ||
234 | - <div class="brand">Wicket</div> | ||
235 | - It whispers WKT in your application's ear. | ||
236 | - </div> | ||
237 | - <div class="text"> | ||
238 | - Wicket is a lightweight Javascript library that reads and writes <a href="http://en.wikipedia.org/wiki/Well-known_text#Geometric_objects" target="_blaknk">Well-Known Text (WKT)</a> strings. It can also be extended to parse and to create geometric objects from various mapping frameworks, such as <a href="http://http://leafletjs.com/" target="_blank">Leaflet</a> and the Google Maps API. | ||
239 | - </div> | ||
240 | - <div id="form"> | ||
241 | - <textarea type="text" name="wkt" id="wkt"></textarea> | ||
242 | - <label><input type="checkbox" name="urlify" id="urlify" onchange="app.urlify(this.checked);" />Format for URLs</label> | ||
243 | - <input type="submit" id="submit" value="Map It!" onclick="app.clearMap();app.mapIt(true, true);" /> | ||
244 | - <input type="reset" id="reset" value="Clear Map" onclick="app.clearText();app.clearMap();" /> | ||
245 | - </div> | ||
246 | - </div> | ||
247 | - </div> | ||
248 | - </div> | ||
249 | - <div id="foot"> | ||
250 | - <div class="wrapper"> | ||
251 | - <div class="menu" id="nav"> | ||
252 | - <a href="/">Home</a> | ||
253 | - <a href="mailto:kaendsle@mtu.edu">Contact Me</a> | ||
254 | - <a href="http://github.com/arthur-e/Wicket">"Fork me on GitHub!"</a> | ||
255 | - </div> | ||
256 | - <div class="attribute"> | ||
257 | - Design © 2012-2013 <a href="mailto:kaendsle@mtu.edu">K. Arthur Endsley</a> | ||
258 | - <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB"> | ||
259 | - <img alt="Wicket is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License" style="float:right;border-width:0;vertical-align:middle;" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png" /> | ||
260 | - </a><br /> | ||
261 | - Wicket is released under the <a href="https://github.com/arthur-e/Wicket/blob/master/LICENSE" target="_blank">GPL v3</a> | ||
262 | - </div> | ||
263 | - </div> | ||
264 | - </div> | ||
265 | -</body> | ||
266 | -</html> |
pacotes/wicket/doc/red_dot.png
1.16 KB
pacotes/wicket/doc/white_spacer.gif
35 Bytes
pacotes/wicket/package.json
@@ -1,67 +0,0 @@ | @@ -1,67 +0,0 @@ | ||
1 | -{ | ||
2 | - "name": "wicket", | ||
3 | - "version": "1.1.0", | ||
4 | - "description": "A modest library for moving between Well-Known Text (WKT) and various framework geometries", | ||
5 | - "homepage": "https://github.com/arthur-e/Wicket", | ||
6 | - "keywords": [ | ||
7 | - "wkt", | ||
8 | - "map", | ||
9 | - "mapping", | ||
10 | - "geometry", | ||
11 | - "leaflet" | ||
12 | - ], | ||
13 | - "maintainers": [{ | ||
14 | - "name": "K. Arthur Endsley", | ||
15 | - "email": "kaendsle@mtu.edu", | ||
16 | - "web": "https://github.com/arthur-e" | ||
17 | - }], | ||
18 | - "contributors": [{ | ||
19 | - "name": "K. Arthur Endsley", | ||
20 | - "email": "kaendsle@mtu.edu", | ||
21 | - "web": "https://github.com/arthur-e" | ||
22 | - }, { | ||
23 | - "name": "cuyahoga", | ||
24 | - "web": "https://github.com/cuyahoga" | ||
25 | - }, { | ||
26 | - "name": "Tom Nightingale", | ||
27 | - "web": "https://github.com/thegreat" | ||
28 | - }, { | ||
29 | - "name": "Aaron Ogle", | ||
30 | - "web": "https://github.com/atogle" | ||
31 | - }, { | ||
32 | - "name": "James Seppi", | ||
33 | - "web": "https://github.com/jseppi" | ||
34 | - }, { | ||
35 | - "name": "tchannel", | ||
36 | - "web": "https://github.com/tchannel" | ||
37 | - }, { | ||
38 | - "name": "Felipe Figueroa", | ||
39 | - "web": "https://github.com/amenadiel" | ||
40 | - }, { | ||
41 | - "name": "Matthijs van Henten", | ||
42 | - "web": "https://github.com/mvhenten" | ||
43 | - }], | ||
44 | - "bugs": { | ||
45 | - "mail": "kaendsle@mtu.edu", | ||
46 | - "url": "https://github.com/arthur-e/Wicket/issues" | ||
47 | - }, | ||
48 | - "licenses": [{ | ||
49 | - "type": "GPLv3", | ||
50 | - "url": "https://raw.github.com/arthur-e/Wicket/master/LICENSE" | ||
51 | - }], | ||
52 | - "repository": { | ||
53 | - "type": "git", | ||
54 | - "url": "https://github.com/arthur-e/Wicket" | ||
55 | - }, | ||
56 | - "scripts": { | ||
57 | - "postinstall": "export PATH=$PATH:/usr/local/lib/node_modules/uglify-js/bin/;unzip ./node_modules/jasmine-core/dist/jasmine-standalone-2.0.0.zip -d ./node_modules/jasmine-core/dist/", | ||
58 | - "build": "uglifyjs wicket.js -o wicket.min.js;uglifyjs wicket-gmap3.js -o wicket-gmap3.min.js;uglifyjs wicket-arcgis.js -o wicket-arcgis.min.js;uglifyjs wicket-leaflet.js -o wicket-leaflet.min.js;", | ||
59 | - "test": "./node_modules/mocha/bin/mocha -R tap tests/wicket-spec.js" | ||
60 | - }, | ||
61 | - "devDependencies": { | ||
62 | - "chai": "*", | ||
63 | - "mocha": "*", | ||
64 | - "uglify-js": "2.4.x", | ||
65 | - "jasmine": "git://github.com/pivotal/jasmine#master" | ||
66 | - } | ||
67 | -} |
pacotes/wicket/tests/wicket-gmap3-spec.js
@@ -1,880 +0,0 @@ | @@ -1,880 +0,0 @@ | ||
1 | -describe('Standard WKT Test Cases: ', function () { | ||
2 | - var cases, wkt; | ||
3 | - | ||
4 | - wkt = new Wkt.Wkt(); | ||
5 | - | ||
6 | - cases = { | ||
7 | - | ||
8 | - point: { | ||
9 | - str: 'POINT(30 10)', | ||
10 | - cmp: [{ | ||
11 | - x: 30, | ||
12 | - y: 10 | ||
13 | - }], | ||
14 | - obj: new google.maps.Point(30, 10), | ||
15 | - json: { | ||
16 | - 'coordinates': [30, 10], | ||
17 | - 'type': 'Point' | ||
18 | - }, | ||
19 | - }, | ||
20 | - | ||
21 | - marker: { | ||
22 | - str: 'POINT(30 10)', | ||
23 | - cmp: [{ | ||
24 | - x: 30, | ||
25 | - y: 10 | ||
26 | - }], | ||
27 | - obj: new google.maps.Marker({ | ||
28 | - position: new google.maps.LatLng(10, 30) | ||
29 | - }) | ||
30 | - }, | ||
31 | - | ||
32 | - linestring: { | ||
33 | - str: 'LINESTRING(30 10,10 30,40 40)', | ||
34 | - cmp: [{ | ||
35 | - x: 30, | ||
36 | - y: 10 | ||
37 | - }, { | ||
38 | - x: 10, | ||
39 | - y: 30 | ||
40 | - }, { | ||
41 | - x: 40, | ||
42 | - y: 40 | ||
43 | - }], | ||
44 | - obj: new google.maps.Polyline({ | ||
45 | - editable: false, | ||
46 | - path: [ | ||
47 | - new google.maps.LatLng(10, 30), | ||
48 | - new google.maps.LatLng(30, 10), | ||
49 | - new google.maps.LatLng(40, 40) | ||
50 | - ] | ||
51 | - }), | ||
52 | - json: { | ||
53 | - 'coordinates': [ | ||
54 | - [30, 10], | ||
55 | - [10, 30], | ||
56 | - [40, 40] | ||
57 | - ], | ||
58 | - 'type': 'LineString' | ||
59 | - }, | ||
60 | - }, | ||
61 | - | ||
62 | - | ||
63 | - polygon: { | ||
64 | - str: 'POLYGON((30 10,10 20,20 40,40 40,30 10))', | ||
65 | - cmp: [ | ||
66 | - [{ | ||
67 | - x: 30, | ||
68 | - y: 10 | ||
69 | - }, { | ||
70 | - x: 10, | ||
71 | - y: 20 | ||
72 | - }, { | ||
73 | - x: 20, | ||
74 | - y: 40 | ||
75 | - }, { | ||
76 | - x: 40, | ||
77 | - y: 40 | ||
78 | - }, { | ||
79 | - x: 30, | ||
80 | - y: 10 | ||
81 | - }] | ||
82 | - ], | ||
83 | - obj: new google.maps.Polygon({ | ||
84 | - editable: false, | ||
85 | - paths: [ | ||
86 | - [ | ||
87 | - new google.maps.LatLng(10, 30), | ||
88 | - new google.maps.LatLng(20, 10), | ||
89 | - new google.maps.LatLng(40, 20), | ||
90 | - new google.maps.LatLng(40, 40) | ||
91 | - ] | ||
92 | - ] | ||
93 | - }), | ||
94 | - json: { | ||
95 | - 'coordinates': [ | ||
96 | - [ | ||
97 | - [30, 10], | ||
98 | - [10, 20], | ||
99 | - [20, 40], | ||
100 | - [40, 40], | ||
101 | - [30, 10] | ||
102 | - ] | ||
103 | - ], | ||
104 | - 'type': 'Polygon' | ||
105 | - }, | ||
106 | - | ||
107 | - }, | ||
108 | - | ||
109 | - polygon2: { | ||
110 | - str: 'POLYGON((35 10,10 20,15 40,45 45,35 10),(25 30,35 35,30 20,25 30))', | ||
111 | - cmp: [ | ||
112 | - [{ | ||
113 | - x: 35, | ||
114 | - y: 10 | ||
115 | - }, { | ||
116 | - x: 10, | ||
117 | - y: 20 | ||
118 | - }, { | ||
119 | - x: 15, | ||
120 | - y: 40 | ||
121 | - }, { | ||
122 | - x: 45, | ||
123 | - y: 45 | ||
124 | - }, { | ||
125 | - x: 35, | ||
126 | - y: 10 | ||
127 | - }], | ||
128 | - [{ | ||
129 | - x: 25, | ||
130 | - y: 30 | ||
131 | - }, { | ||
132 | - x: 35, | ||
133 | - y: 35 | ||
134 | - }, { | ||
135 | - x: 30, | ||
136 | - y: 20 | ||
137 | - }, { | ||
138 | - x: 25, | ||
139 | - y: 30 | ||
140 | - }] | ||
141 | - ], | ||
142 | - obj: new google.maps.Polygon({ | ||
143 | - editable: false, | ||
144 | - paths: [ | ||
145 | - [ | ||
146 | - new google.maps.LatLng(10, 35), | ||
147 | - new google.maps.LatLng(20, 10), | ||
148 | - new google.maps.LatLng(40, 15), | ||
149 | - new google.maps.LatLng(45, 45) | ||
150 | - ], | ||
151 | - [ // Order in inner rings is reversed | ||
152 | - new google.maps.LatLng(20, 30), | ||
153 | - new google.maps.LatLng(35, 35), | ||
154 | - new google.maps.LatLng(30, 25) | ||
155 | - ] | ||
156 | - ] | ||
157 | - }), | ||
158 | - json: { | ||
159 | - 'coordinates': [ | ||
160 | - [ | ||
161 | - [35, 10], | ||
162 | - [10, 20], | ||
163 | - [15, 40], | ||
164 | - [45, 45], | ||
165 | - [35, 10] | ||
166 | - ], | ||
167 | - [ | ||
168 | - [25, 30], | ||
169 | - [35, 35], | ||
170 | - [30, 20], | ||
171 | - [25, 30] | ||
172 | - ] | ||
173 | - ], | ||
174 | - 'type': 'Polygon' | ||
175 | - }, | ||
176 | - jsonStr: '{"coordinates": [[[35, 10], [45, 45], [15, 40], [10, 20], [35, 10]], [[20, 30], [35, 35], [30, 20], [20, 30]]], "type": "Polygon"}' | ||
177 | - }, | ||
178 | - | ||
179 | - multipoint: { | ||
180 | - str: 'MULTIPOINT((10 40),(40 30),(20 20),(30 10))', | ||
181 | - cmp: [ | ||
182 | - [{ | ||
183 | - x: 10, | ||
184 | - y: 40 | ||
185 | - }], | ||
186 | - [{ | ||
187 | - x: 40, | ||
188 | - y: 30 | ||
189 | - }], | ||
190 | - [{ | ||
191 | - x: 20, | ||
192 | - y: 20 | ||
193 | - }], | ||
194 | - [{ | ||
195 | - x: 30, | ||
196 | - y: 10 | ||
197 | - }] | ||
198 | - ], | ||
199 | - obj: [ | ||
200 | - new google.maps.Marker({ | ||
201 | - position: new google.maps.LatLng(40, 10) | ||
202 | - }), | ||
203 | - new google.maps.Marker({ | ||
204 | - position: new google.maps.LatLng(30, 40) | ||
205 | - }), | ||
206 | - new google.maps.Marker({ | ||
207 | - position: new google.maps.LatLng(20, 20) | ||
208 | - }), | ||
209 | - new google.maps.Marker({ | ||
210 | - position: new google.maps.LatLng(10, 30) | ||
211 | - }), | ||
212 | - ], | ||
213 | - json: { | ||
214 | - 'coordinates': [ | ||
215 | - [10, 40], | ||
216 | - [40, 30], | ||
217 | - [20, 20], | ||
218 | - [30, 10] | ||
219 | - ], | ||
220 | - 'type': 'MultiPoint' | ||
221 | - }, | ||
222 | - jsonStr: '{"coordinates": [[10, 40], [40, 30], [20, 20], [30, 10]], "type": "MultiPoint"}' | ||
223 | - }, | ||
224 | - | ||
225 | - multilinestring: { | ||
226 | - str: 'MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10))', | ||
227 | - cmp: [ | ||
228 | - [{ | ||
229 | - x: 10, | ||
230 | - y: 10 | ||
231 | - }, { | ||
232 | - x: 20, | ||
233 | - y: 20 | ||
234 | - }, { | ||
235 | - x: 10, | ||
236 | - y: 40 | ||
237 | - }], | ||
238 | - [{ | ||
239 | - x: 40, | ||
240 | - y: 40 | ||
241 | - }, { | ||
242 | - x: 30, | ||
243 | - y: 30 | ||
244 | - }, { | ||
245 | - x: 40, | ||
246 | - y: 20 | ||
247 | - }, { | ||
248 | - x: 30, | ||
249 | - y: 10 | ||
250 | - }] | ||
251 | - ], | ||
252 | - obj: [ | ||
253 | - new google.maps.Polyline({ | ||
254 | - editable: false, | ||
255 | - path: [ | ||
256 | - new google.maps.LatLng(10, 10), | ||
257 | - new google.maps.LatLng(20, 20), | ||
258 | - new google.maps.LatLng(40, 10) | ||
259 | - ] | ||
260 | - }), | ||
261 | - new google.maps.Polyline({ | ||
262 | - editable: false, | ||
263 | - path: [ | ||
264 | - new google.maps.LatLng(40, 40), | ||
265 | - new google.maps.LatLng(30, 30), | ||
266 | - new google.maps.LatLng(20, 40), | ||
267 | - new google.maps.LatLng(10, 30) | ||
268 | - ] | ||
269 | - }) | ||
270 | - ], | ||
271 | - json: { | ||
272 | - 'coordinates': [ | ||
273 | - [ | ||
274 | - [10, 10], | ||
275 | - [20, 20], | ||
276 | - [10, 40] | ||
277 | - ], | ||
278 | - [ | ||
279 | - [40, 40], | ||
280 | - [30, 30], | ||
281 | - [40, 20], | ||
282 | - [30, 10] | ||
283 | - ] | ||
284 | - ], | ||
285 | - 'type': 'MultiLineString' | ||
286 | - }, | ||
287 | - jsonStr: '{"coordinates": [[[10, 10], [20, 20], [10, 40]], [[40, 40], [30, 30], [40, 20], [30, 10]]], "type": "MultiLineString"}' | ||
288 | - }, | ||
289 | - | ||
290 | - multipolygon: { | ||
291 | - str: 'MULTIPOLYGON(((30 20,10 40,45 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))', | ||
292 | - cmp: [ | ||
293 | - [ | ||
294 | - [{ | ||
295 | - x: 30, | ||
296 | - y: 20 | ||
297 | - }, { | ||
298 | - x: 10, | ||
299 | - y: 40 | ||
300 | - }, { | ||
301 | - x: 45, | ||
302 | - y: 40 | ||
303 | - }, { | ||
304 | - x: 30, | ||
305 | - y: 20 | ||
306 | - }, ] | ||
307 | - ], | ||
308 | - [ | ||
309 | - [{ | ||
310 | - x: 15, | ||
311 | - y: 5 | ||
312 | - }, { | ||
313 | - x: 40, | ||
314 | - y: 10 | ||
315 | - }, { | ||
316 | - x: 10, | ||
317 | - y: 20 | ||
318 | - }, { | ||
319 | - x: 5, | ||
320 | - y: 10 | ||
321 | - }, { | ||
322 | - x: 15, | ||
323 | - y: 5 | ||
324 | - }] | ||
325 | - ] | ||
326 | - ], | ||
327 | - obj: [ | ||
328 | - new google.maps.Polygon({ | ||
329 | - editable: false, | ||
330 | - paths: [ | ||
331 | - [ | ||
332 | - new google.maps.LatLng(20, 30), | ||
333 | - new google.maps.LatLng(40, 10), | ||
334 | - new google.maps.LatLng(40, 45) | ||
335 | - ] | ||
336 | - ] | ||
337 | - }), | ||
338 | - new google.maps.Polygon({ | ||
339 | - editable: false, | ||
340 | - paths: [ | ||
341 | - [ | ||
342 | - new google.maps.LatLng(5, 15), | ||
343 | - new google.maps.LatLng(10, 40), | ||
344 | - new google.maps.LatLng(20, 10), | ||
345 | - new google.maps.LatLng(10, 5) | ||
346 | - ] | ||
347 | - ] | ||
348 | - }) | ||
349 | - ], | ||
350 | - json: { | ||
351 | - 'coordinates': [ | ||
352 | - [ | ||
353 | - [ | ||
354 | - [30, 20], | ||
355 | - [10, 40], | ||
356 | - [45, 40], | ||
357 | - [30, 20] | ||
358 | - ] | ||
359 | - ], | ||
360 | - [ | ||
361 | - [ | ||
362 | - [15, 5], | ||
363 | - [40, 10], | ||
364 | - [10, 20], | ||
365 | - [5, 10], | ||
366 | - [15, 5] | ||
367 | - ] | ||
368 | - ] | ||
369 | - ], | ||
370 | - 'type': 'MultiPolygon' | ||
371 | - }, | ||
372 | - jsonStr: '{"coordinates": [[[[30, 20], [10, 40], [45, 40], [30, 20]]], [[[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]]], "type": "MultiPolygon"}' | ||
373 | - }, | ||
374 | - | ||
375 | - multipolygon2: { | ||
376 | - str: 'MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)))', | ||
377 | - cmp: [ | ||
378 | - [ | ||
379 | - [{ | ||
380 | - x: 40, | ||
381 | - y: 40 | ||
382 | - }, { | ||
383 | - x: 20, | ||
384 | - y: 45 | ||
385 | - }, { | ||
386 | - x: 45, | ||
387 | - y: 30 | ||
388 | - }, { | ||
389 | - x: 40, | ||
390 | - y: 40 | ||
391 | - }, ] | ||
392 | - ], | ||
393 | - [ | ||
394 | - [{ | ||
395 | - x: 20, | ||
396 | - y: 35 | ||
397 | - }, { | ||
398 | - x: 45, | ||
399 | - y: 20 | ||
400 | - }, { | ||
401 | - x: 30, | ||
402 | - y: 5 | ||
403 | - }, { | ||
404 | - x: 10, | ||
405 | - y: 10 | ||
406 | - }, { | ||
407 | - x: 10, | ||
408 | - y: 30 | ||
409 | - }, { | ||
410 | - x: 20, | ||
411 | - y: 35 | ||
412 | - }, ], | ||
413 | - [{ | ||
414 | - x: 30, | ||
415 | - y: 20 | ||
416 | - }, { | ||
417 | - x: 20, | ||
418 | - y: 25 | ||
419 | - }, { | ||
420 | - x: 20, | ||
421 | - y: 15 | ||
422 | - }, { | ||
423 | - x: 30, | ||
424 | - y: 20 | ||
425 | - }] | ||
426 | - ] | ||
427 | - ], | ||
428 | - obj: [ | ||
429 | - new google.maps.Polygon({ | ||
430 | - editable: false, | ||
431 | - paths: [ | ||
432 | - [ | ||
433 | - new google.maps.LatLng(40, 40), | ||
434 | - new google.maps.LatLng(45, 20), | ||
435 | - new google.maps.LatLng(30, 45) | ||
436 | - ] | ||
437 | - ] | ||
438 | - }), | ||
439 | - new google.maps.Polygon({ | ||
440 | - editable: false, | ||
441 | - paths: [ | ||
442 | - [ | ||
443 | - new google.maps.LatLng(35, 20), | ||
444 | - new google.maps.LatLng(20, 45), | ||
445 | - new google.maps.LatLng(5, 30), | ||
446 | - new google.maps.LatLng(10, 10), | ||
447 | - new google.maps.LatLng(30, 10) | ||
448 | - ], | ||
449 | - [ | ||
450 | - new google.maps.LatLng(15, 20), | ||
451 | - new google.maps.LatLng(25, 20), | ||
452 | - new google.maps.LatLng(20, 30) | ||
453 | - ] | ||
454 | - ] | ||
455 | - }) | ||
456 | - ], | ||
457 | - json: { | ||
458 | - 'coordinates': [ | ||
459 | - [ | ||
460 | - [ | ||
461 | - [40, 40], | ||
462 | - [20, 45], | ||
463 | - [45, 30], | ||
464 | - [40, 40] | ||
465 | - ] | ||
466 | - ], | ||
467 | - [ | ||
468 | - [ | ||
469 | - [20, 35], | ||
470 | - [45, 20], | ||
471 | - [30, 5], | ||
472 | - [10, 10], | ||
473 | - [10, 30], | ||
474 | - [20, 35] | ||
475 | - ], | ||
476 | - [ | ||
477 | - [30, 20], | ||
478 | - [20, 25], | ||
479 | - [20, 15], | ||
480 | - [30, 20] | ||
481 | - ] | ||
482 | - ] | ||
483 | - ], | ||
484 | - 'type': 'MultiPolygon' | ||
485 | - }, | ||
486 | - jsonStr: '{"coordinates": [[[[40, 40], [20, 45], [45, 30], [40, 40]]], [[[20, 35], [10, 30], [10, 10], [30, 5], [45, 20], [20, 35]], [[30, 20], [20, 15], [20, 25], [30, 20]]]], "type": "MultiPolygon"}' | ||
487 | - }, | ||
488 | - | ||
489 | - rectangle: { | ||
490 | - str: 'POLYGON((-50 20,0 20,0 0,-50 0,-50 20))', | ||
491 | - cmp: [ | ||
492 | - [{ | ||
493 | - x: -50, | ||
494 | - y: 20 | ||
495 | - }, { | ||
496 | - x: 0, | ||
497 | - y: 20 | ||
498 | - }, { | ||
499 | - x: 0, | ||
500 | - y: 0 | ||
501 | - }, { | ||
502 | - x: -50, | ||
503 | - y: 0 | ||
504 | - }, { | ||
505 | - x: -50, | ||
506 | - y: 20 | ||
507 | - }] | ||
508 | - ], | ||
509 | - obj: new google.maps.Rectangle({ | ||
510 | - bounds: new google.maps.LatLngBounds(new google.maps.LatLng(0, -50), | ||
511 | - new google.maps.LatLng(20, 0)) | ||
512 | - }) | ||
513 | - }, | ||
514 | - | ||
515 | - | ||
516 | - | ||
517 | - box: { | ||
518 | - str: 'BOX(0 0,20 20)', | ||
519 | - cmp: [{ | ||
520 | - x: 0, | ||
521 | - y: 0 | ||
522 | - }, { | ||
523 | - x: 20, | ||
524 | - y: 20 | ||
525 | - }], | ||
526 | - obj: new google.maps.Rectangle({ | ||
527 | - bounds: new google.maps.LatLngBounds(new google.maps.LatLng(0, 0), | ||
528 | - new google.maps.LatLng(20, 20)) | ||
529 | - }), | ||
530 | - json: { | ||
531 | - 'coordinates': [ | ||
532 | - [ | ||
533 | - [0, 0], | ||
534 | - [0, 20], | ||
535 | - [20, 20], | ||
536 | - [20, 0], | ||
537 | - [0, 0] | ||
538 | - ] | ||
539 | - ], | ||
540 | - 'type': 'Polygon', | ||
541 | - 'bbox': [0, 0, 20, 20] | ||
542 | - } | ||
543 | - }, | ||
544 | - | ||
545 | - geometrycollection: { | ||
546 | - str: 'GEOMETRYCOLLECTION(POINT(30 10),LINESTRING(30 10,10 30,40 40),POLYGON((30 10,10 20,20 40,40 40,30 10)))', | ||
547 | - json: { | ||
548 | - "type": "GeometryCollection", | ||
549 | - "geometries": [{ | ||
550 | - "type": "Point", | ||
551 | - "coordinates": [30, 10] | ||
552 | - }, { | ||
553 | - 'type': 'LineString', | ||
554 | - 'coordinates': [ | ||
555 | - [30, 10], | ||
556 | - [10, 30], | ||
557 | - [40, 40] | ||
558 | - ] | ||
559 | - }, | ||
560 | - | ||
561 | - { | ||
562 | - "type": "Polygon", | ||
563 | - "coordinates": [ | ||
564 | - [ | ||
565 | - [30, 10], | ||
566 | - [10, 20], | ||
567 | - [20, 40], | ||
568 | - [40, 40], | ||
569 | - [30, 10] | ||
570 | - ] | ||
571 | - ] | ||
572 | - } | ||
573 | - ] | ||
574 | - } | ||
575 | - } | ||
576 | - | ||
577 | - }; | ||
578 | - | ||
579 | - dataObjects = new google.maps.Data; | ||
580 | - | ||
581 | - | ||
582 | - | ||
583 | - | ||
584 | - | ||
585 | - describe('Converting objects into WKT strings: ', function () { | ||
586 | - | ||
587 | - afterEach(function () { | ||
588 | - wkt.delimiter = ' '; | ||
589 | - }); | ||
590 | - | ||
591 | - it('should convert a Marker instance into a basic POINT string', function () { | ||
592 | - wkt.fromObject(cases.point.obj); | ||
593 | - expect(wkt.type).toBe('point'); | ||
594 | - expect(wkt.isCollection()).toBe(false); | ||
595 | - expect(wkt.components).toEqual(cases.point.cmp); | ||
596 | - expect(wkt.write()).toBe(cases.point.str); | ||
597 | - }); | ||
598 | - | ||
599 | - it('should convert a Polyline instance into a basic LINESTRING string', function () { | ||
600 | - wkt.fromObject(cases.linestring.obj); | ||
601 | - expect(wkt.type).toBe('linestring'); | ||
602 | - expect(wkt.isCollection()).toBe(false); | ||
603 | - expect(wkt.components).toEqual(cases.linestring.cmp); | ||
604 | - expect(wkt.write()).toBe(cases.linestring.str); | ||
605 | - }); | ||
606 | - | ||
607 | - it('should convert a Polygon instance into a basic POLYGON string', function () { | ||
608 | - wkt.fromObject(cases.polygon.obj); | ||
609 | - expect(wkt.type).toBe('polygon'); | ||
610 | - expect(wkt.isCollection()).toBe(true); | ||
611 | - expect(wkt.components).toEqual(cases.polygon.cmp); | ||
612 | - expect(wkt.write()).toBe(cases.polygon.str); | ||
613 | - }); | ||
614 | - | ||
615 | - it('should convert a Polygon instance with a hole into a POLYGON string with the same hole', function () { | ||
616 | - wkt.fromObject(cases.polygon2.obj); | ||
617 | - expect(wkt.type).toBe('polygon'); | ||
618 | - expect(wkt.isCollection()).toBe(true); | ||
619 | - expect(wkt.components).toEqual(cases.polygon2.cmp); | ||
620 | - expect(wkt.write()).toBe(cases.polygon2.str); | ||
621 | - }); | ||
622 | - | ||
623 | - it('should convert a Rectangle instance into a POLYGON string', function () { | ||
624 | - wkt.fromObject(cases.rectangle.obj); | ||
625 | - expect(wkt.type).toBe('polygon'); | ||
626 | - expect(wkt.isRectangle).toBe(true); | ||
627 | - expect(wkt.isCollection()).toBe(true); | ||
628 | - expect(wkt.components).toEqual(cases.rectangle.cmp); | ||
629 | - expect(wkt.write()).toBe(cases.rectangle.str); | ||
630 | - }); | ||
631 | - | ||
632 | - it('should convert an Array of Marker instances into a MULTIPOINT string', function () { | ||
633 | - wkt.fromObject(cases.multipoint.obj); | ||
634 | - expect(wkt.type).toBe('multipoint'); | ||
635 | - expect(wkt.isCollection()).toBe(true); | ||
636 | - expect(wkt.components).toEqual(cases.multipoint.cmp); | ||
637 | - expect(wkt.write()).toBe(cases.multipoint.str); | ||
638 | - }); | ||
639 | - | ||
640 | - it('should convert an Array of Polyline instances into a MULTILINESTRING string', function () { | ||
641 | - wkt.fromObject(cases.multilinestring.obj); | ||
642 | - expect(wkt.type).toBe('multilinestring'); | ||
643 | - expect(wkt.isCollection()).toBe(true); | ||
644 | - expect(wkt.components).toEqual(cases.multilinestring.cmp); | ||
645 | - expect(wkt.write()).toBe(cases.multilinestring.str); | ||
646 | - }); | ||
647 | - | ||
648 | - it('should convert an Array of Polygon instances into a MULTIPOLYGON string', function () { | ||
649 | - wkt.fromObject(cases.multipolygon.obj); | ||
650 | - expect(wkt.type).toBe('multipolygon'); | ||
651 | - expect(wkt.isCollection()).toBe(true); | ||
652 | - expect(wkt.components).toEqual(cases.multipolygon.cmp); | ||
653 | - expect(wkt.write()).toBe(cases.multipolygon.str); | ||
654 | - }); | ||
655 | - | ||
656 | - it('should convert an Array of Polygon instances, some with holes, into a MULTIPOLYGON string with the same hole', function () { | ||
657 | - wkt.fromObject(cases.multipolygon2.obj); | ||
658 | - expect(wkt.type).toBe('multipolygon'); | ||
659 | - expect(wkt.isCollection()).toBe(true); | ||
660 | - expect(wkt.components).toEqual(cases.multipolygon2.cmp); | ||
661 | - expect(wkt.write()).toBe(cases.multipolygon2.str); | ||
662 | - }); | ||
663 | - | ||
664 | - }); | ||
665 | - | ||
666 | - describe('Converting google.maps.Data objects into WKT strings: ', function () { | ||
667 | - | ||
668 | - afterEach(function () { | ||
669 | - wkt.delimiter = ' '; | ||
670 | - }); | ||
671 | - | ||
672 | - it('should convert a google.maps.Data.Point instance into a basic POINT string', function () { | ||
673 | - var dataPoint = dataObjects.addGeoJson({ | ||
674 | - "type": "Feature", | ||
675 | - geometry: cases.point.json | ||
676 | - })[0]; | ||
677 | - wkt.fromObject(dataPoint.getGeometry()); | ||
678 | - expect(wkt.type).toBe('point'); | ||
679 | - expect(wkt.isCollection()).toBe(false); | ||
680 | - expect(wkt.components).toEqual(cases.point.cmp); | ||
681 | - expect(wkt.write()).toBe(cases.point.str); | ||
682 | - }); | ||
683 | - | ||
684 | - it('should convert a google.maps.Data.LineString instance into a basic LINESTRING string', function () { | ||
685 | - var dataLineString = dataObjects.addGeoJson({ | ||
686 | - "type": "Feature", | ||
687 | - geometry: cases.linestring.json | ||
688 | - })[0]; | ||
689 | - wkt.fromObject(dataLineString.getGeometry()); | ||
690 | - expect(wkt.type).toBe('linestring'); | ||
691 | - expect(wkt.isCollection()).toBe(false); | ||
692 | - expect(wkt.components).toEqual(cases.linestring.cmp); | ||
693 | - expect(wkt.write()).toBe(cases.linestring.str); | ||
694 | - }); | ||
695 | - | ||
696 | - it('should convert a google.maps.Data.Polygon instance into a basic POLYGON string', function () { | ||
697 | - var dataPolygon = dataObjects.addGeoJson({ | ||
698 | - "type": "Feature", | ||
699 | - geometry: cases.polygon.json | ||
700 | - })[0]; | ||
701 | - wkt.fromObject(dataPolygon.getGeometry()); | ||
702 | - expect(wkt.type).toBe('polygon'); | ||
703 | - expect(wkt.isCollection()).toBe(true); | ||
704 | - expect(wkt.components).toEqual(cases.polygon.cmp); | ||
705 | - expect(wkt.write()).toBe(cases.polygon.str); | ||
706 | - }); | ||
707 | - | ||
708 | - it('should convert a google.maps.Data.Polygon instance with a hole into a POLYGON string with the same hole', function () { | ||
709 | - var dataPolygon2 = dataObjects.addGeoJson({ | ||
710 | - "type": "Feature", | ||
711 | - geometry: cases.polygon2.json | ||
712 | - })[0]; | ||
713 | - wkt.fromObject(dataPolygon2.getGeometry()); | ||
714 | - expect(wkt.type).toBe('polygon'); | ||
715 | - expect(wkt.isCollection()).toBe(true); | ||
716 | - expect(wkt.components).toEqual(cases.polygon2.cmp); | ||
717 | - expect(wkt.write()).toBe(cases.polygon2.str); | ||
718 | - }); | ||
719 | - | ||
720 | - | ||
721 | - it('should convert a google.maps.Data.MultiPoint instance into a MULTIPOINT string', function () { | ||
722 | - var dataMultiPoint = dataObjects.addGeoJson({ | ||
723 | - "type": "Feature", | ||
724 | - geometry: cases.multipoint.json | ||
725 | - })[0]; | ||
726 | - wkt.fromObject(dataMultiPoint.getGeometry()); | ||
727 | - expect(wkt.type).toBe('multipoint'); | ||
728 | - expect(wkt.isCollection()).toBe(true); | ||
729 | - expect(wkt.components).toEqual(cases.multipoint.cmp); | ||
730 | - expect(wkt.write()).toBe(cases.multipoint.str); | ||
731 | - }); | ||
732 | - | ||
733 | - it('should convert a google.maps.Data.MultiLineString instance into a MULTILINESTRING string', function () { | ||
734 | - var dataMultiLineString = dataObjects.addGeoJson({ | ||
735 | - "type": "Feature", | ||
736 | - geometry: cases.multilinestring.json | ||
737 | - })[0]; | ||
738 | - wkt.fromObject(dataMultiLineString.getGeometry()); | ||
739 | - expect(wkt.type).toBe('multilinestring'); | ||
740 | - expect(wkt.isCollection()).toBe(true); | ||
741 | - expect(wkt.components).toEqual(cases.multilinestring.cmp); | ||
742 | - expect(wkt.write()).toBe(cases.multilinestring.str); | ||
743 | - }); | ||
744 | - | ||
745 | - it('should convert a google.maps.Data.MultiPolygon instance into a MULTIPOLYGON string', function () { | ||
746 | - var dataMultiPolygon = dataObjects.addGeoJson({ | ||
747 | - "type": "Feature", | ||
748 | - geometry: cases.multipolygon.json | ||
749 | - })[0]; | ||
750 | - wkt.fromObject(dataMultiPolygon.getGeometry()); | ||
751 | - expect(wkt.type).toBe('multipolygon'); | ||
752 | - expect(wkt.isCollection()).toBe(true); | ||
753 | - expect(wkt.components).toEqual(cases.multipolygon.cmp); | ||
754 | - expect(wkt.write()).toBe(cases.multipolygon.str); | ||
755 | - }); | ||
756 | - | ||
757 | - it('should convert a google.maps.Data.MultiPolygon with holes, into a MULTIPOLYGON string with the same holes', function () { | ||
758 | - var dataMultiPolygon2 = dataObjects.addGeoJson({ | ||
759 | - "type": "Feature", | ||
760 | - geometry: cases.multipolygon2.json | ||
761 | - })[0]; | ||
762 | - wkt.fromObject(dataMultiPolygon2.getGeometry()); | ||
763 | - expect(wkt.type).toBe('multipolygon'); | ||
764 | - expect(wkt.isCollection()).toBe(true); | ||
765 | - expect(wkt.components).toEqual(cases.multipolygon2.cmp); | ||
766 | - expect(wkt.write()).toBe(cases.multipolygon2.str); | ||
767 | - }); | ||
768 | - | ||
769 | - it('should convert a google.maps.Data.GeometryCollection into a GEOMETRYCOLLECTION string', function () { | ||
770 | - var dataGeometryCollection = dataObjects.addGeoJson({ | ||
771 | - "type": "Feature", | ||
772 | - geometry: cases.geometrycollection.json | ||
773 | - })[0]; | ||
774 | - | ||
775 | - wkt.fromObject(dataGeometryCollection.getGeometry()); | ||
776 | - expect(wkt.type).toBe('geometrycollection'); | ||
777 | - //expect(wkt.isCollection()).toBe(true); | ||
778 | - | ||
779 | - }); | ||
780 | - | ||
781 | - }); | ||
782 | - | ||
783 | - | ||
784 | - describe('Coverting WKT strings into objects: ', function () { | ||
785 | - | ||
786 | - afterEach(function () { | ||
787 | - wkt.delimiter = ' '; | ||
788 | - }); | ||
789 | - | ||
790 | - it('should convert a basic POINT string to a Marker instance', function () { | ||
791 | - wkt.read(cases.marker.str); | ||
792 | - expect(wkt.type).toBe('point'); | ||
793 | - expect(wkt.isCollection()).toBe(false); | ||
794 | - expect(wkt.components).toEqual(cases.marker.cmp); | ||
795 | - expect(wkt.toObject().getPosition()).toEqual(cases.marker.obj.getPosition()); | ||
796 | - }); | ||
797 | - | ||
798 | - it('should convert a basic LINESTRING string to a Polyline instance', function () { | ||
799 | - wkt.read(cases.linestring.str); | ||
800 | - expect(wkt.type).toBe('linestring'); | ||
801 | - expect(wkt.isCollection()).toBe(false); | ||
802 | - expect(wkt.components).toEqual(cases.linestring.cmp); | ||
803 | - expect(wkt.toObject().getPath()).toEqual(cases.linestring.obj.getPath()); | ||
804 | - }); | ||
805 | - | ||
806 | - it('should convert a basic POLYGON string to a Polygon instance', function () { | ||
807 | - wkt.read(cases.polygon.str); | ||
808 | - expect(wkt.type).toBe('polygon'); | ||
809 | - expect(wkt.isCollection()).toBe(true); | ||
810 | - expect(wkt.components).toEqual(cases.polygon.cmp); | ||
811 | - expect(wkt.toObject().getPaths()).toEqual(cases.polygon.obj.getPaths()); | ||
812 | - }); | ||
813 | - | ||
814 | - it('should convert a POLYGON string with a hole to a Polygon instance with the same hole', function () { | ||
815 | - wkt.read(cases.polygon2.str); | ||
816 | - expect(wkt.type).toBe('polygon'); | ||
817 | - expect(wkt.isCollection()).toBe(true); | ||
818 | - expect(wkt.components).toEqual(cases.polygon2.cmp); | ||
819 | - expect(wkt.toObject().getPaths()).toEqual(cases.polygon2.obj.getPaths()); | ||
820 | - }); | ||
821 | - | ||
822 | - it('should convert a POLYGON string, with isRectangle=true, into a Rectangle instance', function () { | ||
823 | - wkt.read(cases.rectangle.str); | ||
824 | - wkt.isRectangle = true; | ||
825 | - expect(wkt.type).toBe('polygon'); | ||
826 | - expect(wkt.isCollection()).toBe(true); | ||
827 | - expect(wkt.components).toEqual(cases.rectangle.cmp); | ||
828 | - expect(wkt.toObject().getBounds()).toEqual(cases.rectangle.obj.getBounds()); | ||
829 | - expect(wkt.toObject().constructor).toEqual(google.maps.Rectangle); | ||
830 | - }); | ||
831 | - | ||
832 | - it('should convert a MULTIPOINT string into an Array of Marker instances', function () { | ||
833 | - var m; | ||
834 | - | ||
835 | - wkt.read(cases.multipoint.str); | ||
836 | - expect(wkt.type).toBe('multipoint'); | ||
837 | - expect(wkt.isCollection()).toBe(true); | ||
838 | - expect(wkt.components).toEqual(cases.multipoint.cmp); | ||
839 | - | ||
840 | - markers = wkt.toObject(); | ||
841 | - for (m = 0; m < markers.length; m += 1) { | ||
842 | - expect(markers[m].getPosition()).toEqual(cases.multipoint.obj[m].getPosition()); | ||
843 | - } | ||
844 | - }); | ||
845 | - | ||
846 | - it('should convert a MULTILINESTRING string into an Array of Polyline instances', function () { | ||
847 | - wkt.read(cases.multilinestring.str); | ||
848 | - expect(wkt.type).toBe('multilinestring'); | ||
849 | - expect(wkt.isCollection()).toBe(true); | ||
850 | - expect(wkt.components).toEqual(cases.multilinestring.cmp); | ||
851 | - expect(wkt.toObject()).toEqual(cases.multilinestring.obj); | ||
852 | - }); | ||
853 | - | ||
854 | - it('should convert a MULTIPOLYGON string into an Array of Polygon instances', function () { | ||
855 | - wkt.read(cases.multipolygon.str); | ||
856 | - expect(wkt.type).toBe('multipolygon'); | ||
857 | - expect(wkt.isCollection()).toBe(true); | ||
858 | - expect(wkt.components).toEqual(cases.multipolygon.cmp); | ||
859 | - expect(wkt.toObject()).toEqual(cases.multipolygon.obj); | ||
860 | - }); | ||
861 | - | ||
862 | - it('should convert a MULTIPOLYGON string with holes into an Array of Polygon instances with the same holes', function () { | ||
863 | - wkt.read(cases.multipolygon2.str); | ||
864 | - expect(wkt.type).toBe('multipolygon'); | ||
865 | - expect(wkt.isCollection()).toBe(true); | ||
866 | - expect(wkt.components).toEqual(cases.multipolygon2.cmp); | ||
867 | - expect(wkt.toObject()).toEqual(cases.multipolygon2.obj); | ||
868 | - }); | ||
869 | - | ||
870 | - it('should convert a PostGIS 2DBOX string into a Rectangle instance', function () { | ||
871 | - wkt.read(cases.box.str); | ||
872 | - expect(wkt.type).toBe('box'); | ||
873 | - expect(wkt.isCollection()).toBe(false); | ||
874 | - expect(wkt.components).toEqual(cases.box.cmp); | ||
875 | - expect(wkt.toObject().getBounds()).toEqual(cases.box.obj.getBounds()); | ||
876 | - }); | ||
877 | - | ||
878 | - }); | ||
879 | - | ||
880 | -}); | ||
881 | \ No newline at end of file | 0 | \ No newline at end of file |
pacotes/wicket/tests/wicket-gmap3.html
@@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
1 | -<!DOCTYPE HTML> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
5 | - <title>Jasmine Spec Runner v2.0.0</title> | ||
6 | - | ||
7 | - <link rel="shortcut icon" type="image/png" href="../node_modules/jasmine-core/dist/lib/jasmine-2.0.0/jasmine_favicon.png"> | ||
8 | - <link rel="stylesheet" type="text/css" href="../node_modules/jasmine-core/dist/lib/jasmine-2.0.0/jasmine.css"> | ||
9 | - | ||
10 | - <!-- Get Jasmine: https://github.com/pivotal/jasmine --> | ||
11 | - <script type="text/javascript" src="../node_modules/jasmine-core/dist/lib/jasmine-2.0.0/jasmine.js"></script> | ||
12 | - <script type="text/javascript" src="../node_modules/jasmine-core/dist/lib/jasmine-2.0.0/jasmine-html.js"></script> | ||
13 | - <script type="text/javascript" src="../node_modules/jasmine-core/dist/lib/jasmine-2.0.0/boot.js"></script> | ||
14 | - | ||
15 | - <script src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false" type="text/javascript"></script> | ||
16 | - | ||
17 | - <!-- include source files here... --> | ||
18 | - <script type="text/javascript" src="../wicket.js"></script> | ||
19 | - <script type="text/javascript" src="../wicket-gmap3.js"></script> | ||
20 | - <!--<script type="text/javascript" src="/static/wicket/wicket-leaflet.src.js"></script>--> | ||
21 | - <!--<script type="text/javascript" src="/static/wicket/wicket-arcgis.src.js"></script>--> | ||
22 | - | ||
23 | - <!-- include spec files here... --> | ||
24 | - <script type="text/javascript" src="wicket-gmap3-spec.js"></script> | ||
25 | - | ||
26 | -</head> | ||
27 | - | ||
28 | -<body> | ||
29 | -</body> | ||
30 | -</html> |
pacotes/wicket/tests/wicket-spec.js
@@ -1,1952 +0,0 @@ | @@ -1,1952 +0,0 @@ | ||
1 | -var Wkt = require('../wicket'); | ||
2 | -var expect = require('chai').expect; | ||
3 | - | ||
4 | -describe('Consistent Design Patterns', function() { | ||
5 | - | ||
6 | - it('should read WKT string when instantiated', function() { | ||
7 | - var wkt = new Wkt.Wkt('POINT(30 10)'); | ||
8 | - | ||
9 | - expect(wkt.components).deep.equal([{ | ||
10 | - x: 30, | ||
11 | - y: 10 | ||
12 | - }]); | ||
13 | - }); | ||
14 | - | ||
15 | - it('should correctly identify an Array', function() { | ||
16 | - expect(Wkt.isArray([0, 1])).equal(true); | ||
17 | - expect(Wkt.isArray({ | ||
18 | - x: 0, | ||
19 | - y: 1 | ||
20 | - })).equal(false); | ||
21 | - expect(Wkt.isArray(0)).equal(false); | ||
22 | - expect(Wkt.isArray(new Date())).equal(false); | ||
23 | - }); | ||
24 | - | ||
25 | -}); | ||
26 | - | ||
27 | -describe('Standard WKT Test Cases: ', function() { | ||
28 | - var cases, wkt; | ||
29 | - | ||
30 | - wkt = new Wkt.Wkt(); | ||
31 | - | ||
32 | - cases = { | ||
33 | - | ||
34 | - point: { | ||
35 | - str: 'POINT(30 10)', | ||
36 | - cmp: [{ | ||
37 | - x: 30, | ||
38 | - y: 10 | ||
39 | - }] | ||
40 | - }, | ||
41 | - | ||
42 | - linestring: { | ||
43 | - str: 'LINESTRING(30 10,10 30,40 40)', | ||
44 | - cmp: [{ | ||
45 | - x: 30, | ||
46 | - y: 10 | ||
47 | - }, { | ||
48 | - x: 10, | ||
49 | - y: 30 | ||
50 | - }, { | ||
51 | - x: 40, | ||
52 | - y: 40 | ||
53 | - }] | ||
54 | - }, | ||
55 | - | ||
56 | - polygon: { | ||
57 | - str: 'POLYGON((30 10,10 20,20 40,40 40,30 10))', | ||
58 | - cmp: [ | ||
59 | - [{ | ||
60 | - x: 30, | ||
61 | - y: 10 | ||
62 | - }, { | ||
63 | - x: 10, | ||
64 | - y: 20 | ||
65 | - }, { | ||
66 | - x: 20, | ||
67 | - y: 40 | ||
68 | - }, { | ||
69 | - x: 40, | ||
70 | - y: 40 | ||
71 | - }, { | ||
72 | - x: 30, | ||
73 | - y: 10 | ||
74 | - }] | ||
75 | - ] | ||
76 | - }, | ||
77 | - | ||
78 | - polygon2: { | ||
79 | - str: 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 35,30 20,20 30))', | ||
80 | - cmp: [ | ||
81 | - [{ | ||
82 | - x: 35, | ||
83 | - y: 10 | ||
84 | - }, { | ||
85 | - x: 10, | ||
86 | - y: 20 | ||
87 | - }, { | ||
88 | - x: 15, | ||
89 | - y: 40 | ||
90 | - }, { | ||
91 | - x: 45, | ||
92 | - y: 45 | ||
93 | - }, { | ||
94 | - x: 35, | ||
95 | - y: 10 | ||
96 | - }], | ||
97 | - [{ | ||
98 | - x: 20, | ||
99 | - y: 30 | ||
100 | - }, { | ||
101 | - x: 35, | ||
102 | - y: 35 | ||
103 | - }, { | ||
104 | - x: 30, | ||
105 | - y: 20 | ||
106 | - }, { | ||
107 | - x: 20, | ||
108 | - y: 30 | ||
109 | - }] | ||
110 | - ] | ||
111 | - }, | ||
112 | - | ||
113 | - multipoint: { | ||
114 | - str: 'MULTIPOINT((10 40),(40 30),(20 20),(30 10))', | ||
115 | - cmp: [ | ||
116 | - [{ | ||
117 | - x: 10, | ||
118 | - y: 40 | ||
119 | - }], | ||
120 | - [{ | ||
121 | - x: 40, | ||
122 | - y: 30 | ||
123 | - }], | ||
124 | - [{ | ||
125 | - x: 20, | ||
126 | - y: 20 | ||
127 | - }], | ||
128 | - [{ | ||
129 | - x: 30, | ||
130 | - y: 10 | ||
131 | - }] | ||
132 | - ] | ||
133 | - }, | ||
134 | - | ||
135 | - multipoint2: { | ||
136 | - str: 'MULTIPOINT(10 40,40 30,20 20,30 10)', | ||
137 | - cmp: [ | ||
138 | - [{ | ||
139 | - x: 10, | ||
140 | - y: 40 | ||
141 | - }], | ||
142 | - [{ | ||
143 | - x: 40, | ||
144 | - y: 30 | ||
145 | - }], | ||
146 | - [{ | ||
147 | - x: 20, | ||
148 | - y: 20 | ||
149 | - }], | ||
150 | - [{ | ||
151 | - x: 30, | ||
152 | - y: 10 | ||
153 | - }] | ||
154 | - ] | ||
155 | - }, | ||
156 | - | ||
157 | - multilinestring: { | ||
158 | - str: 'MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10))', | ||
159 | - cmp: [ | ||
160 | - [{ | ||
161 | - x: 10, | ||
162 | - y: 10 | ||
163 | - }, { | ||
164 | - x: 20, | ||
165 | - y: 20 | ||
166 | - }, { | ||
167 | - x: 10, | ||
168 | - y: 40 | ||
169 | - }], | ||
170 | - [{ | ||
171 | - x: 40, | ||
172 | - y: 40 | ||
173 | - }, { | ||
174 | - x: 30, | ||
175 | - y: 30 | ||
176 | - }, { | ||
177 | - x: 40, | ||
178 | - y: 20 | ||
179 | - }, { | ||
180 | - x: 30, | ||
181 | - y: 10 | ||
182 | - }] | ||
183 | - ] | ||
184 | - }, | ||
185 | - | ||
186 | - multipolygon: { | ||
187 | - str: 'MULTIPOLYGON(((30 20,10 40,45 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))', | ||
188 | - cmp: [ | ||
189 | - [ | ||
190 | - [{ | ||
191 | - x: 30, | ||
192 | - y: 20 | ||
193 | - }, { | ||
194 | - x: 10, | ||
195 | - y: 40 | ||
196 | - }, { | ||
197 | - x: 45, | ||
198 | - y: 40 | ||
199 | - }, { | ||
200 | - x: 30, | ||
201 | - y: 20 | ||
202 | - }, ] | ||
203 | - ], | ||
204 | - [ | ||
205 | - [{ | ||
206 | - x: 15, | ||
207 | - y: 5 | ||
208 | - }, { | ||
209 | - x: 40, | ||
210 | - y: 10 | ||
211 | - }, { | ||
212 | - x: 10, | ||
213 | - y: 20 | ||
214 | - }, { | ||
215 | - x: 5, | ||
216 | - y: 10 | ||
217 | - }, { | ||
218 | - x: 15, | ||
219 | - y: 5 | ||
220 | - }] | ||
221 | - ] | ||
222 | - ] | ||
223 | - }, | ||
224 | - | ||
225 | - multipolygon2: { | ||
226 | - str: 'MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)))', | ||
227 | - cmp: [ | ||
228 | - [ | ||
229 | - [{ | ||
230 | - x: 40, | ||
231 | - y: 40 | ||
232 | - }, { | ||
233 | - x: 20, | ||
234 | - y: 45 | ||
235 | - }, { | ||
236 | - x: 45, | ||
237 | - y: 30 | ||
238 | - }, { | ||
239 | - x: 40, | ||
240 | - y: 40 | ||
241 | - }, ] | ||
242 | - ], | ||
243 | - [ | ||
244 | - [{ | ||
245 | - x: 20, | ||
246 | - y: 35 | ||
247 | - }, { | ||
248 | - x: 45, | ||
249 | - y: 20 | ||
250 | - }, { | ||
251 | - x: 30, | ||
252 | - y: 5 | ||
253 | - }, { | ||
254 | - x: 10, | ||
255 | - y: 10 | ||
256 | - }, { | ||
257 | - x: 10, | ||
258 | - y: 30 | ||
259 | - }, { | ||
260 | - x: 20, | ||
261 | - y: 35 | ||
262 | - }, ], | ||
263 | - [{ | ||
264 | - x: 30, | ||
265 | - y: 20 | ||
266 | - }, { | ||
267 | - x: 20, | ||
268 | - y: 25 | ||
269 | - }, { | ||
270 | - x: 20, | ||
271 | - y: 15 | ||
272 | - }, { | ||
273 | - x: 30, | ||
274 | - y: 20 | ||
275 | - }] | ||
276 | - ] | ||
277 | - ] | ||
278 | - }, | ||
279 | - | ||
280 | - box: { | ||
281 | - str: 'BOX(0 0,20 20)', | ||
282 | - cmp: [{ | ||
283 | - x: 0, | ||
284 | - y: 0 | ||
285 | - }, { | ||
286 | - x: 20, | ||
287 | - y: 20 | ||
288 | - }] | ||
289 | - } | ||
290 | - | ||
291 | - }; | ||
292 | - | ||
293 | - describe('Reading WKT Strings: ', function() { | ||
294 | - | ||
295 | - afterEach(function() { | ||
296 | - wkt.delimiter = ' '; | ||
297 | - }); | ||
298 | - | ||
299 | - it('should read basic POINT string', function() { | ||
300 | - wkt.read(cases.point.str); | ||
301 | - | ||
302 | - expect(wkt.type).equal('point'); | ||
303 | - expect(wkt.isCollection()).equal(false); | ||
304 | - expect(wkt.components).deep.equal(cases.point.cmp); | ||
305 | - | ||
306 | - // Now try it for URLs | ||
307 | - wkt.delimiter = '+'; | ||
308 | - wkt.read(cases.point.str.replace(/ /g, '+')); | ||
309 | - expect(wkt.components).deep.equal(cases.point.cmp); | ||
310 | - }); | ||
311 | - | ||
312 | - it('should read basic LINESTRING string', function() { | ||
313 | - wkt.read(cases.linestring.str); | ||
314 | - | ||
315 | - expect(wkt.type).equal('linestring'); | ||
316 | - expect(wkt.isCollection()).equal(false); | ||
317 | - expect(wkt.components).deep.equal(cases.linestring.cmp); | ||
318 | - | ||
319 | - // Now try it for URLs | ||
320 | - wkt.delimiter = '+'; | ||
321 | - wkt.read(cases.linestring.str.replace(/ /g, '+')); | ||
322 | - expect(wkt.components).deep.equal(cases.linestring.cmp); | ||
323 | - }); | ||
324 | - | ||
325 | - it('should read basic POLYGON string', function() { | ||
326 | - wkt.read(cases.polygon.str); | ||
327 | - | ||
328 | - expect(wkt.type).equal('polygon'); | ||
329 | - expect(wkt.isCollection()).equal(true); | ||
330 | - expect(wkt.components).deep.equal(cases.polygon.cmp); | ||
331 | - | ||
332 | - // Now try it for URLs | ||
333 | - wkt.delimiter = '+'; | ||
334 | - wkt.read(cases.polygon.str.replace(/ /g, '+')); | ||
335 | - expect(wkt.components).deep.equal(cases.polygon.cmp); | ||
336 | - }); | ||
337 | - | ||
338 | - it('should read basic POLYGON string with one (1) hole', function() { | ||
339 | - wkt.read(cases.polygon2.str); | ||
340 | - | ||
341 | - expect(wkt.type).equal('polygon'); | ||
342 | - expect(wkt.isCollection()).equal(true); | ||
343 | - expect(wkt.components).deep.equal(cases.polygon2.cmp); | ||
344 | - | ||
345 | - // Now try it for URLs | ||
346 | - wkt.delimiter = '+'; | ||
347 | - wkt.read(cases.polygon2.str.replace(/ /g, '+')); | ||
348 | - expect(wkt.components).deep.equal(cases.polygon2.cmp); | ||
349 | - }); | ||
350 | - | ||
351 | - it('should read basic MULTIPOINT string with wrapped vertices', function() { | ||
352 | - wkt.read(cases.multipoint.str); | ||
353 | - | ||
354 | - expect(wkt.type).equal('multipoint'); | ||
355 | - expect(wkt.isCollection()).equal(true); | ||
356 | - expect(wkt.components).deep.equal(cases.multipoint.cmp); | ||
357 | - | ||
358 | - // Now try it for URLs | ||
359 | - wkt.delimiter = '+'; | ||
360 | - wkt.read(cases.multipoint.str.replace(/ /g, '+')); | ||
361 | - expect(wkt.components).deep.equal(cases.multipoint.cmp); | ||
362 | - }); | ||
363 | - | ||
364 | - it('should read basic MULTIPOINT string without wrapped vertices', function() { | ||
365 | - wkt.read(cases.multipoint2.str); | ||
366 | - | ||
367 | - expect(wkt.type).equal('multipoint'); | ||
368 | - expect(wkt.isCollection()).equal(true); | ||
369 | - expect(wkt.components).deep.equal(cases.multipoint2.cmp); | ||
370 | - | ||
371 | - // Now try it for URLs | ||
372 | - wkt.delimiter = '+'; | ||
373 | - wkt.read(cases.multipoint2.str.replace(/ /g, '+')); | ||
374 | - expect(wkt.components).deep.equal(cases.multipoint2.cmp); | ||
375 | - }); | ||
376 | - | ||
377 | - it('should read basic MULTILINESTRING string', function() { | ||
378 | - wkt.read(cases.multilinestring.str); | ||
379 | - | ||
380 | - expect(wkt.type).equal('multilinestring'); | ||
381 | - expect(wkt.isCollection()).equal(true); | ||
382 | - expect(wkt.components).deep.equal(cases.multilinestring.cmp); | ||
383 | - | ||
384 | - // Now try it for URLs | ||
385 | - wkt.delimiter = '+'; | ||
386 | - wkt.read(cases.multilinestring.str.replace(/ /g, '+')); | ||
387 | - expect(wkt.components).deep.equal(cases.multilinestring.cmp); | ||
388 | - }); | ||
389 | - | ||
390 | - it('should read basic MULTIPOLYGON string', function() { | ||
391 | - wkt.read(cases.multipolygon.str); | ||
392 | - | ||
393 | - expect(wkt.type).equal('multipolygon'); | ||
394 | - expect(wkt.isCollection()).equal(true); | ||
395 | - expect(wkt.components).deep.equal(cases.multipolygon.cmp); | ||
396 | - | ||
397 | - // Now try it for URLs | ||
398 | - wkt.delimiter = '+'; | ||
399 | - wkt.read(cases.multipolygon.str.replace(/ /g, '+')); | ||
400 | - expect(wkt.components).deep.equal(cases.multipolygon.cmp); | ||
401 | - }); | ||
402 | - | ||
403 | - it('should read basic MULTIPOLYGON string with two (2) polygons, one with one (1) hole', function() { | ||
404 | - wkt.read(cases.multipolygon2.str); | ||
405 | - | ||
406 | - expect(wkt.type).equal('multipolygon'); | ||
407 | - expect(wkt.isCollection()).equal(true); | ||
408 | - expect(wkt.components).deep.equal(cases.multipolygon2.cmp); | ||
409 | - | ||
410 | - // Now try it for URLs | ||
411 | - wkt.delimiter = '+'; | ||
412 | - wkt.read(cases.multipolygon2.str.replace(/ /g, '+')); | ||
413 | - expect(wkt.components).deep.equal(cases.multipolygon2.cmp); | ||
414 | - }); | ||
415 | - | ||
416 | - it('should read basic PostGIS 2DBOX string', function() { | ||
417 | - wkt.read(cases.box.str); | ||
418 | - | ||
419 | - expect(wkt.type).equal('box'); | ||
420 | - expect(wkt.isCollection()).equal(false); | ||
421 | - expect(wkt.components).deep.equal(cases.box.cmp); | ||
422 | - | ||
423 | - // Now try it for URLs | ||
424 | - wkt.delimiter = '+'; | ||
425 | - wkt.read(cases.box.str.replace(/ /g, '+')); | ||
426 | - expect(wkt.components).deep.equal(cases.box.cmp); | ||
427 | - }); | ||
428 | - | ||
429 | - }); // eo describe() | ||
430 | - | ||
431 | - describe('Writing Well-Formed WKT Strings: ', function() { | ||
432 | - | ||
433 | - afterEach(function() { | ||
434 | - wkt.wrapVertices = false; | ||
435 | - wkt.delimiter = ' '; | ||
436 | - }); | ||
437 | - | ||
438 | - it('should write basic POINT string', function() { | ||
439 | - wkt.components = cases.point.cmp; | ||
440 | - wkt.type = 'point'; | ||
441 | - | ||
442 | - expect(wkt.write()).equal(cases.point.str); | ||
443 | - | ||
444 | - // Now try it for URLs | ||
445 | - wkt.delimiter = '+'; | ||
446 | - expect(wkt.write()).equal(cases.point.str.replace(/ /g, '+')); | ||
447 | - }); | ||
448 | - | ||
449 | - it('should write basic LINESTRING string', function() { | ||
450 | - wkt.components = cases.linestring.cmp; | ||
451 | - wkt.type = 'linestring'; | ||
452 | - | ||
453 | - expect(wkt.write()).equal(cases.linestring.str); | ||
454 | - | ||
455 | - // Now try it for URLs | ||
456 | - wkt.delimiter = '+'; | ||
457 | - expect(wkt.write()).equal(cases.linestring.str.replace(/ /g, '+')); | ||
458 | - }); | ||
459 | - | ||
460 | - it('should write basic POLYGON string', function() { | ||
461 | - wkt.components = cases.polygon.cmp; | ||
462 | - wkt.type = 'polygon'; | ||
463 | - | ||
464 | - expect(wkt.write()).equal(cases.polygon.str); | ||
465 | - | ||
466 | - // Now try it for URLs | ||
467 | - wkt.delimiter = '+'; | ||
468 | - expect(wkt.write()).equal(cases.polygon.str.replace(/ /g, '+')); | ||
469 | - }); | ||
470 | - | ||
471 | - it('should write basic POLYGON string with one (1) hole', function() { | ||
472 | - wkt.components = cases.polygon2.cmp; | ||
473 | - wkt.type = 'polygon'; | ||
474 | - | ||
475 | - expect(wkt.write()).equal(cases.polygon2.str); | ||
476 | - | ||
477 | - // Now try it for URLs | ||
478 | - wkt.delimiter = '+'; | ||
479 | - expect(wkt.write()).equal(cases.polygon2.str.replace(/ /g, '+')); | ||
480 | - }); | ||
481 | - | ||
482 | - it('should write basic MULTIPOINT string with wrapped vertices', function() { | ||
483 | - wkt.components = cases.multipoint.cmp; | ||
484 | - wkt.type = 'multipoint'; | ||
485 | - wkt.wrapVertices = true; | ||
486 | - | ||
487 | - expect(wkt.write()).equal(cases.multipoint.str); | ||
488 | - | ||
489 | - // Now try it for URLs | ||
490 | - wkt.delimiter = '+'; | ||
491 | - expect(wkt.write()).equal(cases.multipoint.str.replace(/ /g, '+')); | ||
492 | - }); | ||
493 | - | ||
494 | - it('should write basic MULTIPOINT string without wrapped vertices', function() { | ||
495 | - wkt.components = cases.multipoint2.cmp; | ||
496 | - wkt.type = 'multipoint'; | ||
497 | - wkt.wrapVertices = false; | ||
498 | - | ||
499 | - expect(wkt.write()).equal(cases.multipoint2.str); | ||
500 | - | ||
501 | - // Now try it for URLs | ||
502 | - wkt.delimiter = '+'; | ||
503 | - expect(wkt.write()).equal(cases.multipoint2.str.replace(/ /g, '+')); | ||
504 | - }); | ||
505 | - | ||
506 | - it('should write basic MULTILINESTRING string', function() { | ||
507 | - wkt.components = cases.multilinestring.cmp; | ||
508 | - wkt.type = 'multilinestring'; | ||
509 | - | ||
510 | - expect(wkt.write()).equal(cases.multilinestring.str); | ||
511 | - | ||
512 | - // Now try it for URLs | ||
513 | - wkt.delimiter = '+'; | ||
514 | - expect(wkt.write()).equal(cases.multilinestring.str.replace(/ /g, '+')); | ||
515 | - }); | ||
516 | - | ||
517 | - it('should write basic MULTIPOLYGON string', function() { | ||
518 | - wkt.components = cases.multipolygon.cmp; | ||
519 | - wkt.type = 'multipolygon'; | ||
520 | - | ||
521 | - expect(wkt.write()).equal(cases.multipolygon.str); | ||
522 | - | ||
523 | - // Now try it for URLs | ||
524 | - wkt.delimiter = '+'; | ||
525 | - expect(wkt.write()).equal(cases.multipolygon.str.replace(/ /g, '+')); | ||
526 | - }); | ||
527 | - | ||
528 | - it('should write basic MULTIPOLYGON string with two (2) polygons, one with one (1) hole', function() { | ||
529 | - wkt.components = cases.multipolygon2.cmp; | ||
530 | - wkt.type = 'multipolygon'; | ||
531 | - | ||
532 | - expect(wkt.write()).equal(cases.multipolygon2.str); | ||
533 | - | ||
534 | - // Now try it for URLs | ||
535 | - wkt.delimiter = '+'; | ||
536 | - expect(wkt.write()).equal(cases.multipolygon2.str.replace(/ /g, '+')); | ||
537 | - }); | ||
538 | - | ||
539 | - it('should write basic PostGIS 2DBOX string', function() { | ||
540 | - wkt.components = cases.box.cmp; | ||
541 | - wkt.type = 'box'; | ||
542 | - | ||
543 | - expect(wkt.write()).equal(cases.box.str); | ||
544 | - | ||
545 | - // Now try it for URLs | ||
546 | - wkt.delimiter = '+'; | ||
547 | - expect(wkt.write()).equal(cases.box.str.replace(/ /g, '+')); | ||
548 | - }); | ||
549 | - | ||
550 | - }); | ||
551 | - | ||
552 | -}); // eo describe() | ||
553 | - | ||
554 | -describe('Arbitrary WKT Test Cases: ', function() { | ||
555 | - var cases, wkt; | ||
556 | - | ||
557 | - wkt = new Wkt.Wkt(); | ||
558 | - | ||
559 | - function randomLat(a, b) { | ||
560 | - var n; | ||
561 | - | ||
562 | - a = a || 0; | ||
563 | - b = b || 90; | ||
564 | - n = Math.random() * (a + (b - a)); | ||
565 | - return (Math.random() < 0.5) ? -n : n; | ||
566 | - }; | ||
567 | - | ||
568 | - function randomLng(a, b) { | ||
569 | - var n; | ||
570 | - | ||
571 | - a = a || 0; | ||
572 | - b = b || 180; | ||
573 | - n = Math.random() * (a + (b - a)); | ||
574 | - return (Math.random() < 0.5) ? -n : n; | ||
575 | - }; | ||
576 | - | ||
577 | - function randomCoords(n, a1, b1, a2, b2) { | ||
578 | - var i, c, cs; | ||
579 | - | ||
580 | - i = 0; | ||
581 | - a1 = a1 || 0; | ||
582 | - b1 = b1 || 180; | ||
583 | - a2 = a2 || 0; | ||
584 | - b2 = b2 || 90; | ||
585 | - cs = []; | ||
586 | - | ||
587 | - while (i < n) { | ||
588 | - cs.push({ | ||
589 | - x: randomLng(a1, b1), | ||
590 | - y: randomLat(a2, b2) | ||
591 | - }); | ||
592 | - i += 1; | ||
593 | - } | ||
594 | - | ||
595 | - return cs; | ||
596 | - }; | ||
597 | - | ||
598 | - it('should be able to read WKT strings with bizarre whitespace', function() { | ||
599 | - wkt.read(' LINESTRING ( 30 10, 10 30, 40 40) '); | ||
600 | - expect(wkt.write()).equal('LINESTRING(30 10,10 30,40 40)'); | ||
601 | - }); | ||
602 | - | ||
603 | - it('should be able to read WKT strings with (somewhat) arbitrary precision', function() { | ||
604 | - wkt.read('MULTIPOINT((9.12345 40),(40 30),(20 19.999999),(30 10.000001))'); | ||
605 | - expect(wkt.write()).equal('MULTIPOINT((9.12345 40),(40 30),(20 19.999999),(30 10.000001))'); | ||
606 | - }); | ||
607 | - | ||
608 | - describe('Working with Random Coordinates: ', function() { | ||
609 | - var c; | ||
610 | - | ||
611 | - it('should read and write arbitrary POINT string', function() { | ||
612 | - c = wkt.components = randomCoords(1); | ||
613 | - wkt.type = 'point'; | ||
614 | - | ||
615 | - expect(wkt.read(wkt.write()).components).deep.equal(c); | ||
616 | - }); | ||
617 | - | ||
618 | - it('should read and write long, arbitrary LINESTRING string', function() { | ||
619 | - c = wkt.components = randomCoords(100); | ||
620 | - wkt.type = 'linestring'; | ||
621 | - | ||
622 | - expect(wkt.read(wkt.write()).components).deep.equal(c); | ||
623 | - }); | ||
624 | - | ||
625 | - it('should read and write long, arbitrary POLYGON string', function() { | ||
626 | - c = wkt.components = [randomCoords(100)]; | ||
627 | - wkt.type = 'polygon'; | ||
628 | - | ||
629 | - expect(wkt.read(wkt.write()).components).deep.equal(c); | ||
630 | - }); | ||
631 | - | ||
632 | - }); | ||
633 | -}); | ||
634 | - | ||
635 | -describe('Edge Cases: ', function() { | ||
636 | - var wkt = new Wkt.Wkt(); | ||
637 | - | ||
638 | - afterEach(function() { | ||
639 | - wkt.wrapVertices = false; | ||
640 | - wkt.delimiter = ' '; | ||
641 | - }); | ||
642 | - | ||
643 | - it('should read a POINT string with single-digit coordinates', function() { | ||
644 | - var test = { | ||
645 | - str: 'POINT(4 4)', | ||
646 | - cmp: [{ | ||
647 | - x: 4, | ||
648 | - y: 4 | ||
649 | - }] | ||
650 | - }; | ||
651 | - | ||
652 | - wkt.read(test.str); | ||
653 | - | ||
654 | - expect(wkt.type).equal('point'); | ||
655 | - expect(wkt.isCollection()).equal(false); | ||
656 | - expect(wkt.components).deep.equal(test.cmp); | ||
657 | - | ||
658 | - // Now try it for URLs | ||
659 | - wkt.delimiter = '+'; | ||
660 | - wkt.read(test.str.replace(/ /g, '+')); | ||
661 | - expect(wkt.components).deep.equal(test.cmp); | ||
662 | - }); | ||
663 | - | ||
664 | - it('should read a LINESTRING string with single-digit coordinates', function() { | ||
665 | - var test = { | ||
666 | - str: 'LINESTRING(4 4,3 5,6 7)', | ||
667 | - cmp: [{ | ||
668 | - x: 4, | ||
669 | - y: 4 | ||
670 | - }, { | ||
671 | - x: 3, | ||
672 | - y: 5 | ||
673 | - }, { | ||
674 | - x: 6, | ||
675 | - y: 7 | ||
676 | - }] | ||
677 | - }; | ||
678 | - | ||
679 | - wkt.read(test.str); | ||
680 | - | ||
681 | - expect(wkt.type).equal('linestring'); | ||
682 | - expect(wkt.isCollection()).equal(false); | ||
683 | - expect(wkt.components).deep.equal(test.cmp); | ||
684 | - | ||
685 | - // Now try it for URLs | ||
686 | - wkt.delimiter = '+'; | ||
687 | - wkt.read(test.str.replace(/ /g, '+')); | ||
688 | - expect(wkt.components).deep.equal(test.cmp); | ||
689 | - }); | ||
690 | - | ||
691 | - it('should read a POLYGON string with single-digit coordinates', function() { | ||
692 | - var test = { | ||
693 | - str: 'POLYGON((4 4,3 5,6 7,7 5,4 4))', | ||
694 | - cmp: [ | ||
695 | - [{ | ||
696 | - x: 4, | ||
697 | - y: 4 | ||
698 | - }, { | ||
699 | - x: 3, | ||
700 | - y: 5 | ||
701 | - }, { | ||
702 | - x: 6, | ||
703 | - y: 7 | ||
704 | - }, { | ||
705 | - x: 7, | ||
706 | - y: 5 | ||
707 | - }, { | ||
708 | - x: 4, | ||
709 | - y: 4 | ||
710 | - }] | ||
711 | - ] | ||
712 | - }; | ||
713 | - | ||
714 | - wkt.read(test.str); | ||
715 | - | ||
716 | - expect(wkt.type).equal('polygon'); | ||
717 | - expect(wkt.isCollection()).equal(true); | ||
718 | - expect(wkt.components).deep.equal(test.cmp); | ||
719 | - | ||
720 | - // Now try it for URLs | ||
721 | - wkt.delimiter = '+'; | ||
722 | - wkt.read(test.str.replace(/ /g, '+')); | ||
723 | - expect(wkt.components).deep.equal(test.cmp); | ||
724 | - }); | ||
725 | - | ||
726 | - it('should read a POLYGON string with excess precision', function() { | ||
727 | - var test = { | ||
728 | - str: 'POLYGON((4.1234 4,3 5,6 7,7 5.5678,4 4))', | ||
729 | - cmp: [ | ||
730 | - [{ | ||
731 | - x: 4.1234, | ||
732 | - y: 4 | ||
733 | - }, { | ||
734 | - x: 3, | ||
735 | - y: 5 | ||
736 | - }, { | ||
737 | - x: 6, | ||
738 | - y: 7 | ||
739 | - }, { | ||
740 | - x: 7, | ||
741 | - y: 5.5678 | ||
742 | - }, { | ||
743 | - x: 4, | ||
744 | - y: 4 | ||
745 | - }] | ||
746 | - ] | ||
747 | - }; | ||
748 | - | ||
749 | - wkt.read(test.str); | ||
750 | - | ||
751 | - expect(wkt.type).equal('polygon'); | ||
752 | - expect(wkt.isCollection()).equal(true); | ||
753 | - expect(wkt.components).deep.equal(test.cmp); | ||
754 | - | ||
755 | - // Now try it for URLs | ||
756 | - wkt.delimiter = '+'; | ||
757 | - wkt.read(test.str.replace(/ /g, '+')); | ||
758 | - expect(wkt.components).deep.equal(test.cmp); | ||
759 | - }); | ||
760 | - | ||
761 | -}); // eo describe() | ||
762 | - | ||
763 | -describe('Merged WKT Test Cases: ', function() { | ||
764 | - var cases = { | ||
765 | - | ||
766 | - pointA: { | ||
767 | - str: 'POINT(30 10)', | ||
768 | - cmp: [{ | ||
769 | - x: 30, | ||
770 | - y: 10 | ||
771 | - }] | ||
772 | - }, | ||
773 | - | ||
774 | - pointB: { | ||
775 | - str: 'POINT(25 45)', | ||
776 | - cmp: [{ | ||
777 | - x: 25, | ||
778 | - y: 45 | ||
779 | - }] | ||
780 | - }, | ||
781 | - | ||
782 | - linestringA: { | ||
783 | - str: 'LINESTRING(25 15,15 35,35 35)', | ||
784 | - cmp: [{ | ||
785 | - x: 25, | ||
786 | - y: 15 | ||
787 | - }, { | ||
788 | - x: 15, | ||
789 | - y: 35 | ||
790 | - }, { | ||
791 | - x: 35, | ||
792 | - y: 35 | ||
793 | - }] | ||
794 | - }, | ||
795 | - | ||
796 | - linestringB: { | ||
797 | - str: 'LINESTRING(30 10,10 30,40 40)', | ||
798 | - cmp: [{ | ||
799 | - x: 30, | ||
800 | - y: 10 | ||
801 | - }, { | ||
802 | - x: 10, | ||
803 | - y: 30 | ||
804 | - }, { | ||
805 | - x: 40, | ||
806 | - y: 40 | ||
807 | - }] | ||
808 | - }, | ||
809 | - | ||
810 | - polygonA: { | ||
811 | - str: 'POLYGON((30 10,10 20,20 40,40 40,30 10))', | ||
812 | - cmp: [ | ||
813 | - [{ | ||
814 | - x: 30, | ||
815 | - y: 10 | ||
816 | - }, { | ||
817 | - x: 10, | ||
818 | - y: 20 | ||
819 | - }, { | ||
820 | - x: 20, | ||
821 | - y: 40 | ||
822 | - }, { | ||
823 | - x: 40, | ||
824 | - y: 40 | ||
825 | - }, { | ||
826 | - x: 30, | ||
827 | - y: 10 | ||
828 | - }] | ||
829 | - ] | ||
830 | - }, | ||
831 | - | ||
832 | - polygonB: { | ||
833 | - str: 'POLYGON((35 15,15 25,25 45,45 45,35 15))', | ||
834 | - cmp: [ | ||
835 | - [{ | ||
836 | - x: 35, | ||
837 | - y: 15 | ||
838 | - }, { | ||
839 | - x: 15, | ||
840 | - y: 25 | ||
841 | - }, { | ||
842 | - x: 25, | ||
843 | - y: 45 | ||
844 | - }, { | ||
845 | - x: 45, | ||
846 | - y: 45 | ||
847 | - }, { | ||
848 | - x: 35, | ||
849 | - y: 15 | ||
850 | - }] | ||
851 | - ] | ||
852 | - }, | ||
853 | - | ||
854 | - polygon2A: { | ||
855 | - str: 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 35,30 20,20 30))', | ||
856 | - cmp: [ | ||
857 | - [{ | ||
858 | - x: 35, | ||
859 | - y: 10 | ||
860 | - }, { | ||
861 | - x: 10, | ||
862 | - y: 20 | ||
863 | - }, { | ||
864 | - x: 15, | ||
865 | - y: 40 | ||
866 | - }, { | ||
867 | - x: 45, | ||
868 | - y: 45 | ||
869 | - }, { | ||
870 | - x: 35, | ||
871 | - y: 10 | ||
872 | - }], | ||
873 | - [{ | ||
874 | - x: 20, | ||
875 | - y: 30 | ||
876 | - }, { | ||
877 | - x: 35, | ||
878 | - y: 35 | ||
879 | - }, { | ||
880 | - x: 30, | ||
881 | - y: 20 | ||
882 | - }, { | ||
883 | - x: 20, | ||
884 | - y: 30 | ||
885 | - }] | ||
886 | - ] | ||
887 | - }, | ||
888 | - | ||
889 | - polygon2B: { | ||
890 | - str: 'POLYGON((135 110,110 120,115 140,145 145,135 110),(120 130,135 135,130 120,120 130))', | ||
891 | - cmp: [ | ||
892 | - [{ | ||
893 | - x: 135, | ||
894 | - y: 110 | ||
895 | - }, { | ||
896 | - x: 110, | ||
897 | - y: 120 | ||
898 | - }, { | ||
899 | - x: 115, | ||
900 | - y: 140 | ||
901 | - }, { | ||
902 | - x: 145, | ||
903 | - y: 145 | ||
904 | - }, { | ||
905 | - x: 135, | ||
906 | - y: 110 | ||
907 | - }], | ||
908 | - [{ | ||
909 | - x: 120, | ||
910 | - y: 130 | ||
911 | - }, { | ||
912 | - x: 135, | ||
913 | - y: 135 | ||
914 | - }, { | ||
915 | - x: 130, | ||
916 | - y: 120 | ||
917 | - }, { | ||
918 | - x: 120, | ||
919 | - y: 130 | ||
920 | - }] | ||
921 | - ] | ||
922 | - }, | ||
923 | - | ||
924 | - multipointA: { | ||
925 | - str: 'MULTIPOINT((10 40),(40 30),(20 20),(30 10))', | ||
926 | - cmp: [ | ||
927 | - [{ | ||
928 | - x: 10, | ||
929 | - y: 40 | ||
930 | - }], | ||
931 | - [{ | ||
932 | - x: 40, | ||
933 | - y: 30 | ||
934 | - }], | ||
935 | - [{ | ||
936 | - x: 20, | ||
937 | - y: 20 | ||
938 | - }], | ||
939 | - [{ | ||
940 | - x: 30, | ||
941 | - y: 10 | ||
942 | - }] | ||
943 | - ] | ||
944 | - }, | ||
945 | - | ||
946 | - multipointB: { | ||
947 | - str: 'MULTIPOINT((15 45),(45 35),(25 25),(35 15))', | ||
948 | - cmp: [ | ||
949 | - [{ | ||
950 | - x: 15, | ||
951 | - y: 45 | ||
952 | - }], | ||
953 | - [{ | ||
954 | - x: 45, | ||
955 | - y: 35 | ||
956 | - }], | ||
957 | - [{ | ||
958 | - x: 25, | ||
959 | - y: 25 | ||
960 | - }], | ||
961 | - [{ | ||
962 | - x: 35, | ||
963 | - y: 15 | ||
964 | - }] | ||
965 | - ] | ||
966 | - }, | ||
967 | - | ||
968 | - multilinestringA: { | ||
969 | - str: 'MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10))', | ||
970 | - cmp: [ | ||
971 | - [{ | ||
972 | - x: 10, | ||
973 | - y: 10 | ||
974 | - }, { | ||
975 | - x: 20, | ||
976 | - y: 20 | ||
977 | - }, { | ||
978 | - x: 10, | ||
979 | - y: 40 | ||
980 | - }], | ||
981 | - [{ | ||
982 | - x: 40, | ||
983 | - y: 40 | ||
984 | - }, { | ||
985 | - x: 30, | ||
986 | - y: 30 | ||
987 | - }, { | ||
988 | - x: 40, | ||
989 | - y: 20 | ||
990 | - }, { | ||
991 | - x: 30, | ||
992 | - y: 10 | ||
993 | - }] | ||
994 | - ] | ||
995 | - }, | ||
996 | - | ||
997 | - multilinestringB: { | ||
998 | - str: 'MULTILINESTRING((15 15,25 25,15 45),(45 45,35 35,45 25,35 15))', | ||
999 | - cmp: [ | ||
1000 | - [{ | ||
1001 | - x: 15, | ||
1002 | - y: 15 | ||
1003 | - }, { | ||
1004 | - x: 25, | ||
1005 | - y: 25 | ||
1006 | - }, { | ||
1007 | - x: 15, | ||
1008 | - y: 45 | ||
1009 | - }], | ||
1010 | - [{ | ||
1011 | - x: 45, | ||
1012 | - y: 45 | ||
1013 | - }, { | ||
1014 | - x: 35, | ||
1015 | - y: 35 | ||
1016 | - }, { | ||
1017 | - x: 45, | ||
1018 | - y: 25 | ||
1019 | - }, { | ||
1020 | - x: 35, | ||
1021 | - y: 15 | ||
1022 | - }] | ||
1023 | - ] | ||
1024 | - }, | ||
1025 | - | ||
1026 | - multipolygonA: { | ||
1027 | - str: 'MULTIPOLYGON(((30 20,10 40,45 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))', | ||
1028 | - cmp: [ | ||
1029 | - [ | ||
1030 | - [{ | ||
1031 | - x: 30, | ||
1032 | - y: 20 | ||
1033 | - }, { | ||
1034 | - x: 10, | ||
1035 | - y: 40 | ||
1036 | - }, { | ||
1037 | - x: 45, | ||
1038 | - y: 40 | ||
1039 | - }, { | ||
1040 | - x: 30, | ||
1041 | - y: 20 | ||
1042 | - }, ] | ||
1043 | - ], | ||
1044 | - [ | ||
1045 | - [{ | ||
1046 | - x: 15, | ||
1047 | - y: 5 | ||
1048 | - }, { | ||
1049 | - x: 40, | ||
1050 | - y: 10 | ||
1051 | - }, { | ||
1052 | - x: 10, | ||
1053 | - y: 20 | ||
1054 | - }, { | ||
1055 | - x: 5, | ||
1056 | - y: 10 | ||
1057 | - }, { | ||
1058 | - x: 15, | ||
1059 | - y: 5 | ||
1060 | - }] | ||
1061 | - ] | ||
1062 | - ] | ||
1063 | - }, | ||
1064 | - | ||
1065 | - multipolygonB: { | ||
1066 | - str: 'MULTIPOLYGON(((130 120,110 140,145 140,130 120)),((115 15,140 110,110 120,15 110,115 15)))', | ||
1067 | - cmp: [ | ||
1068 | - [ | ||
1069 | - [{ | ||
1070 | - x: 130, | ||
1071 | - y: 120 | ||
1072 | - }, { | ||
1073 | - x: 110, | ||
1074 | - y: 140 | ||
1075 | - }, { | ||
1076 | - x: 145, | ||
1077 | - y: 140 | ||
1078 | - }, { | ||
1079 | - x: 130, | ||
1080 | - y: 120 | ||
1081 | - }, ] | ||
1082 | - ], | ||
1083 | - [ | ||
1084 | - [{ | ||
1085 | - x: 115, | ||
1086 | - y: 15 | ||
1087 | - }, { | ||
1088 | - x: 140, | ||
1089 | - y: 110 | ||
1090 | - }, { | ||
1091 | - x: 110, | ||
1092 | - y: 120 | ||
1093 | - }, { | ||
1094 | - x: 15, | ||
1095 | - y: 110 | ||
1096 | - }, { | ||
1097 | - x: 115, | ||
1098 | - y: 15 | ||
1099 | - }] | ||
1100 | - ] | ||
1101 | - ] | ||
1102 | - } | ||
1103 | - | ||
1104 | - }; | ||
1105 | - | ||
1106 | - it('should merge POINT strings together', function() { | ||
1107 | - var a = new Wkt.Wkt(cases.pointA.str), | ||
1108 | - b = new Wkt.Wkt(cases.pointB.str); | ||
1109 | - | ||
1110 | - a.merge(b); | ||
1111 | - expect(a.type).equal('multipoint'); | ||
1112 | - expect(b.type).equal('point'); | ||
1113 | - expect(a.isCollection()).equal(true); | ||
1114 | - expect(b.isCollection()).equal(false); | ||
1115 | - expect(a.write()).equal('MULTIPOINT((30 10),(25 45))'); | ||
1116 | - expect(a.components).deep.equal([ | ||
1117 | - [{ | ||
1118 | - x: 30, | ||
1119 | - y: 10 | ||
1120 | - }, { | ||
1121 | - x: 25, | ||
1122 | - y: 45 | ||
1123 | - }] | ||
1124 | - ]); | ||
1125 | - | ||
1126 | - }); | ||
1127 | - | ||
1128 | - it('should merge LINESTRING strings together', function() { | ||
1129 | - var a = new Wkt.Wkt(cases.linestringA.str), | ||
1130 | - b = new Wkt.Wkt(cases.linestringB.str); | ||
1131 | - | ||
1132 | - a.merge(b); | ||
1133 | - expect(a.type).equal('multilinestring'); | ||
1134 | - expect(b.type).equal('linestring'); | ||
1135 | - expect(a.isCollection()).equal(true); | ||
1136 | - expect(b.isCollection()).equal(false); | ||
1137 | - expect(a.write()).equal('MULTILINESTRING((25 15,15 35,35 35),(30 10,10 30,40 40))'); | ||
1138 | - expect(a.components).deep.equal([ | ||
1139 | - [{ | ||
1140 | - x: 25, | ||
1141 | - y: 15 | ||
1142 | - }, { | ||
1143 | - x: 15, | ||
1144 | - y: 35 | ||
1145 | - }, { | ||
1146 | - x: 35, | ||
1147 | - y: 35 | ||
1148 | - }], | ||
1149 | - [{ | ||
1150 | - x: 30, | ||
1151 | - y: 10 | ||
1152 | - }, { | ||
1153 | - x: 10, | ||
1154 | - y: 30 | ||
1155 | - }, { | ||
1156 | - x: 40, | ||
1157 | - y: 40 | ||
1158 | - }] | ||
1159 | - ]); | ||
1160 | - | ||
1161 | - }); | ||
1162 | - | ||
1163 | - it('should merge POLYGON strings together', function() { | ||
1164 | - var a = new Wkt.Wkt(cases.polygonA.str), | ||
1165 | - b = new Wkt.Wkt(cases.polygonB.str); | ||
1166 | - | ||
1167 | - a.merge(b); | ||
1168 | - expect(a.type).equal('multipolygon'); | ||
1169 | - expect(b.type).equal('polygon'); | ||
1170 | - expect(a.isCollection()).equal(true); | ||
1171 | - expect(b.isCollection()).equal(true); | ||
1172 | - expect(a.write()).equal('MULTIPOLYGON(((30 10,10 20,20 40,40 40,30 10)),((35 15,15 25,25 45,45 45,35 15)))'); | ||
1173 | - expect(a.components).deep.equal([ | ||
1174 | - [ | ||
1175 | - [{ | ||
1176 | - x: 30, | ||
1177 | - y: 10 | ||
1178 | - }, { | ||
1179 | - x: 10, | ||
1180 | - y: 20 | ||
1181 | - }, { | ||
1182 | - x: 20, | ||
1183 | - y: 40 | ||
1184 | - }, { | ||
1185 | - x: 40, | ||
1186 | - y: 40 | ||
1187 | - }, { | ||
1188 | - x: 30, | ||
1189 | - y: 10 | ||
1190 | - }] | ||
1191 | - ], | ||
1192 | - [ | ||
1193 | - [{ | ||
1194 | - x: 35, | ||
1195 | - y: 15 | ||
1196 | - }, { | ||
1197 | - x: 15, | ||
1198 | - y: 25 | ||
1199 | - }, { | ||
1200 | - x: 25, | ||
1201 | - y: 45 | ||
1202 | - }, { | ||
1203 | - x: 45, | ||
1204 | - y: 45 | ||
1205 | - }, { | ||
1206 | - x: 35, | ||
1207 | - y: 15 | ||
1208 | - }] | ||
1209 | - ] | ||
1210 | - ]); | ||
1211 | - | ||
1212 | - }); | ||
1213 | - | ||
1214 | - it('should merge POLYGON strings together even if they have holes', function() { | ||
1215 | - var a = new Wkt.Wkt(cases.polygon2A.str), | ||
1216 | - b = new Wkt.Wkt(cases.polygon2B.str); | ||
1217 | - | ||
1218 | - a.merge(b); | ||
1219 | - expect(a.type).equal('multipolygon'); | ||
1220 | - expect(b.type).equal('polygon'); | ||
1221 | - expect(a.isCollection()).equal(true); | ||
1222 | - expect(b.isCollection()).equal(true); | ||
1223 | - expect(a.write()).equal('MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10),(20 30,35 35,30 20,20 30)),((135 110,110 120,115 140,145 145,135 110),(120 130,135 135,130 120,120 130)))'); | ||
1224 | - expect(a.components).deep.equal([ | ||
1225 | - [ | ||
1226 | - [{ | ||
1227 | - x: 35, | ||
1228 | - y: 10 | ||
1229 | - }, { | ||
1230 | - x: 10, | ||
1231 | - y: 20 | ||
1232 | - }, { | ||
1233 | - x: 15, | ||
1234 | - y: 40 | ||
1235 | - }, { | ||
1236 | - x: 45, | ||
1237 | - y: 45 | ||
1238 | - }, { | ||
1239 | - x: 35, | ||
1240 | - y: 10 | ||
1241 | - }], | ||
1242 | - [{ | ||
1243 | - x: 20, | ||
1244 | - y: 30 | ||
1245 | - }, { | ||
1246 | - x: 35, | ||
1247 | - y: 35 | ||
1248 | - }, { | ||
1249 | - x: 30, | ||
1250 | - y: 20 | ||
1251 | - }, { | ||
1252 | - x: 20, | ||
1253 | - y: 30 | ||
1254 | - }] | ||
1255 | - ], | ||
1256 | - [ | ||
1257 | - [{ | ||
1258 | - x: 135, | ||
1259 | - y: 110 | ||
1260 | - }, { | ||
1261 | - x: 110, | ||
1262 | - y: 120 | ||
1263 | - }, { | ||
1264 | - x: 115, | ||
1265 | - y: 140 | ||
1266 | - }, { | ||
1267 | - x: 145, | ||
1268 | - y: 145 | ||
1269 | - }, { | ||
1270 | - x: 135, | ||
1271 | - y: 110 | ||
1272 | - }], | ||
1273 | - [{ | ||
1274 | - x: 120, | ||
1275 | - y: 130 | ||
1276 | - }, { | ||
1277 | - x: 135, | ||
1278 | - y: 135 | ||
1279 | - }, { | ||
1280 | - x: 130, | ||
1281 | - y: 120 | ||
1282 | - }, { | ||
1283 | - x: 120, | ||
1284 | - y: 130 | ||
1285 | - }] | ||
1286 | - ] | ||
1287 | - ]); | ||
1288 | - | ||
1289 | - }); | ||
1290 | - | ||
1291 | - it('should merge MULTIPOINT strings together', function() { | ||
1292 | - var a = new Wkt.Wkt(cases.multipointA.str), | ||
1293 | - b = new Wkt.Wkt(cases.multipointB.str); | ||
1294 | - | ||
1295 | - a.merge(b); | ||
1296 | - expect(a.type).equal('multipoint'); | ||
1297 | - expect(b.type).equal('multipoint'); | ||
1298 | - expect(a.isCollection()).equal(true); | ||
1299 | - expect(b.isCollection()).equal(true); | ||
1300 | - expect(a.write()).equal('MULTIPOINT((10 40),(40 30),(20 20),(30 10),(15 45),(45 35),(25 25),(35 15))'); | ||
1301 | - expect(a.components).deep.equal([ | ||
1302 | - [{ | ||
1303 | - x: 10, | ||
1304 | - y: 40 | ||
1305 | - }], | ||
1306 | - [{ | ||
1307 | - x: 40, | ||
1308 | - y: 30 | ||
1309 | - }], | ||
1310 | - [{ | ||
1311 | - x: 20, | ||
1312 | - y: 20 | ||
1313 | - }], | ||
1314 | - [{ | ||
1315 | - x: 30, | ||
1316 | - y: 10 | ||
1317 | - }], | ||
1318 | - [{ | ||
1319 | - x: 15, | ||
1320 | - y: 45 | ||
1321 | - }], | ||
1322 | - [{ | ||
1323 | - x: 45, | ||
1324 | - y: 35 | ||
1325 | - }], | ||
1326 | - [{ | ||
1327 | - x: 25, | ||
1328 | - y: 25 | ||
1329 | - }], | ||
1330 | - [{ | ||
1331 | - x: 35, | ||
1332 | - y: 15 | ||
1333 | - }] | ||
1334 | - ]); | ||
1335 | - | ||
1336 | - }); | ||
1337 | - | ||
1338 | - it('should merge MULTILINESTRING strings together', function() { | ||
1339 | - var a = new Wkt.Wkt(cases.multilinestringA.str), | ||
1340 | - b = new Wkt.Wkt(cases.multilinestringB.str); | ||
1341 | - | ||
1342 | - a.merge(b); | ||
1343 | - expect(a.type).equal('multilinestring'); | ||
1344 | - expect(b.type).equal('multilinestring'); | ||
1345 | - expect(a.isCollection()).equal(true); | ||
1346 | - expect(b.isCollection()).equal(true); | ||
1347 | - expect(a.write()).equal('MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10),(15 15,25 25,15 45),(45 45,35 35,45 25,35 15))'); | ||
1348 | - expect(a.components).deep.equal([ | ||
1349 | - [{ | ||
1350 | - x: 10, | ||
1351 | - y: 10 | ||
1352 | - }, { | ||
1353 | - x: 20, | ||
1354 | - y: 20 | ||
1355 | - }, { | ||
1356 | - x: 10, | ||
1357 | - y: 40 | ||
1358 | - }], | ||
1359 | - [{ | ||
1360 | - x: 40, | ||
1361 | - y: 40 | ||
1362 | - }, { | ||
1363 | - x: 30, | ||
1364 | - y: 30 | ||
1365 | - }, { | ||
1366 | - x: 40, | ||
1367 | - y: 20 | ||
1368 | - }, { | ||
1369 | - x: 30, | ||
1370 | - y: 10 | ||
1371 | - }], | ||
1372 | - [{ | ||
1373 | - x: 15, | ||
1374 | - y: 15 | ||
1375 | - }, { | ||
1376 | - x: 25, | ||
1377 | - y: 25 | ||
1378 | - }, { | ||
1379 | - x: 15, | ||
1380 | - y: 45 | ||
1381 | - }], | ||
1382 | - [{ | ||
1383 | - x: 45, | ||
1384 | - y: 45 | ||
1385 | - }, { | ||
1386 | - x: 35, | ||
1387 | - y: 35 | ||
1388 | - }, { | ||
1389 | - x: 45, | ||
1390 | - y: 25 | ||
1391 | - }, { | ||
1392 | - x: 35, | ||
1393 | - y: 15 | ||
1394 | - }] | ||
1395 | - ]); | ||
1396 | - | ||
1397 | - }); | ||
1398 | - | ||
1399 | - it('should merge MULTIPOLYGON strings together', function() { | ||
1400 | - var a = new Wkt.Wkt(cases.multipolygonA.str), | ||
1401 | - b = new Wkt.Wkt(cases.multipolygonB.str); | ||
1402 | - | ||
1403 | - a.merge(b); | ||
1404 | - expect(a.type).equal('multipolygon'); | ||
1405 | - expect(b.type).equal('multipolygon'); | ||
1406 | - expect(a.isCollection()).equal(true); | ||
1407 | - expect(b.isCollection()).equal(true); | ||
1408 | - expect(a.write()).equal('MULTIPOLYGON(((30 20,10 40,45 40,30 20)),((15 5,40 10,10 20,5 10,15 5)),((130 120,110 140,145 140,130 120)),((115 15,140 110,110 120,15 110,115 15)))'); | ||
1409 | - expect(a.components).deep.equal([ | ||
1410 | - [ | ||
1411 | - [{ | ||
1412 | - x: 30, | ||
1413 | - y: 20 | ||
1414 | - }, { | ||
1415 | - x: 10, | ||
1416 | - y: 40 | ||
1417 | - }, { | ||
1418 | - x: 45, | ||
1419 | - y: 40 | ||
1420 | - }, { | ||
1421 | - x: 30, | ||
1422 | - y: 20 | ||
1423 | - }, ] | ||
1424 | - ], | ||
1425 | - [ | ||
1426 | - [{ | ||
1427 | - x: 15, | ||
1428 | - y: 5 | ||
1429 | - }, { | ||
1430 | - x: 40, | ||
1431 | - y: 10 | ||
1432 | - }, { | ||
1433 | - x: 10, | ||
1434 | - y: 20 | ||
1435 | - }, { | ||
1436 | - x: 5, | ||
1437 | - y: 10 | ||
1438 | - }, { | ||
1439 | - x: 15, | ||
1440 | - y: 5 | ||
1441 | - }] | ||
1442 | - ], | ||
1443 | - [ | ||
1444 | - [{ | ||
1445 | - x: 130, | ||
1446 | - y: 120 | ||
1447 | - }, { | ||
1448 | - x: 110, | ||
1449 | - y: 140 | ||
1450 | - }, { | ||
1451 | - x: 145, | ||
1452 | - y: 140 | ||
1453 | - }, { | ||
1454 | - x: 130, | ||
1455 | - y: 120 | ||
1456 | - }, ] | ||
1457 | - ], | ||
1458 | - [ | ||
1459 | - [{ | ||
1460 | - x: 115, | ||
1461 | - y: 15 | ||
1462 | - }, { | ||
1463 | - x: 140, | ||
1464 | - y: 110 | ||
1465 | - }, { | ||
1466 | - x: 110, | ||
1467 | - y: 120 | ||
1468 | - }, { | ||
1469 | - x: 15, | ||
1470 | - y: 110 | ||
1471 | - }, { | ||
1472 | - x: 115, | ||
1473 | - y: 15 | ||
1474 | - }] | ||
1475 | - ] | ||
1476 | - ]); | ||
1477 | - | ||
1478 | - }); | ||
1479 | - | ||
1480 | - it('should merge POINT strings into MULTIPOINT strings', function() { | ||
1481 | - var a = new Wkt.Wkt(cases.multipointA.str), | ||
1482 | - b = new Wkt.Wkt(cases.pointB.str); | ||
1483 | - | ||
1484 | - a.merge(b); | ||
1485 | - expect(a.type).equal('multipoint'); | ||
1486 | - expect(b.type).equal('point'); | ||
1487 | - expect(a.isCollection()).equal(true); | ||
1488 | - expect(b.isCollection()).equal(false); | ||
1489 | - expect(a.write()).equal('MULTIPOINT((10 40),(40 30),(20 20),(30 10),(25 45))'); | ||
1490 | - expect(a.components).deep.equal([ | ||
1491 | - [{ | ||
1492 | - x: 10, | ||
1493 | - y: 40 | ||
1494 | - }], | ||
1495 | - [{ | ||
1496 | - x: 40, | ||
1497 | - y: 30 | ||
1498 | - }], | ||
1499 | - [{ | ||
1500 | - x: 20, | ||
1501 | - y: 20 | ||
1502 | - }], | ||
1503 | - [{ | ||
1504 | - x: 30, | ||
1505 | - y: 10 | ||
1506 | - }], | ||
1507 | - [{ | ||
1508 | - x: 25, | ||
1509 | - y: 45 | ||
1510 | - }] | ||
1511 | - ]); | ||
1512 | - | ||
1513 | - }); | ||
1514 | - | ||
1515 | - it('should merge LINESTRING strings into MULTILINESTRING strings', function() { | ||
1516 | - var a = new Wkt.Wkt(cases.multilinestringA.str), | ||
1517 | - b = new Wkt.Wkt(cases.linestringB.str); | ||
1518 | - | ||
1519 | - a.merge(b); | ||
1520 | - expect(a.type).equal('multilinestring'); | ||
1521 | - expect(b.type).equal('linestring'); | ||
1522 | - expect(a.isCollection()).equal(true); | ||
1523 | - expect(b.isCollection()).equal(false); | ||
1524 | - expect(a.write()).equal('MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10),(30 10,10 30,40 40))'); | ||
1525 | - expect(a.components).deep.equal([ | ||
1526 | - [{ | ||
1527 | - x: 10, | ||
1528 | - y: 10 | ||
1529 | - }, { | ||
1530 | - x: 20, | ||
1531 | - y: 20 | ||
1532 | - }, { | ||
1533 | - x: 10, | ||
1534 | - y: 40 | ||
1535 | - }], | ||
1536 | - [{ | ||
1537 | - x: 40, | ||
1538 | - y: 40 | ||
1539 | - }, { | ||
1540 | - x: 30, | ||
1541 | - y: 30 | ||
1542 | - }, { | ||
1543 | - x: 40, | ||
1544 | - y: 20 | ||
1545 | - }, { | ||
1546 | - x: 30, | ||
1547 | - y: 10 | ||
1548 | - }], | ||
1549 | - [{ | ||
1550 | - x: 30, | ||
1551 | - y: 10 | ||
1552 | - }, { | ||
1553 | - x: 10, | ||
1554 | - y: 30 | ||
1555 | - }, { | ||
1556 | - x: 40, | ||
1557 | - y: 40 | ||
1558 | - }] | ||
1559 | - ]); | ||
1560 | - | ||
1561 | - }); | ||
1562 | - | ||
1563 | - it('should merge POLYGON strings into MULTIPOLYGON strings', function() { | ||
1564 | - var a = new Wkt.Wkt(cases.multipolygonA.str), | ||
1565 | - b = new Wkt.Wkt(cases.polygonB.str); | ||
1566 | - | ||
1567 | - a.merge(b); | ||
1568 | - expect(a.type).equal('multipolygon'); | ||
1569 | - expect(b.type).equal('polygon'); | ||
1570 | - expect(a.isCollection()).equal(true); | ||
1571 | - expect(b.isCollection()).equal(true); | ||
1572 | - expect(a.write()).equal('MULTIPOLYGON(((30 20,10 40,45 40,30 20)),((15 5,40 10,10 20,5 10,15 5)),((35 15,15 25,25 45,45 45,35 15)))'); | ||
1573 | - expect(a.components).deep.equal([ | ||
1574 | - [ | ||
1575 | - [{ | ||
1576 | - x: 30, | ||
1577 | - y: 20 | ||
1578 | - }, { | ||
1579 | - x: 10, | ||
1580 | - y: 40 | ||
1581 | - }, { | ||
1582 | - x: 45, | ||
1583 | - y: 40 | ||
1584 | - }, { | ||
1585 | - x: 30, | ||
1586 | - y: 20 | ||
1587 | - }, ] | ||
1588 | - ], | ||
1589 | - [ | ||
1590 | - [{ | ||
1591 | - x: 15, | ||
1592 | - y: 5 | ||
1593 | - }, { | ||
1594 | - x: 40, | ||
1595 | - y: 10 | ||
1596 | - }, { | ||
1597 | - x: 10, | ||
1598 | - y: 20 | ||
1599 | - }, { | ||
1600 | - x: 5, | ||
1601 | - y: 10 | ||
1602 | - }, { | ||
1603 | - x: 15, | ||
1604 | - y: 5 | ||
1605 | - }] | ||
1606 | - ], | ||
1607 | - [ | ||
1608 | - [{ | ||
1609 | - x: 35, | ||
1610 | - y: 15 | ||
1611 | - }, { | ||
1612 | - x: 15, | ||
1613 | - y: 25 | ||
1614 | - }, { | ||
1615 | - x: 25, | ||
1616 | - y: 45 | ||
1617 | - }, { | ||
1618 | - x: 45, | ||
1619 | - y: 45 | ||
1620 | - }, { | ||
1621 | - x: 35, | ||
1622 | - y: 15 | ||
1623 | - }] | ||
1624 | - ] | ||
1625 | - ]); | ||
1626 | - | ||
1627 | - }); | ||
1628 | - | ||
1629 | -}); | ||
1630 | - | ||
1631 | -describe('GeoJSON Cases:', function() { | ||
1632 | - var cases = { // See: http://en.wikipedia.org/wiki/GeoJSON#Geometries | ||
1633 | - | ||
1634 | - point: { | ||
1635 | - str: 'POINT(30 10)', | ||
1636 | - json: { | ||
1637 | - 'coordinates': [30, 10], | ||
1638 | - 'type': 'Point' | ||
1639 | - }, | ||
1640 | - jsonStr: '{"coordinates": [30, 10], "type": "Point"}' | ||
1641 | - }, | ||
1642 | - | ||
1643 | - linestring: { | ||
1644 | - str: 'LINESTRING(30 10,10 30,40 40)', | ||
1645 | - json: { | ||
1646 | - 'coordinates': [ | ||
1647 | - [30, 10], | ||
1648 | - [10, 30], | ||
1649 | - [40, 40] | ||
1650 | - ], | ||
1651 | - 'type': 'LineString' | ||
1652 | - }, | ||
1653 | - jsonStr: '{"coordinates": [[30, 10], [10, 30], [40, 40]], "type": "LineString"}' | ||
1654 | - }, | ||
1655 | - | ||
1656 | - polygon: { | ||
1657 | - str: 'POLYGON((30 10,10 20,20 40,40 40,30 10))', | ||
1658 | - json: { | ||
1659 | - 'coordinates': [ | ||
1660 | - [ | ||
1661 | - [30, 10], | ||
1662 | - [10, 20], | ||
1663 | - [20, 40], | ||
1664 | - [40, 40], | ||
1665 | - [30, 10] | ||
1666 | - ] | ||
1667 | - ], | ||
1668 | - 'type': 'Polygon' | ||
1669 | - }, | ||
1670 | - jsonStr: '{"coordinates": [[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]], "type": "Polygon"}' | ||
1671 | - }, | ||
1672 | - | ||
1673 | - polygon2: { | ||
1674 | - str: 'POLYGON((35 10,45 45,15 40,10 20,35 10),(20 30,35 35,30 20,20 30))', | ||
1675 | - json: { | ||
1676 | - 'coordinates': [ | ||
1677 | - [ | ||
1678 | - [35, 10], | ||
1679 | - [45, 45], | ||
1680 | - [15, 40], | ||
1681 | - [10, 20], | ||
1682 | - [35, 10] | ||
1683 | - ], | ||
1684 | - [ | ||
1685 | - [20, 30], | ||
1686 | - [35, 35], | ||
1687 | - [30, 20], | ||
1688 | - [20, 30] | ||
1689 | - ] | ||
1690 | - ], | ||
1691 | - 'type': 'Polygon' | ||
1692 | - }, | ||
1693 | - jsonStr: '{"coordinates": [[[35, 10], [45, 45], [15, 40], [10, 20], [35, 10]], [[20, 30], [35, 35], [30, 20], [20, 30]]], "type": "Polygon"}' | ||
1694 | - }, | ||
1695 | - | ||
1696 | - multipolygon: { | ||
1697 | - str: 'MULTIPOLYGON(((30 20,10 40,45 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))', | ||
1698 | - json: { | ||
1699 | - 'coordinates': [ | ||
1700 | - [ | ||
1701 | - [ | ||
1702 | - [30, 20], | ||
1703 | - [10, 40], | ||
1704 | - [45, 40], | ||
1705 | - [30, 20] | ||
1706 | - ] | ||
1707 | - ], | ||
1708 | - [ | ||
1709 | - [ | ||
1710 | - [15, 5], | ||
1711 | - [40, 10], | ||
1712 | - [10, 20], | ||
1713 | - [5, 10], | ||
1714 | - [15, 5] | ||
1715 | - ] | ||
1716 | - ] | ||
1717 | - ], | ||
1718 | - 'type': 'MultiPolygon' | ||
1719 | - }, | ||
1720 | - jsonStr: '{"coordinates": [[[[30, 20], [10, 40], [45, 40], [30, 20]]], [[[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]]], "type": "MultiPolygon"}' | ||
1721 | - }, | ||
1722 | - | ||
1723 | - multipolygon2: { | ||
1724 | - str: 'MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,10 30,10 10,30 5,45 20,20 35),(30 20,20 15,20 25,30 20)))', | ||
1725 | - json: { | ||
1726 | - 'coordinates': [ | ||
1727 | - [ | ||
1728 | - [ | ||
1729 | - [40, 40], | ||
1730 | - [20, 45], | ||
1731 | - [45, 30], | ||
1732 | - [40, 40] | ||
1733 | - ] | ||
1734 | - ], | ||
1735 | - [ | ||
1736 | - [ | ||
1737 | - [20, 35], | ||
1738 | - [10, 30], | ||
1739 | - [10, 10], | ||
1740 | - [30, 5], | ||
1741 | - [45, 20], | ||
1742 | - [20, 35] | ||
1743 | - ], | ||
1744 | - [ | ||
1745 | - [30, 20], | ||
1746 | - [20, 15], | ||
1747 | - [20, 25], | ||
1748 | - [30, 20] | ||
1749 | - ] | ||
1750 | - ] | ||
1751 | - ], | ||
1752 | - 'type': 'MultiPolygon' | ||
1753 | - }, | ||
1754 | - jsonStr: '{"coordinates": [[[[40, 40], [20, 45], [45, 30], [40, 40]]], [[[20, 35], [10, 30], [10, 10], [30, 5], [45, 20], [20, 35]], [[30, 20], [20, 15], [20, 25], [30, 20]]]], "type": "MultiPolygon"}' | ||
1755 | - }, | ||
1756 | - | ||
1757 | - multipoint: { | ||
1758 | - str: 'MULTIPOINT((10 40),(40 30),(20 20),(30 10))', | ||
1759 | - json: { | ||
1760 | - 'coordinates': [ | ||
1761 | - [10, 40], | ||
1762 | - [40, 30], | ||
1763 | - [20, 20], | ||
1764 | - [30, 10] | ||
1765 | - ], | ||
1766 | - 'type': 'MultiPoint' | ||
1767 | - }, | ||
1768 | - jsonStr: '{"coordinates": [[10, 40], [40, 30], [20, 20], [30, 10]], "type": "MultiPoint"}' | ||
1769 | - }, | ||
1770 | - | ||
1771 | - multilinestring: { | ||
1772 | - str: 'MULTILINESTRING((10 10,20 20,10 40),(40 40,30 30,40 20,30 10))', | ||
1773 | - json: { | ||
1774 | - 'coordinates': [ | ||
1775 | - [ | ||
1776 | - [10, 10], | ||
1777 | - [20, 20], | ||
1778 | - [10, 40] | ||
1779 | - ], | ||
1780 | - [ | ||
1781 | - [40, 40], | ||
1782 | - [30, 30], | ||
1783 | - [40, 20], | ||
1784 | - [30, 10] | ||
1785 | - ] | ||
1786 | - ], | ||
1787 | - 'type': 'MultiLineString' | ||
1788 | - }, | ||
1789 | - jsonStr: '{"coordinates": [[[10, 10], [20, 20], [10, 40]], [[40, 40], [30, 30], [40, 20], [30, 10]]], "type": "MultiLineString"}' | ||
1790 | - }, | ||
1791 | - | ||
1792 | - box: { | ||
1793 | - str: 'BOX(0 0,20 20)', | ||
1794 | - json: { | ||
1795 | - 'coordinates': [ | ||
1796 | - [ | ||
1797 | - [0, 0], | ||
1798 | - [0, 20], | ||
1799 | - [20, 20], | ||
1800 | - [20, 0], | ||
1801 | - [0, 0] | ||
1802 | - ] | ||
1803 | - ], | ||
1804 | - 'type': 'Polygon', | ||
1805 | - 'bbox': [0, 0, 20, 20] | ||
1806 | - } | ||
1807 | - } | ||
1808 | - | ||
1809 | - }; | ||
1810 | - | ||
1811 | - describe('GeoJSON Construction:', function() { | ||
1812 | - | ||
1813 | - it('should create valid JSON for WKT Point type', function() { | ||
1814 | - var a = new Wkt.Wkt(cases.point.str); | ||
1815 | - expect(a.toJson()).deep.equal(cases.point.json); | ||
1816 | - }); | ||
1817 | - | ||
1818 | - it('should create valid JSON for WKT LineString type', function() { | ||
1819 | - var a = new Wkt.Wkt(cases.linestring.str); | ||
1820 | - expect(a.toJson()).deep.equal(cases.linestring.json); | ||
1821 | - }); | ||
1822 | - | ||
1823 | - it('should create valid JSON for WKT Polygon type', function() { | ||
1824 | - var a = new Wkt.Wkt(cases.polygon.str); | ||
1825 | - expect(a.toJson()).deep.equal(cases.polygon.json); | ||
1826 | - }); | ||
1827 | - | ||
1828 | - it('should create valid JSON for WKT Polygon type with a hole', function() { | ||
1829 | - var a = new Wkt.Wkt(cases.polygon2.str); | ||
1830 | - expect(a.toJson()).deep.equal(cases.polygon2.json); | ||
1831 | - }); | ||
1832 | - | ||
1833 | - it('should create valid JSON for WKT MultiPolygon type', function() { | ||
1834 | - var a = new Wkt.Wkt(cases.multipolygon.str); | ||
1835 | - expect(a.toJson()).deep.equal(cases.multipolygon.json); | ||
1836 | - }); | ||
1837 | - | ||
1838 | - it('should create valid JSON for WKT MultiPolygon type with a hole', function() { | ||
1839 | - var a = new Wkt.Wkt(cases.multipolygon2.str); | ||
1840 | - expect(a.toJson()).deep.equal(cases.multipolygon2.json); | ||
1841 | - }); | ||
1842 | - | ||
1843 | - it('should create valid JSON for WKT MultiPoint type', function() { | ||
1844 | - var a = new Wkt.Wkt(cases.multipoint.str); | ||
1845 | - expect(a.toJson()).deep.equal(cases.multipoint.json); | ||
1846 | - }); | ||
1847 | - | ||
1848 | - it('should create valid JSON for WKT MultiLineString type', function() { | ||
1849 | - var a = new Wkt.Wkt(cases.multilinestring.str); | ||
1850 | - expect(a.toJson()).deep.equal(cases.multilinestring.json); | ||
1851 | - }); | ||
1852 | - | ||
1853 | - it('should create valid JSON for WKT Box type', function() { | ||
1854 | - var a = new Wkt.Wkt(cases.box.str); | ||
1855 | - expect(a.toJson()).deep.equal(cases.box.json); | ||
1856 | - }); | ||
1857 | - | ||
1858 | - }); | ||
1859 | - | ||
1860 | - describe('GeoJSON Deconstruction (from Objects):', function() { | ||
1861 | - | ||
1862 | - it('should write the WKT string corresponding to a GeoJSON Point', function() { | ||
1863 | - var a = new Wkt.Wkt(cases.point.json); | ||
1864 | - expect(a.write()).deep.equal(cases.point.str); | ||
1865 | - }); | ||
1866 | - | ||
1867 | - it('should write the WKT string corresponding to a GeoJSON LineString', function() { | ||
1868 | - var a = new Wkt.Wkt(cases.linestring.json); | ||
1869 | - expect(a.write()).deep.equal(cases.linestring.str); | ||
1870 | - }); | ||
1871 | - | ||
1872 | - it('should write the WKT string corresponding to a GeoJSON Polygon', function() { | ||
1873 | - var a = new Wkt.Wkt(cases.polygon.json); | ||
1874 | - expect(a.write()).deep.equal(cases.polygon.str); | ||
1875 | - }); | ||
1876 | - | ||
1877 | - it('should write the WKT string corresponding to a GeoJSON Polygon with a hole', function() { | ||
1878 | - var a = new Wkt.Wkt(cases.polygon2.json); | ||
1879 | - expect(a.write()).deep.equal(cases.polygon2.str); | ||
1880 | - }); | ||
1881 | - | ||
1882 | - it('should write the WKT string corresponding to a GeoJSON MultiPolygon', function() { | ||
1883 | - var a = new Wkt.Wkt(cases.multipolygon.json); | ||
1884 | - expect(a.write()).deep.equal(cases.multipolygon.str); | ||
1885 | - }); | ||
1886 | - | ||
1887 | - it('should write the WKT string corresponding to a GeoJSON MultiPolygon with a hole', function() { | ||
1888 | - var a = new Wkt.Wkt(cases.multipolygon2.json); | ||
1889 | - expect(a.write()).deep.equal(cases.multipolygon2.str); | ||
1890 | - }); | ||
1891 | - | ||
1892 | - it('should write the WKT string corresponding to a GeoJSON MultiPoint', function() { | ||
1893 | - var a = new Wkt.Wkt(cases.multipoint.json); | ||
1894 | - expect(a.write()).deep.equal(cases.multipoint.str); | ||
1895 | - }); | ||
1896 | - | ||
1897 | - it('should write the WKT string corresponding to a GeoJSON MultiLineString', function() { | ||
1898 | - var a = new Wkt.Wkt(cases.multilinestring.json); | ||
1899 | - expect(a.write()).deep.equal(cases.multilinestring.str); | ||
1900 | - }); | ||
1901 | - | ||
1902 | - }); | ||
1903 | - | ||
1904 | - describe('GeoJSON Deconstruction (from Strings):', function() { | ||
1905 | - it('should provide support for JSON.parse() in the environment...', function() { | ||
1906 | - expect(typeof JSON).deep.equal('object'); | ||
1907 | - expect(typeof JSON.parse).deep.equal('function'); | ||
1908 | - }); | ||
1909 | - | ||
1910 | - it('should parse a GeoJSON Point string', function() { | ||
1911 | - var a = new Wkt.Wkt(cases.point.jsonStr); | ||
1912 | - expect(a.write()).deep.equal(cases.point.str); | ||
1913 | - }); | ||
1914 | - | ||
1915 | - it('should parse a GeoJSON LineString string', function() { | ||
1916 | - var a = new Wkt.Wkt(cases.linestring.jsonStr); | ||
1917 | - expect(a.write()).deep.equal(cases.linestring.str); | ||
1918 | - }); | ||
1919 | - | ||
1920 | - it('should parse a GeoJSON Polygon string', function() { | ||
1921 | - var a = new Wkt.Wkt(cases.polygon.jsonStr); | ||
1922 | - expect(a.write()).deep.equal(cases.polygon.str); | ||
1923 | - }); | ||
1924 | - | ||
1925 | - it('should parse a GeoJSON Polygon string with a hole', function() { | ||
1926 | - var a = new Wkt.Wkt(cases.polygon2.jsonStr); | ||
1927 | - expect(a.write()).deep.equal(cases.polygon2.str); | ||
1928 | - }); | ||
1929 | - | ||
1930 | - it('should parse a GeoJSON MultiPolygon string', function() { | ||
1931 | - var a = new Wkt.Wkt(cases.multipolygon.jsonStr); | ||
1932 | - expect(a.write()).deep.equal(cases.multipolygon.str); | ||
1933 | - }); | ||
1934 | - | ||
1935 | - it('should parse a GeoJSON MultiPolygon string with a hole', function() { | ||
1936 | - var a = new Wkt.Wkt(cases.multipolygon2.jsonStr); | ||
1937 | - expect(a.write()).deep.equal(cases.multipolygon2.str); | ||
1938 | - }); | ||
1939 | - | ||
1940 | - it('should parse a GeoJSON MultiPoint string', function() { | ||
1941 | - var a = new Wkt.Wkt(cases.multipoint.jsonStr); | ||
1942 | - expect(a.write()).deep.equal(cases.multipoint.str); | ||
1943 | - }); | ||
1944 | - | ||
1945 | - it('should parse a GeoJSON MultiLineString string', function() { | ||
1946 | - var a = new Wkt.Wkt(cases.multilinestring.jsonStr); | ||
1947 | - expect(a.write()).deep.equal(cases.multilinestring.str); | ||
1948 | - }); | ||
1949 | - | ||
1950 | - }); | ||
1951 | - | ||
1952 | -}); |
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +MAP | ||
2 | + FONTSET "/var/www/i3geo/symbols/fontes.txt" | ||
3 | + SYMBOLSET "/var/www/i3geo/symbols/simbolosv6.sym" | ||
4 | + LAYER | ||
5 | + CONNECTION "ses" | ||
6 | + CONNECTIONTYPE POSTGIS | ||
7 | + DATA "waygeo from (select st_transform(way,4326) AS waygeo,osm_id,highway from public.planet_osm_line) as foo using unique osm_id using srid=4326" | ||
8 | + METADATA | ||
9 | + "CLASSE" "SIM" | ||
10 | + "TEMA" "Teste" | ||
11 | + | ||
12 | + END # METADATA | ||
13 | + NAME "teste" | ||
14 | + PROCESSING "LABEL_NO_CLIP=True" | ||
15 | + PROCESSING "POLYLINE_NO_CLIP=True" | ||
16 | + STATUS DEFAULT | ||
17 | + TEMPLATE "none.htm" | ||
18 | + TILEITEM "location" | ||
19 | + TYPE LINE | ||
20 | + classitem "highway" | ||
21 | +class | ||
22 | + expression "motorway" | ||
23 | + style | ||
24 | + color 0 0 0 | ||
25 | + width 8 | ||
26 | + end | ||
27 | + style | ||
28 | + color 128 155 192 | ||
29 | + width 6 | ||
30 | + end | ||
31 | + end | ||
32 | + | ||
33 | + END # LAYER | ||
34 | +END # MAP | ||
35 | + |
testainstal/index.php
@@ -193,7 +193,6 @@ if (! function_exists("ms_GetVersion")) { | @@ -193,7 +193,6 @@ if (! function_exists("ms_GetVersion")) { | ||
193 | if (get_cfg_var("safe_mode") == 1) { | 193 | if (get_cfg_var("safe_mode") == 1) { |
194 | echo '<div class="alert alert-warning" role="alert">Problema: safe_mode no php.ini deveria estar como Off. O i3Geo não irá funcionar!!!</div>'; | 194 | echo '<div class="alert alert-warning" role="alert">Problema: safe_mode no php.ini deveria estar como Off. O i3Geo não irá funcionar!!!</div>'; |
195 | } | 195 | } |
196 | -// TODO ao fechar versao verificar esses acentos | ||
197 | echo <<<HTML | 196 | echo <<<HTML |
198 | <h3>Acentuação</h3> | 197 | <h3>Acentuação</h3> |
199 | <pre> | 198 | <pre> |
versao.php
@@ -4,10 +4,7 @@ Utilizado como um include em ms_configura.php | @@ -4,10 +4,7 @@ Utilizado como um include em ms_configura.php | ||
4 | */ | 4 | */ |
5 | /** | 5 | /** |
6 | * TODO Verificar ao fechar versao | 6 | * TODO Verificar ao fechar versao |
7 | - * v7 numero da versao esta correto? | ||
8 | - * v7 guia de instalacao esta correto? | ||
9 | - * v7 guia de migracao esta correto? | ||
10 | - * v7 gerar repositorio no SVN com o nome i3geo6 | 7 | + * numero da versao esta correto? |
11 | */ | 8 | */ |
12 | -$mensagemInicia = 'V. 7.0 beta'; | 9 | +$mensagemInicia = 'V. 8.0 alfa'; |
13 | ?> | 10 | ?> |