本文整理汇总了C++中MgCommand::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ MgCommand::getName方法的具体用法?C++ MgCommand::getName怎么用?C++ MgCommand::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MgCommand
的用法示例。
在下文中一共展示了MgCommand::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: gestureToCommand
bool GiCoreViewImpl::gestureToCommand(const MgMotion& motion)
{
MgDynShapeLock locker(true, motion.view);
MgCommand* cmd = _cmds->getCommand();
bool ret = false;
if (motion.gestureState == kMgGestureCancel || !cmd) {
return cmd && cmd->cancel(&motion);
}
if (motion.gestureState == kMgGesturePossible
&& motion.gestureType != kGiTwoFingersMove) {
return true;
}
switch (motion.gestureType)
{
case kGiTwoFingersMove:
ret = cmd->twoFingersMove(&motion);
break;
case kGiGesturePan:
switch (motion.gestureState)
{
case kMgGestureBegan:
ret = cmd->touchBegan(&motion);
break;
case kMgGestureMoved:
ret = cmd->touchMoved(&motion);
break;
case kMgGestureEnded:
default:
ret = cmd->touchEnded(&motion);
break;
}
break;
case kGiGestureTap:
ret = cmd->click(&motion);
break;
case kGiGestureDblTap:
ret = cmd->doubleClick(&motion);
break;
case kGiGesturePress:
ret = cmd->longPress(&motion);
break;
}
if (!ret) {
LOGD("The current command (%s) don't support #%d gesture (state=%d)",
cmd->getName(), motion.gestureType, motion.gestureState);
}
return ret;
}
示例3: getBoundingBox
void MgCmdManagerImpl::getBoundingBox(Box2d& box, const MgMotion* sender)
{
MgCommand* cmd = sender->cmds()->getCommand();
Box2d selbox;
if (cmd && strcmp(cmd->getName(), MgCmdSelect::Name()) == 0) {
MgCmdSelect* sel = (MgCmdSelect*)cmd;
selbox = sel->getBoundingBox(sender);
}
box = selbox.isEmpty() ? Box2d(sender->pointM, 0, 0) : selbox;
box *= sender->view->xform()->modelToDisplay();
box.normalize();
}
示例4: getCommandName
const char* MgCmdManagerImpl::getCommandName()
{
MgCommand* cmd = getCommand();
return cmd ? cmd->getName() : "";
}