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:
java.lang.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 java.lang.Comparable<AbstractSegmentHandlePart<? extends javafx.scene.Node>>
AnAbstractSegmentHandlePartis bound to a segment of a poly-bezier handle geometry, represented by an array ofBezierCurves. The segmentIndex of theAbstractSegmentHandlePartidentifies that segment (0, 1, 2, ...). The segmentParameter specifies the position of this handle part on the segment (0 = start, 0.5 = mid, 1 = end).
-
-
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
Constructors Constructor Description AbstractSegmentHandlePart()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(AbstractSegmentHandlePart<? extends javafx.scene.Node> o)voiddoRefreshVisual(N visual)Refreshes this part's visualization based on this part's content.protected BezierCurvegetBezierSegmentInParent()Returns theBezierCurveat which this handle part is anchored (depending on segment index), ornullif thatBezierCurvecannot be determined.protected javafx.scene.paint.ColorgetConnectedFill()Returns theColorthat is used to fill connected handles.protected javafx.scene.paint.ColorgetInsertFill()Returns theColorthat is used to fill insertion handles.protected javafx.scene.paint.ColorgetMoveFill()Returns theColorthat is used to fill movement handles.protected PointgetPosition(BezierCurve segment)Returns the position of thisAbstractSegmentHandleParton the given segment using the segment parameter that is assigned to this part.intgetSegmentCount()Returns the number of segments that are provided to this part.intgetSegmentIndex()The segmentIndex specifies the segment of the IGeometry provided by the handle geometry provider on which this selection handle part is positioned.doublegetSegmentParameter()The segmentParameter is a value between 0 and 1.protected BezierCurve[]getSegmentsInScene()Returns theBezierCurves that are provided to this part in the coordinate system of theScene.protected javafx.scene.paint.ColorgetStroke()Returns theColorthat is used to stroke handles.voidsetSegmentIndex(int segmentIndex)Sets the segment index and refreshes the visual.voidsetSegmentParameter(double segmentParameter)Sets the segment parameter and refreshes the visual.voidsetSegmentsProvider(Provider<BezierCurve[]> segmentsProvider)Sets theProvider<BezierCurve[]>for this part to the given value.protected voidupdateLocation(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
-
-
-
-
Method Detail
-
compareTo
public int compareTo(AbstractSegmentHandlePart<? extends javafx.scene.Node> o)
- Specified by:
compareToin interfacejava.lang.Comparable<N extends javafx.scene.Node>
-
doRefreshVisual
public void doRefreshVisual(N visual)
Description copied from class:AbstractVisualPartRefreshes this part's visualization based on this part's content.- Specified by:
doRefreshVisualin classAbstractVisualPart<N extends javafx.scene.Node>- Parameters:
visual- This part's visual.
-
getBezierSegmentInParent
protected BezierCurve getBezierSegmentInParent()
Returns theBezierCurveat which this handle part is anchored (depending on segment index), ornullif thatBezierCurvecannot be determined.- Returns:
- The
BezierCurveat which this handle part is anchored, ornullif thatBezierCurvecannot be determined.
-
getConnectedFill
protected javafx.scene.paint.Color getConnectedFill()
Returns theColorthat is used to fill connected handles.- Returns:
- The
Colorthat is used to fill connected handles.
-
getInsertFill
protected javafx.scene.paint.Color getInsertFill()
Returns theColorthat is used to fill insertion handles.- Returns:
- The
Colorthat is used to fill insertion handles.
-
getMoveFill
protected javafx.scene.paint.Color getMoveFill()
Returns theColorthat is used to fill movement handles.- Returns:
- The
Colorthat is used to fill movement handles.
-
getPosition
protected Point getPosition(BezierCurve segment)
Returns the position of thisAbstractSegmentHandleParton the given segment using the segment parameter that is assigned to this part.- Parameters:
segment- TheBezierCurveon 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
protected BezierCurve[] getSegmentsInScene()
Returns theBezierCurves that are provided to this part in the coordinate system of theScene.- Returns:
- The
BezierCurves that are provided to this part in the coordinate system of theScene.
-
getStroke
protected javafx.scene.paint.Color getStroke()
Returns theColorthat is used to stroke handles.- Returns:
- The
Colorthat 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:
getSegmentIndex()
-
setSegmentParameter
public void setSegmentParameter(double segmentParameter)
Sets the segment parameter and refreshes the visual.- Parameters:
segmentParameter- The segment parameter to set.- See Also:
getSegmentParameter()
-
setSegmentsProvider
public void setSegmentsProvider(Provider<BezierCurve[]> segmentsProvider)
Sets theProvider<BezierCurve[]>for this part to the given value.- Parameters:
segmentsProvider- The newProvider<BezierCurve[]>for this part.
-
updateLocation
protected void updateLocation(N visual)
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.
-
-