Пример #1
0
 public boolean equals(Object object) {
   if (!(object instanceof ShapeEdge)) return false;
   ShapeEdge edge = (ShapeEdge) object;
   if (startPoint.equals(edge.getStartPoint()) && endPoint.equals(edge.getEndPoint())) return true;
   if (startPoint.equals(edge.getEndPoint()) && endPoint.equals(edge.getStartPoint())) return true;
   return false;
 }
Пример #2
0
 /**
  * Returns the type of the edge
  * (<code>TYPE_HORIZONTAL, TYPE_VERTICAL, TYPE_SLOPED).
  *
  * @return
  */
 private int getType() {
   if (startPoint.isHorizontallyInLineWith(endPoint)) return TYPE_VERTICAL;
   if (startPoint.isVerticallyInLineWith(endPoint)) return TYPE_HORIZONTAL;
   return TYPE_SLOPED;
 }
Пример #3
0
 public void translate(float dx, float dy) {
   startPoint.x += dx;
   startPoint.y += dy;
   endPoint.x += dx;
   endPoint.y += dy;
 }
Пример #4
0
 public boolean isVertical() {
   if (startPoint.isVerticallyInLineWith(endPoint)) return true;
   return false;
 }