Add SCircle
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package ovh.gasser.newshapes.ui;
|
||||
|
||||
import ovh.gasser.newshapes.ShapeVisitor;
|
||||
import ovh.gasser.newshapes.shapes.Shape;
|
||||
import ovh.gasser.newshapes.attributes.ColorAttributes;
|
||||
import ovh.gasser.newshapes.attributes.SelectionAttributes;
|
||||
import ovh.gasser.newshapes.shapes.SCircle;
|
||||
import ovh.gasser.newshapes.shapes.SCollection;
|
||||
import ovh.gasser.newshapes.shapes.SRectangle;
|
||||
import ovh.gasser.newshapes.shapes.Shape;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -46,6 +47,23 @@ public class ShapeDraftman implements ShapeVisitor {
|
||||
drawHandlerIfSelected(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCircle(SCircle circle) {
|
||||
ColorAttributes colAttrs = (ColorAttributes) circle.getAttributes(ColorAttributes.ID);
|
||||
final Rectangle bounds = circle.getBounds();
|
||||
if (colAttrs == null) {
|
||||
colAttrs = DEFAULT_COLOR_ATTRIBUTES;
|
||||
}
|
||||
if (colAttrs.filled) {
|
||||
this.g2d.setColor(colAttrs.filledColor);
|
||||
this.g2d.fillOval(bounds.x, bounds.y, circle.getRadius(), circle.getRadius());
|
||||
}
|
||||
if (colAttrs.stroked) this.g2d.setColor(colAttrs.strokedColor);
|
||||
this.g2d.drawOval(bounds.x, bounds.y, circle.getRadius(), circle.getRadius());
|
||||
|
||||
drawHandlerIfSelected(circle);
|
||||
}
|
||||
|
||||
private void drawHandlerIfSelected(Shape s) {
|
||||
SelectionAttributes selAttrs = (SelectionAttributes) s.getAttributes(SelectionAttributes.ID);
|
||||
if ((selAttrs != null) && (selAttrs.selected)){
|
||||
|
||||
Reference in New Issue
Block a user