- **Sketch auxiliary entity color** selects default color for sketch auxiliary objects;\r
- **Sketch overconstraint color** selects default color for a sketch with redundant constraints;\r
- **Sketch fully constraint color** selects default color for a sketch with zero degrees of freedom.\r
+- **Zoom trihedron arrows** if this control is checked then arrows of a view trihedron will be scaled according to current view scale\r
+- **Axis arrow size** relative size of trihedron arrows. It has effect only in case if **Zoom trihedron arrows** is On.\r
\r
To redefine any color click on the corresponding line to access **Select color** dialog box\r
\r
/// \param theAIS a presentation object
virtual void onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS) {}
+ /// Called on transformation in current viewer
+ /// \param theTrsfType type of tranformation
+ virtual void onViewTransformed(int theTrsfType = 2) {}
+
protected slots:
/// Called on selection changed event
virtual void onSelectionChanged() {}
"Hidden faces transparency",
Config_Prop::DblSpin,
"0.8");
+
std::ostringstream aStream;
aStream << SketcherPrs_Tools::getDefaultArrowSize();
Config_PropManager::registerProp("Visualization", "dimension_arrow_size",
"Feature items in Object Browser",
Config_Prop::Color, FEATURE_ITEM_COLOR);
+ Config_PropManager::registerProp("Visualization", "zoom_trihedron_arrows",
+ "Zoom trihedron arrows", Config_Prop::Boolean, "false");
+
+ Config_PropManager::registerProp("Visualization", "axis_arrow_size",
+ "Axis arrow size", Config_Prop::IntSpin, "10");
+
Config_PropManager::registerProp("Shortcuts", "add_parameter_shortcut",
"Add parameter in parameters manager dialog",
Config_Prop::Shortcut, "Ctrl+A");
return;
bool isModified = false;
+ double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
if (aCurrentOperation &&
(PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) ||
sketchMgr()->isNestedSketchOperation(aCurrentOperation) ||
(aCurrentOperation->id() == "Measurement")))
{
- double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
double aPrevLen = SketcherPrs_Tools::getArrowSize();
SketcherPrs_Tools::setArrowSize(aLen);
isModified = true;
}
}
- if (isModified)
- aDisplayer->updateViewer();
}
+ // Manage trihedron arrows
+ if (Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows")) {
+ Handle(AIS_Trihedron) aTrihedron = aViewer->trihedron();
+ if (!aTrihedron.IsNull()) {
+ double aAxLen =
+ aView->Convert(Config_PropManager::integer("Visualization", "axis_arrow_size"));
+ Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+ double aAxisLen = aDatumAspect->AxisLength(Prs3d_DP_XAxis);
+ aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen);
+ aTrihedron->Attributes()->SetDatumAspect(aDatumAspect);
+ aContext->Redisplay(aTrihedron, false);
+ isModified = true;
+ }
+ }
+ if (isModified)
+ aDisplayer->updateViewer();
}
//******************************************************
/// Called on transformation in current viewer
/// \param theTrsfType type of tranformation
- void onViewTransformed(int theTrsfType = 2);
+ virtual void onViewTransformed(int theTrsfType = 2);
protected slots:
/// Called when previous operation is finished
SHAPERGUI::SHAPERGUI()
: LightApp_Module("SHAPER"),
mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false),
- myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false)
+ myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false),
+ myAxisArrowRate(-1)
{
myWorkshop = new XGUI_Workshop(this);
connect(myWorkshop, SIGNAL(commandStatusUpdated()),
XGUI_Displayer* aDisp = myWorkshop->displayer();
QObjectPtrList aObjList = aDisp->displayedObjects();
- //if (myHighlightPointAspect.IsNull()) {
- // Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
- // myHighlightPointAspect =
- // new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
- //}
if (myOldSelectionColor.size() == 0)
myOldSelectionColor = aDisp->selectionColor();
}
// Delete selector because it has to be redefined on next activation
if (mySelector) {
- //if (!myHighlightPointAspect.IsNull()) {
- // Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
- // aTrihedron->getHighlightPointAspect()->SetAspect(myHighlightPointAspect);
- // myHighlightPointAspect.Nullify();
- //}
+ // Restore size of arrows of trihedron
+ if (myAxisArrowRate > 0) {
+ Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+ Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+ aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate);
+ Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext();
+ aContext->Redisplay(aTrihedron, false);
+ }
myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
myProxyViewer->setSelector(0);
if (theMgr->getType() == OCCViewer_Viewer::Type()) {
OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
- //if (myHighlightPointAspect.IsNull()) {
- // Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
- // myHighlightPointAspect =
- // new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
- //}
+ // Remember current length of arrow of axis
+ Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
+ Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+ myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
+
SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
getApp()->selectionMgr());
#ifdef SALOME_PATCH_FOR_CTRL_WHEEL
std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
myWorkshop->displayer()->setSelectionColor(aColor);
+
+ // Cause scaling of arrows of axis and dimensions
+ myWorkshop->module()->onViewTransformed();
+
return aSelector;
}
return 0;
std::vector<int> myOldSelectionColor;
Handle(Graphic3d_AspectMarker3d) myHighlightPointAspect;
+
+ double myAxisArrowRate;
};
#endif
#include <QMouseEvent>
#include <QContextMenuEvent>
+#include <QTimer>
#if OCC_VERSION_HEX < 0x070400
#define SALOME_PATCH_FOR_CTRL_WHEEL
myWindowScale.insert(aView->getViewPort()->getView(),
aView->getViewPort()->getView()->Camera()->Scale());
- emit viewCreated(myView);
+ QTimer::singleShot(10, this, SLOT(onAfterViewCreated()));
+ emit viewCreated(myView);
+}
+//**********************************************
+void SHAPERGUI_SalomeViewer::onAfterViewCreated()
+{
+ // Update trihedron and dimension arrows
+ emit onViewTransformed(OCCViewer_ViewWindow::ZOOMVIEW);
}
+
//**********************************************
void SHAPERGUI_SalomeViewer::onActivated(SUIT_ViewManager* theMgr)
{
/// It is necessary to activate the viewer trihedron in the current selection mode
void onViewPortMapped();
+ /// Signal called in order to apdate viewer transformed objects
+ void onAfterViewCreated();
+
private:
SHAPERGUI_OCCSelector* mySelector;
SHAPERGUI_SalomeView* myView;