Package org.eclipse.gef.mvc.fx.parts
Class AbstractSegmentHandlePart<N extends javafx.scene.Node>
java.lang.Object
org.eclipse.gef.mvc.fx.parts.AbstractVisualPart<V>
org.eclipse.gef.mvc.fx.parts.AbstractHandlePart<N>
org.eclipse.gef.mvc.fx.parts.AbstractSegmentHandlePart<N>
- Type Parameters:
N
- The type of visual used by this handle. Needs to be a sub-type ofNode
.
- All Implemented Interfaces:
Comparable<AbstractSegmentHandlePart<? extends javafx.scene.Node>>
,IActivatable
,IAdaptable
,IAdaptable.Bound<IViewer>
,IDisposable
,IHandlePart<N>
,IVisualPart<N>
- Direct Known Subclasses:
CircleSegmentHandlePart
,RectangleSegmentHandlePart
,SquareSegmentHandlePart
public abstract class AbstractSegmentHandlePart<N extends javafx.scene.Node>
extends AbstractHandlePart<N>
implements Comparable<AbstractSegmentHandlePart<? extends javafx.scene.Node>>
An
AbstractSegmentHandlePart
is bound to a segment of a poly-bezier
handle geometry, represented by an array of BezierCurve
s. The
segmentIndex of the AbstractSegmentHandlePart
identifies that segment
(0, 1, 2, ...). The segmentParameter specifies the position of this handle
part on the segment (0 = start, 0.5 = mid, 1 = end).-
Property Summary
Properties inherited from class org.eclipse.gef.mvc.fx.parts.AbstractVisualPart
active, adaptable, adapters, anchoragesUnmodifiable, anchoredsUnmodifiable, childrenUnmodifiable, parent, refreshVisual
Properties inherited from interface org.eclipse.gef.common.activate.IActivatable
active
Properties inherited from interface org.eclipse.gef.common.adapt.IAdaptable
adapters
Properties inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
adaptable
Properties inherited from interface org.eclipse.gef.mvc.fx.parts.IVisualPart
anchoragesUnmodifiable, anchoredsUnmodifiable, childrenUnmodifiable, parent, refreshVisual
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable
IAdaptable.Bound<A extends IAdaptable>
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
IAdaptable.Bound.Impl<T extends IAdaptable>
-
Field Summary
Fields inherited from interface org.eclipse.gef.common.activate.IActivatable
ACTIVE_PROPERTY
Fields inherited from interface org.eclipse.gef.common.adapt.IAdaptable
ADAPTERS_PROPERTY
Fields inherited from interface org.eclipse.gef.mvc.fx.parts.IVisualPart
ANCHORAGES_PROPERTY, ANCHOREDS_PROPERTY, CHILDREN_PROPERTY, PARENT_PROPERTY, REFRESH_VISUAL_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(AbstractSegmentHandlePart<? extends javafx.scene.Node> o) void
doRefreshVisual
(N visual) Refreshes this part's visualization based on this part's content.protected BezierCurve
Returns theBezierCurve
at which this handle part is anchored (depending on segment index), ornull
if thatBezierCurve
cannot be determined.protected javafx.scene.paint.Color
Returns theColor
that is used to fill connected handles.protected javafx.scene.paint.Color
Returns theColor
that is used to fill insertion handles.protected javafx.scene.paint.Color
Returns theColor
that is used to fill movement handles.protected Point
getPosition
(BezierCurve segment) Returns the position of thisAbstractSegmentHandlePart
on the given segment using the segment parameter that is assigned to this part.int
Returns the number of segments that are provided to this part.int
The segmentIndex specifies the segment of the IGeometry provided by the handle geometry provider on which this selection handle part is positioned.double
The segmentParameter is a value between 0 and 1.protected BezierCurve[]
Returns theBezierCurve
s that are provided to this part in the coordinate system of theScene
.protected javafx.scene.paint.Color
Returns theColor
that is used to stroke handles.void
setSegmentIndex
(int segmentIndex) Sets the segment index and refreshes the visual.void
setSegmentParameter
(double segmentParameter) Sets the segment parameter and refreshes the visual.void
setSegmentsProvider
(Provider<BezierCurve[]> segmentsProvider) Sets theProvider<BezierCurve[]>
for this part to the given value.protected void
updateLocation
(N visual) Computes the location for this part and relocates its visual to that location.Methods inherited from class org.eclipse.gef.mvc.fx.parts.AbstractHandlePart
doAddChildVisual, doAttachToAnchorageVisual, doDetachFromAnchorageVisual, doRemoveChildVisual
Methods inherited from class org.eclipse.gef.mvc.fx.parts.AbstractVisualPart
activate, activateAdapters, activateChildren, activeProperty, adaptableProperty, adaptersProperty, addChild, addChild, addChildren, addChildren, anchoragesUnmodifiableProperty, anchoredsUnmodifiableProperty, attachAnchored, attachToAnchorage, attachToAnchorage, childrenUnmodifiableProperty, deactivate, deactivateAdapters, deactivateChildren, detachAnchored, detachFromAnchorage, detachFromAnchorage, determineViewer, dispose, doActivate, doCreateVisual, doDeactivate, getAdaptable, getAdapter, getAdapter, getAdapter, getAdapterKey, getAdapters, getAdapters, getAdapters, getAnchoragesUnmodifiable, getAnchoredsUnmodifiable, getBehaviors, getChildrenUnmodifiable, getHandlers, getParent, getPolicies, getRoot, getVisual, isActive, isRefreshVisual, parentProperty, refreshVisual, refreshVisualProperty, register, registerAtVisualPartMap, removeChild, removeChildren, reorderChild, setAdaptable, setAdapter, setAdapter, setAdapter, setAdapter, setParent, setRefreshVisual, unregister, unregisterFromVisualPartMap, unsetAdapter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.gef.common.activate.IActivatable
activate, activeProperty, deactivate, isActive
Methods inherited from interface org.eclipse.gef.common.adapt.IAdaptable
adaptersProperty, getAdapter, getAdapter, getAdapter, getAdapterKey, getAdapters, getAdapters, getAdapters, setAdapter, setAdapter, setAdapter, setAdapter, unsetAdapter
Methods inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
adaptableProperty, getAdaptable, setAdaptable
Methods inherited from interface org.eclipse.gef.common.dispose.IDisposable
dispose
Methods inherited from interface org.eclipse.gef.mvc.fx.parts.IVisualPart
addChild, addChild, addChildren, addChildren, anchoragesUnmodifiableProperty, anchoredsUnmodifiableProperty, attachAnchored, attachToAnchorage, attachToAnchorage, childrenUnmodifiableProperty, detachAnchored, detachFromAnchorage, detachFromAnchorage, getAnchoragesUnmodifiable, getAnchoredsUnmodifiable, getBehaviors, getChildrenUnmodifiable, getHandlers, getParent, getPolicies, getRoot, getViewer, getVisual, isRefreshVisual, parentProperty, refreshVisual, refreshVisualProperty, removeChild, removeChildren, reorderChild, setParent, setRefreshVisual
-
Constructor Details
-
AbstractSegmentHandlePart
public AbstractSegmentHandlePart()
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<N extends javafx.scene.Node>
-
doRefreshVisual
Description copied from class:AbstractVisualPart
Refreshes this part's visualization based on this part's content.- Specified by:
doRefreshVisual
in classAbstractVisualPart<N extends javafx.scene.Node>
- Parameters:
visual
- This part's visual.
-
getBezierSegmentInParent
Returns theBezierCurve
at which this handle part is anchored (depending on segment index), ornull
if thatBezierCurve
cannot be determined.- Returns:
- The
BezierCurve
at which this handle part is anchored, ornull
if thatBezierCurve
cannot be determined.
-
getConnectedFill
protected javafx.scene.paint.Color getConnectedFill()Returns theColor
that is used to fill connected handles.- Returns:
- The
Color
that is used to fill connected handles.
-
getInsertFill
protected javafx.scene.paint.Color getInsertFill()Returns theColor
that is used to fill insertion handles.- Returns:
- The
Color
that is used to fill insertion handles.
-
getMoveFill
protected javafx.scene.paint.Color getMoveFill()Returns theColor
that is used to fill movement handles.- Returns:
- The
Color
that is used to fill movement handles.
-
getPosition
Returns the position of thisAbstractSegmentHandlePart
on the given segment using the segment parameter that is assigned to this part.- Parameters:
segment
- TheBezierCurve
on which the position is evaluated.- Returns:
- The position of this part on the given segment using the segment parameter of this part.
-
getSegmentCount
public int getSegmentCount()Returns the number of segments that are provided to this part.- Returns:
- The number of segments that are provided to this part.
-
getSegmentIndex
public int getSegmentIndex()The segmentIndex specifies the segment of the IGeometry provided by the handle geometry provider on which this selection handle part is positioned. For a shape geometry, segments are determined by theIShape.getOutlineSegments()
method. For a curve geometry, segments are determined by theICurve.toBezier()
method. The exact position on the segment is specified by thesegmentParameter
.- Returns:
- segmentIndex
-
getSegmentParameter
public double getSegmentParameter()The segmentParameter is a value between 0 and 1. It determines the final point on the segment which this selection handle part belongs to.- Returns:
- segmentParameter
-
getSegmentsInScene
Returns theBezierCurve
s that are provided to this part in the coordinate system of theScene
.- Returns:
- The
BezierCurve
s that are provided to this part in the coordinate system of theScene
.
-
getStroke
protected javafx.scene.paint.Color getStroke()Returns theColor
that is used to stroke handles.- Returns:
- The
Color
that is used to stroke handles.
-
setSegmentIndex
public void setSegmentIndex(int segmentIndex) Sets the segment index and refreshes the visual.- Parameters:
segmentIndex
- The segment index to set.- See Also:
-
setSegmentParameter
public void setSegmentParameter(double segmentParameter) Sets the segment parameter and refreshes the visual.- Parameters:
segmentParameter
- The segment parameter to set.- See Also:
-
setSegmentsProvider
Sets theProvider<BezierCurve[]>
for this part to the given value.- Parameters:
segmentsProvider
- The newProvider<BezierCurve[]>
for this part.
-
updateLocation
Computes the location for this part and relocates its visual to that location. The visual is made invisible if this part has an invalid index (out of bounds), i.e. when no location can be computed.- Parameters:
visual
- This part's visual for convenience.
-