Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
declare const stream: d3Geo.GeoStream;
stream.point(0, 0);
stream.point(0, 0, 0);
stream.lineStart();
stream.lineEnd();
stream.polygonStart();
stream.polygonEnd();
stream.sphere();
// geoStream(...) ========================================================
d3Geo.geoStream(samplePolygon, stream);
d3Geo.geoStream(sampleSphere, stream);
d3Geo.geoStream(sampleGeometryCollection, stream);
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
d3Geo.geoStream(sampleFeature, stream);
d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
stream.point(0, 0);
stream.point(0, 0, 0);
stream.lineStart();
stream.lineEnd();
stream.polygonStart();
stream.polygonEnd();
stream.sphere();
// geoStream(...) ========================================================
d3Geo.geoStream(samplePolygon, stream);
d3Geo.geoStream(sampleSphere, stream);
d3Geo.geoStream(sampleGeometryCollection, stream);
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
d3Geo.geoStream(sampleFeature, stream);
d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
// ----------------------------------------------------------------------
declare const stream: d3Geo.GeoStream;
stream.point(0, 0);
stream.point(0, 0, 0);
stream.lineStart();
stream.lineEnd();
stream.polygonStart();
stream.polygonEnd();
stream.sphere();
// geoStream(...) ========================================================
d3Geo.geoStream(samplePolygon, stream);
d3Geo.geoStream(sampleSphere, stream);
d3Geo.geoStream(sampleGeometryCollection, stream);
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
d3Geo.geoStream(sampleFeature, stream);
d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
stream.lineStart();
stream.lineEnd();
stream.polygonStart();
stream.polygonEnd();
stream.sphere();
// geoStream(...) ========================================================
d3Geo.geoStream(samplePolygon, stream);
d3Geo.geoStream(sampleSphere, stream);
d3Geo.geoStream(sampleGeometryCollection, stream);
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
d3Geo.geoStream(sampleFeature, stream);
d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
stream.lineStart();
stream.lineEnd();
stream.polygonStart();
stream.polygonEnd();
stream.sphere();
// geoStream(...) ========================================================
d3Geo.geoStream(samplePolygon, stream);
d3Geo.geoStream(sampleSphere, stream);
d3Geo.geoStream(sampleGeometryCollection, stream);
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
d3Geo.geoStream(sampleFeature, stream);
d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
// ----------------------------------------------------------------------
// Stream interface
// ----------------------------------------------------------------------
declare const stream: d3Geo.GeoStream;
stream.point(0, 0);
stream.point(0, 0, 0);
stream.lineStart();
stream.lineEnd();
stream.polygonStart();
stream.polygonEnd();
stream.sphere();
// geoStream(...) ========================================================
d3Geo.geoStream(samplePolygon, stream);
d3Geo.geoStream(sampleSphere, stream);
d3Geo.geoStream(sampleGeometryCollection, stream);
d3Geo.geoStream(sampleExtendedGeometryCollection, stream);
d3Geo.geoStream(sampleFeature, stream);
d3Geo.geoStream(sampleExtendedFeature1, stream);
d3Geo.geoStream(sampleExtendedFeature2, stream);
d3Geo.geoStream(sampleFeatureCollection, stream);
d3Geo.geoStream(sampleExtendedFeatureCollection, stream);
function fitExtent(projection, extent, object) {
const w = extent[1][0] - extent[0][0];
const h = extent[1][1] - extent[0][1];
const clip = projection.clipExtent && projection.clipExtent();
projection
.scale(150)
.translate([0, 0]);
if (clip != null) projection.clipExtent(null);
geoStream(object, projection.stream(boundsStream));
const b = boundsStream.result();
const k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1]));
const x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2;
const y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
if (clip != null) projection.clipExtent(clip);
return projection
.scale(k * 150)
.translate([x, y]);
}
function projectGeometry(o, stream) {
if (!o) return null;
if (o.type === "GeometryCollection") return projectGeometryCollection(o, stream);
var sink;
switch (o.type) {
case "Point": sink = sinkPoint; break;
case "MultiPoint": sink = sinkPoint; break;
case "LineString": sink = sinkLine; break;
case "MultiLineString": sink = sinkLine; break;
case "Polygon": sink = sinkPolygon; break;
case "MultiPolygon": sink = sinkPolygon; break;
case "Sphere": sink = sinkPolygon; break;
default: return null;
}
geoStream(o, stream(sink));
return sink.result();
}
rotateStream.sphere = function() { geoStream(sphere, sphereStream); };
return rotateStream;