File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ App.map = (function ($, publ) {
144
144
this . setGeolocation ( ) ;
145
145
this . setGeocoding ( ) ;
146
146
this . zoomToExtent ( ) ;
147
+ this . parseHistory ( ) ;
147
148
148
149
// Control button
149
150
var maximizeCtrl = new ol . control . Button ( {
@@ -300,10 +301,36 @@ App.map = (function ($, publ) {
300
301
}
301
302
} ;
302
303
304
+ /**
305
+ * Parse page for WKT strings in history
306
+ */
307
+ publ . parseHistory = function ( ) {
308
+ $ ( 'div#history ul.details i' ) . each ( function ( idx , item ) {
309
+ var regex = new RegExp ( / \w + \s ( \( ( - ? \d + .\d + \s ? - ? \d + .\d + , ? ) + \) ) + / g) ;
310
+ var match = $ ( item ) . text ( ) . match ( regex ) ;
311
+ if ( match !== null ) {
312
+ var feature = new ol . format . WKT ( ) . readFeature (
313
+ match [ 0 ] , {
314
+ dataProjection : 'EPSG:4326' ,
315
+ featureProjection : 'EPSG:3857'
316
+ }
317
+ ) ;
318
+ var wkt = new ol . format . WKT ( ) . writeFeature (
319
+ feature , {
320
+ dataProjection : 'EPSG:4326' ,
321
+ featureProjection : 'EPSG:3857' ,
322
+ decimals : 6
323
+ }
324
+ ) ;
325
+ $ ( item ) . html ( '<a href="#" onclick="event.preventDefault();" class="wkt">' + wkt + '</a>' ) ;
326
+ }
327
+ } ) ;
328
+ } ;
329
+
303
330
/**
304
331
* Add Geolocation functionality
305
332
*/
306
- publ . setGeolocation = function ( ) {
333
+ publ . setGeolocation = function ( ) {
307
334
308
335
geolocation = new ol . Geolocation ( {
309
336
tracking : false ,
You can’t perform that action at this time.
0 commit comments