geopoints.js 691 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Renders geopoints as geo-json poly gon entities
  3. * Allows for them to clip on spheres correctly
  4. */
  5. function displayGeopoints(scope, path) {
  6. var points = [];
  7. var circle = d3.geo.circle();
  8. var degrees = 180 / Math.PI
  9. if (scope.panel.display.geopoints.enabled) {
  10. points = scope.points;
  11. }
  12. var geopoints = scope.g.selectAll(".geopoint")
  13. .data(points);
  14. geopoints.enter().append("path")
  15. .datum(function(d) {
  16. return circle.origin([d[0], d[1]]).angle(scope.panel.display.geopoints.pointSize / 6371 * degrees)();
  17. })
  18. .attr("d", path)
  19. .attr("class", "geopoint");
  20. geopoints.exit().remove();
  21. }