Part Dimension: alterations to existing files
Not sure what is happening with View3dInventorViewer.h. The only REAL change, beyond the addition of dim functions, is the removal of the member arrowrotation. It wasn't referenced anywhere.
This commit is contained in:
parent
32134f64f0
commit
59e69bbe0e
|
@ -152,6 +152,9 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::W
|
|||
OnChange(*hGrp,"OrbitStyle");
|
||||
OnChange(*hGrp,"Sensitivity");
|
||||
OnChange(*hGrp,"ResetCursorPosition");
|
||||
OnChange(*hGrp,"DimensionsVisible");
|
||||
OnChange(*hGrp,"Dimensions3dVisible");
|
||||
OnChange(*hGrp,"DimensionsDeltaVisible");
|
||||
|
||||
stopSpinTimer = new QTimer(this);
|
||||
connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating()));
|
||||
|
@ -360,7 +363,28 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
|
|||
else
|
||||
_viewer->setCameraType(SoPerspectiveCamera::getClassTypeId());
|
||||
}
|
||||
else {
|
||||
else if (strcmp(Reason, "DimensionsVisible") == 0)
|
||||
{
|
||||
if (rGrp.GetBool("DimensionsVisible", true))
|
||||
_viewer->turnAllDimensionsOn();
|
||||
else
|
||||
_viewer->turnAllDimensionsOff();
|
||||
}
|
||||
else if (strcmp(Reason, "Dimensions3dVisible") == 0)
|
||||
{
|
||||
if (rGrp.GetBool("Dimensions3dVisible", true))
|
||||
_viewer->turn3dDimensionsOn();
|
||||
else
|
||||
_viewer->turn3dDimensionsOff();
|
||||
}
|
||||
else if (strcmp(Reason, "DimensionsDeltaVisible") == 0)
|
||||
{
|
||||
if (rGrp.GetBool("DimensionsDeltaVisible", true))
|
||||
_viewer->turnDeltaDimensionsOn();
|
||||
else
|
||||
_viewer->turnDeltaDimensionsOff();
|
||||
}
|
||||
else{
|
||||
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
|
||||
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
|
||||
unsigned long col3 = rGrp.GetUnsigned("BackgroundColor3",2880160255UL); // default color (blue/grey)
|
||||
|
|
|
@ -250,6 +250,11 @@ View3DInventorViewer::View3DInventorViewer (QWidget *parent, const char *name,
|
|||
pEventCallback->ref();
|
||||
pcViewProviderRoot->addChild(pEventCallback);
|
||||
pEventCallback->addEventCallback(SoEvent::getClassTypeId(), handleEventCB, this);
|
||||
|
||||
dimensionRoot = new SoSwitch(SO_SWITCH_NONE);
|
||||
pcViewProviderRoot->addChild(dimensionRoot);
|
||||
dimensionRoot->addChild(new SoSwitch()); //first one will be for the 3d dimensions.
|
||||
dimensionRoot->addChild(new SoSwitch()); //second one for the delta dimensions.
|
||||
|
||||
// This is a callback node that logs all action that traverse the Inventor tree.
|
||||
#if defined (FC_DEBUG) && defined(FC_LOGGING_CB)
|
||||
|
@ -2182,3 +2187,49 @@ std::vector<ViewProvider*> View3DInventorViewer::getViewProvidersOfType(const Ba
|
|||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::turnAllDimensionsOn()
|
||||
{
|
||||
dimensionRoot->whichChild = SO_SWITCH_ALL;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::turnAllDimensionsOff()
|
||||
{
|
||||
dimensionRoot->whichChild = SO_SWITCH_NONE;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::eraseAllDimensions()
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(0))->removeAllChildren();
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(1))->removeAllChildren();
|
||||
}
|
||||
|
||||
void View3DInventorViewer::turn3dDimensionsOn()
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(0))->whichChild = SO_SWITCH_ALL;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::turn3dDimensionsOff()
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(0))->whichChild = SO_SWITCH_NONE;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::addDimension3d(SoNode *node)
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(0))->addChild(node);
|
||||
}
|
||||
|
||||
void View3DInventorViewer::addDimensionDelta(SoNode *node)
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(1))->addChild(node);
|
||||
}
|
||||
|
||||
void View3DInventorViewer::turnDeltaDimensionsOn()
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(1))->whichChild = SO_SWITCH_ALL;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::turnDeltaDimensionsOff()
|
||||
{
|
||||
static_cast<SoSwitch *>(dimensionRoot->getChild(1))->whichChild = SO_SWITCH_NONE;
|
||||
}
|
||||
|
|
|
@ -112,8 +112,8 @@ public:
|
|||
SbBool isBacklight(void) const;
|
||||
void setSceneGraph (SoNode *root);
|
||||
|
||||
void setAnimationEnabled(const SbBool enable);
|
||||
SbBool isAnimationEnabled(void) const;
|
||||
void setAnimationEnabled(const SbBool enable);
|
||||
SbBool isAnimationEnabled(void) const;
|
||||
|
||||
void setPopupMenuEnabled(const SbBool on);
|
||||
SbBool isPopupMenuEnabled(void) const;
|
||||
|
@ -121,16 +121,16 @@ public:
|
|||
void startAnimating(const SbVec3f& axis, float velocity);
|
||||
void stopAnimating(void);
|
||||
SbBool isAnimating(void) const;
|
||||
|
||||
void setFeedbackVisibility(const SbBool enable);
|
||||
SbBool isFeedbackVisible(void) const;
|
||||
|
||||
void setFeedbackSize(const int size);
|
||||
int getFeedbackSize(void) const;
|
||||
|
||||
void setRenderFramebuffer(const SbBool enable);
|
||||
SbBool isRenderFramebuffer() const;
|
||||
void renderToFramebuffer(QGLFramebufferObject*);
|
||||
void setFeedbackVisibility(const SbBool enable);
|
||||
SbBool isFeedbackVisible(void) const;
|
||||
|
||||
void setFeedbackSize(const int size);
|
||||
int getFeedbackSize(void) const;
|
||||
|
||||
void setRenderFramebuffer(const SbBool enable);
|
||||
SbBool isRenderFramebuffer() const;
|
||||
void renderToFramebuffer(QGLFramebufferObject*);
|
||||
|
||||
virtual void setViewing(SbBool enable);
|
||||
virtual void setCursorEnabled(SbBool enable);
|
||||
|
@ -193,8 +193,8 @@ public:
|
|||
void setEditingCursor (const QCursor& cursor);
|
||||
void setRedirectToSceneGraph(SbBool redirect) { this->redirected = redirect; }
|
||||
SbBool isRedirectedToSceneGraph() const { return this->redirected; }
|
||||
void setRedirectToSceneGraphEnabled(SbBool enable) { this->allowredir = enable; }
|
||||
SbBool isRedirectToSceneGraphEnabled(void) const { return this->allowredir; }
|
||||
void setRedirectToSceneGraphEnabled(SbBool enable) { this->allowredir = enable; }
|
||||
SbBool isRedirectToSceneGraphEnabled(void) const { return this->allowredir; }
|
||||
//@}
|
||||
|
||||
/** @name Pick actions */
|
||||
|
@ -241,6 +241,23 @@ public:
|
|||
/** Project the given normalized 2d point onto the far plane */
|
||||
SbVec3f projectOnFarPlane(const SbVec2f&) const;
|
||||
//@}
|
||||
|
||||
/** @name Dimension controls
|
||||
* the "turn*" functions are wired up to parameter groups through view3dinventor.
|
||||
* don't call them directly. instead set the parameter groups.
|
||||
* @see TaskDimension
|
||||
*/
|
||||
//@{
|
||||
void turnAllDimensionsOn();
|
||||
void turnAllDimensionsOff();
|
||||
void turn3dDimensionsOn();
|
||||
void turn3dDimensionsOff();
|
||||
void turnDeltaDimensionsOn();
|
||||
void turnDeltaDimensionsOff();
|
||||
void eraseAllDimensions();
|
||||
void addDimension3d(SoNode *node);
|
||||
void addDimensionDelta(SoNode *node);
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Set the camera's orientation. If isAnimationEnabled() returns
|
||||
|
@ -320,7 +337,6 @@ private:
|
|||
SoFCBackgroundGradient *pcBackGround;
|
||||
SoSeparator * backgroundroot;
|
||||
SoSeparator * foregroundroot;
|
||||
SoRotationXYZ * arrowrotation;
|
||||
SoDirectionalLight* backlight;
|
||||
|
||||
SoSeparator * pcViewProviderRoot;
|
||||
|
@ -328,6 +344,7 @@ private:
|
|||
NavigationStyle* navigation;
|
||||
SoFCUnifiedSelection* selectionRoot;
|
||||
QGLFramebufferObject* framebuffer;
|
||||
SoSwitch *dimensionRoot;
|
||||
|
||||
// small axis cross in the corner
|
||||
SbBool axiscrossEnabled;
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "ViewProviderPrism.h"
|
||||
#include "ViewProviderSpline.h"
|
||||
#include "ViewProviderRegularPolygon.h"
|
||||
|
||||
#include "TaskDimension.h"
|
||||
#include "DlgSettingsGeneral.h"
|
||||
#include "DlgSettingsObjectColor.h"
|
||||
#include "DlgSettings3DViewPartImp.h"
|
||||
|
@ -146,6 +146,9 @@ void PartGuiExport initPartGui()
|
|||
PartGui::ViewProviderConeParametric ::init();
|
||||
PartGui::ViewProviderTorusParametric ::init();
|
||||
PartGui::ViewProviderRuledSurface ::init();
|
||||
PartGui::DimensionLinear ::initClass();
|
||||
PartGui::DimensionAngular ::initClass();
|
||||
PartGui::ArcEngine ::initClass();
|
||||
|
||||
PartGui::Workbench ::init();
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ set(PartGui_MOC_HDRS
|
|||
TaskOffset.h
|
||||
TaskSweep.h
|
||||
TaskThickness.h
|
||||
TaskDimension.h
|
||||
TaskCheckGeometry.h
|
||||
)
|
||||
fc_wrap_cpp(PartGui_MOC_SRCS ${PartGui_MOC_HDRS})
|
||||
|
@ -208,6 +209,8 @@ SET(PartGui_SRCS
|
|||
TaskSweep.ui
|
||||
TaskThickness.cpp
|
||||
TaskThickness.h
|
||||
TaskDimension.cpp
|
||||
TaskDimension.h
|
||||
TaskCheckGeometry.cpp
|
||||
TaskCheckGeometry.h
|
||||
)
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "TaskShapeBuilder.h"
|
||||
#include "TaskLoft.h"
|
||||
#include "TaskSweep.h"
|
||||
#include "TaskDimension.h"
|
||||
#include "TaskCheckGeometry.h"
|
||||
|
||||
|
||||
|
@ -1495,6 +1496,179 @@ bool CmdColorPerFace::isActive(void)
|
|||
return (hasActiveDocument() && !Gui::Control().activeDialog() && objectSelected);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Measure_Linear
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdMeasureLinear);
|
||||
|
||||
CmdMeasureLinear::CmdMeasureLinear()
|
||||
: Command("Part_Measure_Linear")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Measure Linear");
|
||||
sToolTipText = QT_TR_NOOP("Measure Linear");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Measure_Linear";
|
||||
}
|
||||
|
||||
void CmdMeasureLinear::activated(int iMsg)
|
||||
{
|
||||
PartGui::goDimensionLinearRoot();
|
||||
}
|
||||
|
||||
bool CmdMeasureLinear::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Measure_Angular
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdMeasureAngular);
|
||||
|
||||
CmdMeasureAngular::CmdMeasureAngular()
|
||||
: Command("Part_Measure_Angular")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Measure Angular");
|
||||
sToolTipText = QT_TR_NOOP("Measure Angular");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Measure_Angular";
|
||||
}
|
||||
|
||||
void CmdMeasureAngular::activated(int iMsg)
|
||||
{
|
||||
PartGui::goDimensionAngularRoot();
|
||||
}
|
||||
|
||||
bool CmdMeasureAngular::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Measure_Clear_All
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdMeasureClearAll);
|
||||
|
||||
CmdMeasureClearAll::CmdMeasureClearAll()
|
||||
: Command("Part_Measure_Clear_All")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Clear All");
|
||||
sToolTipText = QT_TR_NOOP("Clear All");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Measure_Clear_All";
|
||||
}
|
||||
|
||||
void CmdMeasureClearAll::activated(int iMsg)
|
||||
{
|
||||
PartGui::eraseAllDimensions();
|
||||
}
|
||||
|
||||
bool CmdMeasureClearAll::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Measure_Toggle_All
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdMeasureToggleAll);
|
||||
|
||||
CmdMeasureToggleAll::CmdMeasureToggleAll()
|
||||
: Command("Part_Measure_Toggle_All")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Toggle All");
|
||||
sToolTipText = QT_TR_NOOP("Toggle All");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Measure_Toggle_All";
|
||||
}
|
||||
|
||||
void CmdMeasureToggleAll::activated(int iMsg)
|
||||
{
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("View");
|
||||
bool visibility = group->GetBool("DimensionsVisible", true);
|
||||
if (visibility)
|
||||
group->SetBool("DimensionsVisible", false);
|
||||
else
|
||||
group->SetBool("DimensionsVisible", true);
|
||||
}
|
||||
|
||||
bool CmdMeasureToggleAll::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Measure_Toggle_3d
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdMeasureToggle3d);
|
||||
|
||||
CmdMeasureToggle3d::CmdMeasureToggle3d()
|
||||
: Command("Part_Measure_Toggle_3d")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Toggle 3d");
|
||||
sToolTipText = QT_TR_NOOP("Toggle 3d");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Measure_Toggle_3d";
|
||||
}
|
||||
|
||||
void CmdMeasureToggle3d::activated(int iMsg)
|
||||
{
|
||||
PartGui::toggle3d();
|
||||
}
|
||||
|
||||
bool CmdMeasureToggle3d::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Measure_Toggle_Delta
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdMeasureToggleDelta);
|
||||
|
||||
CmdMeasureToggleDelta::CmdMeasureToggleDelta()
|
||||
: Command("Part_Measure_Toggle_Delta")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Toggle Delta");
|
||||
sToolTipText = QT_TR_NOOP("Toggle Delta");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Part_Measure_Toggle_Delta";
|
||||
}
|
||||
|
||||
void CmdMeasureToggleDelta::activated(int iMsg)
|
||||
{
|
||||
PartGui::toggleDelta();
|
||||
}
|
||||
|
||||
bool CmdMeasureToggleDelta::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
void CreatePartCommands(void)
|
||||
{
|
||||
|
@ -1531,4 +1705,10 @@ void CreatePartCommands(void)
|
|||
rcCmdMgr.addCommand(new CmdPartThickness());
|
||||
rcCmdMgr.addCommand(new CmdCheckGeometry());
|
||||
rcCmdMgr.addCommand(new CmdColorPerFace());
|
||||
rcCmdMgr.addCommand(new CmdMeasureLinear());
|
||||
rcCmdMgr.addCommand(new CmdMeasureAngular());
|
||||
rcCmdMgr.addCommand(new CmdMeasureClearAll());
|
||||
rcCmdMgr.addCommand(new CmdMeasureToggleAll());
|
||||
rcCmdMgr.addCommand(new CmdMeasureToggle3d());
|
||||
rcCmdMgr.addCommand(new CmdMeasureToggleDelta());
|
||||
}
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
<file>icons/Part_Point_Parametric.svg</file>
|
||||
<file>icons/Part_Polygon_Parametric.svg</file>
|
||||
<file>icons/Part_Spline_Parametric.svg</file>
|
||||
<file>icons/Part_Measure_Linear.svg</file>
|
||||
<file>icons/Part_Measure_Angular.svg</file>
|
||||
<file>icons/Part_Measure_Clear_All.svg</file>
|
||||
<file>icons/Part_Measure_Toggle_All.svg</file>
|
||||
<file>icons/Part_Measure_Toggle_3d.svg</file>
|
||||
<file>icons/Part_Measure_Toggle_Delta.svg</file>
|
||||
<file>icons/Part_Measure_Step_Active.svg</file>
|
||||
<file>icons/Part_Measure_Step_Done.svg</file>
|
||||
<file>icons/Tree_Part_Box_Parametric.svg</file>
|
||||
<file>icons/Tree_Part_Cylinder_Parametric.svg</file>
|
||||
<file>icons/Tree_Part_Cone_Parametric.svg</file>
|
||||
|
|
|
@ -66,6 +66,11 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
Gui::MenuItem* bop = new Gui::MenuItem;
|
||||
bop->setCommand("Boolean");
|
||||
*bop << "Part_Boolean" << "Part_Cut" << "Part_Fuse" << "Part_Common";
|
||||
|
||||
Gui::MenuItem* measure = new Gui::MenuItem;
|
||||
measure->setCommand("Measure");
|
||||
*measure << "Part_Measure_Linear" << "Part_Measure_Angular" << "Part_Measure_Clear_All" << "Part_Measure_Toggle_All" <<
|
||||
"Part_Measure_Toggle_3d" << "Part_Measure_Toggle_Delta";
|
||||
|
||||
Gui::MenuItem* part = new Gui::MenuItem;
|
||||
root->insertItem(item, part);
|
||||
|
@ -74,7 +79,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
*part << prim << "Part_Primitives" << "Part_Builder" << "Separator"
|
||||
<< "Part_ShapeFromMesh" << "Part_MakeSolid" << "Part_ReverseShape"
|
||||
<< "Part_SimpleCopy" << "Part_RefineShape" << "Part_CheckGeometry"
|
||||
<< "Separator" << bop << "Separator"
|
||||
<< measure << "Separator" << bop << "Separator"
|
||||
<< "Part_CrossSections" << "Part_Compound" << "Part_Extrude"
|
||||
<< "Part_Revolve" << "Part_Mirror" << "Part_Fillet" << "Part_Chamfer"
|
||||
<< "Part_RuledSurface" << "Part_Loft" << "Part_Sweep"
|
||||
|
@ -114,6 +119,11 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
boolop->setCommand("Boolean");
|
||||
*boolop << "Part_Boolean" << "Part_Cut" << "Part_Fuse" << "Part_Common"
|
||||
<< "Part_CheckGeometry" << "Part_Section" << "Part_CrossSections";
|
||||
|
||||
Gui::ToolBarItem* measure = new Gui::ToolBarItem(root);
|
||||
measure->setCommand("Measure");
|
||||
*measure << "Part_Measure_Linear" << "Part_Measure_Angular" << "Part_Measure_Clear_All" << "Part_Measure_Toggle_All"
|
||||
<< "Part_Measure_Toggle_3d" << "Part_Measure_Toggle_Delta";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
@ -124,4 +134,3 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
|||
Gui::ToolBarItem* root = new Gui::ToolBarItem;
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user