Slit.java
5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
package osp;
import java.awt.geom.Point2D;
import java.util.Observable;
import jsky.coords.DMS;
import jsky.coords.HMS;
import jsky.coords.WorldCoords;
/**
* Class representing a slit on the mask.
* Slits are numbered to 0 to 54 in soft,
* to 1 to 55 in display and files.
* The 1st and 55th slits can't be affected but positioned if joined
*/
public class Slit extends Observable {
// Attributes
// -----------
/** Maximal position of the slit in arc sec*/
public double PosMax = 2.0 * 60.0;
/** Minimal position of the slit in arc sec */
public double PosMin = -2.0 * 60.0;
/** Default position of the slit *in arc sec */
public double PosDef = 0.0;
/** Maximum slit aperture in arc sec */
public double ApeMax = 30.0;
/** Minimum slit aperture in arc sec */
public double ApeMin = 0.0;
/** Default slit aperture */
public double ApeDef;
/** Coordinates of the slit */
private Point2D.Double posXY = new Point2D.Double();
/** Coordinates of the slit center */
private Point2D.Double posCenter = new Point2D.Double();
private WorldCoords centerSlitWc = new WorldCoords();
/** Slit world coordinates */
private HMS alphaSlit;
private DMS deltaSlit;
public boolean fSkyCoord=false;
/** Id of the slit */
private int id;
/** slit position from the center axe of th mask*/
private double position;
/** slit aperture */
private double aperture;
private boolean isJoined;
private int joinedReferenceSlitId;
private int affectedObject = -1;
// Constructors
// --------------
/**
* Constructs a new slit with the default position and aperture.
*
* @param i
* Id of the slit
*/
public Slit(int i) {
id = i;
position = PosDef;
aperture = ApeMin;
isJoined=false;
joinedReferenceSlitId=-1;
}
// Methods
// ---------
/**
* Notifies observers of changes.
*/
public void update() {
setChanged();
notifyObservers();
}
/**
* Returns the id of the slit.
*
* @return Number of the slit
*/
public int getId() {
return id;
}
/**
* Sets the position of the slit.
*
* @param pos
* Position of the slit.
*/
public void setPosition(double pos) {
position = pos;
}
public void setSkyPosition(HMS alpha, DMS delta)
{
alphaSlit=alpha;
deltaSlit=delta;
fSkyCoord=true;
}
// /** Return the slit center ra */
// public HMS getAlpha() {
//
// return alphaSlit;
// }
// /** Return the slit center dec */
// public DMS getDelta() {
//
// return deltaSlit;
// }
/**
* Returns the position of the slit.
*
* @return Position of the slit.
*/
public double getPosition() {
return position;
}
/**
* Changes slits aperture default value
*/
public void setSlitDefaultAperture(double defValue)
{
ApeDef=defValue;
}
/**
* Reinit the aperture of the slit
* to the default value
*/
public void setToDefaultAperture() {
aperture = ApeDef;
}
/**
* Sets the aperture of the slit.
*
* @param ape
* Aperture of the slit
*/
public void setAperture(double ape) {
aperture = ape;
}
/**
* Returns the aperture of the slit.
*
* @return Aperture of the slit
*/
public double getAperture() {
return aperture;
}
/**
* Sets the XY position of the slit in the space.
*
* @param xy
* Coordinates of the slit
*/
public void setPosXY(Point2D.Double xy) {
posXY = xy;
}
/**
* Sets the XY position of the slit in the space.
*
* @param x
* X coordinate of the slit
* @param y
* Y coordinate of the slit
*/
public void setPosXY(double x, double y) {
posXY.x = x;
posXY.y = y;
}
/**
* Returns the XY coordinates of the slit in space.
*
* @return XY position of the slit
*/
public Point2D.Double getPosXY() {
return posXY;
}
/**
* Returns the X coordinate of the slit in space.
*
* @return X position of the slit
*/
public double getPosX() {
return posXY.x;
}
/**
* Returns the Y coordinate of the slit in space.
*
* @return Y position of the slit
*/
public double getPosY() {
return posXY.y;
}
/**
* Sets the object affected to the slit. A value of -1 means there is no
* affected object.
*
* @param num
* Number of the affected object, -1 if there is no affected
* object
*/
public void setAffectedObject(int num) {
affectedObject = num;
}
/**
* Returns the number of object affected to the slit. A value of -1 means
* there is no affected object.
*
* @return Number of the affected object or -1 if there is no affected
* object
*/
public int getAffectedObject() {
return affectedObject;
}
// ADD May 2018 //
/** Position slit center */
public Point2D.Double getPosCenter() {
return posCenter;
}
public void setPosCenter(Point2D.Double posCenter) {
this.posCenter = posCenter;
}
/** WC Position slit center */
public WorldCoords getWcPosCenter() {
return centerSlitWc;
}
public void setWcPosCenter(Point2D.Double wcPosCenter) {
this.centerSlitWc = new WorldCoords(wcPosCenter.getX(),wcPosCenter.getY());
fSkyCoord=true;
}
public boolean isJoined()
{
return (isJoined);
}
/** Flag if the slit is joined **/
public void setIsJoined(boolean b) {
isJoined=b;
}
/** Set reference slit id to actual slit joined to **/
public void setJoinedRefSlit(int k) {
// TODO Auto-generated method stub
joinedReferenceSlitId=k;
}
/** Get reference slit id to actual slit joined to **/
public int getJoinedRefSlit()
{
return joinedReferenceSlitId;
}
}