View Javadoc

1   package org.sat4j.sat.visu;
2   
3   import info.monitorenter.gui.chart.ITracePoint2D;
4   import info.monitorenter.gui.chart.pointpainters.APointPainter;
5   
6   import java.awt.Graphics;
7   
8   public class PointPainterPlus extends APointPainter<PointPainterPlus> {
9   
10      /**
11  	 * 
12  	 */
13      private static final long serialVersionUID = 1L;
14  
15      /**
16       * The size of the plus point in pixels
17       */
18      private int plusSize;
19  
20      /**
21       * Creates an instance with a default plus size of 4.
22       * <p>
23       */
24      public PointPainterPlus(int plusSize) {
25          this.plusSize = plusSize;
26      }
27  
28      /**
29       * Creates an instance with the given plus size.
30       * 
31       * @param plusSize
32       *            the plus size in pixel to use.
33       */
34      public PointPainterPlus() {
35          this.plusSize = 6;
36      }
37  
38      /**
39       * @see info.monitorenter.gui.chart.pointpainters.APointPainter#equals(java.lang.Object)
40       */
41      @Override
42      public boolean equals(final Object obj) {
43          if (this == obj) {
44              return true;
45          }
46          if (!super.equals(obj)) {
47              return false;
48          }
49          if (this.getClass() != obj.getClass()) {
50              return false;
51          }
52          final PointPainterPlus other = (PointPainterPlus) obj;
53          if (this.plusSize != other.plusSize) {
54              return false;
55          }
56          return true;
57      }
58  
59      /**
60       * @see info.monitorenter.gui.chart.pointpainters.APointPainter#hashCode()
61       */
62      @Override
63      public int hashCode() {
64          final int prime = 31;
65          int result = super.hashCode();
66          result = prime * result + this.plusSize;
67          return result;
68      }
69  
70      /**
71       * @see info.monitorenter.gui.chart.IPointPainter#paintPoint(int, int, int,
72       *      int, java.awt.Graphics, info.monitorenter.gui.chart.ITracePoint2D)
73       */
74      public void paintPoint(final int absoluteX, final int absoluteY,
75              final int nextX, final int nextY, final Graphics g,
76              final ITracePoint2D original) {
77          g.drawLine(absoluteX - this.plusSize / 2, absoluteY, absoluteX
78                  + this.plusSize / 2, absoluteY);
79          g.drawLine(absoluteX, absoluteY - this.plusSize / 2, absoluteX,
80                  absoluteY + this.plusSize / 2);
81      }
82  
83      /**
84       * Returns the size of the plus point in pixels
85       * <p>
86       * 
87       * @return the size of the plus point in pixels
88       */
89      public int getPlusSize() {
90          return this.plusSize;
91      }
92  
93      /**
94       * Sets the size of the plus point in pixels
95       * 
96       * @param plusSize
97       *            the size of the plus point in pixels
98       */
99      public void setPlusSize(int plusSize) {
100         this.plusSize = plusSize;
101     }
102 
103 }