50 if (
name.length() > 0)
122 QRectF rect(QPointF(0, 0), parent->getSize());
125 auto rm = parent->margin.width();
127 auto right = rect.right();
128 auto left = rect.left();
129 auto lm = parent->margin.left();
131 newPos.setX(qMin(right - bw - rm, qMax(newPos.x(), left + lm)));
132 newPos.setY(qMin(rect.bottom() -
getBounds().height() - parent->margin.height(),
133 qMax(newPos.y(), rect.top() + parent->margin.top())));
141 if (std::isnan(newPosition.x()) || std::isnan(newPosition.y()))
144 <<
" contains NaN. wont set it";
149 if ((
position - newPosition).manhattanLength() < 2)
181 if (std::isnan(newStateCenter.x()) || std::isnan(newStateCenter.y()))
184 <<
" contains NaN. wont setting it";
191 QPointF newPosition =
255 return std::min(xRatio, yRatio);
StateInstance(const QString &instanceName, StatePtr parentState=StatePtr())
QRectF getBounds() const
getBounds returns the rectangle occupied by this state instance in the parent coordinate system.
const QPointF & getTopLeft() const
getTopLeft returns the topleft point of the stateinstance in the coordinate system of the parent stat...
const int defaultBoundingSquareSize
QString getInstanceName() const
void setBoundingBox(float squareSize)
QPointF adjustPosition(QPointF &newPos) const
QSizeF getClassSize() const
StatePtr getParent() const
QRectF getBoundingSquare() const
getBoundingSquare return the maximum bounding box of this state instance in parent coordinate system
virtual void setInstanceName(const QString &value)
float getScale() const
getScale returns the scale of this state instance, which is the relation between boundingSquareSize a...
void setPosition(QPointF newPosition)
virtual StatePtr getStateClass() const
static const QSizeF StateDefaultSize
std::weak_ptr< State > parentState
void setCenter(const QPointF &newStateCenter)
const QPointF getCenter() const
#define ARMARX_WARNING_S
The logging level for unexpected behaviour, but not a serious problem.
std::shared_ptr< State > StatePtr