Class Position
- java.lang.Object
-
- com._1c.g5.v8.dt.common.gef.drow2d.Position
-
public class Position extends Object
The position information: - point - direction - assigned obstacle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPosition.DirectionEnumeration of the rectilinear directions (UP, RIGHT, DOWN, LEFT)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Positioncreate(org.eclipse.draw2d.geometry.Rectangle obstacle, org.eclipse.draw2d.geometry.Point point)Factory method for create new instance of thePositionusingpointandobstacle.PositiongetCopy()Position.DirectiongetDirection()Gets the directionorg.eclipse.draw2d.geometry.RectanglegetObstacle()Gets the obstacle: the area assigned with figure - source of the rayorg.eclipse.draw2d.geometry.PointgetPoint()Gets the pointbooleanisHorizontal()Checks, isdirectionnot specified or horizontalbooleanisVertical()Checks, isdirectionnot specified or verticalPositionmoveOnDirection(int length)Shifts the start point by the specifiedlengthusing the current direction.StringtoString()Returns the string in the format: "(<x>,<y>) <direction>"
-
-
-
Method Detail
-
getPoint
public org.eclipse.draw2d.geometry.Point getPoint()
Gets the point- Returns:
- the point
-
getDirection
public Position.Direction getDirection()
Gets the direction- Returns:
- the direction
-
getObstacle
public org.eclipse.draw2d.geometry.Rectangle getObstacle()
Gets the obstacle: the area assigned with figure - source of the ray- Returns:
- the obstacle: the area assigned with figure - source of the ray
-
isHorizontal
public boolean isHorizontal()
Checks, isdirectionnot specified or horizontal- Returns:
truein case direction not specified or horizontal andfalseotherwise
-
isVertical
public boolean isVertical()
Checks, isdirectionnot specified or vertical- Returns:
truein case direction not specified or vertical andfalseotherwise
-
create
public static Position create(org.eclipse.draw2d.geometry.Rectangle obstacle, org.eclipse.draw2d.geometry.Point point)
Factory method for create new instance of thePositionusingpointandobstacle. Calculates the rectangle side nearest to a point and sets the ray direction to opposite. Ifobstacleisnullthen Ray with empty direction will created.- Parameters:
obstacle- the area assigned with figure - source of the raypoint- the point of ray- Returns:
- new instance of the
Position
-
getCopy
public Position getCopy()
- Returns:
- a copy of this Position
-
moveOnDirection
public Position moveOnDirection(int length)
Shifts the start point by the specifiedlengthusing the current direction.- Parameters:
length- - a length- Returns:
thisfor convenience
-
-