|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.malai.instrument.Instrument
net.sf.latexdraw.instruments.Border
public class Border
This instrument manages the selected views.
This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
10/27/10
Nested Class Summary | |
---|---|
private static class |
Border.DnD2MoveCtrlPoint
This link maps a DnD interaction on a move control point handler to an action that moves the selected control point. |
private static class |
Border.DnD2MovePoint
This link maps a DnD interaction on a move point handler to an action that moves the selected point. |
private static class |
Border.DnD2Rotate
This link maps a DnD interaction on a rotation handler to an action that rotates the selected shapes. |
private static class |
Border.DnD2Scale
This link maps a DnD interaction on a scale handler to an action that scales the selection. |
Field Summary | |
---|---|
protected ArcAngleHandler |
arcHandlerEnd
The handler that sets the end angle of an arc. |
protected ArcAngleHandler |
arcHandlerStart
The handler that sets the start angle of an arc. |
protected java.awt.geom.Rectangle2D |
border
The rectangle uses to show the selection. |
protected ICanvas |
canvas
The canvas that contains the border. |
protected java.util.List<IHandler> |
ctrlPt1Handlers
The handlers that move first control points. |
protected java.util.List<IHandler> |
ctrlPt2Handlers
The handlers that move second control points. |
protected java.util.List<IHandler> |
mvPtHandlers
The handlers that move points. |
protected IHandler |
rotHandler
The handler that rotates shapes. |
protected java.util.List<IHandler> |
scaleHandlers
The handlers that scale shapes. |
protected java.util.List<IViewShape> |
selection
The selected views. |
static java.awt.BasicStroke |
STROKE
The stroke uses by the border to display its bounding rectangle. |
Fields inherited from class org.malai.instrument.Instrument |
---|
activated, eventables, links, modified |
Constructor Summary | |
---|---|
Border(ICanvas canvas)
Creates and initialises the border. |
Method Summary | |
---|---|
void |
add(IViewShape view)
Adds the given shape to the selection. |
void |
clear()
Removes all the selected views. |
boolean |
contains(java.lang.Object obj)
Tests if the given object is contained by the calling picker. |
private IHandler |
getHandlerAt(double x,
double y,
java.util.List<IHandler> handlers)
|
Pickable |
getPickableAt(double x,
double y)
|
Picker |
getPickerAt(double x,
double y)
|
java.awt.geom.Point2D |
getRelativePoint(double x,
double y,
java.lang.Object o)
|
java.util.List<IViewShape> |
getSelection()
|
private void |
initialiseCtrlMvHandlers(IControlPointShape cps)
|
protected void |
initialiseLinks()
Initialises the links of the instrument. |
void |
interimFeedback()
Reinitialises the interim feedback of the instrument. |
protected boolean |
isArcHandlerShowable()
|
protected boolean |
isCtrlPtMvHandlersShowable()
|
protected boolean |
isPtMvHandlersShowable()
|
void |
paint(java.awt.Graphics2D g)
Paints the border if activated. |
private void |
paintHandlers(java.awt.Graphics2D g)
Paints the required handlers. |
void |
reinit()
Reinitialises the object. |
void |
remove(IViewShape view)
Removes the given view from the selection. |
void |
update()
Updates the bounding rectangle using the selected views. |
private void |
updateArcHandlers()
Updates the arc handlers. |
private void |
updateCtrlMvHandlers()
Updates the handlers that move control points. |
private void |
updateHandlersPosition()
Updates the position of the handlers. |
private void |
updateMvHandlers()
Updates the handlers that move points. |
Methods inherited from class org.malai.instrument.Instrument |
---|
addEventable, addLink, clearEvents, getLinks, getSizeLinks, hasLinks, isActivated, isModified, load, onActionAborted, onActionAdded, onActionCancelled, onActionDone, onActionExecuted, onUndoableAdded, onUndoableRedo, onUndoableUndo, removeLink, save, setActivated, setModified |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.BasicStroke STROKE
protected java.util.List<IViewShape> selection
protected java.awt.geom.Rectangle2D border
protected java.util.List<IHandler> scaleHandlers
protected java.util.List<IHandler> mvPtHandlers
protected java.util.List<IHandler> ctrlPt1Handlers
protected java.util.List<IHandler> ctrlPt2Handlers
protected ArcAngleHandler arcHandlerStart
protected ArcAngleHandler arcHandlerEnd
protected IHandler rotHandler
protected ICanvas canvas
Constructor Detail |
---|
public Border(ICanvas canvas)
canvas
- The canvas that contains the border.Method Detail |
---|
public void reinit()
Reinitialisable
reinit
in interface Reinitialisable
reinit
in class Instrument
public void interimFeedback()
Instrument
interimFeedback
in class Instrument
public void update()
private void updateHandlersPosition()
private void updateArcHandlers()
private void updateCtrlMvHandlers()
private void initialiseCtrlMvHandlers(IControlPointShape cps)
private void updateMvHandlers()
public void paint(java.awt.Graphics2D g)
g
- The graphics in which the border is painted.private void paintHandlers(java.awt.Graphics2D g)
protected boolean isCtrlPtMvHandlersShowable()
protected boolean isPtMvHandlersShowable()
protected boolean isArcHandlerShowable()
public void add(IViewShape view)
view
- The view to add. If null, nothing is done.public void remove(IViewShape view)
view
- The view to remove. If null or it is not
already in the selection, nothing is performed.public java.util.List<IViewShape> getSelection()
protected void initialiseLinks()
Instrument
initialiseLinks
in class Instrument
public void clear()
public Pickable getPickableAt(double x, double y)
getPickableAt
in interface Picker
x
- The x-coordinate of the position used to get the pickable object.y
- The y-coordinate of the position used to get the pickable object.
private IHandler getHandlerAt(double x, double y, java.util.List<IHandler> handlers)
public Picker getPickerAt(double x, double y)
getPickerAt
in interface Picker
x
- The x-coordinate of the position used to get the picker object.y
- The y-coordinate of the position used to get the picker object.
public java.awt.geom.Point2D getRelativePoint(double x, double y, java.lang.Object o)
getRelativePoint
in interface Picker
x
- The x-coordinate of the position to convert.y
- The y-coordinate of the position to convert.o
- An object contained by the calling picker. This function will computed the real position of the given
point in o
.
o1
that contains an other object o2
at position (10, 10)
. o1.getRelativePoint(30, 30, o2)
will return (20, 20)
.public boolean contains(java.lang.Object obj)
Picker
contains
in interface Picker
obj
- The object to test.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |