@Test public void getEnvelopeByWorld() { final double w = 0.1; AffineTransform tr = pane.getMapContent().getViewport().getScreenToWorld(); Point2D p = new Point2D.Double(x, y); tr.transform(p, p); Rectangle2D expected = new Rectangle2D.Double(p.getX() - w/2, p.getY() - w/2, w, w); MapMouseEvent ev = createEvent(x, y); ReferencedEnvelope actual = ev.getEnvelopeByWorld(0.1); assertRect(expected, actual); }
public ReferencedEnvelope getEnvelopeByWorld(double widthWorld) { if (widthWorld < 0) { throw new IllegalArgumentException("invalid value for widthWorld: " + widthWorld); } double halfw = widthWorld / 2; DirectPosition2D worldPos = getWorldPos(); return new ReferencedEnvelope( worldPos.x - halfw, worldPos.x + halfw, worldPos.y - halfw, worldPos.y + halfw, worldPos.getCoordinateReferenceSystem()); }
MapMouseEvent extends MouseEvent { public ReferencedEnvelope getEnvelopeByWorld(double widthWorld) { if (widthWorld < 0) { throw new IllegalArgumentException("invalid value for widthWorld: " + widthWorld); } double halfw = widthWorld / 2; DirectPosition2D worldPos = getWorldPos(); return new ReferencedEnvelope( worldPos.x - halfw, worldPos.x + halfw, worldPos.y - halfw, worldPos.y + halfw, worldPos.getCoordinateReferenceSystem()); } }
MapMouseEvent extends MouseEvent { public ReferencedEnvelope getEnvelopeByWorld(double widthWorld) { if (widthWorld < 0) { throw new IllegalArgumentException("invalid value for widthWorld: " + widthWorld); } double halfw = widthWorld / 2; DirectPosition2D worldPos = getWorldPos(); return new ReferencedEnvelope( worldPos.x - halfw, worldPos.x + halfw, worldPos.y - halfw, worldPos.y + halfw, worldPos.getCoordinateReferenceSystem()); } MapMouseEvent(MapPane pane, MouseEvent event);  MapMouseEvent(MapPane pane, MouseWheelEvent event); }
MapMouseEvent extends MouseEvent { public ReferencedEnvelope getEnvelopeByWorld(double widthWorld) { if (widthWorld < 0) { throw new IllegalArgumentException("invalid value for widthWorld: " + widthWorld); } double halfw = widthWorld / 2; DirectPosition2D worldPos = getWorldPos(); return new ReferencedEnvelope( worldPos.x - halfw, worldPos.x + halfw, worldPos.y - halfw, worldPos.y + halfw, worldPos.getCoordinateReferenceSystem()); } MapMouseEvent(MapPane pane, MouseEvent event);  MapMouseEvent(MapPane pane, MouseWheelEvent event); @Override MapPane getSource(); boolean isWheelEvent(); int getWheelAmount(); DirectPosition2D getMapPosition(); DirectPosition2D getWorldPos(); ReferencedEnvelope getEnvelopeByWorld(double widthWorld); ReferencedEnvelope getEnvelopeByPixels(double widthPixels); }
MapMouseEvent extends MouseEvent { public ReferencedEnvelope getEnvelopeByWorld(double widthWorld) { if (widthWorld < 0) { throw new IllegalArgumentException("invalid value for widthWorld: " + widthWorld); } double halfw = widthWorld / 2; DirectPosition2D worldPos = getWorldPos(); return new ReferencedEnvelope( worldPos.x - halfw, worldPos.x + halfw, worldPos.y - halfw, worldPos.y + halfw, worldPos.getCoordinateReferenceSystem()); } MapMouseEvent(MapPane pane, MouseEvent event);  MapMouseEvent(MapPane pane, MouseWheelEvent event); @Override MapPane getSource(); boolean isWheelEvent(); int getWheelAmount(); DirectPosition2D getMapPosition(); DirectPosition2D getWorldPos(); ReferencedEnvelope getEnvelopeByWorld(double widthWorld); ReferencedEnvelope getEnvelopeByPixels(double widthPixels);  }