示例#1
0
  public static Point2D latLongToPixel(
      final Dimension2D MAP_DIMENSION,
      final Point2D UPPER_LEFT,
      final Point2D LOWER_RIGHT,
      final Point2D LOCATION) {
    final double LATITUDE = LOCATION.getX();
    final double LONGITUDE = LOCATION.getY();
    final double MAP_WIDTH = MAP_DIMENSION.getWidth();
    final double MAP_HEIGHT = MAP_DIMENSION.getHeight();

    final double WORLD_MAP_WIDTH =
        ((MAP_WIDTH / (LOWER_RIGHT.getY() - UPPER_LEFT.getY())) * 360) / (2 * Math.PI);
    final double MAP_OFFSET_Y =
        (WORLD_MAP_WIDTH
            / 2
            * Math.log10(
                (1 + Math.sin(Math.toRadians(LOWER_RIGHT.getX())))
                    / (1 - Math.sin(Math.toRadians(LOWER_RIGHT.getX())))));

    final double X =
        (LONGITUDE - UPPER_LEFT.getY()) * (MAP_WIDTH / (LOWER_RIGHT.getY() - UPPER_LEFT.getY()));
    final double Y =
        MAP_HEIGHT
            - ((WORLD_MAP_WIDTH
                    / 2
                    * Math.log10(
                        (1 + Math.sin(Math.toRadians(LATITUDE)))
                            / (1 - Math.sin(Math.toRadians(LATITUDE)))))
                - MAP_OFFSET_Y);

    return new Point2D(X, Y);
  }
示例#2
0
  static enum ShapeType {
    RECTANGLE(gc -> gc.fillRect(0, 0, CIRCLE_RADIUS, CIRCLE_RADIUS)),
    CIRCLE(gc -> gc.fillOval(0, 0, CIRCLE_RADIUS, CIRCLE_RADIUS)),
    ELLIPSE(
        gc ->
            gc.fillOval(
                ELLIPSE_CENTER.getX(),
                ELLIPSE_CENTER.getY(),
                ELLIPSE_RADIUS.getWidth(),
                ELLIPSE_RADIUS.getHeight()));

    ShapeType(Consumer<GraphicsContext> drawAlgorithm) {
      this.drawAlgorithm = drawAlgorithm;
    }

    public void drawWith(GraphicsContext gc) {
      drawAlgorithm.accept(gc);
    }

    public void clearAndDrawWith(GraphicsContext gc) {
      gc.clearRect(0, 0, CIRCLE_RADIUS, CIRCLE_RADIUS);
      gc.setFill(Color.TAN);
      drawAlgorithm.accept(gc);
    }

    private Consumer<GraphicsContext> drawAlgorithm;
  }
示例#3
0
  @Override
  public void start(Stage stage) {
    Scene scene = new Scene(pane, SIZE.getWidth(), SIZE.getHeight());

    stage.setTitle("HeatMap Viewer");
    stage.setScene(scene);
    stage.show();
  }
示例#4
0
 /**
  * Creates a {@link Bounds} object whose top-left corner = 0 and whose width & height = {code
  * dimension.getWidth()} and {@code dimension.getHeight()}, respectively.
  */
 public static Bounds bounds(Dimension2D dimension) {
   return bounds(0, 0, dimension.getWidth(), dimension.getHeight());
 }
 public String getAsText() {
   if (null == getValue()) return null;
   Dimension2D dimension = (Dimension2D) getValue();
   return dimension.getWidth() + ", " + dimension.getHeight();
 }