当前位置: 首页>>代码示例>>C++>>正文


C++ MgCommand::isDrawingCommand方法代码示例

本文整理汇总了C++中MgCommand::isDrawingCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ MgCommand::isDrawingCommand方法的具体用法?C++ MgCommand::isDrawingCommand怎么用?C++ MgCommand::isDrawingCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MgCommand的用法示例。


在下文中一共展示了MgCommand::isDrawingCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setCommand

bool MgCmdManagerImpl::setCommand(const MgMotion* sender,
                                  const char* name, MgStorage* s)
{
    if (strcmp(name, "@draw") == 0) {   // 将 @draw 换成上一次绘图命令名
        name = _drawcmd.empty() ? "splines" : _drawcmd.c_str();
    }

    MgCommand* cmd = findCommand(name);
    if (!cmd) {
        cmd = sender->view->getCmdSubject()->createCommand(sender, name);
        if (cmd) {
            _cmds[name] = cmd;
            LOGD("createCommand %d: %s", (int)_cmds.size(), name);
        }
    }
    
    if (strcmp(name, "erase") == 0 && _cmdname == "select") {   // 在选择命令中点橡皮擦
        MgSelection *sel = getSelection();
        if (sel && sel->deleteSelection(sender)) {      // 直接删除选中的图形
            return false;                               // 不切换到橡皮擦命令
        }
    }
    
    cancel(sender);
    
    bool ret = false;
    std::string oldname(_cmdname);
    
    if (cmd) {
        _cmdname = cmd->getName();
        
        ret = cmd->initialize(sender, s);
        if (!ret) {
            _cmdname = oldname;
        }
        else if (cmd->isDrawingCommand()) {
            _drawcmd = _cmdname;
        }
    }
    else {
        if (strcmp(name, "erasewnd") == 0) {
            eraseWnd(sender);
        }
        else {
            _cmdname = "select";
            cmd = findCommand(_cmdname.c_str());
            cmd->initialize(sender, s);
        }
    }
    
    if (MgBaseShape::minTol().equalPoint() < 1e-5) {
        MgBaseShape::minTol().setEqualPoint(sender->view->xform()->displayToModel(1.f, true));
    }
    if (oldname != _cmdname) {
        sender->view->commandChanged();
    }
    
    return ret;
}
开发者ID:arthur-zhang,项目名称:touchvg,代码行数:59,代码来源:mgcmdmgr_.cpp

示例2: drawCommand

bool GiCoreViewImpl::drawCommand(GcBaseView* view, const MgMotion& motion, GiGraphics& gs)
{
    bool ret = false;

    if (view == curview) {
        MgDynShapeLock locker(false, this);
        MgCommand* cmd = _cmds->getCommand();

        ret = cmd && cmd->draw(&motion, &gs);
        if (ret && cmd->isDrawingCommand()) {
            getCmdSubject()->drawInShapeCommand(&motion, cmd, &gs);
        }
    }

    return ret;
}
开发者ID:arthur-zhang,项目名称:touchvg,代码行数:16,代码来源:gicoreview.cpp

示例3: doAction

bool MgCmdManagerImpl::doAction(const MgMotion* sender, int action)
{
    MgView* view = sender->view;
    MgSelection *sel = getSelection();
    bool ret = false;
    
    switch (action) {
        case kMgActionSelAll:
            ret = sel && sel->selectAll(sender);
            break;
            
        case kMgActionSelReset:
            if (sel) sel->resetSelection(sender);
            break;
            
        case kMgActionDraw:
            ret = setCommand(sender, "@draw", NULL);
            break;
            
        case kMgActionCancel:
            ret = setCommand(sender, "select", NULL);
            break;
            
        case kMgActionDelete:
            ret = sel && sel->deleteSelection(sender);
            break;
            
        case kMgActionClone:
            ret = sel && sel->cloneSelection(sender);
            break;

        case kMgActionGroup:
            ret = sel && sel->groupSelection(sender);
            break;

        case kMgActionUngroup:
            ret = sel && sel->ungroupSelection(sender);
            break;
            
        case kMgActionFixedLength:
        case kMgActionFreeLength:
            ret = sel && sel->setFixedLength(sender, !sel->isFixedLength(view));
            break;
            
        case kMgActionLocked:
        case kMgActionUnlocked:
            ret = sel && sel->setLocked(sender, !sel->isLocked(view));
            break;
            
        case kMgActionEditVertex:
        case kMgActionHideVertex:
            ret = sel && sel->setEditMode(sender, !sel->isEditMode(view));
            break;
            
        case kMgActionClosed:
        case kMgActionOpened:
            ret = sel && sel->switchClosed(sender);
            break;
            
        case kMgActionAddVertex:
            ret = sel && sel->insertVertext(sender);
            break;
            
        case kMgActionDelVertex:
            ret = sel && sel->deleteVertext(sender);
            break;
            
        case kMgActionOverturn:
            ret = sel && sel->overturnPolygon(sender);
            break;
            
        default: {
            ret = sender->view->getCmdSubject()->doAction(sender, action);
            MgCommand* cmd = getCommand();
            ret = ret || (cmd && cmd->doContextAction(sender, action));
            
            if (!ret && cmd && !cmd->isDrawingCommand()) {
                ret = sender->view->getCmdSubject()->doEndAction(sender, action);
                cmd = findCommand(_drawcmd.c_str());
                ret = ret || (cmd && cmd->doContextAction(sender, action));
            }
            break;
        }
    }
    LOGD("doAction(%d) %s", action, ret ? "ok" : "fail");
    
    return ret;
}
开发者ID:arthur-zhang,项目名称:touchvg,代码行数:88,代码来源:mgactions.cpp


注:本文中的MgCommand::isDrawingCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。