Example #1
0
  @Override
  public void fillWithDimensionItem(Segment segment, DimensionItem dimensionItem) {
    StorageElementLink storageElementLink =
        ((SheetDimentionItem) dimensionItem).getStorageElementLink();
    Board board = (Board) storageElementLink.getStoreElement();
    segment.setMaterialLength(board.getLength());
    segment.setMaterialWidth(board.getWidth());

    int length =
        FacadeContext.getCutterFacade()
            .trim(dimensionItem.getDimension(), board.getBoardDef().getCutter())
            .getWidth();
    int width =
        FacadeContext.getCutterFacade()
            .trim(dimensionItem.getDimension(), board.getBoardDef().getCutter())
            .getHeight();

    if (storageElementLink.getStripsEntity() instanceof StripsEntity) {
      length -= board.getBoardDef().getReservedLength().intValue();
      width -= board.getBoardDef().getReservedLength().intValue();
    }

    segment.setLength(length);
    segment.setWidth(width);
  }
Example #2
0
 @Override
 public List<RestBoardDimension> getRestDimensions(Strips strips) {
   ArrayList<RestBoardDimension> dimensions = new ArrayList<RestBoardDimension>();
   for (Segment segment : strips.getItems()) {
     if (segment.getElements().length > 0) {
       StorageElementLink storageElementLink =
           FacadeContext.getBoardFacade().getStorageElementLinkBy(segment);
       Board board =
           storageElementLink != null
               ? (Board) storageElementLink.getStoreElement()
               : ((SheetDimentionItem) segment.getDimensionItem()).getBoard();
       dimensions.addAll(getFreeDimensions(board, segment));
     }
   }
   return dimensions;
 }
Example #3
0
 @Override
 public boolean isWhole(Segment segment) {
   DimensionItem dimensionItem = segment.getDimensionItem();
   if (dimensionItem instanceof SheetDimentionItem) {
     return ((SheetDimentionItem) dimensionItem).getBoard().isWhole();
   }
   return false;
 }
Example #4
0
 private List<RestBoardDimension> getFreeDimensions(Board board, Segment segment) {
   ArrayList<RestBoardDimension> dimensions = new ArrayList<RestBoardDimension>();
   int free = segment.getFreeLength() - segment.getPadding();
   if (free > 0) {
     RestBoardDimension dimension =
         new RestBoardDimension(
             (segment.getLevel() % 2) == 0 ? segment.getWidth() : free,
             (segment.getLevel() % 2) == 0 ? free : segment.getWidth(),
             board);
     dimensions.add(dimension);
   }
   for (Segment s : segment.getItems()) {
     dimensions.addAll(getFreeDimensions(board, s));
   }
   return dimensions;
 }