Class Rect

java.lang.Object
cn.mapway.geo.shared.vector.Rect

public class Rect extends Object
Rect
Author:
zhangjianshe <zhangjianshe@gmail.com>
  • Field Details

    • x

      public double x
    • y

      public double y
    • width

      public double width
    • height

      public double height
  • Constructor Details

    • Rect

      public Rect()
    • Rect

      public Rect(double x, double y, double width, double height)
  • Method Details

    • getXAsInt

      public int getXAsInt()
    • getYAsInt

      public int getYAsInt()
    • getWidthAsInt

      public int getWidthAsInt()
    • getHeightAsInt

      public int getHeightAsInt()
    • setValue

      public Rect setValue(double x, double y, double width, double height)
    • moveTo

      public void moveTo(double x, double y)
    • offset

      public Rect offset(double x, double y)
    • offset

      public Rect offset(Point pt)
    • contains

      public boolean contains(double x, double y)
      矩形是否包含(x,y)
      Parameters:
      x -
      y -
      Returns:
    • toString

      public String toString()
      output json format
      Overrides:
      toString in class Object
      Returns:
    • clone

      public Rect clone()
      Overrides:
      clone in class Object
    • shrink

      public Rect shrink(double left, double top, double right, double bottom)
    • normalize

      public void normalize()
      正交化对象
    • intersect

      public boolean intersect(Rect box)
      两个矩形是否相交
      Parameters:
      box -
      Returns:
    • isCross

      public boolean isCross(Rect r)
      判断两个矩形是否交叉
      Parameters:
      r -
      Returns:
    • extend

      public Rect extend(Point pt)
    • extend

      public Rect extend(double x, double y)
    • extend

      public Rect extend(Rect box)
      扩展矩形范围
      Parameters:
      box -
    • copyFrom

      public Rect copyFrom(Rect from)
    • getCenter

      public Point getCenter()