From: vpa Date: Fri, 11 Dec 2015 08:35:59 +0000 (+0300) Subject: 0026959: Visualization - cannot select edge of the shape X-Git-Tag: V7_0_0_beta~44 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=3667907665fd93bd81b1d52df2170d1b6b7cd02c 0026959: Visualization - cannot select edge of the shape - polygonal representation of the edge is used for sensitive entity computation regardless of requested deflection; - test case for issue #26959 Adjusting test case --- diff --git a/src/StdSelect/StdSelect_BRepSelectionTool.cxx b/src/StdSelect/StdSelect_BRepSelectionTool.cxx index acffeb6645..3726615426 100644 --- a/src/StdSelect/StdSelect_BRepSelectionTool.cxx +++ b/src/StdSelect/StdSelect_BRepSelectionTool.cxx @@ -323,40 +323,31 @@ void StdSelect_BRepSelectionTool // Function: GetPointsFromPolygon // Purpose : //================================================== -static Handle(TColgp_HArray1OfPnt) GetPointsFromPolygon (const TopoDS_Edge& theEdge, - const Standard_Real theDeflection) +static Handle(TColgp_HArray1OfPnt) GetPointsFromPolygon (const TopoDS_Edge& theEdge) { Handle(TColgp_HArray1OfPnt) aResultPoints; - Standard_Real fi, la; - Handle(Geom_Curve) CC3d = BRep_Tool::Curve (theEdge, fi, la); - TopLoc_Location aLocation; Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (theEdge, aLocation); if (!aPolygon.IsNull()) { - Standard_Boolean isOK = aPolygon->Deflection() <= theDeflection; - isOK = isOK || (CC3d.IsNull()); - if (isOK) + const TColgp_Array1OfPnt& aNodes = aPolygon->Nodes(); + aResultPoints = new TColgp_HArray1OfPnt (1, aNodes.Length()); + if (aLocation.IsIdentity()) { - const TColgp_Array1OfPnt& aNodes = aPolygon->Nodes(); - aResultPoints = new TColgp_HArray1OfPnt (1, aNodes.Length()); - if (aLocation.IsIdentity()) + for (Standard_Integer aNodeId (aNodes.Lower()), aPntId (1); aNodeId <= aNodes.Upper(); ++aNodeId, ++aPntId) { - for (Standard_Integer aNodeId (aNodes.Lower()), aPntId (1); aNodeId <= aNodes.Upper(); ++aNodeId, ++aPntId) - { - aResultPoints->SetValue (aPntId, aNodes.Value (aNodeId)); - } + aResultPoints->SetValue (aPntId, aNodes.Value (aNodeId)); } - else + } + else + { + for (Standard_Integer aNodeId (aNodes.Lower()), aPntId (1); aNodeId <= aNodes.Upper(); ++aNodeId, ++aPntId) { - for (Standard_Integer aNodeId (aNodes.Lower()), aPntId (1); aNodeId <= aNodes.Upper(); ++aNodeId, ++aPntId) - { - aResultPoints->SetValue (aPntId, aNodes.Value (aNodeId).Transformed (aLocation)); - } + aResultPoints->SetValue (aPntId, aNodes.Value (aNodeId).Transformed (aLocation)); } - return aResultPoints; } + return aResultPoints; } Handle(Poly_Triangulation) aTriangulation; @@ -364,31 +355,26 @@ static Handle(TColgp_HArray1OfPnt) GetPointsFromPolygon (const TopoDS_Edge& theE BRep_Tool::PolygonOnTriangulation (theEdge, anHIndices, aTriangulation, aLocation); if (!anHIndices.IsNull()) { - Standard_Boolean isOK = anHIndices->Deflection() <= theDeflection; - isOK = isOK || (CC3d.IsNull()); - if (isOK) - { - const TColStd_Array1OfInteger& anIndices = anHIndices->Nodes(); - const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes(); + const TColStd_Array1OfInteger& anIndices = anHIndices->Nodes(); + const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes(); - aResultPoints = new TColgp_HArray1OfPnt (1, anIndices.Length()); + aResultPoints = new TColgp_HArray1OfPnt (1, anIndices.Length()); - if (aLocation.IsIdentity()) + if (aLocation.IsIdentity()) + { + for (Standard_Integer anIndex (anIndices.Lower()), aPntId (1); anIndex <= anIndices.Upper(); ++anIndex, ++aPntId) { - for (Standard_Integer anIndex (anIndices.Lower()), aPntId (1); anIndex <= anIndices.Upper(); ++anIndex, ++aPntId) - { - aResultPoints->SetValue (aPntId, aNodes (anIndices (anIndex))); - } + aResultPoints->SetValue (aPntId, aNodes (anIndices (anIndex))); } - else + } + else + { + for (Standard_Integer anIndex (anIndices.Lower()), aPntId (1); anIndex <= anIndices.Upper(); ++anIndex, ++aPntId) { - for (Standard_Integer anIndex (anIndices.Lower()), aPntId (1); anIndex <= anIndices.Upper(); ++anIndex, ++aPntId) - { - aResultPoints->SetValue (aPntId, aNodes (anIndices (anIndex)).Transformed (aLocation)); - } + aResultPoints->SetValue (aPntId, aNodes (anIndices (anIndex)).Transformed (aLocation)); } - return aResultPoints; } + return aResultPoints; } return aResultPoints; } @@ -474,7 +460,7 @@ void StdSelect_BRepSelectionTool } // try to get points from existing polygons - Handle(TColgp_HArray1OfPnt) aPoints = GetPointsFromPolygon (anEdge, theDeflection); + Handle(TColgp_HArray1OfPnt) aPoints = GetPointsFromPolygon (anEdge); if (!aPoints.IsNull() && aPoints->Length() > 0) { theSensitive = new Select3D_SensitiveCurve (theOwner, aPoints); diff --git a/tests/bugs/vis/bug12121 b/tests/bugs/vis/bug12121 index fdc31c4aff..761d0ab89c 100755 --- a/tests/bugs/vis/bug12121 +++ b/tests/bugs/vis/bug12121 @@ -28,7 +28,7 @@ set y_edge_new 240 set x_wire_obj 298 set y_wire_obj 209 -set x_wire_new 55 +set x_wire_new 56 set y_wire_new 236 set x_face_obj 169 diff --git a/tests/bugs/vis/bug26959 b/tests/bugs/vis/bug26959 new file mode 100644 index 0000000000..a301450235 --- /dev/null +++ b/tests/bugs/vis/bug26959 @@ -0,0 +1,31 @@ +puts "============" +puts "CR26959" +puts "Visualization - cannot select edge of the shape" +puts "============" +puts "" + +pload VISUALIZATION MODELING + +restore [locate_data_file bug26959.brep] aFace + +vinit +vdisplay aFace +fixshape aFace1 aFace + +vremove aFace +vdisplay aFace1 +vaspects aFace1 -setWidth 3 +vselmode aFace1 2 1 + +vfit + +vmoveto 142 127 +if {[vreadpixel 142 127 name] == "CYAN1 1"} { + puts "OK" +} elseif {[vreadpixel 142 127 name] == "GREEN 1"} { + puts "ERROR: the upper edge cannot be highlighted!" +} else { + puts "ERROR: the shape was not displayed correctly!" +} + +set only_screen 1