Class ShapeGroup
- All Implemented Interfaces:
Drawable,Fillable,Strokeable
ShapwGroup ist eine Sammlung von Shapes, die gemeinsam
eine Gruppe bilden. Transformationen der Gruppe werden nach den
Transformationen der einzelnen Formen auf die gesammte Gruppe angewandt. So
kann ein Rechteck in der Gruppe zunächst um 45 Grad gedreht werden und dann
die Gruppe um -45 Grad. Das Rechteck wird dann wieder waagerecht dargestellt,
während alle anderen Formen der Gruppe nun gedreht erscheinen. Da die Gruppe
selbst ein eigenes Drehzentrum hat, können so komplexe Strukturen als eine
eigene, zusammenhängende Form verwendet werden. (Im Gegensatz zu einer
CustomShape haben Formgruppen den Vorteil, dass die einzelnen Formen
individuelle Farben und Konturen bekommen können.)
Da die Größe der Gruppe durch seine zugewiesenen Formen fefstgelegt wird,
sollten Modifikation wie Shape.setAnchor(Options.Direction),
Shape.nextTo(Shape, Options.Direction) oder
Shape.alignTo(Shape, Options.Direction, double), die die Größe der Gruppe
benötigen, erst nach Hinzufügen der Gruppenelemente ausgeführt werden.
Nachdem sich die Zusammensetzung der Gruppe geändert hat, muss die Gruppe
ggf. neu ausgerichtet werden.
Für die Ausrichtung der Elemente in einer Gruppe können
arrange(Options.Direction, double),
arrangeInGrid(int, Options.Direction, double, int) und
align(Options.Direction) verwendet werden, die jeweils die Position
der Formen in der Gruppe ändern und nicht die Position der Gruppe selbst (so
wie z.B. Shape.alignTo(Shape, Options.Direction)).
-
Field Summary
FieldsFields inherited from class schule.ngb.zm.BasicDrawable
fill, fillColor, stroke, strokeColor, strokeJoin, strokeType, strokeWeight, visibleFields inherited from class schule.ngb.zm.Constants
APP_NAME, APP_VERSION, APP_VERSION_MAJ, APP_VERSION_MIN, APP_VERSION_REV, ARROW, BEVEL, BLACK, BLUE, BOLD, BROWN, canvasHeight, canvasWidth, CENTER, CLOSED, cmouseX, cmouseY, CROSS, CYAN, DARKGRAY, DASHED, DEFAULT_ANIM_RUNTIME, DEFAULT_BACKGROUND, DEFAULT_BUFFER, DEFAULT_EASING, DEFAULT_FILLCOLOR, DEFAULT_FONTSIZE, DEFAULT_FPS, DEFAULT_HEIGHT, DEFAULT_STROKECOLOR, DEFAULT_STROKEWEIGHT, DEFAULT_WIDTH, delta, DOTTED, DOWN, DOWNLEFT, DOWNRIGHT, EAST, FILLED, framesPerSecond, GRAY, GREEN, HALF_PI, HAND, ITALIC, key, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, KEY_ALT, KEY_B, KEY_BACK_SPACE, KEY_C, KEY_CANCEL, KEY_CAPS_LOCK, KEY_CLEAR, KEY_COMMA, KEY_CONTROL, KEY_D, KEY_DOWN, KEY_E, KEY_END, KEY_ENTER, KEY_EQUALS, KEY_ESCAPE, KEY_F, KEY_G, KEY_H, KEY_HOME, KEY_I, KEY_J, KEY_K, KEY_L, KEY_LEFT, KEY_M, KEY_MINUS, KEY_N, KEY_O, KEY_P, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_PAUSE, KEY_PERIOD, KEY_Q, KEY_R, KEY_RIGHT, KEY_S, KEY_SEMICOLON, KEY_SHIFT, KEY_SLASH, KEY_SPACE, KEY_T, KEY_TAB, KEY_U, KEY_UP, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, keyCode, keyEvent, keyPressed, LEFT, LIGHTGRAY, LINES, LINUX, MACOS, MAGENTA, MIDDLE, MITER, MOUSE1, MOUSE2, MOUSE3, mouseButton, mouseEvent, mousePressed, mouseX, mouseY, MOVE, NOMOUSE, NORTH, NORTHEAST, NORTHWEST, OPEN, ORANGE, PI, PIE, PINK, PLAIN, pmouseX, pmouseY, PURPLE, QUARTER_PI, RED, RIGHT, ROUND, runtime, screenHeight, screenWidth, SOLID, SOUTH, SOUTHEAST, SOUTHWEST, TEXT, tick, TWO_PI, UP, UPLEFT, UPRIGHT, WAIT, WEST, WHITE, WINDOWS, YELLOW -
Constructor Summary
ConstructorsConstructorDescriptionShapeGroup(double x, double y) ShapeGroup(double x, double y, Shape... shapes) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidalign(Options.Direction dir) voidarrange(Options.Direction dir, double buffer) voidarrangeInColumns(int n, Options.Direction dir, double buffer) voidarrangeInGrid(int n, Options.Direction dir, double buffer, int mode) voidarrangeInRows(int n, Options.Direction dir, double buffer) booleancopy()Erzeugt eine Kopie dieser Form mit denselben Eigenschaften.voiddraw(Graphics2D graphics, AffineTransform transform) Zeichnet die Form, aber wendet zuvor noch eine zusätzliche Transformations- matrix an.get(int index) doubleLiefert die aktuelle Höhe dieser Form.getShape()Gibt eineJava-AWT ShapeVersion dieser Form zurück.doublegetWidth()Liefert die aktuelle Breite dieser Form.voidpack()voidvoidintsize()Methods inherited from class schule.ngb.zm.shapes.Shape
alignTo, alignTo, alignTo, alignTo, copyFrom, draw, equals, fillShape, getAbsAnchorPoint, getAnchor, getAnchorPoint, getAnchorPoint, getBounds, getRotation, getScale, getTransform, getX, getY, move, moveTo, moveTo, moveTo, moveTo, nextTo, nextTo, rotate, rotate, rotate, rotateTo, scale, scaleBy, setAnchor, setGradient, setGradient, setX, setY, strokeShapeMethods inherited from class schule.ngb.zm.BasicDrawable
getFill, getFillColor, getGradient, getStroke, getStrokeColor, getStrokeJoin, getStrokeType, getStrokeWeight, hasFillColor, hasGradient, hide, isVisible, setFill, setFillColor, setStroke, setStrokeColor, setStrokeJoin, setStrokeType, setStrokeWeight, show, toggleMethods inherited from class schule.ngb.zm.Constants
abs, arccos, arcsin, arctan, asBool, asBool, asBool, asBool, asBool, asBool, asBool, asBool, asBool, asDouble, asDouble, asDouble, asDouble, asDouble, asDouble, asDouble, asDouble, asDouble, asInt, asInt, asInt, asInt, asInt, asInt, asInt, asInt, asInt, avg, binary, ceil, choice, choice, choice, choice, color, color, color, color, colorHsb, colorHsl, cos, degrees, distance, floor, fromBinary, fromHex, getRandom, hex, interpolate, limit, limit, loadImage, map, max, max, min, min, morph, noise, noise, noise, noise, pow, radians, random, random, random, random, random, randomBool, randomBool, randomBool, randomColor, randomGaussian, randomNiceColor, round, setSeed, shuffle, shuffle, shuffle, shuffle, sign, sin, sqrt, sum, tanMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface schule.ngb.zm.Fillable
hasFill, noFill, noGradient, resetFill, setFillColor, setFillColor, setFillColor, setFillColor, setFillColor, setGradient, setGradientMethods inherited from interface schule.ngb.zm.Strokeable
hasStroke, noStroke, resetStroke, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeColor
-
Field Details
-
ARRANGE_ROWS
public static final int ARRANGE_ROWS- See Also:
-
ARRANGE_COLS
public static final int ARRANGE_COLS- See Also:
-
-
Constructor Details
-
ShapeGroup
public ShapeGroup() -
ShapeGroup
public ShapeGroup(double x, double y) -
ShapeGroup
-
-
Method Details
-
copy
Description copied from class:ShapeErzeugt eine Kopie dieser Form mit denselben Eigenschaften.Unterklassen implementieren diese Methode mit dem genauen Typ der Unterklasse. In
Rectanglesieht die Umsetzung beispielsweise so aus:public Rectangle copy() { return new Rectangle(this); }Die Methode kann beliebig umgesetzt werden, um eine 1-zu-1-Kopie dieser Form zu erhalten. In der Regel besitzt aber jede Form einen Konstruktor, der alle Werte einer andern Form übernimmt. Die gezeigte Implementierung ist daher im Regelfall ausreichend.
-
add
-
add
-
removeAll
public void removeAll() -
getShapes
-
getShapes
-
remove
-
get
-
contains
-
size
public int size() -
getWidth
public double getWidth()Description copied from class:ShapeLiefert die aktuelle Breite dieser Form.Die Breite einer Form ist immer die Breite ihrer Begrenzung, bevor Drehungen und andere Transformationen auf sie angewandt wurden.
Die Begrenzungen der tatsächlich gezeichneten Form wird mit
Shape.getBounds()abgerufen. -
getHeight
public double getHeight()Description copied from class:ShapeLiefert die aktuelle Höhe dieser Form.Die Höhe einer Form ist immer die Höhe ihrer Begrenzung, bevor Drehungen und andere Transformationen auf sie angewandt wurden.
Die Begrenzungen der tatsächlich gezeichneten Form wird mit
Shape.getBounds()abgerufen. -
arrange
-
arrangeInRows
-
arrangeInColumns
-
arrangeInGrid
-
align
-
pack
public void pack() -
getShape
Description copied from class:ShapeGibt eineJava-AWT ShapeVersion dieser Form zurück. Intern werden die AWT Shapes benutzt, um sie auf denGrafikkontextzu zeichnen.Wenn diese Form nicht durch eine AWT-Shape dargestellt wird, liefert die Methode
null. -
draw
Description copied from class:ShapeZeichnet die Form, aber wendet zuvor noch eine zusätzliche Transformations- matrix an. Wird u.A. von derShapeGroupverwendet.
-