Java org.eclipse.jface.util Geometry fields, constructors, methods, implement or subclass

Example usage for Java org.eclipse.jface.util Geometry fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.eclipse.jface.util Geometry.

The text is from its open source code.

Method

Rectangleadd(Rectangle rect1, Rectangle rect2)

Returns a new Rectangle whose x, y, width, and height is the sum of the x, y, width, and height values of both rectangles respectively.

Pointadd(Point point1, Point point2)
Adds two points as 2d vectors.
PointcenterPoint(Rectangle rect)
Returns the point in the center of the given rectangle.
Pointcopy(Point toCopy)
Returns a copy of the given point
Rectanglecopy(Rectangle toCopy)
Returns a copy of the given rectangle
RectanglecreateDiffRectangle(int left, int right, int top, int bottom)

Returns a rectangle which, when added to another rectangle, will expand each side by the given number of units.

RectanglecreateRectangle(Point position, Point size)
Returns a new rectangle with the given position and dimensions, expressed as points.
intdistanceSquared(Point p1, Point p2)
Returns the square of the distance between two points.
Pointdivide(Point toDivide, int scalar)
Divides both coordinates of the given point by the given scalar.
voidexpand(Rectangle rect, int left, int right, int top, int bottom)
Moves each edge of the given rectangle outward by the given amount.
voidflipXY(Point toFlip)
Swaps the X and Y coordinates of the given point.
voidflipXY(Rectangle toFlip)
Swaps the X and Y coordinates of the given rectangle, along with the height and width.
intgetClosestSide(Rectangle boundary, Point toTest)
Returns the edge of the given rectangle is closest to the given point.
intgetCoordinate(Point toMeasure, boolean width)
Returns the x or y coordinates of the given point.
intgetCoordinate(Rectangle toMeasure, boolean width)
Returns the x or y coordinates of the given rectangle.
intgetDimension(Rectangle toMeasure, boolean width)
Returns the height or width of the given rectangle.
RectanglegetExtrudedEdge(Rectangle toExtrude, int size, int orientation)
Extrudes the given edge inward by the given distance.
PointgetLocation(Rectangle toQuery)
Returns the x,y position of the given rectangle.
intgetOppositeSide(int swtDirectionConstant)
Returns the opposite of the given direction.
PointgetSize(Rectangle rectangle)
Returns the size of the rectangle, as a Point
booleanisHorizontal(int swtSideConstant)
Returns true iff the given SWT side constant corresponds to a horizontal side of a rectangle.
Pointmax(Point p1, Point p2)
Returns a new point whose coordinates are the maximum of the coordinates of the given points
Pointmin(Point p1, Point p2)
Returns a new point whose coordinates are the minimum of the coordinates of the given points
voidmoveInside(Rectangle inner, Rectangle outer)
Repositions the 'inner' rectangle to lie completely within the bounds of the 'outer' rectangle if possible.
voidset(Point result, Point toCopy)
Sets result equal to toCopy
voidset(Rectangle result, Rectangle toCopy)
Sets result equal to toCopy
voidsetDimension(Rectangle toSet, boolean width, int newCoordinate)
Sets one dimension of the given rectangle.
Rectanglesubtract(Rectangle rect1, Rectangle rect2)

Returns a new difference Rectangle whose x, y, width, and height are equal to the difference of the corresponding attributes from the given rectangles

Example: Compute the margins for a given Composite, and apply those same margins to a new GridLayout
  // Compute the client area, in the coordinate system of the input composite's parent Rectangle clientArea = Display.getCurrent().map(inputComposite, inputComposite.getParent(), inputComposite.getClientArea()); // Compute the margins for a given Composite by subtracting the client area from the composite's bounds Rectangle margins = Geometry.subtract(inputComposite.getBounds(), clientArea); // Now apply these margins to a new GridLayout GridLayout layout = GridLayoutFactory.fillDefaults().margins(margins).create();  
Pointsubtract(Point point1, Point point2)
Performs vector subtraction on two points.
RectangletoControl(Control coordinateSystem, Rectangle toConvert)
Converts the given rectangle from display coordinates to the local coordinate system of the given object into display coordinates.
RectangletoDisplay(Control coordinateSystem, Rectangle toConvert)
Converts the given rectangle from the local coordinate system of the given object into display coordinates.