- if(Dist <= 1.e-9) {
- BRepBuilderAPI_MakeVertex MakeVertex(P1);
- mySimulationTopoDs = MakeVertex.Vertex();
- myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
-
- GroupC1->LineEdit3->setText("0.0");
- }
- else {
- BRepBuilderAPI_MakeEdge MakeEdge(P1, P2);
- mySimulationTopoDs = MakeEdge.Edge();
-
- TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1);
- TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2);
-
- QString S;
- S.sprintf("%.1f", Dist);
-
- gp_Pnt P3;
- P3.SetX((P1.X() + P2.X()) / 2);
- P3.SetY((P1.Y() + P2.Y()) / 2);
- P3.SetZ(((P1.Z() + P2.Z()) / 2) + 100);
- gp_Vec va(P3, P1);
- gp_Vec vb(P3, P2);
- if(va.IsParallel(vb, Precision::Angular())) {
- P3.SetY(((P1.Y() + P2.Y()) / 2) + 100);
- P3.SetZ(((P1.Z() + P2.Z()) / 2));
- }
- gce_MakePln gce_MP(P1, P2, P3);
- gp_Pln gp_P = gce_MP.Value();
- Handle(Geom_Plane) P = new Geom_Plane(gp_P);
-
- Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension(V1, V2, P, Dist, TCollection_ExtendedString(strdup(S)));
-
- GroupC1->LineEdit3->setText(S);
-
- if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
- ic->Display(Distance);
- ic->UpdateCurrentViewer();
- }
- }
+ Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension(
+ aVert1, aVert2, P, aDist, TCollection_ExtendedString( (Standard_CString)aLabel.latin1() ) );
+
+ SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+ SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) );
+
+ //QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView();
+ //OCCViewer_Prs* aPrs = dynamic_cast<OCCViewer_Prs*>( vf->CreatePrs( 0 ) );
+
+ if ( aPrs )
+ aPrs->AddObject( anIO );
+
+ return aPrs;