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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Gabriele Giacone
  • Date: 2013-03-22 23:35:34 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130322233534-k9g9mz1vch0dfy4y
Tags: 4.0+dfsg-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
                        THICKNESS, HEIGHT, HEIGHT_AT_END, 
46
46
                        LEFT_SIDE_COLOR, LEFT_SIDE_TEXTURE, LEFT_SIDE_SHININESS, 
47
47
                        RIGHT_SIDE_COLOR, RIGHT_SIDE_TEXTURE, RIGHT_SIDE_SHININESS,
48
 
                        PATTERN, LEVEL}
 
48
                        PATTERN, TOP_COLOR, LEVEL}
49
49
  
50
50
  private static final long serialVersionUID = 1L;
51
51
  
67
67
  private float        rightSideShininess;
68
68
  private boolean      symmetric = true;
69
69
  private TextureImage pattern;  
 
70
  private Integer      topColor;
70
71
  private Level        level;
71
72
  
72
73
  private transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
80
81
   * @deprecated specify a height with the {@linkplain #Wall(float, float, float, float, float, float) other constructor}.
81
82
   */
82
83
  public Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness) {
 
84
    this(xStart, yStart, xEnd, yEnd, thickness, 0);
 
85
  }
 
86
  
 
87
  /**
 
88
   * Creates a wall from (<code>xStart</code>,<code>yStart</code>)
 
89
   * to (<code>xEnd</code>, <code>yEnd</code>), 
 
90
   * with given thickness and height. Pattern, left and right colors are <code>null</code>.
 
91
   */
 
92
  public Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness, float height) {
 
93
    this(xStart, yStart, xEnd, yEnd, thickness, height, null);
 
94
  }
 
95
  
 
96
  /**
 
97
   * Creates a wall from (<code>xStart</code>,<code>yStart</code>)
 
98
   * to (<code>xEnd</code>, <code>yEnd</code>), 
 
99
   * with given thickness, height and pattern. 
 
100
   * Colors are <code>null</code>.
 
101
   * @since 4.0
 
102
   */
 
103
  public Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness, float height, TextureImage pattern) {
83
104
    this.xStart = xStart;
84
105
    this.yStart = yStart;
85
106
    this.xEnd = xEnd;
86
107
    this.yEnd = yEnd;
87
108
    this.thickness = thickness;
88
 
  }
89
 
  
90
 
  /**
91
 
   * Creates a wall from (<code>xStart</code>,<code>yStart</code>)
92
 
   * to (<code>xEnd</code>, <code>yEnd</code>), 
93
 
   * with given thickness and height. Left and right colors are <code>null</code>.
94
 
   */
95
 
  public Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness, float height) {
96
 
    this(xStart, yStart, xEnd, yEnd, thickness);
97
109
    this.height = height;
 
110
    this.pattern = pattern;
98
111
  }
99
112
  
100
113
  /**
250
263
  /**
251
264
   * Returns the abscissa of the arc circle center of this wall.
252
265
   * If the wall isn't round, the return abscissa is at the middle of the wall. 
 
266
   * @since 3.0
253
267
   */
254
268
  public float getXArcCircleCenter() {
255
269
    if (this.arcExtent == null) {
262
276
  /**
263
277
   * Returns the ordinate of the arc circle center of this wall.
264
278
   * If the wall isn't round, the return ordinate is at the middle of the wall. 
 
279
   * @since 3.0
265
280
   */
266
281
  public float getYArcCircleCenter() {
267
282
    if (this.arcExtent == null) {
434
449
   */
435
450
  public void setHeightAtEnd(Float heightAtEnd) {
436
451
    if (heightAtEnd != this.heightAtEnd
437
 
        || (heightAtEnd != null && !heightAtEnd.equals(this.heightAtEnd))) {
 
452
        && (heightAtEnd == null || !heightAtEnd.equals(this.heightAtEnd))) {
438
453
      Float oldHeightAtEnd = this.heightAtEnd;
439
454
      this.heightAtEnd = heightAtEnd;
440
455
      this.propertyChangeSupport.firePropertyChange(Property.HEIGHT_AT_END.name(), 
466
481
   */
467
482
  public void setLeftSideColor(Integer leftSideColor) {
468
483
    if (leftSideColor != this.leftSideColor
469
 
        || (leftSideColor != null && !leftSideColor.equals(this.leftSideColor))) {
 
484
        && (leftSideColor == null || !leftSideColor.equals(this.leftSideColor))) {
470
485
      Integer oldLeftSideColor = this.leftSideColor;
471
486
      this.leftSideColor = leftSideColor;
472
487
      this.propertyChangeSupport.firePropertyChange(Property.LEFT_SIDE_COLOR.name(), 
488
503
   */
489
504
  public void setRightSideColor(Integer rightSideColor) {
490
505
    if (rightSideColor != this.rightSideColor
491
 
        || (rightSideColor != null && !rightSideColor.equals(this.rightSideColor))) {
 
506
        && (rightSideColor == null || !rightSideColor.equals(this.rightSideColor))) {
492
507
      Integer oldLeftSideColor = this.rightSideColor;
493
508
      this.rightSideColor = rightSideColor;
494
509
      this.propertyChangeSupport.firePropertyChange(Property.RIGHT_SIDE_COLOR.name(), 
510
525
   */
511
526
  public void setLeftSideTexture(HomeTexture leftSideTexture) {
512
527
    if (leftSideTexture != this.leftSideTexture
513
 
        || (leftSideTexture != null && !leftSideTexture.equals(this.leftSideTexture))) {
 
528
        && (leftSideTexture == null || !leftSideTexture.equals(this.leftSideTexture))) {
514
529
      HomeTexture oldLeftSideTexture = this.leftSideTexture;
515
530
      this.leftSideTexture = leftSideTexture;
516
531
      this.propertyChangeSupport.firePropertyChange(Property.LEFT_SIDE_TEXTURE.name(), 
531
546
   */
532
547
  public void setRightSideTexture(HomeTexture rightSideTexture) {
533
548
    if (rightSideTexture != this.rightSideTexture
534
 
        || (rightSideTexture != null && !rightSideTexture.equals(this.rightSideTexture))) {
 
549
        && (rightSideTexture == null || !rightSideTexture.equals(this.rightSideTexture))) {
535
550
      HomeTexture oldLeftSideTexture = this.rightSideTexture;
536
551
      this.rightSideTexture = rightSideTexture;
537
552
      this.propertyChangeSupport.firePropertyChange(Property.RIGHT_SIDE_TEXTURE.name(), 
584
599
  }
585
600
 
586
601
  /**
587
 
   * Returns the wall pattern in plan.
 
602
   * Returns the pattern of this wall in the plan.
588
603
   * @since 3.3
589
604
   */
590
605
  public TextureImage getPattern() {
592
607
  }
593
608
  
594
609
  /**
595
 
   * Sets how walls should be displayed in plan, and notifies
 
610
   * Sets the pattern of this wall in the plan, and notifies
596
611
   * listeners of this change.
597
612
   * @since 3.3 
598
613
   */
606
621
  }
607
622
 
608
623
  /**
 
624
   * Returns the color of the top of this wall in the 3D view.
 
625
   * @since 4.0
 
626
   */
 
627
  public Integer getTopColor() {
 
628
    return this.topColor;
 
629
  }
 
630
  
 
631
  /**
 
632
   * Sets the color of the top of this wall in the 3D view, and notifies
 
633
   * listeners of this change.
 
634
   * @since 4.0 
 
635
   */
 
636
  public void setTopColor(Integer topColor) {
 
637
    if (this.topColor != topColor
 
638
        && (topColor == null || !topColor.equals(this.topColor))) {
 
639
      Integer oldTopColor = this.topColor;
 
640
      this.topColor = topColor;
 
641
      this.propertyChangeSupport.firePropertyChange(Property.TOP_COLOR.name(), 
 
642
          oldTopColor, topColor);
 
643
    }
 
644
  }
 
645
 
 
646
  /**
609
647
   * Returns the level which this wall belongs to. 
610
648
   * @since 3.4
611
649
   */
902
940
        }
903
941
      } else {
904
942
        boolean sameSignum = Math.signum(alpha1) == Math.signum(alpha2);
905
 
        if ((sameSignum && (Math.abs(alpha1) > Math.abs(alpha2)   ? alpha1 / alpha2   : alpha2 / alpha1) > 1.0001)
 
943
        if ((sameSignum && (Math.abs(alpha1) > Math.abs(alpha2)   ? alpha1 / alpha2   : alpha2 / alpha1) > 1.004)
906
944
            || (!sameSignum && Math.abs(alpha1 - alpha2) > 1E-5)) {
907
945
          float beta1 = point2 [1] - alpha1 * point2 [0];
908
946
          float beta2 = point4 [1] - alpha2 * point4 [0];