mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Added orientation parameter to "Ground Simbol" to allow rotation
This commit is contained in:
@@ -2734,6 +2734,10 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added "Renumber On Paste" option in the "Config" menu</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added orientation parameter to "Ground Simbol" to allow rotation</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Upgraded to Java 8</description>
|
||||
@@ -2742,6 +2746,10 @@
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>The third control point of resistors and similar components appears in the Spice netlist by mistake</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Hide the 3rd control point for components that do not need it (Trace, Jumper, Line)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>"Auto-Create Pads" doesn't work for ICs and similar non-stretchable components</description>
|
||||
@@ -2750,10 +2758,6 @@
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Threads on 1/4" Closed Jack were not rendered at all</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Hide the 3rd control point for components that do not need it (Trace, Jumper, Line)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Threads on 1/4" Closed Jack were not rendered at all</description>
|
||||
|
||||
@@ -21,22 +21,23 @@
|
||||
*/
|
||||
package org.diylc.components.misc;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Ground", author = "Branislav Stojkovic", category = "Schematic Symbols",
|
||||
@@ -52,8 +53,10 @@ public class GroundSymbol extends AbstractComponent<Void> {
|
||||
private Point point = new Point(0, 0);
|
||||
private Color color = COLOR;
|
||||
private Size size = SIZE;
|
||||
private GroundSymbolType type = GroundSymbolType.DEFAULT;
|
||||
private GroundSymbolType type = GroundSymbolType.DEFAULT;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
@@ -61,7 +64,20 @@ public class GroundSymbol extends AbstractComponent<Void> {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.setColor(color);
|
||||
int x = point.x;
|
||||
int y = point.y;
|
||||
int y = point.y;
|
||||
|
||||
switch (getOrientation()) {
|
||||
case _90:
|
||||
g2d.rotate(Math.PI / 2, point.x, point.y);
|
||||
break;
|
||||
case _180:
|
||||
g2d.rotate(Math.PI, point.x, point.y);
|
||||
break;
|
||||
case _270:
|
||||
g2d.rotate(Math.PI * 3 / 2, point.x, point.y);
|
||||
break;
|
||||
}
|
||||
|
||||
g2d.drawLine(x, y, x, y + sizePx / 6);
|
||||
if (type == GroundSymbolType.DEFAULT) {
|
||||
int delta = sizePx / 7;
|
||||
@@ -96,6 +112,17 @@ public class GroundSymbol extends AbstractComponent<Void> {
|
||||
|
||||
public void setType(GroundSymbolType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Orientation getOrientation() {
|
||||
if (orientation == null)
|
||||
orientation = Orientation.DEFAULT;
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(Orientation orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user