AIS_ConnectedInteractive now shares HLR computation code with AIS_Shape.
BRepTools_WireExplorer::Orientation() now returns TopAbs_FORWARD
instead of throwing exception in case of infinite Edge without vertices.
StdSelect_BRepSelectionTool::GetSensitiveForFace() now creates Select3D_SensitiveCurve
from 2 points in case of infinite Edge instead of Select3D_SensitiveFace.
//purpose :
//=======================================================================
void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
- const Handle(Prs3d_Presentation)& thePresentation,
+ const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape)
{
- if (myShape.IsNull())
- {
- return;
- }
-
- switch (theShape.ShapeType())
- {
- case TopAbs_VERTEX:
- case TopAbs_EDGE:
- case TopAbs_WIRE:
- {
- thePresentation->SetDisplayPriority (4);
- StdPrs_WFShape::Add (thePresentation, theShape, myDrawer);
- break;
- }
- default:
- {
- Handle(Prs3d_Drawer) aDefaultDrawer = GetContext()->DefaultDrawer();
- if (aDefaultDrawer->DrawHiddenLine())
- {
- myDrawer->EnableDrawHiddenLine();
- }
- else
- {
- myDrawer->DisableDrawHiddenLine();
- }
-
- Aspect_TypeOfDeflection aPrevDeflection = aDefaultDrawer->TypeOfDeflection();
- aDefaultDrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
-
- // process HLRAngle and HLRDeviationCoefficient()
- Standard_Real aPrevAngle = myDrawer->HLRAngle();
- Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
- if (myDrawer->IsAutoTriangulation() &&
- Abs (aNewAngle - aPrevAngle) > Precision::Angular())
- {
- BRepTools::Clean (theShape);
- }
-
- myDrawer->SetHLRAngle (aNewAngle);
- myDrawer->SetHLRDeviationCoefficient (aDefaultDrawer->HLRDeviationCoefficient());
- StdPrs_HLRPolyShape::Add (thePresentation, theShape, myDrawer, theProjector);
- aDefaultDrawer->SetTypeOfDeflection (aPrevDeflection);
- }
- }
+ AIS_Shape::computeHlrPresentation (theProjector, thePrs, theShape, myDrawer);
}
//=======================================================================
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_SequenceOfGroup.hxx>
#include <Graphic3d_Structure.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
#include <HLRBRep.hxx>
#include <OSD_Timer.hxx>
#include <Precision.hxx>
OCC_CATCH_SIGNALS
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
- catch (Standard_Failure)
+ catch (Standard_Failure const& anException)
{
- #ifdef OCCT_DEBUG
- cout << "AIS_Shape::Compute() failed" << endl;
- cout << "a Shape should be incorrect : No Compute can be maked on it " << endl;
- #endif
- // presentation of the bounding box is calculated
- // Compute(aPresentationManager,aPrs,2);
+ Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ + "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
+ + anException.GetMessageString() + ")", Message_Fail);
}
break;
}
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
myUVOrigin, myUVRepeat, myUVScale);
}
- catch (Standard_Failure)
+ catch (Standard_Failure const& anException)
{
- #ifdef OCCT_DEBUG
- cout << "AIS_Shape::Compute() in ShadingMode failed" << endl;
- #endif
+ Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ + "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
+ + anException.GetMessageString() + ")", Message_Fail);
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
}
}
//=======================================================================
-//function : Compute
-//purpose : Hidden Line Removal
-//=======================================================================
-void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
- const Handle(Prs3d_Presentation)& aPresentation)
-{
- Compute(aProjector,aPresentation,myshape);
-}
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
- const Handle(Geom_Transformation)& TheTrsf,
- const Handle(Prs3d_Presentation)& aPresentation)
-{
- const TopLoc_Location& loc = myshape.Location();
- TopoDS_Shape shbis = myshape.Located(TopLoc_Location(TheTrsf->Trsf())*loc);
- Compute(aProjector,aPresentation,shbis);
-}
-
-//=======================================================================
-//function : Compute
-//purpose :
+//function : computeHlrPresentation
+//purpose :
//=======================================================================
-
-void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
- const Handle(Prs3d_Presentation)& aPresentation,
- const TopoDS_Shape& SH)
+void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer)
{
- if (SH.ShapeType() == TopAbs_COMPOUND) {
- TopoDS_Iterator anExplor (SH);
+ if (theShape.IsNull())
+ {
+ return;
+ }
- if (!anExplor.More()) // Shape vide -> Assemblage vide.
+ switch (theShape.ShapeType())
+ {
+ case TopAbs_VERTEX:
+ case TopAbs_EDGE:
+ case TopAbs_WIRE:
+ {
+ thePrs->SetDisplayPriority (4);
+ StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
return;
+ }
+ case TopAbs_COMPOUND:
+ {
+ TopoDS_Iterator anExplor (theShape);
+ if (!anExplor.More())
+ {
+ return;
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
}
- Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
- if (defdrawer->DrawHiddenLine())
- {myDrawer->EnableDrawHiddenLine();}
- else {myDrawer->DisableDrawHiddenLine();}
-
- Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
- defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
+ const Handle(Prs3d_Drawer)& aDefDrawer = theDrawer->Link();
+ if (aDefDrawer->DrawHiddenLine())
+ {
+ theDrawer->EnableDrawHiddenLine();
+ }
+ else
+ {
+ theDrawer->DisableDrawHiddenLine();
+ }
- if (myDrawer->IsAutoTriangulation())
+ const Aspect_TypeOfDeflection aPrevDef = aDefDrawer->TypeOfDeflection();
+ aDefDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
+ if (theDrawer->IsAutoTriangulation())
{
- // coefficients for calculation
- Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
- Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
- Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
- if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
- ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
- {
- BRepTools::Clean(SH);
- }
+ StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (theShape, theDrawer, Standard_True);
}
-
+
{
- try {
+ try
+ {
OCC_CATCH_SIGNALS
- switch (TypeOfHLR()) {
+ switch (theDrawer->TypeOfHLR())
+ {
case Prs3d_TOH_Algo:
- StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
+ StdPrs_HLRShape::Add (thePrs, theShape, theDrawer, theProjector);
break;
case Prs3d_TOH_PolyAlgo:
default:
- StdPrs_HLRPolyShape::Add (aPresentation, SH, myDrawer, aProjector);
+ StdPrs_HLRPolyShape::Add (thePrs, theShape, theDrawer, theProjector);
break;
}
}
- catch (Standard_Failure) {
-#ifdef OCCT_DEBUG
- cout <<"AIS_Shape::Compute(Proj) HLR Algorithm failed" << endl;
-#endif
- StdPrs_WFShape::Add(aPresentation,SH,myDrawer);
+ catch (Standard_Failure const& anException)
+ {
+ Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ + "Error: AIS_Shape::Compute() HLR Algorithm has failed ("
+ + anException.GetMessageString() + ")", Message_Fail);
+ StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
}
}
- defdrawer->SetTypeOfDeflection (prevdef);
+ aDefDrawer->SetTypeOfDeflection (aPrevDef);
}
-//=======================================================================
-//function : SelectionType
-//purpose : gives the type according to the Index of Selection Mode
-//=======================================================================
-
-TopAbs_ShapeEnum AIS_Shape::SelectionType(const Standard_Integer aMode)
-{
- switch(aMode){
- case 1:
- return TopAbs_VERTEX;
- case 2:
- return TopAbs_EDGE;
- case 3:
- return TopAbs_WIRE;
- case 4:
- return TopAbs_FACE;
- case 5:
- return TopAbs_SHELL;
- case 6:
- return TopAbs_SOLID;
- case 7:
- return TopAbs_COMPSOLID;
- case 8:
- return TopAbs_COMPOUND;
- case 0:
- default:
- return TopAbs_SHAPE;
- }
-
-}
-//=======================================================================
-//function : SelectionType
-//purpose : gives the SelectionMode according to the Type od Decomposition...
-//=======================================================================
-Standard_Integer AIS_Shape::SelectionMode(const TopAbs_ShapeEnum aType)
-{
- switch(aType){
- case TopAbs_VERTEX:
- return 1;
- case TopAbs_EDGE:
- return 2;
- case TopAbs_WIRE:
- return 3;
- case TopAbs_FACE:
- return 4;
- case TopAbs_SHELL:
- return 5;
- case TopAbs_SOLID:
- return 6;
- case TopAbs_COMPSOLID:
- return 7;
- case TopAbs_COMPOUND:
- return 8;
- case TopAbs_SHAPE:
- default:
- return 0;
- }
-}
-
-
//=======================================================================
//function : ComputeSelection
//purpose :
// POP protection against crash in low layers
Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
- try {
+ try
+ {
OCC_CATCH_SIGNALS
StdSelect_BRepSelectionTool::Load(aSelection,
this,
aDeflection,
myDrawer->HLRAngle(),
myDrawer->IsAutoTriangulation());
- } catch ( Standard_Failure ) {
-// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
- if ( aMode == 0 ) {
+ }
+ catch (Standard_Failure const& anException)
+ {
+ Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ + "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
+ + anException.GetMessageString() + ")", Message_Fail);
+ if (aMode == 0)
+ {
aSelection->Clear();
Bnd_Box B = BoundingBox();
Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);
//! Returns the transparency attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
-
- //! Activates the same TopAbs shape enumerations as
- //! those used by SelectionMode assigning a type to the mode aDecompositionMode.
- Standard_EXPORT static TopAbs_ShapeEnum SelectionType (const Standard_Integer aDecompositionMode);
-
- //! Establishes an equivalence between a mode and the
- //! type, aShapeType, of selection. The correspondences are as follows:
- //! - mode 0 - Shape
- //! - mode 1 - Vertex
- //! - mode 2 - Edge
- //! - mode 3 - Wire
- //! - mode 4 - Face
- //! - mode 5 - Shell
- //! - mode 6 - Solid
- //! - mode 7 - Compsolid
- //! - mode 8 - Compound
- Standard_EXPORT static Standard_Integer SelectionMode (const TopAbs_ShapeEnum aShapeType);
+
+ //! Return shape type for specified selection mode.
+ static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
+ {
+ switch (theSelMode)
+ {
+ case 1: return TopAbs_VERTEX;
+ case 2: return TopAbs_EDGE;
+ case 3: return TopAbs_WIRE;
+ case 4: return TopAbs_FACE;
+ case 5: return TopAbs_SHELL;
+ case 6: return TopAbs_SOLID;
+ case 7: return TopAbs_COMPSOLID;
+ case 8: return TopAbs_COMPOUND;
+ case 0: return TopAbs_SHAPE;
+ }
+ return TopAbs_SHAPE;
+ }
+
+ //! Return selection mode for specified shape type.
+ static Standard_Integer SelectionMode (const TopAbs_ShapeEnum theShapeType)
+ {
+ switch (theShapeType)
+ {
+ case TopAbs_VERTEX: return 1;
+ case TopAbs_EDGE: return 2;
+ case TopAbs_WIRE: return 3;
+ case TopAbs_FACE: return 4;
+ case TopAbs_SHELL: return 5;
+ case TopAbs_SOLID: return 6;
+ case TopAbs_COMPSOLID: return 7;
+ case TopAbs_COMPOUND: return 8;
+ case TopAbs_SHAPE: return 0;
+ }
+ return 0;
+ }
public: //! @name methods to alter texture mapping properties
protected:
- Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
-
- Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
-
- Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
-
- Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
+ //! Compute normal presentation.
+ Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const Standard_Integer theMode) Standard_OVERRIDE;
+
+ //! Compute projected presentation.
+ virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
+ const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
+ {
+ computeHlrPresentation (theProjector, thePrs, myshape, myDrawer);
+ }
+
+ //! Compute projected presentation with transformation.
+ virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
+ const Handle(Geom_Transformation)& theTrsf,
+ const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
+ {
+ const TopLoc_Location& aLoc = myshape.Location();
+ const TopoDS_Shape aShape = myshape.Located (TopLoc_Location (theTrsf->Trsf()) * aLoc);
+ computeHlrPresentation (theProjector, thePrs, aShape, myDrawer);
+ }
+
+ //! Compute selection.
+ Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
-private:
+public:
- Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& ashape);
+ //! Compute HLR presentation for specified shape.
+ Standard_EXPORT static void computeHlrPresentation (const Handle(Prs3d_Projector)& theProjector,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer);
protected:
//=======================================================================
TopAbs_Orientation BRepTools_WireExplorer::Orientation() const
{
+ if (myVertex.IsNull()
+ && !myEdge.IsNull())
+ {
+ // infinite edge
+ return TopAbs_FORWARD;
+ }
+
TopoDS_Iterator it(myEdge,Standard_False);
while (it.More()) {
if (myVertex.IsSame(it.Value()))
const Standard_Real theMaxParam,
const Standard_Boolean theInteriorFlag)
{
- // check if there is triangulation of the face...
TopLoc_Location aLoc;
- Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (theFace, aLoc);
-
- if (!aTriangulation.IsNull())
+ if (Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (theFace, aLoc))
{
Handle(Select3D_SensitiveTriangulation) STG = new Select3D_SensitiveTriangulation (theOwner, aTriangulation, aLoc, theInteriorFlag);
theSensitiveList.Append (STG);
// for faces with triangulation bugs or without autotriangulation ....
// very ugly and should not even exist ...
- BRepAdaptor_Surface BS;
- BS.Initialize (theFace);
-
- Standard_Real FirstU = BS.FirstUParameter() <= -Precision::Infinite() ? -theMaxParam : BS.FirstUParameter();
- Standard_Real LastU = BS.LastUParameter() >= Precision::Infinite() ? theMaxParam : BS.LastUParameter();
- Standard_Real FirstV = BS.FirstVParameter() <= -Precision::Infinite() ? -theMaxParam : BS.FirstVParameter();
- Standard_Real LastV = BS.LastVParameter() >= Precision::Infinite() ? theMaxParam : BS.LastVParameter();
-
+ BRepAdaptor_Surface BS (theFace);
if (BS.GetType() == GeomAbs_Plane)
{
- gp_Pnt pcur;
- Handle(TColgp_HArray1OfPnt) P = new TColgp_HArray1OfPnt (1, 5);
- BS.D0 (FirstU, FirstV, pcur);
- P->SetValue (1, pcur);
- BS.D0 (LastU, FirstV, pcur);
- P->SetValue (2, pcur);
- BS.D0 (LastU, LastV, pcur);
- P->SetValue (3, pcur);
- BS.D0 (FirstU, LastV, pcur);
- P->SetValue (4, pcur);
- P->SetValue (5, P->Value (1));
+ const Standard_Real aFirstU = BS.FirstUParameter() <= -Precision::Infinite() ? -theMaxParam : BS.FirstUParameter();
+ const Standard_Real aLastU = BS.LastUParameter() >= Precision::Infinite() ? theMaxParam : BS.LastUParameter();
+ const Standard_Real aFirstV = BS.FirstVParameter() <= -Precision::Infinite() ? -theMaxParam : BS.FirstVParameter();
+ const Standard_Real aLastV = BS.LastVParameter() >= Precision::Infinite() ? theMaxParam : BS.LastVParameter();
+ Handle(TColgp_HArray1OfPnt) aPlanePnts = new TColgp_HArray1OfPnt (1, 5);
+ BS.D0 (aFirstU, aFirstV, aPlanePnts->ChangeValue (1));
+ BS.D0 (aLastU, aFirstV, aPlanePnts->ChangeValue (2));
+ BS.D0 (aLastU, aLastV, aPlanePnts->ChangeValue (3));
+ BS.D0 (aFirstU, aLastV, aPlanePnts->ChangeValue (4));
+ aPlanePnts->SetValue (5, aPlanePnts->Value (1));
+
// if the plane is "infinite", it is sensitive only on the border limited by MaxParam
- if (FirstU == -theMaxParam && LastU == theMaxParam && FirstV == -theMaxParam && LastV == theMaxParam)
- {
- theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, P, Select3D_TOS_BOUNDARY));
- }
- else
- {
- Select3D_TypeOfSensitivity TS = theInteriorFlag ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
- theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, P, TS));
- }
+ const bool isInfinite = aFirstU == -theMaxParam
+ && aLastU == theMaxParam
+ && aFirstV == -theMaxParam
+ && aLastV == theMaxParam;
+ theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, aPlanePnts,
+ theInteriorFlag && !isInfinite
+ ? Select3D_TOS_INTERIOR
+ : Select3D_TOS_BOUNDARY));
return Standard_True;
}
- // This is construction of a sevsitive polygon from the exterior contour of the face...
+ // This is construction of a sensitive polygon from the exterior contour of the face...
// It is not good at all, but...
TopoDS_Wire aWire;
- TopExp_Explorer anExpWiresInFace (theFace, TopAbs_WIRE);
- if (anExpWiresInFace.More())
{
- // believing that this is the first... to be seen
- aWire = TopoDS::Wire (anExpWiresInFace.Current());
+ TopExp_Explorer anExpWiresInFace (theFace, TopAbs_WIRE);
+ if (anExpWiresInFace.More())
+ {
+ // believing that this is the first... to be seen
+ aWire = TopoDS::Wire (anExpWiresInFace.Current());
+ }
}
if (aWire.IsNull())
{
return Standard_False;
}
- TColgp_SequenceOfPnt WirePoints;
- Standard_Boolean FirstExp = Standard_True;
- Standard_Real wf, wl;
+ TColgp_SequenceOfPnt aWirePoints;
+ Standard_Boolean isFirstExp = Standard_True;
BRepAdaptor_Curve cu3d;
- for (BRepTools_WireExplorer aWireExplorer (aWire);
- aWireExplorer.More(); aWireExplorer.Next())
+ for (BRepTools_WireExplorer aWireExplorer (aWire); aWireExplorer.More(); aWireExplorer.Next())
{
cu3d.Initialize (aWireExplorer.Current());
+ Standard_Real wf = 0.0, wl = 0.0;
BRep_Tool::Range (aWireExplorer.Current(), wf, wl);
if (Abs (wf - wl) <= Precision::Confusion())
{
#ifdef OCCT_DEBUG
cout<<" StdSelect_BRepSelectionTool : Curve where ufirst = ulast ...."<<endl;
#endif
+ continue;
}
- else
+
+ if (isFirstExp)
{
- if (FirstExp)
+ isFirstExp = Standard_False;
+ if (aWireExplorer.Orientation() == TopAbs_FORWARD)
{
- if (aWireExplorer.Orientation() == TopAbs_FORWARD)
- {
- WirePoints.Append (cu3d.Value (wf));
- }
- else
- {
- WirePoints.Append (cu3d.Value (wl));
- }
- FirstExp = Standard_False;
+ aWirePoints.Append (cu3d.Value (wf));
+ }
+ else
+ {
+ aWirePoints.Append (cu3d.Value (wl));
}
+ }
- switch (cu3d.GetType())
+ switch (cu3d.GetType())
+ {
+ case GeomAbs_Line:
{
- case GeomAbs_Line:
- {
- WirePoints.Append (cu3d.Value ((aWireExplorer.Orientation() == TopAbs_FORWARD) ? wl : wf));
- break;
- }
- case GeomAbs_Circle:
+ aWirePoints.Append (cu3d.Value ((aWireExplorer.Orientation() == TopAbs_FORWARD) ? wl : wf));
+ break;
+ }
+ case GeomAbs_Circle:
+ {
+ if (2.0 * M_PI - Abs (wl - wf) <= Precision::Confusion())
{
- if (2 * M_PI - Abs (wl - wf) <= Precision::Confusion())
+ if (BS.GetType() == GeomAbs_Cylinder ||
+ BS.GetType() == GeomAbs_Torus ||
+ BS.GetType() == GeomAbs_Cone ||
+ BS.GetType() == GeomAbs_BSplineSurface) // beuurkk pour l'instant...
{
- if (BS.GetType() == GeomAbs_Cylinder ||
- BS.GetType() == GeomAbs_Torus ||
- BS.GetType() == GeomAbs_Cone ||
- BS.GetType() == GeomAbs_BSplineSurface) // beuurkk pour l'instant...
+ Standard_Real ff = wf ,ll = wl;
+ Standard_Real dw =(Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
+ if (aWireExplorer.Orientation() == TopAbs_FORWARD)
{
- Standard_Real ff = wf ,ll = wl;
- Standard_Real dw =(Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
- if (aWireExplorer.Orientation() == TopAbs_FORWARD)
- {
- for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
- {
- WirePoints.Append (cu3d.Value (wc));
- }
- }
- else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
+ for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
{
- for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
- {
- WirePoints.Append (cu3d.Value (wc));
- }
+ aWirePoints.Append (cu3d.Value (wc));
}
}
- else
+ else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
{
- if (cu3d.Circle().Radius() <= Precision::Confusion())
- {
- theSensitiveList.Append (new Select3D_SensitivePoint (theOwner, cu3d.Circle().Location()));
- }
- else
+ for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
{
- theSensitiveList.Append (new Select3D_SensitiveCircle (theOwner, new Geom_Circle (cu3d.Circle()), theInteriorFlag, 16));
+ aWirePoints.Append (cu3d.Value (wc));
}
}
}
else
{
- Standard_Real ff = wf, ll = wl;
- Standard_Real dw = (Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
- if (aWireExplorer.Orientation() == TopAbs_FORWARD)
+ if (cu3d.Circle().Radius() <= Precision::Confusion())
{
- for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
- {
- WirePoints.Append (cu3d.Value (wc));
- }
+ theSensitiveList.Append (new Select3D_SensitivePoint (theOwner, cu3d.Circle().Location()));
}
- else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
+ else
{
- for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
- {
- WirePoints.Append (cu3d.Value (wc));
- }
+ theSensitiveList.Append (new Select3D_SensitiveCircle (theOwner, new Geom_Circle (cu3d.Circle()), theInteriorFlag, 16));
}
}
- break;
}
- default:
+ else
{
Standard_Real ff = wf, ll = wl;
Standard_Real dw = (Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
- if (aWireExplorer.Orientation()==TopAbs_FORWARD)
+ if (aWireExplorer.Orientation() == TopAbs_FORWARD)
{
for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
{
- WirePoints.Append (cu3d.Value (wc));
+ aWirePoints.Append (cu3d.Value (wc));
}
}
else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
{
for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
{
- WirePoints.Append (cu3d.Value (wc));
+ aWirePoints.Append (cu3d.Value (wc));
}
}
}
+ break;
+ }
+ default:
+ {
+ Standard_Real ff = wf, ll = wl;
+ Standard_Real dw = (Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
+ if (aWireExplorer.Orientation()==TopAbs_FORWARD)
+ {
+ for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
+ {
+ aWirePoints.Append (cu3d.Value (wc));
+ }
+ }
+ else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
+ {
+ for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
+ {
+ aWirePoints.Append (cu3d.Value (wc));
+ }
+ }
}
}
}
- Standard_Integer ArrayPosition = WirePoints.Length();
- Handle(TColgp_HArray1OfPnt) facepoints = new TColgp_HArray1OfPnt (1, ArrayPosition);
- for (Standard_Integer I = 1; I <= ArrayPosition; ++I)
+ Handle(TColgp_HArray1OfPnt) aFacePoints = new TColgp_HArray1OfPnt (1, aWirePoints.Length());
{
- facepoints->SetValue (I, WirePoints.Value(I));
+ Standard_Integer aPntIndex = 1;
+ for (TColgp_SequenceOfPnt::Iterator aPntIter (aWirePoints); aPntIter.More(); aPntIter.Next())
+ {
+ aFacePoints->SetValue (aPntIndex++, aPntIter.Value());
+ }
}
- if ((facepoints->Array1()).Length() > 1)
- { //1 if only one circular edge
- Select3D_TypeOfSensitivity TS = theInteriorFlag ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
- theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, facepoints, TS));
+ // 1 if only one circular edge
+ if (aFacePoints->Array1().Length() == 2)
+ {
+ theSensitiveList.Append (new Select3D_SensitiveCurve (theOwner, aFacePoints));
+ }
+ else if (aFacePoints->Array1().Length() > 2)
+ {
+ theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, aFacePoints,
+ theInteriorFlag
+ ? Select3D_TOS_INTERIOR
+ : Select3D_TOS_BOUNDARY));
}
return Standard_True;
}
puts "================"
-puts "OCC129"
+puts "OCC129 - infinite cylinder is not selectable in 3D Viewer"
puts "================"
puts ""
-#######################################################################################
-# Object is not selectable in the Cascade Viewer
-######################################################################################
-
-set BugNumber OCC22129
cylinder c 0 0 1 10
mkface f c
-vinit
-vdisplay f
-
-set x1 207
-set y1 184
-set x2 222
-set y2 175
-
-set UNSELECT_R 1
-set UNSELECT_G 1
-set UNSELECT_B 0
-
-set MOVESELECT_R 0
-set MOVESELECT_G 1
-set MOVESELECT_B 1
-
-
-vmoveto ${x1} ${y1}
-checkcolor ${x1} ${y1} 0 1 1
-
-vselect ${x1} ${y1}
-checkcolor ${x1} ${y1} 0.8 0.8 0.8
-
-vselect ${x2} ${y2}
-checkcolor ${x1} ${y1} 1 1 0
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
-
+vclear
+vinit View1
+vdisplay -dispMode 0 f
+# check dynamic highlighting
+vmoveto 207 184
+checkcolor 207 184 0 1 1
+# check selected highlighting
+vselect 207 184
+checkcolor 207 184 0.8 0.8 0.8
+# check unselected
+vselect 222 175
+checkcolor 207 184 1 1 0
+
+vdump ${imagedir}/${casename}.png
--- /dev/null
+puts "================"
+puts "0027869: Visualization - AIS_ConnectedInteractive does not support exact HLR mode"
+puts "================"
+puts ""
+
+restore [locate_data_file CrankArm.brep] obj
+vclear
+vinit View1
+vdisplay obj
+vconnect new 50 50 50 obj
+vfit
+vhlr on -algoType algo
+
+vdump ${imagedir}/${casename}.png