Packagenet.systemeD.potlatch2.controller
Classpublic class ControllerState
SubclassesDragBackground, DragSelection, DragWayNode, DrawQuadrilateral, NoSelection, SelectArea, SelectedMarker, SelectedMultiple, SelectedPOINode, SelectedWay, SelectedWayNode

Represents a particular state of the controller, such as "dragging a way" or "nothing selected". Key methods are processKeyboardEvent and processMouseEvent which take some action, and return a new state for the controller. This abstract class has some behaviour that applies in most states, and lots of 'null' behaviour.



Public Properties
 PropertyDefined by
  firstSelected : Entity
[read-only]
ControllerState
  layer : MapPaint
ControllerState
  map : Map
[read-only] Retrieves the map associated with the current EditController
ControllerState
  selectCount : uint
[read-only]
ControllerState
  selectedNodes : Array
[read-only]
ControllerState
  selectedWay : Way
[read-only]
ControllerState
  selectedWays : Array
[read-only]
ControllerState
  selection : Array
ControllerState
Protected Properties
 PropertyDefined by
  controller : EditController
ControllerState
  previousState : ControllerState
ControllerState
  _selection : Array
ControllerState
Public Methods
 MethodDefined by
  
ControllerState
  
addToSelection(items:Array):void
ControllerState
  
enterState():void
This is called when the EditController sets this ControllerState as the active state.
ControllerState
  
exitState(newState:ControllerState):void
This is called by the EditController as the current controllerstate is exiting.
ControllerState
  
[static] Gets the way that the selected node is part of, if that makes sense.
ControllerState
  
hasAdjoiningWays():Boolean
ControllerState
  
hasSelectedAreas():Boolean
ControllerState
  
ControllerState
  
Determine whether or not any nodes are selected, and if so whether any of them belong to areas.
ControllerState
  
hasSelectedWays():Boolean
ControllerState
  
isSelectionState():Boolean
ControllerState
  
processKeyboardEvent(event:KeyboardEvent):ControllerState
When triggered by a keypress, perform an action on the given entity, then move to a new state.
ControllerState
  
processMouseEvent(event:MouseEvent, entity:Entity):ControllerState
When triggered by a mouse action such as a click, perform an action on the given entity, then move to a new state.
ControllerState
  
removeFromSelection(items:Array):void
ControllerState
  
setController(controller:EditController):void
ControllerState
  
setPreviousState(previousState:ControllerState):void
ControllerState
  
toggleSelection(item:Entity):Boolean
ControllerState
  
toString():String
Represent the state in text for debugging.
ControllerState
Protected Methods
 MethodDefined by
  
getMapPaint(d:DisplayObject):MapPaint
Find the MapPaint object that this DisplayObject belongs to.
ControllerState
  
getNodeIndex(way:Way, node:Node):uint
ControllerState
  
repeatTags(object:Entity):void
Create a "repeat tags" action on the current entity, if possible.
ControllerState
  
revertHandler(event:CloseEvent):void
ControllerState
  
Revert all selected items to previously saved state, via a dialog box.
ControllerState
  
setSourceTag():void
Create an action to add "source= tag to current entity based on background imagery.
ControllerState
  
sharedKeyboardEvents(event:KeyboardEvent):ControllerState
Default behaviour for the current state that should be called if state-specific action has been taken care of or ruled out.
ControllerState
  
sharedMouseEvents(event:MouseEvent, entity:Entity):ControllerState
Default behaviour for the current state that should be called if state-specific action has been taken care of or ruled out.
ControllerState
Property detail
controllerproperty
protected var controller:EditController
firstSelectedproperty 
firstSelected:Entity  [read-only]Implementation
    public function get firstSelected():Entity
layerproperty 
public var layer:MapPaint
mapproperty 
map:Map  [read-only]

Retrieves the map associated with the current EditController

Implementation
    public function get map():Map
previousStateproperty 
protected var previousState:ControllerState
selectCountproperty 
selectCount:uint  [read-only]Implementation
    public function get selectCount():uint
selectedNodesproperty 
selectedNodes:Array  [read-only]Implementation
    public function get selectedNodes():Array
selectedWayproperty 
selectedWay:Way  [read-only]Implementation
    public function get selectedWay():Way
selectedWaysproperty 
selectedWays:Array  [read-only]Implementation
    public function get selectedWays():Array
_selectionproperty 
protected var _selection:Array
selectionproperty 
selection:Array  [read-write]Implementation
    public function get selection():Array
    public function set selection(value:Array):void
Constructor detail
ControllerState()constructor
public function ControllerState()
Method detail
addToSelection()method
public function addToSelection(items:Array):voidParameters
items:Array
enterState()method 
public function enterState():void

This is called when the EditController sets this ControllerState as the active state. Override this with whatever is needed, such as adding highlights to entities

exitState()method 
public function exitState(newState:ControllerState):void

This is called by the EditController as the current controllerstate is exiting. Override this with whatever cleanup is needed, such as removing highlights from entities

Parameters
newState:ControllerState
getMapPaint()method 
protected function getMapPaint(d:DisplayObject):MapPaint

Find the MapPaint object that this DisplayObject belongs to.

Parameters
d:DisplayObject

Returns
MapPaint
getNodeIndex()method 
protected function getNodeIndex(way:Way, node:Node):uintParameters
way:Way
 
node:Node

Returns
uint
getTopLevelFocusEntity()method 
public static function getTopLevelFocusEntity(entity:Entity):Entity

Gets the way that the selected node is part of, if that makes sense. If not, return the node, or the way, or nothing.

Parameters
entity:Entity

Returns
Entity
hasAdjoiningWays()method 
public function hasAdjoiningWays():Boolean

Returns
Boolean
hasSelectedAreas()method 
public function hasSelectedAreas():Boolean

Returns
Boolean
hasSelectedUnclosedWays()method 
public function hasSelectedUnclosedWays():Boolean

Returns
Boolean
hasSelectedWayNodesInAreas()method 
public function hasSelectedWayNodesInAreas():Boolean

Determine whether or not any nodes are selected, and if so whether any of them belong to areas.

Returns
Boolean
hasSelectedWays()method 
public function hasSelectedWays():Boolean

Returns
Boolean
isSelectionState()method 
public function isSelectionState():Boolean

Returns
Boolean
processKeyboardEvent()method 
public function processKeyboardEvent(event:KeyboardEvent):ControllerState

When triggered by a keypress, perform an action on the given entity, then move to a new state.

Parameters
event:KeyboardEvent

Returns
ControllerState
processMouseEvent()method 
public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState

When triggered by a mouse action such as a click, perform an action on the given entity, then move to a new state.

Parameters
event:MouseEvent
 
entity:Entity

Returns
ControllerState
removeFromSelection()method 
public function removeFromSelection(items:Array):voidParameters
items:Array
repeatTags()method 
protected function repeatTags(object:Entity):void

Create a "repeat tags" action on the current entity, if possible.

Parameters
object:Entity
revertHandler()method 
protected function revertHandler(event:CloseEvent):voidParameters
event:CloseEvent
revertSelection()method 
protected function revertSelection():void

Revert all selected items to previously saved state, via a dialog box.

setController()method 
public function setController(controller:EditController):voidParameters
controller:EditController
setPreviousState()method 
public function setPreviousState(previousState:ControllerState):voidParameters
previousState:ControllerState
setSourceTag()method 
protected function setSourceTag():void

Create an action to add "source= tag to current entity based on background imagery. This is a convenient shorthand for users.

sharedKeyboardEvents()method 
protected function sharedKeyboardEvents(event:KeyboardEvent):ControllerState

Default behaviour for the current state that should be called if state-specific action has been taken care of or ruled out.

Parameters
event:KeyboardEvent

Returns
ControllerState
sharedMouseEvents()method 
protected function sharedMouseEvents(event:MouseEvent, entity:Entity):ControllerState

Default behaviour for the current state that should be called if state-specific action has been taken care of or ruled out.

Parameters
event:MouseEvent
 
entity:Entity

Returns
ControllerState
toggleSelection()method 
public function toggleSelection(item:Entity):BooleanParameters
item:Entity

Returns
Boolean
toString()method 
public function toString():String

Represent the state in text for debugging.

Returns
String