Граф коммитов

35 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock 1c529da03e Silence bogus test failures. 2012-12-12 21:22:54 -08:00
Jason Davies 37f64b74f2 Fix streaming polygon clipping. 2012-12-13 02:01:04 +00:00
Jason Davies 33e24962be Refactor clipping to use streams.
Work in progress: everything is treated as lines at the moment.
2012-12-12 21:33:59 +00:00
Jason Davies b1d078db1a More robust handling of polygons with empty ring(s).
This is a valid situation but won't usually happen at the moment since
we don't return empty rings when clipping.
2012-12-12 12:01:36 +00:00
Jason Davies bc06b2ec57 Refactor d3.geo.projection to be more data-driven. 2012-12-11 21:43:14 +00:00
Jason Davies 34180a7485 More accurate winding order check. 2012-12-10 23:09:14 +00:00
Jason Davies 531b443c09 Take into account clipping when computing centroids. 2012-12-05 21:30:13 +00:00
Jason Davies bf180cb8a0 Take into account clipping when computing areas.
This can be optimised later.
2012-12-05 20:35:50 +00:00
Jason Davies 25098ab0ff Add Sphere centroid and area. 2012-12-05 20:04:18 +00:00
Jason Davies 050b1c319e Define a new "Sphere" GeoJSON type.
This allows us to generate the clip outline for whole-earth projections
with arbitrary rotations.

Internally, this is interpreted as a polygon with null coordinates.
2012-12-05 18:39:57 +00:00
Jason Davies 4d268a7966 Add some test cases for small U.S. counties.
These were originally anticlockwise in examples/data/us-counties.  I
have corrected the ordering for these tests.
2012-12-05 09:14:07 -08:00
Jason Davies e6ab7219b8 Detect polygon direction using area calculation.
This fixes various problems that were occurring due to winding numbers
being tricky on a finite sphere.

This also includes some cleanup and fixes for degenerate points.
2012-12-05 09:14:07 -08:00
Jason Davies acbce53ec5 Fix antemeridian clip point ordering. 2012-12-05 09:13:51 -08:00
Jason Davies 210085d3ea Fix antemeridian degeneracy handling. 2012-12-05 09:13:13 -08:00
Jason Davies f58b5db715 Fix path.centroid for polygons with holes.
The centroid was not being subtracted for interior polygon rings
(holes), hence it was appearing too far to the right.  The winding order
is ignored.
2012-12-04 20:56:14 +00:00
Jason Davies cba8a77bad Improve Polygon clipping.
1. We no longer perform an equality check on GeoJSON polygon endpoints,
since we know that the first and last points should be equal.
2. However, there are special cases where a polygon just touches the
clip edge, generating two coincident intersection points.  Here we avoid
generating a coincident point, and continue as normal.
3. Another special case is where we have coincident intersection points
e.g. due to a self-intersecting polygon.  Here we continue calculating
the winding number as if this is a closed polygon (so we know whether to
insert a polygon around the whole clip edge).
2012-11-20 22:20:54 +00:00
Jason Davies 28fb58b635 Fix polygon clipping. 2012-11-19 13:05:43 +00:00
Mike Bostock 3297cf23e0 Collection centroids are undefined.
It's not always meaningful to define the centroid of a collection because
collections are heterogenous: they can contain points, lines, polygons, or all
these types together. The previous code ignored objects that had dimensionality
lower than the collection's maximum dimensionality; for example, ignoring lines
and points if the collection contains polygons. While this may be what you want,
this feels magical and it's simpler to just define the centroid as undefined.
I'd prefer to force the user to state what they want explicitly, say by creating
a MultiPolygon that merges together a collection's polygons.
2012-11-18 08:40:57 -08:00
Jason Davies ad30a774f0 Add another resampling test for points near poles.
This tests the fix in 091f389499.
2012-11-16 09:35:37 +00:00
Jason Davies f9f4e265f4 Add tests for longitude wrapping. 2012-11-16 09:08:46 +00:00
Jason Davies fbbbfbf239 Add failing test case for Albers artefacts. 2012-11-14 14:51:11 +00:00
Jason Davies dbd0745a8b Another fix for d3.geo.circle Polygon exteriors. 2012-11-14 14:07:33 +00:00
Jason Davies 0bb3d29539 Fix d3.geo.circle Polygon exterior insertion. 2012-11-14 13:24:16 +00:00
Jason Davies 8ac44493ce Fix resampling along antemeridian. 2012-11-14 11:50:37 +00:00
Jason Davies b04954bc9f Fix drawing of [Multi]Point geometries. 2012-10-25 18:31:12 +01:00
Jason Davies 3cf08d3df1 Add tests and fixes for d3.geo.path().centroid.
These are from #765.
2012-10-06 10:11:47 +01:00
Jason Davies d10868bb69 Rename a few variables for consistency. 2012-10-06 01:05:41 +01:00
Jason Davies 78815b6783 Reinstate d3.geo.path().centroid.
Also adds support for previously unsupported object types e.g. Points
and LineStrings.
2012-10-06 00:54:21 +01:00
Jason Davies d58bbdd6ea Fix d3.geo.path().area. 2012-10-06 00:03:53 +01:00
Mike Bostock c9cffe7a62 Fix for some redundant points on resampling.
Also restore path.area and add a few tests.
2012-10-01 22:39:17 -07:00
Mike Bostock 99c444ddaf path(null) should return null.
This frequently happens when a feature is fully clipped.
2012-09-26 21:01:42 -07:00
Mike Bostock 8f5ede349e Fix #816 - getters for projection and pointRadius. 2012-09-22 16:08:27 -07:00
Mike Bostock 0daedb2344 Harden d3_geo_type against object built-ins. 2012-02-21 08:42:37 -08:00
Mike Bostock 3081dd45ef Consolidate everything into d3.v2.js.
Rather than producing separate files for each module, the default build now
produces a single file. This should encourage better page-load performance as
the files were relatively small. Also, it's easier to deal with only one file
rather than many, especially if you're not quite sure what the dependencies are.
You may still create minimized builds, if you don't want every feature.

This commit also demotes the chart components to the examples directory, rather
than keeping them as part of the core library. As always, D3 is not a charting
library, and these were ever only intended to serve as examples.
2012-02-18 14:04:01 -08:00
Jason Davies abc6541cd5 Add d3.geo.clip for radial clipping.
This can be used with d3.geo.path.clip to clip the input coordinates of
geographical shapes using a given origin and angular radius, e.g. for
hemispherical or near-hemispherical views.  Geodesics are inserted as
necessary.

This also includes a minor bugfix and test for d3.geo.path: the last
coordinate of Polygon features was being included unnecessarily
(MultiPolygon already handled this correctly).
2011-09-12 09:27:57 +01:00