This class can be used to easily model an orthogonal borderline or sky-line.
Remarks
Type Details
- yFiles module
- algorithms
Constructors
Initializes a new instance of the BorderLine class, representing a single segment that extends from the lowest possible position (-Number.MAX_VALUE) to the highest possible position (+ Number.MAX_VALUE) with a constant value.
Parameters
A map of options to pass to the method.
- value - number
- the value of the segment
Initializes a new instance of the BorderLine class, representing a single segment that extends from the specified min
position to the specified max
position with a constant value.
Parameters
A map of options to pass to the method.
- min - number
- The starting position of the BorderLine
- max - number
- The ending position of the BorderLine
- value - number
- The value of the segment
Initializes a new instance of the BorderLine class, representing a single segment that extends from the specified min
position to the specified max
position.
Parameters
A map of options to pass to the method.
- min - number
- The starting position of the BorderLine
- max - number
- The ending position of the BorderLine
- valueAtMin - number
- The value at the starting position of the segment
- valueAtMax - number
- The value at the ending position of the segment
Properties
Returns the first segment or null
if there is no such segment.
Returns the last segment or null
if there is no such segment.
Methods
Creates a copy of this borderline, optionally negating the values or offsets
Parameters
A map of options to pass to the method.
- negateValues - boolean
- whether the values are negated
- negateOffsets - boolean
- whether the offsets are negated
Returns
- ↪BorderLine
- the copy of the borderline
Merges this borderline with the given borderline using the "maximum" policy.
Remarks
Parameters
A map of options to pass to the method.
- other - BorderLine
- the other borderline
Returns
- ↪BorderLine
- a new borderline that is the result of the merge
Merges this borderline with the given borderline using the "minimum" policy.
Remarks
Parameters
A map of options to pass to the method.
- other - BorderLine
- the other borderline
Returns
- ↪BorderLine
- a new borderline that is the result of the merge
Enlarges this borderline horizontally, so that the values of the borderline stay the same however their starting and ending positions are moved in the direction of toMin
and toMax
.
Remarks
This is useful for scenarios where a borderline is needed that consists of an enlarged border.
Note that this method normalizes the segments, i.e., it transforms each segment with slope != 0
to a segment with slope == 0
.
Parameters
A map of options to pass to the method.
- toMin - number
- the delta by which the border should be extended towards -Infinity
- toMax - number
- the delta by which the border should be extended towards +Infinity
- positive - boolean
- whether the borderline should be interpreted to point in positive direction. This influences the direction into which a segment's border is extended.
Calculates the minimum distance between this borderline and the other one.
Remarks
Parameters
A map of options to pass to the method.
- greater - BorderLine
- The other borderline to which the distance is calculated.
Returns
- ↪number
- The minimum distance between this borderline and the other one.
Returns the highest position of the given segment.
Parameters
A map of options to pass to the method.
- segment - BorderLineSegment
- The segment
Returns
- ↪number
- The highest position of the given segment.
Calculates the maximum value in the interval specified by position from
and position to
.
Parameters
A map of options to pass to the method.
- from - number
- The starting position of the interval.
- to - number
- The ending position of the interval.
Returns
- ↪number
- The maximum value in the interval specified by position
from
and positionto
.
from
value is larger or equal to the to
value, the algorithm always returns -Number.MAX_VALUE.Returns the lowest position of the given segment.
Parameters
A map of options to pass to the method.
- segment - BorderLineSegment
- The segment
Returns
- ↪number
- The lowest position of the given segment.
Calculates the minimum value in the interval specified by position from
and position to
.
Parameters
A map of options to pass to the method.
- from - number
- The starting position of the interval.
- to - number
- The ending position of the interval.
Returns
- ↪number
- The minimum value in the interval specified by position
from
and positionto
.
from
value is larger or equal to the to
value, the algorithm always returns Number.MAX_VALUE.Returns the segment at the given position.
Parameters
A map of options to pass to the method.
- position - number
- The position
Returns
- ↪BorderLineSegment?
- The segment at the given position.
Returns the slope of the given segment.
Parameters
A map of options to pass to the method.
- segment - BorderLineSegment
- The segment
Returns
- ↪number
- The slope of the given segment.
Returns the value at the lowest position of the given segment.
Remarks
0
, it is the value of the whole segment. In case the slope differs from 0
, it is the value of the start of the slope.Parameters
A map of options to pass to the method.
- segment - BorderLineSegment
- The segment
Returns
- ↪number
- The value at the lowest position of the given segment.
Returns the value that is set on this borderline at the specified position.
Parameters
A map of options to pass to the method.
- position - number
- The position for which the value is to be returned
Returns
- ↪number
- The value
Throws
- Exception({ name: 'IndexOutOfRangeError' })
- If the position is outside the borderline.
Returns the value that is set on this borderline at the specified position.
Remarks
Parameters
A map of options to pass to the method.
- segment - BorderLineSegment
- The segment for which the value is to be returned
- position - number
- The position for which the value is to be returned
Returns
- ↪number
- The value
Throws
- Exception({ name: 'ArgumentError' })
- if
position
is outside the segment's range.
Merges this borderline with the given borderline using the "maximum" policy.
Parameters
A map of options to pass to the method.
- other - BorderLine
- the other borderline
Merges this borderline with the given borderline using the "minimum" policy.
Parameters
A map of options to pass to the method.
- other - BorderLine
- the other borderline
Assures that all values in the given interval are greater than or equal to the given value.
Parameters
A map of options to pass to the method.
- min - number
- the lower position of the interval
- max - number
- the upper position of the interval
- value - number
- the smallest possible value for the interval
Assures that all values in the given interval are less than or equal to the given value.
Parameters
A map of options to pass to the method.
- min - number
- the lower position of the interval
- max - number
- the upper position of the interval
- value - number
- the greatest possible value for the interval
Sets a specific interval specified by position min
and position max
to a slope starting at a given value.
Parameters
A map of options to pass to the method.
- min - number
- The lower position of the interval.
- max - number
- The upper position of the interval.
- value - number
- The value at
min
where the slope starts. - slope - number
- The slope of the segment in the given interval.
Throws
- Exception({ name: 'ArgumentError' })
- If
min
is greater thanmax
.
Sets a specific interval specified by position min
and position max
to a given value.
Parameters
A map of options to pass to the method.
- min - number
- The lower position of the interval.
- max - number
- The upper position of the interval.
- value - number
- The value for the whole interval.