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;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import schule.ngb.zm.Options;
|
||||
import schule.ngb.zm.Vector;
|
||||
|
||||
@@ -30,7 +29,7 @@ public class Arrow extends Line {
|
||||
*
|
||||
* @param vector
|
||||
*/
|
||||
public Arrow( @NotNull Vector vector ) {
|
||||
public Arrow( Vector vector ) {
|
||||
this(0, 0, vector.x, vector.y);
|
||||
}
|
||||
|
||||
@@ -41,7 +40,7 @@ public class Arrow extends Line {
|
||||
* @param vector1
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ public class Arrow extends Line {
|
||||
* @param y
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ public class Arrow extends Line {
|
||||
*
|
||||
* @param line
|
||||
*/
|
||||
public Arrow( @NotNull Line line ) {
|
||||
public Arrow( Line line ) {
|
||||
this(line.x, line.y, line.x2, line.y2);
|
||||
this.copyFrom(line);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package schule.ngb.zm.shapes;
|
||||
|
||||
import schule.ngb.zm.Drawable;
|
||||
import schule.ngb.zm.Options;
|
||||
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
public class Circle extends Shape {
|
||||
public class Circle extends Shape implements Drawable {
|
||||
|
||||
protected double radius;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package schule.ngb.zm.shapes;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.geom.Path2D;
|
||||
|
||||
public class CustomShape extends Shape {
|
||||
@@ -15,7 +13,7 @@ public class CustomShape extends Shape {
|
||||
path = new Path2D.Double();
|
||||
}
|
||||
|
||||
public CustomShape( @NotNull CustomShape custom ) {
|
||||
public CustomShape( CustomShape custom ) {
|
||||
super(custom.x, custom.y);
|
||||
path = custom.path;
|
||||
calculateBounds();
|
||||
|
||||
@@ -14,6 +14,10 @@ public abstract class FilledShape extends StrokedShape {
|
||||
fillColor = color;
|
||||
}
|
||||
|
||||
public void setFillColor( Color color, int alpha ) {
|
||||
fillColor = new Color(color, alpha);
|
||||
}
|
||||
|
||||
public void setFillColor( int gray ) {
|
||||
setFillColor(gray, gray, gray, 255);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package schule.ngb.zm.shapes;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import schule.ngb.zm.Options;
|
||||
|
||||
import java.awt.geom.Line2D;
|
||||
|
||||
public class Line extends Shape {
|
||||
@@ -17,7 +14,7 @@ public class Line extends Shape {
|
||||
this.y2 = y2;
|
||||
}
|
||||
|
||||
public Line( @NotNull Line line ) {
|
||||
public Line(Line line) {
|
||||
this(line.x, line.y, line.x2, line.y2);
|
||||
copyFrom(line);
|
||||
}
|
||||
@@ -98,8 +95,10 @@ public class Line extends Shape {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if( this == o ) return true;
|
||||
if( o == null || getClass() != o.getClass() ) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Line pLine = (Line) o;
|
||||
return super.equals(o) &&
|
||||
Double.compare(pLine.x2, x2) == 0 &&
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package schule.ngb.zm.shapes;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import schule.ngb.zm.Options;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@@ -24,6 +24,10 @@ public abstract class StrokedShape extends Constants implements Drawable {
|
||||
this.strokeColor = color;
|
||||
}
|
||||
|
||||
public void setStrokeColor( Color color , int alpha ) {
|
||||
this.strokeColor = new Color(color, alpha);
|
||||
}
|
||||
|
||||
public void setStrokeColor( int gray ) {
|
||||
setStrokeColor(gray, gray, gray, 255);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user