+ // collect the objects of the parameter presentation to avoid a repeted objects in the result
+ QObjectPtrList aPresentationObjects;
+ QList<ModuleBase_ViewerPrs>::const_iterator aPrsIt = thePresentations.begin(),
+ aPrsLast = thePresentations.end();
+ for (; aPrsIt != aPrsLast; aPrsIt++) {
+ aPresentationObjects.push_back((*aPrsIt).object());
+ }
+
+ QObjectPtrList anObjects = selectedObjects();
+ QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
+ for (; anIt != aLast; anIt++) {
+ ObjectPtr anObject = *anIt;
+ if (anObject.get() != NULL && !aPresentationObjects.contains(anObject)) {
+ thePresentations.append(ModuleBase_ViewerPrs(anObject, TopoDS_Shape(), NULL));
+ }
+ }
+}
+
+void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
+{
+ thePrs.setOwner(theOwner);
+
+ Handle(AIS_InteractiveObject) anIO =
+ Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+ thePrs.setInteractive(anIO);
+
+ // we should not check the appearance of this feature because there can be some selected shapes
+ // for one feature
+ Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if( !aBRO.IsNull() && aBRO->HasShape() ) {
+ // the located method is called in the context to obtain the shape by the SelectedShape() method,
+ // so the shape is located by the same rules
+ TopoDS_Shape aShape = aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
+#ifndef DEBUG_DELIVERY
+ if (aShape.IsNull())
+ aShape = findAxisShape(anIO);
+#endif
+ if (!aShape.IsNull())
+ thePrs.setShape(aShape);
+ } else {
+#ifdef DEBUG_DELIVERY
+ // Fill by trihedron shapes
+ Handle(AIS_Axis) aAxis = Handle(AIS_Axis)::DownCast(anIO);
+ if (!aAxis.IsNull()) {
+ // an Axis from Trihedron
+ Handle(Geom_Line) aLine = aAxis->Component();
+ Handle(Prs3d_DatumAspect) DA = aAxis->Attributes()->DatumAspect();
+ Handle(Geom_TrimmedCurve) aTLine = new Geom_TrimmedCurve(aLine, 0, DA->FirstAxisLength());
+
+ BRep_Builder aBuilder;
+ TopoDS_Edge aEdge;
+ aBuilder.MakeEdge(aEdge, aTLine, Precision::Confusion());
+ if (!aEdge.IsNull())
+ thePrs.setShape(aEdge);
+ } else {
+ Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast(anIO);
+ if (!aPoint.IsNull()) {
+ // A point from trihedron
+ Handle(Geom_Point) aPnt = aPoint->Component();
+ BRep_Builder aBuilder;
+ TopoDS_Vertex aVertex;
+ aBuilder.MakeVertex(aVertex, aPnt->Pnt(), Precision::Confusion());
+ if (!aVertex.IsNull())
+ thePrs.setShape(aVertex);
+ }
+ }
+#endif
+ }
+