The identity projection is equivalent to setting path.projection(null), except
that you can apply post-projection features such as viewport clipping.
This commit is contained in:
Mike Bostock 2013-08-05 10:44:59 -07:00
Родитель 23ee2c08a6
Коммит 84793153d5
4 изменённых файлов: 38 добавлений и 2 удалений

15
d3.js поставляемый
Просмотреть файл

@ -3932,6 +3932,21 @@ d3 = function() {
(d3.geo.gnomonic = function() {
return d3_geo_projection(d3_geo_gnomonic);
}).raw = d3_geo_gnomonic;
d3.geo.identity = function() {
var clipExtent = null;
function identity(x) {
return x;
}
identity.invert = identity;
identity.stream = identity;
identity.clipExtent = function(_) {
if (!arguments.length) return clipExtent;
clipExtent = _;
identity.stream = _ == null ? identity : d3_geo_clipView(_[0][0], _[0][1], _[1][0], _[1][1]);
return identity;
};
return identity;
};
function d3_geo_mercator(λ, φ) {
return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ];
}

4
d3.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

20
src/geo/identity.js Normal file
Просмотреть файл

@ -0,0 +1,20 @@
d3.geo.identity = function() {
var clipExtent = null;
function identity(x) {
return x;
}
identity.invert = identity;
identity.stream = identity;
identity.clipExtent = function(_) {
if (!arguments.length) return clipExtent;
clipExtent = _;
identity.stream = _ == null ? identity : d3_geo_clipView(_[0][0], _[0][1], _[1][0], _[1][1]);
return identity;
};
return identity;
};

Просмотреть файл

@ -26,6 +26,7 @@ import "conic-equal-area";
import "conic-equidistant";
import "equirectangular";
import "gnomonic";
import "identity";
import "mercator";
import "orthographic";
import "stereographic";