01: package net.sourceforge.squirrel_sql.plugins.graph;
02:
03: import java.awt.*;
04:
05: public class FoldingPoint {
06: private Point _unzoomedPoint;
07: private Zoomer _zoomer;
08: private Point _zoomedPointBuffer = new Point();
09:
10: public FoldingPoint(Point unZoomedPoint, Zoomer zoomer) {
11: _unzoomedPoint = unZoomedPoint;
12:
13: if (_unzoomedPoint.x < 0) {
14: _unzoomedPoint.x = 0;
15: }
16: if (_unzoomedPoint.y < 0) {
17: _unzoomedPoint.y = 0;
18: }
19:
20: _zoomer = zoomer;
21: }
22:
23: public FoldingPoint(FoldingPoint fp) {
24: _unzoomedPoint = fp._unzoomedPoint;
25: _zoomer = fp._zoomer;
26: }
27:
28: Point getZoomedPoint() {
29: if (_zoomer.isEnabled()) {
30: double zoom = _zoomer.getZoom();
31: _zoomedPointBuffer.x = (int) (_unzoomedPoint.x * zoom + 0.5);
32: _zoomedPointBuffer.y = (int) (_unzoomedPoint.y * zoom + 0.5);
33:
34: } else {
35: _zoomedPointBuffer.x = _unzoomedPoint.x;
36: _zoomedPointBuffer.y = _unzoomedPoint.y;
37: }
38: return _zoomedPointBuffer;
39: }
40:
41: public boolean equals(Object obj) {
42: FoldingPoint other = (FoldingPoint) obj;
43: return _unzoomedPoint.equals(other._unzoomedPoint);
44: }
45:
46: public int hashCode() {
47: return _unzoomedPoint.hashCode();
48: }
49:
50: public Point getUnZoomedPoint() {
51: return _unzoomedPoint;
52: }
53: }
|