~ubuntu-branches/ubuntu/utopic/sweethome3d/utopic

« back to all changes in this revision

Viewing changes to src/com/eteks/sweethome3d/model/Room.java

  • Committer: Package Import Robot
  • Author(s): Gabriele Giacone
  • Date: 2012-09-18 13:36:44 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20120918133644-smm7jyifj8ywj3rd
Tags: 3.6+dfsg-1
* New upstream release (Closes: #687996).
* B-D on default-jdk, runtime on default-jre (Closes: #684298).
* Remove gamma correction from icons (Closes: #687823).
* Fix binary xz compression.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
44
44
   */
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}
49
49
  
50
50
  private static final long serialVersionUID = 1L;
51
51
  
 
52
  private static final double TWICE_PI = 2 * Math.PI;
 
53
 
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;
189
193
  }
190
194
  
191
195
  /**
 
196
   * Returns the angle in radians used to display the room name.
 
197
   * @since 3.6 
 
198
   */
 
199
  public float getNameAngle() {
 
200
    return this.nameAngle;
 
201
  }
 
202
 
 
203
  /**
 
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.
 
206
   * @since 3.6 
 
207
   */
 
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);
 
215
    }
 
216
  }
 
217
 
 
218
  /**
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.
194
221
   */
385
412
  }
386
413
  
387
414
  /**
 
415
   * Returns the angle in radians used to display the room area.
 
416
   * @since 3.6 
 
417
   */
 
418
  public float getAreaAngle() {
 
419
    return this.areaAngle;
 
420
  }
 
421
 
 
422
  /**
 
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.
 
425
   * @since 3.6 
 
426
   */
 
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);
 
434
    }
 
435
  }
 
436
 
 
437
  /**
388
438
   * Returns the abscissa of the center point of this room.
389
439
   */
390
440
  public float getXCenter() {