mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Added ability control if the board underside display should render as transparent or not
This commit is contained in:
@@ -8,9 +8,11 @@ public interface IBoard {
|
||||
|
||||
Rectangle2D getBoardRectangle();
|
||||
|
||||
BoardUndersideDisplay getBoardUndersideDisplay();
|
||||
BoardUndersideDisplay getUndersideDisplay();
|
||||
|
||||
Size getUndersideOffset();
|
||||
|
||||
Boolean getUndersideTransparency();
|
||||
|
||||
boolean shouldExportToGerber();
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class DrawingManager {
|
||||
Map<IBoard, List<IDIYComponent<?>>> boardMap = project.getComponents().stream()
|
||||
.filter(IBoard.class::isInstance)
|
||||
.map(IBoard.class::cast)
|
||||
.filter(b -> b.getBoardUndersideDisplay() != BoardUndersideDisplay.NONE)
|
||||
.filter(b -> b.getUndersideDisplay() != BoardUndersideDisplay.NONE)
|
||||
.collect(Collectors.toMap(x -> x, x -> new ArrayList<IDIYComponent<?>>()));
|
||||
Map<IDIYComponent<?>, Set<IBoard>> componentBoardMap = new HashMap<IDIYComponent<?>, Set<IBoard>>();
|
||||
|
||||
@@ -524,7 +524,7 @@ public class DrawingManager {
|
||||
IDIYComponent<?> clonedComponent = component.clone();
|
||||
int direction = 0;
|
||||
Point2D pivotPoint = new Point2D.Double();
|
||||
switch (board.getBoardUndersideDisplay()) {
|
||||
switch (board.getUndersideDisplay()) {
|
||||
case ABOVE:
|
||||
direction = IComponentTransformer.VERTICAL;
|
||||
pivotPoint.setLocation(boardRectangle.getMinX(), boardRectangle.getMinY() - offset / 2);
|
||||
@@ -543,7 +543,7 @@ public class DrawingManager {
|
||||
break;
|
||||
}
|
||||
componentType.getTransformer().mirror(clonedComponent, pivotPoint, direction);
|
||||
if (AbstractTransparentComponent.class.isInstance(clonedComponent)) {
|
||||
if (board.getUndersideTransparency() && AbstractTransparentComponent.class.isInstance(clonedComponent)) {
|
||||
AbstractTransparentComponent<?> transparentComponent = (AbstractTransparentComponent<?>) clonedComponent;
|
||||
transparentComponent.setAlpha(MIRROR_ALPHA);
|
||||
}
|
||||
|
||||
@@ -337,6 +337,10 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added a 'Save' button to all analysis screens which saves results of a circuit analysis to an HTML file</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added ability control if the board underside display should render as transparent or not</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Moved 'Analyze' functions from 'File' menu to their own menu for faster access</description>
|
||||
|
||||
@@ -79,6 +79,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
|
||||
protected BoardUndersideDisplay boardUndersideDisplay = BoardUndersideDisplay.NONE;
|
||||
protected Size undersideOffset = DEFAULT_UNDERSIDE_OFFSET;
|
||||
private Boolean undersideTransparency = true;
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
@@ -372,14 +373,14 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
|
||||
@EditableProperty(name = "Underside Display")
|
||||
@Override
|
||||
public BoardUndersideDisplay getBoardUndersideDisplay() {
|
||||
public BoardUndersideDisplay getUndersideDisplay() {
|
||||
if (this.boardUndersideDisplay == null) {
|
||||
this.boardUndersideDisplay = BoardUndersideDisplay.NONE;
|
||||
}
|
||||
return this.boardUndersideDisplay;
|
||||
}
|
||||
|
||||
public void setBoardUndersideDisplay(BoardUndersideDisplay boardUndersideDisplay) {
|
||||
public void setUndersideDisplay(BoardUndersideDisplay boardUndersideDisplay) {
|
||||
this.boardUndersideDisplay = boardUndersideDisplay;
|
||||
}
|
||||
|
||||
@@ -396,6 +397,19 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
this.undersideOffset = undersideOffset;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Underside Transparency")
|
||||
@Override
|
||||
public Boolean getUndersideTransparency() {
|
||||
if (undersideTransparency == null) {
|
||||
undersideTransparency = true;
|
||||
}
|
||||
return undersideTransparency;
|
||||
}
|
||||
|
||||
public void setUndersideTransparency(Boolean undersideTransparency) {
|
||||
this.undersideTransparency = undersideTransparency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getBoardRectangle() {
|
||||
Point2D finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Reference in New Issue
Block a user