mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8f6a653158 | ||
|
c7354b8f81 | ||
|
78541f86af |
@@ -50,27 +50,22 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
S->Bounds(umin, umax, vmin, vmax);
|
||||
S->D1((umin + umax) / 2, (vmin + vmax) / 2, P, DU, DV);
|
||||
|
||||
if (DU.SquareMagnitude() > gp::Resolution() &&
|
||||
DV.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
// On prend DX le plus proche possible de DU
|
||||
gp_Dir du(DU);
|
||||
Standard_Real Angle1 = du.Angle(DX);
|
||||
Standard_Real Angle2 = du.Angle(DY);
|
||||
if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1;
|
||||
if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2;
|
||||
if (Angle2 < Angle1) {
|
||||
du = DY; DY = DX; DX = du;
|
||||
}
|
||||
if (DX.Angle(DU) > M_PI / 2) DX.Reverse();
|
||||
if (DY.Angle(DV) > M_PI / 2) DY.Reverse();
|
||||
|
||||
gp_Ax3 axe(Bary, DX^DY, DX);
|
||||
Plan.SetPosition(axe);
|
||||
Plan.SetLocation(Bary);
|
||||
IsPlan = Standard_True;
|
||||
// On prend DX le plus proche possible de DU
|
||||
gp_Dir du(DU);
|
||||
Standard_Real Angle1 = du.Angle(DX);
|
||||
Standard_Real Angle2 = du.Angle(DY);
|
||||
if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1;
|
||||
if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2;
|
||||
if (Angle2 < Angle1) {
|
||||
du = DY; DY = DX; DX = du;
|
||||
}
|
||||
if (DX.Angle(DU) > M_PI / 2) DX.Reverse();
|
||||
if (DY.Angle(DV) > M_PI / 2) DY.Reverse();
|
||||
|
||||
gp_Ax3 axe(Bary, DX^DY, DX);
|
||||
Plan.SetPosition(axe);
|
||||
Plan.SetLocation(Bary);
|
||||
IsPlan = Standard_True;
|
||||
}
|
||||
return IsPlan;
|
||||
}
|
||||
|
@@ -25,15 +25,8 @@ enum Graphic3d_TransModeFlags
|
||||
Graphic3d_TMF_TriedronPers = 0x0020, //!< object behaves like trihedron - it is fixed at the corner of view and does not resizing (but rotating)
|
||||
Graphic3d_TMF_2d = 0x0040, //!< object is defined in 2D screen coordinates (pixels) and does not resize, pan and rotate
|
||||
Graphic3d_TMF_CameraPers = 0x0080, //!< object is in front of the camera
|
||||
Graphic3d_TMF_OrthoPers = 0x0100, //!< object is forced to be rendered with orthographic projection.
|
||||
Graphic3d_TMF_ZoomRotatePers = Graphic3d_TMF_ZoomPers
|
||||
| Graphic3d_TMF_RotatePers //!< object doesn't resize and rotate
|
||||
};
|
||||
|
||||
//! Bitwise OR operator for transform persistence mode flags. Be aware that some flags combinations are not valid.
|
||||
inline Graphic3d_TransModeFlags operator| (Graphic3d_TransModeFlags a, Graphic3d_TransModeFlags b)
|
||||
{
|
||||
return static_cast<Graphic3d_TransModeFlags> (static_cast<uint32_t> (a) | static_cast<uint32_t> (b));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -58,12 +58,6 @@ public:
|
||||
return (theMode & (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_2d)) != 0;
|
||||
}
|
||||
|
||||
//! Return true if specified mode is orthographic projection transformation persistence.
|
||||
static Standard_Boolean IsOrthoPers (Graphic3d_TransModeFlags theMode)
|
||||
{
|
||||
return (theMode & Graphic3d_TMF_OrthoPers) != 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Set transformation persistence.
|
||||
@@ -116,9 +110,6 @@ public:
|
||||
//! Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes.
|
||||
Standard_Boolean IsTrihedronOr2d() const { return IsTrihedronOr2d (myMode); }
|
||||
|
||||
//! Return true for Graphic3d_TMF_OrthoPers mode.
|
||||
Standard_Boolean IsOrthoPers () const { return IsOrthoPers (myMode); }
|
||||
|
||||
//! Transformation persistence mode flags.
|
||||
Graphic3d_TransModeFlags Mode() const { return myMode; }
|
||||
|
||||
@@ -306,32 +297,28 @@ public:
|
||||
//! @param theWorldView [in] the world view transformation matrix.
|
||||
//! @param theViewportWidth [in] the width of viewport (for 2d persistence).
|
||||
//! @param theViewportHeight [in] the height of viewport (for 2d persistence).
|
||||
//! @param theToApplyProjPers [in] if should apply projection persistence to matrix (for orthographic persistence).
|
||||
//! @return transformation matrix to be applied to model world transformation of an object.
|
||||
template<class T>
|
||||
NCollection_Mat4<T> Compute (const Handle(Graphic3d_Camera)& theCamera,
|
||||
const NCollection_Mat4<T>& theProjection,
|
||||
const NCollection_Mat4<T>& theWorldView,
|
||||
const Standard_Integer theViewportWidth,
|
||||
const Standard_Integer theViewportHeight,
|
||||
const Standard_Boolean theToApplyProjPers = false) const;
|
||||
const Standard_Integer theViewportHeight) const;
|
||||
|
||||
//! Apply transformation persistence on specified matrices.
|
||||
//! @param theCamera [in] camera definition
|
||||
//! @param theProjection [in] projection matrix to modify
|
||||
//! @param theWorldView [in/out] world-view matrix to modify
|
||||
//! @param theViewportWidth [in] viewport width
|
||||
//! @param theViewportHeight [in] viewport height
|
||||
//! @param theAnchor [in] if not NULL, overrides anchor point
|
||||
//! @param theToApplyProjPers [in] if should apply projection persistence to matrix (for orthographic persistence).
|
||||
//! @param theCamera camera definition
|
||||
//! @param theProjection projection matrix to modify
|
||||
//! @param theWorldView world-view matrix to modify
|
||||
//! @param theViewportWidth viewport width
|
||||
//! @param theViewportHeight viewport height
|
||||
//! @param theAnchor if not NULL, overrides anchor point
|
||||
template<class T>
|
||||
void Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
const NCollection_Mat4<T>& theProjection,
|
||||
NCollection_Mat4<T>& theWorldView,
|
||||
const Standard_Integer theViewportWidth,
|
||||
const Standard_Integer theViewportHeight,
|
||||
const gp_Pnt* theAnchor = NULL,
|
||||
const Standard_Boolean theToApplyProjPers = true) const;
|
||||
const gp_Pnt* theAnchor = NULL) const;
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
@@ -381,50 +368,41 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
NCollection_Mat4<T>& theWorldView,
|
||||
const Standard_Integer theViewportWidth,
|
||||
const Standard_Integer theViewportHeight,
|
||||
const gp_Pnt* theAnchor,
|
||||
const Standard_Boolean theToApplyProjPers) const
|
||||
const gp_Pnt* theAnchor) const
|
||||
{
|
||||
(void )theViewportWidth;
|
||||
(void )theProjection;
|
||||
if (myMode == Graphic3d_TMF_None
|
||||
|| theViewportHeight == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Camera) aCamera = theCamera;
|
||||
if (IsOrthoPers() && !aCamera->IsOrthographic())
|
||||
{
|
||||
aCamera = new Graphic3d_Camera(*theCamera); // If OrthoPers, copy camera and set to orthographic projection
|
||||
aCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
|
||||
}
|
||||
|
||||
NCollection_Mat4<Standard_Real> aWorldView = aCamera->OrientationMatrix();
|
||||
|
||||
// use total size when tiling is active
|
||||
const Standard_Integer aVPSizeY = aCamera->Tile().IsValid() ? aCamera->Tile().TotalSize.y() : theViewportHeight;
|
||||
const Standard_Integer aVPSizeY = theCamera->Tile().IsValid() ? theCamera->Tile().TotalSize.y() : theViewportHeight;
|
||||
|
||||
// a small enough jitter compensation offset
|
||||
// to avoid image dragging within single pixel in corner cases
|
||||
const Standard_Real aJitterComp = 0.001;
|
||||
if ((myMode & Graphic3d_TMF_TriedronPers) != 0)
|
||||
if (myMode == Graphic3d_TMF_TriedronPers)
|
||||
{
|
||||
// reset Z focus for trihedron persistence
|
||||
const Standard_Real aFocus = aCamera->IsOrthographic()
|
||||
? aCamera->Distance()
|
||||
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
|
||||
? Standard_Real(aCamera->ZFocus() * aCamera->Distance())
|
||||
: Standard_Real(aCamera->ZFocus()));
|
||||
const Standard_Real aFocus = theCamera->IsOrthographic()
|
||||
? theCamera->Distance()
|
||||
: (theCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
|
||||
? Standard_Real(theCamera->ZFocus() * theCamera->Distance())
|
||||
: Standard_Real(theCamera->ZFocus()));
|
||||
|
||||
// scale factor to pixels
|
||||
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus);
|
||||
const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
|
||||
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
const gp_Dir aForward = aCamera->Direction();
|
||||
gp_XYZ aCenter = aCamera->Center().XYZ() + aForward.XYZ() * (aFocus - aCamera->Distance());
|
||||
const gp_Dir aForward = theCamera->Direction();
|
||||
gp_XYZ aCenter = theCamera->Center().XYZ() + aForward.XYZ() * (aFocus - theCamera->Distance());
|
||||
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
|
||||
{
|
||||
const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
|
||||
const gp_Dir aSide = aForward.Crossed (aCamera->Up());
|
||||
const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * aCamera->NDC2dOffsetX() - anOffsetX);
|
||||
const gp_Dir aSide = aForward.Crossed (theCamera->Up());
|
||||
const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * theCamera->NDC2dOffsetX() - anOffsetX);
|
||||
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
|
||||
{
|
||||
aCenter += aDeltaX;
|
||||
@@ -437,7 +415,7 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
|
||||
{
|
||||
const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
|
||||
const gp_XYZ aDeltaY = aCamera->Up().XYZ() * (Abs(aViewDim.Y()) * aCamera->NDC2dOffsetY() - anOffsetY);
|
||||
const gp_XYZ aDeltaY = theCamera->Up().XYZ() * (Abs(aViewDim.Y()) * theCamera->NDC2dOffsetY() - anOffsetY);
|
||||
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
|
||||
{
|
||||
aCenter += aDeltaY;
|
||||
@@ -448,24 +426,27 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
}
|
||||
}
|
||||
|
||||
NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
|
||||
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
|
||||
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
|
||||
theWorldView.ConvertFrom (aWorldView);
|
||||
return;
|
||||
}
|
||||
else if ((myMode & Graphic3d_TMF_2d) != 0)
|
||||
else if (myMode == Graphic3d_TMF_2d)
|
||||
{
|
||||
const Standard_Real aFocus = aCamera->IsOrthographic()
|
||||
? aCamera->Distance()
|
||||
: (aCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
|
||||
? Standard_Real(aCamera->ZFocus() * aCamera->Distance())
|
||||
: Standard_Real(aCamera->ZFocus()));
|
||||
const Standard_Real aFocus = theCamera->IsOrthographic()
|
||||
? theCamera->Distance()
|
||||
: (theCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
|
||||
? Standard_Real(theCamera->ZFocus() * theCamera->Distance())
|
||||
: Standard_Real(theCamera->ZFocus()));
|
||||
|
||||
// scale factor to pixels
|
||||
const gp_XYZ aViewDim = aCamera->ViewDimensions (aFocus);
|
||||
const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
|
||||
const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
|
||||
gp_XYZ aCenter (0.0, 0.0, -aFocus);
|
||||
if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
|
||||
{
|
||||
aCenter.SetX (-aViewDim.X() * aCamera->NDC2dOffsetX() + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
|
||||
aCenter.SetX (-aViewDim.X() * theCamera->NDC2dOffsetX() + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
|
||||
if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
|
||||
{
|
||||
aCenter.SetX (-aCenter.X());
|
||||
@@ -473,24 +454,26 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
}
|
||||
if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
|
||||
{
|
||||
aCenter.SetY (-aViewDim.Y() * aCamera->NDC2dOffsetY() + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
|
||||
aCenter.SetY (-aViewDim.Y() * theCamera->NDC2dOffsetY() + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
|
||||
if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
|
||||
{
|
||||
aCenter.SetY (-aCenter.Y());
|
||||
}
|
||||
}
|
||||
|
||||
aWorldView.InitIdentity();
|
||||
Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
|
||||
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
|
||||
theWorldView.InitIdentity();
|
||||
Graphic3d_TransformUtils::Translate (theWorldView, T(aCenter.X()), T(aCenter.Y()), T(aCenter.Z()));
|
||||
Graphic3d_TransformUtils::Scale (theWorldView, T(aScale), T(aScale), T(aScale));
|
||||
return;
|
||||
}
|
||||
else if ((myMode & Graphic3d_TMF_CameraPers) != 0)
|
||||
{
|
||||
aWorldView.InitIdentity();
|
||||
theWorldView.InitIdentity();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compute reference point for transformation in untransformed projection space.
|
||||
NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
|
||||
if (theAnchor != NULL)
|
||||
{
|
||||
Graphic3d_TransformUtils::Translate (aWorldView, theAnchor->X(), theAnchor->Y(), theAnchor->Z());
|
||||
@@ -520,19 +503,12 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
if ((myMode & Graphic3d_TMF_ZoomPers) != 0)
|
||||
{
|
||||
// lock zooming
|
||||
Standard_Real aScale = persistentScale (aCamera, theViewportWidth, theViewportHeight);
|
||||
Standard_Real aScale = persistentScale (theCamera, theViewportWidth, theViewportHeight);
|
||||
Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
|
||||
}
|
||||
theWorldView.ConvertFrom (aWorldView);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theCamera->IsOrthographic() && IsOrthoPers() && theToApplyProjPers)
|
||||
{
|
||||
Graphic3d_Mat4d aProjInv;
|
||||
aProjInv.ConvertFrom (theProjection.Inverted());
|
||||
aWorldView = (aProjInv * aCamera->ProjectionMatrix()) * aWorldView;
|
||||
}
|
||||
|
||||
theWorldView.ConvertFrom (aWorldView);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -579,7 +555,7 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
|
||||
const Standard_Integer theViewportHeight,
|
||||
BVH_Box<T, 3>& theBoundingBox) const
|
||||
{
|
||||
NCollection_Mat4<T> aTPers = Compute (theCamera, theProjection, theWorldView, theViewportWidth, theViewportHeight, false);
|
||||
NCollection_Mat4<T> aTPers = Compute (theCamera, theProjection, theWorldView, theViewportWidth, theViewportHeight);
|
||||
if (aTPers.IsIdentity()
|
||||
|| !theBoundingBox.IsValid())
|
||||
{
|
||||
@@ -618,8 +594,7 @@ NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Cam
|
||||
const NCollection_Mat4<T>& theProjection,
|
||||
const NCollection_Mat4<T>& theWorldView,
|
||||
const Standard_Integer theViewportWidth,
|
||||
const Standard_Integer theViewportHeight,
|
||||
const Standard_Boolean theToApplyProjPers) const
|
||||
const Standard_Integer theViewportHeight) const
|
||||
{
|
||||
if (myMode == Graphic3d_TMF_None)
|
||||
{
|
||||
@@ -635,7 +610,7 @@ NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Cam
|
||||
|
||||
// compute only world-view matrix difference to avoid floating point instability
|
||||
// caused by projection matrix modifications outside of this algorithm (e.g. by Z-fit)
|
||||
Apply (theCamera, theProjection, aWorldView, theViewportWidth, theViewportHeight, NULL, theToApplyProjPers);
|
||||
Apply (theCamera, theProjection, aWorldView, theViewportWidth, theViewportHeight);
|
||||
return anUnviewMat * aWorldView;
|
||||
}
|
||||
|
||||
|
@@ -178,8 +178,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
#ifdef CHRONO
|
||||
Chronrsnld.Stop();
|
||||
#endif
|
||||
Standard_Boolean isOnDegeneratedBorder = Standard_False;
|
||||
|
||||
|
||||
if (Cadre) { // update of limits.
|
||||
BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM;
|
||||
}
|
||||
@@ -263,7 +262,6 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
/ (uv[aCoordIdx - 1] - uvprev[aCoordIdx - 1]) );
|
||||
Standard_Integer aFixIdx = aCoordIdx == 1? 2 : 1; // Fixing index;
|
||||
Uvap(aFixIdx) = uv[aFixIdx - 1] + (uv[aFixIdx - 1] - uvprev[aFixIdx - 1]) * aScaleCoeff;
|
||||
isOnDegeneratedBorder = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,8 +307,6 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
if (N <= 0) { // jag 941017
|
||||
MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol);
|
||||
Tgtend = Func.IsTangent(); // jag 940616
|
||||
if (isOnDegeneratedBorder)
|
||||
Tgtend = Standard_True;
|
||||
N = -N;
|
||||
}
|
||||
Arrive = (wd2[I].etat == 12); // the line is open
|
||||
@@ -319,9 +315,6 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
|
||||
aStatus = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
|
||||
NbDivision,PasC,StepSign);
|
||||
|
||||
if (isOnDegeneratedBorder && Tgtend)
|
||||
aStatus = IntWalk_ArretSurPoint;
|
||||
|
||||
StatusPrecedent = aStatus;
|
||||
if (aStatus == IntWalk_PasTropGrand) {// division of the step
|
||||
Arrive = Standard_False;
|
||||
|
@@ -91,14 +91,7 @@ void RWStepBasic_RWProduct::WriteStep
|
||||
|
||||
// --- own field : description ---
|
||||
|
||||
if (!ent->Description().IsNull())
|
||||
{
|
||||
SW.Send(ent->Description());
|
||||
}
|
||||
else
|
||||
{
|
||||
SW.SendUndef();
|
||||
}
|
||||
SW.Send(ent->Description());
|
||||
|
||||
// --- own field : frameOfReference ---
|
||||
|
||||
|
@@ -78,14 +78,7 @@ void RWStepBasic_RWProductDefinition::WriteStep
|
||||
|
||||
// --- own field : description ---
|
||||
|
||||
if (!ent->Description().IsNull())
|
||||
{
|
||||
SW.Send(ent->Description());
|
||||
}
|
||||
else
|
||||
{
|
||||
SW.SendUndef();
|
||||
}
|
||||
SW.Send(ent->Description());
|
||||
|
||||
// --- own field : formation ---
|
||||
|
||||
|
@@ -71,14 +71,7 @@ void RWStepBasic_RWProductDefinitionFormation::WriteStep
|
||||
|
||||
// --- own field : description ---
|
||||
|
||||
if (!ent->Description().IsNull())
|
||||
{
|
||||
SW.Send(ent->Description());
|
||||
}
|
||||
else
|
||||
{
|
||||
SW.SendUndef();
|
||||
}
|
||||
SW.Send(ent->Description());
|
||||
|
||||
// --- own field : ofProduct ---
|
||||
|
||||
|
@@ -151,8 +151,6 @@ bool STEPCAFControl_ConfigurationNode::Load(const Handle(DE_ConfigurationContext
|
||||
theResource->BooleanVal("write.props", InternalParameters.WriteProps, aScope);
|
||||
InternalParameters.WriteModelType = (STEPControl_StepModelType)
|
||||
theResource->IntegerVal("write.model.type", InternalParameters.WriteModelType, aScope);
|
||||
InternalParameters.WriteNonmanifold =
|
||||
theResource->IntegerVal("write.nonmanifold", InternalParameters.WriteNonmanifold, aScope);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -74,12 +74,12 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
aReader.SetLayerMode(aNode->InternalParameters.ReadLayer);
|
||||
aReader.SetPropsMode(aNode->InternalParameters.ReadProps);
|
||||
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
||||
aReadStat = aReader.ReadFile(thePath.ToCString(), aNode->InternalParameters);
|
||||
StepData_ConfParameters aParams;
|
||||
aReadStat = aReader.ReadFile(thePath.ToCString(), aParams);
|
||||
if (aReadStat != IFSelect_RetDone)
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
||||
thePath << "\t: abandon";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,10 +87,8 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
||||
thePath << "\t: Cannot read any relevant data from the STEP file";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
aNode->InternalParameters.Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -124,13 +122,13 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
|
||||
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
|
||||
aWriter.SetPropsMode(aNode->InternalParameters.WriteProps);
|
||||
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
|
||||
|
||||
TDF_Label aLabel;
|
||||
if (!aWriter.Transfer(theDocument, aNode->InternalParameters, aMode, 0, theProgress))
|
||||
StepData_ConfParameters aParams;
|
||||
if (!aWriter.Transfer(theDocument, aParams, aMode, 0, theProgress))
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
||||
thePath << "\t: The document cannot be translated or gives no result";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
IFSelect_ReturnStatus aStatus = aWriter.Write(thePath.ToCString());
|
||||
@@ -140,7 +138,6 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
||||
thePath << "\t: No file written";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;;
|
||||
}
|
||||
case IFSelect_RetDone:
|
||||
@@ -151,11 +148,9 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during writing the file " <<
|
||||
thePath << "\t: Error on writing file";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
aNode->InternalParameters.Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -204,13 +199,13 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
STEPControl_Reader aReader;
|
||||
aReader.SetWS(theWS);
|
||||
IFSelect_ReturnStatus aReadstat = IFSelect_RetVoid;
|
||||
aReadstat = aReader.ReadFile(thePath.ToCString(), aNode->InternalParameters);
|
||||
StepData_ConfParameters aParams;
|
||||
aReadstat = aReader.ReadFile(thePath.ToCString(), aParams);
|
||||
Handle(StepData_StepModel) aModel = aReader.StepModel();
|
||||
if (aReadstat != IFSelect_RetDone)
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
||||
thePath << "\t: abandon, no model loaded";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
aModel->SetLocalLengthUnit(aNode->GlobalParameters.LengthUnit);
|
||||
@@ -218,11 +213,9 @@ bool STEPCAFControl_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
||||
thePath << "\t:Cannot read any relevant data from the STEP file";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
theShape = aReader.OneShape();
|
||||
aNode->InternalParameters.Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -249,21 +242,19 @@ bool STEPCAFControl_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
IFSelect_ReturnStatus aWritestat = IFSelect_RetVoid;
|
||||
Handle(StepData_StepModel) aModel = aWriter.Model();
|
||||
aModel->SetWriteLengthUnit(UnitsMethods::GetLengthUnitScale(aNode->InternalParameters.WriteUnit, UnitsMethods_LengthUnit_Millimeter));
|
||||
aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, aNode->InternalParameters, true, theProgress);
|
||||
StepData_ConfParameters aParams;
|
||||
aWritestat = aWriter.Transfer(theShape, aNode->InternalParameters.WriteModelType, aParams, true, theProgress);
|
||||
if (aWritestat != IFSelect_RetDone)
|
||||
{
|
||||
Message::SendFail() << "Error in the STEPCAFControl_Provider during reading the file " <<
|
||||
thePath << "\t: abandon, no model loaded";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
if (aWriter.Write(thePath.ToCString()) != IFSelect_RetDone)
|
||||
{
|
||||
Message::SendFail() << "STEPCAFControl_Provider: Error on writing file";
|
||||
aNode->InternalParameters.Reset();
|
||||
return false;
|
||||
}
|
||||
aNode->InternalParameters.Reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -573,7 +573,6 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
{
|
||||
reader.ClearShapes();
|
||||
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(reader.Model());
|
||||
myReader.WS()->TransferReader()->SetEncodeRegAngle(aModel->InternalParameters.EncodeRegAngle);
|
||||
StepData_Factors aLocalFactors;
|
||||
prepareUnits(aModel, doc, aLocalFactors);
|
||||
Standard_Integer i;
|
||||
@@ -2554,36 +2553,11 @@ static Standard_Boolean ReadDatums(const Handle(XCAFDoc_ShapeTool) &STool,
|
||||
const Handle(StepDimTol_GeometricToleranceWithDatumReference)& GTWDR)
|
||||
{
|
||||
if (GTWDR.IsNull()) return Standard_False;
|
||||
Handle(StepDimTol_HArray1OfDatumSystemOrReference) aHADSOR = GTWDR->DatumSystemAP242();
|
||||
if (aHADSOR.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
NCollection_List<Handle(StepDimTol_Datum)> aDatumList;
|
||||
for (Standard_Integer idr = 1; idr <= aHADSOR->Length(); idr++)
|
||||
{
|
||||
const StepDimTol_DatumSystemOrReference aDSOR = aHADSOR->Value(idr);
|
||||
if (aDSOR.IsNull()) continue;
|
||||
Handle(StepDimTol_DatumSystem) aDS = aDSOR.DatumSystem();
|
||||
Handle(StepDimTol_DatumReference) aDR = aDSOR.DatumReference();
|
||||
Handle(StepDimTol_Datum) aDatum;
|
||||
if (!aDS.IsNull())
|
||||
{
|
||||
auto aDatumConList = aDS->Constituents();
|
||||
for (Standard_Integer anInd = 1; anInd <= aDatumConList->Length(); anInd++)
|
||||
{
|
||||
Handle(StepDimTol_DatumReferenceCompartment) aDatRefC = aDatumConList->Value(anInd);
|
||||
aDatumList.Append(aDatRefC->Base().Datum());
|
||||
}
|
||||
}
|
||||
else if (!aDR.IsNull())
|
||||
{
|
||||
aDatumList.Append(aDR->ReferencedDatum());
|
||||
}
|
||||
}
|
||||
for(NCollection_List<Handle(StepDimTol_Datum)>::Iterator anIt(aDatumList); anIt.More(); anIt.Next())
|
||||
{
|
||||
Handle(StepDimTol_Datum) aDatum = anIt.Value();
|
||||
Handle(StepDimTol_HArray1OfDatumReference) HADR = GTWDR->DatumSystem();
|
||||
if (HADR.IsNull()) return Standard_False;
|
||||
for (Standard_Integer idr = 1; idr <= HADR->Length(); idr++) {
|
||||
Handle(StepDimTol_DatumReference) DR = HADR->Value(idr);
|
||||
Handle(StepDimTol_Datum) aDatum = DR->ReferencedDatum();
|
||||
if (aDatum.IsNull()) continue;
|
||||
Interface_EntityIterator subs4 = graph.Sharings(aDatum);
|
||||
for (subs4.Start(); subs4.More(); subs4.Next()) {
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <STEPControl_Writer.hxx>
|
||||
|
||||
#include <APIHeaderSection_MakeHeader.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <STEPControl_ActorWrite.hxx>
|
||||
@@ -163,12 +162,7 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
}
|
||||
if (!thesession->Model().IsNull())
|
||||
{
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(thesession->Model());
|
||||
aStepModel->InternalParameters = theParams;
|
||||
thesession->TransferWriter()->SetNonmanifoldMode(aStepModel->InternalParameters.WriteNonmanifold);
|
||||
aStepModel->ClearHeader();
|
||||
APIHeaderSection_MakeHeader aHeaderApi;
|
||||
aHeaderApi.Apply(aStepModel);
|
||||
Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters = theParams;
|
||||
}
|
||||
Handle(STEPControl_ActorWrite) ActWrite =
|
||||
Handle(STEPControl_ActorWrite)::DownCast(WS()->NormAdaptor()->ActorWrite());
|
||||
|
@@ -93,24 +93,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_AxisIntersector::ScaleAndTransform (
|
||||
return aRes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CopyWithBuilder
|
||||
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
|
||||
// Returned frustum should be re-constructed before being used.
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_BaseIntersector) SelectMgr_AxisIntersector::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
|
||||
{
|
||||
(void )theBuilder;
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::CopyWithBuilder() should be called after selection axis initialization");
|
||||
|
||||
Handle(SelectMgr_AxisIntersector) aRes = new SelectMgr_AxisIntersector();
|
||||
aRes->myAxis = myAxis;
|
||||
aRes->mySelectionType = mySelectionType;
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : hasIntersection
|
||||
// purpose :
|
||||
|
@@ -52,11 +52,6 @@ public:
|
||||
const gp_GTrsf& theTrsf,
|
||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns a copy of the intersector transformed using the builder configuration given.
|
||||
//! Builder is an argument that represents corresponding settings for re-constructing transformed frustum from scratch.
|
||||
//! In this class, builder is not used and theBuilder parameter is ignored.
|
||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Intersection test between defined axis and given axis-aligned box
|
||||
|
@@ -71,11 +71,6 @@ public:
|
||||
const gp_GTrsf& theTrsf,
|
||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0;
|
||||
|
||||
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
|
||||
//! should NOT be NULL.
|
||||
//! @return a copy of the frustum with the input builder assigned
|
||||
virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const = 0;
|
||||
|
||||
public:
|
||||
|
||||
//! Return camera definition.
|
||||
|
@@ -449,28 +449,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_RectangularFrustum::ScaleAndTransfor
|
||||
return aRes;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CopyWithBuilder
|
||||
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
|
||||
// Returned frustum should be re-constructed before being used.
|
||||
// =======================================================================
|
||||
Handle(SelectMgr_BaseIntersector) SelectMgr_RectangularFrustum::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
|
||||
"Error! SelectMgr_RectangularFrustum::CopyWithBuilder() should be called after selection frustum initialization");
|
||||
|
||||
Standard_ASSERT_RAISE (!theBuilder.IsNull(),
|
||||
"Error! SelectMgr_RectangularFrustum::CopyWithBuilder() should be called with valid builder");
|
||||
|
||||
Handle(SelectMgr_RectangularFrustum) aRes = new SelectMgr_RectangularFrustum();
|
||||
aRes->mySelectionType = mySelectionType;
|
||||
aRes->mySelRectangle = mySelRectangle;
|
||||
aRes->myPixelTolerance = myPixelTolerance;
|
||||
aRes->SetBuilder (theBuilder);
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : IsScalable
|
||||
// purpose :
|
||||
|
@@ -99,13 +99,6 @@ public:
|
||||
const gp_GTrsf& theTrsf,
|
||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns a copy of the frustum using the given frustum builder configuration.
|
||||
//! Returned frustum should be re-constructed before being used.
|
||||
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
|
||||
//! should NOT be NULL.
|
||||
//! @return a copy of the frustum with the input builder assigned
|
||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
// SAT Tests for different objects
|
||||
|
||||
//! SAT intersection test between defined volume and given axis-aligned box
|
||||
|
@@ -241,23 +241,17 @@ namespace
|
||||
//=============================================================================
|
||||
SelectMgr_SelectableObjectSet::SelectMgr_SelectableObjectSet()
|
||||
{
|
||||
myBVH[BVHSubset_ortho2dPersistent] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_ortho3dPersistent] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_2dPersistent] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_3dPersistent] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_3d] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_2dPersistent] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_3dPersistent] = new BVH_Tree<Standard_Real, 3>();
|
||||
myBVH[BVHSubset_3d] = new BVH_Tree<Standard_Real, 3>();
|
||||
|
||||
myBuilder[BVHSubset_ortho2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
|
||||
myBuilder[BVHSubset_ortho3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
|
||||
myBuilder[BVHSubset_2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
|
||||
myBuilder[BVHSubset_3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
|
||||
myBuilder[BVHSubset_3d] = new BVH_BinnedBuilder<Standard_Real, 3, 4> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth, Standard_True);
|
||||
myBuilder[BVHSubset_2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
|
||||
myBuilder[BVHSubset_3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
|
||||
myBuilder[BVHSubset_3d] = new BVH_BinnedBuilder<Standard_Real, 3, 4> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth, Standard_True);
|
||||
|
||||
myIsDirty[BVHSubset_ortho2dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_ortho3dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_3d] = Standard_False;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_3d] = Standard_False;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -268,9 +262,10 @@ Standard_Boolean SelectMgr_SelectableObjectSet::Append (const Handle(SelectMgr_S
|
||||
{
|
||||
// get an appropriate BVH subset to insert the object into it
|
||||
const Standard_Integer aSubsetIdx = appropriateSubset (theObject);
|
||||
|
||||
|
||||
// check that the object is excluded from other subsets
|
||||
if (currentSubset (theObject) != -1)
|
||||
if (myObjects[(aSubsetIdx + 1) % BVHSubsetNb].Contains (theObject)
|
||||
|| myObjects[(aSubsetIdx + 2) % BVHSubsetNb].Contains (theObject))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -406,51 +401,9 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
|
||||
myBuilder[BVHSubset_2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_2dPersistent].get(), anAdaptor.Box());
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// check and update 3D orthographic persistence BVH tree if necessary
|
||||
// -------------------------------------------------------------------
|
||||
if (!IsEmpty (BVHSubset_ortho3dPersistent)
|
||||
&& (myIsDirty[BVHSubset_ortho3dPersistent]
|
||||
|| myLastViewState.IsChanged (aViewState)
|
||||
|| isWinSizeChanged))
|
||||
{
|
||||
Handle(Graphic3d_Camera) aNewOrthoCam = new Graphic3d_Camera (*theCam); // If OrthoPers, copy camera and set to orthographic projection
|
||||
aNewOrthoCam->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
|
||||
|
||||
// construct adaptor over private fields to provide direct access for the BVH builder
|
||||
BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_ortho3dPersistent],
|
||||
aNewOrthoCam, aNewOrthoCam->ProjectionMatrix(),
|
||||
aNewOrthoCam->OrientationMatrix(), theWinSize);
|
||||
|
||||
// update corresponding BVH tree data structure
|
||||
myBuilder[BVHSubset_ortho3dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_ortho3dPersistent].get(), anAdaptor.Box());
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// check and update 2D orthographic persistence BVH tree if necessary
|
||||
// -------------------------------------------------------------------
|
||||
if (!IsEmpty (BVHSubset_ortho2dPersistent)
|
||||
&& (myIsDirty[BVHSubset_ortho2dPersistent]
|
||||
|| myLastViewState.IsProjectionChanged (aViewState)
|
||||
|| isWinSizeChanged))
|
||||
{
|
||||
Handle(Graphic3d_Camera) aNewOrthoCam = new Graphic3d_Camera (*theCam); // If OrthoPers, copy camera and set to orthographic projection
|
||||
aNewOrthoCam->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
|
||||
|
||||
// construct adaptor over private fields to provide direct access for the BVH builder
|
||||
BVHBuilderAdaptorPersistent anAdaptor (myObjects[BVHSubset_ortho2dPersistent],
|
||||
aNewOrthoCam, aNewOrthoCam->ProjectionMatrix(),
|
||||
SelectMgr_SelectableObjectSet_THE_IDENTITY_MAT, theWinSize);
|
||||
|
||||
// update corresponding BVH tree data structure
|
||||
myBuilder[BVHSubset_ortho2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_ortho2dPersistent].get(), anAdaptor.Box());
|
||||
}
|
||||
|
||||
// release dirty state for every subset
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_ortho3dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_ortho2dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_False;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_False;
|
||||
|
||||
// keep last view state
|
||||
myLastViewState = aViewState;
|
||||
@@ -466,11 +419,9 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
|
||||
//=============================================================================
|
||||
void SelectMgr_SelectableObjectSet::MarkDirty()
|
||||
{
|
||||
myIsDirty[BVHSubset_3d] = Standard_True;
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_ortho3dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_ortho2dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_3d] = Standard_True;
|
||||
myIsDirty[BVHSubset_3dPersistent] = Standard_True;
|
||||
myIsDirty[BVHSubset_2dPersistent] = Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
|
@@ -42,22 +42,11 @@ public:
|
||||
//! needs to be updated only when camera's projection changes. Bounding volumes for this object subclass
|
||||
//! is represented directly in eye space coordinates.
|
||||
//! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
|
||||
//! - BVHSubset_ortho3dPersistent refers to the subset of 3D persistent selectable objects (rotate, pan, zoom persistence)
|
||||
//! that contains `Graphic3d_TMF_OrthoPers` persistence mode.
|
||||
//! Associated BVH tree needs to be updated when either the camera's projection and position change.
|
||||
//! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
|
||||
//! - BVHSubset_ortho2dPersistent refers to the subset of 2D persistent selectable objects
|
||||
//! that contains `Graphic3d_TMF_OrthoPers` persistence mode. Associated BVH tree
|
||||
//! needs to be updated only when camera's projection changes. Bounding volumes for this object subclass
|
||||
//! is represented directly in eye space coordinates.
|
||||
//! This subset uses linear BVH builder with 32 levels of depth and 1 element per leaf.
|
||||
enum BVHSubset
|
||||
{
|
||||
BVHSubset_3d,
|
||||
BVHSubset_3dPersistent,
|
||||
BVHSubset_2dPersistent,
|
||||
BVHSubset_ortho3dPersistent,
|
||||
BVHSubset_ortho2dPersistent,
|
||||
BVHSubsetNb
|
||||
};
|
||||
|
||||
@@ -151,9 +140,7 @@ public:
|
||||
{
|
||||
return myObjects[BVHSubset_3d].Contains (theObject)
|
||||
|| myObjects[BVHSubset_3dPersistent].Contains (theObject)
|
||||
|| myObjects[BVHSubset_2dPersistent].Contains (theObject)
|
||||
|| myObjects[BVHSubset_ortho3dPersistent].Contains (theObject)
|
||||
|| myObjects[BVHSubset_ortho2dPersistent].Contains (theObject);
|
||||
|| myObjects[BVHSubset_2dPersistent].Contains (theObject);
|
||||
}
|
||||
|
||||
//! Returns true if the object set does not contain any selectable objects.
|
||||
@@ -161,9 +148,7 @@ public:
|
||||
{
|
||||
return myObjects[BVHSubset_3d].IsEmpty()
|
||||
&& myObjects[BVHSubset_3dPersistent].IsEmpty()
|
||||
&& myObjects[BVHSubset_2dPersistent].IsEmpty()
|
||||
&& myObjects[BVHSubset_ortho3dPersistent].IsEmpty()
|
||||
&& myObjects[BVHSubset_ortho2dPersistent].IsEmpty();
|
||||
&& myObjects[BVHSubset_2dPersistent].IsEmpty();
|
||||
}
|
||||
|
||||
//! Returns true if the specified object subset is empty.
|
||||
@@ -207,18 +192,10 @@ private:
|
||||
}
|
||||
return SelectMgr_SelectableObjectSet::BVHSubset_3d;
|
||||
}
|
||||
else if ((theObject->TransformPersistence()->Mode() & Graphic3d_TMF_2d) != 0)
|
||||
else if (theObject->TransformPersistence()->Mode() == Graphic3d_TMF_2d)
|
||||
{
|
||||
if (theObject->TransformPersistence()->IsOrthoPers())
|
||||
{
|
||||
return SelectMgr_SelectableObjectSet::BVHSubset_ortho2dPersistent;
|
||||
}
|
||||
return SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent;
|
||||
}
|
||||
else if (theObject->TransformPersistence()->IsOrthoPers())
|
||||
{
|
||||
return SelectMgr_SelectableObjectSet::BVHSubset_ortho3dPersistent;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SelectMgr_SelectableObjectSet::BVHSubset_3dPersistent;
|
||||
|
@@ -67,28 +67,6 @@ SelectMgr_SelectingVolumeManager SelectMgr_SelectingVolumeManager::ScaleAndTrans
|
||||
return aMgr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CopyWithBuilder
|
||||
// purpose : Returns a copy of the selecting volume manager and its active frustum re-constructed using the passed builder.
|
||||
// Builder is an argument that represents corresponding settings for re-constructing transformed
|
||||
// frustum from scratch.
|
||||
//=======================================================================
|
||||
SelectMgr_SelectingVolumeManager SelectMgr_SelectingVolumeManager::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
|
||||
{
|
||||
SelectMgr_SelectingVolumeManager aMgr;
|
||||
aMgr.myToAllowOverlap = myToAllowOverlap;
|
||||
aMgr.myViewClipPlanes = myViewClipPlanes;
|
||||
aMgr.myObjectClipPlanes = myObjectClipPlanes;
|
||||
aMgr.myViewClipRange = myViewClipRange;
|
||||
if (!myActiveSelectingVolume.IsNull())
|
||||
{
|
||||
aMgr.myActiveSelectingVolume = myActiveSelectingVolume->CopyWithBuilder (theBuilder);
|
||||
aMgr.BuildSelectingVolume();
|
||||
}
|
||||
|
||||
return aMgr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GetActiveSelectionType
|
||||
// purpose :
|
||||
|
@@ -81,11 +81,6 @@ public:
|
||||
const gp_GTrsf& theTrsf,
|
||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const;
|
||||
|
||||
//! Returns a copy of the selecting volume manager and its active frustum re-constructed using the passed builder.
|
||||
//! Builder is an argument that represents corresponding settings for re-constructing transformed
|
||||
//! frustum from scratch.
|
||||
Standard_EXPORT virtual SelectMgr_SelectingVolumeManager CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const;
|
||||
|
||||
public:
|
||||
|
||||
//! Returns current camera definition.
|
||||
|
@@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SensitiveEntitySet, BVH_PrimitiveSet3d)
|
||||
SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder)
|
||||
: BVH_PrimitiveSet3d (theBuilder)
|
||||
{
|
||||
myNbEntityWithPersistence = 0;
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -42,6 +42,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_SensitiveEntit
|
||||
theEntity->ResetSelectionActiveStatus();
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer anExtent = mySensitives.Extent();
|
||||
if (mySensitives.Add (theEntity) > anExtent)
|
||||
{
|
||||
@@ -49,7 +50,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_SensitiveEntit
|
||||
}
|
||||
if (!theEntity->BaseSensitive()->TransformPersistence().IsNull())
|
||||
{
|
||||
++myNbEntityWithPersistence;
|
||||
myHasEntityWithPersistence = Standard_True;
|
||||
}
|
||||
MarkDirty();
|
||||
}
|
||||
@@ -77,7 +78,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_Selection)& th
|
||||
}
|
||||
if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
|
||||
{
|
||||
++myNbEntityWithPersistence;
|
||||
myHasEntityWithPersistence = Standard_True;
|
||||
}
|
||||
}
|
||||
MarkDirty();
|
||||
@@ -92,8 +93,7 @@ void SelectMgr_SensitiveEntitySet::Remove (const Handle(SelectMgr_Selection)& th
|
||||
{
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_SensitiveEntity)& aSensEnt = aSelEntIter.Value();
|
||||
const Standard_Integer anEntIdx = mySensitives.FindIndex (aSensEnt);
|
||||
const Standard_Integer anEntIdx = mySensitives.FindIndex (aSelEntIter.Value());
|
||||
if (anEntIdx == 0)
|
||||
{
|
||||
continue;
|
||||
@@ -103,13 +103,9 @@ void SelectMgr_SensitiveEntitySet::Remove (const Handle(SelectMgr_Selection)& th
|
||||
{
|
||||
Swap (anEntIdx - 1, mySensitives.Size() - 1);
|
||||
}
|
||||
if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
|
||||
{
|
||||
--myNbEntityWithPersistence;
|
||||
}
|
||||
|
||||
mySensitives.RemoveLast();
|
||||
removeOwner (aSensEnt->BaseSensitive()->OwnerId());
|
||||
removeOwner (aSelEntIter.Value()->BaseSensitive()->OwnerId());
|
||||
}
|
||||
|
||||
MarkDirty();
|
||||
|
@@ -77,7 +77,7 @@ public:
|
||||
const SelectMgr_MapOfOwners& Owners() const { return myOwnersMap; }
|
||||
|
||||
//! Returns map of entities.
|
||||
Standard_Boolean HasEntityWithPersistence() const { return myNbEntityWithPersistence > 0; }
|
||||
Standard_Boolean HasEntityWithPersistence() const { return myHasEntityWithPersistence; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -89,9 +89,9 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
|
||||
SelectMgr_MapOfOwners myOwnersMap; //!< Map of entity owners and its corresponding number of sensitives
|
||||
Standard_Integer myNbEntityWithPersistence; //!< number of sensitive entities that have own transform persistence
|
||||
SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
|
||||
SelectMgr_MapOfOwners myOwnersMap; //!< Map of entity owners and its corresponding number of sensitives
|
||||
Standard_Boolean myHasEntityWithPersistence; //!< flag if some of sensitive entity has own transform persistence
|
||||
};
|
||||
|
||||
#endif // _SelectMgr_SensitiveEntitySet_HeaderFile
|
||||
|
@@ -189,20 +189,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustum::ScaleAndTransform
|
||||
return aRes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CopyWithBuilder
|
||||
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
|
||||
// Returned frustum should be re-constructed before being used.
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustum::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
|
||||
{
|
||||
Handle(SelectMgr_TriangularFrustum) aRes = new SelectMgr_TriangularFrustum();
|
||||
aRes->mySelTriangle = mySelTriangle;
|
||||
aRes->SetBuilder (theBuilder);
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsBox
|
||||
// purpose : SAT intersection test between defined volume and
|
||||
|
@@ -55,13 +55,6 @@ public:
|
||||
const gp_GTrsf& theTrsf,
|
||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns a copy of the frustum using the given frustum builder configuration.
|
||||
//! Returned frustum should be re-constructed before being used.
|
||||
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
|
||||
//! should NOT be NULL.
|
||||
//! @return a copy of the frustum with the input builder assigned
|
||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
public: //! @name SAT Tests for different objects
|
||||
|
||||
//! SAT intersection test between defined volume and given axis-aligned box
|
||||
|
@@ -186,32 +186,6 @@ Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustumSet::ScaleAndTransf
|
||||
return aRes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CopyWithBuilder
|
||||
// purpose : Returns a copy of the frustum using the given frustum builder configuration.
|
||||
// Returned frustum should be re-constructed before being used.
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_BaseIntersector) SelectMgr_TriangularFrustumSet::CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||
"Error! SelectMgr_TriangularFrustumSet::CopyWithBuilder() should be called after selection frustum initialization");
|
||||
|
||||
Standard_ASSERT_RAISE (!theBuilder.IsNull(),
|
||||
"Error! SelectMgr_TriangularFrustumSet::CopyWithBuilder() should be called with valid builder");
|
||||
|
||||
Handle(SelectMgr_TriangularFrustumSet) aRes = new SelectMgr_TriangularFrustumSet();
|
||||
aRes->SetCamera (myCamera);
|
||||
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
aRes->myFrustums.Append (Handle(SelectMgr_TriangularFrustum)::DownCast (anIter.Value()->CopyWithBuilder (theBuilder)));
|
||||
}
|
||||
aRes->mySelectionType = mySelectionType;
|
||||
aRes->mySelPolyline = mySelPolyline;
|
||||
aRes->myToAllowOverlap = myToAllowOverlap;
|
||||
aRes->SetBuilder (theBuilder);
|
||||
return aRes;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OverlapsBox
|
||||
// purpose :
|
||||
|
@@ -62,13 +62,6 @@ public:
|
||||
const gp_GTrsf& theTrsf,
|
||||
const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns a copy of the frustum using the given frustum builder configuration.
|
||||
//! Returned frustum should be re-constructed before being used.
|
||||
//! @param theBuilder [in] argument that represents corresponding settings for re-constructing transformed frustum from scratch;
|
||||
//! should NOT be NULL.
|
||||
//! @return a copy of the frustum with the input builder assigned
|
||||
Standard_EXPORT virtual Handle(SelectMgr_BaseIntersector) CopyWithBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsBox (const SelectMgr_Vec3& theMinPnt,
|
||||
|
@@ -138,12 +138,12 @@ void SelectMgr_ViewerSelector::updatePoint3d (SelectMgr_SortCriterion& theCriter
|
||||
case SelectMgr_TypeOfDepthTolerance_UniformPixels:
|
||||
case SelectMgr_TypeOfDepthTolerance_SensitivityFactor:
|
||||
{
|
||||
if (theMgr.Camera().IsNull())
|
||||
if (mySelectingVolumeMgr.Camera().IsNull())
|
||||
{
|
||||
// fallback for an arbitrary projection matrix
|
||||
theCriterion.Tolerance = aSensFactor / 33.0;
|
||||
}
|
||||
else if (theMgr.Camera()->IsOrthographic())
|
||||
else if (mySelectingVolumeMgr.Camera()->IsOrthographic())
|
||||
{
|
||||
theCriterion.Tolerance = myCameraScale * aSensFactor;
|
||||
}
|
||||
@@ -634,9 +634,6 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
|
||||
|
||||
Graphic3d_Vec2i aWinSize;
|
||||
mySelectingVolumeMgr.WindowSize (aWinSize.x(), aWinSize.y());
|
||||
const double aPixelSize = aWinSize.x() > 0 && aWinSize.y() > 0
|
||||
? Max (1.0 / aWinSize.x(), 1.0 / aWinSize.y())
|
||||
: 1.0;
|
||||
|
||||
const Handle(Graphic3d_Camera)& aCamera = mySelectingVolumeMgr.Camera();
|
||||
Graphic3d_Mat4d aProjectionMat, aWorldViewMat;
|
||||
@@ -649,6 +646,11 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
|
||||
|
||||
myCameraEye = aCamera->Eye().XYZ();
|
||||
myCameraDir = aCamera->Direction().XYZ();
|
||||
myCameraScale = aCamera->IsOrthographic()
|
||||
? aCamera->Scale()
|
||||
: 2.0 * Tan (aCamera->FOVy() * M_PI / 360.0);
|
||||
const double aPixelSize = Max (1.0 / aWinSize.x(), 1.0 / aWinSize.y());
|
||||
myCameraScale *= aPixelSize;
|
||||
}
|
||||
mySelectableObjects.UpdateBVH (aCamera, aWinSize);
|
||||
|
||||
@@ -670,8 +672,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
|
||||
// for 2D space selection transform selecting volumes to perform overlap testing
|
||||
// directly in camera's eye space omitting the camera position, which is not
|
||||
// needed there at all
|
||||
if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent
|
||||
|| aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_ortho2dPersistent)
|
||||
if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent)
|
||||
{
|
||||
gp_GTrsf aTFrustum;
|
||||
aTFrustum.SetValue (1, 1, aWorldViewMat.GetValue (0, 0));
|
||||
@@ -687,46 +688,22 @@ void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theVie
|
||||
aWorldViewMat.GetValue (1, 3),
|
||||
aWorldViewMat.GetValue (2, 3)));
|
||||
|
||||
// define corresponding frustum builder parameters for 2d persistence.
|
||||
// define corresponding frustum builder parameters
|
||||
Handle(SelectMgr_FrustumBuilder) aBuilder = new SelectMgr_FrustumBuilder();
|
||||
Handle(Graphic3d_Camera) aNewCamera = new Graphic3d_Camera();
|
||||
aNewCamera->CopyMappingData (aCamera);
|
||||
aNewCamera->SetIdentityOrientation();
|
||||
if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_ortho2dPersistent)
|
||||
{
|
||||
aNewCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
|
||||
}
|
||||
aWorldViewMat = aNewCamera->OrientationMatrix(); // should be identity matrix
|
||||
aProjectionMat = aNewCamera->ProjectionMatrix(); // should be the same to aProjectionMat
|
||||
aBuilder->SetCamera (aNewCamera);
|
||||
aBuilder->SetWindowSize (aWinSize.x(), aWinSize.y());
|
||||
aMgr = mySelectingVolumeMgr.ScaleAndTransform (1, aTFrustum, aBuilder);
|
||||
}
|
||||
else if (aBVHSubset == SelectMgr_SelectableObjectSet::BVHSubset_ortho3dPersistent)
|
||||
{
|
||||
// define corresponding frustum builder parameters for 3d orthographic persistence.
|
||||
Handle(SelectMgr_FrustumBuilder) aBuilder = new SelectMgr_FrustumBuilder();
|
||||
Handle(Graphic3d_Camera) aNewCamera = new Graphic3d_Camera (*aCamera);
|
||||
aNewCamera->SetProjectionType (Graphic3d_Camera::Projection_Orthographic);
|
||||
aWorldViewMat = aNewCamera->OrientationMatrix(); // should be the same to aWorldViewMat
|
||||
aProjectionMat = aNewCamera->ProjectionMatrix(); // should be orthographic projection
|
||||
aBuilder->SetCamera (aNewCamera);
|
||||
aBuilder->SetWindowSize (aWinSize.x(), aWinSize.y());
|
||||
aMgr = mySelectingVolumeMgr.CopyWithBuilder (aBuilder);
|
||||
}
|
||||
else
|
||||
{
|
||||
aMgr = mySelectingVolumeMgr;
|
||||
}
|
||||
|
||||
if (!aMgr.Camera().IsNull())
|
||||
{
|
||||
myCameraScale = aMgr.Camera()->IsOrthographic()
|
||||
? aMgr.Camera()->Scale()
|
||||
: 2.0 * Tan (aMgr.Camera()->FOVy() * M_PI / 360.0);
|
||||
myCameraScale *= aPixelSize;
|
||||
}
|
||||
|
||||
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVHTree = mySelectableObjects.BVH (aBVHSubset);
|
||||
|
||||
Standard_Integer aNode = 0;
|
||||
|
@@ -328,7 +328,7 @@ protected:
|
||||
//! @param theObject [in] the selectable object for traversal.
|
||||
//! @param theMgr [in] the (un)transformed copy of the selecting volume manager representing active selection frustum.
|
||||
//! @param theCamera, theProjectionMat, theWorldViewMat [in] the source camera and matrices for theMgr given.
|
||||
//! @param theWinSize [in] viewport (window) dimensions for evaluating
|
||||
//! @param theViewportWidth, theViewportHeight [in] viewport (window) dimensions for evaluating
|
||||
//! object's transformation persistence.
|
||||
Standard_EXPORT void traverseObject (const Handle(SelectMgr_SelectableObject)& theObject,
|
||||
const SelectMgr_SelectingVolumeManager& theMgr,
|
||||
|
@@ -35,19 +35,19 @@
|
||||
// Primary definitions
|
||||
#define OCC_VERSION_MAJOR 7
|
||||
#define OCC_VERSION_MINOR 8
|
||||
#define OCC_VERSION_MAINTENANCE 1
|
||||
#define OCC_VERSION_MAINTENANCE 0
|
||||
|
||||
//! This macro must be commented in official release, and set to non-empty
|
||||
//! string in other situations, to identify specifics of the version, e.g.:
|
||||
//! - "dev" for development version between releases
|
||||
//! - "beta..." or "rc..." for beta releases or release candidates
|
||||
//! - "project..." for version containing project-specific fixes
|
||||
#define OCC_VERSION_DEVELOPMENT "dev"
|
||||
//#define OCC_VERSION_DEVELOPMENT "dev"
|
||||
|
||||
// Derived (manually): version as real and string (major.minor)
|
||||
#define OCC_VERSION 7.8
|
||||
#define OCC_VERSION_STRING "7.8"
|
||||
#define OCC_VERSION_COMPLETE "7.8.1"
|
||||
#define OCC_VERSION_COMPLETE "7.8.0"
|
||||
|
||||
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
||||
#ifdef OCC_VERSION_DEVELOPMENT
|
||||
|
@@ -1585,9 +1585,10 @@ Handle(Standard_Type)& atype) const
|
||||
Standard_CString StepAP214_Protocol::SchemaName(const Handle(Interface_InterfaceModel)& theModel) const
|
||||
{
|
||||
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theModel);
|
||||
if (aModel.IsNull())
|
||||
StepData_ConfParameters aParam;
|
||||
if (!aModel.IsNull())
|
||||
{
|
||||
return "";
|
||||
aParam = aModel->InternalParameters;
|
||||
}
|
||||
switch (aModel->InternalParameters.WriteSchema)
|
||||
{
|
||||
|
@@ -69,6 +69,12 @@ public:
|
||||
//! was C++ : return const
|
||||
Standard_EXPORT virtual Standard_CString SchemaName(const Handle(Interface_InterfaceModel)& theModel) const;
|
||||
|
||||
//! Returns the Schema Name attached to each class of Protocol
|
||||
//! To be redefined by each sub-class
|
||||
//! Here, SchemaName returns "(DEFAULT)"
|
||||
//! was C++ : return const
|
||||
Standard_DEPRECATED("USED old static interface to extract active schema.\n"\
|
||||
"Recommended to use method with input model to extract from current session")
|
||||
Standard_EXPORT virtual Standard_CString SchemaName() const;
|
||||
|
||||
//! Creates an empty Model for Step Norm
|
||||
|
@@ -545,10 +545,7 @@ void StepToTopoDS_TranslateFace::Init(const Handle(StepShape_FaceSurface)& FS,
|
||||
#endif
|
||||
FaceBound = FS->BoundsValue(i);
|
||||
Loop = FaceBound->Bound();
|
||||
if (Loop.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// The Loop is a VertexLoop
|
||||
// ------------------------
|
||||
|
@@ -5100,24 +5100,6 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
aTrsfPers = new Graphic3d_TransformPers (aTrsfPers->Mode(), Aspect_TypeOfTriedronPosition (aCorner), Graphic3d_Vec2i (aZ.IntegerValue()));
|
||||
}
|
||||
}
|
||||
else if (aNameCase == "-trsfPersOrtho")
|
||||
{
|
||||
if (aTrsfPers.IsNull())
|
||||
{
|
||||
Message::SendFail() << "Error: wrong syntax at " << aName << ".";
|
||||
return 1;
|
||||
}
|
||||
|
||||
toSetTrsfPers = Standard_True;
|
||||
if (aTrsfPers->IsZoomOrRotate())
|
||||
{
|
||||
aTrsfPers = new Graphic3d_TransformPers (aTrsfPers->Mode() | Graphic3d_TMF_OrthoPers, aTrsfPers->AnchorPoint());
|
||||
}
|
||||
else if (aTrsfPers->IsTrihedronOr2d())
|
||||
{
|
||||
aTrsfPers = new Graphic3d_TransformPers (aTrsfPers->Mode() | Graphic3d_TMF_OrthoPers, aTrsfPers->Corner2d(), aTrsfPers->Offset2d());
|
||||
}
|
||||
}
|
||||
else if (aNameCase == "-layer"
|
||||
|| aNameCase == "-zlayer")
|
||||
{
|
||||
@@ -6648,45 +6630,42 @@ If last 3 optional parameters are not set prints numbers of U-, V- isolines and
|
||||
|
||||
addCmd ("vdisplay", VDisplay2, /* [vdisplay] */ R"(
|
||||
vdisplay [-noupdate|-update] [-mutable] [-neutral]
|
||||
[-trsfPers {zoom|rotate|zoomRotate|trihedron|none}=none]
|
||||
[-trsfPers {zoom|rotate|zoomRotate|none}=none]
|
||||
[-trsfPersPos X Y [Z]] [-3d]
|
||||
[-2d|-trihedron [{top|bottom|left|right|topLeft
|
||||
|topRight|bottomLeft|bottomRight}
|
||||
[offsetX offsetY]]]
|
||||
[-trsfPersOrtho]
|
||||
[-dispMode mode] [-highMode mode]
|
||||
[-layer index] [-top|-topmost|-overlay|-underlay]
|
||||
[-redisplay] [-erased]
|
||||
[-noecho] [-autoTriangulation {0|1}]
|
||||
name1 [name2] ... [name n]
|
||||
Displays named objects.
|
||||
-noupdate Suppresses viewer redraw call.
|
||||
-mutable Enables optimizations for mutable objects.
|
||||
-neutral Draws objects in main viewer.
|
||||
-erased Loads the object into context, but does not display it.
|
||||
-layer Sets z-layer for objects.
|
||||
Alternatively -overlay|-underlay|-top|-topmost
|
||||
options can be used for the default z-layers.
|
||||
-top Draws object on top of main presentations
|
||||
but below topmost.
|
||||
-topmost Draws in overlay for 3D presentations.
|
||||
with independent Depth.
|
||||
-overlay Draws objects in overlay for 2D presentations.
|
||||
(On-Screen-Display)
|
||||
-underlay Draws objects in underlay for 2D presentations.
|
||||
(On-Screen-Display)
|
||||
-noupdate Suppresses viewer redraw call.
|
||||
-mutable Enables optimizations for mutable objects.
|
||||
-neutral Draws objects in main viewer.
|
||||
-erased Loads the object into context, but does not display it.
|
||||
-layer Sets z-layer for objects.
|
||||
Alternatively -overlay|-underlay|-top|-topmost
|
||||
options can be used for the default z-layers.
|
||||
-top Draws object on top of main presentations
|
||||
but below topmost.
|
||||
-topmost Draws in overlay for 3D presentations.
|
||||
with independent Depth.
|
||||
-overlay Draws objects in overlay for 2D presentations.
|
||||
(On-Screen-Display)
|
||||
-underlay Draws objects in underlay for 2D presentations.
|
||||
(On-Screen-Display)
|
||||
-selectable|-noselect Controls selection of objects.
|
||||
-trsfPers Sets a transform persistence flags.
|
||||
-trsfPersPos Sets an anchor point for transform persistence.
|
||||
-2d Displays object in screen coordinates.
|
||||
(DY looks up)
|
||||
-trsfPersOrtho Set orthographic transform persistence.
|
||||
(Objects shown with orthographic projection)
|
||||
-dispmode Sets display mode for objects.
|
||||
-highmode Sets hilight mode for objects.
|
||||
-redisplay Recomputes presentation of objects.
|
||||
-noecho Avoid printing of command results.
|
||||
-autoTriang Enable/disable auto-triangulation for displayed shape.
|
||||
-trsfPers Sets a transform persistence flags.
|
||||
-trsfPersPos Sets an anchor point for transform persistence.
|
||||
-2d Displays object in screen coordinates.
|
||||
(DY looks up)
|
||||
-dispmode Sets display mode for objects.
|
||||
-highmode Sets hilight mode for objects.
|
||||
-redisplay Recomputes presentation of objects.
|
||||
-noecho Avoid printing of command results.
|
||||
-autoTriang Enable/disable auto-triangulation for displayed shape.
|
||||
)" /* [vdisplay] */);
|
||||
|
||||
addCmd ("vnbdisplayed", VNbDisplayed, /* [vnbdisplayed] */ R"(
|
||||
|
@@ -176,12 +176,11 @@ namespace
|
||||
GetDisplayConnection() = theDisplayConnection;
|
||||
}
|
||||
|
||||
static ViewerTest_ViewerCommandsViewMap ViewerTest_myViews;
|
||||
static ViewerTest_ViewerCommandsInteractiveContextMap ViewerTest_myContexts;
|
||||
static ViewerTest_ViewerCommandsGraphicDriverMap ViewerTest_myDrivers;
|
||||
}
|
||||
|
||||
ViewerTest_ViewerCommandsViewMap ViewerTest_myViews;
|
||||
|
||||
static struct
|
||||
{
|
||||
Quantity_Color FlatColor;
|
||||
@@ -13686,12 +13685,6 @@ static int VViewCube (Draw_Interpretor& ,
|
||||
{
|
||||
aViewCube->SetAxesSphereRadius (Draw::Atof (theArgVec[++anArgIter]));
|
||||
}
|
||||
else if (anArg == "-orthopers")
|
||||
{
|
||||
const Handle(Graphic3d_TransformPers)& aTrsfPers = aViewCube->TransformPersistence();
|
||||
Handle(Graphic3d_TransformPers) anOrthoPers = new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_OrthoPers, aTrsfPers->Corner2d(), aTrsfPers->Offset2d());
|
||||
aViewCube->SetTransformPersistence (anOrthoPers);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
|
||||
@@ -14989,7 +14982,6 @@ Displays interactive view manipulation object. Options:
|
||||
-axesSphereRadius Value radius of the sphere (central point) of trihedron
|
||||
-fixedAnimation {0|1} uninterruptible animation loop
|
||||
-duration Seconds animation duration in seconds
|
||||
-orthoPers force orthographic projection persistence.
|
||||
)" /* [vviewcube] */);
|
||||
|
||||
addCmd ("vcolorconvert", VColorConvert, /* [vcolorconvert] */ R"(
|
||||
|
@@ -399,7 +399,7 @@ TopoDS_Shape XSControl_TransferReader::ShapeResult
|
||||
TopoDS_Shape sh = xu.BinderShape (mres->Binder());
|
||||
|
||||
// Ouh la vilaine verrue
|
||||
Standard_Real tolang = EncodeRegAngle();
|
||||
Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
|
||||
if (tolang <= 0 || sh.IsNull()) return sh;
|
||||
ShapeFix::EncodeRegularity (sh,tolang);
|
||||
return sh;
|
||||
|
@@ -65,7 +65,6 @@ class XSControl_TransferReader : public Standard_Transient
|
||||
|
||||
//! Creates a TransferReader, empty
|
||||
XSControl_TransferReader()
|
||||
: myEncodeRegAngle(0.01)
|
||||
{}
|
||||
|
||||
//! Sets a Controller. It is required to generate the Actor.
|
||||
@@ -114,14 +113,6 @@ class XSControl_TransferReader : public Standard_Transient
|
||||
//! Returns actual value of file name
|
||||
Standard_CString FileName() const
|
||||
{ return myFileName.ToCString(); }
|
||||
|
||||
//! Sets value for EncodeRegularityAngle
|
||||
void SetEncodeRegAngle(const Standard_Real theEncRegAngle)
|
||||
{ myEncodeRegAngle = theEncRegAngle; }
|
||||
|
||||
//! Returns value of EncodeRegularityAngle
|
||||
Standard_Real EncodeRegAngle() const
|
||||
{ return myEncodeRegAngle; }
|
||||
|
||||
//! Clears data, according mode :
|
||||
//! -1 all
|
||||
@@ -368,7 +359,6 @@ class XSControl_TransferReader : public Standard_Transient
|
||||
Handle(Transfer_TransientProcess) myTP;
|
||||
TColStd_DataMapOfIntegerTransient myResults;
|
||||
Handle(TopTools_HSequenceOfShape) myShapeResult;
|
||||
Standard_Real myEncodeRegAngle;
|
||||
};
|
||||
|
||||
#endif // _XSControl_TransferReader_HeaderFile
|
||||
|
@@ -141,7 +141,7 @@ IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape
|
||||
if (theModel.IsNull()) return IFSelect_RetVoid;
|
||||
|
||||
TopoDS_Shape aShape = theShape;
|
||||
Standard_Boolean isNMMode = NonmanifoldMode() != 0;
|
||||
Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
|
||||
if (isNMMode)
|
||||
{
|
||||
ShapeUpgrade_RemoveLocations aRemLoc;
|
||||
|
@@ -46,8 +46,7 @@ class XSControl_TransferWriter : public Standard_Transient
|
||||
//! with an empty FinderProcess (but no controller, etc)
|
||||
XSControl_TransferWriter()
|
||||
: myTransferWriter(new Transfer_FinderProcess),
|
||||
myTransferMode(0),
|
||||
myNonmanifoldMode(0)
|
||||
myTransferMode(0)
|
||||
{}
|
||||
|
||||
//! Returns the FinderProcess itself
|
||||
@@ -85,14 +84,6 @@ class XSControl_TransferWriter : public Standard_Transient
|
||||
void SetTransferMode (const Standard_Integer theMode)
|
||||
{ myTransferMode = theMode; }
|
||||
|
||||
//! Returns Nonmanifold Mode
|
||||
Standard_Integer NonmanifoldMode() const
|
||||
{ return myNonmanifoldMode; }
|
||||
|
||||
//! Changes Nonmanifold Mode
|
||||
void SetNonmanifoldMode (const Standard_Integer theNonmMode)
|
||||
{ myNonmanifoldMode = theNonmMode; }
|
||||
|
||||
//! Prints statistics on current Trace File, according what,mode
|
||||
//! See PrintStatsProcess for details
|
||||
Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const;
|
||||
@@ -143,7 +134,6 @@ class XSControl_TransferWriter : public Standard_Transient
|
||||
Handle(XSControl_Controller) myController;
|
||||
Handle(Transfer_FinderProcess) myTransferWriter;
|
||||
Standard_Integer myTransferMode;
|
||||
Standard_Integer myNonmanifoldMode;
|
||||
};
|
||||
|
||||
#endif // _XSControl_TransferWriter_HeaderFile
|
||||
|
@@ -19,14 +19,14 @@ checkprops result -s 8206.54
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 5
|
||||
EDGE : 8
|
||||
EDGE : 9
|
||||
WIRE : 4
|
||||
FACE : 4
|
||||
SHELL : 1
|
||||
SOLID : 1
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 24
|
||||
SHAPE : 25
|
||||
"
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations common"
|
||||
|
||||
|
@@ -19,14 +19,14 @@ checkprops result -s 34566
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 13
|
||||
EDGE : 20
|
||||
EDGE : 21
|
||||
WIRE : 8
|
||||
FACE : 8
|
||||
SHELL : 1
|
||||
SOLID : 1
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 52
|
||||
SHAPE : 53
|
||||
"
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations cut"
|
||||
|
||||
|
@@ -1,29 +0,0 @@
|
||||
puts "======================================================="
|
||||
puts " 0032291: General Fuse produces wrong number of solids"
|
||||
puts "======================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32291.brep] s
|
||||
|
||||
explode s
|
||||
baddobjects s_1
|
||||
baddtools s_2 s_3 s_4 s_5 s_6 s_7 s_8
|
||||
bfillds
|
||||
bbuild result
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -vertex 79 -edge 176 -wire 112 -face 112 -shell 18 -solid 18
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 7.e-5} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
axo
|
||||
clear
|
||||
explode result So
|
||||
fit
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
@@ -1,11 +0,0 @@
|
||||
puts "==========================================================="
|
||||
puts "0033567: Modeling Data - GeomLib_IsPlanarSurface raises SIGFPE in Release mode"
|
||||
puts "==========================================================="
|
||||
|
||||
puts "REQUIRED All: Conversion failed"
|
||||
|
||||
pload MODELING
|
||||
|
||||
restore [locate_data_file bug33567.brep] a
|
||||
mksurface s a
|
||||
tocanon r s 0.0005
|
@@ -1,3 +1,5 @@
|
||||
puts "TODO OCC25188 ALL: Error: File "
|
||||
|
||||
puts "========"
|
||||
puts "OCC25168"
|
||||
puts "========"
|
||||
|
@@ -1,13 +0,0 @@
|
||||
puts "================"
|
||||
puts "0033569: Data Exchange, STEP - Crash when reading multi-body file"
|
||||
puts "================"
|
||||
|
||||
ReadStep D [locate_data_file bug33569.stp]
|
||||
|
||||
set result [XDumpNbDGTs D]
|
||||
|
||||
regexp {NbOfAttachedDatum +: +([0-9]+)} $result full nb
|
||||
|
||||
if { $nb != 26} {
|
||||
puts "Error: Number of Datums incorrect"
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
puts "=================================="
|
||||
puts "0028954: Visualization - compare AIS_ViewCube on perspective view with and without orthographic persistence"
|
||||
puts "=================================="
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vinit View1
|
||||
vcamera -persp
|
||||
|
||||
box b 15 20 70
|
||||
vdisplay -dispMode 1 b
|
||||
vaxo
|
||||
vfit
|
||||
vviewcube vc -fixedAnimation 1 -duration 0 -orthoPers
|
||||
|
||||
vmoveto 70 350
|
||||
if {[vreadpixel 95 350 name rgb] != "GRAY62"} { puts "Error: Highlighting of view cube Side is wrong." }
|
||||
vmoveto 0 0
|
||||
vdump $imagedir/${casename}_axo.png
|
||||
|
||||
# check FRONT side
|
||||
vselect 70 340
|
||||
if {[vreadpixel 255 300 name rgb] != "BLACK"} { puts "Error: Position of FRONT camera is wrong." }
|
||||
vdump $imagedir/${casename}_side.png
|
||||
|
||||
# check FRONT/TOP edge
|
||||
vselect 110 270
|
||||
if {[vreadpixel 100 320 name rgb] != "GRAY57"} { puts "Error: Position of FRONT-TOP camera is wrong." }
|
||||
if {[vreadpixel 100 310 name rgb] != "CYAN"} { puts "Error: Position of FRONT-TOP camera is wrong." }
|
||||
vdump $imagedir/${casename}_edge.png
|
||||
|
||||
# Check vertex
|
||||
vselect 140 310
|
||||
if {[vreadpixel 100 290 name rgb] != "GRAY41"} { puts "Error: Position of TOP-FRONT-RIGHT camera is wrong." }
|
||||
if {[vreadpixel 100 310 name rgb] != "CYAN"} { puts "Error: Position of TOP-FRONT-RIGHT camera is wrong." }
|
||||
if {[vreadpixel 100 320 name rgb] != "GRAY62"} { puts "Error: Position of TOP-FRONT-RIGHT camera is wrong." }
|
||||
vdump $imagedir/${casename}_corner.png
|
Reference in New Issue
Block a user