Ejemplo n.º 1
0
 @Override
 public void draw(Graphics2D g) {
   Shape bounds = getOwner().getBezierPath();
   if (AttributeKeys.TRANSFORM.get(getOwner()) != null) {
     bounds = AttributeKeys.TRANSFORM.get(getOwner()).createTransformedShape(bounds);
   }
   bounds = view.getDrawingToViewTransform().createTransformedShape(bounds);
   Stroke stroke1;
   Color strokeColor1;
   Stroke stroke2;
   Color strokeColor2;
   if (getEditor().getTool().supportsHandleInteraction()) {
     if (isHoverHandle) {
       stroke1 =
           (Stroke) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_STROKE_1_HOVER);
       strokeColor1 =
           (Color) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_COLOR_1_HOVER);
       stroke2 =
           (Stroke) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_STROKE_2_HOVER);
       strokeColor2 =
           (Color) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_COLOR_2_HOVER);
     } else {
       stroke1 = (Stroke) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_STROKE_1);
       strokeColor1 =
           (Color) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_COLOR_1);
       stroke2 = (Stroke) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_STROKE_2);
       strokeColor2 =
           (Color) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_COLOR_2);
     }
   } else {
     stroke1 =
         (Stroke)
             getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_STROKE_1_DISABLED);
     strokeColor1 =
         (Color) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_COLOR_1_DISABLED);
     stroke2 =
         (Stroke)
             getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_STROKE_2_DISABLED);
     strokeColor2 =
         (Color) getEditor().getHandleAttribute(HandleAttributeKeys.BEZIER_PATH_COLOR_2_DISABLED);
   }
   if (stroke1 != null && strokeColor1 != null) {
     g.setStroke(stroke1);
     g.setColor(strokeColor1);
     g.draw(bounds);
   }
   if (stroke2 != null && strokeColor2 != null) {
     g.setStroke(stroke2);
     g.setColor(strokeColor2);
     g.draw(bounds);
   }
 }
 public java.util.List<Figure> findFiguresWithin(Rectangle2D.Double bounds) {
   LinkedList<Figure> contained = new LinkedList<Figure>();
   for (Figure f : children) {
     Rectangle2D r = f.getBounds();
     if (AttributeKeys.TRANSFORM.get(f) != null) {
       r = AttributeKeys.TRANSFORM.get(f).createTransformedShape(r).getBounds2D();
     }
     if (f.isVisible() && bounds.contains(r)) {
       contained.add(f);
     }
   }
   return contained;
 }