public final class SegmentRatioPortLocationModel extends Object implements IPortLocationModel
| Modifier and Type | Field and Description |
|---|---|
static SegmentRatioPortLocationModel |
INSTANCE
A static immutable global instance of this class.
|
| Constructor and Description |
|---|
SegmentRatioPortLocationModel() |
| Modifier and Type | Method and Description |
|---|---|
IPortLocationModelParameter |
createFromSource(double ratio,
int segmentIndex)
Creates the a new parameter for the specified segment index and ratio.
|
IPortLocationModelParameter |
createFromTarget(double ratio,
int segmentIndex)
Creates the a new parameter for the specified segment index counted from the target end of the edge and the provided
ratio.
|
IPortLocationModelParameter |
createParameter(IPortOwner owner,
PointD location)
Factory method that creates a parameter for the given port that tries to match the provided location in absolute world
coordinates.
|
ILookup |
getContext(IPort port,
IPortLocationModelParameter locationParameter)
Provides a
lookup context for the given combination of port and parameter. |
PointD |
getLocation(IPort port,
IPortLocationModelParameter locationParameter)
Determines the location of the port for the given parameter.
|
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookuppublic static final SegmentRatioPortLocationModel INSTANCE
public final IPortLocationModelParameter createFromSource(double ratio, int segmentIndex)
ratio - The ratio for the segment, with 0 being at the start of the segment and 1 at the end.segmentIndex - The index of the segment.public final IPortLocationModelParameter createFromTarget(double ratio, int segmentIndex)
ratio - The ratio for the segment, with 0 being at the start of the segment and 1 at the end.segmentIndex - The index of the segment counted from the target end.public final IPortLocationModelParameter createParameter(IPortOwner owner, PointD location)
IPortLocationModelcreateParameter in interface IPortLocationModelowner - The port owner that will own the port for which the parameter shall be created.location - The location in the world coordinate system that should be matched as best as possible.IPort at the given owner.public final ILookup getContext(IPort port, IPortLocationModelParameter locationParameter)
IPortLocationModellookup context for the given combination of port and parameter.getContext in interface IPortLocationModelport - The port to use in the context.locationParameter - The parameter to use for the port in the context.ILookup interface that can be used to query additional aspects of the port/parameter
combination.public final PointD getLocation(IPort port, IPortLocationModelParameter locationParameter)
IPortLocationModelgetLocation in interface IPortLocationModelport - The port to determine the location for.locationParameter - The parameter to use. The parameter can be expected to be created by this instance having the Model
property set to this instance..public final <TLookup> TLookup lookup(Class<TLookup> type)
ILookupnull.
Typically, this method will be called in order to obtain a different view or
aspect of the current instance. This is quite similar to casting or using
a super type or interface of this instance, but is not limited to inheritance or
compile time constraints. An instance implementing this method is not
required to return non-null implementations for the types, nor does it
have to return the same instance any time. Also it depends on the
type and context whether the instance returned stays up to date or needs to
be reobtained for subsequent use.