本文整理汇总了C++中Group::Activate方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::Activate方法的具体用法?C++ Group::Activate怎么用?C++ Group::Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::Activate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopOntoCurrentFrom
void SolveSpaceUI::PopOntoCurrentFrom(UndoStack *uk) {
int i;
ssassert(uk->cnt > 0, "Cannot pop from empty undo stack");
(uk->cnt)--;
uk->write = WRAP(uk->write - 1, MAX_UNDO);
UndoState *ut = &(uk->d[uk->write]);
// Free everything in the main copy of the program before replacing it
for(i = 0; i < SK.groupOrder.n; i++) {
Group *g = SK.GetGroup(SK.groupOrder.elem[i]);
g->Clear();
}
SK.group.Clear();
SK.groupOrder.Clear();
SK.request.Clear();
SK.constraint.Clear();
SK.param.Clear();
SK.style.Clear();
// And then do a shallow copy of the state from the undo list
ut->group.MoveSelfInto(&(SK.group));
for(i = 0; i < ut->groupOrder.n; i++)
SK.groupOrder.Add(&ut->groupOrder.elem[i]);
ut->request.MoveSelfInto(&(SK.request));
ut->constraint.MoveSelfInto(&(SK.constraint));
ut->param.MoveSelfInto(&(SK.param));
ut->style.MoveSelfInto(&(SK.style));
SS.GW.activeGroup = ut->activeGroup;
// No need to free it, since a shallow copy was made above
*ut = {};
// And reset the state everywhere else in the program, since the
// sketch just changed a lot.
SS.GW.ClearSuper();
SS.TW.ClearSuper();
SS.ReloadAllImported();
SS.GenerateAll(SolveSpaceUI::Generate::ALL);
SS.ScheduleShowTW();
// Activate the group that was active before.
Group *activeGroup = SK.GetGroup(SS.GW.activeGroup);
activeGroup->Activate();
}
示例2: MenuGroup
//.........这里部分代码省略.........
g.opA = SS.GW.activeGroup;
g.name.strcpy("lathe");
break;
case GraphicsWindow::MNU_GROUP_ROT: {
if(gs.points == 1 && gs.n == 1 && SS.GW.LockedInWorkplane()) {
g.predef.origin = gs.point[0];
Entity *w = SK.GetEntity(SS.GW.ActiveWorkplane());
g.predef.entityB = w->Normal()->h;
g.activeWorkplane = w->h;
} else if(gs.points == 1 && gs.vectors == 1 && gs.n == 2) {
g.predef.origin = gs.point[0];
g.predef.entityB = gs.vector[0];
} else {
Error("Bad selection for new rotation. This group can "
"be created with:\n\n"
" * a point, while locked in workplane (rotate "
"in plane, about that point)\n"
" * a point and a line or a normal (rotate about "
"an axis through the point, and parallel to "
"line / normal)\n");
return;
}
g.type = ROTATE;
g.opA = SS.GW.activeGroup;
g.valA = 3;
g.subtype = ONE_SIDED;
g.name.strcpy("rotate");
break;
}
case GraphicsWindow::MNU_GROUP_TRANS:
g.type = TRANSLATE;
g.opA = SS.GW.activeGroup;
g.valA = 3;
g.subtype = ONE_SIDED;
g.predef.entityB = SS.GW.ActiveWorkplane();
g.activeWorkplane = SS.GW.ActiveWorkplane();
g.name.strcpy("translate");
break;
case GraphicsWindow::MNU_GROUP_IMPORT: {
g.type = IMPORTED;
g.opA = SS.GW.activeGroup;
if(strlen(g.impFile) == 0) {
if(!GetOpenFile(g.impFile, SLVS_EXT, SLVS_PATTERN)) return;
}
// Assign the default name of the group based on the name of
// the imported file.
char groupName[MAX_PATH];
strcpy(groupName, g.impFile);
char *dot = strrchr(groupName, '.');
if(dot) *dot = '\0';
char *s, *start = groupName;
for(s = groupName; *s; s++) {
if(*s == '/' || *s == '\\') {
start = s + 1;
} else if(isalnum(*s)) {
// do nothing, valid character
} else {
// convert invalid characters (like spaces) to dashes
*s = '-';
}
}
if(strlen(start) > 0) {
g.name.strcpy(start);
} else {
g.name.strcpy("import");
}
g.meshCombine = COMBINE_AS_ASSEMBLE;
break;
}
default: oops();
}
SS.GW.ClearSelection();
SS.UndoRemember();
SK.group.AddAndAssignId(&g);
Group *gg = SK.GetGroup(g.h);
if(gg->type == IMPORTED) {
SS.ReloadAllImported();
}
gg->clean = false;
SS.GW.activeGroup = gg->h;
SS.GenerateAll();
if(gg->type == DRAWING_WORKPLANE) {
// Can't set the active workplane for this one until after we've
// regenerated, because the workplane doesn't exist until then.
gg->activeWorkplane = gg->h.entity(0);
}
gg->Activate();
SS.GW.AnimateOntoWorkplane();
TextWindow::ScreenSelectGroup(0, gg->h.v);
SS.later.showTW = true;
}