- for ( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) {
- TopoDS_Vertex aVertex;
- TopoDS_Shape aShape = aContext->SelectedShape();
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
- aVertex = TopoDS::Vertex( aContext->SelectedShape() );
- else {
- Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
- if ( !anOwner.IsNull() ) {
- Handle(AIS_InteractiveObject) anAIS = Handle(AIS_InteractiveObject)::DownCast( anOwner->Selectable() );
- if ( !anAIS.IsNull() ) {
- Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast( anAIS);
- if ( !aPoint.IsNull() )
- aVertex = TopoDS::Vertex( aPoint->Vertex() );
- }
- if ( aVertex.IsNull() ) {
- // the following happens if there are no points in the current curve, there is only a shape
- /*Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
- if ( aBrepOwner.IsNull() )
- continue;
- if ( aBrepOwner->HasShape() ) {
- const TopoDS_Shape& aShape = aBrepOwner->Shape();
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
- {
- aVertex = TopoDS::Vertex( aShape );
- }
- }*/
- }
- }
- }
- if ( aVertex.IsNull() )
- continue;
- aPnt = BRep_Tool::Pnt( aVertex );
- addLocalPointToTable( aPnt.X(), aPnt.Y() );