本文整理汇总了C++中dynshape函数的典型用法代码示例。如果您正苦于以下问题:C++ dynshape函数的具体用法?C++ dynshape怎么用?C++ dynshape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dynshape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dynshape
bool MgCmdDrawLine::touchMoved(const MgMotion* sender)
{
dynshape()->shape()->setPoint(1, snapPoint(sender));
dynshape()->shape()->update();
return MgCommandDraw::touchMoved(sender);
}
示例2: pnt
bool MgCmdDrawLines::touchEnded(const MgMotion* sender)
{
Point2d pnt(snapPoint(sender));
dynshape()->shape()->setPoint(m_index, pnt);
bool closed = checkClosed(sender, pnt);
MgBaseLines* lines = (MgBaseLines*)dynshape()->shape();
dynshape()->shape()->update();
if (canAddPoint(sender, pnt)) {
if (closed || needEnded()) {
if (closed) {
lines->removePoint(m_step);
}
addShape(sender);
m_step = 0;
_lastClicked = false;
}
else if (m_step <= dynshape()->shape()->getPointCount()) {
m_step++;
}
}
else if (m_step > 1) {
if (m_step >= dynshape()->shape()->getPointCount()) {
m_step--;
}
lines->removePoint(m_index);
}
return MgCommandDraw::touchEnded(sender);
}
示例3: mgLineHalfWidthModel
bool MgCmdDrawFreeLines::touchMoved(const MgMotion* sender)
{
MgBaseLines* lines = (MgBaseLines*)dynshape()->shape();
float closelen = mgLineHalfWidthModel(dynshape(), sender) + mgDisplayMmToModel(5, sender);
float closedist = sender->pointM.distanceTo(dynshape()->shape()->getPoint(0));
bool closed = (m_step > 2 && closedist < closelen
&& dynshape()->shape()->getExtent().width() > closedist * 1.5f
&& dynshape()->shape()->getExtent().height() > closedist * 1.5f);
if (m_step > 2 && dynshape()->shape()->isClosed() != closed) {
lines->setClosed(closed);
if (closed)
lines->removePoint(m_step);
else
lines->addPoint(sender->pointM);
}
if (!closed) {
dynshape()->shape()->setPoint(m_step, sender->pointM);
if (m_step > 0 && canAddPoint(sender, false)) {
m_step++;
if (m_step >= dynshape()->shape()->getPointCount()) {
((MgBaseLines*)dynshape()->shape())->addPoint(sender->pointM);
}
}
}
dynshape()->shape()->update();
return _touchMoved(sender);
}
示例4: dynshape
bool MgCmdDrawTriangle::touchMoved(const MgMotion* sender)
{
dynshape()->shape()->setPoint(m_step, snapPoint(sender));
dynshape()->shape()->update();
return _touchMoved(sender);
}
示例5: dynshape
bool MgCmdDrawFreeLines::backStep(const MgMotion* sender)
{
if (m_step > 2) { // 去掉倒数第二个点,倒数第一点是临时动态点
((MgBaseLines*)dynshape()->shape())->removePoint(m_step - 1);
dynshape()->shape()->update();
}
return MgCommandDraw::backStep(sender);
}
示例6: dynshape
bool MgCmdDrawDot::touchBegan(const MgMotion* sender)
{
m_step = 1;
dynshape()->shape()->setPoint(0, snapPoint(sender, true));
dynshape()->shape()->update();
return MgCommandDraw::touchBegan(sender);
}
示例7: snapPoint
bool MgCmdDrawRect::touchBegan(const MgMotion* sender)
{
m_step = 1;
m_startPt = snapPoint(sender, true);
((MgBaseRect*)dynshape()->shape())->setRect2P(m_startPt, m_startPt);
dynshape()->shape()->update();
return MgCommandDraw::touchBegan(sender);
}
示例8: dynshape
bool MgCmdDrawSplines::backStep(const MgMotion* sender)
{
if (m_step > 1) { // freehand: 去掉倒数第二个点,倒数第一点是临时动态点
((MgBaseLines*)dynshape()->shape())->removePoint(m_freehand ? m_step - 1 : m_step);
dynshape()->shape()->update();
}
return MgCommandDraw::backStep(sender);
}
示例9: dynshape
bool MgCmdDrawLines::undo(bool &enableRecall, const MgMotion* sender)
{
enableRecall = true;
if (m_step > 2) { // 去掉倒数第二个点,倒数第一点是临时动态点
((MgBaseLines*)dynshape()->shape())->removePoint(m_step - 1);
dynshape()->shape()->update();
}
return MgCommandDraw::_undo(sender);
}
示例10: dynshape
bool MgCmdDrawSplines::undo(bool &enableRecall, const MgMotion* sender)
{
enableRecall = m_freehand;
if (m_step > 1) { // freehand: 去掉倒数第二个点,倒数第一点是临时动态点
((MgBaseLines*)dynshape()->shape())->removePoint(m_freehand ? m_step - 1 : m_step);
dynshape()->shape()->update();
}
return MgCommandDraw::_undo(sender);
}
示例11: pt1
bool MgCmdDrawRect::touchMoved(const MgMotion* sender)
{
Point2d pt1(m_startPt);
Point2d pt2(snapPoint(sender));
MgBaseRect* shape = (MgBaseRect*)dynshape()->shape();
shape->setRect2P(pt1, pt2);
dynshape()->shape()->update();
return MgCommandDraw::touchMoved(sender);
}
示例12: dynshape
bool MgCmdDrawGrid::touchMoved(const MgMotion* sender)
{
if (m_step == 1) {
return MgCmdDrawRect::touchMoved(sender);
}
dynshape()->shape()->setHandlePoint(8, snapPoint(sender), 0);
dynshape()->shape()->update();
return _touchMoved(sender);
}
示例13: ctx
bool MgCmdDrawSplines::draw(const MgMotion* sender, GiGraphics* gs)
{
if (getStep() > 0 && !m_freehand) {
GiContext ctx(0, GiColor(64, 128, 64, 172), GiContext::kSolidLine, GiColor(0, 64, 64, 128));
float radius = sender->displayMmToModel(0.8f, gs);
for (int i = 1, n = dynshape()->shape()->getPointCount(); i < 6 && n >= i; i++) {
gs->drawCircle(&ctx, dynshape()->shape()->getPoint(n - i), radius);
}
gs->drawCircle(&ctx, dynshape()->shape()->getPoint(0), radius * 1.5f);
}
return MgCommandDraw::draw(sender, gs);
}
示例14: while
bool MgCmdDrawLines::doubleClick(const MgMotion* sender)
{
if (m_step > 1) {
while (m_step > 1 && mgDisplayMmToModel(3.f, sender) >
sender->pointM.distanceTo(dynshape()->shape()->getPoint(m_step))) {
((MgBaseLines*)dynshape()->shape())->removePoint(m_step--);
}
_addshape(sender);
_delayClear();
m_step = 0;
}
return true;
}
示例15: ctx
bool MgCmdDrawSplines::draw(const MgMotion* sender, GiGraphics* gs)
{
if (m_step > 0 && !m_freehand) {
GiContext ctx(0, GiColor(64, 128, 64, 172), kLineSolid, GiColor(0, 64, 64, 128));
float radius = gs->xf().displayToModel(4);
for (UInt32 i = 1, n = dynshape()->shape()->getPointCount(); i < 6 && n >= i; i++) {
gs->drawEllipse(&ctx, dynshape()->shape()->getPoint(n - i), radius);
}
gs->drawEllipse(&ctx, dynshape()->shape()->getPoint(0), radius * 1.5f);
}
return MgCommandDraw::draw(sender, gs);
}