Commit Graph

155 Commits

Author SHA1 Message Date
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
Vladimir Agafonkin
b9727d9190 made up my mind about comment format, add some more comments 2012-12-20 12:37:40 +02:00
Vladimir Agafonkin
b0e5c817a9 more comments and cleanup 2012-12-19 18:47:28 +02:00
Vladimir Agafonkin
d4432882ba use lightweight classes for LatLngBounds and Bounds 2012-12-19 18:46:44 +02:00
Vladimir Agafonkin
b4770906b3 tweak simple projection, add debug file 2012-12-11 20:18:54 +02:00
Vladimir Agafonkin
df03016f0c fix infinite recursion in latLngBounds factory, close #933 2012-12-11 17:03:33 +02:00
Vladimir Agafonkin
f5cfab73a1 remove LatLng coords wrapping/clamping, add explicit LatLng wrap method 2012-12-11 15:02:47 +02:00
Vladimir Agafonkin
9770054240 update build 2012-11-13 16:50:00 +02:00
Pascal Borreli
9546599520 Fixed typos 2012-11-09 23:15:48 +00:00
Vladimir Agafonkin
dbd4da6255 add shortcuts for extend, bind, stamp and setOptions 2012-11-07 20:30:56 +02:00
Vladimir Agafonkin
2b225cc3a8 more whitespace fixes 2012-11-07 18:46:59 +02:00
Vladimir Agafonkin
fe73b355c4 precision argument for LatLng toString 2012-10-15 11:39:46 +03:00
Dominik Moritz
f8d6e7052e Implemented isValid() function for Bounds and LatLngBounds. Fixes issue #966. Added specification. 2012-09-11 12:43:16 +01:00
Vladimir Agafonkin
3e24ed5400 more work on simplified api 2012-07-05 14:45:06 +03:00
Vladimir Agafonkin
0d6749a3ac initial API simplification 2012-07-03 17:06:44 +03:00
mourner
76b0a1de5a get rid of "unbounded" stuff (unprojection should always be unbounded) 2012-06-22 18:24:08 +03:00
mourner
9081e9a00c Merge branch 'master' of github.com:CloudMade/Leaflet 2012-03-07 00:08:17 +02:00
mourner
e5f934e97f more global refactoring 2012-03-04 00:42:50 +02:00
Jason Sanford
d86278571d LatLngBounds.extend(otherLatLngBounds) seems to be working. Addresses #517. 2012-03-03 08:39:18 -07:00
mourner
b90c2f551f Clean up LatLngBounds#pad, update changelog 2012-02-16 13:09:48 +02:00
jacobtoye
b817093da8 Added method to pad a LatLngBounds by a %. 2012-02-16 10:37:45 +13:00
mourner
30f1c6af9e Merged #488 fix from stable, closed #488, allowed smart tabs 2012-02-15 11:03:39 +02:00
Jason Sanford
22e2fba84b Adding "equals" method to LatLngBounds using the preferred LatLng.equals method. Much cleaner. 2012-02-14 09:29:29 -07:00
mourner
3c2df2ee61 Clean up harvesine formula, update changelog 2012-02-03 12:17:11 +02:00
Morten Ditlevsen
86badfcefa Haversine distance formula for getting distance (in meters) between two LatLngs 2012-02-03 08:43:59 +01:00
Alex Graul
57f44bc423 fix issue with 180 longs being clamped to -180 2011-12-21 13:22:07 +00:00
mourner
cf8e0ca50e Fixed map.getBounds on a date line cross issue, closed #295 2011-12-16 14:04:45 +02:00
mourner
e5242cec29 Fix LatLngBounds intersects 2011-12-13 17:12:33 +02:00
mourner
12d3dc5e71 Merge Elliptical Mercator fix by @Savvkin 2011-12-13 16:23:22 +02:00
mourner
6f8698b93d Added LatLngBounds intersects method, closed #350 2011-12-13 16:01:04 +02:00
mourner
c509c55f20 more whitespace fixes 2011-12-10 13:48:45 +02:00
mourner
a9720fcb43 Final jshinting without remorse 2011-12-09 16:51:31 +02:00
mourner
b03f6eff07 Some really heavy jshinting and whitespace fixes 2011-12-09 16:35:15 +02:00
Savva
f54a55858b Fix for Elliptical Mercator projection (y coord corresponds to minor earth radius) 2011-11-02 21:38:12 +04:00
Mourner
c450dfdbf9 cleanup LatLngBounds toBBoxString 2011-08-31 15:02:27 +03:00
Jason Sanford
2fad6c1bc0 Adding "toBBoxString" method to LatLngBounds. I'm following the OpenSearch Geo spec which is different than what was originally request in #216. 2011-08-22 09:29:54 -06:00
Mourner
6eb9e8fe53 sanitize LatLng arguments, closes #136 2011-06-20 13:50:40 +03:00
Mourner
94a15edef9 cleanup 2011-06-01 15:07:48 +03:00
H. Westphal
911b46c6fc Allow creation of empty L.LatLngBounds 2011-06-01 10:55:05 +02:00
Mourner
40207bdbef fix whitespace 2011-05-31 13:07:43 +03:00
Mourner
cfdaebb299 forgot to add several source files 2011-05-31 12:37:07 +03:00
Mourner
e7410e6e03 improve projections support, add EPSG:3395 (real mercator) 2011-05-31 12:36:05 +03:00
mourner
c0662f62d6 fix accidental global variable 2011-05-31 00:43:57 +03:00
mourner
876bb4f69d finished projections improvement 2011-05-31 00:37:48 +03:00
Mourner
cf74d0eb18 started work on projections 2011-05-30 19:44:40 +03:00
Mourner
87eee7fbcb LatLngBounds#contains(LatLng), Bounds#contains(Point), fixes #76 2011-05-26 11:56:52 +03:00
Mourner
c6e878a997 tiny mercator refactoring 2011-03-28 15:56:20 +03:00
mourner
38f25834a4 larger route example, small optimizations 2011-02-27 23:56:06 +02:00
Mourner
d011038bf7 initial vector support, huge commit! 2011-02-25 19:01:29 +02:00
Mourner
a7d362e1e4 LatLng todo 2010-09-28 15:46:12 +03:00
mourner
d1f1744ca3 jslinted 2010-09-27 18:34:56 +03:00
mourner
e9c1c0f685 added latLngToLayerPoint; added overlayPane; converted LatLngBounds sw/ne properties to methods. 2010-09-24 15:47:22 +03:00
mourner
f9f8b81195 toString 2010-09-21 15:57:37 +03:00