com.stimulsoft.base.system.geometry
Class StiRectangle

java.lang.Object
  extended by com.stimulsoft.base.system.geometry.StiRectangle
All Implemented Interfaces:
IStiSerializable, IStiSerializableToString

public class StiRectangle
extends java.lang.Object
implements IStiSerializableToString

Class represent rectangle & operations with it Copyright Stimulsoft


Field Summary
 double height
           
 double width
           
 double x
           
 double y
           
 
Constructor Summary
StiRectangle()
           
StiRectangle(double x, double y, double width, double height)
          Constructor
StiRectangle(long x, long y, long width, long height)
          Constructor
StiRectangle(StiPoint location, StiSize size)
          Initializes a new instance of the RectangleD class with the specified location and size.
StiRectangle(StiRectangle rectangleD)
          Constructor, create StiRectangle form StiRectangle
 
Method Summary
static StiRectangle alignSizeInRect(StiRectangle rect, StiSize size, StiContentAlignment alignment)
          Align rectangle to fit in rect
 StiRectangle AlignToGrid(double gridSize, boolean aligningToGrid)
          Align the rectangle to grid.
 StiRectangle clone()
          Clone current StiRectangle
 boolean contains(double x, double y)
           
 java.lang.Boolean contains(java.lang.Double x, java.lang.Double y)
          Is this StiRectangle contains point
 boolean contains(StiPoint pt)
           
 void deserialize(java.lang.String strObject)
          Десериализация объекта из строки.
 StiRectangle deserializeString(java.lang.String strObject)
           
static StiRectangle empty()
           
 StiRectangle FitToRectangle(StiRectangle rectangle)
          Fit rectangle to rectangle.
 int getBi()
          Return rounded Integer bottom value
 double getBottom()
           
static StiRectangle getEmpty()
           
 double getHeight()
           
 int getHi()
          Return rounded Integer height value
 boolean getIsEmpty()
          Tests whether all numeric properties of this StiRectangle have values of zero.
 double getLeft()
           
 int getLi()
           
 StiPoint getLocation()
           
 StiRectangle getNormalize()
           
 int getRi()
          Return rounded Integer right value
 double getRight()
           
 StiSize getSize()
           
 int getTi()
           
 double getTop()
           
 int getWi()
          Return rounded Integer width value
 double getWidth()
           
 double getX()
           
 int getXi()
          Return rounded Integer X value
 double getY()
           
 int getYi()
          Return rounded Integer Y value
 StiRectangle inflate(java.lang.Double width, java.lang.Double height)
          Inflate current StiRectangle
 StiRectangle inflate(int width, int height)
          Inflate current StiRectangle
 java.lang.Boolean intersectsWith(StiRectangle rect)
          Is this StiRectangle intersects with other rectangle
 boolean IntersectsWith(StiRectangle rect)
           
 java.lang.Boolean isEmpty()
          Check if StiRectangle is empty
 void LoadFromJson(JSONObject jObject)
           
 StiRectangle move(java.lang.Double deltaX, java.lang.Double deltaY)
          Move rectangle by delta values
 StiRectangle Multiply(double multipleFactor)
           
 StiRectangle normalize()
          Normalize StiRectangle
 StiRectangle OffsetRect(StiRectangle offsettingRectangle)
          Changes the sizes of the rectangle.
 StiRectangle round(double digits)
          Round double x,y,width,height values to digits after point
 StiRectangle round(java.lang.Double digits, java.lang.Boolean smartRound)
          Round double x,y,width,height values to digits after point with smart reound
static StiRectangle round(StiRectangle labelRect)
           
 java.lang.String serialize()
          Сериализация объекта в строку.
 void setBottom(double bottom)
           
 void setHeight(double height)
           
 void setLeft(double left)
           
 void setLocation(StiPoint value)
           
 void setRight(double right)
          Set right
 void setSize(StiSize value)
           
 void setTop(double top)
          Set top
 void setWidth(double width)
           
 void setX(double x)
           
 void setY(double y)
           
 java.awt.Rectangle toRectangle()
          Convert StiRectangle to Rectangle
 java.lang.String toString()
           
static StiRectangle union(StiRectangle a, StiRectangle b)
           
 StiRectangle zoom(java.lang.Double zoom)
          Zoom StiRectangle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public double width

height

public double height

y

public double y

x

public double x
Constructor Detail

StiRectangle

public StiRectangle()

StiRectangle

public StiRectangle(StiRectangle rectangleD)
Constructor, create StiRectangle form StiRectangle

Parameters:
rectangleD - StiRectangle

StiRectangle

public StiRectangle(long x,
                    long y,
                    long width,
                    long height)
Constructor

Parameters:
x -
y -
width -
height -

StiRectangle

public StiRectangle(double x,
                    double y,
                    double width,
                    double height)
Constructor

Parameters:
x -
y -
width -
height -

StiRectangle

public StiRectangle(StiPoint location,
                    StiSize size)
Initializes a new instance of the RectangleD class with the specified location and size.

Parameters:
location - A StiPoint that represents the upper-left corner of the rectangular region.
size - A StiSize that represents the width and height of the rectangular region.
Method Detail

empty

public static StiRectangle empty()

clone

public StiRectangle clone()
Clone current StiRectangle

Overrides:
clone in class java.lang.Object
Returns:
StiRectangle

move

public StiRectangle move(java.lang.Double deltaX,
                         java.lang.Double deltaY)
Move rectangle by delta values

Parameters:
deltaX -
deltaY -
Returns:
this moved StiRectangle

inflate

public StiRectangle inflate(java.lang.Double width,
                            java.lang.Double height)
Inflate current StiRectangle

Parameters:
width -
height -
Returns:
this inflated StiRectangle

inflate

public StiRectangle inflate(int width,
                            int height)
Inflate current StiRectangle

Parameters:
width -
height -
Returns:
this inflated StiRectangle

isEmpty

public java.lang.Boolean isEmpty()
Check if StiRectangle is empty

Returns:
is empty rectangle

alignSizeInRect

public static StiRectangle alignSizeInRect(StiRectangle rect,
                                           StiSize size,
                                           StiContentAlignment alignment)
Align rectangle to fit in rect

Parameters:
rect - StiRectangle Fitten rectangle
size - StiSize Size to fitin
alignment - StiContentAlignment
Returns:
Fitted rectangle

intersectsWith

public java.lang.Boolean intersectsWith(StiRectangle rect)
Is this StiRectangle intersects with other rectangle

Parameters:
rect - StiRectangle
Returns:
intersects result

contains

public java.lang.Boolean contains(java.lang.Double x,
                                  java.lang.Double y)
Is this StiRectangle contains point

Parameters:
x -
y -
Returns:

zoom

public StiRectangle zoom(java.lang.Double zoom)
Zoom StiRectangle

Parameters:
zoom -
Returns:

round

public StiRectangle round(double digits)
Round double x,y,width,height values to digits after point

Parameters:
digits -
Returns:
this rounded StiRectangle

round

public StiRectangle round(java.lang.Double digits,
                          java.lang.Boolean smartRound)
Round double x,y,width,height values to digits after point with smart reound

Parameters:
digits -
smartRound -
Returns:
this rounded StiRectangle

normalize

public StiRectangle normalize()
Normalize StiRectangle

Returns:

toRectangle

public java.awt.Rectangle toRectangle()
Convert StiRectangle to Rectangle

Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLeft

public double getLeft()
Returns:
the left

getRight

public double getRight()
Returns:
the right

getTop

public double getTop()
Returns:
the top

getBottom

public double getBottom()
Returns:
the bottom

setBottom

public void setBottom(double bottom)
Parameters:
bottom - the bottom to set

getY

public double getY()
Returns:
the y

setY

public void setY(double y)
Parameters:
y - the y to set

getX

public double getX()
Returns:
the x

setX

public void setX(double x)
Parameters:
x - the x to set

getWidth

public double getWidth()
Returns:
the width

setWidth

public void setWidth(double width)
Parameters:
width - the width to set

getHeight

public double getHeight()
Returns:
the height

setHeight

public void setHeight(double height)
Parameters:
height - the height to set

setLeft

public void setLeft(double left)
Parameters:
left -

setRight

public void setRight(double right)
Set right

Parameters:
right -

setTop

public void setTop(double top)
Set top

Parameters:
top -

getHi

public int getHi()
Return rounded Integer height value

Returns:

getWi

public int getWi()
Return rounded Integer width value

Returns:

getXi

public int getXi()
Return rounded Integer X value

Returns:

getYi

public int getYi()
Return rounded Integer Y value

Returns:

getRi

public int getRi()
Return rounded Integer right value

Returns:

getBi

public int getBi()
Return rounded Integer bottom value

Returns:

getLi

public int getLi()

getTi

public int getTi()

round

public static StiRectangle round(StiRectangle labelRect)

getSize

public StiSize getSize()

setSize

public void setSize(StiSize value)

getLocation

public StiPoint getLocation()

setLocation

public void setLocation(StiPoint value)

union

public static StiRectangle union(StiRectangle a,
                                 StiRectangle b)

contains

public boolean contains(double x,
                        double y)

contains

public boolean contains(StiPoint pt)

getEmpty

public static StiRectangle getEmpty()

getIsEmpty

public boolean getIsEmpty()
Tests whether all numeric properties of this StiRectangle have values of zero.


serialize

public java.lang.String serialize()
Description copied from interface: IStiSerializableToString
Сериализация объекта в строку.

Specified by:
serialize in interface IStiSerializableToString
Returns:
строковое представление объекта

deserializeString

public StiRectangle deserializeString(java.lang.String strObject)

deserialize

public void deserialize(java.lang.String strObject)
Description copied from interface: IStiSerializableToString
Десериализация объекта из строки. Все свойства объекта устанавливаются за счет распарсивания строки.

Specified by:
deserialize in interface IStiSerializableToString

Multiply

public StiRectangle Multiply(double multipleFactor)

getNormalize

public StiRectangle getNormalize()

FitToRectangle

public StiRectangle FitToRectangle(StiRectangle rectangle)
Fit rectangle to rectangle.

Parameters:
rectangle - Rectangle, which will be fited.
Returns:
Result rectangle.

OffsetRect

public StiRectangle OffsetRect(StiRectangle offsettingRectangle)
Changes the sizes of the rectangle.

Parameters:
offsettingRectangle - Data for change the size.
Returns:
Changed rectangle.

AlignToGrid

public StiRectangle AlignToGrid(double gridSize,
                                boolean aligningToGrid)
Align the rectangle to grid.

Parameters:
gridSize - Grid size.
aligningToGrid - Align or no.
Returns:
Aligned rectangle.

IntersectsWith

public boolean IntersectsWith(StiRectangle rect)

LoadFromJson

public void LoadFromJson(JSONObject jObject)
                  throws java.lang.NumberFormatException,
                         JSONException
Throws:
java.lang.NumberFormatException
JSONException