Mesh segmentation

This commit is contained in:
wmayer
2012-05-18 15:57:32 +02:00
parent 9bbc10bdd9
commit 47d0418e7c
11 changed files with 488 additions and 10 deletions

View File

@@ -69,6 +69,7 @@
#include "ViewProviderMeshFaceSet.h"
#include "ViewProviderCurvature.h"
#include "MeshEditor.h"
#include "Segmentation.h"
using namespace Mesh;
@@ -1368,6 +1369,39 @@ bool CmdMeshFillInteractiveHole::isActive(void)
return false;
}
DEF_STD_CMD_A(CmdMeshSegmentation);
CmdMeshSegmentation::CmdMeshSegmentation()
: Command("Mesh_Segmentation")
{
sAppModule = "Mesh";
sGroup = QT_TR_NOOP("Mesh");
sMenuText = QT_TR_NOOP("Create mesh segments...");
sToolTipText = QT_TR_NOOP("Create mesh segments");
sWhatsThis = "Mesh_Segmentation";
sStatusTip = QT_TR_NOOP("Create mesh segments");
}
void CmdMeshSegmentation::activated(int iMsg)
{
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType
(Mesh::Feature::getClassTypeId());
Mesh::Feature* mesh = static_cast<Mesh::Feature*>(objs.front());
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
if (!dlg) {
dlg = new MeshGui::TaskSegmentation(mesh);
}
Gui::Control().showDialog(dlg);
}
bool CmdMeshSegmentation::isActive(void)
{
if (Gui::Control().activeDialog())
return false;
return Gui::Selection().countObjectsOfType
(Mesh::Feature::getClassTypeId()) == 1;
}
void CreateMeshCommands(void)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
@@ -1400,4 +1434,5 @@ void CreateMeshCommands(void)
rcCmdMgr.addCommand(new CmdMeshFillInteractiveHole());
rcCmdMgr.addCommand(new CmdMeshRemoveCompByHand());
rcCmdMgr.addCommand(new CmdMeshFromGeometry());
rcCmdMgr.addCommand(new CmdMeshSegmentation());
}