Examples of Wall


Examples of com.eteks.sweethome3d.model.Wall

         
          largerRoomPoints [i] = computeIntersection(point1, point2, point3, point4);
        }

        // Create walls joining points of largerRoomPoints
        Wall lastWall = null;
        for (int i = 0; i < largerRoomPoints.length; i++) {
          float [] point     = largerRoomPoints [i];
          float [] nextPoint = largerRoomPoints [(i + 1) % roomPoints.length];
          Wall wall = createWall(point [0], point [1], nextPoint [0], nextPoint [1], null, lastWall);
          this.newWalls.add(wall);
          lastWall = wall;
        }
        joinNewWallEndToWall(lastWall, this.newWalls.get(0), null);
      }     
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

        }
      }
    }

    private void createNextWall() {
      Wall previousWall = this.wallEndAtStart != null
          ? this.wallEndAtStart
          : this.wallStartAtStart;
      // Create a new wall with an angle equal to previous wall angle - 90�
      double previousWallAngle = Math.PI - Math.atan2(previousWall.getYStart() - previousWall.getYEnd(),
          previousWall.getXStart() - previousWall.getXEnd());
      previousWallAngle -=  Math.PI / 2;
      float previousWallSegmentDistance = previousWall.getStartPointToEndPointDistance();
      this.xLastEnd = (float)(this.xStart + previousWallSegmentDistance * Math.cos(previousWallAngle));
      this.yLastEnd = (float)(this.yStart - previousWallSegmentDistance * Math.sin(previousWallAngle));
      this.newWall = createWall(this.xStart, this.yStart,
          this.xLastEnd, this.yLastEnd, this.wallStartAtStart, previousWall);
      this.newWall.setThickness(previousWall.getThickness());         
      this.newWalls.add(this.newWall);
      this.lastWallCreationTime = System.currentTimeMillis();
      deselectAll();
    }
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

    this.home.addPieceOfFurniture(firstPiece);
    HomePieceOfFurniture secondPiece = new HomePieceOfFurniture(firstCategory.getFurniture().get(1));
    secondPiece.setAngle(15);
    this.home.addPieceOfFurniture(secondPiece);
    // Add a wall to home
    this.home.addWall(new Wall(0, 0, 100, 0, 7));
   
    PlanController planController = this.homeController.getPlanController();
    float scale = planController.getScale();
   
    // 1. Zoom in
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

    Home home = new Home();
    HomeController homeController =
        new HomeController(home, preferences, viewFactory);
   
    // 2. Add to home a wall and a piece of furniture
    home.addWall(new Wall(0, 0, 0, 1000, 10));
    HomePieceOfFurniture piece = new HomePieceOfFurniture(
        preferences.getFurnitureCatalog().getCategory(0).getPieceOfFurniture(0));
    home.addPieceOfFurniture(piece);
    piece.setX(500);
    piece.setY(500);
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

        }
      }
    });
   
    // Create 2 walls
    Wall wall1 = new Wall(0, 0, 100, 0, 0);
    Wall wall2 = new Wall(100, 0, 100, 100, 0);
    // Add them to home
    home.addWall(wall1);
    home.addWall(wall2);
    // Check they were added and that wall listener received a notification for each wall
    assertWallCollectionContains(home.getWalls(), wall1, wall2);
    assertWallCollectionContains(addedWalls, wall1, wall2);
   
    // Join end point of first wall to start point of second wall
    wall1.setWallAtEnd(wall2);
    // Check wall1 end wall is wall2 and that wall listener received 1 notification
    assertSame("Wall not joined", wall2, wall1.getWallAtEnd());
    assertWallCollectionContains(updatedWalls, wall1);

    // Join start point of second wall to end point of first wall
    updatedWalls.clear();
    wall2.setWallAtStart(wall1);
    // Check wall2 start wall is wall1 and that wall listener received 1 notification
    assertSame("Wall not joined", wall1, wall2.getWallAtStart());
    assertWallCollectionContains(updatedWalls, wall2);
   
    // Move end point of second wall
    updatedWalls.clear();
    wall2.setXEnd(60);
    wall2.setYEnd(100);
    // Check wall2 end position and that wall listener received 1 notifications
    assertEquals("Incorrect abscissa", 60f, wall2.getXEnd());
    assertEquals("Incorrect ordinate", 100f, wall2.getYEnd());
    assertWallCollectionContains(updatedWalls, wall2);

    // Move point shared by the two walls
    updatedWalls.clear();
    wall2.setXStart(60);
    wall2.setYStart(0);
    // Check wall2 start point position
    assertEquals("Incorrect abscissa", 60f, wall2.getXStart());
    assertEquals("Incorrect ordinate", 0f, wall2.getYStart());
    // Check that wall listener received 2 notifications
    assertWallCollectionContains(updatedWalls, wall2);

    updatedWalls.clear();
    wall1.setXEnd(60);
    wall1.setYEnd(0);
    // Check wall1 end point position
    assertEquals("Incorrect abscissa", 60f, wall1.getXEnd());
    assertEquals("Incorrect ordinate", 0f, wall1.getYEnd());
    // Check that wall listener received 2 notifications
    assertWallCollectionContains(updatedWalls, wall1);
   
    // Detach second wall from first wall
    updatedWalls.clear();
    wall2.setWallAtStart(null);
    // Check wall2 and wall1 are not joined and that wall listener received 2 notifications
    assertSame("Wall joined", null, wall1.getWallAtEnd());
    assertSame("Wall joined", null, wall2.getWallAtStart());
    assertWallCollectionContains(updatedWalls, wall1, wall2);
   
    // Delete second wall
    home.deleteWall(wall2);
    // Check it was removed and that wall listener received a notification
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

    Locale.setDefault(Locale.FRANCE);
    UserPreferences preferences = new DefaultUserPreferences();
    ViewFactory viewFactory = new SwingViewFactory();
    // Create a home and add a selected wall to it
    Home home = new Home();
    Wall wall1 = new Wall(0.1f, 0.2f, 100.1f, 100.2f, 7.5f);
    home.addWall(wall1);
    wall1.setLeftSideColor(10);
    wall1.setRightSideColor(20);
    home.setSelectedItems(Arrays.asList(new Wall [] {wall1}));
   
    // 2. Create a wall panel to edit the selected wall
    WallController wallController = new WallController(home, preferences, viewFactory, null, null);
    // Check values stored by wall panel components are equal to the ones set
    assertWallControllerEquals(wall1.getXStart(), wall1.getYStart(),
        wall1.getXEnd(), wall1.getYEnd(),
        (float)Point2D.distance(wall1.getXStart(), wall1.getYStart(),
            wall1.getXEnd(), wall1.getYEnd()),
        wall1.getThickness(), home.getWallHeight(), wall1.getHeightAtEnd(),
        wall1.getLeftSideColor(), wall1.getLeftSideTexture(),
        wall1.getRightSideColor(), wall1.getRightSideTexture(), wallController);   
    // 3. Modify wall right side texture with first available texture
    TextureImage firstTexture = preferences.getTexturesCatalog().getCategories().get(0).getTexture(0);
    wall1.setRightSideColor(null);
    wall1.setRightSideTexture(new HomeTexture(firstTexture));
    wallController = new WallController(home, preferences, viewFactory, null, null);
    assertWallControllerEquals(wall1.getXStart(), wall1.getYStart(),
        wall1.getXEnd(), wall1.getYEnd(),
        (float)Point2D.distance(wall1.getXStart(), wall1.getYStart(),
            wall1.getXEnd(), wall1.getYEnd()),
        wall1.getThickness(), home.getWallHeight(), wall1.getHeightAtEnd(),
        wall1.getLeftSideColor(), wall1.getLeftSideTexture(),
        null, wall1.getRightSideTexture(), wallController);
   
    // 4. Increase length in dialog
    DialogView wallView = wallController.getView();
    JSpinner distanceToEndPointSpinner =
        (JSpinner)TestUtilities.getField(wallView, "distanceToEndPointSpinner");
    distanceToEndPointSpinner.setValue((Float)distanceToEndPointSpinner.getValue() + 20f);
    // Check wall end coordinates changed accordingly
    assertTrue("Wrong X end", Math.abs(wall1.getXEnd() + 20f * (float)Math.cos(Math.PI / 4) - wallController.getXEnd()) < 1E-5);
    assertTrue("Wrong Y end", Math.abs(wall1.getYEnd() + 20f * (float)Math.sin(Math.PI / 4) - wallController.getYEnd()) < 1E-5);
   
    // 5. Add a second selected wall to home
    Wall wall2 = new Wall(0.1f, 0.3f, 200.1f, 200.2f, 5f);
    home.addWall(wall2);
    wall2.setHeight(300f);
    wall2.setLeftSideColor(10);
    wall2.setRightSideColor(50);
    home.setSelectedItems(Arrays.asList(new Wall [] {wall1, wall2}));
    // Check if wall panel edits null values if walls thickness or colors are the same
    wallController = new WallController(home, preferences, viewFactory, null, null);
    // Check values stored by furniture panel components are equal to the ones set
    assertWallControllerEquals(0.1f, null, null,
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

  }

  public static void main(String [] args) {
    // Create a selected wall in a home and display it in a wall panel
    Home home = new Home();
    Wall wall1 = new Wall(0.1f, 0.2f, 100.1f, 100.2f, 7.5f);
    home.addWall(wall1);
    wall1.setLeftSideColor(null);
    wall1.setRightSideColor(0xFFFF00);
    home.setSelectedItems(Arrays.asList(new Wall [] {wall1}));
   
    DefaultUserPreferences preferences = new DefaultUserPreferences();
    new WallController(home, preferences,
          new SwingViewFactory(), new FileContentManager(preferences), null).displayView(null);
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

    runAction(controller, HomePane.ActionType.SELECT);
    // Check two walls were created and selected
    assertEquals("Wrong wall count in home", 2, home.getWalls().size());
    assertEquals("Wrong selected items count in home", 2, home.getSelectedItems().size());
    Iterator<Wall> iterator = home.getWalls().iterator();
    Wall wall1 = iterator.next();
    Wall wall2 = iterator.next();
    // Check walls don't use texture yet
    assertNull("Wrong texture on wall 1 left side", wall1.getLeftSideTexture());
    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertNull("Wrong texture on wall 1 right side", wall1.getRightSideTexture());
    assertNull("Wrong texture on wall 2 right side", wall2.getRightSideTexture());
   
    // 3. Edit walls
    JDialog attributesDialog = showWallPanel(preferences, controller, frame, tester);
    // Retrieve WallPanel components
    WallPanel wallPanel = (WallPanel)TestUtilities.findComponent(
        attributesDialog, WallPanel.class);
    JSpinner xStartSpinner =
        (JSpinner)TestUtilities.getField(wallPanel, "xStartSpinner");
    JSpinner xEndSpinner =
        (JSpinner)TestUtilities.getField(wallPanel, "xEndSpinner");
    TextureChoiceComponent rightSideTextureComponent =
        (TextureChoiceComponent)TestUtilities.getField(wallPanel, "rightSideTextureComponent");
    // Check xStartSpinner and xEndSpinner panels aren't visible
    assertFalse("X start spinner panel is visible", xStartSpinner.getParent().isVisible());
    assertFalse("X end spinner panel is visible", xEndSpinner.getParent().isVisible());
    // Edit right side texture
    JDialog textureDialog = showTexturePanel(preferences, rightSideTextureComponent, false, attributesDialog, tester);
    JList availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    int textureCount = availableTexturesList.getModel().getSize();
    CatalogTexture defaultTexture = (CatalogTexture)availableTexturesList.getSelectedValue();
    // Import texture
    JDialog textureWizardDialog = showImportTextureWizard(preferences, frame, tester, false);   
    // Retrieve ImportedFurnitureWizardStepsPanel components
    ImportedTextureWizardStepsPanel panel = (ImportedTextureWizardStepsPanel)TestUtilities.findComponent(
        textureWizardDialog, ImportedTextureWizardStepsPanel.class);
    final JButton imageChoiceOrChangeButton = (JButton)TestUtilities.getField(panel, "imageChoiceOrChangeButton");
    final JTextField nameTextField = (JTextField)TestUtilities.getField(panel, "nameTextField");
    JComboBox categoryComboBox = (JComboBox)TestUtilities.getField(panel, "categoryComboBox");
    JSpinner widthSpinner = (JSpinner)TestUtilities.getField(panel, "widthSpinner");
    JSpinner heightSpinner = (JSpinner)TestUtilities.getField(panel, "heightSpinner");
   
    // Check current step is image
    tester.waitForIdle();
    assertStepShowing(panel, true, false);   
    WizardPane view = (WizardPane)TestUtilities.findComponent(textureWizardDialog, WizardPane.class);
    // Check wizard view next button is disabled
    final JButton nextFinishOptionButton = (JButton)TestUtilities.getField(view, "nextFinishOptionButton");
    assertFalse("Next button is enabled", nextFinishOptionButton.isEnabled());
   
    // 4. Choose tested image
    String imageChoiceOrChangeButtonText = imageChoiceOrChangeButton.getText();
    tester.invokeAndWait(new Runnable() {
        public void run() {
          imageChoiceOrChangeButton.doClick();
        }
      });
    // Wait 200 ms to let time to Java to load the image
    Thread.sleep(200);
    // Check choice button text changed
    assertFalse("Choice button text didn't change",
        imageChoiceOrChangeButtonText.equals(imageChoiceOrChangeButton.getText()));
    // Click on next button
    tester.invokeAndWait(new Runnable() {
        public void run() {
          nextFinishOptionButton.doClick();
        }
      });
    // Check current step is attributes
    assertStepShowing(panel, false, true);

    // 5. Check default furniture name is the presentation name proposed by content manager
    assertEquals("Wrong default name",
        contentManager.getPresentationName(testedImageName.toString(), ContentManager.ContentType.IMAGE),
        nameTextField.getText());
    // Check name text field has focus
    assertSame("Name text field doesn't have focus", nameTextField,
        KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());   
    // Check default category is user category 
    String userCategoryName = preferences.getLocalizedString(
        ImportedTextureWizardStepsPanel.class, "userCategory");
    assertEquals("Wrong default category", userCategoryName,
        ((TexturesCategory)categoryComboBox.getSelectedItem()).getName());
    // Rename texture 
    final String textureTestName = "#@" + System.currentTimeMillis() + "@#";
    tester.invokeAndWait(new Runnable() {
      public void run() {
        nameTextField.setText(textureTestName);   
      }
    });
    // Check next button is enabled again
    assertTrue("Next button isn't enabled", nextFinishOptionButton.isEnabled());

    // 6. Change width with a value 5 times greater
    float width = (Float)widthSpinner.getValue();
    float height = (Float)heightSpinner.getValue();
    widthSpinner.setValue(width * 5);
    // Check height is 5 times greater
    float newWidth = (Float)widthSpinner.getValue();
    float newHeight = (Float)heightSpinner.getValue();
    assertEquals("width", 5 * width, newWidth);
    assertEquals("height", 5 * height, newHeight);
   
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Click on Finish to hide dialog box in Event Dispatch Thread
          nextFinishOptionButton.doClick();
        }
      });
    assertFalse("Import texture wizard still showing", textureWizardDialog.isShowing());

    // Check the list of available textures has one more selected modifiable texture
    assertEquals("Wrong texture count in list", textureCount + 1, availableTexturesList.getModel().getSize());
    assertEquals("No selected texture in list", 1, availableTexturesList.getSelectedValues().length);
    CatalogTexture importedTexture = (CatalogTexture)availableTexturesList.getSelectedValue();
    assertNotSame("Wrong selected texture in list", defaultTexture, importedTexture);
    // Check the attributes of the new texture
    assertEquals("Wrong name", textureTestName, importedTexture.getName());
    assertEquals("Wrong category", userCategoryName, importedTexture.getCategory().getName());
    assertEquals("Wrong width", newWidth, importedTexture.getWidth());
    assertEquals("Wrong height", newHeight, importedTexture.getHeight());
    assertTrue("New texture isn't modifiable", importedTexture.isModifiable());
       
    // 7. Click on OK in texture dialog box
    doClickOnOkInDialog(textureDialog, tester);
    // Click on OK in wall dialog box
    doClickOnOkInDialog(attributesDialog, tester);   
    // Check wall attributes are modified accordingly
    assertNull("Wrong texture on wall 1 left side", wall1.getLeftSideTexture());
    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertEquals("Wrong texture on wall 1 right side", textureTestName, wall1.getRightSideTexture().getName());
    assertEquals("Wrong texture on wall 2 right side", textureTestName, wall2.getRightSideTexture().getName());
   
    // 8. Edit left side texture of first wall
    home.setSelectedItems(Arrays.asList(wall1));
    assertEquals("Wrong selected items count in home", 1, home.getSelectedItems().size());
    attributesDialog = showWallPanel(preferences, controller, frame, tester);
    // Retrieve WallPanel components
    wallPanel = (WallPanel)TestUtilities.findComponent(attributesDialog, WallPanel.class);
    xStartSpinner = (JSpinner)TestUtilities.getField(wallPanel, "xStartSpinner");
    xEndSpinner = (JSpinner)TestUtilities.getField(wallPanel, "xEndSpinner");
    TextureChoiceComponent leftSideTextureComponent =
        (TextureChoiceComponent)TestUtilities.getField(wallPanel, "leftSideTextureComponent");
    // Check xStartSpinner and xEndSpinner panels are visible
    assertTrue("X start spinner panel isn't visible", xStartSpinner.getParent().isVisible());
    assertTrue("X end spinner panel isn't visible", xEndSpinner.getParent().isVisible());
    // Edit left side texture
    textureDialog = showTexturePanel(preferences, leftSideTextureComponent, true, attributesDialog, tester);
    availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    textureCount = availableTexturesList.getModel().getSize();
    // Select imported texture
    availableTexturesList.setSelectedValue(importedTexture, true);
    // Modify texture
    textureWizardDialog = showImportTextureWizard(preferences, frame, tester, true);   
    // Retrieve ImportedFurnitureWizardStepsPanel components
    panel = (ImportedTextureWizardStepsPanel)TestUtilities.findComponent(
        textureWizardDialog, ImportedTextureWizardStepsPanel.class);
    widthSpinner = (JSpinner)TestUtilities.getField(panel, "widthSpinner");
    final JButton nextFinishOptionButton2 = (JButton)TestUtilities.getField(
        TestUtilities.findComponent(textureWizardDialog, WizardPane.class), "nextFinishOptionButton");
    tester.invokeAndWait(new Runnable() {
        public void run() {
          nextFinishOptionButton2.doClick();
        }
      });
   
    // Change width
    widthSpinner.setValue((Float)widthSpinner.getValue() * 2);
    newWidth = (Float)widthSpinner.getValue();
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Click on Finish to hide dialog box in Event Dispatch Thread
          nextFinishOptionButton2.doClick();
        }
      });
    tester.waitForIdle();
    assertFalse("Import texture wizard still showing", textureWizardDialog.isShowing());
    // Check the list of available textures has the same texture count
    // and a new selected texture
    assertEquals("Wrong texture count in list", textureCount, availableTexturesList.getModel().getSize());
    assertEquals("No selected texture in list", 1, availableTexturesList.getSelectedValues().length);
    CatalogTexture modifiedTexture = (CatalogTexture)availableTexturesList.getSelectedValue();
    assertNotSame("Wrong selected texture in list", importedTexture, modifiedTexture);
    // Check the attributes of the new texture
    assertEquals("Wrong name", textureTestName, modifiedTexture.getName());
    assertEquals("Wrong category", userCategoryName, modifiedTexture.getCategory().getName());
    assertEquals("Wrong width", newWidth, modifiedTexture.getWidth());
    assertTrue("New texture isn't modifiable", modifiedTexture.isModifiable());

    // 9. Click on OK in texture dialog box
    doClickOnOkInDialog(textureDialog, tester);
    // Click on OK in wall dialog box
    doClickOnOkInDialog(attributesDialog, tester);   
    // Check wall attributes are modified accordingly
    assertEquals("Wrong texture on wall 1 left side", newWidth, wall1.getLeftSideTexture().getWidth());
    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertEquals("Wrong texture on wall 1 right side", newWidth / 2, wall1.getRightSideTexture().getWidth());
    assertEquals("Wrong texture on wall 2 right side", newWidth / 2, wall2.getRightSideTexture().getWidth());
   
    // 10. Open wall dialog a last time to delete the modified texture
    attributesDialog = showWallPanel(preferences, controller, frame, tester);
    // Retrieve WallPanel components
    wallPanel = (WallPanel)TestUtilities.findComponent(attributesDialog, WallPanel.class);
    leftSideTextureComponent = (TextureChoiceComponent)TestUtilities.getField(wallPanel, "leftSideTextureComponent");
    // Edit left side texture
    textureDialog = showTexturePanel(preferences, leftSideTextureComponent, true, attributesDialog, tester);
    availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    textureCount = availableTexturesList.getModel().getSize();
    // Select modified texture
    availableTexturesList.setSelectedValue(modifiedTexture, true);
    final JButton deleteButton = (JButton)new BasicFinder().find(textureDialog,
        new Matcher() {
          public boolean matches(Component c) {
            return c instanceof JButton && ((JButton)c).getText().equals(preferences.getLocalizedString(
                TextureChoiceComponent.class, "deleteTextureButton.text"));
          }
        });
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Display confirm dialog box later in Event Dispatch Thread to avoid blocking test thread
          deleteButton.doClick();       
        }
      });
    tester.waitForIdle();
    // Wait for confirm dialog to be shown
    final String confirmDeleteSelectedCatalogTextureDialogTitle = preferences.getLocalizedString(
        TextureChoiceComponent.class, "confirmDeleteSelectedCatalogTexture.title");
    tester.waitForFrameShowing(new AWTHierarchy(), confirmDeleteSelectedCatalogTextureDialogTitle);
    // Check dialog box is displayed
    JDialog confirmDialog = (JDialog)new BasicFinder().find(textureDialog, 
        new Matcher() {
            public boolean matches(Component c) {
              return c instanceof JDialog && ((JDialog)c).getTitle().equals(
                  confirmDeleteSelectedCatalogTextureDialogTitle);
            }
          });
    assertTrue("Confirm dialog not showing", confirmDialog.isShowing());
    doClickOnOkInDialog(confirmDialog, tester);
    tester.waitForIdle();
    // Check the list of available textures has one less texture and no selected texture
    assertEquals("Wrong texture count in list", textureCount - 1, availableTexturesList.getModel().getSize());
    assertEquals("No selected texture in list", 0, availableTexturesList.getSelectedValues().length);
    // Check delete button is disabled
    assertFalse("Delete button isn't disabled", deleteButton.isEnabled());
    // Click on OK in texture dialog box
    doClickOnOkInDialog(textureDialog, tester);
    // Click on OK in wall dialog box
    doClickOnOkInDialog(attributesDialog, tester);   
    // Check wall attributes didn't change
    assertNotNull("Wrong texture on wall 1 left side", wall1.getLeftSideTexture());
    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertNotNull("Wrong texture on wall 1 right side", wall1.getRightSideTexture());
    assertNotNull("Wrong texture on wall 2 right side", wall2.getRightSideTexture());
  }
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

      wall.setYEnd(yStart);
      if (wall.getArcExtent() != null) {
        wall.setArcExtent(-wall.getArcExtent());
      }

      Wall wallAtStart = wall.getWallAtStart();           
      boolean joinedAtEndOfWallAtStart =
        wallAtStart != null
        && wallAtStart.getWallAtEnd() == wall;
      boolean joinedAtStartOfWallAtStart =
        wallAtStart != null
        && wallAtStart.getWallAtStart() == wall;
      Wall wallAtEnd = wall.getWallAtEnd();     
      boolean joinedAtEndOfWallAtEnd =
        wallAtEnd != null
        && wallAtEnd.getWallAtEnd() == wall;
      boolean joinedAtStartOfWallAtEnd =
        wallAtEnd != null
        && wallAtEnd.getWallAtStart() == wall;
     
      wall.setWallAtStart(wallAtEnd);
      wall.setWallAtEnd(wallAtStart);
     
      if (joinedAtEndOfWallAtStart) {
        wallAtStart.setWallAtEnd(wall);
      } else if (joinedAtStartOfWallAtStart) {
        wallAtStart.setWallAtStart(wall);
      }
     
      if (joinedAtEndOfWallAtEnd) {
        wallAtEnd.setWallAtEnd(wall);
      } else if (joinedAtStartOfWallAtEnd) {
        wallAtEnd.setWallAtStart(wall);
      }
     
      Integer rightSideColor = wall.getRightSideColor();
      HomeTexture rightSideTexture = wall.getRightSideTexture();
      float leftSideShininess = wall.getLeftSideShininess();
View Full Code Here

Examples of com.eteks.sweethome3d.model.Wall

  public void splitSelectedWall() {
    List<Selectable> selectedItems = this.home.getSelectedItems();
    List<Wall> selectedWalls = Home.getWallsSubList(selectedItems);
    if (selectedWalls.size() == 1) {
      boolean basePlanLocked = this.home.isBasePlanLocked();
      Wall splitWall = selectedWalls.get(0);
      JoinedWall splitJoinedWall = new JoinedWall(splitWall);
      float xStart = splitWall.getXStart();
      float yStart = splitWall.getYStart();
      float xEnd = splitWall.getXEnd();
      float yEnd = splitWall.getYEnd();
      float xMiddle = (xStart + xEnd) / 2;
      float yMiddle = (yStart + yEnd) / 2;

      Wall wallAtStart = splitWall.getWallAtStart();           
      boolean joinedAtEndOfWallAtStart =
        wallAtStart != null
        && wallAtStart.getWallAtEnd() == splitWall;
      boolean joinedAtStartOfWallAtStart =
        wallAtStart != null
        && wallAtStart.getWallAtStart() == splitWall;
      Wall wallAtEnd = splitWall.getWallAtEnd();     
      boolean joinedAtEndOfWallAtEnd =
        wallAtEnd != null
        && wallAtEnd.getWallAtEnd() == splitWall;
      boolean joinedAtStartOfWallAtEnd =
        wallAtEnd != null
        && wallAtEnd.getWallAtStart() == splitWall;

      // Clone new walls to copy their characteristics
      Wall firstWall = splitWall.clone();
      this.home.addWall(firstWall);
      Wall secondWall = splitWall.clone();
      this.home.addWall(secondWall);
     
      // Change split walls end and start point
      firstWall.setXEnd(xMiddle);
      firstWall.setYEnd(yMiddle);
      secondWall.setXStart(xMiddle);
      secondWall.setYStart(yMiddle);
      if (splitWall.getHeightAtEnd() != null) {
        Float heightAtMiddle = (splitWall.getHeight() + splitWall.getHeightAtEnd()) / 2;
        firstWall.setHeightAtEnd(heightAtMiddle);
        secondWall.setHeight(heightAtMiddle);
      }
           
      firstWall.setWallAtEnd(secondWall);
      secondWall.setWallAtStart(firstWall);
     
      firstWall.setWallAtStart(wallAtStart);
      if (joinedAtEndOfWallAtStart) {
        wallAtStart.setWallAtEnd(firstWall);
      } else if (joinedAtStartOfWallAtStart) {
        wallAtStart.setWallAtStart(firstWall);
      }
     
      secondWall.setWallAtEnd(wallAtEnd);
      if (joinedAtEndOfWallAtEnd) {
        wallAtEnd.setWallAtEnd(secondWall);
      } else if (joinedAtStartOfWallAtEnd) {
        wallAtEnd.setWallAtStart(secondWall);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.