Class Highway

java.lang.Object
com._1c.g5.v8.dt.common.gef.drow2d.Highway

public class Highway extends Object
The horizontal or vertical line (probably bounded by one or both ends) not crossing an obstacle.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Highway(int start, int end, int position, boolean type)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    static Highway
    createHorizontal(int x, int y, int length)
    Static factory method creting horizontal Highway using point and length.
    static Highway
    createVertical(int x, int y, int length)
    Static factory method creting vertival Highway using point and length.
    boolean
     
    int
    Gets the end position.
    org.eclipse.draw2d.geometry.Point
    Gets the intersection point.
    int
    Gets the y position in case horizontal or x otherwise
    int
    Gets the start position.
    org.eclipse.draw2d.geometry.Point
    Gets the start point
    int
     
    boolean
    Whether is horisontal highway?
    boolean
    Checks, whether has crossing with other highway.
    boolean
    Whether is vertical highway
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Highway

      protected Highway(int start, int end, int position, boolean type)
      Constructor
      Parameters:
      start - the start position. x in case horizontal or y otherwise
      end - the end position. x in case horizontal or y otherwise
      position - the y position in case horizontal or x otherwise
      type - true - horizontal, false vertical
  • Method Details

    • createHorizontal

      public static Highway createHorizontal(int x, int y, int length)
      Static factory method creting horizontal Highway using point and length. Use Integer.MIN_VALUE and Integer.MAX_VALUE foor creating unlimited end.

      Examples:
      createHorizontal(-100, 100, 200):
          line segment [point(-100, 100), point(100, 100)]
      createHorizontal(Integer.MIN_VALUE, 100, 200-Integer.MIN_VALUE):
          line segment [point(-INFINITY, 200), point(100, 200)]
      createHorizontal(-200, 100, Integer.MAX_VALUE-(-200)):
          line segment [point(-200, 100), point(INFINITY, 200)]

      Parameters:
      x - - x coordinate of the point
      y - - y coordinate of the point
      length - - length
      Returns:
      horizontal Highway
    • createVertical

      public static Highway createVertical(int x, int y, int length)
      Static factory method creting vertival Highway using point and length. Use Integer.MIN_VALUE and Integer.MAX_VALUE foor creating unlimited end.

      Examples:
      createVertical(-100, 100, 200):
          line segment [point(-100, 100), point(-100, 300)]
      createVertical(100, Integer.MIN_VALUE, 200-Integer.MIN_VALUE):
          line segment [point(100, -INFINITY), point(100, 200)]
      createVertical(-200, -100, Integer.MAX_VALUE-(-100)):
          line segment [point(-200, -100), point(-200, INFINITY)]

      Parameters:
      x - - x coordinate of the point
      y - - y coordinate of the point
      length - - length
      Returns:
      horizontal Highway
    • getStart

      public int getStart()
      Gets the start position. x in case horizontal or y otherwise
      Returns:
      the start position. x in case horizontal or y otherwise
    • getEnd

      public int getEnd()
      Gets the end position. x in case horizontal or y otherwise
      Returns:
      the end position. x in case horizontal or y otherwise
    • getPosition

      public int getPosition()
      Gets the y position in case horizontal or x otherwise
      Returns:
      the y position in case horizontal or x otherwise
    • isHorizontal

      public boolean isHorizontal()
      Whether is horisontal highway?
      Returns:
      whether is horisontal highway?
    • isVertical

      public boolean isVertical()
      Whether is vertical highway
      Returns:
      whether is vertical highway
    • getStartPoint

      public org.eclipse.draw2d.geometry.Point getStartPoint()
      Gets the start point
      Returns:
      the start point
    • isIntersect

      public boolean isIntersect(Highway other)
      Checks, whether has crossing with other highway.
      Returns:
      the start point
    • getIntersection

      public org.eclipse.draw2d.geometry.Point getIntersection(Highway other)
      Gets the intersection point.

      NOTE: Invalid in case highways has not intersection. Call isIntersect(Highway) before.

      Parameters:
      other - other hightway
      Returns:
      the intersection point
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object