Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sampleExtendedFeatureCollection: d3Geo.ExtendedFeatureCollection | d3Geo.ExtendedFeature> = {
type: 'FeatureCollection',
features: [
sampleExtendedFeature1,
sampleExtendedFeature2
]
};
// ----------------------------------------------------------------------
// Spherical Math
// ----------------------------------------------------------------------
// geoArea(...) =========================================================
let area: number = d3Geo.geoArea(samplePolygon);
area = d3Geo.geoArea(sampleSphere);
area = d3Geo.geoArea(sampleGeometryCollection);
area = d3Geo.geoArea(sampleExtendedGeometryCollection);
area = d3Geo.geoArea(sampleFeature);
area = d3Geo.geoArea(sampleExtendedFeature1);
area = d3Geo.geoArea(sampleExtendedFeature2);
area = d3Geo.geoArea(sampleFeatureCollection);
area = d3Geo.geoArea(sampleExtendedFeatureCollection);
// geoBounds(...) =========================================================
let bounds: [[number, number], [number, number]] = d3Geo.geoBounds(samplePolygon);
bounds = d3Geo.geoBounds(sampleSphere);
bounds = d3Geo.geoBounds(sampleGeometryCollection);
bounds = d3Geo.geoBounds(sampleExtendedGeometryCollection);
bounds = d3Geo.geoBounds(sampleFeature);
// ----------------------------------------------------------------------
// Spherical Math
// ----------------------------------------------------------------------
// geoArea(...) =========================================================
let area: number = d3Geo.geoArea(samplePolygon);
area = d3Geo.geoArea(sampleSphere);
area = d3Geo.geoArea(sampleGeometryCollection);
area = d3Geo.geoArea(sampleExtendedGeometryCollection);
area = d3Geo.geoArea(sampleFeature);
area = d3Geo.geoArea(sampleExtendedFeature1);
area = d3Geo.geoArea(sampleExtendedFeature2);
area = d3Geo.geoArea(sampleFeatureCollection);
area = d3Geo.geoArea(sampleExtendedFeatureCollection);
// geoBounds(...) =========================================================
let bounds: [[number, number], [number, number]] = d3Geo.geoBounds(samplePolygon);
bounds = d3Geo.geoBounds(sampleSphere);
bounds = d3Geo.geoBounds(sampleGeometryCollection);
bounds = d3Geo.geoBounds(sampleExtendedGeometryCollection);
bounds = d3Geo.geoBounds(sampleFeature);
bounds = d3Geo.geoBounds(sampleExtendedFeature1);
bounds = d3Geo.geoBounds(sampleExtendedFeature2);
bounds = d3Geo.geoBounds(sampleFeatureCollection);
bounds = d3Geo.geoBounds(sampleExtendedFeatureCollection);
// geoCentroid(...) =======================================================
let centroid: [number, number] = d3Geo.geoCentroid(samplePolygon);
};
// ----------------------------------------------------------------------
// Spherical Math
// ----------------------------------------------------------------------
// geoArea(...) =========================================================
let area: number = d3Geo.geoArea(samplePolygon);
area = d3Geo.geoArea(sampleSphere);
area = d3Geo.geoArea(sampleGeometryCollection);
area = d3Geo.geoArea(sampleExtendedGeometryCollection);
area = d3Geo.geoArea(sampleFeature);
area = d3Geo.geoArea(sampleExtendedFeature1);
area = d3Geo.geoArea(sampleExtendedFeature2);
area = d3Geo.geoArea(sampleFeatureCollection);
area = d3Geo.geoArea(sampleExtendedFeatureCollection);
// geoBounds(...) =========================================================
let bounds: [[number, number], [number, number]] = d3Geo.geoBounds(samplePolygon);
bounds = d3Geo.geoBounds(sampleSphere);
bounds = d3Geo.geoBounds(sampleGeometryCollection);
bounds = d3Geo.geoBounds(sampleExtendedGeometryCollection);
bounds = d3Geo.geoBounds(sampleFeature);
bounds = d3Geo.geoBounds(sampleExtendedFeature1);
bounds = d3Geo.geoBounds(sampleExtendedFeature2);
bounds = d3Geo.geoBounds(sampleFeatureCollection);
bounds = d3Geo.geoBounds(sampleExtendedFeatureCollection);
// geoCentroid(...) =======================================================
features: [
sampleExtendedFeature1,
sampleExtendedFeature2
]
};
// ----------------------------------------------------------------------
// Spherical Math
// ----------------------------------------------------------------------
// geoArea(...) =========================================================
let area: number = d3Geo.geoArea(samplePolygon);
area = d3Geo.geoArea(sampleSphere);
area = d3Geo.geoArea(sampleGeometryCollection);
area = d3Geo.geoArea(sampleExtendedGeometryCollection);
area = d3Geo.geoArea(sampleFeature);
area = d3Geo.geoArea(sampleExtendedFeature1);
area = d3Geo.geoArea(sampleExtendedFeature2);
area = d3Geo.geoArea(sampleFeatureCollection);
area = d3Geo.geoArea(sampleExtendedFeatureCollection);
// geoBounds(...) =========================================================
let bounds: [[number, number], [number, number]] = d3Geo.geoBounds(samplePolygon);
bounds = d3Geo.geoBounds(sampleSphere);
bounds = d3Geo.geoBounds(sampleGeometryCollection);
bounds = d3Geo.geoBounds(sampleExtendedGeometryCollection);
bounds = d3Geo.geoBounds(sampleFeature);
bounds = d3Geo.geoBounds(sampleExtendedFeature1);
bounds = d3Geo.geoBounds(sampleExtendedFeature2);
bounds = d3Geo.geoBounds(sampleFeatureCollection);
sampleExtendedFeature2
]
};
// ----------------------------------------------------------------------
// Spherical Math
// ----------------------------------------------------------------------
// geoArea(...) =========================================================
let area: number = d3Geo.geoArea(samplePolygon);
area = d3Geo.geoArea(sampleSphere);
area = d3Geo.geoArea(sampleGeometryCollection);
area = d3Geo.geoArea(sampleExtendedGeometryCollection);
area = d3Geo.geoArea(sampleFeature);
area = d3Geo.geoArea(sampleExtendedFeature1);
area = d3Geo.geoArea(sampleExtendedFeature2);
area = d3Geo.geoArea(sampleFeatureCollection);
area = d3Geo.geoArea(sampleExtendedFeatureCollection);
// geoBounds(...) =========================================================
let bounds: [[number, number], [number, number]] = d3Geo.geoBounds(samplePolygon);
bounds = d3Geo.geoBounds(sampleSphere);
bounds = d3Geo.geoBounds(sampleGeometryCollection);
bounds = d3Geo.geoBounds(sampleExtendedGeometryCollection);
bounds = d3Geo.geoBounds(sampleFeature);
bounds = d3Geo.geoBounds(sampleExtendedFeature1);
bounds = d3Geo.geoBounds(sampleExtendedFeature2);
bounds = d3Geo.geoBounds(sampleFeatureCollection);
bounds = d3Geo.geoBounds(sampleExtendedFeatureCollection);
var vor_poly = DT.vor_polygons[DT.indices[i]];
var geometry = {}
if (vor_poly == undefined) {
geometry.type = "Sphere";
} else {
var line = mapline(DT.vor_positions,
vor_poly.boundary.concat([vor_poly.boundary[0]])
);
// correct winding order
var b = {
type: "Polygon",
coordinates: [[pos[i], line[0], line[1], pos[i]]]
};
if (geoArea(b) > 2 * Math.PI + 1e-10) {
line = line.reverse();
}
geometry.type = "Polygon";
geometry.coordinates = [line];
}
return {
type: "Feature",
geometry: geometry,
properties: {
site: sites[i],
sitecoordinates: pos[i],
neighbours: vor_poly.edges.map(function (e) {
return e.verts.filter(function (j) {
return j !== i;
var ociFeatureCollection = Object.values(ociFeatures).map(function(feature) {
// workaround for which-polygon: only supports `properties`, not `id`
// https://github.com/mapbox/which-polygon/pull/6
feature.properties = {
id: feature.id,
area: d3_geoArea(feature) // also precompute areas
};
return feature;
});
geoArea(feature) {
return geoArea(feature);
},
geoAreaByName(name) {
geoArea(feature: ExtendedFeature) {
return geoArea(feature);
},
geoAreaByName(this: View, name: string) {
if (this.series) {
var projection = this.series.chart.projection;
projection.d3Projection.precision(0.5);
var pathGenerator = projection.d3Path;
if (this.multiPolygon) {
if (this.series) {
var feature = { type: "MultiPolygon", coordinates: this.multiPolygon };
this.polygon.path = pathGenerator(feature);
}
if (this.series.calculateVisualCenter) {
var biggestArea = 0;
var biggestPolygon = this.multiPolygon[0];
if (this.multiPolygon.length > 1) {
for (var i = 0; i < this.multiPolygon.length; i++) {
var polygon = this.multiPolygon[i];
var area = d3geo.geoArea({ type: "Polygon", coordinates: polygon });
if (area > biggestArea) {
biggestPolygon = polygon;
biggestArea = area;
}
}
}
var center = $polylabel(biggestPolygon);
this._visualLongitude = center[0];
this._visualLatitude = center[1];
}
else {
this._visualLongitude = this.longitude;
this._visualLatitude = this.latitude;
}
}
}