mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-10-12 01:45:18 +02:00
Kleinere Verbesserungen und Formatierungen
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package schule.ngb.zm.shapes;
|
package schule.ngb.zm.shapes;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import schule.ngb.zm.Options;
|
import schule.ngb.zm.Options;
|
||||||
import schule.ngb.zm.Vector;
|
import schule.ngb.zm.Vector;
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ public class Arrow extends Line {
|
|||||||
*
|
*
|
||||||
* @param vector
|
* @param vector
|
||||||
*/
|
*/
|
||||||
public Arrow( @NotNull Vector vector ) {
|
public Arrow( Vector vector ) {
|
||||||
this(0, 0, vector.x, vector.y);
|
this(0, 0, vector.x, vector.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ public class Arrow extends Line {
|
|||||||
* @param vector1
|
* @param vector1
|
||||||
* @param vector2
|
* @param vector2
|
||||||
*/
|
*/
|
||||||
public Arrow( @NotNull Vector vector1, @NotNull Vector vector2 ) {
|
public Arrow( Vector vector1, Vector vector2 ) {
|
||||||
this(vector1.x, vector1.y, vector2.x, vector2.y);
|
this(vector1.x, vector1.y, vector2.x, vector2.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ public class Arrow extends Line {
|
|||||||
* @param y
|
* @param y
|
||||||
* @param vector
|
* @param vector
|
||||||
*/
|
*/
|
||||||
public Arrow( double x, double y, @NotNull Vector vector ) {
|
public Arrow( double x, double y, Vector vector ) {
|
||||||
this(x, y, x + vector.x, y + vector.y);
|
this(x, y, x + vector.x, y + vector.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ public class Arrow extends Line {
|
|||||||
*
|
*
|
||||||
* @param line
|
* @param line
|
||||||
*/
|
*/
|
||||||
public Arrow( @NotNull Line line ) {
|
public Arrow( Line line ) {
|
||||||
this(line.x, line.y, line.x2, line.y2);
|
this(line.x, line.y, line.x2, line.y2);
|
||||||
this.copyFrom(line);
|
this.copyFrom(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package schule.ngb.zm.shapes;
|
package schule.ngb.zm.shapes;
|
||||||
|
|
||||||
|
import schule.ngb.zm.Drawable;
|
||||||
import schule.ngb.zm.Options;
|
import schule.ngb.zm.Options;
|
||||||
|
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
|
||||||
public class Circle extends Shape {
|
public class Circle extends Shape implements Drawable {
|
||||||
|
|
||||||
protected double radius;
|
protected double radius;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package schule.ngb.zm.shapes;
|
package schule.ngb.zm.shapes;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.awt.geom.Path2D;
|
import java.awt.geom.Path2D;
|
||||||
|
|
||||||
public class CustomShape extends Shape {
|
public class CustomShape extends Shape {
|
||||||
@@ -15,7 +13,7 @@ public class CustomShape extends Shape {
|
|||||||
path = new Path2D.Double();
|
path = new Path2D.Double();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomShape( @NotNull CustomShape custom ) {
|
public CustomShape( CustomShape custom ) {
|
||||||
super(custom.x, custom.y);
|
super(custom.x, custom.y);
|
||||||
path = custom.path;
|
path = custom.path;
|
||||||
calculateBounds();
|
calculateBounds();
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ public abstract class FilledShape extends StrokedShape {
|
|||||||
fillColor = color;
|
fillColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFillColor( Color color, int alpha ) {
|
||||||
|
fillColor = new Color(color, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
public void setFillColor( int gray ) {
|
public void setFillColor( int gray ) {
|
||||||
setFillColor(gray, gray, gray, 255);
|
setFillColor(gray, gray, gray, 255);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package schule.ngb.zm.shapes;
|
package schule.ngb.zm.shapes;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import schule.ngb.zm.Options;
|
|
||||||
|
|
||||||
import java.awt.geom.Line2D;
|
import java.awt.geom.Line2D;
|
||||||
|
|
||||||
public class Line extends Shape {
|
public class Line extends Shape {
|
||||||
@@ -17,7 +14,7 @@ public class Line extends Shape {
|
|||||||
this.y2 = y2;
|
this.y2 = y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Line( @NotNull Line line ) {
|
public Line(Line line) {
|
||||||
this(line.x, line.y, line.x2, line.y2);
|
this(line.x, line.y, line.x2, line.y2);
|
||||||
copyFrom(line);
|
copyFrom(line);
|
||||||
}
|
}
|
||||||
@@ -98,8 +95,10 @@ public class Line extends Shape {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if( this == o ) return true;
|
if (this == o)
|
||||||
if( o == null || getClass() != o.getClass() ) return false;
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
Line pLine = (Line) o;
|
Line pLine = (Line) o;
|
||||||
return super.equals(o) &&
|
return super.equals(o) &&
|
||||||
Double.compare(pLine.x2, x2) == 0 &&
|
Double.compare(pLine.x2, x2) == 0 &&
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package schule.ngb.zm.shapes;
|
package schule.ngb.zm.shapes;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import schule.ngb.zm.Options;
|
import schule.ngb.zm.Options;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ public abstract class StrokedShape extends Constants implements Drawable {
|
|||||||
this.strokeColor = color;
|
this.strokeColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStrokeColor( Color color , int alpha ) {
|
||||||
|
this.strokeColor = new Color(color, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
public void setStrokeColor( int gray ) {
|
public void setStrokeColor( int gray ) {
|
||||||
setStrokeColor(gray, gray, gray, 255);
|
setStrokeColor(gray, gray, gray, 255);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user