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 PointPainterCross extends APointPainter<PointPainterPlus> {
9
10
11
12
13 private static final long serialVersionUID = 1L;
14
15
16
17
18 private int crossSize;
19
20 private static final int DEFAULT_SIZE = 6;
21
22
23
24
25
26 public PointPainterCross(int crossSize) {
27 this.crossSize = crossSize;
28 }
29
30
31
32
33
34
35
36 public PointPainterCross() {
37 this.crossSize = DEFAULT_SIZE;
38 }
39
40
41
42
43 @Override
44 public boolean equals(final Object obj) {
45 if (this == obj) {
46 return true;
47 }
48 if (!super.equals(obj)) {
49 return false;
50 }
51 if (this.getClass() != obj.getClass()) {
52 return false;
53 }
54 final PointPainterCross other = (PointPainterCross) obj;
55 if (this.crossSize != other.crossSize) {
56 return false;
57 }
58 return true;
59 }
60
61
62
63
64 @Override
65 public int hashCode() {
66 final int prime = 31;
67 int result = super.hashCode();
68 result = prime * result + this.crossSize;
69 return result;
70 }
71
72
73
74
75
76 public void paintPoint(final int absoluteX, final int absoluteY,
77 final int nextX, final int nextY, final Graphics g,
78 final ITracePoint2D original) {
79 g.drawLine(absoluteX - this.crossSize / 2, absoluteY - this.crossSize
80 / 2, absoluteX + this.crossSize / 2, absoluteY + this.crossSize
81 / 2);
82 g.drawLine(absoluteX - this.crossSize / 2, absoluteY + this.crossSize
83 / 2, absoluteX + this.crossSize / 2, absoluteY - this.crossSize
84 / 2);
85 }
86
87
88
89
90
91
92
93 public int getCrossSize() {
94 return this.crossSize;
95 }
96
97
98
99
100
101
102
103 public void setCrossSize(int crossSize) {
104 this.crossSize = crossSize;
105 }
106
107 }