View Javadoc
1   package com.github.celldynamics.quimp.plugin.protanalysis;
2   
3   import java.awt.Point;
4   
5   /**
6    * Keep coordinates of point selected by user with frame and object number.
7    * 
8    * @author p.baniukiewicz
9    *
10   */
11  class PointCoords {
12  
13    /**
14     * Convenience constructor called from {@link CustomCanvas}.
15     * 
16     * <p>Do not set frame.
17     * 
18     * @param point selected point
19     * @param cellNo cell number
20     */
21    public PointCoords(Point point, int cellNo) {
22      this.point = point;
23      this.cellNo = cellNo;
24    }
25  
26    /**
27     * Construct full coordinates: x,y,cellNo,frame.
28     * 
29     * @param point selected point
30     * @param cellNo cell number
31     * @param frame frame number
32     */
33    public PointCoords(Point point, int cellNo, int frame) {
34      this(point, cellNo);
35      this.frame = frame;
36    }
37  
38    /**
39     * Screen coordinates of point selected by user.
40     */
41    public Point point;
42    /**
43     * Frame (0-indexed).
44     */
45    public int frame = -1;
46    /**
47     * Index of cell in {@link Prot_Analysis#outlines}.
48     */
49    public int cellNo;
50  
51    /*
52     * (non-Javadoc)
53     * 
54     * @see java.lang.Object#hashCode()
55     */
56    @Override
57    public int hashCode() {
58      final int prime = 31;
59      int result = 1;
60      result = prime * result + cellNo;
61      result = prime * result + frame;
62      result = prime * result + ((point == null) ? 0 : point.hashCode());
63      return result;
64    }
65  
66    /*
67     * (non-Javadoc)
68     * 
69     * @see java.lang.Object#equals(java.lang.Object)
70     */
71    @Override
72    public boolean equals(Object obj) {
73      if (this == obj) {
74        return true;
75      }
76      if (obj == null) {
77        return false;
78      }
79      if (getClass() != obj.getClass()) {
80        return false;
81      }
82      PointCoords./../../../../com/github/celldynamics/quimp/plugin/protanalysis/PointCoords.html#PointCoords">PointCoords other = (PointCoords) obj;
83      if (cellNo != other.cellNo) {
84        return false;
85      }
86      if (frame != other.frame) {
87        return false;
88      }
89      if (point == null) {
90        if (other.point != null) {
91          return false;
92        }
93      } else if (!point.equals(other.point)) {
94        return false;
95      }
96      return true;
97    }
98  
99    /*
100    * (non-Javadoc)
101    * 
102    * @see java.lang.Object#toString()
103    */
104   @Override
105   public String toString() {
106     return "PointCoords [point=" + point + ", frame=" + frame + ", cellNo=" + cellNo + "]";
107   }
108 
109 }