public boolean isInZoomCenter(Point p) { Point p_intern = model.getModelGrafic().transformToIntern(this.viewId, p); Point center_intern = model.getModelGrafic().transformToIntern(this.viewId, point); // System.out.println("Marker: p : "+p_intern); // System.out.println("Marker: center: "+center_intern); int dx = p_intern.x - center_intern.x; int dy = p_intern.y - center_intern.y; return Math.sqrt(dx * dx + dy * dy) <= 10; }
public void paintComponent(Graphics g) { // System.out.println("ZoomMarker.paint"); Graphics2D g2 = (Graphics2D) g; if (this.point != null) { Point intern = model.getModelGrafic().transformToIntern(this.viewId, point); g2.setColor(Grafic.COLOR_ZOOM_MARKER); g2.setStroke(new BasicStroke(1)); if (this.shift_mode) g2.fillOval(intern.x - 10, intern.y - 10, 20, 20); else g2.drawOval(intern.x - 10, intern.y - 10, 20, 20); g2.drawLine(intern.x - 20, intern.y, intern.x + 20, intern.y); g2.drawLine(intern.x, intern.y - 20, intern.x, intern.y + 20); } }