本文整理汇总了C++中PathPoint::getNumPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ PathPoint::getNumPoints方法的具体用法?C++ PathPoint::getNumPoints怎么用?C++ PathPoint::getNumPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathPoint
的用法示例。
在下文中一共展示了PathPoint::getNumPoints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: withChangedPointType
PathPoint PathPoint::withChangedPointType (const Path::Iterator::PathElementType newType,
const Rectangle<int>& parentArea) const
{
PathPoint p (*this);
if (newType != p.type)
{
int oldNumPoints = getNumPoints();
p.type = newType;
int numPoints = p.getNumPoints();
if (numPoints != oldNumPoints)
{
double lastX, lastY;
double x, y, w, h;
p.pos [numPoints - 1] = p.pos [oldNumPoints - 1];
p.pos [numPoints - 1].getRectangleDouble (x, y, w, h, parentArea, owner->getDocument()->getComponentLayout());
const int index = owner->points.indexOf (this);
PathPoint* lastPoint = owner->points [index - 1];
jassert (lastPoint != nullptr)
if (lastPoint != nullptr)
{
lastPoint->pos [lastPoint->getNumPoints() - 1]
.getRectangleDouble (lastX, lastY, w, h, parentArea, owner->getDocument()->getComponentLayout());
}
else
{
lastX = x;
lastY = y;
}
for (int i = 0; i < numPoints - 1; ++i)
{
p.pos[i] = p.pos [numPoints - 1];
p.pos[i].updateFrom (lastX + (x - lastX) * (i + 1) / numPoints,
lastY + (y - lastY) * (i + 1) / numPoints,
w, h,
parentArea,
owner->getDocument()->getComponentLayout());
}
}
示例2: setCurrentBounds
void PaintElementPath::setCurrentBounds (const Rectangle<int>& b,
const Rectangle<int>& parentArea,
const bool /*undoable*/)
{
Rectangle<int> newBounds (b);
newBounds.setSize (jmax (1, newBounds.getWidth()),
jmax (1, newBounds.getHeight()));
const Rectangle<int> current (getCurrentBounds (parentArea));
if (newBounds != current)
{
const int borderSize = getBorderSize();
const int dx = newBounds.getX() - current.getX();
const int dy = newBounds.getY() - current.getY();
const double scaleStartX = current.getX() + borderSize;
const double scaleStartY = current.getY() + borderSize;
const double scaleX = (newBounds.getWidth() - borderSize * 2) / (double) (current.getWidth() - borderSize * 2);
const double scaleY = (newBounds.getHeight() - borderSize * 2) / (double) (current.getHeight() - borderSize * 2);
for (int i = 0; i < points.size(); ++i)
{
PathPoint* const destPoint = points.getUnchecked(i);
PathPoint p (*destPoint);
for (int j = p.getNumPoints(); --j >= 0;)
rescalePoint (p.pos[j], dx, dy,
scaleX, scaleY,
scaleStartX, scaleStartY,
parentArea);
perform (new ChangePointAction (destPoint, i, p), "Move path");
}
}
}