const _MwWrapper = require("../_mwbridge/_mw-wrapper.js");
const utils = require("../core/utils")
const {MwQuadrangle} = require("../_mwbridge/_mw-bridge")
/**
* Stores a set of four Points that represent a Quadrangle region.
*/
class Quadrangle extends _MwWrapper
{
leftTop;
rightTop;
rightBottom;
leftBottom;
/**
* Represents a Quadrangle structure with its properties left uninitialized.Value: Quadrangle
*/
static get EMPTY()
{
return new Quadrangle(utils.toJavaPoint({x: 0, y: 0}), utils.toJavaPoint({x: 0, y: 0}), utils.toJavaPoint({x: 0, y: 0}), (utils.toJavaPoint({x: 0, y: 0})));
}
static _fromMwObject(...args)
{
let quadrangle = Quadrangle.EMPTY;
quadrangle.setJavaClass(args[0]);
return quadrangle;
}
/**
* Initializes a new instance of the Quadrangle structure with the describing points.
*
* @param leftTop A Point that represents the left-top corner of the Quadrangle.
* @param rightTop A Point that represents the right-top corner of the Quadrangle.
* @param rightBottom A Point that represents the right-bottom corner of the Quadrangle.
* @param leftBottom A Point that represents the left-bottom corner of the Quadrangle.
*/
constructor(leftTop, rightTop, rightBottom, leftBottom)
{
let mwQuadrangle = new MwQuadrangle(utils.toJavaPoint(leftTop), utils.toJavaPoint(rightTop), utils.toJavaPoint(rightBottom), utils.toJavaPoint(leftBottom));
super(mwQuadrangle);
this._initializeWrapperMembers();
}
_initializeWrapperMembers()
{
this.leftTop = utils.fromJavaPoint(this.getJavaClass().getLeftTopSync());
this.rightTop = utils.fromJavaPoint(this.getJavaClass().getRightTopSync());
this.rightBottom = utils.fromJavaPoint(this.getJavaClass().getRightBottomSync());
this.leftBottom = utils.fromJavaPoint(this.getJavaClass().getLeftBottomSync());
}
/**
* Gets left-top corner Point of Quadrangle regionValue: A left-top corner Point of Quadrangle region
*/
getLeftTop()
{
return this.leftTop;
}
/**
* Sets left-top corner Point of Quadrangle regionValue: A left-top corner Point of Quadrangle region
*/
setLeftTop(value)
{
this.leftTop = value;
this.getJavaClass().setLeftTopSync(utils.toJavaPoint(value));
}
/**
* Gets right-top corner Point of Quadrangle regionValue: A right-top corner Point of Quadrangle region
*/
getRightTop()
{
return this.rightTop;
}
/**
* Sets right-top corner Point of Quadrangle regionValue: A right-top corner Point of Quadrangle region
*/
setRightTop(value)
{
this.rightTop = value;
this.getJavaClass().setRightTopSync(utils.toJavaPoint(value));
}
/**
* Gets right-bottom corner Point of Quadrangle regionValue: A right-bottom corner Point of Quadrangle region
*/
getRightBottom()
{
return this.rightBottom;
}
/**
* Sets right-bottom corner Point of Quadrangle regionValue: A right-bottom corner Point of Quadrangle region
*/
setRightBottom(value)
{
this.rightBottom = value;
this.getJavaClass().setRightBottomSync(utils.toJavaPoint(value));
}
/**
* Gets left-bottom corner Point of Quadrangle regionValue: A left-bottom corner Point of Quadrangle region
*/
getLeftBottom()
{
return this.leftBottom;
}
/**
* Sets left-bottom corner Point of Quadrangle regionValue: A left-bottom corner Point of Quadrangle region
*/
setLeftBottom(value)
{
this.leftBottom = value;
this.getJavaClass().setLeftBottomSync(utils.toJavaPoint(value));
}
/**
* Tests whether all Points of this Quadrangle have values of zero.Value: Returns true if all Points of this Quadrangle have values of zero; otherwise, false.
*/
isEmpty()
{
return this.getJavaClass().isEmptySync();
}
/**
* Determines if the specified Point is contained within this Quadrangle structure.
*
* @param pt The Point to test.
* @return true if Point is contained within this Quadrangle structure; otherwise, false.
*/
contains(pt)
{
return this.getJavaClass().containsSync(utils.toJavaPoint(pt));
}
/**
* Determines if the specified point is contained within this Quadrangle structure.
*
* @param x The x point cordinate.
* @param y The y point cordinate.
* @return Returns true if point is contained within this Quadrangle structure; otherwise, false.
*/
containsPoint(x, y)
{
return this.getJavaClass().containsSync(x, y);
}
/**
* Determines if the specified Quadrangle is contained or intersect this Quadrangle structure.
*
* @param quad The Quadrangle to test.
* @return Returns true if Quadrangle is contained or intersect this Quadrangle structure; otherwise, false.
*/
containsQuadrangle(quad)
{
return this.getJavaClass().containsSync(quad.getJavaClass());
}
/**
* Determines if the specified Rectangle is contained or intersect this Quadrangle structure.
*
* @param rect The Rectangle to test.
* @return Returns true if Rectangle is contained or intersect this Quadrangle structure; otherwise, false.
*/
containsRectangle(rect)
{
return this.getJavaClass().containsSync(rect.getJavaClass());
}
/**
* Returns a value indicating whether this instance is equal to a specified Quadrangle value.
*
* @param other An Quadrangle value to compare to this instance.
* @return true if obj has the same value as this instance; otherwise, false.
*/
equals(other)
{
return this.getJavaClass().equalsSync(other.getJavaClass());
}
/**
* Returns the hash code for this instance.
*
* @return A 32-bit signed integer hash code.
*/
hashCode()
{
return this.getJavaClass().hashCodeSync();
}
/**
* Returns a human-readable string representation of this Quadrangle.
*
* @return A string that represents this Quadrangle.
*/
toString()
{
return this.getJavaClass().toStringSync();
}
/**
* Creates Rectangle bounding this Quadrangle
*
* @return returns Rectangle bounding this Quadrangle
*/
getBoundingRectangle()
{
return utils.fromJavaRectangle(this.getJavaClass().getBoundingRectangleSync());
}
}
module.exports = Quadrangle;