Commit Graph

107 Commits

Author SHA1 Message Date
Vladimir Agafonkin
665e766608 simplify optimized LatLngBounds extend 2014-02-27 19:03:00 +02:00
Antoine Pultier
63e22f0ed0 Manage empty L.LatLngBounds objects 2014-02-27 19:03:00 +02:00
Antoine Pultier
39af6fb5d7 L.LatLngBounds.extend return to Math.min/max 2014-02-27 19:03:00 +02:00
Antoine Pultier
ed44604411 L.LatLngBounds.extend optimization 2014-02-27 19:03:00 +02:00
Vladimir Agafonkin
893b6fa2f0 add LatLng wrap method back 2014-02-24 17:20:47 +02:00
Vladimir Agafonkin
5e441018f8 fix true mercator regression 2014-01-03 17:37:16 +02:00
Vladimir Agafonkin
264eca8ee6 don't clamp mercator after 85, simplify projection code 2014-01-03 15:26:40 +02:00
Vladimir Agafonkin
9ce2cc5cbd use simpler distance formula (precision is good enough) 2014-01-02 16:32:57 +02:00
Vladimir Agafonkin
5923a64ec4 add Map distance method, close #1442 2014-01-02 16:13:03 +02:00
Vladimir Agafonkin
2ee5c90f02 add CRS.Earth, move Harvesine distance there 2014-01-02 15:42:14 +02:00
Vladimir Agafonkin
d662e005bb no parseFloat in LatLng, faster factory (massive speedup)
see http://jsperf.com/leaflet-parsefloat-in-latlng
2013-12-17 15:38:49 -05:00
Vladimir Agafonkin
b151ceb63f remove LatLng constants, add move maxMargin to equals arguments 2013-12-03 19:09:36 +02:00
Vladimir Agafonkin
a1828f3f6a change wrapNum signature, clean up 2013-12-02 19:18:07 +02:00
Vladimir Agafonkin
91a01a03da move Projection namespace to Projection.LonLat.js 2013-12-02 19:18:07 +02:00
Vladimir Agafonkin
53d47af746 improve comments in CRS 2013-12-02 19:18:07 +02:00
Vladimir Agafonkin
a6517dac60 add CRS unproject, close #1560 2013-12-02 19:18:07 +02:00
Vladimir Agafonkin
49af3fda5c merge spherical mercator / epsg3857 changes with some fixes
closes #2062
2013-12-02 19:18:07 +02:00
Vladimir Agafonkin
678a5cbd05 better wrapping/bounding, make projection bounds optional 2013-12-02 19:16:01 +02:00
Per Liedman
ad9449e7cf Replace getBounds() with property bounds, defaulting to normal lat/lng bounds 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
7e20997e40 remove LatLng wrap and fix wrap tests 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
e43873298c update wrapping/bounding logic to allow negative coords 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
a4fa618144 fix True Mercator & EPSG:3395 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
a03bfb753e add CRS & Map wrapLatLng, fix GridLayer bounding 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
00166b9c4f proper EPSG:4326 with 2x1 root, fixes #1207 2013-12-02 19:16:00 +02:00
Per Liedman
294a7250d0 Added tests to verify size of EPSG3857 and 4326 2013-12-02 19:16:00 +02:00
Per Liedman
6c4d607e4d Add bounds to Projection, to calculate size 2013-12-02 19:16:00 +02:00
Vladimir Agafonkin
7a3e63ea53 handle simple CRS in GridLayer 2013-12-02 19:16:00 +02:00
Vladimir Agafonkin
82e43019ee proper GridLayer wrapping/bounding 2013-12-02 19:16:00 +02:00
Calvin Metcalf
b2acd4e26d update 3857 based on 3395 2013-12-02 19:15:19 +02:00
Calvin Metcalf
87520df2e2 Spherical Radius is used in Spherical Mercator 2013-12-02 19:15:18 +02:00
Vladimir Agafonkin
e2977a1244 Merge pull request #2160 from perliedman/crs-size
Remove hardcoded world size from L.TileLayer
2013-11-06 14:03:30 -08:00
Vladimir Agafonkin
b1c5aa2e29 fix problems with #1822 merge 2013-11-06 23:34:23 +02:00
Vladimir Agafonkin
5d6641360b merge GeoJSON altitude pull with some tweaks #1822 2013-11-06 23:17:14 +02:00
perliedman
63e84693ae Fixed smart tabs 2013-11-06 21:55:33 +01:00
perliedman
8ae0e2700c Generalized 2013-11-06 21:46:17 +01:00
perliedman
b782498650 Added getBounds function to CRS 2013-09-23 09:58:42 +02:00
Seb Emonet
16f9c9a302 Accept simple objects in L.latLngBounds(). Fixes #1915. 2013-09-13 00:22:19 +02:00
Alexander Parshin
d10cff3357 Fixing wrong EPGS3395 transformation 2013-09-10 10:47:52 +04:00
Hans Kristian Flaatten
8e98e52b88 Renames L.LatLng property .altitude to .alt 2013-07-03 15:44:57 +02:00
Hans Kristian Flaatten
46885de00d Adds support for altitude and 3D GeoJSON
This commit adds a third parameter to the L.LatLon class for specifying
altitude. This is in turn stored in the `.latitude` property for the LatLng
instance. Latitude property will only be set if the latitude parameter is not
undefined, this is done in order to ensure backwards compability.

```javascript
var latlng = new L.LatLng(10, 20, 30);
console.log(latlng.altitude); // prints '30' to the console
```

Similar functionality has been added to L.GeoJSON coordsToLatLng() and
latLngToCoords() methods in order to handle import and export of 3D GeoJSON.

```javascript
var geoJSON = {
  type: 'Feature'
  ,properties: {}
  ,geometry: {
    type: 'Point'
    ,coordinates: [20, 10, 30]
  }
}
var layer = new L.GeoJSON();
layer.addData(geoJSON);
console.log(layer.getLayers()[0].getLatLng().altitude);
```

`NB` It is important to notice that no logic has been added in order to prevent
latitude and longitude to change without appropirate change in altitude – this
must be handled by the application.
2013-07-03 10:13:00 +02:00
Vladimir Agafonkin
e468704738 fix EPSG3395 zooming, close #1796 2013-06-27 09:27:25 -04:00
Vladimir Agafonkin
54befc9203 fix True Mercator projection calculations, close #1578 2013-06-24 10:42:15 -04:00
John Firebaugh
2ddcc3d4d4 Fix trailing whitespace 2013-06-01 22:21:07 -07:00
Andrii Korzh
ef17f99708 Check object when LatLngBounds extend
When LatLngBounds extend, must check the extending object, because empty marker `L.marker().getLatLng()` got `undefined` and `obj[0]` got `TypeError`
2013-05-18 13:20:37 +03:00
Vladimir Agafonkin
a0dd4a60e9 accept coordinates in form of simple objects, close #1412 2013-02-19 18:01:53 +02:00
Vladimir Agafonkin
84d537b804 fix L.latLng factory not passing null through 2013-02-05 14:26:32 +02:00
Yohan Boniface
4f59140253 Eat our own food 2013-01-28 01:09:26 +01:00
Yohan Boniface
4b5746ffbc Use getWest/South/East/North instead of getLeft/Bottom/Right/Top 2013-01-28 01:04:09 +01:00
Yohan Boniface
69b925b057 Add LatLngBounds.getLeft/getBottom/getRight/getTop 2013-01-27 12:12:02 +01:00
oslek
7dd7e4f699 Robust array type check for cross-frame support
In a multi-frame DOM environment, if setView is called with an array for
the first parameter, a subsequent call to getBounds raises "Invalid
LatLng object" exception. This is the case if the array passed to
setView was created outside the iFrame that contains the map. It causes
the array test using "instanceof" in L.latLng to fail, and
_initialTopLeftPoint to not being properly initialized.

Thank you to Juriy Zaytsev for the full explaination:
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
John Resig and Dean Edwards post comments and concur.
2013-01-14 14:04:50 -08:00