public class AddPathCommandFactory extends AddCommandFactoryBase implements IPathRepOwner, MouseDownProcessor, MouseMoveProcessor, MouseUpProcessor, ScalingHandler
IPathRepOwner.Mode, IPathRepOwner.VertexState
Modifier and Type | Field and Description |
---|---|
protected boolean |
ctrlPressed
True if the ctrl key is pressed, false otherwise
|
protected SVGSegRep |
danglingSegment
The segment current being edited by the end-user,
but not yet finished
|
protected org.vectomatic.dom.svg.OMSVGGElement |
g
The group where SVG elements representing this
manipulator are nested
|
static IFactoryInstantiator<AddPathCommandFactory> |
INSTANTIATOR |
protected int |
last
Index of the last visible segment in the segment stack
|
protected boolean |
mousePressed
True if the mouse button is pressed, false otherwise
|
protected org.vectomatic.dom.svg.OMSVGPoint |
p0
The mousedown point in user space
|
protected org.vectomatic.dom.svg.OMSVGPathElement |
path
The path representation
|
protected com.google.gwt.event.shared.HandlerRegistration |
scalingHandlerReg
Event registration for the scaling handler
|
protected List<SVGSegRep> |
segments
The path segment representations
|
protected String |
segType
The type of segment about to be added to the path
|
protected org.vectomatic.svg.edit.client.command.add.AddPathCommandFactory.State |
state
The current mode
|
protected org.vectomatic.dom.svg.OMSVGGElement |
tangentGroup
A group for elements representing tangents
|
protected org.vectomatic.dom.svg.OMSVGGElement |
vertexGroup
A group for elements representing vertices
|
oneShot, owner
status
Constructor and Description |
---|
AddPathCommandFactory() |
Modifier and Type | Method and Description |
---|---|
SVGSegRep |
appendSegment(SVGSegRep segRep)
Appends a new segment to the list.
|
void |
clear() |
void |
commit() |
SVGSegRep |
danglingSegment() |
IFactoryInstantiator<?> |
getInstantiator() |
IPathRepOwner.Mode |
getMode() |
int |
getSegCount() |
List<SVGSegRep> |
getSegments() |
org.vectomatic.dom.svg.OMSVGSVGElement |
getSvg() |
SVGSegRep |
lastSegment() |
void |
onScale(ScalingEvent event) |
SVGSegRep |
previousCurve() |
boolean |
processMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)
Processes a mousedown event
|
boolean |
processMouseMove(com.google.gwt.event.dom.client.MouseMoveEvent event)
Processes a mousemove event
|
boolean |
processMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
Processes a mouseup event
|
void |
redoSegment() |
void |
removeDanglingSegment() |
void |
setSegmentType(String segType) |
void |
setState(org.vectomatic.svg.edit.client.command.add.AddPathCommandFactory.State state) |
void |
start(Object requester)
Invoked when the user selects this command factory (through
the command toolbar, the context menu, or implicitely by editing
a field in the inspector).
|
void |
stop()
Invoked when this command factory terminates its lifecycle (on
its own accord or because or because another command factory
preempts it, or because the end-user terminates it)
|
void |
undoSegment() |
void |
update() |
void |
validateSegment(float hs)
Makes the dangling segment permanent
|
applyCssContextStyle, createCommand
getStatus, updateStatus
public static final IFactoryInstantiator<AddPathCommandFactory> INSTANTIATOR
protected org.vectomatic.dom.svg.OMSVGGElement g
protected org.vectomatic.dom.svg.OMSVGGElement tangentGroup
protected org.vectomatic.dom.svg.OMSVGGElement vertexGroup
protected org.vectomatic.dom.svg.OMSVGPathElement path
protected org.vectomatic.svg.edit.client.command.add.AddPathCommandFactory.State state
protected boolean mousePressed
protected boolean ctrlPressed
protected String segType
protected org.vectomatic.dom.svg.OMSVGPoint p0
protected SVGSegRep danglingSegment
protected int last
protected com.google.gwt.event.shared.HandlerRegistration scalingHandlerReg
public IFactoryInstantiator<?> getInstantiator()
getInstantiator
in interface ICommandFactory
public void start(Object requester)
ICommandFactory
start
in interface ICommandFactory
start
in class AddCommandFactoryBase
requester
- The object requesting this command to startpublic void stop()
ICommandFactory
stop
in interface ICommandFactory
stop
in class CommandFactoryBase
public void setSegmentType(String segType)
public void update()
public void undoSegment()
public void redoSegment()
public void commit()
public void clear()
public boolean processMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)
MouseDownProcessor
processMouseDown
in interface MouseDownProcessor
public boolean processMouseMove(com.google.gwt.event.dom.client.MouseMoveEvent event)
MouseMoveProcessor
processMouseMove
in interface MouseMoveProcessor
public boolean processMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
MouseUpProcessor
processMouseUp
in interface MouseUpProcessor
public void setState(org.vectomatic.svg.edit.client.command.add.AddPathCommandFactory.State state)
public org.vectomatic.dom.svg.OMSVGSVGElement getSvg()
getSvg
in interface IPathRepOwner
public List<SVGSegRep> getSegments()
getSegments
in interface IPathRepOwner
public int getSegCount()
public SVGSegRep danglingSegment()
public SVGSegRep lastSegment()
public SVGSegRep previousCurve()
public IPathRepOwner.Mode getMode()
getMode
in interface IPathRepOwner
public SVGSegRep appendSegment(SVGSegRep segRep)
segRep
- The segment to addpublic void validateSegment(float hs)
hs
- The vertex sizepublic void removeDanglingSegment()
public void onScale(ScalingEvent event)
onScale
in interface ScalingHandler
Copyright © 2018. All Rights Reserved.