10#include <QtCore/QRectF>
36 CRectangle(
double left,
double top,
double width,
double height);
281 operator QRectF()
const;
290 double* errorFactorPtr =
nullptr)
override;
294 double* errorFactorPtr =
nullptr)
override;
299 double* errorFactorPtr =
nullptr)
const override;
304 double* errorFactorPtr =
nullptr)
const override;
365 return m_horizontalRange;
371 return m_horizontalRange;
377 return m_verticalRange;
383 return m_verticalRange;
Definition of a line in 2D-space.
Base class for 2D-objects implementing interface i2d::IObject2d.
Simple rectangle with integer bounds.
Definition of rectangle area orthogonal to axis of coordination system.
double GetTop() const
Get value of top boundary.
double GetHeight() const
Get height of this rectangle.
void MoveCenterTo(const CVector2d &position) override
Move object to position position.
void SetBottom(double bottom)
Set value of bottom boundary.
void SetBottomLeft(const CVector2d &bottomLeft)
Set left-bottom point of this rectangle.
CVector2d GetTopCenter() const
Get point in center of top edge.
bool Transform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override
Transform this object using some transformation.
CRectangle GetTranslated(const i2d::CVector2d &delta) const
void Reset()
Make rectangle empty.
double GetDistance(const CVector2d &position) const
Get distance from nearest point of this rectangle to specified position.
void Intersect(const CRectangle &rectangle)
Set new rectangle as intersection of the current rectangle with a given one.
CVector2d GetLeftBottom() const
Get left-bottom point of this rectangle.
const istd::CRange & GetHorizontalRange() const
Get values of horizontal boundaries.
CVector2d GetBottomCenter() const
Get point in center of bottom edge.
QByteArray GetFactoryId() const override
double GetLeft() const
Get value of left boundary.
void Translate(const i2d::CVector2d &delta)
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
void SetTop(double top)
Set value of top boundary.
bool IsIntersectedBy(const CLine2d &line) const
Returns true, if this rectangle is intersected by the line rect.
CVector2d GetRightTop() const
Get right-top point of this rectangle.
void SetBottomRight(const CVector2d &bottomRight)
Set right-bottom point of this rectangle.
bool IsEmpty() const
Return true if the rectangle is empty.
void Expand(const CRectangle &rect)
Expand rectangle.
CVector2d GetRightBottom() const
Get right-bottom point of this rectangle.
void Unite(const i2d::CVector2d &position)
Set this rectangle to union of rectangle and point.
CLine2d GetIntersection(const CLine2d &line) const
Get resulting line of the intersection of this rectangle with the line line.
bool operator==(const CRectangle &rect) const
double GetBottom() const
Get value of bottom boundary.
void SetRight(double right)
Set value of right boundary.
void SetTopLeft(const CVector2d &topLeft)
Set left-top point of this rectangle.
int GetSupportedOperations() const override
Get set of flags for supported operations.
CRectangle(const istd::CRange &horizontalRange, const istd::CRange &verticalRange)
CVector2d GetLeftTop() const
Get left-top point of this rectangle.
bool InvTransform(const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override
Do inverse transformation of this object.
CRectangle GetBoundingBox() const override
Get bounding box of this shape.
CVector2d GetRightCenter() const
Get point in center of right edge.
bool Contains(const CVector2d &point) const
Check if some point is contained in this rectangle.
CRectangle(double left, double top, double width, double height)
bool GetInvTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override
Calulate inverse transformation of the object into second one.
static QByteArray GetTypeName()
CRectangle GetUnion(const CRectangle &rect) const
Get union of two rectangles.
istd::CRange & GetVerticalRangeRef()
Get values of vertical boundaries as reference.
bool operator!=(const CRectangle &rect) const
CRectangle GetIntersection(const CRectangle &rect) const
Get resulting rectangle of the intersection of this rectangle with rect.
void SetVerticalRange(const istd::CRange &range)
Set values of vertical boundaries.
bool GetTransformed(const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override
Calulate transformation of the object into second one.
CVector2d GetNearestPointTo(const CVector2d &point) const
Get the nearest point in the rectangle for the some given point.
CRectangle GetUnion(const i2d::CVector2d &position) const
Get union of this rectangle and point.
istd::CRange & GetHorizontalRangeRef()
Get values of horizontal boundaries as reference.
static const i2d::CRectangle & GetInvalid()
Get invalid rectangle.
double GetMaxDistance(const CVector2d &position) const
Get maximal distance from points of this rectangle to specified position.
void SetHorizontalRange(const istd::CRange &range)
Set values of horizontal boundaries.
static const i2d::CRectangle & GetEmpty()
Get empty rectangle with all values set to 0.
bool IsValidNonEmpty() const
Return true if the rectangle is valid and it is not empty.
const istd::CRange & GetVerticalRange() const
Get values of vertical boundaries.
CRectangle(const istd::CIndex2d &size)
bool Contains(const CRectangle &rect) const
Check if some rectangle is fully contained in this rectangle.
bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
double GetRight() const
Get value of right boundary.
void Unite(const CRectangle &rect)
Set this rectangle to union of two rectangles.
CRectangle(const i2d::CRect &rect)
CVector2d GetSize() const
Get size of this rectangle.
void SetLeft(double left)
Set value of left boundary.
bool IsIntersectedBy(const CRectangle &rect) const
Returns true, if this rectangle is intersected by the other rectangle rect.
std::unique_ptr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
CRectangle(const CVector2d &topLeft, const CVector2d &bottomRight)
CVector2d GetCenter() const override
Returns center of this 2D-object.
double GetWidth() const
Get width of this rectangle.
void SetTopRight(const CVector2d &topRight)
Set right-top point of this rectangle.
CRectangle GetExpanded(const CRectangle &rect) const
Get expanded rectangle (simple sum of boundary values).
bool IsValid() const
Return true if the rectangle is valid.
CVector2d GetLeftCenter() const
Get point in center of left edge.
bool Contains(const istd::CIndex2d &point) const
Check if some point is contained in this rectangle.
Definition of position or mathematical vector on 2D plane.
Common interface for describing the 2D-objects.
Represent input/output persistence archive.
Index implementation for addressing elements in 2D-space.
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
ValueType GetMaxValue() const
Get the top value.
ValueType GetMinValue() const
Get the bottom value.