public class PlanController extends FurnitureController implements Controller
Modifier and Type | Class and Description |
---|---|
protected static class |
PlanController.ControllerState
Controller state classes super class.
|
static class |
PlanController.EditableProperty
Fields that can be edited in plan view.
|
static class |
PlanController.Mode
Selectable modes in controller.
|
static class |
PlanController.Property |
Constructor and Description |
---|
PlanController(Home home,
UserPreferences preferences,
ViewFactory viewFactory,
ContentManager contentManager,
javax.swing.undo.UndoableEditSupport undoSupport)
Creates the controller of plan view.
|
Modifier and Type | Method and Description |
---|---|
void |
addDimensionLines(java.util.List<DimensionLine> dimensionLines)
Add
dimensionLines to home and post an undoable new dimension line operation. |
void |
addFurniture(java.util.List<HomePieceOfFurniture> furniture)
Adds furniture to home and updates door and window flags if they intersect with walls and magnestism is enabled.
|
void |
addItems(java.util.List<? extends Selectable> items)
Adds
items to home and post an undoable operation. |
void |
addLabels(java.util.List<Label> labels)
Add
labels to home and post an undoable new label operation. |
void |
addLevel()
Controls the creation of a new level.
|
void |
addPropertyChangeListener(PlanController.Property property,
java.beans.PropertyChangeListener listener)
Adds the property change
listener in parameter to this controller. |
void |
addRooms(java.util.List<Room> rooms)
Add
newRooms to home and post an undoable new room line operation. |
void |
addWalls(java.util.List<Wall> walls)
Adds
walls to home and post an undoable new wall operation. |
protected void |
adjustMagnetizedPieceOfFurniture(HomePieceOfFurniture piece,
float x,
float y)
Attempts to modify
piece location depending of its context. |
protected DimensionLine |
createDimensionLine(float xStart,
float yStart,
float xEnd,
float yEnd,
float offset)
Returns a new dimension instance joining (
xStart ,
yStart ) and (xEnd , yEnd ) points. |
protected Level |
createLevel(java.lang.String name,
float elevation,
float floorThickness,
float height)
Returns a new level added to home.
|
protected Room |
createRoom(float[][] roomPoints)
Returns a new room instance with the given points.
|
protected Wall |
createWall(float xStart,
float yStart,
float xEnd,
float yEnd,
Wall wallStartAtStart,
Wall wallEndAtStart)
Returns a new wall instance between (
xStart ,
yStart ) and (xEnd , yEnd )
end points. |
void |
decreaseTextSize()
Decrease the size of texts in selected items.
|
void |
deleteItems(java.util.List<? extends Selectable> items)
Deletes
items in plan and record it as an undoable operation. |
void |
deleteSelectedLevel()
Deletes the selected level and the items that belongs to it.
|
void |
deleteSelection()
Deletes the selection in home.
|
void |
escape()
Escapes of current action.
|
protected PlanController.ControllerState |
getCameraElevationState()
Returns the camera elevation state.
|
protected PlanController.ControllerState |
getCameraPitchRotationState()
Returns the camera pitch rotation state.
|
protected PlanController.ControllerState |
getCameraYawRotationState()
Returns the camera yaw rotation state.
|
protected PlanController.ControllerState |
getCompassResizeState()
Returns the compass resize state.
|
protected PlanController.ControllerState |
getCompassRotationState()
Returns the compass rotation state.
|
protected PlanController.ControllerState |
getDimensionLineCreationState()
Returns the dimension line creation state.
|
protected PlanController.ControllerState |
getDimensionLineDrawingState()
Returns the dimension line drawing state.
|
protected PlanController.ControllerState |
getDimensionLineOffsetState()
Returns the dimension line offset state.
|
protected PlanController.ControllerState |
getDimensionLineResizeState()
Returns the dimension line resize state.
|
protected PlanController.ControllerState |
getDragAndDropState()
Returns the drag and drop state.
|
View |
getHorizontalRulerView()
Returns the horizontal ruler of the plan view.
|
protected PlanController.ControllerState |
getLabelCreationState()
Returns the label creation state.
|
protected PlanController.ControllerState |
getLabelRotationState()
Returns the label rotation state.
|
protected PlanController.ControllerState |
getLightPowerModificationState()
Returns the light power modification state.
|
float |
getMaximumScale()
Returns the maximum scale of the plan view.
|
float |
getMinimumScale()
Returns the minimum scale of the plan view.
|
PlanController.Mode |
getMode()
Returns the active mode of this controller.
|
protected PlanController.ControllerState |
getPanningState()
Returns the panning state.
|
protected PlanController.ControllerState |
getPieceOfFurnitureElevationState()
Returns the piece elevation state.
|
protected PlanController.ControllerState |
getPieceOfFurnitureHeightState()
Returns the piece height state.
|
protected PlanController.ControllerState |
getPieceOfFurnitureNameOffsetState()
Returns the piece name offset state.
|
protected PlanController.ControllerState |
getPieceOfFurnitureNameRotationState()
Returns the piece name rotation state.
|
protected PlanController.ControllerState |
getPieceOfFurnitureResizeState()
Returns the piece resize state.
|
protected PlanController.ControllerState |
getPieceOfFurnitureRotationState()
Returns the piece rotation state.
|
protected PlanController.ControllerState |
getRectangleSelectionState()
Returns the rectangle selection state.
|
protected PlanController.ControllerState |
getRoomAreaOffsetState()
Returns the room area offset state.
|
protected PlanController.ControllerState |
getRoomAreaRotationState()
Returns the room area rotation state.
|
protected PlanController.ControllerState |
getRoomCreationState()
Returns the room creation state.
|
protected PlanController.ControllerState |
getRoomDrawingState()
Returns the room drawing state.
|
protected PlanController.ControllerState |
getRoomNameOffsetState()
Returns the room name offset state.
|
protected PlanController.ControllerState |
getRoomNameRotationState()
Returns the room name rotation state.
|
protected PlanController.ControllerState |
getRoomResizeState()
Returns the room resize state.
|
float |
getScale()
Returns the scale in plan view.
|
Selectable |
getSelectableItemAt(float x,
float y)
Returns the selectable item at (
x , y ) point. |
java.util.List<Selectable> |
getSelectableItemsAt(float x,
float y)
Returns the selectable items at (
x , y ) point. |
protected java.util.List<Selectable> |
getSelectableItemsIntersectingRectangle(float x0,
float y0,
float x1,
float y1)
Returns the items that intersects with the rectangle of (
x0 ,
y0 ), (x1 , y1 ) opposite corners. |
protected PlanController.ControllerState |
getSelectionMoveState()
Returns the selection move state.
|
protected PlanController.ControllerState |
getSelectionState()
Returns the selection state.
|
View |
getVerticalRulerView()
Returns the vertical ruler of the plan view.
|
PlanView |
getView()
Returns the view associated with this controller.
|
protected PlanController.ControllerState |
getWallCreationState()
Returns the wall creation state.
|
protected PlanController.ControllerState |
getWallDrawingState()
Returns the wall drawing state.
|
protected PlanController.ControllerState |
getWallResizeState()
Returns the wall resize state.
|
protected float |
getXLastMouseMove()
Returns the abscissa of mouse position at last mouse move.
|
protected float |
getXLastMousePress()
Returns the abscissa of mouse position at last mouse press.
|
protected float |
getYLastMouseMove()
Returns the ordinate of mouse position at last mouse move.
|
protected float |
getYLastMousePress()
Returns the ordinate of mouse position at last mouse press.
|
void |
increaseTextSize()
Increase the size of texts in selected items.
|
protected boolean |
isItemDeletable(Selectable item)
Returns
true if the given item may be deleted. |
protected boolean |
isItemMovable(Selectable item)
Returns
true if the given item may be moved
in the plan. |
protected boolean |
isItemPartOfBasePlan(Selectable item)
Returns
true it the given item belongs
to the base plan. |
protected boolean |
isItemResizable(Selectable item)
Returns
true if the given item may be resized. |
boolean |
isModificationState()
Returns
true if the interactions in the current mode may modify
the state of a home. |
void |
lockBasePlan()
Locks home base plan.
|
void |
modifyCompass()
Controls the modification of the compass.
|
void |
modifyObserverCamera()
Controls the modification of the observer camera.
|
void |
modifySelectedLabels()
Controls the modification of the selected labels.
|
void |
modifySelectedLevel() |
void |
modifySelectedRooms()
Controls the modification of the selected rooms.
|
void |
modifySelectedWalls()
Controls the modification of selected walls.
|
void |
moveItems(java.util.List<? extends Selectable> items,
float dx,
float dy)
Moves
items of (dx , dy ) units. |
void |
moveMouse(float x,
float y)
Processes a mouse button moved event.
|
void |
moveSelection(float dx,
float dy)
Moves the selection of (
dx ,dy ) in home. |
void |
pressMouse(float x,
float y,
int clickCount,
boolean shiftDown,
boolean duplicationActivated)
Processes a mouse button pressed event.
|
void |
pressMouse(float x,
float y,
int clickCount,
boolean shiftDown,
boolean alignmentActivated,
boolean duplicationActivated,
boolean magnetismToggled)
Processes a mouse button pressed event.
|
void |
releaseMouse(float x,
float y)
Processes a mouse button released event.
|
void |
removePropertyChangeListener(PlanController.Property property,
java.beans.PropertyChangeListener listener)
Removes the property change
listener in parameter from this controller. |
void |
reverseSelectedWallsDirection()
Controls the direction reverse of selected walls.
|
void |
selectAll()
Selects all visible items in the selected level of home.
|
protected void |
selectAndShowItems(java.util.List<? extends Selectable> items)
Selects
items and make them visible at screen. |
void |
selectItem(Selectable item)
Selects the given
item . |
protected void |
selectItems(java.util.List<? extends Selectable> items)
Selects
items . |
void |
setAlignmentActivated(boolean alignmentActivated)
Activates or deactivates alignment feature.
|
void |
setDuplicationActivated(boolean duplicationActivated)
Activates or deactivates duplication feature.
|
void |
setEditionActivated(boolean editionActivated)
Activates or deactivates edition.
|
void |
setMode(PlanController.Mode mode)
Sets the active mode of this controller and fires a
PropertyChangeEvent . |
void |
setScale(float scale)
Controls the scale in plan view and and fires a
PropertyChangeEvent . |
void |
setSelectedLevel(Level level)
Sets the selected level in home.
|
protected void |
setState(PlanController.ControllerState state)
Changes current state of controller.
|
void |
splitSelectedWall()
Controls the split of the selected wall in two joined walls of equal length.
|
void |
startDraggedItems(java.util.List<Selectable> draggedItems,
float x,
float y)
Displays in plan view the feedback of
draggedItems ,
during a drag and drop operation initiated from outside of plan view. |
void |
stopDraggedItems()
Deletes in plan view the feedback of the dragged items.
|
void |
toggleBoldStyle()
Toggles bold style of texts in selected items.
|
void |
toggleItalicStyle()
Toggles italic style of texts in selected items.
|
void |
toggleMagnetism(boolean magnetismToggled)
Toggles temporary magnetism feature of user preferences.
|
void |
unlockBasePlan()
Unlocks home base plan.
|
void |
updateEditableProperty(PlanController.EditableProperty editableProperty,
java.lang.Object value)
Updates an editable property with the entered
value . |
protected boolean |
wasAlignmentActivatedLastMousePress()
Returns
true if alignment was activated at last mouse press. |
protected boolean |
wasDuplicationActivatedLastMousePress()
Returns
true if duplication was activated at last mouse press. |
protected boolean |
wasMagnetismToggledLastMousePress()
Returns
true if magnetism was toggled at last mouse press. |
protected boolean |
wasShiftDownLastMousePress()
Returns
true if shift key was down at last mouse press. |
void |
zoom(float factor)
Processes a zoom event.
|
alignSelectedFurnitureOnBackSide, alignSelectedFurnitureOnBottom, alignSelectedFurnitureOnFrontSide, alignSelectedFurnitureOnLeft, alignSelectedFurnitureOnLeftSide, alignSelectedFurnitureOnRight, alignSelectedFurnitureOnRightSide, alignSelectedFurnitureOnTop, alignSelectedFurnitureSideBySide, createHomeFurnitureGroup, createHomePieceOfFurniture, deleteFurniture, distributeSelectedFurniture, distributeSelectedFurnitureHorizontally, distributeSelectedFurnitureVertically, groupSelectedFurniture, importFurniture, importFurniture, isPieceOfFurnitureDeletable, isPieceOfFurnitureMovable, isPieceOfFurniturePartOfBasePlan, modifySelectedFurniture, setFurnitureVisibleProperties, setSelectedFurniture, sortFurniture, sortFurniture, toggleFurnitureSort, toggleFurnitureSortOrder, toggleFurnitureVisibleProperty, toggleSelectedFurnitureVisibility, ungroupSelectedFurniture
public PlanController(Home home, UserPreferences preferences, ViewFactory viewFactory, ContentManager contentManager, javax.swing.undo.UndoableEditSupport undoSupport)
home
- the home plan edited by this controller and its viewpreferences
- the preferences of the applicationviewFactory
- a factory able to create the plan view managed by this controllercontentManager
- a content manager used to import furnitureundoSupport
- undo support to post changes on plan by this controllerpublic PlanView getView()
getView
in interface Controller
getView
in class FurnitureController
protected void setState(PlanController.ControllerState state)
public void addPropertyChangeListener(PlanController.Property property, java.beans.PropertyChangeListener listener)
listener
in parameter to this controller.public void removePropertyChangeListener(PlanController.Property property, java.beans.PropertyChangeListener listener)
listener
in parameter from this controller.public PlanController.Mode getMode()
public void setMode(PlanController.Mode mode)
PropertyChangeEvent
.public boolean isModificationState()
true
if the interactions in the current mode may modify
the state of a home.public void deleteSelection()
deleteSelection
in class FurnitureController
public void escape()
public void moveSelection(float dx, float dy)
dx
,dy
) in home.public void toggleMagnetism(boolean magnetismToggled)
magnetismToggled
- if true
then magnetism feature is toggled.public void setAlignmentActivated(boolean alignmentActivated)
alignmentActivated
- if true
then alignment is active.public void setDuplicationActivated(boolean duplicationActivated)
duplicationActivated
- if true
then duplication is active.public void setEditionActivated(boolean editionActivated)
editionActivated
- if true
then edition is activepublic void updateEditableProperty(PlanController.EditableProperty editableProperty, java.lang.Object value)
value
.public void pressMouse(float x, float y, int clickCount, boolean shiftDown, boolean duplicationActivated)
public void pressMouse(float x, float y, int clickCount, boolean shiftDown, boolean alignmentActivated, boolean duplicationActivated, boolean magnetismToggled)
public void releaseMouse(float x, float y)
public void moveMouse(float x, float y)
public void zoom(float factor)
protected PlanController.ControllerState getSelectionState()
protected PlanController.ControllerState getSelectionMoveState()
protected PlanController.ControllerState getRectangleSelectionState()
protected PlanController.ControllerState getPanningState()
protected PlanController.ControllerState getDragAndDropState()
protected PlanController.ControllerState getWallCreationState()
protected PlanController.ControllerState getWallDrawingState()
protected PlanController.ControllerState getWallResizeState()
protected PlanController.ControllerState getPieceOfFurnitureRotationState()
protected PlanController.ControllerState getPieceOfFurnitureElevationState()
protected PlanController.ControllerState getPieceOfFurnitureHeightState()
protected PlanController.ControllerState getPieceOfFurnitureResizeState()
protected PlanController.ControllerState getLightPowerModificationState()
protected PlanController.ControllerState getPieceOfFurnitureNameOffsetState()
protected PlanController.ControllerState getPieceOfFurnitureNameRotationState()
protected PlanController.ControllerState getCameraYawRotationState()
protected PlanController.ControllerState getCameraPitchRotationState()
protected PlanController.ControllerState getCameraElevationState()
protected PlanController.ControllerState getDimensionLineCreationState()
protected PlanController.ControllerState getDimensionLineDrawingState()
protected PlanController.ControllerState getDimensionLineResizeState()
protected PlanController.ControllerState getDimensionLineOffsetState()
protected PlanController.ControllerState getRoomCreationState()
protected PlanController.ControllerState getRoomDrawingState()
protected PlanController.ControllerState getRoomResizeState()
protected PlanController.ControllerState getRoomAreaOffsetState()
protected PlanController.ControllerState getRoomAreaRotationState()
protected PlanController.ControllerState getRoomNameOffsetState()
protected PlanController.ControllerState getRoomNameRotationState()
protected PlanController.ControllerState getLabelCreationState()
protected PlanController.ControllerState getLabelRotationState()
protected PlanController.ControllerState getCompassRotationState()
protected PlanController.ControllerState getCompassResizeState()
protected float getXLastMousePress()
protected float getYLastMousePress()
protected boolean wasShiftDownLastMousePress()
true
if shift key was down at last mouse press.protected boolean wasMagnetismToggledLastMousePress()
true
if magnetism was toggled at last mouse press.protected boolean wasAlignmentActivatedLastMousePress()
true
if alignment was activated at last mouse press.protected boolean wasDuplicationActivatedLastMousePress()
true
if duplication was activated at last mouse press.protected float getXLastMouseMove()
protected float getYLastMouseMove()
public void modifySelectedWalls()
public void lockBasePlan()
protected boolean isItemPartOfBasePlan(Selectable item)
true
it the given item
belongs
to the base plan.public void unlockBasePlan()
protected boolean isItemMovable(Selectable item)
true
if the given item
may be moved
in the plan. Default implementation returns true
.protected boolean isItemResizable(Selectable item)
true
if the given item
may be resized.
Default implementation returns false
if the given item
is a non resizable piece of furniture.protected boolean isItemDeletable(Selectable item)
true
if the given item
may be deleted.
Default implementation returns true
except if the given item
is a camera or a compass or if the given item
isn't a
deletable piece of furniture.public void reverseSelectedWallsDirection()
public void splitSelectedWall()
public void modifySelectedRooms()
public void modifySelectedLabels()
public void modifyCompass()
public void modifyObserverCamera()
public void toggleBoldStyle()
public void toggleItalicStyle()
public void increaseTextSize()
public void decreaseTextSize()
public float getMinimumScale()
public float getMaximumScale()
public float getScale()
public void setScale(float scale)
PropertyChangeEvent
.public void setSelectedLevel(Level level)
public void selectAll()
selectAll
in class FurnitureController
public View getHorizontalRulerView()
public View getVerticalRulerView()
public void startDraggedItems(java.util.List<Selectable> draggedItems, float x, float y)
draggedItems
,
during a drag and drop operation initiated from outside of plan view.public void stopDraggedItems()
protected void adjustMagnetizedPieceOfFurniture(HomePieceOfFurniture piece, float x, float y)
piece
location depending of its context.
If the piece
is a door or a window and the point (x
, y
)
belongs to a wall, the piece will be resized, rotated and moved so
its opening depth is equal to wall thickness and its angle matches wall direction.
If the piece
isn't a door or a window and the point (x
, y
)
belongs to a wall, the piece will be rotated and moved so
its back face lies along the closest wall side and its angle matches wall direction.
If the piece
isn't a door or a window, its bounding box is included in
the one of an other object and its elevation is equal to zero, it will be elevated
to appear on the top of the latter.public void addLevel()
protected Level createLevel(java.lang.String name, float elevation, float floorThickness, float height)
public void modifySelectedLevel()
public void deleteSelectedLevel()
protected Wall createWall(float xStart, float yStart, float xEnd, float yEnd, Wall wallStartAtStart, Wall wallEndAtStart)
xStart
,
yStart
) and (xEnd
, yEnd
)
end points. The new wall is added to home and its start point is joined
to the start of wallStartAtStart
or
the end of wallEndAtStart
.protected Room createRoom(float[][] roomPoints)
protected DimensionLine createDimensionLine(float xStart, float yStart, float xEnd, float yEnd, float offset)
xStart
,
yStart
) and (xEnd
, yEnd
) points.
The new dimension line is added to home.public Selectable getSelectableItemAt(float x, float y)
x
, y
) point.public java.util.List<Selectable> getSelectableItemsAt(float x, float y)
x
, y
) point.protected java.util.List<Selectable> getSelectableItemsIntersectingRectangle(float x0, float y0, float x1, float y1)
x0
,
y0
), (x1
, y1
) opposite corners.public void deleteItems(java.util.List<? extends Selectable> items)
items
in plan and record it as an undoable operation.public void moveItems(java.util.List<? extends Selectable> items, float dx, float dy)
items
of (dx
, dy
) units.protected void selectAndShowItems(java.util.List<? extends Selectable> items)
items
and make them visible at screen.protected void selectItems(java.util.List<? extends Selectable> items)
items
.public void selectItem(Selectable item)
item
.public void addItems(java.util.List<? extends Selectable> items)
items
to home and post an undoable operation.public void addFurniture(java.util.List<HomePieceOfFurniture> furniture)
addFurniture
in class FurnitureController
furniture
- the furniture to add.public void addWalls(java.util.List<Wall> walls)
walls
to home and post an undoable new wall operation.public void addRooms(java.util.List<Room> rooms)
newRooms
to home and post an undoable new room line operation.public void addDimensionLines(java.util.List<DimensionLine> dimensionLines)
dimensionLines
to home and post an undoable new dimension line operation.public void addLabels(java.util.List<Label> labels)
labels
to home and post an undoable new label operation.
© Copyrights 2006-2014 eTeks - All rights reserved
Distributed under GNU General Public License