mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
6 Commits
CR30591
...
NewGEOM_2.
Author | SHA1 | Date | |
---|---|---|---|
|
fbb0703ef9 | ||
|
d5e71d630e | ||
|
cf9192329b | ||
|
415fb570ce | ||
|
b3cbd47d26 | ||
|
9e5394288d |
@@ -277,6 +277,8 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
||||
//=======================================================================
|
||||
void AIS_AngleDimension::Init()
|
||||
{
|
||||
SetAngleReversed (Standard_False);
|
||||
SetArrowVisible (Standard_True, Standard_True);
|
||||
SetSpecialSymbol (THE_DEGREE_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_After);
|
||||
SetFlyout (15.0);
|
||||
@@ -298,6 +300,12 @@ gp_Pnt AIS_AngleDimension::GetCenterOnArc (const gp_Pnt& theFirstAttach,
|
||||
}
|
||||
|
||||
gp_Pln aPlane = aConstructPlane.Value();
|
||||
if (myUseReverse) {
|
||||
gp_Ax1 anAxis = aPlane.Axis();
|
||||
gp_Dir aDir = anAxis.Direction();
|
||||
aDir.Reverse();
|
||||
aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir));
|
||||
}
|
||||
|
||||
Standard_Real aRadius = theFirstAttach.Distance (theCenter);
|
||||
|
||||
@@ -337,6 +345,12 @@ void AIS_AngleDimension::DrawArc (const Handle(Prs3d_Presentation)& thePresentat
|
||||
}
|
||||
|
||||
gp_Pln aPlane = aConstructPlane.Value();
|
||||
if (myUseReverse) {
|
||||
gp_Ax1 anAxis = aPlane.Axis();
|
||||
gp_Dir aDir = anAxis.Direction();
|
||||
aDir.Reverse();
|
||||
aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir));
|
||||
}
|
||||
|
||||
// construct circle forming the arc
|
||||
gce_MakeCirc aConstructCircle (theCenter, aPlane, theRadius);
|
||||
@@ -348,7 +362,7 @@ void AIS_AngleDimension::DrawArc (const Handle(Prs3d_Presentation)& thePresentat
|
||||
gp_Circ aCircle = aConstructCircle.Value();
|
||||
|
||||
// construct the arc
|
||||
GC_MakeArcOfCircle aConstructArc (aCircle, theFirstAttach, theSecondAttach, Standard_True);
|
||||
GC_MakeArcOfCircle aConstructArc(aCircle, theFirstAttach, theSecondAttach, Standard_True);
|
||||
if (!aConstructArc.IsDone())
|
||||
{
|
||||
return;
|
||||
@@ -362,7 +376,13 @@ void AIS_AngleDimension::DrawArc (const Handle(Prs3d_Presentation)& thePresentat
|
||||
// compute number of discretization elements in old-fanshioned way
|
||||
gp_Vec aCenterToFirstVec (theCenter, theFirstAttach);
|
||||
gp_Vec aCenterToSecondVec (theCenter, theSecondAttach);
|
||||
const Standard_Real anAngle = aCenterToFirstVec.Angle (aCenterToSecondVec);
|
||||
|
||||
gp_Ax1 anAxis = aPlane.Axis();
|
||||
gp_Dir aDir = anAxis.Direction();
|
||||
gp_Vec aRefVec(aDir);
|
||||
Standard_Real anAngle = aCenterToFirstVec.AngleWithRef (aCenterToSecondVec, aRefVec);
|
||||
if (anAngle < 0)
|
||||
anAngle = 2.0 * M_PI + anAngle;
|
||||
const Standard_Integer aNbPoints = Max (4, Standard_Integer (50.0 * anAngle / M_PI));
|
||||
|
||||
GCPnts_UniformAbscissa aMakePnts (anArcAdaptor, aNbPoints);
|
||||
@@ -694,8 +714,8 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
|
||||
{
|
||||
DrawArc (thePresentation,
|
||||
isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
|
||||
isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
|
||||
(isArrowsExternal || !myFirstArrowVisible) ? aFirstAttach : aFirstArrowEnd,
|
||||
(isArrowsExternal || !mySecondArrowVisible) ? aSecondAttach : aSecondArrowEnd,
|
||||
myCenterPoint,
|
||||
Abs (GetFlyout()),
|
||||
theMode);
|
||||
@@ -707,7 +727,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
{
|
||||
DrawExtension (thePresentation,
|
||||
anExtensionSize,
|
||||
isArrowsExternal ? aFirstArrowEnd : aFirstAttach,
|
||||
(isArrowsExternal && myFirstArrowVisible) ? aFirstArrowEnd : aFirstAttach,
|
||||
aFirstExtensionDir,
|
||||
aLabelString,
|
||||
aLabelWidth,
|
||||
@@ -720,7 +740,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
{
|
||||
DrawExtension (thePresentation,
|
||||
anExtensionSize,
|
||||
isArrowsExternal ? aSecondArrowEnd : aSecondAttach,
|
||||
(isArrowsExternal && mySecondArrowVisible) ? aSecondArrowEnd : aSecondAttach,
|
||||
aSecondExtensionDir,
|
||||
aLabelString,
|
||||
aLabelWidth,
|
||||
@@ -736,8 +756,8 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
DrawArc (thePresentation,
|
||||
isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
|
||||
isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
|
||||
(isArrowsExternal || !myFirstArrowVisible) ? aFirstAttach : aFirstArrowEnd,
|
||||
(isArrowsExternal || !mySecondArrowVisible) ? aSecondAttach : aSecondArrowEnd,
|
||||
myCenterPoint,
|
||||
Abs(GetFlyout ()),
|
||||
theMode);
|
||||
@@ -748,7 +768,9 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
{
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
if (myFirstArrowVisible)
|
||||
DrawArrow (thePresentation, aFirstArrowBegin, gp_Dir (aFirstArrowVec));
|
||||
if (mySecondArrowVisible)
|
||||
DrawArrow (thePresentation, aSecondArrowBegin, gp_Dir (aSecondArrowVec));
|
||||
}
|
||||
|
||||
@@ -756,7 +778,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
{
|
||||
Prs3d_Root::NewGroup (thePresentation);
|
||||
|
||||
if (aHPosition != LabelPosition_Left)
|
||||
if (aHPosition != LabelPosition_Left && myFirstArrowVisible)
|
||||
{
|
||||
DrawExtension (thePresentation,
|
||||
aDimensionAspect->ArrowTailSize(),
|
||||
@@ -768,7 +790,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
LabelPosition_None);
|
||||
}
|
||||
|
||||
if (aHPosition != LabelPosition_Right)
|
||||
if (aHPosition != LabelPosition_Right && mySecondArrowVisible)
|
||||
{
|
||||
DrawExtension (thePresentation,
|
||||
aDimensionAspect->ArrowTailSize(),
|
||||
@@ -902,11 +924,10 @@ Standard_Boolean AIS_AngleDimension::InitTwoEdgesAngle (gp_Pln& theComputedPlane
|
||||
// |
|
||||
// | <- dimension should be here
|
||||
// *----
|
||||
myFirstPoint = myCenterPoint.Distance (aFirstPoint1) > myCenterPoint.Distance (aLastPoint1)
|
||||
myFirstPoint = !myCenterPoint.IsEqual(aFirstPoint1, Precision::Confusion())
|
||||
? aFirstPoint1
|
||||
: aLastPoint1;
|
||||
|
||||
mySecondPoint = myCenterPoint.Distance (aFirstPoint2) > myCenterPoint.Distance (aLastPoint2)
|
||||
mySecondPoint = !myCenterPoint.IsEqual(aFirstPoint2, Precision::Confusion())
|
||||
? aFirstPoint2
|
||||
: aLastPoint2;
|
||||
}
|
||||
@@ -1229,6 +1250,46 @@ void AIS_AngleDimension::SetTextPosition (const gp_Pnt& theTextPos)
|
||||
myFixedTextPosition = theTextPos;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAngleReversed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_AngleDimension::SetAngleReversed(const Standard_Boolean& theUseReverse)
|
||||
{
|
||||
myUseReverse = theUseReverse;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAngleReversed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_AngleDimension::GetAngleReversed() const
|
||||
{
|
||||
return myUseReverse;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetArrowVisible
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_AngleDimension::SetArrowVisible(const Standard_Boolean& theFirstArrowVisible,
|
||||
const Standard_Boolean& theSecondArrowVisible)
|
||||
{
|
||||
myFirstArrowVisible = theFirstArrowVisible;
|
||||
mySecondArrowVisible = theSecondArrowVisible;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetArrowVisible
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_AngleDimension::GetArrowVisible(Standard_Boolean& theFirstArrowVisible,
|
||||
Standard_Boolean& theSecondArrowVisible)
|
||||
{
|
||||
theFirstArrowVisible = myFirstArrowVisible;
|
||||
theSecondArrowVisible = mySecondArrowVisible;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustParameters
|
||||
//purpose :
|
||||
|
@@ -207,6 +207,27 @@ public:
|
||||
|
||||
Standard_EXPORT virtual const gp_Pnt GetTextPosition () const;
|
||||
|
||||
//! Sets state if the angle arc should be built reversing to the presentation plane.
|
||||
//! Default state is not reversed
|
||||
//! @param theUseReverse [in] the boolean state.
|
||||
Standard_EXPORT void SetAngleReversed(const Standard_Boolean& theUseReverse);
|
||||
|
||||
//! Returns state if the angle arc is reversed to the presentation plane.
|
||||
//! @return TRUE if the anble is build to be reversed
|
||||
Standard_EXPORT Standard_Boolean GetAngleReversed() const;
|
||||
|
||||
//! Sets visible state of angle arrows. Default value is true for both
|
||||
//! @param theFirstArrowVisible [in] the visibility of the first arrow.
|
||||
//! @param theSecondArrowVisible [in] the visibility of the second arrow.
|
||||
Standard_EXPORT void SetArrowVisible(const Standard_Boolean& theFirstArrowVisible,
|
||||
const Standard_Boolean& theSecondArrowVisible);
|
||||
|
||||
//! Gets visible state of angle arrows.
|
||||
//! @param theFirstArrowVisible [out] the visibility of the first arrow.
|
||||
//! @param theSecondArrowVisible [out] the visibility of the second arrow.
|
||||
Standard_EXPORT void GetArrowVisible(Standard_Boolean& theFirstArrowVisible,
|
||||
Standard_Boolean& theSecondArrowVisible);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI (AIS_AngleDimension)
|
||||
@@ -335,6 +356,10 @@ protected:
|
||||
const gp_Pnt& theSecondPoint) const;
|
||||
|
||||
private:
|
||||
Standard_Boolean myUseReverse;
|
||||
|
||||
Standard_Boolean myFirstArrowVisible;
|
||||
Standard_Boolean mySecondArrowVisible;
|
||||
|
||||
gp_Pnt myFirstPoint;
|
||||
gp_Pnt mySecondPoint;
|
||||
|
@@ -99,7 +99,9 @@ AIS_Dimension::AIS_Dimension (const AIS_KindOfDimension theType)
|
||||
: AIS_InteractiveObject (),
|
||||
mySelToleranceForText2d(0.0),
|
||||
myCustomValue (0.0),
|
||||
myCustomStringValue (""),
|
||||
myIsValueCustom (Standard_False),
|
||||
myIsStringValueCustom (Standard_False),
|
||||
myIsTextPositionFixed (Standard_False),
|
||||
mySpecialSymbol (' '),
|
||||
myDisplaySpecialSymbol (AIS_DSS_No),
|
||||
@@ -129,6 +131,33 @@ void AIS_Dimension::SetCustomValue (const Standard_Real theValue)
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCustomValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Dimension::SetCustomValue (const TCollection_ExtendedString& theValue)
|
||||
{
|
||||
if (myIsStringValueCustom && myCustomStringValue == theValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myIsStringValueCustom = Standard_True;
|
||||
|
||||
myCustomStringValue = theValue;
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCustomValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& AIS_Dimension::GetCustomValue () const
|
||||
{
|
||||
return myCustomStringValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetPlane
|
||||
//purpose :
|
||||
@@ -279,12 +308,18 @@ Standard_Real AIS_Dimension::ValueToDisplayUnits() const
|
||||
//=======================================================================
|
||||
TCollection_ExtendedString AIS_Dimension::GetValueString (Standard_Real& theWidth) const
|
||||
{
|
||||
TCollection_ExtendedString aValueStr;
|
||||
if (myIsStringValueCustom) {
|
||||
aValueStr = myCustomStringValue;
|
||||
}
|
||||
else {
|
||||
// format value string using "sprintf"
|
||||
TCollection_AsciiString aFormatStr = myDrawer->DimensionAspect()->ValueStringFormat();
|
||||
|
||||
char aFmtBuffer[256];
|
||||
sprintf (aFmtBuffer, aFormatStr.ToCString(), ValueToDisplayUnits());
|
||||
TCollection_ExtendedString aValueStr = TCollection_ExtendedString (aFmtBuffer);
|
||||
aValueStr = TCollection_ExtendedString (aFmtBuffer);
|
||||
}
|
||||
|
||||
// add units to values string
|
||||
if (myDrawer->DimensionAspect()->IsUnitsDisplayed())
|
||||
|
@@ -235,6 +235,15 @@ public:
|
||||
//! @param theValue [in] the user-defined value to display.
|
||||
Standard_EXPORT void SetCustomValue (const Standard_Real theValue);
|
||||
|
||||
//! Sets user-defined dimension value.
|
||||
//! Unit conversion during the display is not applyed.
|
||||
//! @param theValue [in] the user-defined value to display.
|
||||
Standard_EXPORT void SetCustomValue (const TCollection_ExtendedString& theValue);
|
||||
|
||||
//! Gets user-defined dimension value.
|
||||
//! @return dimension value string.
|
||||
Standard_EXPORT const TCollection_ExtendedString& GetCustomValue () const;
|
||||
|
||||
//! Get the dimension plane in which the 2D dimension presentation is computed.
|
||||
//! By default, if plane is not defined by user, it is computed automatically
|
||||
//! after dimension geometry is computed.
|
||||
@@ -655,13 +664,15 @@ protected: //! @name Value properties
|
||||
Standard_Real myCustomValue; //!< Value of the dimension (computed or user-defined).
|
||||
Standard_Boolean myIsValueCustom; //!< Is user-defined value.
|
||||
|
||||
TCollection_ExtendedString myCustomStringValue; //!< Value of the dimension (computed or user-defined).
|
||||
Standard_Boolean myIsStringValueCustom; //!< Is user-defined value.
|
||||
|
||||
protected: //! @name Fixed text position properties
|
||||
|
||||
gp_Pnt myFixedTextPosition; //!< Stores text position fixed by user.
|
||||
Standard_Boolean myIsTextPositionFixed; //!< Is the text label position fixed by user.
|
||||
|
||||
protected: //! @name Units properties
|
||||
|
||||
Standard_ExtCharacter mySpecialSymbol; //!< Special symbol.
|
||||
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol; //!< Special symbol display options.
|
||||
|
||||
|
@@ -28,7 +28,9 @@ uses
|
||||
|
||||
HArray2OfShape from TopTools,
|
||||
MapOfShape from TopTools,
|
||||
ListOfShape from TopTools,
|
||||
DataMapOfShapeHArray2OfShape from BRepFill,
|
||||
DataMapOfShapeListOfShape from TopTools,
|
||||
LocationLaw from BRepFill,
|
||||
Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
@@ -83,6 +85,9 @@ is
|
||||
---C++ : return const &
|
||||
is static;
|
||||
|
||||
Generated(me: in out; S: Shape from TopoDS; L: in out ListOfShape from TopTools);
|
||||
---Purpose: Returns the list of shapes generated from the shape <S>.
|
||||
|
||||
Face(me : in out; ESpine, EProfile : Edge from TopoDS)
|
||||
returns Face from TopoDS
|
||||
---Purpose: Returns the face created from an edge of the spine
|
||||
@@ -181,6 +186,7 @@ fields
|
||||
myCurIndexOfSectionEdge : Integer from Standard;
|
||||
myFirst : Shape from TopoDS;
|
||||
myLast : Shape from TopoDS;
|
||||
myGenMap : DataMapOfShapeListOfShape from TopTools;
|
||||
|
||||
myDegmax : Integer from Standard;
|
||||
mySegmax : Integer from Standard;
|
||||
|
@@ -69,6 +69,38 @@
|
||||
static Standard_Boolean Affich = 0;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// static function: UpdateMap
|
||||
// purpose:
|
||||
// ---------------------------------------------------------------------------------
|
||||
static Standard_Boolean UpdateMap(const TopoDS_Shape& theKey,
|
||||
const TopoDS_Shape& theValue,
|
||||
TopTools_DataMapOfShapeListOfShape& theMap)
|
||||
{
|
||||
if(!theMap.IsBound(theKey))
|
||||
{
|
||||
TopTools_ListOfShape thelist;
|
||||
theMap.Bind(theKey, thelist);
|
||||
}
|
||||
TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
|
||||
TopTools_ListIteratorOfListOfShape anIt(aList);
|
||||
Standard_Boolean found = Standard_False;
|
||||
|
||||
for(; anIt.More(); anIt.Next())
|
||||
{
|
||||
if(theValue.IsSame(anIt.Value()))
|
||||
{
|
||||
found = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
aList.Append(theValue);
|
||||
|
||||
return !found;
|
||||
}
|
||||
|
||||
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
|
||||
TopTools_MapOfShape& Emap)
|
||||
{
|
||||
@@ -374,6 +406,47 @@ const TopoDS_Shape& BRepFill_Pipe::LastShape() const
|
||||
return myLast;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepFill_Pipe::Generated(const TopoDS_Shape& theShape,
|
||||
TopTools_ListOfShape& theList)
|
||||
{
|
||||
theList.Clear();
|
||||
|
||||
if (theShape.IsSame(myProfile))
|
||||
theList.Append(myShape);
|
||||
else
|
||||
{
|
||||
if (theShape.ShapeType() == TopAbs_FACE ||
|
||||
theShape.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
if(myGenMap.IsBound(theShape))
|
||||
theList = myGenMap.Find(theShape);
|
||||
}
|
||||
else if (theShape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
TopoDS_Iterator itw(mySpine);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
|
||||
const TopoDS_Shape& aFace = Face(aSpineEdge, TopoDS::Edge(theShape));
|
||||
theList.Append(aFace);
|
||||
}
|
||||
}
|
||||
else if (theShape.ShapeType() == TopAbs_VERTEX)
|
||||
{
|
||||
TopoDS_Iterator itw(mySpine);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
|
||||
const TopoDS_Shape& anEdge = Edge(aSpineEdge, TopoDS::Vertex(theShape));
|
||||
theList.Append(anEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Face
|
||||
@@ -640,6 +713,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
MkSw.Build( myReversedEdges, myTapes, myRails,
|
||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
result = MkSw.Shape();
|
||||
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
|
||||
myErrorOnSurf = MkSw.ErrorOnSurface();
|
||||
|
||||
Handle(TopTools_HArray2OfShape) aSections = MkSw.Sections();
|
||||
@@ -662,6 +736,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
MkSw.Build( myReversedEdges, myTapes, myRails,
|
||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||
result = MkSw.Shape();
|
||||
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
|
||||
myErrorOnSurf = MkSw.ErrorOnSurface();
|
||||
//Correct <myFirst> and <myLast>
|
||||
ReverseModifiedEdges(myFirst, myReversedEdges);
|
||||
@@ -769,6 +844,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
||||
BS.Add(solid,TopoDS::Shell(aLocalShape));
|
||||
// BS.Add(solid,TopoDS::Shell(result.Reversed()));
|
||||
}
|
||||
UpdateMap(TheS.Located(myProfile.Location()), solid, myGenMap);
|
||||
return solid;
|
||||
}
|
||||
else {
|
||||
|
@@ -84,6 +84,11 @@ is
|
||||
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
Generated (me: in out; S: Shape from TopoDS)
|
||||
returns ListOfShape from TopTools
|
||||
is redefined;
|
||||
---C++: return const &
|
||||
---Level: Public
|
||||
|
||||
Generated (me: in out; SSpine, SProfile : Shape from TopoDS)
|
||||
---Level: Public
|
||||
|
@@ -109,13 +109,22 @@ TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape()
|
||||
return myPipe.LastShape();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose : standard method
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& S)
|
||||
{
|
||||
myPipe.Generated(S, myGenerated);
|
||||
return myGenerated;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Generated
|
||||
//purpose :
|
||||
//purpose : returns generated elementary subshape
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated (const TopoDS_Shape& SSpine,
|
||||
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& SSpine,
|
||||
const TopoDS_Shape& SProfile)
|
||||
{
|
||||
if (SProfile.ShapeType () == TopAbs_EDGE) {
|
||||
|
@@ -53,7 +53,9 @@
|
||||
#include <GeomFill_Trihedron.hxx>
|
||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||
#include <Standard_Atomic.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
|
||||
#define QCOMPARE(val1, val2) \
|
||||
@@ -4306,6 +4308,167 @@ static Standard_Integer OCC26313(Draw_Interpretor& di,Standard_Integer n,const c
|
||||
return 0;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
//function : OCC27065
|
||||
//purpose : Tests overloaded method "Generated" of BRepOffsetAPI_MakePipe
|
||||
//========================================================================
|
||||
static Standard_Integer OCC27065(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
BRep_Builder BB;
|
||||
|
||||
TopoDS_Shape SpineShape = DBRep::Get(a[1],TopAbs_WIRE);
|
||||
if ( SpineShape.IsNull()) return 1;
|
||||
TopoDS_Wire Spine = TopoDS::Wire(SpineShape);
|
||||
|
||||
TopoDS_Shape Profile = DBRep::Get(a[2]);
|
||||
if ( Profile.IsNull()) return 1;
|
||||
|
||||
BRepOffsetAPI_MakePipe aPipeBuilder(Spine, Profile);
|
||||
if (!aPipeBuilder.IsDone())
|
||||
{
|
||||
di << "Error: failed to create pipe\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopExp_Explorer Explo(Profile, TopAbs_SHELL);
|
||||
TopoDS_Shape aShape;
|
||||
TopTools_ListIteratorOfListOfShape itl;
|
||||
if (Explo.More())
|
||||
{
|
||||
aShape = Explo.Current();
|
||||
TopoDS_Compound res1;
|
||||
BB.MakeCompound(res1);
|
||||
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||
for (; itl.More(); itl.Next())
|
||||
BB.Add(res1, itl.Value());
|
||||
DBRep::Set("res_shell", res1);
|
||||
}
|
||||
|
||||
Explo.Init(Profile, TopAbs_FACE);
|
||||
if (Explo.More())
|
||||
{
|
||||
aShape = Explo.Current();
|
||||
TopoDS_Compound res2;
|
||||
BB.MakeCompound(res2);
|
||||
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||
for (; itl.More(); itl.Next())
|
||||
BB.Add(res2, itl.Value());
|
||||
DBRep::Set("res_face", res2);
|
||||
}
|
||||
|
||||
Explo.Init(Profile, TopAbs_WIRE);
|
||||
if (Explo.More())
|
||||
{
|
||||
aShape = Explo.Current();
|
||||
TopoDS_Compound res3;
|
||||
BB.MakeCompound(res3);
|
||||
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||
for (; itl.More(); itl.Next())
|
||||
BB.Add(res3, itl.Value());
|
||||
DBRep::Set("res_wire", res3);
|
||||
}
|
||||
|
||||
Explo.Init(Profile, TopAbs_EDGE);
|
||||
if (Explo.More())
|
||||
{
|
||||
aShape = Explo.Current();
|
||||
TopoDS_Compound res4;
|
||||
BB.MakeCompound(res4);
|
||||
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||
for (; itl.More(); itl.Next())
|
||||
BB.Add(res4, itl.Value());
|
||||
DBRep::Set("res_edge", res4);
|
||||
}
|
||||
|
||||
Explo.Init(Profile, TopAbs_VERTEX);
|
||||
if (Explo.More())
|
||||
{
|
||||
aShape = Explo.Current();
|
||||
TopoDS_Compound res5;
|
||||
BB.MakeCompound(res5);
|
||||
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||
for (; itl.More(); itl.Next())
|
||||
BB.Add(res5, itl.Value());
|
||||
DBRep::Set("res_vertex", res5);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
//function : OCC27523
|
||||
//purpose : Checks recomputation of deactivated selection mode after object's redisplaying
|
||||
//========================================================================
|
||||
static Standard_Integer OCC27523 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
|
||||
{
|
||||
if (theArgNb != 1)
|
||||
{
|
||||
std::cerr << "Error: wrong number of arguments! See usage:\n";
|
||||
theDI.PrintHelp (theArgVec[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
|
||||
if(anAISContext.IsNull())
|
||||
{
|
||||
std::cerr << "Error: no active view. Please call vinit.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
gp_Pnt aStart (100, 100, 100);
|
||||
gp_Pnt anEnd (300, 400, 600);
|
||||
BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
|
||||
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
|
||||
Handle(AIS_InteractiveObject) aTestAISShape = new AIS_Shape (anEdge);
|
||||
anAISContext->Display (aTestAISShape);
|
||||
|
||||
// activate it in selection modes
|
||||
TColStd_SequenceOfInteger aModes;
|
||||
aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
|
||||
|
||||
anAISContext->OpenLocalContext();
|
||||
anAISContext->Deactivate (aTestAISShape);
|
||||
anAISContext->Load (aTestAISShape, -1, true);
|
||||
anAISContext->Activate (aTestAISShape, 0);
|
||||
anAISContext->Deactivate (aTestAISShape, 0);
|
||||
|
||||
// activate in vertices mode
|
||||
for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
|
||||
{
|
||||
anAISContext->Activate (aTestAISShape, aModes (anIt));
|
||||
}
|
||||
|
||||
TopoDS_Shape aVertexShape = BRepBuilderAPI_MakeVertex (gp_Pnt (75, 0, 0));
|
||||
TopAbs_ShapeEnum aVertexShapeType = aVertexShape.ShapeType();
|
||||
Handle(AIS_Shape)::DownCast (aTestAISShape)->Set (aVertexShape);
|
||||
aTestAISShape->Redisplay();
|
||||
|
||||
anAISContext->AddOrRemoveSelected (aTestAISShape);
|
||||
|
||||
bool aValidShapeType = false;
|
||||
for (anAISContext->InitSelected(); anAISContext->MoreSelected(); anAISContext->NextSelected())
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = anAISContext->SelectedOwner();
|
||||
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (!aBRO.IsNull() && aBRO->HasShape())
|
||||
{
|
||||
TopoDS_Shape aShape = aBRO->Shape();
|
||||
|
||||
aValidShapeType = aShape.ShapeType() == aVertexShapeType;
|
||||
}
|
||||
}
|
||||
|
||||
if (!aValidShapeType)
|
||||
{
|
||||
std::cerr << "Error: shape type is invalid.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
const char *group = "QABugs";
|
||||
|
||||
@@ -4397,5 +4560,13 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
|
||||
theCommands.Add ("OCC26313", "OCC26313 result shape", __FILE__, OCC26313, group);
|
||||
|
||||
theCommands.Add ("OCC27065",
|
||||
"OCC27065 spine profile",
|
||||
__FILE__, OCC27065, group);
|
||||
|
||||
theCommands.Add ("OCC27523",
|
||||
"OCC27523: Checks recomputation of deactivated selection mode after object's redisplaying",
|
||||
__FILE__, OCC27523, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ uses
|
||||
AsciiString from TCollection,
|
||||
ViewerSelector from SelectMgr,
|
||||
SelectableObject from SelectMgr,
|
||||
Selection from SelectMgr,
|
||||
CString from Standard,
|
||||
MapOfTransient from TColStd,
|
||||
TypeOfUpdate from SelectMgr,
|
||||
@@ -163,7 +164,7 @@ is
|
||||
theObject : SelectableObject from SelectMgr;
|
||||
theIsForce : Boolean from Standard = Standard_False;
|
||||
theMode : Integer from Standard = -1);
|
||||
---Purpose: Recomputes activated selections of theObject for all known viewer selectors according to theMode specified.
|
||||
---Purpose: Recomputes all selections of theObject for all known viewer selectors according to theMode specified.
|
||||
-- If theMode is set to default (-1), then all activated selections will be recomputed. If theIsForce is set to true,
|
||||
-- then selection mode theMode for object theObject will be recomputed regardless of its activation status.
|
||||
|
||||
@@ -210,7 +211,11 @@ is
|
||||
-- changes previous sensitivity value of all sensitive entities in selection with theMode
|
||||
-- to the given theNewSensitivity.
|
||||
|
||||
|
||||
recomputeSelectionMode (me : mutable;
|
||||
theObject : SelectableObject from SelectMgr;
|
||||
theSelection : Selection from SelectMgr;
|
||||
theMode : Integer from Standard) is protected;
|
||||
---Purpose: Recomputes given selection mode and updates BVHs in all viewer selectors
|
||||
|
||||
loadMode (me : mutable;
|
||||
theObject : SelectableObject from SelectMgr;
|
||||
|
@@ -646,6 +646,28 @@ void SelectMgr_SelectionManager::rebuildSelectionStructures (const Handle(Select
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function: recomputeSelectionMode
|
||||
// Purpose :
|
||||
//==================================================
|
||||
void SelectMgr_SelectionManager::recomputeSelectionMode (const Handle(SelectMgr_SelectableObject)& theObject,
|
||||
const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
theSelection->UpdateStatus (SelectMgr_TOU_Full);
|
||||
|
||||
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
|
||||
{
|
||||
Handle(SelectMgr_ViewerSelector) aCurSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key());
|
||||
|
||||
ClearSelectionStructures (theObject, theMode, aCurSelector);
|
||||
theObject->RecomputePrimitives (theMode);
|
||||
RestoreSelectionStructures (theObject, theMode, aCurSelector);
|
||||
theSelection->UpdateStatus (SelectMgr_TOU_None);
|
||||
theSelection->UpdateBVHStatus (SelectMgr_TBU_None);
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function: Update
|
||||
// Purpose :
|
||||
@@ -684,23 +706,22 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele
|
||||
if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject)))
|
||||
return;
|
||||
|
||||
for(theObject->Init(); theObject->More(); theObject->Next())
|
||||
if (theMode == -1)
|
||||
{
|
||||
for (theObject->Init(); theObject->More(); theObject->Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection();
|
||||
Standard_Integer aSelMode = aSelection->Mode();
|
||||
recomputeSelectionMode (theObject, aSelection, aSelMode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!theObject->HasSelection (theMode))
|
||||
return;
|
||||
|
||||
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_ViewerSelector)& aCurSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key());
|
||||
if (aCurSelector->Status (aSelection) == SelectMgr_SOS_Activated)
|
||||
{
|
||||
ClearSelectionStructures (theObject, aSelMode, aCurSelector);
|
||||
theObject->RecomputePrimitives(aSelMode);
|
||||
RestoreSelectionStructures (theObject, aSelMode, aCurSelector);
|
||||
}
|
||||
}
|
||||
aSelection->UpdateStatus (SelectMgr_TOU_None);
|
||||
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
|
||||
const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
|
||||
recomputeSelectionMode (theObject, aSelection, theMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
24
tests/bugs/modalg_6/bug27065_1
Normal file
24
tests/bugs/modalg_6/bug27065_1
Normal file
@@ -0,0 +1,24 @@
|
||||
puts "============"
|
||||
puts "OCC27065"
|
||||
puts "============"
|
||||
puts ""
|
||||
###############################
|
||||
## BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
|
||||
###############################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
restore [locate_data_file bug24840_comp.brep] sh
|
||||
explode sh
|
||||
OCC27065 sh_1 sh_2
|
||||
fit
|
||||
|
||||
checknbshapes res_shell -vertex 56 -edge 130 -wire 99 -face 99 -shell 24 -solid 24 -compsolid 1 -compound 1 -shape 434
|
||||
|
||||
checknbshapes res_face -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 35
|
||||
|
||||
checknbshapes res_wire -vertex 8 -edge 12 -wire 4 -face 4 -shell 1 -solid 0 -compsolid 0 -compound 1 -shape 30
|
||||
|
||||
checknbshapes res_edge -vertex 4 -edge 4 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 11
|
||||
|
||||
checknbshapes res_vertex -vertex 2 -edge 1 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 4
|
28
tests/bugs/modalg_6/bug27065_2
Normal file
28
tests/bugs/modalg_6/bug27065_2
Normal file
@@ -0,0 +1,28 @@
|
||||
puts "============"
|
||||
puts "OCC27065"
|
||||
puts "============"
|
||||
puts ""
|
||||
###############################
|
||||
## BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
|
||||
###############################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
restore [locate_data_file bug23903_base.brep] base
|
||||
restore [locate_data_file bug23903_path.brep] sp
|
||||
explode base
|
||||
shape pr Sh
|
||||
add base_1 pr
|
||||
add base_2 pr
|
||||
OCC27065 sp pr
|
||||
fit
|
||||
|
||||
checknbshapes res_shell -vertex 2 -edge 5 -wire 3 -face 3 -shell 2 -solid 2 -compsolid 1 -compound 1 -shape 19
|
||||
|
||||
checknbshapes res_face -vertex 2 -edge 4 -wire 2 -face 2 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 13
|
||||
|
||||
checknbshapes res_wire -vertex 2 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 1 -shape 12
|
||||
|
||||
checknbshapes res_edge -vertex 2 -edge 3 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 8
|
||||
|
||||
checknbshapes res_vertex -vertex 1 -edge 1 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 3
|
37
tests/bugs/vis/bug26870
Normal file
37
tests/bugs/vis/bug26870
Normal file
@@ -0,0 +1,37 @@
|
||||
puts "============"
|
||||
puts "CR26870"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
##########################################################################################
|
||||
puts "Visualization - deactivated selections are not updated after object's re-computation"
|
||||
##########################################################################################
|
||||
|
||||
pload VISUALIZATION MODELING
|
||||
|
||||
vinit
|
||||
box b 1 1 1
|
||||
vdisplay b
|
||||
vfit
|
||||
|
||||
vselmode b 2 1
|
||||
vselmode b 4 1
|
||||
vselmode b 4 0
|
||||
|
||||
box b 3 3 3
|
||||
vdisplay b
|
||||
vfit
|
||||
|
||||
vselmode 4 1
|
||||
|
||||
# pick a point onto previously computed face
|
||||
vmoveto 80 265
|
||||
if {[vreadpixel 90 206 name] == "CYAN1 1"} {
|
||||
puts "ERROR: previously computed entities are highlighted! Selection mode 4 was not updated after redisplaying the box."
|
||||
}
|
||||
# pick a point onto box
|
||||
if {[vreadpixel 29 216 name] == "YELLOW 1"} {
|
||||
puts "ERROR: the box's face is not highlighted! Selection mode 4 was not updated after redisplaying the box."
|
||||
}
|
||||
|
||||
set only_screen 1
|
15
tests/bugs/vis/bug27523
Normal file
15
tests/bugs/vis/bug27523
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "============"
|
||||
puts "OCC27523"
|
||||
puts "============"
|
||||
puts ""
|
||||
####################################################################################
|
||||
# Visualization - selection owner contains obsolete shape
|
||||
####################################################################################
|
||||
|
||||
|
||||
pload QAcommands VISUALIZATION
|
||||
|
||||
vinit
|
||||
OCC27523
|
||||
|
||||
set only_screen 1
|
Reference in New Issue
Block a user