42
42
* The properties of a room that may change. <code>PropertyChangeListener</code>s added
43
43
* to a room will be notified under a property name equal to the string value of one these properties.
45
public enum Property {NAME, NAME_X_OFFSET, NAME_Y_OFFSET, NAME_STYLE,
46
POINTS, AREA_VISIBLE, AREA_X_OFFSET, AREA_Y_OFFSET, AREA_STYLE,
45
public enum Property {NAME, NAME_X_OFFSET, NAME_Y_OFFSET, NAME_STYLE, NAME_ANGLE,
46
POINTS, AREA_VISIBLE, AREA_X_OFFSET, AREA_Y_OFFSET, AREA_STYLE, AREA_ANGLE,
47
47
FLOOR_COLOR, FLOOR_TEXTURE, FLOOR_VISIBLE, FLOOR_SHININESS,
48
48
CEILING_COLOR, CEILING_TEXTURE, CEILING_VISIBLE, CEILING_SHININESS, LEVEL}
50
50
private static final long serialVersionUID = 1L;
52
private static final double TWICE_PI = 2 * Math.PI;
52
54
private String name;
53
55
private float nameXOffset;
54
56
private float nameYOffset;
55
57
private TextStyle nameStyle;
58
private float nameAngle;
56
59
private float [][] points;
57
60
private boolean areaVisible;
58
61
private float areaXOffset;
59
62
private float areaYOffset;
60
63
private TextStyle areaStyle;
64
private float areaAngle;
61
65
private boolean floorVisible;
62
66
private Integer floorColor;
63
67
private HomeTexture floorTexture;
196
* Returns the angle in radians used to display the room name.
199
public float getNameAngle() {
200
return this.nameAngle;
204
* Sets the angle in radians used to display the room name. Once this piece is updated,
205
* listeners added to this piece will receive a change notification.
208
public void setNameAngle(float nameAngle) {
209
// Ensure angle is always positive and between 0 and 2 PI
210
nameAngle = (float)((nameAngle % TWICE_PI + TWICE_PI) % TWICE_PI);
211
if (nameAngle != this.nameAngle) {
212
float oldNameAngle = this.nameAngle;
213
this.nameAngle = nameAngle;
214
this.propertyChangeSupport.firePropertyChange(Property.NAME_ANGLE.name(), oldNameAngle, nameAngle);
192
219
* Returns the points of the polygon matching this room.
193
220
* @return an array of the (x,y) coordinates of the room points.
415
* Returns the angle in radians used to display the room area.
418
public float getAreaAngle() {
419
return this.areaAngle;
423
* Sets the angle in radians used to display the room area. Once this piece is updated,
424
* listeners added to this piece will receive a change notification.
427
public void setAreaAngle(float areaAngle) {
428
// Ensure angle is always positive and between 0 and 2 PI
429
areaAngle = (float)((areaAngle % TWICE_PI + TWICE_PI) % TWICE_PI);
430
if (areaAngle != this.areaAngle) {
431
float oldAreaAngle = this.areaAngle;
432
this.areaAngle = areaAngle;
433
this.propertyChangeSupport.firePropertyChange(Property.AREA_ANGLE.name(), oldAreaAngle, areaAngle);
388
438
* Returns the abscissa of the center point of this room.
390
440
public float getXCenter() {