+
+
+void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
+{
+ Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
+ Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
+ if (!aDim.IsNull()) {
+ aCtx->SetZLayer(aDim, myVisualLayerId);
+ } else {
+ Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
+ if (!aCons.IsNull())
+ aCtx->SetZLayer(aCons, myVisualLayerId);
+ }
+ }
+}
+
+void PartSet_Module::onViewTransformed(int theTrsfType)
+{
+ // Set length of arrows constant in pixel size
+ // if the operation is panning or rotate or panglobal then do nothing
+ if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
+ return;
+
+ ModuleBase_IViewer* aViewer = myWorkshop->viewer();
+ Handle(V3d_View) aView = aViewer->activeView();
+
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+
+ double aLen = aView->Convert(15);
+
+ SketcherPrs_Tools::setArrowSize(aLen);
+ bool isModified = false;
+ QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
+ foreach (AISObjectPtr aAIS, aPrsList) {
+ Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
+
+ Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
+ if (!aDim.IsNull()) {
+ aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
+ aContext->Redisplay(aDim, false);
+ isModified = true;
+ }
+ }
+ if (isModified)
+ aDisplayer->updateViewer();
+}