@@ -300,50 +300,127 @@ export var ContextMenu = L.Handler.extend({
300300
301301 _copyGCRS : function ( e ) {
302302 let mapEl = this . options . mapEl ,
303- click = this . contextMenu . _clickEvent ;
304- this . contextMenu . _copyData ( `lon :${ click . latlng . lng . toFixed ( 6 ) } , lat:${ click . latlng . lat . toFixed ( 6 ) } ` ) ;
303+ click = this . contextMenu . _clickEvent ,
304+ projection = mapEl . projection ;
305+ let data = `<map-feature zoom="${ mapEl . zoom } ">
306+ <map-featurecaption>Copied ${ projection } gcrs location</map-featurecaption>
307+ <map-properties>
308+ <h2>Copied ${ projection } gcrs location</h2>
309+ <div style="text-align:center">${ click . latlng . lng . toFixed ( 6 ) } ${ click . latlng . lat . toFixed ( 6 ) } </div>
310+ </map-properties>
311+ <map-geometry cs="gcrs">
312+ <map-point>
313+ <map-coordinates>${ click . latlng . lng . toFixed ( 6 ) } ${ click . latlng . lat . toFixed ( 6 ) } </map-coordinates>
314+ </map-point>
315+ </map-geometry>
316+ </map-feature>` ;
317+ this . contextMenu . _copyData ( data ) ;
305318 } ,
306319
307320 _copyTCRS : function ( e ) {
308321 let mapEl = this . options . mapEl ,
309322 click = this . contextMenu . _clickEvent ,
310- point = mapEl . _map . project ( click . latlng ) ;
311- this . contextMenu . _copyData ( `z:${ mapEl . zoom } , x:${ point . x } , y:${ point . y } ` ) ;
323+ point = mapEl . _map . project ( click . latlng ) ,
324+ projection = mapEl . projection ;
325+ let data = `<map-feature zoom="${ mapEl . zoom } ">
326+ <map-featurecaption>Copied ${ projection } tcrs location</map-featurecaption>
327+ <map-properties>
328+ <h2>Copied ${ projection } tcrs location</h2>
329+ <div style="text-align:center">${ point . x } ${ point . y } </div>
330+ </map-properties>
331+ <map-geometry cs="tcrs">
332+ <map-point>
333+ <map-coordinates>${ point . x } ${ point . y } </map-coordinates>
334+ </map-point>
335+ </map-geometry>
336+ </map-feature>` ;
337+ this . contextMenu . _copyData ( data ) ;
312338 } ,
313339
314340 _copyTileMatrix : function ( e ) {
315341 let mapEl = this . options . mapEl ,
316342 click = this . contextMenu . _clickEvent ,
317343 point = mapEl . _map . project ( click . latlng ) ,
318- tileSize = mapEl . _map . options . crs . options . crs . tile . bounds . max . x ;
319- this . contextMenu . _copyData ( `z:${ mapEl . zoom } , column:${ Math . trunc ( point . x / tileSize ) } , row:${ Math . trunc ( point . y / tileSize ) } ` ) ;
344+ tileSize = mapEl . _map . options . crs . options . crs . tile . bounds . max . x ,
345+ projection = mapEl . projection ;
346+ let data = `<map-feature zoom="${ mapEl . zoom } ">
347+ <map-featurecaption>Copied ${ projection } tilematrix location</map-featurecaption>
348+ <map-properties>
349+ <h2>Copied ${ projection } tilematrix location</h2>
350+ <div style="text-align:center">${ Math . trunc ( point . x / tileSize ) } ${ Math . trunc ( point . y / tileSize ) } </div>
351+ </map-properties>
352+ <map-geometry cs="tilematrix">
353+ <map-point>
354+ <map-coordinates>${ Math . trunc ( point . x / tileSize ) } ${ Math . trunc ( point . y / tileSize ) } </map-coordinates>
355+ </map-point>
356+ </map-geometry>
357+ </map-feature>` ;
358+ this . contextMenu . _copyData ( data ) ;
320359 } ,
321360
322361 _copyPCRS : function ( e ) {
323362 let mapEl = this . options . mapEl ,
324363 click = this . contextMenu . _clickEvent ,
325364 point = mapEl . _map . project ( click . latlng ) ,
326365 scale = mapEl . _map . options . crs . scale ( + mapEl . zoom ) ,
327- pcrs = mapEl . _map . options . crs . transformation . untransform ( point , scale ) ;
328- this . contextMenu . _copyData ( `easting:${ Math . round ( pcrs . x ) } , northing:${ Math . round ( pcrs . y ) } ` ) ;
366+ pcrs = mapEl . _map . options . crs . transformation . untransform ( point , scale ) ,
367+ projection = mapEl . projection ;
368+ let data = `<map-feature zoom="${ mapEl . zoom } ">
369+ <map-featurecaption>Copied ${ projection } pcrs location</map-featurecaption>
370+ <map-properties>
371+ <h2>Copied ${ projection } pcrs location</h2>
372+ <div style="text-align:center">${ Math . round ( pcrs . x ) } ${ Math . round ( pcrs . y ) } </div>
373+ </map-properties>
374+ <map-geometry cs="pcrs">
375+ <map-point>
376+ <map-coordinates>${ Math . round ( pcrs . x ) } ${ Math . round ( pcrs . y ) } </map-coordinates>
377+ </map-point>
378+ </map-geometry>
379+ </map-feature>` ;
380+ this . contextMenu . _copyData ( data ) ;
329381 } ,
330382
331383 _copyTile : function ( e ) {
332384 let mapEl = this . options . mapEl ,
333385 click = this . contextMenu . _clickEvent ,
334386 point = mapEl . _map . options . crs . project ( click . latlng ) ,
335387 tileSize = mapEl . _map . options . crs . options . crs . tile . bounds . max . x ,
336- pointX = point . x % tileSize , pointY = point . y % tileSize ;
388+ pointX = point . x % tileSize , pointY = point . y % tileSize ,
389+ projection = mapEl . projection ;
337390 if ( pointX < 0 ) pointX += tileSize ;
338391 if ( pointY < 0 ) pointY += tileSize ;
339-
340- this . contextMenu . _copyData ( `z:${ mapEl . zoom } , i:${ Math . trunc ( pointX ) } , j:${ Math . trunc ( pointY ) } ` ) ;
392+ let data = `<map-feature zoom="${ mapEl . zoom } ">
393+ <map-featurecaption>Copied ${ projection } tile location</map-featurecaption>
394+ <map-properties>
395+ <h2>Copied ${ projection } tile location</h2>
396+ <div style="text-align:center">${ Math . trunc ( pointX ) } ${ Math . trunc ( pointY ) } </div>
397+ </map-properties>
398+ <map-geometry cs="tile">
399+ <map-point>
400+ <map-coordinates>${ Math . trunc ( pointX ) } ${ Math . trunc ( pointY ) } </map-coordinates>
401+ </map-point>
402+ </map-geometry>
403+ </map-feature>` ;
404+ this . contextMenu . _copyData ( data ) ;
341405 } ,
342406
343407 _copyMap : function ( e ) {
344408 let mapEl = this . options . mapEl ,
345- click = this . contextMenu . _clickEvent ;
346- this . contextMenu . _copyData ( `z:${ mapEl . zoom } , i:${ Math . trunc ( click . containerPoint . x ) } , j:${ Math . trunc ( click . containerPoint . y ) } ` ) ;
409+ click = this . contextMenu . _clickEvent ,
410+ projection = mapEl . projection ;
411+ let data = `<map-feature zoom="${ mapEl . zoom } ">
412+ <map-featurecaption>Copied ${ projection } map location</map-featurecaption>
413+ <map-properties>
414+ <h2>Copied ${ projection } map location</h2>
415+ <div style="text-align:center">${ Math . trunc ( click . containerPoint . x ) } ${ Math . trunc ( click . containerPoint . y ) } </div>
416+ </map-properties>
417+ <map-geometry cs="map">
418+ <map-point>
419+ <map-coordinates>${ Math . trunc ( click . containerPoint . x ) } ${ Math . trunc ( click . containerPoint . y ) } </map-coordinates>
420+ </map-point>
421+ </map-geometry>
422+ </map-feature>` ;
423+ this . contextMenu . _copyData ( data ) ;
347424 } ,
348425
349426 _copyAllCoords : function ( e ) {
0 commit comments