mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-10-12 09:56:33 +02:00
Vergleich von Options.Direction Enumerations angepasst
This commit is contained in:
@@ -456,16 +456,16 @@ public class DrawingLayer extends Layer {
|
|||||||
// anchor == CENTER
|
// anchor == CENTER
|
||||||
Point2D.Double anchorPoint = new Point2D.Double(x - whalf, y - hhalf);
|
Point2D.Double anchorPoint = new Point2D.Double(x - whalf, y - hhalf);
|
||||||
|
|
||||||
if( NORTH.is(anchor) ) {
|
if( NORTH.in(anchor) ) {
|
||||||
anchorPoint.y += hhalf;
|
anchorPoint.y += hhalf;
|
||||||
}
|
}
|
||||||
if( SOUTH.is(anchor) ) {
|
if( SOUTH.in(anchor) ) {
|
||||||
anchorPoint.y -= hhalf;
|
anchorPoint.y -= hhalf;
|
||||||
}
|
}
|
||||||
if( WEST.is(anchor) ) {
|
if( WEST.in(anchor) ) {
|
||||||
anchorPoint.x += whalf;
|
anchorPoint.x += whalf;
|
||||||
}
|
}
|
||||||
if( EAST.is(anchor) ) {
|
if( EAST.in(anchor) ) {
|
||||||
anchorPoint.x -= whalf;
|
anchorPoint.x -= whalf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package schule.ngb.zm;
|
|||||||
import java.awt.geom.Arc2D;
|
import java.awt.geom.Arc2D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diese Klasse sammelt Enumerationen, die verschiedene Eigenschaften der
|
* Diese Klasse sammelt Enumerationen, die verschiedene Eigenschaften der zu
|
||||||
* zu zeichnenden Formen darstellen.
|
* zeichnenden Formen darstellen.
|
||||||
*/
|
*/
|
||||||
public final class Options {
|
public final class Options {
|
||||||
private Options() {}
|
|
||||||
|
private Options() {
|
||||||
|
}
|
||||||
|
|
||||||
public enum StrokeType {
|
public enum StrokeType {
|
||||||
SOLID, DASHED, DOTTED
|
SOLID, DASHED, DOTTED
|
||||||
@@ -19,7 +21,9 @@ public final class Options {
|
|||||||
|
|
||||||
public enum PathType {
|
public enum PathType {
|
||||||
OPEN(Arc2D.OPEN), CLOSED(Arc2D.CHORD), PIE(Arc2D.PIE);
|
OPEN(Arc2D.OPEN), CLOSED(Arc2D.CHORD), PIE(Arc2D.PIE);
|
||||||
|
|
||||||
public final int awt_type;
|
public final int awt_type;
|
||||||
|
|
||||||
PathType( int type ) {
|
PathType( int type ) {
|
||||||
awt_type = type;
|
awt_type = type;
|
||||||
}
|
}
|
||||||
@@ -55,14 +59,25 @@ public final class Options {
|
|||||||
RIGHT(EAST.mask);
|
RIGHT(EAST.mask);
|
||||||
|
|
||||||
public final byte mask;
|
public final byte mask;
|
||||||
|
|
||||||
Direction( int mask ) {
|
Direction( int mask ) {
|
||||||
this.mask = (byte) mask;
|
this.mask = (byte) mask;
|
||||||
}
|
}
|
||||||
public boolean is( int mask ) {
|
|
||||||
|
public boolean in( int mask ) {
|
||||||
return (mask & this.mask) == this.mask;
|
return (mask & this.mask) == this.mask;
|
||||||
}
|
}
|
||||||
public boolean is( Direction dir ) {
|
|
||||||
return (dir.mask & this.mask) == this.mask;
|
public boolean in( Direction dir ) {
|
||||||
|
return in(dir.mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains( int mask ) {
|
||||||
|
return (mask & this.mask) == mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains( Direction dir ) {
|
||||||
|
return contains(dir.mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,16 +129,16 @@ public abstract class Shape extends FilledShape {
|
|||||||
anchorpoint.x = bHalf;
|
anchorpoint.x = bHalf;
|
||||||
anchorpoint.y = hHalf;
|
anchorpoint.y = hHalf;
|
||||||
|
|
||||||
if( NORTH.is(anchor) ) {
|
if( NORTH.in(anchor) ) {
|
||||||
anchorpoint.y -= hHalf;
|
anchorpoint.y -= hHalf;
|
||||||
}
|
}
|
||||||
if( SOUTH.is(anchor) ) {
|
if( SOUTH.in(anchor) ) {
|
||||||
anchorpoint.y += hHalf;
|
anchorpoint.y += hHalf;
|
||||||
}
|
}
|
||||||
if( WEST.is(anchor) ) {
|
if( WEST.in(anchor) ) {
|
||||||
anchorpoint.x -= bHalf;
|
anchorpoint.x -= bHalf;
|
||||||
}
|
}
|
||||||
if( EAST.is(anchor) ) {
|
if( EAST.in(anchor) ) {
|
||||||
anchorpoint.x += bHalf;
|
anchorpoint.x += bHalf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user