1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

..

2 Commits

342 changed files with 9097 additions and 8600 deletions

View File

@@ -1091,7 +1091,7 @@ The following environment variables have become redundant:
* *CSF_UnitsLexicon* and *CSF_UnitsDefinition* are no more used. Units definition (*UnitsAPI/Lexi_Expr.dat* and *UnitsAPI/Units.dat*) is now embedded into source code.
* *CSF_XSMessage* and *CSF_XHMessage* are now optional.
English messages (XSMessage/\*XSTEP.us* and SHMessage/\*SHAPE.us*) are now embedded into source code
English messages (XSMessage/*XSTEP.us* and SHMessage/*SHAPE.us*) are now embedded into source code
and automatically loaded when environment variables are not set.
* *CSF_ShadersDirectory* is not required any more, though it still can be used to load custom shaders.
Mandatory GLSL resources are now embedded into source code.
@@ -1678,47 +1678,3 @@ Standard_Boolean meshing_new()
Some public methods of the class BRepFilletAPI_MakeChamfer are released from excess arguments:
- method Add for symmetric chamfer now takes only 2 arguments: distance and edge;
- method GetDistAngle now takes only 3 arguments: index of contour, distance and angle.
@subsection upgrade_740_aspects Aspects unification
Fill Area, Line and Marker aspects (classes *Graphic3d_AspectFillArea3d*, *Graphic3d_AspectLine3d*, *Graphic3d_AspectMarker3d* and *Graphic3d_AspectText3d*)
have been merged into new class *Graphic3d_Aspects* providing a single state for rendering primitives of any type.
The old per-primitive type aspect classes have been preserved as sub-classes of *Graphic3d_Aspects* with default values close to the previous behavior.
All aspects except Graphic3d_AspectFillArea3d define Graphic3d_TOSM_UNLIT shading model.
The previous approach with dedicated aspects per primitive type was handy in simplified case, but lead to confusion otherwise.
In fact, drawing points or lines with lighting applied is a valid use case, but only *Graphic3d_AspectFillArea3d* previously defined necessary material properties.
As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties.
Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated.
For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property:
~~~~
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect
Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
aGroup->AddPrimitiveArray (aLines); //!< both arrays will use the same aspect
aGroup->AddPrimitiveArray (aTris);
~~~~
To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order:
~~~~
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
aGroup->AddPrimitiveArray (aTris);
Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array will use the new aspect
aGroup->AddPrimitiveArray (aLines);
~~~~
@subsection upgrade_740_interiorstyles Interior styles
* *Aspect_IS_HOLLOW* is now an alias to *Aspect_IS_EMPTY* and does not implicitly enables drawing mesh edges anymore.
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_EMPTY) to get previous behavior of Aspect_IS_HOLLOW style.
* *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.

View File

@@ -23,7 +23,7 @@ WARNINGS = NO
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = Standard_EXPORT Standard_NODISCARD Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle<a> DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC
PREDEFINED = Standard_EXPORT Standard_OVERRIDE:=override __Standard_API __Draw_API Handle(a):=Handle<a> DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC
GENERATE_HTML = YES
GENERATE_LATEX = NO
SEARCH_INCLUDES = YES

View File

@@ -1793,11 +1793,12 @@ Create facet attributes.
Handle(Graphic3d_AspectFillArea3d) aFaceAspect = new Graphic3d_AspectFillArea3d();
Graphic3d_MaterialAspect aBrassMaterial (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NOM_GOLD);
aFaceAspect->SetInteriorStyle (Aspect_IS_SOLID_WIREFRAME);
aFaceAspect->SetInteriorStyle (Aspect_IS_SOLID);
aFaceAspect->SetInteriorColor (aMyColor);
aFaceAspect->SetDistinguishOn ();
aFaceAspect->SetFrontMaterial (aGoldMaterial);
aFaceAspect->SetBackMaterial (aBrassMaterial);
aFaceAspect->SetEdgeOn();
~~~~~
Create text attributes.

View File

@@ -14,9 +14,9 @@ Requirements for building sample:
* Android NDK r9d or newer
* Apache Ant 1.9.4 or higher
* OCCT compiled under Android platform and placed in directories:
* occt/libs/armeabi-v7a/\*.so and occt/inc/\*.hxx (libraries and include files of OCCT install)
* android/assets/opencascade/shared/Shaders/\* (Shaders folder of OCCT install: /share/opencascade/resources/Shaders)
* 3rdparty/include/freetype2/\*, 3rdparty/include/FreeImage.h and 3rdparty/libs/armeabi-v7a/libFreeImage.so and 3rdparty/libs/armeabi-v7a/libfreetype.so
* occt/libs/armeabi-v7a/*.so and occt/inc/*.hxx (libraries and include files of OCCT install)
* android/assets/opencascade/shared/Shaders/* (Shaders folder of OCCT install: /share/opencascade/resources/Shaders)
* 3rdparty/include/freetype2/*, 3rdparty/include/FreeImage.h and 3rdparty/libs/armeabi-v7a/libFreeImage.so and 3rdparty/libs/armeabi-v7a/libfreetype.so
It is also possible to to correct OCCT.pri file an get resources from another tree of directories.

View File

@@ -277,6 +277,7 @@ blend result _model 2 _model_161
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vsetcolorbg 200 200 255
vdisplay -dispMode 1 result
vdisplay result
vfit
vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2
vsetdispmode 1
vshowfaceboundary result 1

View File

@@ -263,6 +263,7 @@ unifysamedom result p_1
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vsetcolorbg 200 200 255
vdisplay -dispMode 1 result
vdisplay result
vfit
vaspects result -setFaceBoundaryDraw 1
vsetdispmode 1
vshowfaceboundary result 1

View File

@@ -57,7 +57,9 @@ bcommon res b9 c2
# show result
donly res
trotate res 0 0 0 0 0 1 90
vinit View1
vdisplay -dispMode 1 res
vaspects res -setFaceBoundaryDraw 1 -setFaceBoundaryColor WHITE -isoontriangulation 1
vinit
vdisplay res
vsetdispmode 1
vshowfaceboundary res 1 255 255 255
vaspects -isoontriangulation 1
vfit

View File

@@ -236,18 +236,17 @@ void AIS_CameraFrustum::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
return;
}
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
switch (theMode)
{
case AIS_Shaded:
{
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (myTriangles);
}
Standard_FALLTHROUGH
case AIS_WireFrame:
{
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
aGroup->AddPrimitiveArray (myBorders);
break;

View File

@@ -107,10 +107,6 @@ AIS_ColorScale::AIS_ColorScale()
myTextHeight (20)
{
SetDisplayMode (0);
myDrawer->SetupOwnShadingAspect();
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (Quantity_NOC_WHITE);
}
//=======================================================================
@@ -462,6 +458,15 @@ void AIS_ColorScale::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Standard_Integer aBarTop = myYPos + myHeight - aTitleOffset - aBarYOffset;
const Standard_Integer aBarHeight = aBarTop - aBarBottom;
// draw title
if (!myTitle.IsEmpty())
{
drawText (Prs3d_Root::CurrentGroup (thePrs), myTitle,
myXPos + mySpacing,
aBarTop + aBarYOffset,
Graphic3d_VTA_BOTTOM);
}
TColStd_SequenceOfExtendedString aLabels;
if (myLabelType == Aspect_TOCSD_USER)
{
@@ -491,27 +496,11 @@ void AIS_ColorScale::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
aColorBreadth += aTextWidth;
}
// draw title
Handle(Graphic3d_Group) aLabelsGroup;
if (!myTitle.IsEmpty()
|| !aLabels.IsEmpty())
{
aLabelsGroup = thePrs->NewGroup();
aLabelsGroup->SetGroupPrimitivesAspect (myDrawer->TextAspect()->Aspect());
}
if (!myTitle.IsEmpty())
{
drawText (aLabelsGroup, myTitle,
myXPos + mySpacing,
aBarTop + aBarYOffset,
Graphic3d_VTA_BOTTOM);
}
// draw colors
drawColorBar (thePrs, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
// draw Labels
drawLabels (aLabelsGroup, aLabels, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
drawLabels (thePrs, aLabels, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
}
//=======================================================================
@@ -638,8 +627,7 @@ void AIS_ColorScale::drawColorBar (const Handle(Prs3d_Presentation)& thePrs,
}
}
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
aGroup->AddPrimitiveArray (aTriangles);
const Quantity_Color aFgColor (hasOwnColor ? myDrawer->Color() : Quantity_NOC_WHITE);
@@ -654,7 +642,7 @@ void AIS_ColorScale::drawColorBar (const Handle(Prs3d_Presentation)& thePrs,
//function : drawLabels
//purpose :
//=======================================================================
void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
void AIS_ColorScale::drawLabels (const Handle(Prs3d_Presentation)& thePrs,
const TColStd_SequenceOfExtendedString& theLabels,
const Standard_Integer theBarBottom,
const Standard_Integer theBarHeight,
@@ -728,14 +716,14 @@ void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
Standard_Integer aPos2 = aNbLabels - 1 - i2;
if (aFilter && !(aPos1 % aFilter))
{
drawText (theGroup, theLabels.Value (i1 + 1),
drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i1 + 1),
anXLeft, anYBottom + Standard_Integer(i1 * aStepY + anAscent),
Graphic3d_VTA_CENTER);
aLast1 = i1;
}
if (aFilter && !(aPos2 % aFilter))
{
drawText (theGroup, theLabels.Value (i2 + 1),
drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i2 + 1),
anXLeft, anYBottom + Standard_Integer(i2 * aStepY + anAscent),
Graphic3d_VTA_CENTER);
aLast2 = i2;
@@ -758,7 +746,7 @@ void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
if (i0 != -1)
{
drawText (theGroup, theLabels.Value (i0 + 1),
drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i0 + 1),
anXLeft, anYBottom + Standard_Integer(i0 * aStepY + anAscent),
Graphic3d_VTA_CENTER);
}
@@ -781,8 +769,8 @@ void AIS_ColorScale::drawFrame (const Handle(Prs3d_Presentation)& thePrs,
aPrim->AddVertex (theX, theY, 0.0);
Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d (theColor, Aspect_TOL_SOLID, 1.0);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (anAspect);
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
aGroup->SetPrimitivesAspect (anAspect);
aGroup->AddPrimitiveArray (aPrim);
}
@@ -796,6 +784,7 @@ void AIS_ColorScale::drawText (const Handle(Graphic3d_Group)& theGroup,
const Graphic3d_VerticalTextAlignment theVertAlignment)
{
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
theGroup->SetPrimitivesAspect (anAspect->Aspect());
theGroup->Text (theText,
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
anAspect->Height(),

View File

@@ -406,7 +406,7 @@ private:
Standard_Integer computeMaxLabelWidth (const TColStd_SequenceOfExtendedString& theLabels) const;
//! Draw labels.
void drawLabels (const Handle(Graphic3d_Group)& theGroup,
void drawLabels (const Handle(Prs3d_Presentation)& thePrs,
const TColStd_SequenceOfExtendedString& theLabels,
const Standard_Integer theBarBottom,
const Standard_Integer theBarHeight,

View File

@@ -232,6 +232,11 @@ void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
{
setColor (myDrawer, theColor);
myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
@@ -257,7 +262,6 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
aDrawer->FaceBoundaryAspect()->SetColor (theColor);
}
}
AIS_Shape::SetColor (theColor);
}
//=======================================================================
@@ -267,6 +271,10 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
{
setWidth (myDrawer, theLineWidth);
myOwnWidth = theLineWidth;
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
@@ -288,16 +296,6 @@ void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
aDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
}
}
AIS_Shape::SetWidth (theLineWidth);
}
//=======================================================================
//function : UnsetWidth
//purpose :
//=======================================================================
void AIS_ColoredShape::UnsetWidth()
{
SetWidth (1.0f);
}
//=======================================================================
@@ -307,6 +305,10 @@ void AIS_ColoredShape::UnsetWidth()
void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
{
setTransparency (myDrawer, theValue);
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
@@ -320,7 +322,6 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
}
}
AIS_Shape::SetTransparency (theValue);
}
//=======================================================================
@@ -329,7 +330,27 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
//=======================================================================
void AIS_ColoredShape::UnsetTransparency()
{
SetTransparency (0.0f);
myDrawer->SetTransparency (0.0f);
if (myDrawer->HasOwnShadingAspect())
{
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
if (!HasColor()
&& !HasMaterial()
&& !myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
{
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
}
}
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(Prs3d_Drawer)& aDrawer = anIter.Value();
if (aDrawer->HasOwnShadingAspect())
{
aDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
}
}
SynchronizeAspects();
}
//=======================================================================
@@ -339,6 +360,10 @@ void AIS_ColoredShape::UnsetTransparency()
void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
{
setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
//myOwnMaterial = theMaterial;
hasOwnMaterial = Standard_True;
LoadRecomputable (AIS_Shaded);
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
@@ -348,7 +373,6 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
}
}
AIS_Shape::SetMaterial (theMaterial);
}
//=======================================================================
@@ -586,7 +610,7 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
const DataMapOfDrawerCompd& theDrawerClosedFaces,
const Standard_Integer theMode)
{
Handle(Graphic3d_Group) anOpenGroup, aClosedGroup, anEdgesGroup;
Handle(Graphic3d_Group) anOpenGroup, aClosedGroup;
for (size_t aShType = 0; aShType <= (size_t )TopAbs_SHAPE; ++aShType)
{
const Standard_Boolean isClosed = aShType == TopAbs_SHAPE;
@@ -640,7 +664,7 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
{
if (aShadedGroup.IsNull())
{
aShadedGroup = thePrs->NewGroup();
aShadedGroup = Prs3d_Root::NewGroup (thePrs);
aShadedGroup->SetClosed (isClosed);
}
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
@@ -649,15 +673,18 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
if (aDrawer->FaceBoundaryDraw())
{
if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw, aDrawer->FaceBoundaryUpperContinuity()))
Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw);
if (!aBndSegments.IsNull())
{
if (anEdgesGroup.IsNull())
if (aShadedGroup.IsNull())
{
anEdgesGroup = thePrs->NewGroup();
aShadedGroup = Prs3d_Root::NewGroup (thePrs);
aShadedGroup->SetClosed (isClosed);
}
anEdgesGroup->SetPrimitivesAspect (aDrawer->FaceBoundaryAspect()->Aspect());
anEdgesGroup->AddPrimitiveArray (aBndSegments);
Handle(Graphic3d_AspectLine3d) aBoundaryAspect = aDrawer->FaceBoundaryAspect()->Aspect();
aShadedGroup->SetPrimitivesAspect (aBoundaryAspect);
aShadedGroup->AddPrimitiveArray (aBndSegments);
}
}
}

View File

@@ -81,16 +81,11 @@ public: //! @name global aspects
//! Sets transparency value.
Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE;
//! Sets the material aspect.
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
public:
//! Removes the setting for transparency in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
//! Setup line width of entire shape.
Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE;
//! Sets the material aspect.
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
protected: //! @name override presentation computation

View File

@@ -431,7 +431,6 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
const TCollection_ExtendedString& theText,
const Standard_Integer theLabelPosition)
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
if (myDrawer->DimensionAspect()->IsText3d())
{
// getting font parameters
@@ -518,7 +517,7 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
aCenterOfLabel.Transform (aTextPlaneTrsf);
gp_Ax2 aFlippingAxes (aCenterOfLabel, GetPlane().Axis().Direction(), aTextDir);
aGroup->SetFlippingOptions (Standard_True, aFlippingAxes);
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_True, aFlippingAxes);
// draw text
if (myDrawer->DimensionAspect()->IsTextShaded())
@@ -547,14 +546,11 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
{
myDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (aColor, Aspect_TOL_SOLID, 1.0));
}
myDrawer->FreeBoundaryAspect()->Aspect()->SetColor (aColor);
// drawing text
if (Handle(Graphic3d_ArrayOfPrimitives) anEdges = StdPrs_WFShape::AddAllEdges (aTextShape, myDrawer))
{
aGroup->SetGroupPrimitivesAspect (myDrawer->FreeBoundaryAspect()->Aspect());
aGroup->AddPrimitiveArray (anEdges);
}
StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer);
}
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_False, gp_Ax2());
@@ -569,7 +565,7 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
// generate primitives for 2D text
myDrawer->DimensionAspect()->TextAspect()->Aspect()->SetDisplayType (Aspect_TODT_DIMENSION);
Prs3d_Text::Draw (aGroup,
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePresentation),
myDrawer->DimensionAspect()->TextAspect(),
theText,
theTextPos);
@@ -603,7 +599,6 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
gp_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine);
gp_Dir aTextDir = theExtensionDir;
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
drawText (thePresentation,
aTextPos,
aTextDir,
@@ -635,17 +630,16 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
aSensitiveCurve.Append (anExtStart);
aSensitiveCurve.Append (anExtEnd);
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
{
aGroup->SetStencilTestOptions (Standard_True);
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
}
Handle(Graphic3d_AspectLine3d) aDimensionLineStyle = myDrawer->DimensionAspect()->LineAspect()->Aspect();
aGroup->SetPrimitivesAspect (aDimensionLineStyle);
aGroup->AddPrimitiveArray (anExtPrimitive);
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionLineStyle);
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (anExtPrimitive);
if (!myDrawer->DimensionAspect()->IsText3d() && theMode == ComputeMode_All)
{
aGroup->SetStencilTestOptions (Standard_False);
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
}
}
@@ -739,6 +733,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
case LabelPosition_HCenter:
{
// add label on dimension or extension line to presentation
Prs3d_Root::NewGroup (thePresentation);
gp_Pnt aTextPos = IsTextPositionCustom() ? myFixedTextPosition
: (aCenterLineBegin.XYZ() + aCenterLineEnd.XYZ()) * 0.5;
gp_Dir aTextDir = aDimensionLine.Direction();
@@ -746,7 +742,6 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
// add text primitives
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
{
thePresentation->NewGroup();
drawText (thePresentation,
aTextPos,
aTextDir,
@@ -804,28 +799,24 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
aDimensionAspect->TextAspect()->SetVerticalJustification (aTextJustificaton);
// main dimension line, short extension
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
{
aGroup->SetStencilTestOptions (Standard_True);
}
aGroup->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
aGroup->AddPrimitiveArray (aPrimSegments);
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
{
aGroup->SetStencilTestOptions (Standard_False);
}
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_True);
}
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
if (!aDimensionAspect->IsText3d() && theMode == ComputeMode_All)
{
Prs3d_Root::CurrentGroup (thePresentation)->SetStencilTestOptions (Standard_False);
}
// add arrows to presentation
Prs3d_Root::NewGroup (thePresentation);
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
if (!theIsOneSide)
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
if (!theIsOneSide)
{
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
}
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
}
if (!isArrowsExternal)
@@ -834,18 +825,19 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
}
// add arrow extension lines to presentation
Prs3d_Root::NewGroup (thePresentation);
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aFirstArrowEnd, aFirstExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
if (!theIsOneSide)
{
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aFirstArrowEnd, aFirstExtensionDir,
aSecondArrowEnd, aSecondExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
if (!theIsOneSide)
{
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aSecondArrowEnd, aSecondExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
}
}
}
break;
}
// ------------------------------------------------------------------------ //
@@ -855,48 +847,45 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
case LabelPosition_Left:
{
// add label on dimension or extension line to presentation
{
// Left extension with the text
DrawExtension (thePresentation, anExtensionSize,
isArrowsExternal
? aFirstArrowEnd
: aFirstArrowBegin,
aFirstExtensionDir,
aLabelString,
aLabelWidth,
theMode,
aLabelPosition);
}
Prs3d_Root::NewGroup (thePresentation);
// Left extension with the text
DrawExtension (thePresentation, anExtensionSize,
isArrowsExternal
? aFirstArrowEnd
: aFirstArrowBegin,
aFirstExtensionDir,
aLabelString,
aLabelWidth,
theMode,
aLabelPosition);
// add dimension line primitives
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
{
// add central dimension line
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
Prs3d_Root::NewGroup (thePresentation);
// add graphical primitives
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
aPrimSegments->AddVertex (aCenterLineBegin);
aPrimSegments->AddVertex (aCenterLineEnd);
// add graphical primitives
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
aPrimSegments->AddVertex (aCenterLineBegin);
aPrimSegments->AddVertex (aCenterLineEnd);
aGroup->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
aGroup->AddPrimitiveArray (aPrimSegments);
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
// add selection primitives
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
aSensitiveCurve.Append (aCenterLineBegin);
aSensitiveCurve.Append (aCenterLineEnd);
}
// add selection primitives
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
aSensitiveCurve.Append (aCenterLineBegin);
aSensitiveCurve.Append (aCenterLineEnd);
// add arrows to presentation
Prs3d_Root::NewGroup (thePresentation);
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
if (!theIsOneSide)
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
if (!theIsOneSide)
{
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
}
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
}
if (!isArrowsExternal || theIsOneSide)
@@ -905,11 +894,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
}
// add extension lines for external arrows
{
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aSecondArrowEnd, aSecondExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
}
Prs3d_Root::NewGroup (thePresentation);
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aSecondArrowEnd, aSecondExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
}
break;
@@ -921,6 +910,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
case LabelPosition_Right:
{
// add label on dimension or extension line to presentation
Prs3d_Root::NewGroup (thePresentation);
// Right extension with text
DrawExtension (thePresentation, anExtensionSize,
@@ -935,30 +925,27 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
{
// add central dimension line
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
Prs3d_Root::NewGroup (thePresentation);
// add graphical primitives
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
aPrimSegments->AddVertex (aCenterLineBegin);
aPrimSegments->AddVertex (aCenterLineEnd);
aGroup->SetGroupPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
aGroup->AddPrimitiveArray (aPrimSegments);
// add graphical primitives
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments (2);
aPrimSegments->AddVertex (aCenterLineBegin);
aPrimSegments->AddVertex (aCenterLineEnd);
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
// add selection primitives
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
aSensitiveCurve.Append (aCenterLineBegin);
aSensitiveCurve.Append (aCenterLineEnd);
}
// add selection primitives
SelectionGeometry::Curve& aSensitiveCurve = mySelectionGeom.NewCurve();
aSensitiveCurve.Append (aCenterLineBegin);
aSensitiveCurve.Append (aCenterLineEnd);
// add arrows to presentation
Prs3d_Root::NewGroup (thePresentation);
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
if (!theIsOneSide)
{
thePresentation->NewGroup();
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
if (!theIsOneSide)
{
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
}
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
}
if (!isArrowsExternal || theIsOneSide)
@@ -967,11 +954,11 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
}
// add extension lines for external arrows
{
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aFirstArrowEnd, aFirstExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
}
Prs3d_Root::NewGroup (thePresentation);
DrawExtension (thePresentation, aDimensionAspect->ArrowTailSize(),
aFirstArrowEnd, aFirstExtensionDir,
THE_EMPTY_LABEL, 0.0, theMode, LabelPosition_None);
}
break;
@@ -981,7 +968,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
// add flyout lines to presentation
if (theMode == ComputeMode_All)
{
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
Prs3d_Root::NewGroup (thePresentation);
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
aPrimSegments->AddVertex (theFirstPoint);
@@ -990,8 +977,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
aPrimSegments->AddVertex (theSecondPoint);
aPrimSegments->AddVertex (aLineEndPoint);
aGroup->SetGroupPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
aGroup->AddPrimitiveArray (aPrimSegments);
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
}
mySelectionGeom.IsComputed = Standard_True;

View File

@@ -198,21 +198,6 @@ public: //! @name highlighting management
const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
//! Setup highlight style settings.
//! It is preferred modifying existing style returned by method HighlightStyle()
//! instead of creating a new drawer.
//!
//! If a new highlight style is created, its presentation Zlayer should be checked,
//! otherwise highlighting might not work as expected.
//! Default values are:
//! - Prs3d_TypeOfHighlight_Dynamic: Graphic3d_ZLayerId_Top,
//! object highlighting is drawn on top of main scene within Immediate Layers,
//! so that V3d_View::RedrawImmediate() will be enough to see update;
//! - Prs3d_TypeOfHighlight_LocalDynamic: Graphic3d_ZLayerId_Topmost,
//! object parts highlighting is drawn on top of main scene within Immediate Layers
//! with depth cleared (even overlapped geometry will be revealed);
//! - Prs3d_TypeOfHighlight_Selected: Graphic3d_ZLayerId_UNKNOWN,
//! object highlighting is drawn on top of main scene within the same layer
//! as object itself (e.g. Graphic3d_ZLayerId_Default by default) and increased priority.
void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
@@ -227,14 +212,6 @@ public: //! @name highlighting management
}
//! Setup the style of dynamic highlighting.
//! It is preferred modifying existing style returned by method HighlightStyle()
//! instead of creating a new drawer.
//!
//! If a new highlight style is created, its presentation Zlayer should be checked,
//! otherwise highlighting might not work as expected.
//! Default value is Graphic3d_ZLayerId_Top,
//! object highlighting is drawn on top of main scene within Immediate Layers,
//! so that V3d_View::RedrawImmediate() will be enough to see update;
void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
//! Returns current selection style settings.
@@ -1285,10 +1262,6 @@ protected: //! @name internal methods
return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
}
//! Return TRUE if highlight style of owner requires full viewer redraw.
Standard_EXPORT Standard_Boolean isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(V3d_Viewer)& theViewer) const;
//! Helper function that returns correct selection style for the object:
//! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
//! selection style of interactive context will be returned.

View File

@@ -293,22 +293,6 @@ void AIS_InteractiveContext::highlightWithSubintensity (const Handle(SelectMgr_E
theOwner->HilightWithColor (myMainPM, myStyles[Prs3d_TypeOfHighlight_SubIntensity], theMode);
}
//=======================================================================
//function : isSlowHiStyle
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(V3d_Viewer)& theViewer) const
{
if (const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()))
{
const Handle(Prs3d_Drawer)& aHiStyle = getHiStyle (anObj, myLastPicked);
return aHiStyle->ZLayer() == Graphic3d_ZLayerId_UNKNOWN
|| !theViewer->ZLayerSettings (aHiStyle->ZLayer()).IsImmediate();
}
return Standard_False;
}
//=======================================================================
//function : MoveTo
//purpose :
@@ -388,11 +372,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
// method call. As result it is necessary to rehighligt it with mySelectionColor.
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
{
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
{
theView->Viewer()->Invalidate();
}
clearDynamicHighlight();
toUpdateViewer = Standard_True;
}
@@ -408,11 +387,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
&& (!myLastPicked->IsSelected()
|| myToHilightSelected))
{
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
{
theView->Viewer()->Invalidate();
}
highlightWithColor (myLastPicked, theView->Viewer());
toUpdateViewer = Standard_True;
}
@@ -431,11 +405,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
&& !myLastPicked.IsNull()
&& myLastPicked->HasSelectable())
{
if (isSlowHiStyle (myLastPicked, theView->Viewer()))
{
theView->Viewer()->Invalidate();
}
clearDynamicHighlight();
toUpdateViewer = Standard_True;
}
@@ -453,14 +422,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
}
else
{
if (theView->IsInvalidated())
{
theView->Viewer()->Redraw();
}
else
{
theView->Viewer()->RedrawImmediate();
}
theView->Viewer()->RedrawImmediate();
}
}

View File

@@ -472,7 +472,33 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode, aFactor, aUnits );
SynchronizeAspects();
// Modify existing presentations
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
if ( !aPrs3d.IsNull() ) {
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
if( !aStruct.IsNull() ) {
// Workaround for issue 23115: Need to update also groups, because their
// face aspect ALWAYS overrides the structure's.
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
{
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
if (aGrp.IsNull()
|| !aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
continue;
}
Handle(Graphic3d_AspectFillArea3d) aFaceAsp = aGrp->FillAreaAspect();
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
}
}
}
}
}
//=======================================================================
@@ -596,33 +622,3 @@ void AIS_InteractiveObject::SynchronizeAspects()
}
}
}
//=======================================================================
//function : replaceAspects
//purpose :
//=======================================================================
void AIS_InteractiveObject::replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap)
{
if (theMap.IsEmpty())
{
return;
}
for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
{
const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation();
if (aPrs3d.IsNull()
|| aPrs3d->Presentation().IsNull())
{
continue;
}
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next())
{
if (!aGroupIter.Value().IsNull())
{
aGroupIter.ChangeValue()->ReplaceAspects (theMap);
}
}
}
}

View File

@@ -386,15 +386,6 @@ public:
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
Standard_EXPORT void SynchronizeAspects();
protected:
//! Replace aspects of existing (computed) presentation groups,
//! so that the new aspects can be applied without recomputing presentation.
//! It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups.
//! The recommended approach is computing presentation with necessary customized aspects,
//! and then modify them directly followed by SynchronizeAspects() call.
Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
private:
Standard_EXPORT virtual Standard_Boolean RecomputeEveryPrs() const;

View File

@@ -26,7 +26,6 @@
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_ToolDisk.hxx>
#include <Prs3d_ToolSector.hxx>
#include <Prs3d_ToolSphere.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <Select3D_SensitivePoint.hxx>
@@ -152,19 +151,6 @@ void AIS_Manipulator::init()
myHighlightAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
myHighlightAspect->SetMaterial (aHilightMaterial);
Graphic3d_MaterialAspect aDraggerMaterial;
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
aDraggerMaterial.SetMaterialType(Graphic3d_MATERIAL_ASPECT);
aDraggerMaterial.SetAmbient(1.0);
myDraggerHighlight = new Prs3d_ShadingAspect();
myDraggerHighlight->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
myDraggerHighlight->SetMaterial(aDraggerMaterial);
myDraggerHighlight->SetTransparency(0.5);
SetSize (100);
SetZLayer (Graphic3d_ZLayerId_Topmost);
}
@@ -184,11 +170,10 @@ Handle(Prs3d_Presentation) AIS_Manipulator::getHighlightPresentation (const Hand
switch (anOwner->Mode())
{
case AIS_MM_Translation : return myAxes[anOwner->Index()].TranslatorHighlightPrs();
case AIS_MM_Rotation : return myAxes[anOwner->Index()].RotatorHighlightPrs();
case AIS_MM_Scaling : return myAxes[anOwner->Index()].ScalerHighlightPrs();
case AIS_MM_TranslationPlane: return myAxes[anOwner->Index()].DraggerHighlightPrs();
case AIS_MM_None : break;
case AIS_MM_Translation: return myAxes[anOwner->Index()].TranslatorHighlightPrs();
case AIS_MM_Rotation : return myAxes[anOwner->Index()].RotatorHighlightPrs();
case AIS_MM_Scaling : return myAxes[anOwner->Index()].ScalerHighlightPrs();
case AIS_MM_None : break;
}
return aDummyPrs;
@@ -209,11 +194,10 @@ Handle(Graphic3d_Group) AIS_Manipulator::getGroup (const Standard_Integer theInd
switch (theMode)
{
case AIS_MM_Translation : return myAxes[theIndex].TranslatorGroup();
case AIS_MM_Rotation : return myAxes[theIndex].RotatorGroup();
case AIS_MM_Scaling : return myAxes[theIndex].ScalerGroup();
case AIS_MM_TranslationPlane: return myAxes[theIndex].DraggerGroup();
case AIS_MM_None : break;
case AIS_MM_Translation: return myAxes[theIndex].TranslatorGroup();
case AIS_MM_Rotation : return myAxes[theIndex].RotatorGroup();
case AIS_MM_Scaling : return myAxes[theIndex].ScalerGroup();
case AIS_MM_None : break;
}
return aDummyGroup;
@@ -282,10 +266,6 @@ void AIS_Manipulator::SetPart (const Standard_Integer theAxisIndex, const AIS_Ma
myAxes[theAxisIndex].SetScaling (theIsEnabled);
break;
case AIS_MM_TranslationPlane:
myAxes[theAxisIndex].SetDragging(theIsEnabled);
break;
case AIS_MM_None:
break;
}
@@ -297,7 +277,7 @@ void AIS_Manipulator::SetPart (const Standard_Integer theAxisIndex, const AIS_Ma
//=======================================================================
void AIS_Manipulator::SetPart (const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled)
{
for (Standard_Integer anIt = 0; anIt < 4; ++anIt)
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
SetPart (anIt, theMode, theIsEnabled);
}
@@ -420,7 +400,6 @@ void AIS_Manipulator::Attach (const Handle(AIS_ManipulatorObjectSequence)& theOb
EnableMode (AIS_MM_Rotation);
EnableMode (AIS_MM_Translation);
EnableMode (AIS_MM_Scaling);
EnableMode (AIS_MM_TranslationPlane);
}
}
@@ -607,34 +586,6 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
myPrevState = anAngle;
return Standard_True;
}
case AIS_MM_TranslationPlane:
{
const gp_Pnt aPosLoc = myStartPosition.Location();
const gp_Ax1 aCurrAxis = getAx1FromAx2Dir(myStartPosition, myCurrentIndex);
IntAna_IntConicQuad aIntersector(anInputLine, gp_Pln(aPosLoc, aCurrAxis.Direction()), Precision::Angular(), Precision::Intersection());
if (!aIntersector.IsDone() || aIntersector.NbPoints() < 1)
{
return Standard_False;
}
const gp_Pnt aNewPosition = aIntersector.Point(1);
if (!myHasStartedTransformation)
{
myStartPick = aNewPosition;
myHasStartedTransformation = Standard_True;
return Standard_True;
}
if (aNewPosition.Distance(myStartPick) < Precision::Confusion())
{
return Standard_False;
}
gp_Trsf aNewTrsf;
aNewTrsf.SetTranslation(gp_Vec(myStartPick, aNewPosition));
theTrsf *= aNewTrsf;
return Standard_True;
}
case AIS_MM_None:
{
return Standard_False;
@@ -706,9 +657,8 @@ void AIS_Manipulator::Transform (const gp_Trsf& theTrsf)
}
}
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|| (myCurrentMode == AIS_MM_Rotation && myBehaviorOnTransform.FollowRotation)
|| (myCurrentMode == AIS_MM_TranslationPlane && myBehaviorOnTransform.FollowDragging))
if ((myCurrentMode == AIS_MM_Translation && myBehaviorOnTransform.FollowTranslation)
|| (myCurrentMode == AIS_MM_Rotation && myBehaviorOnTransform.FollowRotation))
{
gp_Pnt aPos = myStartPosition.Location().Transformed (theTrsf);
gp_Dir aVDir = myStartPosition.Direction().Transformed (theTrsf);
@@ -836,13 +786,8 @@ void AIS_Manipulator::DeactivateCurrentMode()
Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect();
anAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
anAspect->SetMaterial (myDrawer->ShadingAspect()->Material());
if (myCurrentMode == AIS_MM_TranslationPlane)
anAspect->SetTransparency(1.0);
else
{
anAspect->SetTransparency(myDrawer->ShadingAspect()->Transparency());
anAspect->SetColor(myAxes[myCurrentIndex].Color());
}
anAspect->SetTransparency (myDrawer->ShadingAspect()->Transparency());
anAspect->SetColor (myAxes[myCurrentIndex].Color());
aGroup->SetGroupPrimitivesAspect (anAspect->Aspect());
}
@@ -937,14 +882,14 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
// Display center
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin());
aGroup = thePrs->NewGroup ();
aGroup = Prs3d_Root::NewGroup (thePrs);
aGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (myCenter.Array());
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
// Display axes
aGroup = thePrs->NewGroup ();
aGroup = Prs3d_Root::NewGroup (thePrs);
Handle(Prs3d_ShadingAspect) anAspectAx = new Prs3d_ShadingAspect (new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
anAspectAx->SetColor (myAxes[anIt].Color());
@@ -987,13 +932,7 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
return;
}
if (anOwner->Mode() == AIS_MM_TranslationPlane)
{
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
}
else
aGroup->SetGroupPrimitivesAspect(myHighlightAspect->Aspect());
aGroup->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
myCurrentIndex = anOwner->Index();
myCurrentMode = anOwner->Mode();
@@ -1022,20 +961,13 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
{
return;
}
if (anOwner->Mode() == AIS_MM_TranslationPlane)
{
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
aStyle->SetColor(myAxes[anOwner->Index()].Color());
aStyle->SetTransparency(0.5);
aPresentation->Highlight(aStyle);
}
else
aPresentation->Highlight(theStyle);
aPresentation->Highlight (theStyle);
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPresentation->Groups());
aGroupIter.More(); aGroupIter.Next())
{
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
if (!aGrp.IsNull())
if (!aGrp.IsNull()
&& aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGrp->SetGroupPrimitivesAspect (myHighlightAspect->Aspect());
}
@@ -1144,38 +1076,6 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
theSelection->Add (aTri);
}
}
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
{
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
if (!myAxes[anIt].HasDragging())
{
continue;
}
if (aMode != AIS_MM_None)
{
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
}
// define sensitivity by two crossed lines
gp_Pnt aP1, aP2;
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
aLine1->SetSensitivityFactor(10);
theSelection->Add(aLine1);
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
aLine2->SetSensitivityFactor(10);
theSelection->Add(aLine2);
// enlarge sensitivity by triangulation
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
theSelection->Add(aTri);
}
}
}
//=======================================================================
@@ -1291,24 +1191,6 @@ void AIS_Manipulator::Cube::addTriangle (const Standard_Integer theIndex,
myArray->AddVertex (theP3, theNormal);
}
//=======================================================================
//class : Sector
//function : Init
//purpose :
//=======================================================================
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb)
{
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
gp_Trsf aTrsf;
aTrsf.SetTransformation(aSystem, gp_Ax3());
aTool.FillArray(myArray, myTriangulation, aTrsf);
}
//=======================================================================
//class : Axis
//function : Constructor
@@ -1329,7 +1211,6 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
myInnerRadius (myLength + myBoxSize),
myDiskThickness (myBoxSize * 0.5f),
myIndent (0.2f),
myHasDragging(Standard_True),
myFacettesNumber (20),
myCircleRadius (myLength + myBoxSize + myBoxSize * 0.5f * 0.5f)
{
@@ -1358,7 +1239,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myAxisRadius * 1.5,
anArrowLength,
myFacettesNumber);
myTranslatorGroup = thePrs->NewGroup ();
myTranslatorGroup = Prs3d_Root::NewGroup (thePrs);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
@@ -1382,7 +1263,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
myScalerGroup = thePrs->NewGroup ();
myScalerGroup = Prs3d_Root::NewGroup (thePrs);
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myScalerGroup->AddPrimitiveArray (myCube.Array());
@@ -1405,7 +1286,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
{
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
myRotatorGroup = thePrs->NewGroup ();
myRotatorGroup = Prs3d_Root::NewGroup (thePrs);
myRotatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myRotatorGroup->AddPrimitiveArray (myCircle.Array());
@@ -1423,36 +1304,4 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
aGroup->AddPrimitiveArray (myCircle.Array());
}
}
if (myHasDragging)
{
gp_Dir aXDirection;
if (myReferenceAxis.Direction().X() > 0)
aXDirection = gp::DY();
else if (myReferenceAxis.Direction().Y() > 0)
aXDirection = gp::DZ();
else
aXDirection = gp::DX();
mySector.Init(myInnerRadius + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection, myFacettesNumber * 2);
myDraggerGroup = thePrs->NewGroup();
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();
myDraggerGroup->SetGroupPrimitivesAspect(aFillArea);
myDraggerGroup->AddPrimitiveArray(mySector.Array());
if (myHighlightDragger.IsNull())
{
myHighlightDragger = new Prs3d_Presentation(thePrsMgr->StructureManager());
}
else
{
myHighlightDragger->Clear();
}
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(myHighlightDragger);
aGroup->SetGroupPrimitivesAspect(aFillArea);
aGroup->AddPrimitiveArray(mySector.Array());
}
}
}

View File

@@ -280,14 +280,12 @@ public:
//! - FollowRotation - whether the manipulator will be rotated together with an object.
struct BehaviorOnTransform {
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True), FollowDragging (Standard_True) {}
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True) {}
BehaviorOnTransform& SetFollowTranslation (const Standard_Boolean theApply) { FollowTranslation = theApply; return *this; }
BehaviorOnTransform& SetFollowRotation (const Standard_Boolean theApply) { FollowRotation = theApply; return *this; }
BehaviorOnTransform& SetFollowDragging (const Standard_Boolean theApply) { FollowDragging = theApply; return *this; }
Standard_Boolean FollowTranslation;
Standard_Boolean FollowRotation;
Standard_Boolean FollowDragging;
};
//! Sets behavior settings for transformation action carried on the manipulator,
@@ -448,29 +446,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
Handle(Graphic3d_ArrayOfTriangles) myArray;
};
class Sector : public Quadric
{
public:
Sector()
: Quadric(),
myRadius(0.0f)
{ }
~Sector() { }
void Init(const Standard_ShortReal theRadius,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
const Standard_Integer theSlicesNb = 5,
const Standard_Integer theStacksNb = 5);
protected:
gp_Ax1 myPosition;
Standard_ShortReal myRadius;
};
//! The class describes on axis sub-object.
//! It includes sub-objects itself:
//! -rotator
@@ -510,11 +485,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
{
myHighlightRotator->SetTransformPersistence (theTrsfPers);
}
if (!myHighlightDragger.IsNull())
{
myHighlightDragger->SetTransformPersistence(theTrsfPers);
}
}
void Transform (const Handle(Geom_Transformation)& theTransformation)
@@ -533,11 +503,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
{
myHighlightRotator->SetTransformation (theTransformation);
}
if (!myHighlightDragger.IsNull())
{
myHighlightDragger->SetTransformation(theTransformation);
}
}
Standard_Boolean HasTranslation() const { return myHasTranslation; }
@@ -546,16 +511,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
Standard_Boolean HasScaling() const { return myHasScaling; }
Standard_Boolean HasDragging() const { return myHasDragging; }
void SetTranslation (const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
void SetRotation (const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
Quantity_Color Color() const { return myColor; }
Standard_ShortReal AxisLength() const { return myLength; }
@@ -570,16 +531,12 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
const Handle(Prs3d_Presentation)& DraggerHighlightPrs() const { return myHighlightDragger; }
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
const Handle(Graphic3d_Group)& DraggerGroup() const { return myDraggerGroup; }
const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
@@ -613,7 +570,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
public:
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
const Sector& DraggerSector() const { return mySector; }
const Disk& RotatorDisk() const { return myCircle; }
float RotatorDiskRadius() const { return myCircleRadius; }
const Cube& ScalerCube() const { return myCube; }
@@ -637,14 +593,11 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
Standard_ShortReal myDiskThickness;
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
Standard_Boolean myHasDragging;
protected:
Standard_Integer myFacettesNumber;
gp_Pnt myArrowTipPos;
Sector mySector;
Disk myCircle;
float myCircleRadius;
Cube myCube;
@@ -653,12 +606,10 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
Handle(Graphic3d_Group) myTranslatorGroup;
Handle(Graphic3d_Group) myScalerGroup;
Handle(Graphic3d_Group) myRotatorGroup;
Handle(Graphic3d_Group) myDraggerGroup;
Handle(Prs3d_Presentation) myHighlightTranslator;
Handle(Prs3d_Presentation) myHighlightScaler;
Handle(Prs3d_Presentation) myHighlightRotator;
Handle(Prs3d_Presentation) myHighlightDragger;
Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
@@ -687,9 +638,6 @@ protected: //! @name Fields for interactive transformation. Fields only for inte
//! Aspect used to color current detected part and current selected part.
Handle(Prs3d_ShadingAspect) myHighlightAspect;
//! Aspect used to color sector part when it's selected.
Handle(Prs3d_ShadingAspect) myDraggerHighlight;
public:
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)

View File

@@ -22,8 +22,7 @@ enum AIS_ManipulatorMode
AIS_MM_None = 0,
AIS_MM_Translation = 1,
AIS_MM_Rotation,
AIS_MM_Scaling,
AIS_MM_TranslationPlane
AIS_MM_Scaling
};
#endif

View File

@@ -173,8 +173,8 @@ void AIS_PointCloudOwner::Clear (const Handle(PrsMgr_PresentationManager)& thePr
//==================================================
AIS_PointCloud::AIS_PointCloud()
{
myDrawer->SetupOwnShadingAspect();
myDrawer->ShadingAspect()->Aspect()->SetMarkerType (Aspect_TOM_POINT);
// override default point style to Aspect_TOM_POINT
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0));
SetDisplayMode (AIS_PointCloud::DM_Points);
SetHilightMode (AIS_PointCloud::DM_BndBox);
@@ -282,8 +282,52 @@ void AIS_PointCloud::SetColor (const Quantity_Color& theColor)
{
AIS_InteractiveObject::SetColor(theColor);
if (!myDrawer->HasOwnPointAspect())
{
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, theColor, 1.0));
if (myDrawer->HasLink())
{
*myDrawer->PointAspect()->Aspect() = *myDrawer->Link()->PointAspect()->Aspect();
}
}
if (!myDrawer->HasOwnShadingAspect())
{
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (myDrawer->HasLink())
{
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
}
}
// Override color
myDrawer->ShadingAspect()->SetColor (theColor);
SynchronizeAspects();
myDrawer->PointAspect() ->SetColor (theColor);
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
{
aGroup->SetGroupPrimitivesAspect (aPointAspect);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAspect);
}
}
}
}
//=======================================================================
@@ -298,20 +342,34 @@ void AIS_PointCloud::UnsetColor()
}
AIS_InteractiveObject::UnsetColor();
if (!HasWidth())
{
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
}
else
{
myDrawer->PointAspect()->SetColor (myDrawer->HasLink()
? myDrawer->Link()->PointAspect()->Aspect()->Color()
: Quantity_Color (Quantity_NOC_YELLOW));
}
if (HasMaterial()
|| IsTransparent())
{
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aMat = aDefaultMat;
Quantity_Color aColor = aDefaultMat.Color();
if (myDrawer->HasLink())
{
aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
}
if (HasMaterial() || myDrawer->HasLink())
{
aMat = AIS_GraphicTool::GetMaterial (HasMaterial() ? myDrawer : myDrawer->Link());
}
if (HasMaterial())
{
Quantity_Color aColor = aDefaultMat.AmbientColor();
if (myDrawer->HasLink())
{
aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
}
aMat.SetColor (aColor);
}
if (IsTransparent())
@@ -320,10 +378,43 @@ void AIS_PointCloud::UnsetColor()
aMat.SetTransparency (Standard_ShortReal(aTransp));
}
myDrawer->ShadingAspect()->SetMaterial (aMat, myCurrentFacingModel);
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aColor);
}
else
{
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
}
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
SynchronizeAspects();
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = myDrawer->Link()->PointAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
{
aGroup->SetGroupPrimitivesAspect (aMarkerAsp);
}
}
}
}
//=======================================================================
@@ -332,6 +423,14 @@ void AIS_PointCloud::UnsetColor()
//=======================================================================
void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
{
if (!myDrawer->HasOwnShadingAspect())
{
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (myDrawer->HasLink())
{
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
}
}
hasOwnMaterial = Standard_True;
myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
@@ -340,7 +439,28 @@ void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat)
myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
}
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
SynchronizeAspects();
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}
}
//=======================================================================
@@ -354,6 +474,8 @@ void AIS_PointCloud::UnsetMaterial()
return;
}
if (HasColor()
|| IsTransparent())
{
Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
myDrawer->ShadingAspect()->SetMaterial (myDrawer->HasLink() ?
@@ -366,8 +488,33 @@ void AIS_PointCloud::UnsetMaterial()
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
}
}
else
{
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
}
hasOwnMaterial = Standard_False;
SynchronizeAspects();
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_PointCloud::DM_Points)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}
}
//=======================================================================
@@ -388,7 +535,8 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
return;
}
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (aPoints);
break;

View File

@@ -28,7 +28,6 @@
#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <gp_Circ.hxx>
#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
@@ -185,13 +184,8 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
pa->SetTypeOfMarker(aProjTOM);
}
{
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (ProjPoint);
aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
aGroup->AddPrimitiveArray (anArrayOfPoints);
}
// calcul du projete
StdPrs_Point::Add(aPrs, new Geom_CartesianPoint(ProjPoint), myDrawer);
if (!myDrawer->HasOwnWireAspect()){
myDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aCallTOL,2.));}
@@ -203,14 +197,10 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
}
// Si les points ne sont pas confondus...
if (!ProjPoint.IsEqual (BRep_Tool::Pnt(aVertex),Precision::Confusion()))
{
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
Handle(Graphic3d_ArrayOfSegments) anArrayOfLines = new Graphic3d_ArrayOfSegments (2);
anArrayOfLines->AddVertex (ProjPoint);
anArrayOfLines->AddVertex (BRep_Tool::Pnt(aVertex));
aGroup->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
aGroup->AddPrimitiveArray (anArrayOfLines);
if (!ProjPoint.IsEqual (BRep_Tool::Pnt(aVertex),Precision::Confusion())) {
// calcul des lignes de rappel
BRepBuilderAPI_MakeEdge MakEd (ProjPoint,BRep_Tool::Pnt(aVertex));
StdPrs_WFShape::Add (aPrs, MakEd.Edge(), myDrawer);
}
}

View File

@@ -392,12 +392,13 @@ void AIS_RubberBand::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer /*theMode*/)
{
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
// Draw filling
if (IsFilling() && fillTriangles())
{
Handle(Graphic3d_Group) aGroup1 = thePresentation->NewGroup();
aGroup1->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup1->AddPrimitiveArray (myTriangles);
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (myTriangles);
}
// Draw frame
@@ -432,7 +433,6 @@ void AIS_RubberBand::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP
}
}
Handle(Graphic3d_Group) aGroup = thePresentation->NewGroup();
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
aGroup->AddPrimitiveArray (myBorders);
}

View File

@@ -77,40 +77,6 @@ static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard
return Standard_False;
}
// Auxiliary macros
#define replaceAspectWithDef(theMap, theAspect) \
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
{ \
theMap.Bind (myDrawer->theAspect()->Aspect(), myDrawer->Link()->theAspect()->Aspect()); \
}
// Auxiliary macros for replaceWithNewOwnAspects()
#define replaceAspectWithOwn(theMap, theAspect) \
if (myDrawer->Link()->theAspect()->Aspect() != myDrawer->theAspect()->Aspect()) \
{ \
theMap.Bind (myDrawer->Link()->theAspect()->Aspect(), myDrawer->theAspect()->Aspect()); \
}
//=======================================================================
//function : replaceWithNewOwnAspects
//purpose :
//=======================================================================
void AIS_Shape::replaceWithNewOwnAspects()
{
Graphic3d_MapOfAspectsToAspects aReplaceMap;
replaceAspectWithOwn (aReplaceMap, ShadingAspect);
replaceAspectWithOwn (aReplaceMap, LineAspect);
replaceAspectWithOwn (aReplaceMap, WireAspect);
replaceAspectWithOwn (aReplaceMap, FreeBoundaryAspect);
replaceAspectWithOwn (aReplaceMap, UnFreeBoundaryAspect);
replaceAspectWithOwn (aReplaceMap, SeenLineAspect);
replaceAspectWithOwn (aReplaceMap, FaceBoundaryAspect);
replaceAspectWithOwn (aReplaceMap, PointAspect);
replaceAspects (aReplaceMap);
}
//==================================================
// Function: AIS_Shape
// Purpose :
@@ -384,9 +350,78 @@ bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColor) const
{
bool toRecompute = false;
toRecompute = theDrawer->SetupOwnShadingAspect() || toRecompute;
toRecompute = theDrawer->SetOwnLineAspects() || toRecompute;
toRecompute = theDrawer->SetupOwnPointAspect() || toRecompute;
if (!theDrawer->HasOwnShadingAspect())
{
toRecompute = true;
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (theDrawer->HasLink())
{
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
}
if (!theDrawer->HasOwnLineAspect())
{
toRecompute = true;
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
}
}
if (!theDrawer->HasOwnWireAspect())
{
toRecompute = true;
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
}
}
if (!theDrawer->HasOwnPointAspect())
{
toRecompute = true;
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
}
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
}
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
}
}
if (!theDrawer->HasOwnSeenLineAspect())
{
toRecompute = true;
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
}
}
if (!theDrawer->HasOwnFaceBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
}
}
// override color
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
@@ -410,19 +445,52 @@ void AIS_Shape::SetColor (const Quantity_Color& theColor)
const bool toRecompute = setColor (myDrawer, theColor);
myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
myToRecomputeModes.Clear();
if (!toRecompute
|| !myDrawer->HasLink())
if (!toRecompute)
{
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
SynchronizeAspects();
return;
}
else
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
replaceWithNewOwnAspects();
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_Shaded)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAspect);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
{
aGroup->SetGroupPrimitivesAspect (aLineAspect);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
{
aGroup->SetGroupPrimitivesAspect (aPointAspect);
}
}
}
recomputeComputed();
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (2);
}
//=======================================================================
@@ -432,31 +500,25 @@ void AIS_Shape::SetColor (const Quantity_Color& theColor)
void AIS_Shape::UnsetColor()
{
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
myToRecomputeModes.Clear();
if (!HasColor())
{
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
return;
}
hasOwnColor = Standard_False;
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
Graphic3d_MapOfAspectsToAspects aReplaceMap;
if (!HasWidth())
{
replaceAspectWithDef (aReplaceMap, LineAspect);
replaceAspectWithDef (aReplaceMap, WireAspect);
replaceAspectWithDef (aReplaceMap, FreeBoundaryAspect);
replaceAspectWithDef (aReplaceMap, UnFreeBoundaryAspect);
replaceAspectWithDef (aReplaceMap, SeenLineAspect);
replaceAspectWithDef (aReplaceMap, FaceBoundaryAspect);
myDrawer->SetLineAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetWireAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetFreeBoundaryAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetUnFreeBoundaryAspect(Handle(Prs3d_LineAspect)());
myDrawer->SetSeenLineAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
Handle(Prs3d_LineAspect) anEmptyAsp;
myDrawer->SetLineAspect (anEmptyAsp);
myDrawer->SetWireAspect (anEmptyAsp);
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
}
else
{
@@ -538,17 +600,10 @@ void AIS_Shape::UnsetColor()
}
else
{
replaceAspectWithDef (aReplaceMap, ShadingAspect);
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
}
if (myDrawer->HasOwnPointAspect())
{
replaceAspectWithDef (aReplaceMap, PointAspect);
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
}
replaceAspects (aReplaceMap);
SynchronizeAspects();
recomputeComputed();
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
myRecomputeEveryPrs = true;
}
//=======================================================================
@@ -559,7 +614,61 @@ void AIS_Shape::UnsetColor()
bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theLineWidth) const
{
bool toRecompute = theDrawer->SetOwnLineAspects();
bool toRecompute = false;
if (!theDrawer->HasOwnLineAspect())
{
toRecompute = true;
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
}
}
if (!theDrawer->HasOwnWireAspect())
{
toRecompute = true;
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
}
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
}
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
toRecompute = true;
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
}
}
if (!theDrawer->HasOwnSeenLineAspect())
{
toRecompute = true;
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
}
}
if (!theDrawer->HasOwnFaceBoundaryAspect())
{
toRecompute = true;
theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
}
}
// override width
theDrawer->LineAspect()->SetWidth (theLineWidth);
@@ -579,19 +688,16 @@ bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
{
myOwnWidth = theLineWidth;
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
myToRecomputeModes.Clear();
if (!setWidth (myDrawer, theLineWidth)
|| !myDrawer->HasLink())
if (setWidth (myDrawer, theLineWidth))
{
SynchronizeAspects();
myRecomputeEveryPrs = true;
}
else
{
replaceWithNewOwnAspects();
myRecomputeEveryPrs = false;
myToRecomputeModes.Clear();
SynchronizeAspects();
}
recomputeComputed();
}
//=======================================================================
@@ -601,30 +707,24 @@ void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
void AIS_Shape::UnsetWidth()
{
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
myToRecomputeModes.Clear();
if (myOwnWidth == 0.0)
{
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
return;
}
myOwnWidth = 0.0;
if (!HasColor())
{
Graphic3d_MapOfAspectsToAspects aReplaceMap;
replaceAspectWithDef (aReplaceMap, LineAspect);
replaceAspectWithDef (aReplaceMap, WireAspect);
replaceAspectWithDef (aReplaceMap, FreeBoundaryAspect);
replaceAspectWithDef (aReplaceMap, UnFreeBoundaryAspect);
replaceAspectWithDef (aReplaceMap, SeenLineAspect);
replaceAspectWithDef (aReplaceMap, FaceBoundaryAspect);
myDrawer->SetLineAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetWireAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetFreeBoundaryAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetUnFreeBoundaryAspect(Handle(Prs3d_LineAspect)());
myDrawer->SetSeenLineAspect (Handle(Prs3d_LineAspect)());
myDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
replaceAspects (aReplaceMap);
const Handle(Prs3d_LineAspect) anEmptyAsp;
myDrawer->SetLineAspect (anEmptyAsp);
myDrawer->SetWireAspect (anEmptyAsp);
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
myRecomputeEveryPrs = true;
}
else
{
@@ -641,8 +741,9 @@ void AIS_Shape::UnsetWidth()
myDrawer->FaceBoundaryAspect() ->SetWidth (myDrawer->HasLink() ?
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_FaceBoundary) : 1.);
SynchronizeAspects();
myToRecomputeModes.Clear();
myRecomputeEveryPrs = false;
}
recomputeComputed();
}
//=======================================================================
@@ -657,7 +758,14 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
{
const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
theDrawer->SetupOwnShadingAspect();
if (!theDrawer->HasOwnShadingAspect())
{
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (theDrawer->HasLink())
{
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
}
theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
if (theToKeepColor)
@@ -677,21 +785,37 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
{
const bool toRecompute = !myDrawer->HasOwnShadingAspect();
setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
hasOwnMaterial = Standard_True;
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_Shaded)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
if (!toRecompute
|| !myDrawer->HasLink())
{
SynchronizeAspects();
}
else
{
replaceWithNewOwnAspects();
}
}
//=======================================================================
@@ -701,8 +825,6 @@ void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
void AIS_Shape::UnsetMaterial()
{
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
myToRecomputeModes.Clear();
if (!HasMaterial())
{
return;
@@ -726,15 +848,37 @@ void AIS_Shape::UnsetMaterial()
myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
}
SynchronizeAspects();
}
else
{
Graphic3d_MapOfAspectsToAspects aReplaceMap;
replaceAspectWithDef (aReplaceMap, ShadingAspect);
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
replaceAspects (aReplaceMap);
}
hasOwnMaterial = Standard_False;
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_Shaded)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}
//=======================================================================
@@ -745,7 +889,15 @@ void AIS_Shape::UnsetMaterial()
void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theValue) const
{
theDrawer->SetupOwnShadingAspect();
if (!theDrawer->HasOwnShadingAspect())
{
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (theDrawer->HasLink())
{
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
}
// override transparency
theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
}
@@ -757,21 +909,33 @@ void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
void AIS_Shape::SetTransparency (const Standard_Real theValue)
{
const bool toRecompute = !myDrawer->HasOwnShadingAspect();
setTransparency (myDrawer, theValue);
myDrawer->SetTransparency ((Standard_ShortReal )theValue);
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_Shaded)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
myToRecomputeModes.Clear();
if (!toRecompute
|| !myDrawer->HasLink())
{
SynchronizeAspects();
}
else
{
replaceWithNewOwnAspects();
}
}
//=======================================================================
@@ -781,9 +945,6 @@ void AIS_Shape::SetTransparency (const Standard_Real theValue)
void AIS_Shape::UnsetTransparency()
{
myRecomputeEveryPrs = false; // no mode to recalculate, only viewer update
myToRecomputeModes.Clear();
myDrawer->SetTransparency (0.0f);
if (!myDrawer->HasOwnShadingAspect())
{
@@ -794,15 +955,36 @@ void AIS_Shape::UnsetTransparency()
|| myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
{
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
SynchronizeAspects();
}
else
{
Graphic3d_MapOfAspectsToAspects aReplaceMap;
replaceAspectWithDef (aReplaceMap, ShadingAspect);
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
replaceAspects (aReplaceMap);
}
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
if (aPrsModed.Mode() != AIS_Shaded)
{
continue;
}
const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}
//=======================================================================

View File

@@ -51,7 +51,7 @@
//! To generate texture coordinates, appropriate shading attribute should be set before computing presentation in AIS_Shaded display mode:
//! @code
//! Handle(AIS_Shape) aPrs = new AIS_Shape();
//! aPrs->Attributes()->SetupOwnShadingAspect();
//! aPrs->Attributes()->SetShadingAspect (new Prs3d_ShadingAspect());
//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn();
//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2Dmanual (Graphic3d_NOT_2D_ALUMINUM));
//! @endcode
@@ -316,9 +316,6 @@ protected:
Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const;
//! Replace aspects of already computed groups from drawer link by the new own value.
Standard_EXPORT void replaceWithNewOwnAspects();
public:
//! Compute HLR presentation for specified shape.

View File

@@ -218,6 +218,36 @@ void AIS_TexturedShape::SetColor (const Quantity_Color& theColor)
void AIS_TexturedShape::UnsetColor()
{
AIS_Shape::UnsetColor();
for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt)
{
const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt);
if (aPrsModed.Mode() != 3)
continue;
Handle(Prs3d_Presentation) aPrs = aPrsModed.Presentation()->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->Link()->LineAspect()->Aspect();
Quantity_Color aColor;
AIS_GraphicTool::GetInteriorColor (myDrawer->Link(), aColor);
anAreaAsp->SetInteriorColor (aColor);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
{
aGroup->SetGroupPrimitivesAspect (aLineAsp);
}
updateAttributes (aPrs);
}
}
//=======================================================================
@@ -347,6 +377,10 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (thePrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
if (!aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
continue;
}
aGroup->SetGroupPrimitivesAspect (myAspect);
}
}

View File

@@ -108,7 +108,10 @@ void AIS_Triangulation::updatePresentation()
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
}

View File

@@ -16,17 +16,23 @@
#ifndef _Aspect_InteriorStyle_HeaderFile
#define _Aspect_InteriorStyle_HeaderFile
//! Interior types for primitive faces.
//! Definition of interior types for primitive
//! faces.
//!
//! IS_EMPTY no interior.
//! IS_HOLLOW display the boundaries of the surface.
//! IS_HATCH display hatched with a hatch style.
//! IS_SOLID display the interior entirely filled.
//! IS_HIDDENLINE display in hidden lines removed.
//! IS_POINT display only vertices.
enum Aspect_InteriorStyle
{
Aspect_IS_EMPTY = -1, //!< no interior
Aspect_IS_SOLID = 0, //!< normally filled surface interior
Aspect_IS_HATCH, //!< hatched surface interior
Aspect_IS_HIDDENLINE, //!< interior is filled with viewer background color
Aspect_IS_POINT, //!< display only vertices of surface (obsolete)
// obsolete aliases
Aspect_IS_HOLLOW = Aspect_IS_EMPTY, //!< transparent surface interior
Aspect_IS_EMPTY,
Aspect_IS_HOLLOW,
Aspect_IS_HATCH,
Aspect_IS_SOLID,
Aspect_IS_HIDDENLINE,
Aspect_IS_POINT
};
#endif // _Aspect_InteriorStyle_HeaderFile

View File

@@ -1182,29 +1182,6 @@ Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E)
return Standard_False;
}
//=======================================================================
//function : MaxContinuity
//purpose :
//=======================================================================
GeomAbs_Shape BRep_Tool::MaxContinuity (const TopoDS_Edge& theEdge)
{
GeomAbs_Shape aMaxCont = GeomAbs_C0;
for (BRep_ListIteratorOfListOfCurveRepresentation aReprIter ((*((Handle(BRep_TEdge)*)&theEdge.TShape()))->ChangeCurves());
aReprIter.More(); aReprIter.Next())
{
const Handle(BRep_CurveRepresentation)& aRepr = aReprIter.Value();
if (aRepr->IsRegularity())
{
const GeomAbs_Shape aCont = aRepr->Continuity();
if ((Standard_Integer )aCont > (Standard_Integer )aMaxCont)
{
aMaxCont = aCont;
}
}
}
return aMaxCont;
}
//=======================================================================
//function : Pnt
//purpose : Returns the 3d point.

View File

@@ -242,9 +242,6 @@ public:
//! Returns True if the edge has regularity on some
//! two surfaces
Standard_EXPORT static Standard_Boolean HasContinuity (const TopoDS_Edge& E);
//! Returns the max continuity of edge between some surfaces or GeomAbs_C0 if there no such surfaces.
Standard_EXPORT static GeomAbs_Shape MaxContinuity (const TopoDS_Edge& theEdge);
//! Returns the 3d point.
Standard_EXPORT static gp_Pnt Pnt (const TopoDS_Vertex& V);

View File

@@ -18,7 +18,9 @@
#include <Adaptor2d_HCurve2d.hxx>
#include <Adaptor3d_HSurface.hxx>
#include <Adaptor3d_HVertex.hxx>
#include <BRepAdaptor_HCurve2d.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepBlend_BlendTool.hxx>
#include <BRepBlend_HCurve2dTool.hxx>
#include <BRepClass_FaceClassifier.hxx>
@@ -134,3 +136,16 @@ void BRepBlend_BlendTool::Bounds(const Handle(Adaptor2d_HCurve2d)& A,
Ufirst = BRepBlend_HCurve2dTool::FirstParameter(A);
Ulast = BRepBlend_HCurve2dTool::LastParameter(A);
}
//=======================================================================
//function : IsSeam
//purpose :
//=======================================================================
Standard_Boolean BRepBlend_BlendTool::IsSeam(const Handle(Adaptor2d_HCurve2d)& C)
{
Handle(BRepAdaptor_HCurve2d) brhc =
Handle(BRepAdaptor_HCurve2d)::DownCast(C);
return BRepTools::IsReallyClosed(((BRepAdaptor_Curve2d *)&(brhc->Curve2d()))->Edge(),
((BRepAdaptor_Curve2d *)&(brhc->Curve2d()))->Face());
}

View File

@@ -76,6 +76,10 @@ public:
//! or a bounding box for an infinite arc.
Standard_EXPORT static void Bounds (const Handle(Adaptor2d_HCurve2d)& C, Standard_Real& Ufirst, Standard_Real& Ulast);
//! Returns the status of edge:
//! is it a seam edge or not
Standard_EXPORT static Standard_Boolean IsSeam (const Handle(Adaptor2d_HCurve2d)& C);
static Handle(Adaptor2d_HCurve2d) CurveOnSurf (const Handle(Adaptor2d_HCurve2d)& C, const Handle(Adaptor3d_HSurface)& S);

View File

@@ -682,7 +682,7 @@ void BRepMesh_Delaun::cleanupMesh()
if ( anEdges[aCurEdgeIdx] != aFreeEdgeId )
continue;
for ( Standard_Integer anOtherEdgeIt = 1; anOtherEdgeIt <= 2 && isCanNotBeRemoved; ++anOtherEdgeIt )
for ( Standard_Integer anOtherEdgeIt = 1; anOtherEdgeIt <= 2; ++anOtherEdgeIt )
{
Standard_Integer anOtherEdgeId = ( aCurEdgeIdx + anOtherEdgeIt ) % 3;
const BRepMesh_PairOfIndex& anOtherEdgePair =
@@ -691,27 +691,7 @@ void BRepMesh_Delaun::cleanupMesh()
if ( anOtherEdgePair.Extent() < 2 )
{
isCanNotBeRemoved = Standard_False;
}
else
{
for (int aTriIdx = 1; aTriIdx <= anOtherEdgePair.Extent () && isCanNotBeRemoved; ++aTriIdx)
{
if (anOtherEdgePair.Index (aTriIdx) == aTriId)
continue;
Standard_Integer v[3];
const BRepMesh_Triangle& aCurTriangle = GetTriangle (anOtherEdgePair.Index (aTriIdx));
myMeshData->ElementNodes (aCurTriangle, v);
for (int aNodeIdx = 0; aNodeIdx < 3 && isCanNotBeRemoved; ++aNodeIdx)
{
if (v[aNodeIdx] == mySupVert[0] ||
v[aNodeIdx] == mySupVert[1] ||
v[aNodeIdx] == mySupVert[2])
{
isCanNotBeRemoved = Standard_False;
}
}
}
break;
}
}

View File

@@ -57,11 +57,8 @@ BRepMesh_ShapeVisitor::~BRepMesh_ShapeVisitor ()
//=======================================================================
void BRepMesh_ShapeVisitor::Visit(const TopoDS_Edge& theEdge)
{
if (!myDEdgeMap.IsBound (theEdge))
{
myModel->AddEdge (theEdge);
myDEdgeMap.Bind (theEdge, myModel->EdgesNb () - 1);
}
myModel->AddEdge(theEdge);
myDEdgeMap.Bind(theEdge, myModel->EdgesNb() - 1);
}
//=======================================================================

View File

@@ -179,8 +179,7 @@ static
const TopTools_MapOfShape& theEdgesInvalidByVertex,
const TopTools_MapOfShape& theMFHoles,
TopTools_IndexedMapOfShape& theMFInvInHole,
TopTools_ListOfShape& theInvFaces,
TopTools_ListOfShape& theInvertedFaces);
TopTools_ListOfShape& theInvFaces);
static
void FindFacesInsideHoleWires(const TopoDS_Face& theFOrigin,
@@ -239,8 +238,6 @@ static
TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
const TopTools_DataMapOfShapeShape& theArtInvFaces,
const TopTools_IndexedMapOfShape& theInvEdges,
const TopTools_MapOfShape& theInvertedEdges,
const TopTools_ListOfShape& theInvertedFaces,
const TopTools_IndexedMapOfShape& theMFToCheckInt,
const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles,
@@ -261,7 +258,6 @@ static
const TopTools_DataMapOfShapeShape& theDMFImF,
const TopTools_IndexedMapOfShape& theMFInv,
const TopTools_IndexedMapOfShape& theInvEdges,
const TopTools_MapOfShape& theInvertedEdges,
TopTools_MapOfShape& theMFToRem);
static
@@ -600,21 +596,6 @@ static
void AppendToList(TopTools_ListOfShape& theL,
const TopoDS_Shape& theS);
template <class ContainerType, class FenceMapType>
static Standard_Boolean TakeModified(const TopoDS_Shape& theS,
const TopTools_DataMapOfShapeListOfShape& theImages,
ContainerType& theMapOut,
FenceMapType* theMFence);
template <class ContainerType>
static Standard_Boolean TakeModified(const TopoDS_Shape& theS,
const TopTools_DataMapOfShapeListOfShape& theImages,
ContainerType& theMapOut)
{
TopTools_MapOfShape* aDummy = NULL;
return TakeModified (theS, theImages, theMapOut, aDummy);
}
//=======================================================================
//function : BuildSplitsOfTrimmedFaces
//purpose : Building splits of already trimmed faces
@@ -1007,12 +988,6 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
}
#endif
#ifdef OFFSET_DEBUG
// Show all obtained splits of faces
TopoDS_Compound aCFIm1;
BRep_Builder().MakeCompound(aCFIm1);
#endif
// Build Edge-Face connectivity map to find faces which removal
// may potentially lead to creation of the holes in the faces
// preventing from obtaining closed volume in the result
@@ -1022,12 +997,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
{
TopTools_ListIteratorOfListOfShape itLFIm(theFImages(i));
for (; itLFIm.More(); itLFIm.Next())
{
TopExp::MapShapesAndAncestors(itLFIm.Value(), TopAbs_EDGE, TopAbs_FACE, anEFMap);
#ifdef OFFSET_DEBUG
BRep_Builder().Add(aCFIm1, itLFIm.Value());
#endif
}
}
TopTools_ListOfShape anEmptyList;
@@ -1036,8 +1006,6 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
// all hole faces
TopoDS_Compound aFHoles;
aBB.MakeCompound(aFHoles);
// Find the faces containing only the inverted edges and the invalid ones
TopTools_ListOfShape anInvertedFaces;
// find invalid faces
// considering faces containing only invalid edges as invalid
aItLF.Initialize(aLFDone);
@@ -1076,7 +1044,7 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
// find invalid faces
FindInvalidFaces(aLFImages, theInvEdges, theValidEdges, aDMFLVE, aDMFLIE,
*pLNE, *pLIVE, theInvertedEdges, aMEdgeInvalidByVertex,
aMFHoles, aMFInvInHole, aLFInv, anInvertedFaces);
aMFHoles, aMFInvInHole, aLFInv);
}
//
if (aLFInv.Extent()) {
@@ -1127,8 +1095,8 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
//
// remove inside faces
TopTools_IndexedMapOfShape aMEInside;
RemoveInsideFaces(theFImages, theInvFaces, theArtInvFaces, theInvEdges, theInvertedEdges,
anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles, theSSInterfs,
RemoveInsideFaces(theFImages, theInvFaces, theArtInvFaces, theInvEdges,
aMFToCheckInt, aMFInvInHole, aFHoles, theSSInterfs,
aMERemoved, aMEInside, theSolids);
//
// make compound of valid splits
@@ -1851,8 +1819,7 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
const TopTools_MapOfShape& theEdgesInvalidByVertex,
const TopTools_MapOfShape& theMFHoles,
TopTools_IndexedMapOfShape& theMFInvInHole,
TopTools_ListOfShape& theInvFaces,
TopTools_ListOfShape& theInvertedFaces)
TopTools_ListOfShape& theInvFaces)
{
// The face should be considered as invalid in the following cases:
// 1. It has been reverted, i.e. at least two not connected edges
@@ -1865,8 +1832,7 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
// The face will be kept in the following cases:
// 1. Some of the edges are valid for this face.
Standard_Boolean bHasValid, bAllValid, bAllInvalid, bHasReallyInvalid, bAllInvNeutral;
Standard_Boolean bValid, bValidLoc, bInvalid, bInvalidLoc, bNeutral, bInverted;
Standard_Boolean bIsInvalidByInverted;
Standard_Boolean bValid, bValidLoc, bInvalid, bInvalidLoc, bNeutral;
Standard_Integer i, aNbChecked;
//
// neutral edges
@@ -1883,7 +1849,7 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
aMEValInverted.Add(aItLE.Value());
}
//
Standard_Boolean bTreatInvertedAsInvalid = (theLFImages.Extent() == 1);
Standard_Boolean bCheckInverted = (theLFImages.Extent() == 1);
//
// neutral edges to remove
TopTools_IndexedMapOfShape aMENRem;
@@ -1917,7 +1883,6 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
bAllInvalid = Standard_True;
bHasReallyInvalid = Standard_False;
bAllInvNeutral = Standard_True;
bIsInvalidByInverted = Standard_True;
aNbChecked = 0;
//
const TopoDS_Wire& aWIm = BRepTools::OuterWire(aFIm);
@@ -1944,19 +1909,17 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
bNeutral = aMEN.Contains(aEIm);
bValidLoc = aMVE.Contains(aEIm);
//
bInverted = theMEInverted.Contains(aEIm);
if (!bInvalid && bTreatInvertedAsInvalid) {
bInvalid = bInverted;
if (!bInvalid && bCheckInverted) {
bInvalid = theMEInverted.Contains(aEIm);
}
//
if (bValidLoc && (bNeutral || aMEValInverted.Contains(aEIm))) {
bHasValid = Standard_True;
}
//
bAllValid &= bValidLoc;
bAllInvalid &= bInvalid;
bAllInvNeutral &= (bAllInvalid && bNeutral);
bIsInvalidByInverted &= (bInvalidLoc || bInverted);
bAllValid = bAllValid && bValidLoc;
bAllInvalid = bAllInvalid && bInvalid;
bAllInvNeutral = bAllInvNeutral && bAllInvalid && bNeutral;
}
//
if (!aNbChecked) {
@@ -1991,12 +1954,6 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
continue;
}
//
if (bIsInvalidByInverted && !(bHasValid || bAllValid))
{
// The face contains only the inverted and locally invalid edges
theInvertedFaces.Append(aFIm);
}
if (!bAllInvNeutral) {
aLFPT.Append(aFIm);
}
@@ -2046,7 +2003,7 @@ void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
bNeutral = aMEN.Contains(aEIm);
bValidLoc = aMVE.Contains(aEIm);
//
if (!bInvalid && bTreatInvertedAsInvalid) {
if (!bInvalid && bCheckInverted) {
bInvalid = theMEInverted.Contains(aEIm);
}
//
@@ -2916,8 +2873,6 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopTools_IndexedDataMapOfShapeListOfShape& theInvFaces,
const TopTools_DataMapOfShapeShape& theArtInvFaces,
const TopTools_IndexedMapOfShape& theInvEdges,
const TopTools_MapOfShape& theInvertedEdges,
const TopTools_ListOfShape& theInvertedFaces,
const TopTools_IndexedMapOfShape& theMFToCheckInt,
const TopTools_IndexedMapOfShape& theMFInvInHole,
const TopoDS_Shape& theFHoles,
@@ -2977,9 +2932,6 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
aMV.SetArguments(aLS);
aMV.SetIntersect(Standard_True);
aMV.Perform();
if (aMV.HasErrors())
return;
//
// get shapes connection for using in the rebuilding process
// for the cases in which some of the intersection left undetected
@@ -3064,21 +3016,19 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
TopExp::MapShapes(aFIm, TopAbs_EDGE, aMEBoundary);
}
}
// Tool for getting the splits of faces
const TopTools_DataMapOfShapeListOfShape& aMVIms = aMV.Images();
//
// update invalid faces with images
aNb = aMFInv.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Shape& aFInv = aMFInv(i);
TakeModified(aFInv, aMVIms, aMFInv);
const TopTools_ListOfShape& aLFInvIm = aMV.Modified(aFInv);
TopTools_ListIteratorOfListOfShape aItLFInvIm(aLFInvIm);
for (; aItLFInvIm.More(); aItLFInvIm.Next()) {
const TopoDS_Shape& aFInvIm = aItLFInvIm.Value();
aMFInv.Add(aFInvIm);
}
}
// Take into account the faces invalid by inverted edges
for (TopTools_ListOfShape::Iterator itLF(theInvertedFaces); itLF.More(); itLF.Next())
TakeModified(itLF.Value(), aMVIms, aMFInv);
//
// check if the invalid faces inside the holes are really invalid:
// check its normal direction - if it has changed relatively the
// original face the offset face is invalid and should be kept for rebuilding
@@ -3132,14 +3082,10 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
//
if (aFS.Orientation() == TopAbs_INTERNAL) {
aMFToRem.Add(aFS);
continue;
}
if (aMFToRem.Contains(aFS))
continue;
bAllRemoved = false;
bAllInv &= aMFInv.Contains(aFS);
//
bAllRemoved = bAllRemoved && aMFToRem.Contains(aFS);
bAllInv = bAllInv && (aMFToRem.Contains(aFS) || aMFInv.Contains(aFS));
}
//
if (bAllInv && !bAllRemoved) {
@@ -3170,7 +3116,7 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
}
// Remove the invalid hanging parts external to the solids
RemoveHangingParts(aMV, aDMFImF, aMFInv, theInvEdges, theInvertedEdges, aMFToRem);
RemoveHangingParts(aMV, aDMFImF, aMFInv, theInvEdges, aMFToRem);
// Remove newly found internal and hanging faces
RemoveValidSplits(aMFToRem, theFImages, aMV, theMERemoved);
@@ -3356,7 +3302,6 @@ void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
const TopTools_DataMapOfShapeShape& theDMFImF,
const TopTools_IndexedMapOfShape& theMFInv,
const TopTools_IndexedMapOfShape& theInvEdges,
const TopTools_MapOfShape& theInvertedEdges,
TopTools_MapOfShape& theMFToRem)
{
// Map the faces of the result solids to filter them from avoided faces
@@ -3378,7 +3323,22 @@ void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
for (; anExpF.More(); anExpF.Next())
{
const TopoDS_Shape& aF = anExpF.Current();
TakeModified(aF, aMVIms, aCFHangs, &aMFS);
const TopTools_ListOfShape* pLFIm = aMVIms.Seek(aF);
if (pLFIm)
{
TopTools_ListIteratorOfListOfShape aItLFIm(*pLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
{
const TopoDS_Shape& aFIm = aItLFIm.Value();
if (!aMFS.Contains(aFIm))
aBB.Add(aCFHangs, aFIm);
}
}
else
{
if (!aMFS.Contains(aF))
aBB.Add(aCFHangs, aF);
}
}
}
@@ -3404,41 +3364,27 @@ void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
// Update invalid edges with intersection results
TopTools_MapOfShape aMEInv;
Standard_Integer i, aNbE = theInvEdges.Extent();
for (i = 1; i <= aNbE; ++i)
TakeModified(theInvEdges(i), aMVIms, aMEInv);
// Update inverted edges with intersection results
TopTools_MapOfShape aMEInverted;
for (TopTools_MapIteratorOfMapOfShape itM(theInvertedEdges); itM.More(); itM.Next())
TakeModified(itM.Value(), aMVIms, aMEInverted);
for (i = 1; i <= aNbE; ++i) {
const TopoDS_Shape& aEInv = theInvEdges(i);
const TopTools_ListOfShape *pLEIm = aMVIms.Seek(aEInv);
if (pLEIm)
{
TopTools_ListIteratorOfListOfShape aItLEIm(*pLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
aMEInv.Add(aItLEIm.Value());
}
else
aMEInv.Add(aEInv);
}
// Tool for getting the origins of the splits
const TopTools_DataMapOfShapeListOfShape& aMVOrs = theMV.Origins();
// Find hanging blocks to remove
TopTools_ListOfShape aBlocksToRemove;
TopTools_ListIteratorOfListOfShape aItLCBH(aLCBHangs);
for (; aItLCBH.More(); aItLCBH.Next())
{
const TopoDS_Shape& aCBH = aItLCBH.Value();
// Remove the block containing the inverted edges
Standard_Boolean bHasInverted = Standard_False;
TopExp_Explorer anExpE(aCBH, TopAbs_EDGE);
for (; anExpE.More() && !bHasInverted; anExpE.Next())
{
const TopoDS_Shape& aE = anExpE.Current();
bHasInverted = !aDMEF .Contains(aE) &&
aMEInverted.Contains(aE);
}
if (bHasInverted)
{
aBlocksToRemove.Append(aCBH);
continue;
}
// Check the block to contain invalid split
Standard_Boolean bHasInvalidFace = Standard_False;
// Check connectivity to invalid parts
@@ -3460,7 +3406,7 @@ void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
if (!bIsConnected)
{
// check edges
anExpE.Init(aF, TopAbs_EDGE);
TopExp_Explorer anExpE(aF, TopAbs_EDGE);
for (; anExpE.More() && !bIsConnected; anExpE.Next())
{
const TopoDS_Shape& aE = anExpE.Current();
@@ -3473,20 +3419,17 @@ void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
}
}
// check vertices
if (!bIsConnected)
TopExp_Explorer anExpV(aF, TopAbs_VERTEX);
for (; anExpV.More() && !bIsConnected; anExpV.Next())
{
TopExp_Explorer anExpV(aF, TopAbs_VERTEX);
for (; anExpV.More() && !bIsConnected; anExpV.Next())
const TopoDS_Shape& aV = anExpV.Current();
const TopTools_ListOfShape *pLE = aDMVE.Seek(aV);
if (pLE)
{
const TopoDS_Shape& aV = anExpV.Current();
const TopTools_ListOfShape *pLE = aDMVE.Seek(aV);
if (pLE)
{
TopTools_ListIteratorOfListOfShape aItLE(*pLE);
for (; aItLE.More() && !bIsConnected; aItLE.Next())
bIsConnected = !aBlockME.Contains(aItLE.Value()) &&
aMEInv .Contains(aItLE.Value());
}
TopTools_ListIteratorOfListOfShape aItLE(*pLE);
for (; aItLE.More() && !bIsConnected; aItLE.Next())
bIsConnected = !aBlockME.Contains(aItLE.Value()) &&
aMEInv .Contains(aItLE.Value());
}
}
}
@@ -3515,17 +3458,12 @@ void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
(!bIsConnected || aMOffsetF.Extent() == 1);
if (bRemove)
aBlocksToRemove.Append(aCBH);
}
// remove the invalidated blocks
aItLCBH.Initialize(aBlocksToRemove);
for (; aItLCBH.More(); aItLCBH.Next())
{
const TopoDS_Shape& aCBH = aItLCBH.Value();
TopExp_Explorer anExpF(aCBH, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
theMFToRem.Add(anExpF.Current());
{
// remove the block
anExpF.Init(aCBH, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
theMFToRem.Add(anExpF.Current());
}
}
}
@@ -6986,16 +6924,13 @@ void UpdateImages(const TopTools_ListOfShape& theLA,
TopTools_MapOfShape& theModified)
{
TopTools_ListIteratorOfListOfShape aIt(theLA);
for (; aIt.More(); aIt.Next())
{
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
//
TopTools_ListOfShape* pLSIm = theImages.ChangeSeek(aS);
if (!pLSIm)
{
if (!pLSIm) {
const TopTools_ListOfShape& aLSIm = theGF.Modified(aS);
if (aLSIm.Extent())
{
if (aLSIm.Extent()) {
theImages.Bind(aS, aLSIm);
theModified.Add(aS);
}
@@ -7009,14 +6944,27 @@ void UpdateImages(const TopTools_ListOfShape& theLA,
//
// check modifications of the images
TopTools_ListIteratorOfListOfShape aIt1(*pLSIm);
for (; aIt1.More(); aIt1.Next())
{
for (; aIt1.More(); aIt1.Next()) {
const TopoDS_Shape& aSIm = aIt1.Value();
bModified |= TakeModified(aSIm, theGF.Images(), aLSImNew, &aMFence);
const TopTools_ListOfShape& aLSIm1 = theGF.Modified(aSIm);
if (aLSIm1.IsEmpty()) {
if (aMFence.Add(aSIm)) {
aLSImNew.Append(aSIm);
}
}
else {
TopTools_ListIteratorOfListOfShape aIt2(aLSIm1);
for (; aIt2.More(); aIt2.Next()) {
const TopoDS_Shape& aSImIm = aIt2.Value();
if (aMFence.Add(aSImIm)) {
aLSImNew.Append(aSImIm);
}
}
bModified = Standard_True;
}
}
//
if (bModified)
{
if (bModified) {
*pLSIm = aLSImNew;
theModified.Add(aS);
}
@@ -7151,61 +7099,3 @@ void AppendToList(TopTools_ListOfShape& theList,
}
theList.Append(theShape);
}
//=======================================================================
//function : AddToContainer
//purpose : Set of methods to add a shape into container
//=======================================================================
static void AddToContainer(const TopoDS_Shape& theS,
TopTools_ListOfShape& theList)
{
theList.Append(theS);
}
static Standard_Boolean AddToContainer(const TopoDS_Shape& theS,
TopTools_MapOfShape& theMap)
{
return theMap.Add(theS);
}
static Standard_Boolean AddToContainer(const TopoDS_Shape& theS,
TopTools_IndexedMapOfShape& theMap)
{
const Standard_Integer aNb = theMap.Extent();
const Standard_Integer anInd = theMap.Add(theS);
return anInd > aNb;
}
static void AddToContainer(const TopoDS_Shape& theS,
TopoDS_Shape& theSOut)
{
BRep_Builder().Add(theSOut, theS);
}
//=======================================================================
//function : TakeModified
//purpose : Check if the shape has images in the given images map.
// Puts in the output map either the images or the shape itself.
//=======================================================================
template <class ContainerType, class FenceMapType>
Standard_Boolean TakeModified(const TopoDS_Shape& theS,
const TopTools_DataMapOfShapeListOfShape& theImages,
ContainerType& theContainer,
FenceMapType* theMFence)
{
const TopTools_ListOfShape *pLSIm = theImages.Seek(theS);
if (pLSIm)
{
TopTools_ListIteratorOfListOfShape itLSIm(*pLSIm);
for (; itLSIm.More(); itLSIm.Next())
{
const TopoDS_Shape& aSIm = itLSIm.Value();
if (!theMFence || AddToContainer(aSIm, *theMFence))
AddToContainer(aSIm, theContainer);
}
return Standard_True;
}
else
{
if (!theMFence || AddToContainer(theS, *theMFence))
AddToContainer(theS, theContainer);
return Standard_False;
}
}

View File

@@ -41,7 +41,15 @@ Standard_Integer Blend_Walking::ArcToRecadre(const Standard_Boolean OnFirst,
lastpt2d.SetCoord(uprev,vprev);
Iter->Init();
while (Iter->More()) {
nbarc++; ok = 0;
if (TheBlendTool::IsSeam(Iter->Value()))
{
Iter->Next();
continue;
}
if (OnFirst) {
if(byinter) {
ok = okinter = TheBlendTool::Inters(pt2d,lastpt2d,

View File

@@ -200,10 +200,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
rsnld.Root(sol);
if(clasonS1) situ1 = domain1->Classify(gp_Pnt2d(sol(1),sol(2)),
Min(tolerance(1),tolerance(2)),0);
Min(tolerance(1),tolerance(2)),Standard_True/*0*/);
else situ1 = TopAbs_IN;
if(clasonS2) situ2 = domain2->Classify(gp_Pnt2d(sol(3),sol(4)),
Min(tolerance(3),tolerance(4)),0);
Min(tolerance(3),tolerance(4)),Standard_True/*0*/);
else situ2 = TopAbs_IN;
}
if(bonpoint && line->NbPoints() == 1 && (situ1 != TopAbs_IN || situ2 != TopAbs_IN)){

View File

@@ -83,7 +83,7 @@ public:
//! Transform the bounding box with the given transformation.
//! The resulting box will be larger if theTrsf contains rotation.
Standard_EXPORT Standard_NODISCARD Bnd_B2d Transformed (const gp_Trsf2d& theTrsf) const;
Standard_EXPORT Bnd_B2d Transformed (const gp_Trsf2d& theTrsf) const;
//! Check the given point for the inclusion in the Box.
//! Returns True if the point is outside.

View File

@@ -84,7 +84,7 @@ public:
//! Transform the bounding box with the given transformation.
//! The resulting box will be larger if theTrsf contains rotation.
Standard_EXPORT Standard_NODISCARD Bnd_B2f Transformed (const gp_Trsf2d& theTrsf) const;
Standard_EXPORT Bnd_B2f Transformed (const gp_Trsf2d& theTrsf) const;
//! Check the given point for the inclusion in the Box.
//! Returns True if the point is outside.

View File

@@ -84,7 +84,7 @@ public:
//! Transform the bounding box with the given transformation.
//! The resulting box will be larger if theTrsf contains rotation.
Standard_EXPORT Standard_NODISCARD Bnd_B3d Transformed (const gp_Trsf& theTrsf) const;
Standard_EXPORT Bnd_B3d Transformed (const gp_Trsf& theTrsf) const;
//! Check the given point for the inclusion in the Box.
//! Returns True if the point is outside.

View File

@@ -85,7 +85,7 @@ public:
//! Transform the bounding box with the given transformation.
//! The resulting box will be larger if theTrsf contains rotation.
Standard_EXPORT Standard_NODISCARD Bnd_B3f Transformed (const gp_Trsf& theTrsf) const;
Standard_EXPORT Bnd_B3f Transformed (const gp_Trsf& theTrsf) const;
//! Check the given point for the inclusion in the Box.
//! Returns True if the point is outside.

View File

@@ -213,7 +213,7 @@ public:
//! Applying a geometric transformation (for example, a
//! rotation) to a bounding box generally increases its
//! dimensions. This is not optimal for algorithms which use it.
Standard_EXPORT Standard_NODISCARD Bnd_Box Transformed (const gp_Trsf& T) const;
Standard_EXPORT Bnd_Box Transformed (const gp_Trsf& T) const;
//! Adds the box <Other> to <me>.
Standard_EXPORT void Add (const Bnd_Box& Other);

View File

@@ -160,7 +160,7 @@ public:
//! Applying a geometric transformation (for example, a
//! rotation) to a bounding box generally increases its
//! dimensions. This is not optimal for algorithms which use it.
Standard_EXPORT Standard_NODISCARD Bnd_Box2d Transformed (const gp_Trsf2d& T) const;
Standard_EXPORT Bnd_Box2d Transformed (const gp_Trsf2d& T) const;
//! Adds the 2d box <Other> to <me>.
Standard_EXPORT void Add (const Bnd_Box2d& Other);

View File

@@ -45,6 +45,8 @@
#include <ChFiDS_Stripe.hxx>
#include <ChFiDS_SurfData.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <GCE2d_MakeLine.hxx>
#include <Geom_Surface.hxx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
@@ -68,6 +70,8 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
//#include <BRepAlgoAPI_Fuse.hxx>
#include <BOPAlgo_Builder.hxx>
#include <TopOpeBRepBuild_HBuilder.hxx>
#include <TopOpeBRepDS_BuildTool.hxx>
#include <TopOpeBRepDS_Curve.hxx>
@@ -79,6 +83,9 @@
#include <TopOpeBRepDS_PointIterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <BRepTools_ReShape.hxx>
#include <BRepTools.hxx>
#ifdef OCCT_DEBUG
#include <OSD_Chronometer.hxx>
@@ -107,6 +114,450 @@ extern Standard_Boolean ChFi3d_GettraceCHRON();
#endif
//=======================================================================
//function : NearestWholePeriod
//purpose :
//=======================================================================
Standard_Real NearestWholePeriod(const Standard_Real theValue,
const Standard_Real thePeriod,
const Standard_Boolean theFromBelow)
{
Standard_Real Result = 0.;
Standard_Real Sign = (theValue < 0.)? -1 : 1;
while (Abs(Result - theValue) > thePeriod)
Result += Sign * thePeriod;
if (Result > theValue && theFromBelow)
Result -= thePeriod;
return Result;
}
//=======================================================================
//function : FindPeriod
//purpose :
//=======================================================================
Standard_Real FindPeriod(const TopoDS_Face& theFace,
const Standard_Boolean theIsUdirection)
{
Standard_Real aPeriod = 0.;
BRepAdaptor_Surface BAsurf(theFace, Standard_False);
if (theIsUdirection)
{
if (BAsurf.IsUPeriodic())
aPeriod = BAsurf.UPeriod();
else
{
Standard_Real Umin = BAsurf.FirstUParameter(),
Umax = BAsurf.LastUParameter();
aPeriod = Umax - Umin;
}
}
else
{
//temporary
}
return aPeriod;
}
//=======================================================================
//function : ContainsEdge
//purpose :
//=======================================================================
Standard_Boolean ContainsEdge(const TopoDS_Shape& theShape,
const TopoDS_Shape& theEdge)
{
TopExp_Explorer Explo(theShape, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
if (anEdge.IsSame(theEdge))
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : FindProperSubShape
//purpose :
//=======================================================================
TopoDS_Shape FindProperSubShape(const TopoDS_Shape& theNewFace,
const TopoDS_Shape& theShape)
{
TopoDS_Shape NullShape;
TopTools_IndexedMapOfShape Emap;
TopExp::MapShapes(theNewFace, TopAbs_EDGE, Emap);
TopoDS_Iterator iter(theShape);
for (; iter.More(); iter.Next())
{
const TopoDS_Shape& aShape = iter.Value();
if (aShape.ShapeType() == TopAbs_FACE)
{
TopExp_Explorer Explo(aShape, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
if (Emap.Contains(anEdge))
return theShape;
}
}
else
{
TopoDS_Shape aResult = FindProperSubShape(theNewFace, aShape);
if (!aResult.IsNull())
return aResult;
}
}
return NullShape;
}
//=======================================================================
//function : DeleteEdgesFromMap
//purpose :
//=======================================================================
void DeleteEdgesFromMap(TopTools_IndexedDataMapOfShapeListOfShape& theVEmap,
const TopTools_SequenceOfShape& theEdges,
//const TopoDS_Edge& theCurEdge,
const TopoDS_Edge& theNextEdge,
const TopoDS_Vertex& theVertex,
const Standard_Integer theIndOr)
{
for (Standard_Integer i = 1; i <= theEdges.Length(); i++)
{
const TopoDS_Edge& anEdge = TopoDS::Edge(theEdges(i));
if (anEdge == theNextEdge)
continue;
TopoDS_Vertex VV [2];
TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
if (VV[theIndOr].IsSame(theVertex))
{
//theDeletedEdges.Append(anEdge);
for (Standard_Integer j = 1; j <= theVEmap.Extent(); j++)
{
TopoDS_Vertex aVertex = TopoDS::Vertex(theVEmap.FindKey(j));
TopTools_ListIteratorOfListOfShape itl(theVEmap(j));
for (; itl.More(); itl.Next())
{
if (anEdge == itl.Value())
{
theVEmap(j).Remove(itl);
break;
}
}
}
}
}
}
//=======================================================================
//function : BuildNewWire
//purpose :
//=======================================================================
TopoDS_Wire BuildNewWire(const TopoDS_Wire& theWire,
TopTools_IndexedDataMapOfShapeListOfShape& theVEmap,
//const TopoDS_Compound& theNewEdges,
const TopTools_IndexedMapOfShape& theNewEdges,
const TopoDS_Face& theFace)
{
//Temporary
BRep_Builder BB;
TopoDS_Compound aNE;
BB.MakeCompound(aNE);
for (Standard_Integer ind = 1; ind <= theNewEdges.Extent(); ind++)
{
const TopoDS_Shape& aNewEdge = theNewEdges(ind);
BB.Add(aNE, aNewEdge);
}
///////////
Standard_Boolean Uclosed, Vclosed;
Standard_Real Uperiod = 0., Vperiod = 0.;
BRepTools::DetectClosedness(theFace, Uclosed, Vclosed);
if (Uclosed)
Uperiod = FindPeriod(theFace, Standard_True);
if (Vclosed)
Vperiod = FindPeriod(theFace, Standard_False);
TopTools_IndexedMapOfShape OldVertices;
TopExp::MapShapes(theWire, TopAbs_VERTEX, OldVertices);
//TopExp::MapShapes(theNewEdges, TopAbs_EDGE, NewEdges);
//Find <StartEdge>, <StartVertex> and calculate minimum distance
//between extremities of edge in 2d
TopoDS_Vertex StartVertex;
TopoDS_Edge StartEdge, SecondEdge;
Standard_Real MinDist = RealLast();
TopTools_ListIteratorOfListOfShape itl;
TopTools_MapOfOrientedShape Emap;
for (Standard_Integer i = 1; i <= OldVertices.Extent(); i++)
{
TopoDS_Vertex aVertex = TopoDS::Vertex(OldVertices(i));
const TopTools_ListOfShape& Elist = theVEmap.FindFromKey(aVertex);
for (itl.Initialize(Elist); itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
if (!Emap.Add(anEdge))
continue;
if (StartEdge.IsNull() &&
theNewEdges.Contains(anEdge))
{
//StartEdge = anEdge;
Standard_Integer anIndex = theNewEdges.FindIndex(anEdge);
StartEdge = TopoDS::Edge(theNewEdges(anIndex));
StartVertex = aVertex;
}
BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
gp_Pnt2d aFirstPoint = BAcurve.Value(BAcurve.FirstParameter());
gp_Pnt2d aLastPoint = BAcurve.Value(BAcurve.LastParameter());
Standard_Real aDist = aFirstPoint.SquareDistance(aLastPoint);
if (aDist < MinDist)
MinDist = aDist;
}
}
if (StartEdge.IsNull())
return theWire;
TopoDS_Wire NewWire;
//BRep_Builder BB;
BB.MakeWire(NewWire);
BB.Add(NewWire, StartEdge);
//Define the direction of loop: forward or reversed
TopAbs_Orientation Direction;
Standard_Integer IndOr;
//Here and further orientation of edge is taken into account
TopoDS_Vertex V1 = TopExp::FirstVertex(StartEdge, Standard_True);
if (V1.IsSame(StartVertex))
{
Direction = TopAbs_FORWARD;
IndOr = 0;
}
else
{
Direction = TopAbs_REVERSED;
IndOr = 1;
}
BRepAdaptor_Curve2d StartBAcurve(StartEdge, theFace);
Standard_Real StartParam = BRep_Tool::Parameter(StartVertex, StartEdge);
gp_Pnt2d StartPoint = StartBAcurve.Value(StartParam);
//Find second edge;
TopTools_SequenceOfShape Candidates; //, DeletedEdges;
TopoDS_Vertex VV [2];
//Main loop
TopoDS_Edge CurEdge = StartEdge, NextEdge, PrevEdge;
TopoDS_Vertex CurVertex = (Direction == TopAbs_FORWARD)?
TopExp::LastVertex(CurEdge, Standard_True) :
TopExp::FirstVertex(CurEdge, Standard_True);
BRepAdaptor_Curve2d CurCurve(CurEdge, theFace);
Standard_Real CurParam = BRep_Tool::Parameter(CurVertex, CurEdge);
gp_Pnt2d CurPoint = CurCurve.Value(CurParam);
Standard_Boolean IsPrevSeamJustBuilt = Standard_False;
for (;;)
{
const TopTools_ListOfShape& Elist = theVEmap.FindFromKey(CurVertex);
Candidates.Clear();
Standard_Boolean ToAdd = Standard_True;
//Standard_Boolean IsPrevEdgeCorrect = Standard_True;
//Candidates are the edges close to <CurPoint> in 2d
for (itl.Initialize(Elist); itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
if (anEdge.IsSame(CurEdge))
continue;
BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
gp_Pnt2d aPoint = BAcurve.Value(BAcurve.FirstParameter());
Standard_Real aDist = CurPoint.SquareDistance(aPoint);
if (aDist < MinDist)
Candidates.Append(anEdge);
else
{
aPoint = BAcurve.Value(BAcurve.LastParameter());
aDist = CurPoint.SquareDistance(aPoint);
if (aDist < MinDist)
Candidates.Append(anEdge);
}
}
TopoDS_Edge NextEdge, aCandidate;
if (Candidates.IsEmpty()) //hanging edge
{
//need to build additional edges
Standard_Real fpar, lpar;
if (BRep_Tool::Degenerated(CurEdge) &&
!BRep_Tool::Degenerated(PrevEdge))
{
//enlarge current degenerated edge
TopoDS_Vertex OtherVertex = CurVertex;
OtherVertex.Reverse();
Standard_Real OtherParam = BRep_Tool::Parameter(OtherVertex, CurEdge);
gp_Pnt2d OtherPoint = CurCurve.Value(OtherParam);
if (Uclosed)
{
Standard_Real DirOfCurEdge = CurPoint.X() - OtherPoint.X();
Standard_Boolean FromBelow = (DirOfCurEdge < 0.);
Standard_Real NewX = NearestWholePeriod( CurPoint.X(), Uperiod, FromBelow );
CurPoint.SetX(NewX);
}
Handle(Geom2d_Line) aLine;
if (CurEdge.Orientation() == TopAbs_FORWARD)
aLine = GCE2d_MakeLine(OtherPoint, CurPoint);
else
aLine = GCE2d_MakeLine(CurPoint, OtherPoint);
BB.UpdateEdge(CurEdge, aLine, theFace, 0.);
BB.Range(CurEdge, 0., CurPoint.Distance(OtherPoint));
NextEdge = CurEdge;
IsPrevSeamJustBuilt = Standard_False;
ToAdd = Standard_False;
}
else if (IsPrevSeamJustBuilt)
{
//Find degenerated edge and enlarge it
for (itl.Initialize(Elist); itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
if (anEdge.IsSame(CurEdge))
continue;
if (BRep_Tool::Degenerated(anEdge))
{
//enlarge found degenerated edge
TopoDS_Vertex OtherVertex = CurVertex;
if (anEdge.Orientation() == TopAbs_FORWARD)
OtherVertex.Reverse();
Standard_Real OtherParam = BRep_Tool::Parameter(OtherVertex, anEdge);
BRepAdaptor_Curve2d aCurve(anEdge, theFace);
gp_Pnt2d OtherPoint = aCurve.Value(OtherParam);
Handle(Geom2d_Line) aLine;
if (anEdge.Orientation() == TopAbs_FORWARD)
aLine = GCE2d_MakeLine(OtherPoint, CurPoint);
else
aLine = GCE2d_MakeLine(CurPoint, OtherPoint);
BB.UpdateEdge(anEdge, aLine, theFace, 0.);
BB.Range(anEdge, 0., CurPoint.Distance(OtherPoint));
NextEdge = anEdge;
IsPrevSeamJustBuilt = Standard_False;
}
}
}
else
{
//build additional seam edge from existing edge
for (itl.Initialize(Elist); itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
if (anEdge.IsSame(CurEdge))
continue;
TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
if (VV[1-IndOr].IsSame(CurVertex))
{
if (!BRep_Tool::IsClosed(anEdge, theFace))
{
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
Standard_Real aParam = BRep_Tool::Parameter(CurVertex, anEdge);
gp_Pnt2d aPoint = aPCurve->Value(aParam);
gp_Vec2d Offset(0.,0.);
if (Uclosed)
Offset.SetX( CurPoint.X() - aPoint.X() );
else
Offset.SetY( CurPoint.Y() - aPoint.Y() );
Handle(Geom2d_Curve) aPCurve2 = Handle(Geom2d_Curve)::DownCast(aPCurve->Translated(Offset));
BB.UpdateEdge(anEdge, aPCurve, aPCurve2, theFace, 0.);
}
NextEdge = TopoDS::Edge(anEdge.Reversed());
IsPrevSeamJustBuilt = Standard_True;
break;
}
}
}
}
for (Standard_Integer i = 1; i <= Candidates.Length(); i++)
{
IsPrevSeamJustBuilt = Standard_False;
const TopoDS_Edge& anEdge = TopoDS::Edge(Candidates(i));
if (theNewEdges.Contains(anEdge))
{
TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
if (VV[IndOr].IsSame(CurVertex))
{
BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
Standard_Real aParam = BRep_Tool::Parameter(CurVertex, anEdge);
gp_Pnt2d aPoint = BAcurve.Value(aParam);
Standard_Real aDist = CurPoint.SquareDistance(aPoint);
if (aDist < MinDist)
{
NextEdge = anEdge;
break;
}
}
else //previous edge is incorrect
{
//error ?
//remove previous edge from wire
//build additional edges
//NextEdge = anEdge;
}
}
else if (aCandidate.IsNull())
{
TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
if (VV[IndOr].IsSame(CurVertex))
{
BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
Standard_Real aParam = BRep_Tool::Parameter(VV[IndOr], anEdge);
gp_Pnt2d aPoint = BAcurve.Value(aParam);
Standard_Real aDist = CurPoint.SquareDistance(aPoint);
if (aDist < MinDist)
aCandidate = anEdge;
}
}
}
if (NextEdge.IsNull())
NextEdge = aCandidate;
DeleteEdgesFromMap(theVEmap, Candidates, NextEdge, CurVertex, 1-IndOr);
PrevEdge = CurEdge;
CurEdge = NextEdge;
CurVertex = (Direction == TopAbs_FORWARD)?
TopExp::LastVertex(CurEdge, Standard_True) :
TopExp::FirstVertex(CurEdge, Standard_True);
CurCurve.Initialize(CurEdge, theFace);
CurParam = BRep_Tool::Parameter(CurVertex, CurEdge);
CurPoint = CurCurve.Value(CurParam);
if (ToAdd)
BB.Add(NewWire, CurEdge);
if (CurVertex.IsSame(StartVertex) &&
CurPoint.SquareDistance(StartPoint) < MinDist)
break;
}
return NewWire;
}
//=======================================================================
//function : CompleteDS
//purpose :
@@ -372,7 +823,7 @@ void ChFi3d_Builder::Compute()
if (done) {
BRep_Builder B1;
BRep_Builder BB;
CompleteDS(DStr,myShape);
//Update tolerances on vertex to max adjacent edges or
//Update tolerances on degenerated edge to max of adjacent vertexes.
@@ -398,7 +849,7 @@ void ChFi3d_Builder::Compute()
if( tolc < tolv ) tolc = tolv + 0.00001;
}
if(degen && tolc < tolv) tolc = tolv;
else if(tolc>tolv) B1.UpdateVertex(v,tolc);
else if(tolc>tolv) BB.UpdateVertex(v,tolc);
}
else if(gk == TopOpeBRepDS_POINT){
TopOpeBRepDS_Point& p = DStr.ChangePoint(gi);
@@ -409,7 +860,324 @@ void ChFi3d_Builder::Compute()
}
if(degen) c.Tolerance(tolc);
}
//jgv
//for (on modified faces)
//compound of wires from each face
//compound of new edges for this face
//general fuse (compound of wires from a face, compound of new edges for this face)
//method building new face from old and new edges
//assembling of resulting shape from modified and unmodified faces.
TopTools_ListOfShape aChFiFaces;
TopTools_IndexedDataMapOfShapeShape aFacesModifiedFaces;
TopTools_IndexedMapOfShape MapNewEdges;
//TopTools_DataMapOfShapeListOfShape FaceListEdges;
NCollection_DataMap<TopoDS_Shape, TopTools_IndexedMapOfShape> FaceMapEdges;
BOPAlgo_Builder GenFuse;
for (Standard_Integer i = 1; i <= myNewFaces.Extent(); i++)
{
TopoDS_Face aFace = TopoDS::Face(myNewFaces(i));
//TopAbs_Orientation anOrOfFace = aFace.Orientation();
aFace.Orientation(TopAbs_FORWARD);
TopTools_IndexedMapOfShape* aEmap = FaceMapEdges.Bound(aFace, TopTools_IndexedMapOfShape());
//TopoDS_Compound aNewEdges;
//BB.MakeCompound(aNewEdges);
//TopTools_ListOfShape ListNewEdges;
//ChFi3d_ListIteratorOfListOfQualifiedEdge itl(myFaceNewEdges.FindFromKey(i));
TColStd_ListIteratorOfListOfInteger itl(myFaceNewEdges.FindFromKey(i));
for (; itl.More(); itl.Next())
{
Standard_Integer aSignedIndex = itl.Value();
Standard_Integer anIndex = Abs(aSignedIndex);
TopoDS_Shape aNewEdge = myNewEdges(anIndex);
TopAbs_Orientation anOr = (aSignedIndex > 0)?
TopAbs_FORWARD : TopAbs_REVERSED;
aNewEdge.Orientation(anOr);
//BB.Add(aNewEdges, aNewEdge);
//ListNewEdges.Append(aNewEdge);
aEmap->Add(aNewEdge);
}
if (myIndsChFiFaces.Contains(i)) //absolutely new face
{
}
else //a modified old face
{
GenFuse.AddArgument(aFace);
//TopTools_ListIteratorOfListOfShape itl(ListNewEdges);
//for (; itl.More(); itl.Next())
//MapNewEdges.Add(itl.Value());
for (Standard_Integer iedge = 1; iedge <= aEmap->Extent(); iedge++)
MapNewEdges.Add(aEmap->FindKey(iedge));
}
}
//Fusing
//GenFuse.AddArgument(aNewEdges);
for (Standard_Integer i = 1; i <= MapNewEdges.Extent(); i++)
GenFuse.AddArgument(MapNewEdges(i));
GenFuse.Perform();
//Temporary
const TopoDS_Shape& aResFuse = GenFuse.Shape();
///////////
const TopTools_DataMapOfShapeListOfShape& ModifiedShapes = GenFuse.Images();
for (Standard_Integer i = 1; i <= myNewFaces.Extent(); i++)
{
TopoDS_Face aFace = TopoDS::Face(myNewFaces(i));
if (myIndsChFiFaces.Contains(i)) //absolutely new face
{
TopAbs_Orientation anOrOfFace = aFace.Orientation();
aFace.Orientation(TopAbs_FORWARD);
TopoDS_Wire aWire;
BB.MakeWire(aWire);
for (Standard_Integer iedge = 1; iedge <= FaceMapEdges(aFace).Extent(); iedge++)
{
const TopoDS_Shape& anEdge = FaceMapEdges(aFace).FindKey(iedge);
TopAbs_Orientation anOr = anEdge.Orientation();
if (ModifiedShapes.IsBound(anEdge))
{
const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(anEdge);
TopTools_ListIteratorOfListOfShape itl(aListOfSplits);
for (; itl.More(); itl.Next())
BB.Add(aWire, itl.Value().Oriented(anOr));
}
else
BB.Add(aWire, anEdge);
}
BB.Add(aFace, aWire);
aFace.Orientation(anOrOfFace);
aChFiFaces.Append(aFace);
}
else //modify old face
{
//Build compound for construction of new face
const TopTools_ListOfShape& aListOfModifiedFromFace = ModifiedShapes(aFace);
TopoDS_Compound ResFuseForFace;
BB.MakeCompound(ResFuseForFace);
TopTools_ListIteratorOfListOfShape itl(aListOfModifiedFromFace);
for (; itl.More(); itl.Next())
BB.Add(ResFuseForFace, itl.Value());
//Update FaceMapEdges(aFace)
TopTools_ListOfShape ToDelete, ToAdd;
for (Standard_Integer ind = 1; ind <= FaceMapEdges(aFace).Extent(); ind++)
{
const TopoDS_Shape& aNewEdgeOfFace = FaceMapEdges(aFace)(ind);
TopAbs_Orientation anOr = aNewEdgeOfFace.Orientation();
if (ModifiedShapes.IsBound(aNewEdgeOfFace))
{
const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(aNewEdgeOfFace);
for (itl.Initialize(aListOfSplits); itl.More(); itl.Next())
ToAdd.Append(itl.Value().Oriented(anOr));
ToDelete.Append(aNewEdgeOfFace);
}
}
for (itl.Initialize(ToDelete); itl.More(); itl.Next())
FaceMapEdges(aFace).RemoveKey(itl.Value());
for (itl.Initialize(ToAdd); itl.More(); itl.Next())
FaceMapEdges(aFace).Add(itl.Value());
//Build the map of splits for edges of old face
TopTools_MapOfShape Splits;
TopExp_Explorer Explo(aFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
if (ModifiedShapes.IsBound(anEdge))
{
const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(anEdge);
for (itl.Initialize(aListOfSplits); itl.More(); itl.Next())
Splits.Add(itl.Value());
}
}
ToDelete.Clear();
for (Standard_Integer ind = 1; ind <= FaceMapEdges(aFace).Extent(); ind++)
{
const TopoDS_Shape& aNewEdgeOfFace = FaceMapEdges(aFace)(ind);
if (Splits.Contains(aNewEdgeOfFace))
{
ToDelete.Append(aNewEdgeOfFace);
continue;
}
TopAbs_Orientation anOr = aNewEdgeOfFace.Orientation();
if (ModifiedShapes.IsBound(aNewEdgeOfFace))
{
const TopTools_ListOfShape& aListOfModifiedFromEdge = ModifiedShapes(aNewEdgeOfFace);
for (itl.Initialize(aListOfModifiedFromEdge); itl.More(); itl.Next())
{
const TopoDS_Shape& aModifiedNewEdgeOfFace = itl.Value();
if (!ContainsEdge(ResFuseForFace, aModifiedNewEdgeOfFace))
BB.Add(ResFuseForFace, aModifiedNewEdgeOfFace.Oriented(anOr));
}
}
else
BB.Add(ResFuseForFace, aNewEdgeOfFace);
}
for (itl.Initialize(ToDelete); itl.More(); itl.Next())
FaceMapEdges(aFace).RemoveKey(itl.Value());
TopTools_IndexedDataMapOfShapeListOfShape VEmapOfNewFace;
TopExp::MapShapesAndUniqueAncestors(ResFuseForFace, TopAbs_VERTEX, TopAbs_EDGE,
VEmapOfNewFace, Standard_True); //with orientation
TopoDS_Shape aNewFace = aFace.EmptyCopied();
TopoDS_Iterator itw(aFace);
for (; itw.More(); itw.Next())
{
const TopoDS_Shape& aWire = itw.Value();
TopTools_ListOfShape ListOfWires;
if (ModifiedShapes.IsBound(aWire))
{
const TopTools_ListOfShape& aListOfModified = ModifiedShapes(aWire);
for (itl.Initialize(aListOfModified); itl.More(); itl.Next())
ListOfWires.Append(itl.Value());
}
else
ListOfWires.Append(aWire);
for (itl.Initialize(ListOfWires); itl.More(); itl.Next())
{
const TopoDS_Wire& aModifiedWire = TopoDS::Wire(itl.Value());
cout<<"a Modified Wire ..."<<endl;
//Temporary
TopoDS_Face TmpFace = TopoDS::Face(aFace.EmptyCopied());
BB.Add(TmpFace, aModifiedWire);
///////////
//TopoDS_Wire aNewWire = BuildNewWire(aModifiedWire, VEmapOfNewFace, aNewEdges, aFace);
TopoDS_Wire aNewWire = BuildNewWire(aModifiedWire, VEmapOfNewFace, FaceMapEdges(aFace), aFace);
cout<<"a New Wire ..."<<endl;
BB.Add(aNewFace, aNewWire);
cout<<"a New Face ..."<<endl;
aFacesModifiedFaces.Add(aFace, aNewFace);
}
}
}
}
//Update ChFiFaces
/*
TopTools_ListOfShape ModifiedChFiFaces;
TopTools_ListIteratorOfListOfShape itl(aChFiFaces);
while (itl.More())
{
TopoDS_Shape aChFiFace = itl.Value();
TopAbs_Orientation anOrOfFace = aChFiFace.Orientation();
aChFiFace.Orientation(TopAbs_FORWARD);
BRepTools_Substitution aSubstitutor;
TopExp_Explorer Explo(aChFiFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
if (!ModifiedShapes.IsBound(anEdge))
continue;
const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(anEdge);
TopTools_ListIteratorOfListOfShape itspl(aListOfSplits);
for (; itspl.More(); itspl.Next())
{
const TopoDS_Shape& aSplit = itspl.Value();
cout<<"a Split..."<<endl;
}
aSubstitutor.Substitute(anEdge.Oriented(TopAbs_FORWARD), aListOfSplits);
}
aSubstitutor.Build(aChFiFace);
if (aSubstitutor.IsCopied(aChFiFace))
{
const TopTools_ListOfShape& listSh = aSubstitutor.Copy(aChFiFace);
TopoDS_Shape aNewChFiFace = listSh.First();
aNewChFiFace.Orientation(anOrOfFace);
ModifiedChFiFaces.Append(aNewChFiFace);
aChFiFaces.Remove(itl);
}
else
itl.Next();
}
aChFiFaces.Append(ModifiedChFiFaces);
*/
/*
else //a modified old face
{
//BRepAlgoAPI_Fuse aFuse(aWires, aNewEdges);
//BOPAlgo_Builder GenFuse;
//GenFuse.AddArgument(aFace);
GenFuse.AddArgument(aNewEdges);
GenFuse.Perform();
TopoDS_Shape aNewFace = aFace.EmptyCopied();
const TopoDS_Shape& aResFuse = GenFuse.Shape();
//const BOPCol_DataMapOfShapeListOfShape& ModifiedShapes = GenFuse.Images();
const TopTools_DataMapOfShapeListOfShape& ModifiedShapes = GenFuse.Images();
TopTools_IndexedDataMapOfShapeListOfShape VEmapOfNewFace;
TopExp::MapShapesAndAncestors(aResFuse, TopAbs_VERTEX, TopAbs_EDGE, VEmapOfNewFace);
TopoDS_Iterator itw(aFace);
for (; itw.More(); itw.Next())
{
const TopoDS_Shape& aWire = itw.Value();
if (!ModifiedShapes.IsBound(aWire))
continue;
const TopTools_ListOfShape& aListOfModified = ModifiedShapes(aWire);
TopTools_ListIteratorOfListOfShape itwm(aListOfModified);
for (; itwm.More(); itwm.Next())
{
const TopoDS_Wire& aModifiedWire = TopoDS::Wire(itwm.Value());
cout<<"a Modified Wire ..."<<endl;
TopoDS_Wire aNewWire = BuildNewWire(aModifiedWire, VEmapOfNewFace, aNewEdges, aFace);
cout<<"a New Wire ..."<<endl;
BB.Add(aNewFace, aNewWire);
cout<<"a New Face ..."<<endl;
aFacesModifiedFaces.Add(aFace, aNewFace);
//Temporary
BB.Add(aShell, aNewFace);
}
}
}
*/
//Modify the original shape using ReShape
BRepTools_ReShape aReshape;
for (Standard_Integer i = 1; i <= aFacesModifiedFaces.Extent(); i++)
{
const TopoDS_Shape& aFace = aFacesModifiedFaces.FindKey(i);
const TopoDS_Shape& aNewFace = aFacesModifiedFaces(i);
aReshape.Replace(aFace, aNewFace);
}
myShapeResult = aReshape.Apply(myShape);
//Add ChFiFaces
while (!aChFiFaces.IsEmpty())
{
TopTools_ListIteratorOfListOfShape itl(aChFiFaces);
while (itl.More())
{
const TopoDS_Shape& aChFiFace = itl.Value();
TopoDS_Shape aTargetShape = FindProperSubShape(aChFiFace, myShapeResult); //recursive method
if (!aTargetShape.IsNull())
{
aTargetShape.Free(Standard_True);
aTargetShape.Orientation(TopAbs_FORWARD);
BB.Add(aTargetShape, aChFiFace);
aChFiFaces.Remove(itl);
}
else
itl.Next();
}
}
/////////////////////////////////////////
/*
myCoup->Perform(myDS);
//jgv//
TColStd_MapIteratorOfMapOfInteger It(MapIndSo);
for(; It.More(); It.Next()){
Standard_Integer indsol = It.Key();
@@ -431,18 +1199,18 @@ void ChFi3d_Builder::Compute()
for (; exv.More(); exv.Next() ) {
const TopoDS_Vertex& v = TopoDS::Vertex(exv.Current());
Standard_Real tolv = BRep_Tool::Tolerance(v);
if (tole>tolv) B1.UpdateVertex(v,tole);
if (tole>tolv) BB.UpdateVertex(v,tole);
}
}
}
if (!hasresult) {
B1.MakeCompound(TopoDS::Compound(myShapeResult));
BB.MakeCompound(TopoDS::Compound(myShapeResult));
for(It.Reset(); It.More(); It.Next()){
Standard_Integer indsol = It.Key();
const TopoDS_Shape& curshape = DStr.Shape(indsol);
TopTools_ListIteratorOfListOfShape
its = myCoup->Merged(curshape,TopAbs_IN);
if(!its.More()) B1.Add(myShapeResult,curshape);
if(!its.More()) BB.Add(myShapeResult,curshape);
else {
//If the old type of Shape is Shell, Shell is placed instead of Solid,
//However there is a problem for compound of open Shell.
@@ -452,11 +1220,11 @@ void ChFi3d_Builder::Compute()
TopExp_Explorer expsh2(its.Value(),TopAbs_SHELL);
const TopoDS_Shape& cursh = expsh2.Current();
TopoDS_Shape tt = cursh;
B1.Add(myShapeResult,cursh);
BB.Add(myShapeResult,cursh);
its.Next();
}
else {
B1.Add(myShapeResult,its.Value());
BB.Add(myShapeResult,its.Value());
its.Next();
}
}
@@ -465,21 +1233,23 @@ void ChFi3d_Builder::Compute()
}
else {
done=Standard_False;
B1.MakeCompound(TopoDS::Compound(badShape));
BB.MakeCompound(TopoDS::Compound(badShape));
for(It.Reset(); It.More(); It.Next()){
Standard_Integer indsol = It.Key();
const TopoDS_Shape& curshape = DStr.Shape(indsol);
TopTools_ListIteratorOfListOfShape
its = myCoup->Merged(curshape,TopAbs_IN);
if(!its.More()) B1.Add(badShape,curshape);
if(!its.More()) BB.Add(badShape,curshape);
else {
while (its.More()) {
B1.Add(badShape,its.Value());
BB.Add(badShape,its.Value());
its.Next();
}
}
}
}
*/
#ifdef OCCT_DEBUG //perf
ChFi3d_ResultChron(cl_reconstruction ,t_reconstruction);
ChFi3d_InitChron(cl_setregul);
@@ -571,6 +1341,8 @@ void ChFi3d_Builder::Compute()
// if it is necessary
if (IsDone())
{
//Temporary
/*
Standard_Real SameParTol = Precision::Confusion();
Standard_Integer aNbSurfaces, iF;
TopTools_ListIteratorOfListOfShape aIt;
@@ -586,6 +1358,7 @@ void ChFi3d_Builder::Compute()
ShapeFix::SameParameter(aF, Standard_False, SameParTol);
}
}
*/
}
}
@@ -837,11 +1610,14 @@ const TopTools_ListOfShape& ChFi3d_Builder::Generated(const TopoDS_Shape& EouV)
TColStd_ListIteratorOfListOfInteger IL;
for(IL.Initialize(L); IL.More(); IL.Next()){
Standard_Integer I = IL.Value();
const TopTools_ListOfShape& LS = myCoup->NewFaces(I);
//const TopTools_ListOfShape& LS = myCoup->NewFaces(I);
const TopoDS_Face& aNewFace = TopoDS::Face(myNewFaces(I));
/*
TopTools_ListIteratorOfListOfShape ILS;
for(ILS.Initialize(LS); ILS.More(); ILS.Next()){
for(ILS.Initialize(LS); ILS.More(); ILS.Next())
myGenerated.Append(ILS.Value());
}
*/
myGenerated.Append(aNewFace);
}
}
return myGenerated;

View File

@@ -31,11 +31,14 @@
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfInteger.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <ChFiDS_ErrorStatus.hxx>
#include <math_Vector.hxx>
#include <TopAbs_Orientation.hxx>
//#include <BRepOffset_Type.hxx>
#include <ChFiDS_SequenceOfSurfData.hxx>
#include <TopAbs_State.hxx>
@@ -74,6 +77,22 @@ class TopoDS_Face;
class AppBlend_Approx;
class Geom2d_Curve;
struct QualifiedEdge
{
Standard_Integer Index;
TopAbs_Orientation Orientation;
//BRepOffset_Type Convexity;
QualifiedEdge(Standard_Integer theIndex,
TopAbs_Orientation theOrientation)
: Index(theIndex),
Orientation(theOrientation)
{
}
};
typedef NCollection_List<QualifiedEdge> ChFi3d_ListOfQualifiedEdge;
typedef ChFi3d_ListOfQualifiedEdge::Iterator ChFi3d_ListIteratorOfListOfQualifiedEdge;
//! Root class for calculation of surfaces (fillets,
//! chamfers) destined to smooth edges of
@@ -779,6 +798,12 @@ protected:
ChFiDS_Map myVFMap;
ChFiDS_Map myVEMap;
Handle(TopOpeBRepDS_HDataStructure) myDS;
//TopTools_IndexedDataMapOfShapeListOfShape myFaceNewEdges;
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger> myFaceNewEdges;
//NCollection_IndexedDataMap<Standard_Integer, ChFi3d_ListOfQualifiedEdge> myFaceNewEdges;
TopTools_IndexedMapOfShape myNewFaces;
TopTools_IndexedMapOfShape myNewEdges;
TColStd_MapOfInteger myIndsChFiFaces;
Handle(TopOpeBRepBuild_HBuilder) myCoup;
ChFiDS_ListOfStripe myListStripe;
ChFiDS_StripeMap myVDataMap;

View File

@@ -90,6 +90,7 @@
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRepLib_MakeFace.hxx>
@@ -176,6 +177,64 @@ extern void ChFi3d_SettraceDRAWSPINE(const Standard_Boolean b);
#include <BRepAdaptor_HSurface.hxx>
#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
//=======================================================================
//function : ChFi3d_IsFirstInside
//purpose :
//=======================================================================
Standard_Boolean ChFi3d_IsFirstInside(const Standard_Real theVal1,
const Standard_Real theVal2,
const Standard_Real theMin,
const Standard_Real theMax)
{
Standard_Real IsFirstInside = (theMin < theVal1 && theVal1 < theMax);
Standard_Real IsSecondInside = (theMin < theVal2 && theVal2 < theMax);
if (IsFirstInside && !IsSecondInside)
return Standard_True;
if (!IsFirstInside && IsSecondInside)
return Standard_False;
if (IsFirstInside && IsSecondInside)
{
Standard_Real MinDistForFirst = Min(theVal1 - theMin, theMax - theVal1);
Standard_Real MinDistForSecond = Min(theVal2 - theMin, theMax - theVal2);
return (MinDistForFirst > MinDistForSecond);
}
else
{
cout<<endl<<"Both points outside!"<<endl;
return Standard_True;
}
}
//=======================================================================
//function : ChFi3d_AdjustPCurve
//purpose :
//=======================================================================
void ChFi3d_AdjustPCurve(Geom2dAdaptor_Curve& thePCurve,
const Standard_Real theCoordOnPCurve,
const Standard_Real theRefCoord,
const Standard_Real thePeriod,
const Standard_Boolean theInUdirection)
{
Standard_Real aCoord = theCoordOnPCurve;
Standard_Real Sign = (aCoord < theRefCoord)? 1 : -1;
while (Abs(aCoord - theRefCoord) > thePeriod/2)
aCoord += Sign * thePeriod;
Standard_Real Offset = aCoord - theCoordOnPCurve;
gp_Vec2d OffsetVector;
if (theInUdirection)
OffsetVector.SetCoord(Offset, 0.);
else
OffsetVector.SetCoord(0., Offset);
Handle(Geom2d_Curve) aPCurve = thePCurve.Curve();
aPCurve->Translate(OffsetVector);
thePCurve.Load(aPCurve);
}
//=======================================================================
//function : ChFi3d_InPeriod
//purpose :
@@ -192,6 +251,211 @@ Standard_Real ChFi3d_InPeriod(const Standard_Real U,
if ( u < UFirst) u = UFirst;
return u;
}
//=======================================================================
//function : ChFi3d_AdjustSecondPointToFirstPoint
//purpose :
//=======================================================================
void ChFi3d_AdjustSecondPointToFirstPoint(const gp_Pnt2d& theFirstPoint,
gp_Pnt2d& theSecondPoint,
const BRepAdaptor_Surface& theSurf)
{
if (theSurf.IsUPeriodic())
{
Standard_Real UPeriod = theSurf.UPeriod();
Standard_Real NewU = ElCLib::InPeriod(theSecondPoint.X(),
theFirstPoint.X() - UPeriod/2,
theFirstPoint.X() + UPeriod/2);
theSecondPoint.SetX(NewU);
}
if (theSurf.IsVPeriodic())
{
Standard_Real VPeriod = theSurf.VPeriod();
Standard_Real NewV = ElCLib::InPeriod(theSecondPoint.Y(),
theFirstPoint.Y() - VPeriod/2,
theFirstPoint.Y() + VPeriod/2);
theSecondPoint.SetY(NewV);
}
}
//=======================================================================
//function : ChFi3d_SplitAndAdjust
//purpose :
//=======================================================================
void ChFi3d_SplitAndAdjust(const TopTools_ListOfShape& theElist,
TopTools_ListOfShape& theNewElist,
const BRepAdaptor_Surface& theBAsurf)
{
TopoDS_Face aFace = theBAsurf.Face();
Handle(Geom_Surface) aSurf, aBasisSurf;
TopLoc_Location aLoc;
aSurf = BRep_Tool::Surface(aFace, aLoc);
aBasisSurf = aSurf;
if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
aBasisSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface();
if (!aBasisSurf->IsUClosed() && !aBasisSurf->IsVClosed())
return;
TColGeom2d_SequenceOfCurve Boundaries;
Standard_Real Ubounds [2], Vbounds [2];
aSurf->Bounds(Ubounds[0], Ubounds[1], Vbounds[0], Vbounds[1]);
for (Standard_Integer i = 0; i < 2; i++)
if (!Precision::IsInfinite(Ubounds[i]))
{
gp_Pnt2d Origin(Ubounds[i], 0.);
Handle(Geom2d_Curve) aLine = new Geom2d_Line(Origin, gp::DY2d());
if (!Precision::IsInfinite(Vbounds[0]) || !Precision::IsInfinite(Vbounds[1]))
aLine = new Geom2d_TrimmedCurve(aLine, Vbounds[0], Vbounds[1]);
Boundaries.Append(aLine);
}
for (Standard_Integer i = 0; i < 2; i++)
if (!Precision::IsInfinite(Vbounds[i]))
{
gp_Pnt2d Origin(0., Vbounds[i]);
Handle(Geom2d_Curve) aLine = new Geom2d_Line(Origin, gp::DX2d());
if (!Precision::IsInfinite(Ubounds[0]) || !Precision::IsInfinite(Ubounds[1]))
aLine = new Geom2d_TrimmedCurve(aLine, Ubounds[0], Ubounds[1]);
Boundaries.Append(aLine);
}
Geom2dInt_GInter Intersector;
BRep_Builder BB;
TopTools_ListIteratorOfListOfShape itl(theElist);
for (; itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
TopAbs_Orientation anOr = anEdge.Orientation();
Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
TColStd_SequenceOfReal Params;
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, fpar, lpar);
Geom2dAdaptor_Curve aGAcurve(aPCurve, fpar, lpar);
Standard_Real LeftTol = Precision::PConfusion(), RightTol = Precision::PConfusion();
BRepAdaptor_Curve BAcurve(anEdge);
gp_Pnt FirstPnt = BAcurve.Value(fpar);
gp_Pnt LastPnt = BAcurve.Value(lpar);
Standard_Real Offset = 0.01*(lpar - fpar);
gp_Pnt PntOffset = BAcurve.Value(fpar + Offset);
Standard_Real dist3d = FirstPnt.Distance(PntOffset);
if (dist3d > gp::Resolution())
LeftTol = Offset*aTol/dist3d;
PntOffset = BAcurve.Value(lpar - Offset);
dist3d = LastPnt.Distance(PntOffset);
if (dist3d > gp::Resolution())
RightTol = Offset*aTol/dist3d;
for (Standard_Integer i = 1; i <= Boundaries.Length(); i++)
{
Geom2dAdaptor_Curve aGAboundary(Boundaries(i));
Intersector.Perform(aGAcurve, aGAboundary,
Precision::PIntersection(),
Precision::PIntersection());
if (Intersector.IsDone() && !Intersector.IsEmpty())
{
for (Standard_Integer j = 1; j <= Intersector.NbPoints(); j++)
{
IntRes2d_IntersectionPoint int2d = Intersector.Point(j);
Standard_Real aParam = int2d.ParamOnFirst();
if (Abs(aParam - fpar) > LeftTol &&
Abs(aParam - lpar) > RightTol)
Params.Append(aParam);
}
for (Standard_Integer j = 1; j <= Intersector.NbSegments(); j++)
{
IntRes2d_IntersectionSegment seg2d = Intersector.Segment(j);
IntRes2d_IntersectionPoint int2d = seg2d.FirstPoint();
Standard_Real aParam = int2d.ParamOnFirst();
if (Abs(aParam - fpar) > LeftTol &&
Abs(aParam - lpar) > RightTol)
Params.Append(aParam);
int2d = seg2d.LastPoint();
aParam = int2d.ParamOnFirst();
if (Abs(aParam - fpar) > LeftTol &&
Abs(aParam - lpar) > RightTol)
Params.Append(aParam);
}
}
} //for (Standard_Integer i = 1; i <= Boundaries.Length(); i++)
//Sort parameters
for (Standard_Integer i = 1; i < Params.Length(); i++)
for (Standard_Integer j = i+1; j <= Params.Length(); j++)
if (Params(i) > Params(j))
{ Standard_Real tmp = Params(i); Params(i) = Params(j); Params(j) = tmp; }
//Delete duplicating parameters
Standard_Real ParamTol = Max(LeftTol, RightTol);
Standard_Integer i = 2;
while (i <= Params.Length())
if (Params(i) - Params(i-1) > ParamTol)
Params.Remove(i);
else
i++;
//Split
TopoDS_Vertex FirstVertex = TopExp::FirstVertex(anEdge), LastVertex;
Standard_Real FirstPar = fpar, LastPar;
for (i = 1; i <= Params.Length(); i++)
{
LastPar = Params(i);
TopoDS_Edge aNewEdge = TopoDS::Edge(anEdge.EmptyCopied());
aNewEdge.Orientation(TopAbs_FORWARD);
BB.Range(aNewEdge, FirstPar, LastPar);
gp_Pnt LastPnt = BAcurve.Value(LastPar);
LastVertex = BRepLib_MakeVertex(LastPnt);
BB.UpdateVertex(LastVertex, ParamTol);
BB.Add(aNewEdge, FirstVertex.Oriented(TopAbs_FORWARD));
BB.Add(aNewEdge, LastVertex.Oriented(TopAbs_REVERSED));
aNewEdge.Orientation(anOr);
BB.UpdateEdge(aNewEdge, aTol);
theNewElist.Append(aNewEdge);
FirstVertex = LastVertex;
FirstPar = LastPar;
}
LastPar = lpar;
LastVertex = TopExp::LastVertex(anEdge);
TopoDS_Edge aNewEdge = TopoDS::Edge(anEdge.EmptyCopied());
aNewEdge.Orientation(TopAbs_FORWARD);
BB.Range(aNewEdge, FirstPar, LastPar);
BB.Add(aNewEdge, FirstVertex.Oriented(TopAbs_FORWARD));
BB.Add(aNewEdge, LastVertex.Oriented(TopAbs_REVERSED));
aNewEdge.Orientation(anOr);
BB.UpdateEdge(aNewEdge, aTol);
theNewElist.Append(aNewEdge);
}
if (theNewElist.IsEmpty())
theNewElist.Assign(theElist);
//Adjust
for (itl.Initialize(theNewElist); itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, fpar, lpar);
gp_Pnt2d MidP2d = aPCurve->Value(0.5*(fpar + lpar));
Standard_Real aU = MidP2d.X(), aV = MidP2d.Y();
if (aU < Ubounds[0] || aU > Ubounds[1])
{
Standard_Real Period = Ubounds[1] - Ubounds[0];
Standard_Real Sign = (aU < Ubounds[0])? 1 : -1;
while (aU < Ubounds[0] || aU > Ubounds[1])
aU += Sign*Period;
}
if (aV < Vbounds[0] || aV > Vbounds[1]) //??? sphere? cone?
{
Standard_Real Period = Vbounds[1] - Vbounds[0];
Standard_Real Sign = (aV < Vbounds[0])? 1 : -1;
while (aV < Vbounds[0] || aV > Vbounds[1])
aV += Sign*Period;
}
if (aU != MidP2d.X() || aV != MidP2d.Y())
{
gp_Vec2d OffsetVec(aU - MidP2d.X(), aV - MidP2d.Y());
aPCurve->Translate(OffsetVec);
}
}
}
//=======================================================================
//function : Box
//purpose : Calculation of min/max uv of the fillet to intersect.
@@ -832,7 +1096,9 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
fd2,pref2,p2,jf2,sens2,
face,P2d,Check2dDistance,enlarge)) {
u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face;
ok = 1;
}
@@ -853,7 +1119,9 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
fd2,pref2,p2,jf2,sens2,
face,P2d,Check2dDistance,enlarge)) {
Standard_Boolean restore =
ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) ||
(j2 == jf2 && sens2*(p2 - u2) > 0.));
@@ -886,7 +1154,9 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
fd2,pref2,p2,jf2,sens2,
face,P2d,Check2dDistance,enlarge)) {
Standard_Boolean restore =
ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) ||
(j2 == jf2 && sens2*(p2 - u2) > 0.));
@@ -919,7 +1189,9 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
fd2,pref2,p2,jf2,sens2,
face,P2d,Check2dDistance,enlarge)) {
Standard_Boolean restore =
ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) ||
(j2 == jf2 && sens2*(p2 - u2) > 0.));
@@ -956,18 +1228,19 @@ static Standard_Real recadre(const Standard_Real p,
//purpose :
//=======================================================================
Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1,
const Standard_Real pref1,
Standard_Real& p1,
const Standard_Integer jf1,
const Standard_Integer sens1,
const Handle(ChFiDS_SurfData)& fd2,
const Standard_Real pref2,
Standard_Real& p2,
const Standard_Integer jf2,
const Standard_Integer sens2,
const gp_Pnt2d& RefP2d,
const Standard_Boolean Check2dDistance,
const Standard_Boolean enlarge)
const Standard_Real pref1,
Standard_Real& p1,
const Standard_Integer jf1,
const Standard_Integer sens1,
const Handle(ChFiDS_SurfData)& fd2,
const Standard_Real pref2,
Standard_Real& p2,
const Standard_Integer jf2,
const Standard_Integer sens2,
const TopoDS_Face& theFace,
const gp_Pnt2d& RefP2d,
const Standard_Boolean Check2dDistance,
const Standard_Boolean enlarge)
{
Geom2dAdaptor_Curve C1;
Geom2dAdaptor_Curve C2;
@@ -1021,6 +1294,26 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1,
Intersection.Perform(C1,C2,
Precision::PIntersection(),
Precision::PIntersection());
if (!Intersection.IsDone() || Intersection.IsEmpty())
{
BRepAdaptor_Surface BAsurf(theFace, Standard_False);
if (BAsurf.IsUPeriodic())
{
//put the pcurves in the same parametric context
Standard_Real Uperiod = BAsurf.UPeriod();
Standard_Real Umin = BAsurf.FirstUParameter();
Standard_Real Umax = BAsurf.LastUParameter();
gp_Pnt2d Origin1 = C1.Value(0.);
gp_Pnt2d Origin2 = C2.Value(0.);
Standard_Boolean IsFirstPointInside =
ChFi3d_IsFirstInside(Origin1.X(), Origin2.X(), Umin, Umax);
if (IsFirstPointInside)
ChFi3d_AdjustPCurve(C2, Origin2.X(), Origin1.X(), Uperiod, Standard_True);
else
ChFi3d_AdjustPCurve(C1, Origin1.X(), Origin2.X(), Uperiod, Standard_True);
}
}
}
if (Intersection.IsDone()) {
if (!Intersection.IsEmpty()) {
@@ -4756,6 +5049,24 @@ Standard_Integer ChFi3d_NumberOfSharpEdges(const TopoDS_Vertex& Vtx,
return nba;
}
//=======================================================================
//function : IsInSingularity
//purpose :
//
//=======================================================================
Standard_Boolean ChFi3d_IsInSingularity(const TopoDS_Vertex& Vtx,
const ChFiDS_Map& VEMap)
{
TopTools_ListIteratorOfListOfShape ItE;
for (ItE.Initialize(VEMap(Vtx)); ItE.More(); ItE.Next())
{
const TopoDS_Edge& cur = TopoDS::Edge(ItE.Value());
if (BRep_Tool::Degenerated(cur))
return Standard_True;
}
return Standard_False;
}
//=====================================================
// function cherche_vertex
// finds common vertex between two edges

View File

@@ -81,6 +81,14 @@ Standard_Real ChFi3d_InPeriod(const Standard_Real U,
const Standard_Real ULast,
const Standard_Real Eps);
void ChFi3d_AdjustSecondPointToFirstPoint(const gp_Pnt2d& theFirstPoint,
gp_Pnt2d& theSecondPoint,
const BRepAdaptor_Surface& theSurf);
void ChFi3d_SplitAndAdjust(const TopTools_ListOfShape& theElist,
TopTools_ListOfShape& theNewElist,
const BRepAdaptor_Surface& theBAsurf);
void ChFi3d_Boite(const gp_Pnt2d& p1,const gp_Pnt2d& p2,
Standard_Real& mu,Standard_Real& Mu,
Standard_Real& mv,Standard_Real& Mv);
@@ -327,6 +335,7 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1,
Standard_Real& p2,
const Standard_Integer jf2,
const Standard_Integer sens2,
const TopoDS_Face& theFace,
const gp_Pnt2d& RefP2d,
const Standard_Boolean Check2dDistance = Standard_False,
const Standard_Boolean enlarge = Standard_False);
@@ -566,6 +575,9 @@ Standard_Integer ChFi3d_NumberOfSharpEdges(const TopoDS_Vertex& Vtx,
const ChFiDS_Map& VEMap,
const ChFiDS_Map& EFmap);
Standard_Boolean ChFi3d_IsInSingularity(const TopoDS_Vertex& Vtx,
const ChFiDS_Map& VEMap);
void ChFi3d_cherche_vertex (const TopoDS_Edge & E1,
const TopoDS_Edge & E2,
TopoDS_Vertex & vertex,

View File

@@ -851,7 +851,7 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)& Stripe,
PC->D1(woned, P1, derive);
// There are ponts on the border, and internal points are found
if (derive.Magnitude() > Precision::PConfusion()) {
derive.Normalize();
derive.Normalized();
derive.Rotate(M_PI/2);
AS.Initialize(f1);
ResU = AS.UResolution(TolE);
@@ -2419,7 +2419,8 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
Handle(ChFiDS_SurfData) SD = new ChFiDS_SurfData();
ChFiDS_SequenceOfSurfData LSD;
if(!ChFiKPart_ComputeData::Compute(DStr,SD,HS1,HS2,Or1,Or2,Spine,iedge)){
if(!ChFiKPart_ComputeData::Compute(DStr,myNewFaces,myNewEdges,myFaceNewEdges,myIndsChFiFaces,
SD,HS1,HS2,Or1,Or2,Spine,iedge)){
#ifdef OCCT_DEBUG
cout<<"failed calculation KPart"<<endl;
#endif
@@ -2728,9 +2729,10 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 Begin
// if(ChFi3d_IntTraces(prevsd,prevpar1,nprevpar1,1,1,
// nextsd,nextpar1,nnextpar1,1,-1,p2d)){
TopoDS_Face FaceOfPCurves = TopoDS::Face(DStr.Shape(prevsd->Index(1)));
if(ChFi3d_IntTraces(prevsd,prevpar1,nprevpar1,1,1,
nextsd,nextpar1,nnextpar1,1,-1,p2d,
Standard_False, Standard_True)){
nextsd,nextpar1,nnextpar1,1,-1,
FaceOfPCurves,p2d,Standard_False, Standard_True)){
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 End
previntf1.SetLastParameter(nprevpar1);
nextintf1.SetFirstParameter(nnextpar1);
@@ -2786,9 +2788,10 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 Begin
// if(ChFi3d_IntTraces(prevsd,prevpar2,nprevpar2,2,1,
// nextsd,nextpar2,nnextpar2,2,-1,p2d)){
TopoDS_Face FaceOfPCurves = TopoDS::Face(DStr.Shape(prevsd->Index(2)));
if(ChFi3d_IntTraces(prevsd,prevpar2,nprevpar2,2,1,
nextsd,nextpar2,nnextpar2,2,-1,p2d,
Standard_False, Standard_True)){
nextsd,nextpar2,nnextpar2,2,-1,
FaceOfPCurves,p2d,Standard_False, Standard_True)){
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 End
previntf2.SetLastParameter(nprevpar2);
nextintf2.SetFirstParameter(nnextpar2);
@@ -2985,7 +2988,8 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
TColStd_ListOfInteger li;
myEVIMap.Bind(Ej,li);
}
myEVIMap.ChangeFind(Ej).Append(cursd->Surf());
//myEVIMap.ChangeFind(Ej).Append(cursd->Surf());
myEVIMap.ChangeFind(Ej).Append(cursd->IndexOfFace());
}
}
else if(IF < IL){

View File

@@ -98,6 +98,7 @@
#include <TopOpeBRepDS_Surface.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <stdio.h>
@@ -795,6 +796,28 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
if(Reversed) TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS2());
else TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS1());
Fint1.SetInterference(Index1OfCurve,TraOn1,PCurveOnFace,PCurveOnSurf);
//jgv
TopoDS_Edge Boundary1, Boundary2;
Boundary1 = BRepLib_MakeEdge(Crv3d1, pppdeb, pppfin);
BRep_Builder BB;
BB.UpdateEdge(Boundary1, tolcheck);
TopLoc_Location aLoc;
BB.UpdateEdge(Boundary1, PCurveOnSurf, Surf, aLoc, 0.);
BB.UpdateEdge(Boundary1, PCurveOnFace, BS1->ChangeSurface().Face(), 0.);
myNewEdges.Add(Boundary1);
Standard_Integer IndF1, IndF2;
if (!myNewFaces.Contains(BS1->ChangeSurface().Face()))
myNewFaces.Add(BS1->ChangeSurface().Face());
IndF1 = myNewFaces.FindIndex(BS1->ChangeSurface().Face());
if (!myFaceNewEdges.Contains(IndF1))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndF1, aList);
}
/////
// SurfData is filled in what concerns S2,
Handle(Geom_Curve) Crv3d2 = Surf->UIso(Uon2);
@@ -848,6 +871,24 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
if(Reversed) TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS1());
else TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS2());
Fint2.SetInterference(Index2OfCurve,TraOn2,PCurveOnFace,PCurveOnSurf);
//jgv
Boundary2 = BRepLib_MakeEdge(Crv3d2, pppdeb, pppfin);
BB.UpdateEdge(Boundary2, tolcheck);
BB.UpdateEdge(Boundary2, PCurveOnSurf, Surf, aLoc, 0.);
BB.UpdateEdge(Boundary2, PCurveOnFace, BS2->ChangeSurface().Face(), 0.);
myNewEdges.Add(Boundary2);
if (!myNewFaces.Contains(BS2->ChangeSurface().Face()))
myNewFaces.Add(BS2->ChangeSurface().Face());
IndF2 = myNewFaces.FindIndex(BS2->ChangeSurface().Face());
if (!myFaceNewEdges.Contains(IndF2))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndF2, aList);
}
/////
}
else {
Handle(Geom2d_Curve) bidpc;
@@ -910,6 +951,49 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
break;
}
// Modified by skv - Wed Jun 9 17:16:26 2004 OCC5898 End
//Add new face and its new edges in the maps
TopoDS_Face aNewFace;
BB.MakeFace(aNewFace);
BB.UpdateFace(aNewFace, Surf, aLoc, Precision::Confusion());
aNewFace.Orientation(Data->Orientation());
Standard_Integer IndNewFace = myNewFaces.Add(aNewFace);
myIndsChFiFaces.Add(IndNewFace);
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndNewFace, aList);
Data->ChangeIndexOfFace(IndNewFace);
TopAbs_Orientation Et = (Reversed)? TopAbs_REVERSED : TopAbs_FORWARD;
Standard_Integer IndE1 = myNewEdges.FindIndex(Boundary1);
Data->ChangeIndexOfE1(IndE1);
//QualifiedEdge aQE1(IndE1, Et);
if (Et == TopAbs_REVERSED)
IndE1 *= -1;
if (Data->Orientation() == TopAbs_REVERSED)
IndE1 *= -1;
myFaceNewEdges.ChangeFromKey(IndF1).Append(IndE1);
Standard_Integer IndE1_forNewFace = IndE1;
if (Data->Orientation() == TopAbs_FORWARD)
IndE1_forNewFace *= -1;
//myFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE1);
myFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE1_forNewFace);
Standard_Integer IndE2 = myNewEdges.FindIndex(Boundary2);
Data->ChangeIndexOfE2(IndE2);
//QualifiedEdge aQE2(IndE2, TopAbs::Reverse(Et));
TopAbs_Orientation RevEt = TopAbs::Reverse(Et);
if (RevEt == TopAbs_REVERSED)
IndE2 *= -1;
if (Data->Orientation() == TopAbs_REVERSED)
IndE2 *= -1;
myFaceNewEdges.ChangeFromKey(IndF2).Append(IndE2);
Standard_Integer IndE2_forNewFace = IndE2;
if (Data->Orientation() == TopAbs_FORWARD)
IndE2_forNewFace *= -1;
//myFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE2);
myFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE2_forNewFace);
////////////////////////
if(!Gd1 && !S1.IsNull())
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),

View File

@@ -42,6 +42,7 @@
#include <BRepBlend_Line.hxx>
#include <BRepExtrema_ExtCC.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_TopolTool.hxx>
#include <ChFi3d.hxx>
@@ -140,6 +141,7 @@
#include <TopOpeBRepDS_Transition.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//#include <BOPTools_AlgoTools2D.hxx>
#ifdef OCCT_DEBUG
# ifdef DRAW
@@ -598,6 +600,9 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
}
Handle(ChFiDS_SurfData)& Fd = SeqFil.ChangeValue(num);
//jgv
Standard_Integer IndexOfNewFace = Fd->IndexOfFace();
/////
ChFiDS_CommonPoint& CV1 = Fd->ChangeVertex(isfirst,1);
ChFiDS_CommonPoint& CV2 = Fd->ChangeVertex(isfirst,2);
//To evaluate the new points.
@@ -621,6 +626,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
BRepAdaptor_Surface& Bs = HBs->ChangeSurface();
BRepAdaptor_Surface& Bad = HBad->ChangeSurface();
BRepAdaptor_Surface& Bop = HBop->ChangeSurface();
TopoDS_Edge aNewEdge;
Handle(Geom_Curve) Cc;
Handle(Geom2d_Curve) Pc,Ps;
Standard_Real Ubid,Vbid;//,mu,Mu,mv,Mv;
@@ -631,6 +637,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Standard_Integer IFadArc = 1, IFopArc = 2;
Fop = TopoDS::Face(DStr.Shape(Fd->Index(IFopArc)));
TopExp_Explorer ex;
BRep_Builder BB;
#ifdef OCCT_DEBUG
ChFi3d_InitChron(ch); // init perf condition if (onsame)
@@ -731,12 +738,11 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
TopoDS_Face FFv;
Standard_Real tol;
Standard_Integer prol=0;
BRep_Builder BRE;
Handle(Geom_Surface ) Sface;
Sface=BRep_Tool::Surface(Fv);
ChFi3d_ExtendSurface(Sface,prol);
tol=BRep_Tool::Tolerance(Fv);
BRE.MakeFace(FFv,Sface,tol);
BB.MakeFace(FFv,Sface,tol);
if (prol) {
Bs.Initialize(FFv,Standard_False);
DStr.SetNewSurface(Fv,Sface);
@@ -753,6 +759,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
ChFiDS_FaceInterference& FiopArc = Fd->ChangeInterference(IFopArc);
ChFiDS_CommonPoint& CPadArc = Fd->ChangeVertex(isfirst,IFadArc);
ChFiDS_FaceInterference& FiadArc = Fd->ChangeInterference(IFadArc);
TopoDS_Vertex VerFopFad [3];
//the parameter of the vertex in the air is initialiced with the value of
//its opposite (point on arc).
Standard_Real wop = Fd->ChangeInterference(IFadArc).Parameter(isfirst);
@@ -768,6 +775,26 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
inters = IntersUpdateOnSame (HGs,HBs,c3df,Fop,Fv,Arcprol,Vtx,isfirst,10*tolesp, // in
FiopArc,CPopArc,p2dbout,wop); // out
//jgv
for (Standard_Integer is = 1; is <= 2; is++)
{
ChFiDS_FaceInterference& Interf = Fd->ChangeInterference(is);
Standard_Integer IndEsurf = Fd->IndexOfEdge(is);
TopoDS_Edge EdgeSurf = TopoDS::Edge(myNewEdges(IndEsurf));
Standard_Real fpar, lpar;
Handle(Geom_Curve) CurveEdgeSurf = BRep_Tool::Curve(EdgeSurf, fpar, lpar);
//BRep_Tool::Range(EdgeSurf, fpar, lpar);
if (isfirst)
fpar = Interf.FirstParameter();
else
lpar = Interf.LastParameter();
BB.Range(EdgeSurf, fpar, lpar);
VerFopFad[is] = (isfirst)? TopExp::FirstVertex(EdgeSurf)
: TopExp::LastVertex(EdgeSurf);
gp_Pnt aPnt = CurveEdgeSurf->Value((isfirst)? fpar : lpar);
BB.UpdateVertex(VerFopFad[is], aPnt, 0.);
}
/////
Handle(BRepAdaptor_HCurve2d) pced = new BRepAdaptor_HCurve2d();
pced->ChangeCurve2d().Initialize(CPadArc.Arc(),Fv);
@@ -794,6 +821,35 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Update(HBs,pced,HGs,Fd->ChangeInterferenceOnS1(),CV1,isfirst);
pced->ChangeCurve2d().Initialize(CV2.Arc(),Fv);
Update(HBs,pced,HGs,Fd->ChangeInterferenceOnS2(),CV2,isfirst);
//jgv
for (Standard_Integer is = 1; is <= 2; is++)
{
const ChFiDS_FaceInterference& Interf = Fd->Interference(is);
Standard_Integer IndEsurf = Fd->IndexOfEdge(is);
TopoDS_Edge EdgeSurf = TopoDS::Edge(myNewEdges(IndEsurf));
EdgeSurf.Orientation(TopAbs_FORWARD);
Standard_Real fpar, lpar;
Handle(Geom_Curve) CurveEdgeSurf = BRep_Tool::Curve(EdgeSurf, fpar, lpar);
if (isfirst)
fpar = Interf.FirstParameter();
else
lpar = Interf.LastParameter();
BB.Range(EdgeSurf, fpar, lpar);
VerFopFad[is] = (isfirst)? TopExp::FirstVertex(EdgeSurf)
: TopExp::LastVertex(EdgeSurf);
gp_Pnt aPnt = CurveEdgeSurf->Value((isfirst)? fpar : lpar);
if (VerFopFad[is].IsNull())
{
VerFopFad[is] = BRepLib_MakeVertex(aPnt);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirst)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeSurf, VerFopFad[is].Oriented(OrOfVer));
}
else
BB.UpdateVertex(VerFopFad[is], aPnt, 0.);
}
/////
}
@@ -829,6 +885,26 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Hc2 = BRep_Tool::CurveOnSurface(CV2.Arc(),Fv,Ubid,Ubid);
pfac2 = Hc2->Value(CV2.ParameterOnArc());
}
//jgv
if (Bs.IsUPeriodic() || Bs.IsVPeriodic())
{
gp_Pnt Pnt1 = BRep_Tool::Pnt(VerFopFad[1]);
gp_Pnt Pnt2 = BRep_Tool::Pnt(VerFopFad[2]);
gp_Pnt MidPnt((Pnt1.XYZ() + Pnt2.XYZ())/2);
//Project middle point onto surface
Extrema_ExtPS ProjPS(MidPnt, Bs,
Precision::PConfusion(), Precision::PConfusion());
Standard_Integer indmin = 1;
for (Standard_Integer iext = 2; iext <= ProjPS.NbExt(); iext++)
if (ProjPS.SquareDistance(iext) < ProjPS.SquareDistance(indmin))
indmin = iext;
Standard_Real uu, vv;
ProjPS.Point(indmin).Parameter(uu,vv);
gp_Pnt2d MidPnt2d(uu, vv);
ChFi3d_AdjustSecondPointToFirstPoint(MidPnt2d, pfac1, Bs);
ChFi3d_AdjustSecondPointToFirstPoint(MidPnt2d, pfac2, Bs);
}
/////
if (Fi1.LineIndex() != 0) {
pfil1 = Fi1.PCurveOnSurf()->Value(Fi1.Parameter(isfirst));
}
@@ -857,6 +933,43 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Pc,tolesp,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
//jgv
/*
gp_Pnt Pver, Pcur;
Pver = BRep_Tool::Pnt(VerFopFad[IFopArc]);
Pcur = Cc->Value(Cc->FirstParameter());
Standard_Real aDist = Pver.Distance(Pcur);
BB.UpdateVertex(VerFopFad[IFopArc], 1.01*aDist);
Pver = BRep_Tool::Pnt(VerFopFad[IFadArc]);
Pcur = Cc->Value(Cc->LastParameter());
aDist = Pver.Distance(Pcur);
BB.UpdateVertex(VerFopFad[IFadArc], 1.01*aDist);
*/
Standard_Integer ind_first, ind_last;
if (onsame)
{
ind_first = IFopArc; ind_last = IFadArc;
}
else
{
ind_first = IFadArc; ind_last = IFopArc;
}
aNewEdge = BRepLib_MakeEdge(Cc,
VerFopFad[ind_first], VerFopFad[ind_last],
Cc->FirstParameter(), Cc->LastParameter());
BB.UpdateEdge(aNewEdge, tolreached);
TopLoc_Location aLoc;
BB.UpdateEdge(aNewEdge, Ps, DStr.Surface(Fd->Surf()).Surface(), aLoc, 0.);
/*
Handle(Geom2d_Curve) AdjustedPc;
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(Bs, Cc->FirstParameter(), Cc->LastParameter(),
Pc, AdjustedPc);
Pc = AdjustedPc;
*/
BB.UpdateEdge(aNewEdge, Pc, Bs.Face(), 0.);
myNewEdges.Add(aNewEdge);
/////
Udeb = Cc->FirstParameter();
Ufin = Cc->LastParameter();
@@ -933,12 +1046,29 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
break;
}
}
//
}
Standard_Integer IndFv;
if (!myNewFaces.Contains(Fv))
myNewFaces.Add(Fv);
IndFv = myNewFaces.FindIndex(Fv);
if (!myFaceNewEdges.Contains(IndFv))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndFv, aList);
}
Standard_Integer IndE = myNewEdges.FindIndex(aNewEdge);
//QualifiedEdge aQE(IndE, Et);
if (Et == TopAbs_REVERSED)
IndE *= -1;
myFaceNewEdges.ChangeFromKey(IndFv).Append(IndE);
Standard_Integer IndE_forNewFace = IndE;
if (Fd->Orientation() == TopAbs_FORWARD)
IndE_forNewFace *= -1;
//myFaceNewEdges.ChangeFromKey(IndexOfNewFace).Append(-IndE);
myFaceNewEdges.ChangeFromKey(IndexOfNewFace).Append(IndE_forNewFace);
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch ,t_inter); //result perf condition if (inter)
ChFi3d_InitChron(ch); // init perf condition if (onsame && inters)
@@ -1246,6 +1376,8 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Hc = BRep_Tool::CurveOnSurface(Arcprol,Fop,Ubid,Ubid);
pop1 = Hc->Value(parVtx);
pop2 = Fiop.PCurveOnFace()->Value(Fiop.Parameter(isfirst));
if (!ChFi3d_IsInSingularity(Vtx, myVEMap))
ChFi3d_AdjustSecondPointToFirstPoint(pop1, pop2, Bop);
Hc = BRep_Tool::CurveOnSurface(Arcprol,Fv,Ubid,Ubid);
pv1 = Hc->Value(parVtx);
pv2 = p2dbout;
@@ -1268,127 +1400,101 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
zob2dv,tolesp,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
//jgv
//TopoDS_Vertex CommonVertexForNewEdgeAndZobEdge = TopExp::FirstVertex(aNewEdge);
gp_Pnt aPnt = BRep_Tool::Pnt(Vtx);
gp_Pnt aPntFromCurve = zob3d->Value(zob3d->FirstParameter());
Standard_Real aDist = aPnt.Distance(aPntFromCurve);
BB.UpdateVertex(Vtx, 1.01*aDist);
TopoDS_Edge aZobEdge = BRepLib_MakeEdge(zob3d,
Vtx, VerFopFad[IFopArc],
zob3d->FirstParameter(), zob3d->LastParameter());
BB.UpdateEdge(aZobEdge, tolreached);
/*
Handle(Geom2d_Curve) AdjustedZob2dop;
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(Bop, zob3d->FirstParameter(), zob3d->LastParameter(),
zob2dop, AdjustedZob2dop);
zob2dop = AdjustedZob2dop;
*/
BB.UpdateEdge(aZobEdge, zob2dop, Bop.Face(), 0.);
/*
Handle(Geom2d_Curve) AdjustedZob2dv;
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(Bs, zob3d->FirstParameter(), zob3d->LastParameter(),
zob2dv, AdjustedZob2dv);
zob2dv = AdjustedZob2dv;
*/
BB.UpdateEdge(aZobEdge, zob2dv, Bs.Face(), 0.);
TopTools_ListOfShape aZobList, aNewZobList;
aZobList.Append(aZobEdge);
ChFi3d_SplitAndAdjust(aZobList, aNewZobList, Bop);
TopTools_ListIteratorOfListOfShape itl(aNewZobList);
for (; itl.More(); itl.Next())
myNewEdges.Add(itl.Value());
Udeb = zob3d->FirstParameter();
Ufin = zob3d->LastParameter();
TopOpeBRepDS_Curve Zob(zob3d,tolreached);
Standard_Integer IZob = DStr.AddCurve(Zob);
// it is determined if Fop has an edge of sewing
// it is determined if the curve has an intersection with the edge of sewing
Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolv));
//TopoDS_Edge edgecouture;
//Standard_Boolean couture;
ChFi3d_Couture(Fop,couture,edgecouture);
if (couture && !BRep_Tool::Degenerated(edgecouture)) {
BRepLib_MakeEdge Bedge (zob3d);
TopoDS_Edge edg =Bedge. Edge();
BRepExtrema_ExtCC extCC (edgecouture,edg);
if (extCC.IsDone()&&extCC.NbExt()!=0) {
for (Standard_Integer i=1; i<=extCC.NbExt()&&!intcouture;i++) {
if (extCC.SquareDistance(i)<=1.e-8) {
par1=extCC.ParameterOnE1(i);
par2=extCC.ParameterOnE2(i);
gp_Pnt P1=extCC.PointOnE1(i);
TopOpeBRepDS_Point tpoint(P1,1.e-4);
indpt=DStr.AddPoint(tpoint);
intcouture=Standard_True;
curv1 = new Geom_TrimmedCurve(zob3d,Udeb,par2);
curv2 = new Geom_TrimmedCurve(zob3d,par2,Ufin);
TopOpeBRepDS_Curve tcurv1(curv1,tolreached);
TopOpeBRepDS_Curve tcurv2(curv2,tolreached);
Icurv1=DStr.AddCurve(tcurv1);
Icurv2=DStr.AddCurve(tcurv2);
}
}
}
Standard_Integer IndFop;
if (!myNewFaces.Contains(Fop))
myNewFaces.Add(Fop);
IndFop = myNewFaces.FindIndex(Fop);
if (!myFaceNewEdges.Contains(IndFop))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndFop, aList);
}
if (intcouture) {
// interference of curv1 and curv2 on Ishape
Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolv));
ComputeCurve2d(curv1,Fop,c2d1);
Handle(TopOpeBRepDS_SurfaceCurveInterference)
InterFv = ChFi3d_FilCurveInDS(Icurv1,IShape,/*zob2dv*/c2d1,Et);
DStr.ChangeShapeInterferences(IShape).Append(InterFv);
ComputeCurve2d(curv2,Fop,c2d2);
InterFv = ChFi3d_FilCurveInDS(Icurv2,IShape,/*zob2dv*/c2d2,Et);
DStr.ChangeShapeInterferences(IShape).Append(InterFv);
// limitation of the sewing edge
Standard_Integer Iarc=DStr.AddShape(edgecouture);
Handle(TopOpeBRepDS_CurvePointInterference) Interfedge;
TopAbs_Orientation ori;
TopoDS_Vertex Vdeb,Vfin;
Vdeb=TopExp::FirstVertex(edgecouture);
Vfin=TopExp::LastVertex(edgecouture);
Standard_Real pard,parf;
pard=BRep_Tool::Parameter(Vdeb,edgecouture);
parf=BRep_Tool::Parameter(Vfin,edgecouture);
if (Abs(par1-pard)<Abs(parf-par1)) ori=TopAbs_REVERSED;
else ori=TopAbs_FORWARD;
Interfedge = ChFi3d_FilPointInDS(ori,Iarc,indpt,par1);
DStr.ChangeShapeInterferences(Iarc).Append(Interfedge);
// interference of curv1 and curv2 on Iop
Standard_Integer Iop = DStr.AddShape(Fop);
Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolop));
Handle(TopOpeBRepDS_SurfaceCurveInterference) Interfop;
ComputeCurve2d(curv1,Fop,c2d1);
Interfop = ChFi3d_FilCurveInDS(Icurv1,Iop,c2d1,Et);
DStr.ChangeShapeInterferences(Iop).Append(Interfop);
ComputeCurve2d(curv2,Fop,c2d2);
Interfop = ChFi3d_FilCurveInDS(Icurv2,Iop,c2d2,Et);
DStr.ChangeShapeInterferences(Iop).Append(Interfop);
Handle(TopOpeBRepDS_CurvePointInterference)
interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,Icurv1,IVtx,Udeb);
DStr.ChangeCurveInterferences(Icurv1).Append(interfprol);
interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,Icurv1,indpt,par2);
DStr.ChangeCurveInterferences(Icurv1).Append(interfprol);
Standard_Integer icc = stripe->IndexPoint(isfirst,IFopArc);
interfprol = ChFi3d_FilPointInDS(TopAbs_FORWARD,Icurv2,indpt,par2);
DStr.ChangeCurveInterferences(Icurv2).Append(interfprol);
interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,Icurv2,icc,Ufin);
DStr.ChangeCurveInterferences(Icurv2).Append(interfprol);
for (itl.Initialize(aNewZobList); itl.More(); itl.Next())
{
Standard_Integer IndZobE = myNewEdges.FindIndex(itl.Value());
//QualifiedEdge aQzobE(IndZobE, Et);
if (Et == TopAbs_REVERSED)
IndZobE *= -1;
myFaceNewEdges.ChangeFromKey(IndFv).Append(IndZobE);
//QualifiedEdge aQzopEonFop(IndZobE, TopAbs::Reverse(Et));
myFaceNewEdges.ChangeFromKey(IndFop).Append(-IndZobE);
}
else {
Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolv));
Handle(TopOpeBRepDS_SurfaceCurveInterference)
InterFv = ChFi3d_FilCurveInDS(IZob,IShape,zob2dv,Et);
DStr.ChangeShapeInterferences(IShape).Append(InterFv);
Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolop));
Standard_Integer Iop = DStr.AddShape(Fop);
Handle(TopOpeBRepDS_SurfaceCurveInterference)
Interfop = ChFi3d_FilCurveInDS(IZob,Iop,zob2dop,Et);
DStr.ChangeShapeInterferences(Iop).Append(Interfop);
Handle(TopOpeBRepDS_CurvePointInterference) interfprol;
#ifdef VARIANT1
interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IVtx,Udeb);
#else
{
Standard_Integer IV2 = DStr.AddShape(V2); // VARIANT 2
interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IV2,Udeb);
}
#endif
DStr.ChangeCurveInterferences(IZob).Append(interfprol);
Standard_Integer icc = stripe->IndexPoint(isfirst,IFopArc);
interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,IZob,icc,Ufin);
DStr.ChangeCurveInterferences(IZob).Append(interfprol);
#ifdef VARIANT1
{
if (IFopArc == 1) box1.Add( zob3d->Value(Ufin) );
else box2.Add( zob3d->Value(Ufin) );
}
#else
{
// cut off existing Arcprol
Standard_Integer iArcprol = DStr.AddShape(Arcprol);
interfprol = ChFi3d_FilPointInDS(OVtx,iArcprol,icc,Udeb);
DStr.ChangeShapeInterferences(Arcprol).Append(interfprol);
}
#endif
Handle(TopOpeBRepDS_SurfaceCurveInterference)
InterFv = ChFi3d_FilCurveInDS(IZob,IShape,zob2dv,Et);
DStr.ChangeShapeInterferences(IShape).Append(InterFv);
Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolop));
Standard_Integer Iop = DStr.AddShape(Fop);
Handle(TopOpeBRepDS_SurfaceCurveInterference)
Interfop = ChFi3d_FilCurveInDS(IZob,Iop,zob2dop,Et);
DStr.ChangeShapeInterferences(Iop).Append(Interfop);
Handle(TopOpeBRepDS_CurvePointInterference) interfprol;
#ifdef VARIANT1
interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IVtx,Udeb);
#else
{
Standard_Integer IV2 = DStr.AddShape(V2); // VARIANT 2
interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IV2,Udeb);
}
}
#endif
DStr.ChangeCurveInterferences(IZob).Append(interfprol);
Standard_Integer icc = stripe->IndexPoint(isfirst,IFopArc);
interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,IZob,icc,Ufin);
DStr.ChangeCurveInterferences(IZob).Append(interfprol);
#ifdef VARIANT1
{
if (IFopArc == 1) box1.Add( zob3d->Value(Ufin) );
else box2.Add( zob3d->Value(Ufin) );
}
#else
{
// cut off existing Arcprol
Standard_Integer iArcprol = DStr.AddShape(Arcprol);
interfprol = ChFi3d_FilPointInDS(OVtx,iArcprol,icc,Udeb);
DStr.ChangeShapeInterferences(Arcprol).Append(interfprol);
}
#endif
} //if (onsame && inters)
ChFi3d_EnlargeBox(DStr,stripe,Fd,box1,box2,isfirst);
if (CV1.IsOnArc()) {
ChFi3d_EnlargeBox(CV1.Arc(),myEFMap(CV1.Arc()),CV1.ParameterOnArc(),box1);

View File

@@ -94,6 +94,8 @@
#include <TopOpeBRepDS_Surface.hxx>
#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeVertex.hxx>
static void Reduce(const Standard_Real& p1,
const Standard_Real& p2,
@@ -146,6 +148,8 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
done = 0;
const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index);
TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
BRep_Builder BB;
TopoDS_Vertex Vertices [3];
//Information on fillets is extracted
//------------------------------------------------------
@@ -161,6 +165,9 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
ChFiDS_SequenceOfSurfData& SeqFil1 =
Corner1->ChangeSetOfSurfData()->ChangeSequence();
Handle(ChFiDS_SurfData)& Fd1 = SeqFil1.ChangeValue(IFd1);
//jgv
Standard_Integer IndexOfNewFace1 = Fd1->IndexOfFace();
/////
//the second
//----------
@@ -176,6 +183,9 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
ChFiDS_SequenceOfSurfData& SeqFil2 =
Corner2->ChangeSetOfSurfData()->ChangeSequence();
Handle(ChFiDS_SurfData)& Fd2 = SeqFil2.ChangeValue(IFd2);
//jgv
Standard_Integer IndexOfNewFace2 = Fd2->IndexOfFace();
/////
// The concavities are analysed in case of differents concavities,
// preview an evolutionary connection of type ThreeCorner of R to 0.
@@ -265,7 +275,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
}
gp_Pnt psp1 = Hpivot->Value(parCP1);
gp_Pnt psp2 = Hpivot->Value(parCP2);
Standard_Real sameparam = (psp1.Distance(psp2) < 10 * tolesp);
Standard_Boolean sameparam = (psp1.Distance(psp2) < 10 * tolesp);
TopoDS_Face FF1 = TopoDS::Face(DStr.Shape(Fd1->Index(IFaArc1)));
TopoDS_Face FF2 = TopoDS::Face(DStr.Shape(Fd2->Index(IFaArc2)));
@@ -346,6 +356,54 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
// CornerData are updated with results of the intersection.
Standard_Real WFirst = Gc->FirstParameter();
Standard_Real WLast = Gc->LastParameter();
//jgv
ChFiDS_FaceInterference& InterfArc1 = Fd1->ChangeInterference(IFaArc1);
Standard_Integer IndEarc1 = Fd1->IndexOfEdge(IFaArc1);
TopoDS_Edge EdgeArc1 = TopoDS::Edge(myNewEdges(IndEarc1));
EdgeArc1.Orientation(TopAbs_FORWARD);
Standard_Real fpar, lpar;
Handle(Geom_Curve) CurveEdgeArc1 = BRep_Tool::Curve(EdgeArc1, fpar, lpar);
if (isfirst1)
fpar = InterfArc1.FirstParameter();
else
lpar = InterfArc1.LastParameter();
BB.Range(EdgeArc1, fpar, lpar);
Vertices[1] = (isfirst1)? TopExp::FirstVertex(EdgeArc1)
: TopExp::LastVertex(EdgeArc1);
gp_Pnt aPnt = CurveEdgeArc1->Value((isfirst1)? fpar : lpar);
if (Vertices[1].IsNull())
{
Vertices[1] = BRepLib_MakeVertex(aPnt);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirst1)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeArc1, Vertices[1].Oriented(OrOfVer));
}
else
BB.UpdateVertex(Vertices[1], aPnt, 0.);
ChFiDS_FaceInterference& InterfArc2 = Fd2->ChangeInterference(IFaArc2);
Standard_Integer IndEarc2 = Fd2->IndexOfEdge(IFaArc2);
TopoDS_Edge EdgeArc2 = TopoDS::Edge(myNewEdges(IndEarc2));
EdgeArc2.Orientation(TopAbs_FORWARD);
Handle(Geom_Curve) CurveEdgeArc2 = BRep_Tool::Curve(EdgeArc2, fpar, lpar);
if (isfirst2)
fpar = InterfArc2.FirstParameter();
else
lpar = InterfArc2.LastParameter();
BB.Range(EdgeArc2, fpar, lpar);
TopoDS_Vertex aVertexArc2 = (isfirst2)? TopExp::FirstVertex(EdgeArc2)
: TopExp::LastVertex(EdgeArc2);
if (!aVertexArc2.IsSame(Vertices[1]))
{
BB.Remove(EdgeArc2, aVertexArc2);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirst2)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeArc2, Vertices[1].Oriented(OrOfVer));
}
/////
Standard_Integer Ipoin1;
Standard_Integer Ipoin2;
ChFiDS_CommonPoint& cpco1 = Fd1->ChangeVertex(isfirst1,IFaCo1);
@@ -363,6 +421,32 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
cpco1.SetPoint(PFaCo);
cpco1.SetTolerance(Max(tolreached,tolpco));
Fd1->ChangeInterference(IFaCo1).SetParameter(UIntPC1,isfirst1);
//jgv
ChFiDS_FaceInterference& Interf1 = Fd1->ChangeInterference(IFaCo1);
Standard_Integer IndEsurf1 = Fd1->IndexOfEdge(IFaCo1);
TopoDS_Edge EdgeSurf1 = TopoDS::Edge(myNewEdges(IndEsurf1));
EdgeSurf1.Orientation(TopAbs_FORWARD);
Handle(Geom_Curve) CurveEdgeSurf1 = BRep_Tool::Curve(EdgeSurf1, fpar, lpar);
//BRep_Tool::Range(EdgeSurf, fpar, lpar);
if (isfirst1)
fpar = Interf1.FirstParameter();
else
lpar = Interf1.LastParameter();
BB.Range(EdgeSurf1, fpar, lpar);
Vertices[2] = (isfirst1)? TopExp::FirstVertex(EdgeSurf1)
: TopExp::LastVertex(EdgeSurf1);
aPnt = CurveEdgeSurf1->Value((isfirst1)? fpar : lpar);
if (Vertices[2].IsNull())
{
Vertices[2] = BRepLib_MakeVertex(aPnt);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirst1)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeSurf1, Vertices[2].Oriented(OrOfVer));
}
else
BB.UpdateVertex(Vertices[2], aPnt, 0.);
/////
tolparc = Max(tolparc,tolreached);
cparc1.SetTolerance(Max(tolparc,tolreached));
Ipoin1 = ChFi3d_IndexPointInDS(Fd1->Vertex(isfirst1,1),DStr);
@@ -374,6 +458,69 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
Corner2->SetCurve(ICurv,isfirst2);
Corner2->ChangePCurve(isfirst2) = PGc2;
Fd2->ChangeInterference(IFaCo2).SetParameter(UIntPC2,isfirst2);
//jgv
ChFiDS_FaceInterference& Interf2 = Fd2->ChangeInterference(IFaCo2);
Standard_Integer IndEsurf2 = Fd2->IndexOfEdge(IFaCo2);
TopoDS_Edge EdgeSurf2 = TopoDS::Edge(myNewEdges(IndEsurf2));
EdgeSurf2.Orientation(TopAbs_FORWARD);
Handle(Geom_Curve) CurveEdgeSurf2 = BRep_Tool::Curve(EdgeSurf2, fpar, lpar);
//BRep_Tool::Range(EdgeSurf, fpar, lpar);
if (isfirst2)
fpar = Interf2.FirstParameter();
else
lpar = Interf2.LastParameter();
BB.Range(EdgeSurf2, fpar, lpar);
TopoDS_Vertex aVertex2 = (isfirst2)? TopExp::FirstVertex(EdgeSurf2)
: TopExp::LastVertex(EdgeSurf2);
if (!aVertex2.IsSame(Vertices[2]))
{
BB.Remove(EdgeSurf2, aVertex2);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirst2)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeSurf2, Vertices[2].Oriented(OrOfVer));
}
//Create new edge
gp_Pnt aPntVer = BRep_Tool::Pnt(Vertices[IFaArc1]);
gp_Pnt aPntFromCurve = Gc->Value(WFirst);
Standard_Real aDist = aPntVer.Distance(aPntFromCurve);
BB.UpdateVertex(Vertices[IFaArc1], 1.01*aDist);
TopoDS_Edge aNewEdge = BRepLib_MakeEdge(Gc,
Vertices[IFaArc1], Vertices[IFaCo1],
WFirst, WLast);
BB.UpdateEdge(aNewEdge, tolreached);
TopLoc_Location aLoc;
BB.UpdateEdge(aNewEdge, PGc1, DStr.Surface(Fd1->Surf()).Surface(), aLoc, 0.);
BB.UpdateEdge(aNewEdge, PGc2, DStr.Surface(Fd2->Surf()).Surface(), aLoc, 0.);
myNewEdges.Add(aNewEdge);
//Temporary
//TopAbs_Orientation Or1 = Fd1->Orientation();
//TopAbs_Orientation Or2 = Fd2->Orientation();
///////////
Standard_Integer IndE = myNewEdges.FindIndex(aNewEdge);
Standard_Boolean IsFirstArcForward = Standard_True;
const TColStd_ListOfInteger& Elist = myFaceNewEdges.FindFromKey(IndexOfNewFace1);
TColStd_ListIteratorOfListOfInteger itl(Elist);
for (; itl.More(); itl.Next())
{
Standard_Integer anIndexOfEdge = itl.Value();
if (Abs(anIndexOfEdge) == IndEarc1)
{
IsFirstArcForward = (anIndexOfEdge > 0);
break;
}
}
if ((isfirst1 && IFaArc1 == 1 && IsFirstArcForward) ||
(!isfirst1 && IFaArc1 == 2 && IsFirstArcForward))
IndE *= -1;
//QualifiedEdge aQE(IndE, Et);
myFaceNewEdges.ChangeFromKey(IndexOfNewFace1).Append(IndE);
Standard_Integer IndE_forNewFace2 = IndE;
if (Fd1->Orientation() == Fd2->Orientation())
IndE_forNewFace2 *= -1;
myFaceNewEdges.ChangeFromKey(IndexOfNewFace2).Append(IndE_forNewFace2);
/////
Fd2->ChangeVertex(isfirst2,IFaCo2) = Fd1->Vertex(isfirst1,IFaCo1);
Fd2->ChangeVertex(isfirst2,IFaArc2) = Fd1->Vertex(isfirst1,IFaArc1);
if (IFaCo1!=IFaCo2) Corner2->SetOrientation(TopAbs_REVERSED,isfirst2);
@@ -414,6 +561,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
Standard_Integer IFaCoBig, IFaCoSma, IFaArcBig, IFaArcSma;
Standard_Boolean isfirstBig, isfirstSma;
Standard_Real UIntPCBig, UIntPCSma;
Standard_Integer IndexOfSmaNewFace, IndexOfBigNewFace;
if((parcrois && parCP2 > parCP1) || (!parcrois && parCP2 < parCP1)){
UIntPCBig = UIntPC2; UIntPCSma = UIntPC1;
@@ -423,6 +571,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
IFaCoBig = IFaCo2; IFaCoSma = IFaCo1;
IFaArcBig = IFaArc2; IFaArcSma = IFaArc1;
isfirstBig = isfirst2; isfirstSma = isfirst1;
IndexOfSmaNewFace = IndexOfNewFace1; IndexOfBigNewFace = IndexOfNewFace2;
}
else{
UIntPCBig = UIntPC1, UIntPCSma = UIntPC2;
@@ -432,6 +581,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
IFaCoBig = IFaCo1; IFaCoSma = IFaCo2;
IFaArcBig = IFaArc1; IFaArcSma = IFaArc2;
isfirstBig = isfirst1; isfirstSma = isfirst2;
IndexOfSmaNewFace = IndexOfNewFace2; IndexOfBigNewFace = IndexOfNewFace1;
}
//Intersection of the big with the small :
@@ -511,10 +661,62 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
psmaco.SetPoint(PFaCo);
psmaco.SetTolerance(Max(tolpco,tolreached));
SmaFD->ChangeInterference(IFaCoSma).SetParameter(UIntPCSma,isfirstSma);
//jgv
ChFiDS_FaceInterference& SmaInterf = SmaFD->ChangeInterference(IFaCoSma);
Standard_Integer IndEsmall = SmaFD->IndexOfEdge(IFaCoSma);
TopoDS_Edge EdgeSmall = TopoDS::Edge(myNewEdges(IndEsmall));
EdgeSmall.Orientation(TopAbs_FORWARD);
Standard_Real fpar, lpar;
Handle(Geom_Curve) CurveEdgeSma = BRep_Tool::Curve(EdgeSmall, fpar, lpar);
//BRep_Tool::Range(EdgeSmall, fpar, lpar);
if (isfirstSma)
fpar = SmaInterf.FirstParameter();
else
lpar = SmaInterf.LastParameter();
BB.Range(EdgeSmall, fpar, lpar);
Vertices[2] = (isfirstSma)? TopExp::FirstVertex(EdgeSmall)
: TopExp::LastVertex(EdgeSmall);
gp_Pnt aPnt = CurveEdgeSma->Value((isfirstSma)? fpar : lpar);
if (Vertices[2].IsNull())
{
Vertices[2] = BRepLib_MakeVertex(aPnt);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirstSma)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeSmall, Vertices[2].Oriented(OrOfVer));
}
else
BB.UpdateVertex(Vertices[2], aPnt, 0.);
/////
psmamil.Reset();
psmamil.SetPoint(PMil);
psmamil.SetTolerance(Max(tolpmil,tolreached));
SmaFD->ChangeInterference(IFaArcSma).SetParameter(wi,isfirstSma);
//jgv
ChFiDS_FaceInterference& SmaArcInterf = SmaFD->ChangeInterference(IFaArcSma);
Standard_Integer IndEarcsmall = SmaFD->IndexOfEdge(IFaArcSma);
TopoDS_Edge EdgeArcSmall = TopoDS::Edge(myNewEdges(IndEarcsmall));
EdgeArcSmall.Orientation(TopAbs_FORWARD);
Handle(Geom_Curve) CurveEdgeArcSma = BRep_Tool::Curve(EdgeArcSmall, fpar, lpar);
if (isfirstSma)
fpar = SmaArcInterf.FirstParameter();
else
lpar = SmaArcInterf.LastParameter();
BB.Range(EdgeArcSmall, fpar, lpar);
Vertices[1] = (isfirstSma)? TopExp::FirstVertex(EdgeArcSmall)
: TopExp::LastVertex(EdgeArcSmall);
aPnt = CurveEdgeArcSma->Value((isfirstSma)? fpar : lpar);
if (Vertices[1].IsNull())
{
Vertices[1] = BRepLib_MakeVertex(aPnt);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirstSma)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeArcSmall, Vertices[1].Oriented(OrOfVer));
}
else
BB.UpdateVertex(Vertices[1], aPnt, 0.);
/////
IpointCo = ChFi3d_IndexPointInDS(psmaco,DStr);
SmaCD->SetIndexPoint(IpointCo,isfirstSma,IFaCoSma);
IpointMil = ChFi3d_IndexPointInDS(psmamil,DStr);
@@ -525,6 +727,87 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
BigCD->SetIndexPoint(IpointCo,isfirstBig,IFaCoBig);
BigFD->ChangeVertex(isfirstBig,IFaCoBig) = psmaco;
BigFD->ChangeInterference(IFaCoBig).SetParameter(UIntPCBig,isfirstBig);
//jgv
ChFiDS_FaceInterference& BigInterf = BigFD->ChangeInterference(IFaCoBig);
Standard_Integer IndEbig = BigFD->IndexOfEdge(IFaCoBig);
TopoDS_Edge EdgeBig = TopoDS::Edge(myNewEdges(IndEbig));
EdgeBig.Orientation(TopAbs_FORWARD);
//???
TopoDS_Vertex BigVer [3];
Handle(Geom_Curve) CurveEdgeBig = BRep_Tool::Curve(EdgeBig, fpar, lpar);
//BRep_Tool::Range(EdgeBig, fpar, lpar);
if (isfirstBig)
fpar = BigInterf.FirstParameter();
else
lpar = BigInterf.LastParameter();
BB.Range(EdgeBig, fpar, lpar);
BigVer[2] = (isfirstBig)? TopExp::FirstVertex(EdgeBig)
: TopExp::LastVertex(EdgeBig);
aPnt = CurveEdgeBig->Value((isfirstBig)? fpar : lpar);
//if (BigVer[2].IsNull())
if (!BigVer[2].IsSame(Vertices[2]))
{
//BigVer[2] = BRepLib_MakeVertex(aPnt);
BB.Remove(EdgeBig, BigVer[2]);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirstBig)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeBig, Vertices[2].Oriented(OrOfVer));
}
/////
ChFiDS_FaceInterference& BigArcInterf = BigFD->ChangeInterference(IFaArcBig);
Standard_Integer IndEarcbig = BigFD->IndexOfEdge(IFaArcBig);
TopoDS_Edge EdgeArcBig = TopoDS::Edge(myNewEdges(IndEarcbig));
EdgeArcBig.Orientation(TopAbs_FORWARD);
//???
Handle(Geom_Curve) CurveEdgeArcBig = BRep_Tool::Curve(EdgeArcBig, fpar, lpar);
if (isfirstBig)
fpar = BigArcInterf.FirstParameter();
else
lpar = BigArcInterf.LastParameter();
BB.Range(EdgeArcBig, fpar, lpar);
BigVer[1] = (isfirstBig)? TopExp::FirstVertex(EdgeArcBig)
: TopExp::LastVertex(EdgeArcBig);
aPnt = CurveEdgeArcBig->Value((isfirstBig)? fpar : lpar);
if (BigVer[1].IsNull())
{
BigVer[1] = BRepLib_MakeVertex(aPnt);
TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
if (!isfirstBig)
OrOfVer = TopAbs_REVERSED;
BB.Add(EdgeArcBig, BigVer[1].Oriented(OrOfVer));
}
else
BB.UpdateVertex(BigVer[1], aPnt, 0.);
/////
//Create new edge
gp_Pnt aPntVer = BRep_Tool::Pnt(Vertices[2]);
gp_Pnt aPntFromCurve = Gc->Value(WFirst);
Standard_Real aDist = aPntVer.Distance(aPntFromCurve);
BB.UpdateVertex(Vertices[2], 1.01*aDist);
TopoDS_Edge aNewEdge = BRepLib_MakeEdge(Gc,
Vertices[2], Vertices[1],
WFirst, WLast);
BB.UpdateEdge(aNewEdge, tolreached);
TopLoc_Location aLoc;
BB.UpdateEdge(aNewEdge, PGc1, DStr.Surface(SmaFD->Surf()).Surface(), aLoc, 0.);
BB.UpdateEdge(aNewEdge, PGc2, DStr.Surface(BigFD->Surf()).Surface(), aLoc, 0.);
myNewEdges.Add(aNewEdge);
Standard_Integer IndE = myNewEdges.FindIndex(aNewEdge);
if (isfirstSma && IFaArcSma == 1 ||
!isfirstSma && IFaArcSma == 2)
IndE *= -1;
//QualifiedEdge aQE(IndE, Et);
myFaceNewEdges.ChangeFromKey(IndexOfSmaNewFace).Append(IndE);
Standard_Integer IndE_forBigNewFace = IndE;
if (SmaFD->Orientation() == BigFD->Orientation())
IndE_forBigNewFace *= -1;
myFaceNewEdges.ChangeFromKey(IndexOfBigNewFace).Append(IndE_forBigNewFace);
/////
TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(ICurv);
Handle(TopOpeBRepDS_CurvePointInterference) Interfp;
@@ -619,6 +902,37 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
// End of update of the BigCD and the DS.
WFirst = Gc->FirstParameter();
WLast = Gc->LastParameter();
//Create additional new edge
TopoDS_Edge anAdditionalNewEdge = BRepLib_MakeEdge(Gc,
Vertices[1], BigVer[1],
WFirst, WLast);
BB.UpdateEdge(anAdditionalNewEdge, tolreached);
BB.UpdateEdge(anAdditionalNewEdge, PGc1, F, 0.);
BB.UpdateEdge(anAdditionalNewEdge, PGc2, DStr.Surface(BigFD->Surf()).Surface(), aLoc, 0.);
myNewEdges.Add(anAdditionalNewEdge);
IndE = myNewEdges.FindIndex(anAdditionalNewEdge);
if (IndE_forBigNewFace < 0)
IndE *= -1;
//QualifiedEdge aQE(IndE, Et);
myFaceNewEdges.ChangeFromKey(IndexOfBigNewFace).Append(IndE);
Standard_Integer IndE_forOldFace = IndE;
if (BigFD->Orientation() == F.Orientation())
IndE_forOldFace *= -1;
Standard_Integer IndF;
if (!myNewFaces.Contains(F))
myNewFaces.Add(F);
IndF = myNewFaces.FindIndex(F);
if (!myFaceNewEdges.Contains(IndF))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndF, aList);
}
myFaceNewEdges.ChangeFromKey(IndF).Append(IndE_forOldFace);
/////
ICurv = DStr.AddCurve(TopOpeBRepDS_Curve(Gc,tolreached));
cpend.SetTolerance(Max(cpend.Tolerance(),tolreached));
IpointArc = ChFi3d_IndexPointInDS(cpend,DStr);

View File

@@ -24,9 +24,11 @@
IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_SurfData,Standard_Transient)
ChFiDS_SurfData::ChFiDS_SurfData () :
indexOfS1(0),indexOfS2(0),indexOfConge(0),
isoncurv1(0),isoncurv2(0),twistons1(0),twistons2(0)
ChFiDS_SurfData::ChFiDS_SurfData ()
: indexOfS1(0),indexOfS2(0),
indexOfE1(0),indexOfE2(0),
indexOfConge(0),
isoncurv1(0),isoncurv2(0),twistons1(0),twistons2(0)
{}
//=======================================================================
@@ -38,6 +40,8 @@ void ChFiDS_SurfData::Copy(const Handle(ChFiDS_SurfData)& Other)
{
indexOfS1 = Other->indexOfS1;
indexOfS2 = Other->indexOfS2;
indexOfE1 = Other->indexOfE1;
indexOfE2 = Other->indexOfE2;
indexOfConge = Other->indexOfConge;
orientation = Other->orientation;
intf1 = Other->intf1;
@@ -75,6 +79,19 @@ Standard_Integer ChFiDS_SurfData::Index(const Standard_Integer OfS) const
else return indexOfS2;
}
//=======================================================================
//function : IndexOfEdge
//purpose :
//=======================================================================
inline Standard_Integer ChFiDS_SurfData::IndexOfEdge(const Standard_Integer OnS) const
{
if (OnS == 1)
return indexOfE1;
else
return indexOfE2;
}
//=======================================================================
//function : Interference
//purpose :
@@ -87,9 +104,8 @@ const ChFiDS_FaceInterference& ChFiDS_SurfData::Interference
else return intf2;
}
//=======================================================================
//function : Interference
//function : ChangeInterference
//purpose :
//=======================================================================

View File

@@ -81,6 +81,12 @@ public:
void ChangeIndexOfS2 (const Standard_Integer Index);
void ChangeIndexOfFace (const Standard_Integer Index);
void ChangeIndexOfE1 (const Standard_Integer Index);
void ChangeIndexOfE2 (const Standard_Integer Index);
void ChangeSurf (const Standard_Integer Index);
void SetIndexOfC1 (const Standard_Integer Index);
@@ -105,8 +111,12 @@ public:
Standard_EXPORT ChFiDS_FaceInterference& ChangeInterference (const Standard_Integer OnS);
Standard_EXPORT Standard_Integer IndexOfFace () const;
Standard_EXPORT Standard_Integer Index (const Standard_Integer OfS) const;
Standard_EXPORT Standard_Integer IndexOfEdge(const Standard_Integer OfS) const;
//! returns one of the four vertices wether First is true
//! or wrong and OnS equals 1 or 2.
Standard_EXPORT const ChFiDS_CommonPoint& Vertex (const Standard_Boolean First, const Standard_Integer OnS) const;
@@ -187,7 +197,11 @@ private:
Standard_Integer indexOfC1;
Standard_Integer indexOfS2;
Standard_Integer indexOfC2;
Standard_Integer indexOfE1;
Standard_Integer indexOfE2;
Standard_Integer indexOfFace;
Standard_Integer indexOfConge;
Standard_Boolean isoncurv1;
Standard_Boolean isoncurv2;
Standard_Boolean twistons1;

View File

@@ -98,6 +98,16 @@ inline void ChFiDS_SurfData::SetIndexOfC2 (const Standard_Integer theIndex)
isoncurv2 = (theIndex != 0);
}
//=======================================================================
//function : IndexOfFace
//purpose :
//=======================================================================
inline Standard_Integer ChFiDS_SurfData::IndexOfFace()const
{
return indexOfFace;
}
//=======================================================================
//function : Surf
//purpose :
@@ -201,6 +211,36 @@ inline void ChFiDS_SurfData::ChangeIndexOfS2(const Standard_Integer Index)
indexOfS2 = Index;
}
//=======================================================================
//function : ChangeIndexOfFace
//purpose :
//=======================================================================
inline void ChFiDS_SurfData::ChangeIndexOfFace(const Standard_Integer Index)
{
indexOfFace = Index;
}
//=======================================================================
//function : ChangeIndexOfE1
//purpose :
//=======================================================================
inline void ChFiDS_SurfData::ChangeIndexOfE1(const Standard_Integer Index)
{
indexOfE1 = Index;
}
//=======================================================================
//function : ChangeIndexOfE2
//purpose :
//=======================================================================
inline void ChFiDS_SurfData::ChangeIndexOfE2(const Standard_Integer Index)
{
indexOfE2 = Index;
}
//=======================================================================
//function : ChangeSurf
//purpose :

View File

@@ -82,6 +82,8 @@
#include <TopOpeBRepDS_Curve.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TopOpeBRepDS_Surface.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
//#include <BRepAdaptor_Curve2d.hxx>
//#include <BRepAdaptor_HCurve2d.hxx>
@@ -91,9 +93,15 @@
//=======================================================================
Standard_Boolean ChFiKPart_ComputeData::Compute
(TopOpeBRepDS_DataStructure& DStr,
TopTools_IndexedMapOfShape& theNewFaces,
TopTools_IndexedMapOfShape& theNewEdges,
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
TColStd_MapOfInteger& theIndsChFiFaces,
Handle(ChFiDS_SurfData)& Data,
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
//const Handle(Adaptor3d_HSurface)& S1,
//const Handle(Adaptor3d_HSurface)& S2,
const Handle(BRepAdaptor_HSurface)& S1,
const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Handle(ChFiDS_Spine)& Sp,
@@ -115,15 +123,16 @@
// Return orientations.
TopAbs_Orientation OrFace1 = TopAbs_FORWARD, OrFace2 = TopAbs_FORWARD;
Handle(BRepAdaptor_HSurface) HS = Handle(BRepAdaptor_HSurface)::DownCast(S1);
if (!HS.IsNull()) OrFace1 = HS->ChangeSurface().Face().Orientation();
HS = Handle(BRepAdaptor_HSurface)::DownCast(S2);
if (!HS.IsNull()) OrFace2 = HS->ChangeSurface().Face().Orientation();
//Handle(BRepAdaptor_HSurface) HS = Handle(BRepAdaptor_HSurface)::DownCast(S1);
OrFace1 = S1->ChangeSurface().Face().Orientation();
//HS = Handle(BRepAdaptor_HSurface)::DownCast(S2);
OrFace2 = S2->ChangeSurface().Face().Orientation();
if(!Spine.IsNull()){
Standard_Real Radius = Spine->Radius(Iedge);
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Plane(),
surfok = ChFiKPart_MakeFillet(DStr,theNewFaces,theNewEdges,theFaceNewEdges,theIndsChFiFaces,
Data,S1,S2,
Or1,Or2,Radius,Spine->Line(),
Wref,OrFace1);
}

View File

@@ -25,9 +25,16 @@
#include <TopAbs_Orientation.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <NCollection_IndexedDataMap.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
class TopOpeBRepDS_DataStructure;
class ChFiDS_SurfData;
class Adaptor3d_HSurface;
class BRepAdaptor_HSurface;
class ChFiDS_Spine;
class gp_Pnt2d;
@@ -49,16 +56,62 @@ public:
//! Computes a simple fillet in several particular
//! cases.
Standard_EXPORT static Standard_Boolean Compute (TopOpeBRepDS_DataStructure& DStr, Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation Or1, const TopAbs_Orientation Or2, const Handle(ChFiDS_Spine)& Sp, const Standard_Integer Iedge);
Standard_EXPORT static Standard_Boolean Compute (TopOpeBRepDS_DataStructure& DStr,
TopTools_IndexedMapOfShape& theNewFaces,
TopTools_IndexedMapOfShape& theNewEdges,
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
TColStd_MapOfInteger& theIndsChFiFaces,
Handle(ChFiDS_SurfData)& Data,
//const Handle(Adaptor3d_HSurface)& S1,
//const Handle(Adaptor3d_HSurface)& S2,
const Handle(BRepAdaptor_HSurface)& S1,
const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Handle(ChFiDS_Spine)& Sp,
const Standard_Integer Iedge);
//! Computes a toric or spheric corner fillet.
Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr, const Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation OrFace1, const TopAbs_Orientation OrFace2, const TopAbs_Orientation Or1, const TopAbs_Orientation Or2, const Standard_Real minRad, const Standard_Real majRad, const gp_Pnt2d& P1S1, const gp_Pnt2d& P2S1, const gp_Pnt2d& P1S2, const gp_Pnt2d& P2S2);
Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr,
const Handle(ChFiDS_SurfData)& Data,
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation OrFace1,
const TopAbs_Orientation OrFace2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real minRad,
const Standard_Real majRad,
const gp_Pnt2d& P1S1,
const gp_Pnt2d& P2S1,
const gp_Pnt2d& P1S2,
const gp_Pnt2d& P2S2);
//! Computes spheric corner fillet with non iso pcurve on S2.
Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr, const Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation OrFace1, const TopAbs_Orientation OrFace2, const TopAbs_Orientation Or1, const TopAbs_Orientation Or2, const Standard_Real Rad, const gp_Pnt2d& PS1, const gp_Pnt2d& P1S2, const gp_Pnt2d& P2S2);
Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr,
const Handle(ChFiDS_SurfData)& Data,
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation OrFace1,
const TopAbs_Orientation OrFace2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real Rad,
const gp_Pnt2d& PS1,
const gp_Pnt2d& P1S2,
const gp_Pnt2d& P2S2);
//! Computes a toric corner rotule.
Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr, const Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation OfS, const TopAbs_Orientation OS, const TopAbs_Orientation OS1, const TopAbs_Orientation OS2, const Standard_Real Radius);
Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr,
const Handle(ChFiDS_SurfData)& Data,
const Handle(Adaptor3d_HSurface)& S,
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation OfS,
const TopAbs_Orientation OS,
const TopAbs_Orientation OS1,
const TopAbs_Orientation OS2,
const Standard_Real Radius);

View File

@@ -15,7 +15,8 @@
// commercial license or contractual agreement.
#include <Adaptor3d_HSurface.hxx>
//#include <Adaptor3d_HSurface.hxx>
#include <BRepAdaptor_HSurface.hxx>
#include <ChFiDS_Spine.hxx>
#include <ChFiDS_SurfData.hxx>
#include <ChFiKPart_ComputeData.hxx>
@@ -40,15 +41,25 @@
#include <IntAna_QuadQuadGeo.hxx>
#include <Precision.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <BRep_Builder.hxx>
#include <BRepLib_MakeEdge.hxx>
//=======================================================================
//function : MakeFillet
//Purpose : cas plan/plan.
//=======================================================================
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
TopTools_IndexedMapOfShape& theNewFaces,
TopTools_IndexedMapOfShape& theNewEdges,
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
const gp_Pln& Pl1,
const gp_Pln& Pl2,
//const gp_Pln& Pl1,
//const gp_Pln& Pl2,
const Handle(BRepAdaptor_HSurface)& S1,
const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real Radius,
@@ -56,6 +67,28 @@ Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
const Standard_Real First,
const TopAbs_Orientation Of1)
{
Standard_Integer IndF1, IndF2;
if (!theNewFaces.Contains(S1->ChangeSurface().Face()))
theNewFaces.Add(S1->ChangeSurface().Face());
IndF1 = theNewFaces.FindIndex(S1->ChangeSurface().Face());
if (!theFaceNewEdges.Contains(IndF1))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
theFaceNewEdges.Add(IndF1, aList);
}
if (!theNewFaces.Contains(S2->ChangeSurface().Face()))
theNewFaces.Add(S2->ChangeSurface().Face());
IndF2 = theNewFaces.FindIndex(S2->ChangeSurface().Face());
if (!theFaceNewEdges.Contains(IndF2))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
theFaceNewEdges.Add(IndF2, aList);
}
gp_Pln Pl1 = S1->Plane();
gp_Pln Pl2 = S2->Plane();
//calcul du cylindre
gp_Ax3 Pos1 = Pl1.Position();
@@ -146,6 +179,56 @@ Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
Data->ChangeInterferenceOnS2().
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln2,DStr),
trans,GLin2dPln2,GLin2dCyl2);
//Add new face and its new edges in the maps
BRep_Builder BB;
TopLoc_Location aLoc;
TopoDS_Face aNewFace;
BB.MakeFace(aNewFace);
BB.UpdateFace(aNewFace, gcyl, aLoc, Precision::Confusion());
aNewFace.Orientation(Data->Orientation());
Standard_Integer IndNewFace = theNewFaces.Add(aNewFace);
theIndsChFiFaces.Add(IndNewFace);
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
theFaceNewEdges.Add(IndNewFace, aList);
Data->ChangeIndexOfFace(IndNewFace);
TopoDS_Edge Boundary1, Boundary2;
Boundary1 = BRepLib_MakeEdge(GLinPln1);
BB.UpdateEdge(Boundary1, GLin2dPln1, S1->ChangeSurface().Face(), 0.);
BB.UpdateEdge(Boundary1, GLin2dCyl1, aNewFace, 0.);
theNewEdges.Add(Boundary1);
Standard_Integer IndE1 = theNewEdges.FindIndex(Boundary1);
Data->ChangeIndexOfE1(IndE1);
//QualifiedEdge aQE1(IndE1, Et);
if (Data->Orientation() == TopAbs_REVERSED)
IndE1 *= -1;
theFaceNewEdges.ChangeFromKey(IndF1).Append(IndE1);
Standard_Integer IndE1_forNewFace = IndE1;
if (Data->Orientation() == TopAbs_FORWARD)
IndE1_forNewFace *= -1;
//theFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE1);
theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE1_forNewFace);
Boundary2 = BRepLib_MakeEdge(GLinPln2);
BB.UpdateEdge(Boundary2, GLin2dPln2, S2->ChangeSurface().Face(), 0.);
BB.UpdateEdge(Boundary2, GLin2dCyl2, aNewFace, 0.);
theNewEdges.Add(Boundary2);
Standard_Integer IndE2 = theNewEdges.FindIndex(Boundary2);
Data->ChangeIndexOfE2(IndE2);
IndE2 *= -1;
if (Data->Orientation() == TopAbs_REVERSED)
IndE2 *= -1;
theFaceNewEdges.ChangeFromKey(IndF2).Append(IndE2);
Standard_Integer IndE2_forNewFace = IndE2;
if (Data->Orientation() == TopAbs_FORWARD)
IndE2_forNewFace *= -1;
//theFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE2);
theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE2_forNewFace);
return Standard_True;
}

View File

@@ -18,9 +18,15 @@
#define ChFiKPart_ComputeData_PlnPln_HeaderFile
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
TopTools_IndexedMapOfShape& theNewFaces,
TopTools_IndexedMapOfShape& theNewEdges,
NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
const gp_Pln& Pl1,
const gp_Pln& Pl2,
//const gp_Pln& Pl1,
//const gp_Pln& Pl2,
const Handle(BRepAdaptor_HSurface)& S1,
const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real Radius,

View File

@@ -128,7 +128,7 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
norm.Normalize();
norm.Normalized();
dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}

View File

@@ -1291,43 +1291,42 @@ void DBRep::Set(const Standard_CString Name, const TopoDS_Shape& S)
Draw::Set(Name,D);
}
//=======================================================================
//function : getShape
//purpose :
//function : Get
//purpose :
//=======================================================================
TopoDS_Shape DBRep::getShape (Standard_CString& theName,
TopAbs_ShapeEnum theType,
Standard_Boolean theToComplain)
TopoDS_Shape DBRep::Get(Standard_CString& name,
const TopAbs_ShapeEnum typ,
const Standard_Boolean complain)
{
const Standard_Boolean toPick = theName[0] == '.';
Handle(DBRep_DrawableShape) aDrawable = Handle(DBRep_DrawableShape)::DownCast (Draw::Get (theName));
if (aDrawable.IsNull())
{
return TopoDS_Shape();
}
TopoDS_Shape aShape = aDrawable->Shape();
if (theType != TopAbs_SHAPE
&& theType != aShape.ShapeType()
&& toPick)
{
// try to find prom pick
Standard_Real u, v;
DBRep_DrawableShape::LastPick (aShape, u, v);
}
if (theType != TopAbs_SHAPE
&& theType != aShape.ShapeType())
{
if (theToComplain)
{
std::cout << theName << " is not a ";
TopAbs::Print (theType, std::cout);
std::cout << " but a ";
TopAbs::Print (aShape.ShapeType(), std::cout);
std::cout << std::endl;
Standard_Boolean pick = name[0] == '.';
TopoDS_Shape S;
Handle(DBRep_DrawableShape) D;
Handle(Draw_Drawable3D) DD = Draw::Get(name,complain);
if (!DD.IsNull())
D = Handle(DBRep_DrawableShape)::DownCast(DD);
if (!D.IsNull()) {
S = D->Shape();
if (typ != TopAbs_SHAPE) {
if (typ != S.ShapeType()) {
// try to find prom pick
if (pick) {
Standard_Real u,v;
DBRep_DrawableShape::LastPick(S,u,v);
}
}
if (typ != S.ShapeType()) {
if (complain) {
cout << name << " is not a ";
TopAbs::Print(typ,cout);
cout << " but a ";
TopAbs::Print(S.ShapeType(),cout);
cout << endl;
}
S = TopoDS_Shape();
}
}
return TopoDS_Shape();
}
return aShape;
return S;
}
static Standard_Integer XProgress (Draw_Interpretor& di, Standard_Integer argc, const char **argv)

View File

@@ -17,10 +17,23 @@
#ifndef _DBRep_HeaderFile
#define _DBRep_HeaderFile
#include <Draw_Interpretor.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_CString.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Boolean.hxx>
#include <Draw_Interpretor.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Shape;
class DBRep_Edge;
class DBRep_Face;
class DBRep_HideData;
class DBRep_DrawableShape;
class DBRep_IsoBuilder;
//! Used to display BRep objects using the DrawTrSurf
//! package.
@@ -41,46 +54,12 @@ public:
//! variable if already set.
Standard_EXPORT static void Set (const Standard_CString Name, const TopoDS_Shape& S);
//! Returns the shape in the variable.
//! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
//! @param theType [in] shape type filter; function will return NULL if shape has different type
//! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
static TopoDS_Shape Get (Standard_CString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
{
return getShape (theName, theType, theToComplain);
}
//! Returns the shape in the variable.
//! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
//! @param theType [in] shape type filter; function will return NULL if shape has different type
//! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
static TopoDS_Shape Get (TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
{
Standard_CString aNamePtr = theName.ToCString();
TopoDS_Shape aShape = getShape (aNamePtr, theType, theToComplain);
if (aNamePtr != theName.ToCString())
{
theName = aNamePtr;
}
return aShape;
}
//! Returns the shape in the variable.
//! @param theName [in] variable name
//! @param theType [in] shape type filter; function will return NULL if shape has different type
//! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
static TopoDS_Shape GetExisting (const TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
{
if (theName.Length() == 1
&& theName.Value (1) == '.')
{
return TopoDS_Shape();
}
Standard_CString aNamePtr = theName.ToCString();
return getShape (aNamePtr, theType, theToComplain);
}
//! Returns the shape in the variable <Name>. Returns
//! a null shape if the variable is not set or not of
//! the given <Typ>. If <Complain> is True a message
//! is printed on cout if the variable is not set.
Standard_EXPORT static TopoDS_Shape Get (Standard_CString& Name, const TopAbs_ShapeEnum Typ = TopAbs_SHAPE, const Standard_Boolean Complain = Standard_False);
//! Defines the basic commands.
Standard_EXPORT static void BasicCommands (Draw_Interpretor& theCommands);
@@ -107,16 +86,32 @@ public:
//! get progress indicator
Standard_EXPORT static Standard_Integer Discretisation();
protected:
//! Returns the shape in the variable.
//! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
//! @param theType [in] shape type filter; function will return NULL if shape has different type
//! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
Standard_EXPORT static TopoDS_Shape getShape (Standard_CString& theName,
TopAbs_ShapeEnum theType,
Standard_Boolean theToComplain);
private:
friend class DBRep_Edge;
friend class DBRep_Face;
friend class DBRep_HideData;
friend class DBRep_DrawableShape;
friend class DBRep_IsoBuilder;
};
#endif // _DBRep_HeaderFile

View File

@@ -75,7 +75,7 @@ Standard_Boolean DDF::GetDF (Standard_CString& Name,
Handle(TDF_Data)& DF,
const Standard_Boolean Complain)
{
Handle(Standard_Transient) t = Draw::Get (Name);
Handle(Standard_Transient) t = Draw::Get(Name, Complain);
Handle(DDF_Data) DDF = Handle(DDF_Data)::DownCast (t);
//Handle(DDF_Data) DDF = Handle(DDF_Data)::DownCast (Draw::Get(Name, Complain));
if (!DDF.IsNull()) {

View File

@@ -103,12 +103,8 @@ static Standard_Integer DFOpenLabel (Draw_Interpretor& di,
{
if (n < 2) return 1;
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
return 1;
}
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True));
TDF_Label lab;
if (n == 3) TDF_Tool::Label(browser->Data(),a[2],lab);
@@ -132,12 +128,8 @@ static Standard_Integer DFOpenAttributeList(Draw_Interpretor& di,
{
if (n < 3) return 1;
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
return 1;
}
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True));
TDF_Label lab;
TDF_Tool::Label(browser->Data(),a[2],lab);
@@ -165,12 +157,8 @@ static Standard_Integer DFOpenAttribute (Draw_Interpretor& di,
{
if (n < 3) return 1;
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
return 1;
}
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True));
const Standard_Integer index = Draw::Atoi(a[2]);
TCollection_AsciiString list = browser->OpenAttribute(index);

View File

@@ -86,26 +86,18 @@ static Standard_Integer DDataStd_PNT (Draw_Interpretor& di,
//purpose : Rmdraw (name)
//=======================================================================
static Standard_Integer DDataStd_Rmdraw (Draw_Interpretor& ,
static Standard_Integer DDataStd_Rmdraw (Draw_Interpretor& di,
Standard_Integer nb,
const char** arg)
{
if (nb != 2)
{
std::cout << "Syntax error: wrong number of arguments\n";
return 1;
}
if (Handle(Draw_Drawable3D) D3D = Draw::Get (arg[1]))
{
dout.RemoveDrawable (D3D);
if (nb == 2) {
Handle(Draw_Drawable3D) D3D;
D3D = Draw::Get(arg[1],Standard_True);
if (!D3D.IsNull()) dout.RemoveDrawable(D3D);
return 0;
}
else
{
std::cout << "Syntax error: variable '" << arg[1] << "' not found\n";
return 1;
}
di << "DDataStd_Rmdraw : Error : not done\n";
return 1;
}
//=======================================================================

View File

@@ -347,12 +347,8 @@ static Standard_Integer DDataStd_OpenNode (Draw_Interpretor& di,
{
if (n < 2) return 1;
Handle(DDataStd_TreeBrowser) browser = Handle(DDataStd_TreeBrowser)::DownCast (Draw::GetExisting (a[1]));
if (browser.IsNull())
{
std::cout << "Syntax error: browser '" << a[1] << "' not found\n";
return 1;
}
Handle(DDataStd_TreeBrowser) browser =
Handle(DDataStd_TreeBrowser)::DownCast (Draw::Get(a[1], Standard_True));
TDF_Label lab;
if (n == 3) TDF_Tool::Label(browser->Label().Data(),a[2],lab);

View File

@@ -71,7 +71,10 @@ Standard_Boolean DDocStd::GetDocument (Standard_CString& Name,
Handle(TDocStd_Document)& DOC,
const Standard_Boolean Complain)
{
Handle(DDocStd_DrawDocument) DD = Handle(DDocStd_DrawDocument)::DownCast (Draw::GetExisting (Name));
Handle(Draw_Drawable3D) D = Draw::Get(Name,Standard_False);
Handle(DDocStd_DrawDocument) DD = Handle(DDocStd_DrawDocument)::DownCast (D);
if (DD.IsNull()) {
if (Complain) cout << Name << " is not a Document" << endl;
return Standard_False;

View File

@@ -348,10 +348,8 @@ static Standard_Integer DDocStd_Close (Draw_Interpretor& /*theDI*/,
aDocApp->Close (aDoc);
if (Handle(Draw_Drawable3D) aDrawable = Draw::GetExisting (aDocName))
{
dout.RemoveDrawable (aDrawable);
}
Handle(Draw_Drawable3D) aDrawable = Draw::Get (aDocName, Standard_False);
dout.RemoveDrawable (aDrawable);
Draw::Set (theArgVec[1], Handle(Draw_Drawable3D)());
return 0;
}

View File

@@ -206,19 +206,20 @@ static int mtmNestedMode (Draw_Interpretor& di, int n, const char** a)
static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if ( argc < 4 ) { di << "ERROR: Too few args\n"; return 1; }
Handle(DDF_Browser) browser = Handle(DDF_Browser)::DownCast (Draw::GetExisting (argv[1]));
if ( browser.IsNull() ) { std::cout << "Syntax error: Not a browser: " << argv[1] << "\n"; return 1; }
if ( argc <4 ) { di << "ERROR: Too few args\n"; return 0; }
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(argv[1], Standard_True));
if ( browser.IsNull() ) { di << "ERROR: Not a browser: " << argv[1] << "\n"; return 0; }
TDF_Label lab;
TDF_Tool::Label(browser->Data(),argv[2],lab);
if ( lab.IsNull() ) { di << "Syntax error: label is Null: " << argv[2] << "\n"; return 1; }
if ( lab.IsNull() ) { di << "ERROR: label is Null: " << argv[2] << "\n"; return 0; }
Standard_Integer num = Draw::Atoi ( argv[3] );
TDF_AttributeIterator itr(lab,Standard_False);
for (Standard_Integer i=1; itr.More() && i < num; i++) itr.Next();
if ( ! itr.More() ) { di << "Syntax error: Attribute #" << num << " not found\n"; return 1; }
if ( ! itr.More() ) { di << "ERROR: Attribute #" << num << " not found\n"; return 0; }
const Handle(TDF_Attribute)& att = itr.Value();
if ( att->IsKind(STANDARD_TYPE(TDataStd_TreeNode)) )

View File

@@ -132,7 +132,7 @@ static Standard_Integer DNaming_TCopyShape (Draw_Interpretor& di,
DNaming_DataMapIteratorOfDataMapOfShapeOfName itrn(aDMapOfShapeOfName);
for(;itrn.More();itrn.Next()) {
TCollection_AsciiString name = itrn.Value();
const TopoDS_Shape Result = TR.Copied(itrn.Key());
const TopoDS_Shape& Result = TR.Copied(itrn.Key());
DBRep::Set(name.ToCString(), Result);
di.AppendElement(name.ToCString());
}

View File

@@ -73,18 +73,16 @@ public:
//! Returns main DRAW interpretor.
Standard_EXPORT static Draw_Interpretor& GetInterpretor();
//! Returns a variable value.
//! The name "." does a graphic selection; in this case theName will be is overwritten with the name of the variable.
static Handle(Draw_Drawable3D) Get (Standard_CString& theName) { return getDrawable (theName, Standard_True); }
//! Returns a variable value.
static Handle(Draw_Drawable3D) GetExisting (const Standard_CString& theName)
{
Standard_CString aName = theName;
return getDrawable (aName, Standard_False);
}
//! Returns a variable value. Null if the variable
//! does not exist, a warning is printed if Complain
//! is True.
//!
//! The name "." does a graphic selection. If the
//! selection is a variable <Name> is overwritten with
//! the name of the variable.
Standard_EXPORT static Handle(Draw_Drawable3D) Get (Standard_CString& Name, const Standard_Boolean Complain = Standard_True);
//! Gets a numeric variable. Returns True if the
//! variable exist.
Standard_EXPORT static Standard_Boolean Get (const Standard_CString Name, Standard_Real& val);
@@ -131,16 +129,20 @@ public:
//! Defines Draw unit commands
Standard_EXPORT static void UnitCommands (Draw_Interpretor& I);
protected:
//! Returns a variable value.
//! @param theName [in] [out] variable name, or "." to activate picking
//! @param theToAllowPick [in] when TRUE, "." name will activate picking
Standard_EXPORT static Handle(Draw_Drawable3D) getDrawable (Standard_CString& theName,
Standard_Boolean theToAllowPick);
private:
friend class Draw_Drawable3D;
friend class Draw_Drawable2D;
friend class Draw_Color;

View File

@@ -627,7 +627,7 @@ static Standard_Integer dgetenv(Draw_Interpretor& di, Standard_Integer argc, con
static Standard_Integer isdraw(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n != 2) return 1;
Handle(Draw_Drawable3D) D = Draw::Get (a[1]);
Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
if (D.IsNull())
di << "0";
else
@@ -643,7 +643,7 @@ static Standard_Integer isdraw(Draw_Interpretor& di, Standard_Integer n, const c
Standard_Integer isprot(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n != 2) return 1;
Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
if (D.IsNull())
di << "0";
else {
@@ -814,63 +814,75 @@ void Draw::Set(const Standard_CString name,
//function : Set
//purpose :
//=======================================================================
void Draw::Set(const Standard_CString theName, const Standard_Real theValue)
void Draw::Set(const Standard_CString Name, const Standard_Real val)
{
if (Handle(Draw_Number) aNumber = Handle(Draw_Number)::DownCast (Draw::GetExisting (theName)))
{
aNumber->Value (theValue);
if ((Name[0] == '.') && (Name[1] == '\0')) return;
Standard_CString aName = Name;
Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
Handle(Draw_Number) N;
if (!D.IsNull()) {
N = Handle(Draw_Number)::DownCast(D);
}
if (N.IsNull()) {
N = new Draw_Number(val);
Draw::Set(aName,N,Standard_False);
}
else
{
aNumber = new Draw_Number (theValue);
Draw::Set (theName, aNumber, Standard_False);
}
N->Value(val);
}
//=======================================================================
//function : getDrawable
//purpose :
//function : Get
//purpose :
//=======================================================================
Handle(Draw_Drawable3D) Draw::getDrawable (Standard_CString& theName,
Standard_Boolean theToAllowPick)
Handle(Draw_Drawable3D) Draw::Get(Standard_CString& name,
const Standard_Boolean )
{
const Standard_Boolean toPick = ((theName[0] == '.') && (theName[1] == '\0'));
if (!toPick)
{
ClientData aCD = Tcl_VarTraceInfo (Draw::GetInterpretor().Interp(), theName, TCL_TRACE_UNSETS | TCL_TRACE_WRITES, tracevar, NULL);
Handle(Draw_Drawable3D) aDrawable = reinterpret_cast<Draw_Drawable3D*>(aCD);
return theVariables.Contains (aDrawable)
? aDrawable
: Handle(Draw_Drawable3D)();
Standard_Boolean pick = ((name[0] == '.') && (name[1] == '\0'));
Handle(Draw_Drawable3D) D;
if (pick) {
cout << "Pick an object" << endl;
dout.Select(p_id,p_X,p_Y,p_b);
dout.Pick(p_id,p_X,p_Y,5,D,0);
if (!D.IsNull()) {
if (D->Name()) {
name = p_Name = D->Name();
//p_Name = (char *)D->Name();
}
}
}
else if (!theToAllowPick)
{
return Handle(Draw_Drawable3D)();
else {
ClientData aCD =
Tcl_VarTraceInfo(Draw::GetInterpretor().Interp(),name,TCL_TRACE_UNSETS | TCL_TRACE_WRITES,
tracevar, NULL);
D = reinterpret_cast<Draw_Drawable3D*>(aCD);
if (!theVariables.Contains(D))
D.Nullify();
#if 0
if (D.IsNull() && complain)
cout <<name<<" does not exist"<<endl;
#endif
}
std::cout << "Pick an object" << std::endl;
Handle(Draw_Drawable3D) aDrawable;
dout.Select (p_id, p_X, p_Y, p_b);
dout.Pick (p_id, p_X, p_Y, 5, aDrawable, 0);
if (!aDrawable.IsNull()
&& aDrawable->Name() != NULL)
{
theName = p_Name = aDrawable->Name();
}
return aDrawable;
return D;
}
//=======================================================================
//function : Get
//purpose :
//=======================================================================
Standard_Boolean Draw::Get (const Standard_CString theName,
Standard_Real& theValue)
Standard_Boolean Draw::Get(const Standard_CString name,
Standard_Real& val)
{
if (Handle(Draw_Number) aNumber = Handle(Draw_Number)::DownCast (Draw::GetExisting (theName)))
{
theValue = aNumber->Value();
return Standard_True;
if ((name[0] == '.') && (name[1] == '\0')) {
return Standard_False;
}
Standard_CString aName = name;
Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
if (!D.IsNull()) {
Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(D);
if (!N.IsNull()) {
val = N->Value();
return Standard_True;
}
}
return Standard_False;
}

View File

@@ -55,11 +55,12 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
const DsgPrs_ArrowSide ArrowSide,
const Standard_Boolean drawFromCenter)
{
Handle(Graphic3d_Group) aGroup = aPresentation->NewGroup();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Quantity_Color aColor = LA->LineAspect()->Aspect()->Color();
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
aGroup->SetGroupPrimitivesAspect (LA->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
switch(ArrowSide) {
case DsgPrs_AS_NONE:
@@ -68,7 +69,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
}
case DsgPrs_AS_FIRSTAR:
{
Prs3d_Arrow::Draw (aGroup,
Prs3d_Arrow::Draw(Prs3d_Root::CurrentGroup (aPresentation),
pt1,
dir1,
LA->ArrowAspect()->Angle(),
@@ -78,7 +79,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_LASTAR:
{
Prs3d_Arrow::Draw (aGroup,
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
pt2,
dir2,
LA->ArrowAspect()->Angle(),
@@ -88,12 +89,12 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_BOTHAR:
{
Prs3d_Arrow::Draw (aGroup,
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
pt1,
dir1,
LA->ArrowAspect()->Angle(),
LA->ArrowAspect()->Length());
Prs3d_Arrow::Draw (aGroup,
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
pt2,
dir2,
LA->ArrowAspect()->Angle(),
@@ -126,11 +127,15 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
{
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (2);
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
anArrayOfPoints1->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
aGroup->SetGroupPrimitivesAspect (aMarkerAsp);
aGroup->AddPrimitiveArray (anArrayOfPoints1);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
}
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
}
break;
}
@@ -138,7 +143,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_FIRSTAR_LASTPT:
{
// an Arrow
Prs3d_Arrow::Draw (aGroup,
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
pt1,
dir1,
LA->ArrowAspect()->Angle(),
@@ -146,28 +151,25 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
// a Round
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
aGroup->SetPrimitivesAspect (aMarkerAsp);
aGroup->AddPrimitiveArray (anArrayOfPoints);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
break;
}
case DsgPrs_AS_FIRSTPT_LASTAR:
{
// a Round
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
// an Arrow
Prs3d_Arrow::Draw (aGroup,
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation),
pt2,
dir2,
LA->ArrowAspect()->Angle(),
LA->ArrowAspect()->Length());
// a Round
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
aGroup->SetPrimitivesAspect (aMarkerAsp);
aGroup->AddPrimitiveArray (anArrayOfPoints);
}
break;
}
}

View File

@@ -162,14 +162,13 @@ void Extrema_ExtPElS::Perform(const gp_Pnt& P,
myDone = Standard_True;
return;
}
gp_Vec DirZ;
if (M.SquareDistance(O) < Tol * Tol)
{
DirZ = (A < 0 ? -OZ : OZ);
}
else
DirZ = gp_Vec(M, O);
gp_Vec DirZ;
if (M.SquareDistance(O)<Tol * Tol)
{ DirZ=OZ;
if( A<0) DirZ.Multiplied(-1.);
}
else
DirZ=gp_Vec(M,O);
// Projection of P in the reference plane of the cone ...
Standard_Real Zp = gp_Vec(O, P).Dot(OZ);

View File

@@ -155,7 +155,7 @@ FEmTool_ProfileMatrix::FEmTool_ProfileMatrix(const TColStd_Array1OfInteger& Firs
Standard_Real * x = &X(X.Lower());
x--;
const Standard_Real * b = &B(B.Lower());
Standard_Real * b = &B(B.Lower());
b--;
const Standard_Real * SMA = &SMatrix->Value(1);
SMA --;
@@ -207,7 +207,7 @@ FEmTool_ProfileMatrix::FEmTool_ProfileMatrix(const TColStd_Array1OfInteger& Firs
Standard_Integer i, j, jj, DiagAddr, CurrAddr;
Standard_Real * m = &MX(MX.Lower());
m--;
const Standard_Real * x = &X(X.Lower());
Standard_Real * x = &X(X.Lower());
x--;
const Standard_Real * PM = &ProfileMatrix->Value(1);
PM--;

View File

@@ -65,7 +65,7 @@ public:
Standard_EXPORT void Reverse();
//! Returns a copy of <me> reversed.
Standard_EXPORT Standard_NODISCARD Handle(Geom_Axis1Placement) Reversed() const;
Standard_EXPORT Handle(Geom_Axis1Placement) Reversed() const;
//! Assigns V to the unit vector of this axis.
Standard_EXPORT void SetDirection (const gp_Dir& V) Standard_OVERRIDE;

View File

@@ -117,7 +117,7 @@ public:
Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf& T) const;
//! Returns a copy of <me> reversed.
Standard_EXPORT Standard_NODISCARD Handle(Geom_Curve) Reversed() const;
Standard_EXPORT Handle(Geom_Curve) Reversed() const;
//! Returns the value of the first parameter.
//! Warnings :

View File

@@ -99,21 +99,21 @@ public:
//! (see class Transformation of the package Geom).
Standard_EXPORT virtual void Transform (const gp_Trsf& T) = 0;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Mirrored (const gp_Pnt& P) const;
Standard_EXPORT Handle(Geom_Geometry) Mirrored (const gp_Pnt& P) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT Handle(Geom_Geometry) Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Mirrored (const gp_Ax2& A2) const;
Standard_EXPORT Handle(Geom_Geometry) Mirrored (const gp_Ax2& A2) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
Standard_EXPORT Handle(Geom_Geometry) Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Scaled (const gp_Pnt& P, const Standard_Real S) const;
Standard_EXPORT Handle(Geom_Geometry) Scaled (const gp_Pnt& P, const Standard_Real S) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Transformed (const gp_Trsf& T) const;
Standard_EXPORT Handle(Geom_Geometry) Transformed (const gp_Trsf& T) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Translated (const gp_Vec& V) const;
Standard_EXPORT Handle(Geom_Geometry) Translated (const gp_Vec& V) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom_Geometry) Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
Standard_EXPORT Handle(Geom_Geometry) Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
//! Creates a new object which is a copy of this geometric object.
Standard_EXPORT virtual Handle(Geom_Geometry) Copy() const = 0;

View File

@@ -79,7 +79,7 @@ public:
//! Reverses the U direction of parametrization of <me>.
//! The bounds of the surface are not modified.
//! A copy of <me> is returned.
Standard_EXPORT Standard_NODISCARD Handle(Geom_Surface) UReversed() const;
Standard_EXPORT Handle(Geom_Surface) UReversed() const;
//! Returns the parameter on the Ureversed surface for
//! the point of parameter U on <me>.
@@ -100,7 +100,7 @@ public:
//! Reverses the V direction of parametrization of <me>.
//! The bounds of the surface are not modified.
//! A copy of <me> is returned.
Standard_EXPORT Standard_NODISCARD Handle(Geom_Surface) VReversed() const;
Standard_EXPORT Handle(Geom_Surface) VReversed() const;
//! Returns the parameter on the Vreversed surface for
//! the point of parameter V on <me>.

View File

@@ -160,12 +160,12 @@ public:
//! Raised if the the transformation is singular. This means that
//! the ScaleFactor is lower or equal to Resolution from
//! package gp.
Standard_EXPORT Standard_NODISCARD Handle(Geom_Transformation) Inverted() const;
Standard_EXPORT Handle(Geom_Transformation) Inverted() const;
//! Computes the transformation composed with Other and <me>.
//! <me> * Other.
//! Returns a new transformation
Standard_EXPORT Standard_NODISCARD Handle(Geom_Transformation) Multiplied (const Handle(Geom_Transformation)& Other) const;
Standard_EXPORT Handle(Geom_Transformation) Multiplied (const Handle(Geom_Transformation)& Other) const;
//! Computes the transformation composed with Other and <me> .
//! <me> = <me> * Other.

View File

@@ -47,7 +47,7 @@ public:
//! Returns a copy of <me> reversed.
Standard_EXPORT Standard_NODISCARD Handle(Geom_Vector) Reversed() const;
Standard_EXPORT Handle(Geom_Vector) Reversed() const;
//! Computes the angular value, in radians, between this
//! vector and vector Other. The result is a value between 0 and Pi.

View File

@@ -80,7 +80,7 @@ public:
//! Adds the vector Other to <me>.
Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Added (const Handle(Geom_Vector)& Other) const;
Standard_EXPORT Handle(Geom_VectorWithMagnitude) Added (const Handle(Geom_Vector)& Other) const;
//! Computes the cross product between <me> and Other
@@ -106,12 +106,12 @@ public:
//! Divides <me> by a scalar. A new vector is returned.
Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Divided (const Standard_Real Scalar) const;
Standard_EXPORT Handle(Geom_VectorWithMagnitude) Divided (const Standard_Real Scalar) const;
//! Computes the product of the vector <me> by a scalar.
//! A new vector is returned.
Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const;
Standard_EXPORT Handle(Geom_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const;
//! Computes the product of the vector <me> by a scalar.
@@ -127,15 +127,14 @@ public:
//!
//! Raised if the magnitude of the vector is lower or equal to
//! Resolution from package gp.
Standard_EXPORT Standard_NODISCARD Handle(Geom_VectorWithMagnitude) Normalized() const;
Standard_EXPORT Handle(Geom_VectorWithMagnitude) Normalized() const;
//! Subtracts the Vector Other to <me>.
Standard_EXPORT void Subtract (const Handle(Geom_Vector)& Other);
//! Subtracts the vector Other to <me>. A new vector is returned.
Standard_EXPORT Standard_NODISCARD
Handle(Geom_VectorWithMagnitude) Subtracted (const Handle(Geom_Vector)& Other) const;
Standard_EXPORT Handle(Geom_VectorWithMagnitude) Subtracted (const Handle(Geom_Vector)& Other) const;
//! Applies the transformation T to this vector.
Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;

View File

@@ -64,7 +64,7 @@ public:
//! Note:
//! - Reverse assigns the result to this axis, while
//! - Reversed creates a new one.
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_AxisPlacement) Reversed() const;
Standard_EXPORT Handle(Geom2d_AxisPlacement) Reversed() const;
//! Changes the complete definition of the axis placement.
Standard_EXPORT void SetAxis (const gp_Ax2d& A);

View File

@@ -110,7 +110,7 @@ public:
//! - the end point of the initial curve becomes the start
//! point of the reversed curve.
//! - Reversed creates a new curve.
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Curve) Reversed() const;
Standard_EXPORT Handle(Geom2d_Curve) Reversed() const;
//! Returns the value of the first parameter.
//! Warnings :

View File

@@ -94,19 +94,19 @@ public:
//! itself. A copy of the object is returned.
Standard_EXPORT virtual void Transform (const gp_Trsf2d& T) = 0;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT Handle(Geom2d_Geometry) Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Mirrored (const gp_Ax2d& A) const;
Standard_EXPORT Handle(Geom2d_Geometry) Mirrored (const gp_Ax2d& A) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
Standard_EXPORT Handle(Geom2d_Geometry) Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
Standard_EXPORT Handle(Geom2d_Geometry) Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Transformed (const gp_Trsf2d& T) const;
Standard_EXPORT Handle(Geom2d_Geometry) Transformed (const gp_Trsf2d& T) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Translated (const gp_Vec2d& V) const;
Standard_EXPORT Handle(Geom2d_Geometry) Translated (const gp_Vec2d& V) const;
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Geometry) Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
Standard_EXPORT Handle(Geom2d_Geometry) Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
Standard_EXPORT virtual Handle(Geom2d_Geometry) Copy() const = 0;

View File

@@ -170,15 +170,14 @@ public:
//! Computes the inverse of this transformation and creates a new one.
//! Raises ConstructionError if the the transformation is singular. This means that
//! the ScaleFactor is lower or equal to Resolution from package gp.
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Transformation) Inverted() const;
Standard_EXPORT Handle(Geom2d_Transformation) Inverted() const;
//! Computes the transformation composed with Other and <me>.
//! <me> * Other.
//! Returns a new transformation
Standard_EXPORT Standard_NODISCARD
Handle(Geom2d_Transformation) Multiplied (const Handle(Geom2d_Transformation)& Other) const;
Standard_NODISCARD Handle(Geom2d_Transformation) operator * (const Handle(Geom2d_Transformation)& Other) const
Standard_EXPORT Handle(Geom2d_Transformation) Multiplied (const Handle(Geom2d_Transformation)& Other) const;
Handle(Geom2d_Transformation) operator * (const Handle(Geom2d_Transformation)& Other) const
{
return Multiplied(Other);
}

View File

@@ -46,7 +46,7 @@ public:
Standard_EXPORT void Reverse();
//! Returns a copy of <me> reversed.
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_Vector) Reversed() const;
Standard_EXPORT Handle(Geom2d_Vector) Reversed() const;
//! Computes the angular value, in radians, between this
//! vector and vector Other. The result is a value

View File

@@ -135,7 +135,8 @@ void Geom2d_VectorWithMagnitude::Normalize () { gpVec2d.Normalize (); }
Handle(Geom2d_VectorWithMagnitude) Geom2d_VectorWithMagnitude::Normalized () const {
gp_Vec2d V = gpVec2d.Normalized();
gp_Vec2d V = gpVec2d;
V.Normalized ();
return new VectorWithMagnitude (V);
}

View File

@@ -80,9 +80,8 @@ void operator += (const Handle(Geom2d_Vector)& Other)
//! Adds the vector Other to <me>.
Standard_EXPORT Standard_NODISCARD
Handle(Geom2d_VectorWithMagnitude) Added (const Handle(Geom2d_Vector)& Other) const;
Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator + (const Handle(Geom2d_Vector)& Other) const
Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Added (const Handle(Geom2d_Vector)& Other) const;
Handle(Geom2d_VectorWithMagnitude) operator + (const Handle(Geom2d_Vector)& Other) const
{
return Added(Other);
}
@@ -105,8 +104,8 @@ void operator /= (const Standard_Real Scalar)
//! Divides <me> by a scalar. A new vector is returned.
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) Divided (const Standard_Real Scalar) const;
Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator / (const Standard_Real Scalar) const
Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Divided (const Standard_Real Scalar) const;
Handle(Geom2d_VectorWithMagnitude) operator / (const Standard_Real Scalar) const
{
return Divided(Scalar);
}
@@ -117,7 +116,7 @@ Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator / (const Standard
//!
//! -C++: alias operator *
//! Collision with same operator defined for the class Vector!
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const;
Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Multiplied (const Standard_Real Scalar) const;
//! Computes the product of the vector <me> by a scalar.
@@ -137,7 +136,7 @@ void operator *= (const Standard_Real Scalar)
//!
//! Raised if the magnitude of the vector is lower or equal to
//! Resolution from package gp.
Standard_EXPORT Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) Normalized() const;
Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Normalized() const;
//! Subtracts the Vector Other to <me>.
Standard_EXPORT void Subtract (const Handle(Geom2d_Vector)& Other);
@@ -148,9 +147,8 @@ void operator -= (const Handle(Geom2d_Vector)& Other)
//! Subtracts the vector Other to <me>. A new vector is returned.
Standard_EXPORT Standard_NODISCARD
Handle(Geom2d_VectorWithMagnitude) Subtracted (const Handle(Geom2d_Vector)& Other) const;
Standard_NODISCARD Handle(Geom2d_VectorWithMagnitude) operator - (const Handle(Geom2d_Vector)& Other) const
Standard_EXPORT Handle(Geom2d_VectorWithMagnitude) Subtracted (const Handle(Geom2d_Vector)& Other) const;
Handle(Geom2d_VectorWithMagnitude) operator - (const Handle(Geom2d_Vector)& Other) const
{
return Subtracted(Other);
}

View File

@@ -252,7 +252,7 @@ void GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_HCurve)& C)
Normal = n.Normalized();
BiNormal = Tangent.Crossed(Normal);
BiNormal.Normalize();
BiNormal.Normalized();
}
else { // Erreur...
#ifdef OCCT_DEBUG

View File

@@ -1381,7 +1381,7 @@ void GeomFill_LocationGuide::Resolution (const Standard_Integer ,
//Function : InitX
//Purpose : recherche par interpolation d'une valeur initiale
//==================================================================
void GeomFill_LocationGuide::InitX(const Standard_Real Param)
void GeomFill_LocationGuide::InitX(const Standard_Real Param) const
{
Standard_Integer Ideb = 1, Ifin = myPoles2d->RowLength(), Idemi;

View File

@@ -186,7 +186,7 @@ private:
Standard_EXPORT void SetRotation (const Standard_Real PrecAngle, Standard_Real& LastAngle);
Standard_EXPORT void InitX (const Standard_Real Param);
Standard_EXPORT void InitX (const Standard_Real Param) const;
Handle(GeomFill_TrihedronWithGuide) myLaw;
Handle(GeomFill_SectionLaw) mySec;

View File

@@ -124,7 +124,7 @@ gp_Vec GeomFill_TgtOnCoons::D1(const Standard_Real W) const
Standard_Real scal = tgsc.Dot(n);
gp_Vec scaln = n.Multiplied(-scal);
tgsc.Add(scaln);
tgsc.Added(scaln);
gp_Vec scaldn = dn.Multiplied(-scal);

View File

@@ -11,8 +11,6 @@ Graphic3d_ArrayOfSegments.hxx
Graphic3d_ArrayOfTriangleFans.hxx
Graphic3d_ArrayOfTriangles.hxx
Graphic3d_ArrayOfTriangleStrips.hxx
Graphic3d_Aspects.cxx
Graphic3d_Aspects.hxx
Graphic3d_AspectFillArea3d.cxx
Graphic3d_AspectFillArea3d.hxx
Graphic3d_AspectLine3d.cxx
@@ -21,6 +19,7 @@ Graphic3d_AspectMarker3d.cxx
Graphic3d_AspectMarker3d.hxx
Graphic3d_AspectText3d.cxx
Graphic3d_AspectText3d.hxx
Graphic3d_AspectTextDefinitionError.hxx
Graphic3d_AttribBuffer.cxx
Graphic3d_AttribBuffer.hxx
Graphic3d_BndBox3d.hxx
@@ -74,7 +73,6 @@ Graphic3d_IndexedMapOfAddress.hxx
Graphic3d_LevelOfTextureAnisotropy.hxx
Graphic3d_LightSet.cxx
Graphic3d_LightSet.hxx
Graphic3d_MapOfAspectsToAspects.hxx
Graphic3d_MapIteratorOfMapOfStructure.hxx
Graphic3d_MapOfObject.hxx
Graphic3d_MapOfStructure.hxx

View File

@@ -15,15 +15,29 @@
#include <Graphic3d_AspectFillArea3d.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Graphic3d_Aspects)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Standard_Transient)
// =======================================================================
// function : Graphic3d_AspectFillArea3d
// purpose :
// =======================================================================
Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d()
: myInteriorColor (Quantity_NOC_CYAN1),
myBackInteriorColor (Quantity_NOC_CYAN1),
myEdgeColor (Quantity_NOC_WHITE),
myInteriorStyle (Aspect_IS_EMPTY),
myShadingModel (Graphic3d_TOSM_DEFAULT),
myAlphaMode (Graphic3d_AlphaMode_BlendAuto),
myAlphaCutoff (0.5f),
myEdgeType (Aspect_TOL_SOLID),
myEdgeWidth (1.0f),
myHatchStyle (Handle(Graphic3d_HatchStyle)()),
myToDistinguishMaterials (false),
myToDrawEdges (false),
myToSuppressBackFaces (true),
myToMapTexture (false)
{
myInteriorStyle = Aspect_IS_EMPTY;
//
}
// =======================================================================
@@ -37,13 +51,40 @@ Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d (const Aspect_InteriorSty
const Standard_Real theEdgeLineWidth,
const Graphic3d_MaterialAspect& theFrontMaterial,
const Graphic3d_MaterialAspect& theBackMaterial)
: myFrontMaterial (theFrontMaterial),
myBackMaterial (theBackMaterial),
myInteriorColor (theInteriorColor),
myBackInteriorColor (theInteriorColor),
myEdgeColor (theEdgeColor),
myInteriorStyle (theInteriorStyle),
myShadingModel (Graphic3d_TOSM_DEFAULT),
myAlphaMode (Graphic3d_AlphaMode_BlendAuto),
myAlphaCutoff (0.5f),
myEdgeType (theEdgeLineType),
myEdgeWidth ((float )theEdgeLineWidth),
myHatchStyle (Handle(Graphic3d_HatchStyle)()),
myToDistinguishMaterials (false),
myToDrawEdges (false),
myToSuppressBackFaces (true),
myToMapTexture (false)
{
myFrontMaterial = theFrontMaterial;
myBackMaterial = theBackMaterial;
myInteriorColor.SetRGB (theInteriorColor);
myBackInteriorColor.SetRGB (theInteriorColor);
myEdgeColor.SetRGB (theEdgeColor);
myInteriorStyle = theInteriorStyle;
myLineType = theEdgeLineType;
SetEdgeWidth ((float )theEdgeLineWidth);
if (theEdgeLineWidth <= 0.0)
{
throw Aspect_AspectFillAreaDefinitionError("Bad value for EdgeLineWidth");
}
}
// =======================================================================
// function : Graphic3d_AspectFillArea3d
// purpose :
// =======================================================================
void Graphic3d_AspectFillArea3d::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture)
{
if (theTexture.IsNull())
{
myTextureSet.Nullify();
return;
}
myTextureSet = new Graphic3d_TextureSet (theTexture);
}

View File

@@ -17,12 +17,30 @@
#ifndef _Graphic3d_AspectFillArea3d_HeaderFile
#define _Graphic3d_AspectFillArea3d_HeaderFile
#include <Graphic3d_Aspects.hxx>
#include <Aspect_AspectFillAreaDefinitionError.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_AlphaMode.hxx>
#include <Graphic3d_HatchStyle.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_PolygonOffset.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Graphic3d_TextureSet.hxx>
#include <Graphic3d_TypeOfShadingModel.hxx>
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <Quantity_ColorRGBA.hxx>
//! This class defines graphic attributes for opaque 3d primitives (polygons, triangles, quadrilaterals).
class Graphic3d_AspectFillArea3d : public Graphic3d_Aspects
class Graphic3d_AspectFillArea3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Graphic3d_Aspects)
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Standard_Transient)
public:
//! Creates a context table for fill area primitives defined with the following default values:
@@ -55,13 +73,310 @@ public:
const Graphic3d_MaterialAspect& theFrontMaterial,
const Graphic3d_MaterialAspect& theBackMaterial);
//! Return interior rendering style (Aspect_IS_EMPTY by default, which means nothing will be rendered!).
Aspect_InteriorStyle InteriorStyle() const { return myInteriorStyle; }
//! Modifies the interior type used for rendering
void SetInteriorStyle (const Aspect_InteriorStyle theStyle) { myInteriorStyle = theStyle; }
//! Returns shading model (Graphic3d_TOSM_DEFAULT by default, which means that Shading Model set as default for entire Viewer will be used)
Graphic3d_TypeOfShadingModel ShadingModel() const { return myShadingModel; }
//! Sets shading model
void SetShadingModel (const Graphic3d_TypeOfShadingModel theShadingModel) { myShadingModel = theShadingModel; }
//! Returns the way how alpha value should be treated (Graphic3d_AlphaMode_BlendAuto by default, for backward compatibility).
Graphic3d_AlphaMode AlphaMode() const { return myAlphaMode; }
//! Returns alpha cutoff threshold, for discarding fragments within Graphic3d_AlphaMode_Mask mode (0.5 by default).
//! If the alpha value is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent.
Standard_ShortReal AlphaCutoff() const { return myAlphaCutoff; }
//! Defines the way how alpha value should be treated.
void SetAlphaMode (Graphic3d_AlphaMode theMode, Standard_ShortReal theAlphaCutoff = 0.5f)
{
myAlphaMode = theMode;
myAlphaCutoff = theAlphaCutoff;
}
//! Return interior color.
const Quantity_Color& InteriorColor() const { return myInteriorColor.GetRGB(); }
//! Return interior color.
const Quantity_ColorRGBA& InteriorColorRGBA() const { return myInteriorColor; }
//! Modifies the color of the interior of the face
void SetInteriorColor (const Quantity_Color& theColor) { myInteriorColor.SetRGB (theColor); }
//! Modifies the color of the interior of the face
void SetInteriorColor (const Quantity_ColorRGBA& theColor) { myInteriorColor = theColor; }
//! Return back interior color.
const Quantity_Color& BackInteriorColor() const { return myBackInteriorColor.GetRGB(); }
//! Return back interior color.
const Quantity_ColorRGBA& BackInteriorColorRGBA() const { return myBackInteriorColor; }
//! Modifies the color of the interior of the back face
void SetBackInteriorColor (const Quantity_Color& theColor) { myBackInteriorColor.SetRGB (theColor); }
//! Modifies the color of the interior of the back face
void SetBackInteriorColor (const Quantity_ColorRGBA& theColor) { myBackInteriorColor = theColor; }
//! Returns the surface material of external faces
const Graphic3d_MaterialAspect& FrontMaterial() const { return myFrontMaterial; }
//! Returns the surface material of external faces
Graphic3d_MaterialAspect& ChangeFrontMaterial() { return myFrontMaterial; }
//! Modifies the surface material of external faces
void SetFrontMaterial (const Graphic3d_MaterialAspect& theMaterial) { myFrontMaterial = theMaterial; }
//! Returns the surface material of internal faces
const Graphic3d_MaterialAspect& BackMaterial() const { return myBackMaterial; }
//! Returns the surface material of internal faces
Graphic3d_MaterialAspect& ChangeBackMaterial() { return myBackMaterial; }
//! Modifies the surface material of internal faces
void SetBackMaterial (const Graphic3d_MaterialAspect& theMaterial) { myBackMaterial = theMaterial; }
//! Returns true if back faces should be suppressed (true by default).
bool ToSuppressBackFaces() const { return myToSuppressBackFaces; }
//! Assign back faces culling flag.
void SetSuppressBackFaces (bool theToSuppress) { myToSuppressBackFaces = theToSuppress; }
//! Returns true if back faces should be suppressed (true by default).
bool BackFace() const { return myToSuppressBackFaces; }
//! Allows the display of back-facing filled polygons.
void AllowBackFace() { myToSuppressBackFaces = false; }
//! Suppress the display of back-facing filled polygons.
//! A back-facing polygon is defined as a polygon whose
//! vertices are in a clockwise order with respect to screen coordinates.
void SuppressBackFace() { myToSuppressBackFaces = true; }
//! Returns true if material properties should be distinguished for back and front faces (false by default).
bool Distinguish() const { return myToDistinguishMaterials; }
//! Set material distinction between front and back faces.
void SetDistinguish (bool toDistinguish) { myToDistinguishMaterials = toDistinguish; }
//! Allows material distinction between front and back faces.
void SetDistinguishOn() { myToDistinguishMaterials = true; }
//! Forbids material distinction between front and back faces.
void SetDistinguishOff() { myToDistinguishMaterials = false; }
//! Return shader program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
//! Return texture array to be mapped.
const Handle(Graphic3d_TextureSet)& TextureSet() const { return myTextureSet; }
//! Setup texture array to be mapped.
void SetTextureSet (const Handle(Graphic3d_TextureSet)& theTextures) { myTextureSet = theTextures; }
//! Return texture to be mapped.
//Standard_DEPRECATED("Deprecated method, TextureSet() should be used instead")
Handle(Graphic3d_TextureMap) TextureMap() const
{
return !myTextureSet.IsNull() && !myTextureSet->IsEmpty()
? myTextureSet->First()
: Handle(Graphic3d_TextureMap)();
}
//! Assign texture to be mapped.
//! See also SetTextureMapOn() to actually activate texture mapping.
//Standard_DEPRECATED("Deprecated method, SetTextureSet() should be used instead")
Standard_EXPORT void SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture);
//! Return true if texture mapping is enabled (false by default).
bool ToMapTexture() const { return myToMapTexture; }
//! Return true if texture mapping is enabled (false by default).
bool TextureMapState() const { return myToMapTexture; }
//! Enable or disable texture mapping (has no effect if texture is not set).
void SetTextureMapOn (bool theToMap) { myToMapTexture = theToMap; }
//! Enable texture mapping (has no effect if texture is not set).
void SetTextureMapOn() { myToMapTexture = true; }
//! Disable texture mapping.
void SetTextureMapOff() { myToMapTexture = false; }
//! Returns current polygon offsets settings.
const Graphic3d_PolygonOffset& PolygonOffset() const { return myPolygonOffset; }
//! Sets polygon offsets settings.
void SetPolygonOffset (const Graphic3d_PolygonOffset& theOffset) { myPolygonOffset = theOffset; }
//! Returns current polygon offsets settings.
void PolygonOffsets (Standard_Integer& theMode,
Standard_ShortReal& theFactor,
Standard_ShortReal& theUnits) const
{
theMode = myPolygonOffset.Mode;
theFactor = myPolygonOffset.Factor;
theUnits = myPolygonOffset.Units;
}
//! Sets up OpenGL polygon offsets mechanism.
//! <aMode> parameter can contain various combinations of
//! Aspect_PolygonOffsetMode enumeration elements (Aspect_POM_None means
//! that polygon offsets are not changed).
//! If <aMode> is different from Aspect_POM_Off and Aspect_POM_None, then <aFactor> and <aUnits>
//! arguments are used by graphic renderer to calculate a depth offset value:
//!
//! offset = <aFactor> * m + <aUnits> * r, where
//! m - maximum depth slope for the polygon currently being displayed,
//! r - minimum window coordinates depth resolution (implementation-specific)
//!
//! Default settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0.
//!
//! Negative offset values move polygons closer to the viewport,
//! while positive values shift polygons away.
//! Consult OpenGL reference for details (glPolygonOffset function description).
void SetPolygonOffsets (const Standard_Integer theMode,
const Standard_ShortReal theFactor = 1.0f,
const Standard_ShortReal theUnits = 0.0f)
{
myPolygonOffset.Mode = (Aspect_PolygonOffsetMode )(theMode & Aspect_POM_Mask);
myPolygonOffset.Factor = theFactor;
myPolygonOffset.Units = theUnits;
}
public:
Standard_DEPRECATED("Deprecated method, ToDrawEdges() should be used instead")
bool Edge() const { return ToDrawEdges(); }
//! Returns true if edges should be drawn (false by default).
bool ToDrawEdges() const { return myToDrawEdges; }
//! Set if edges should be drawn or not.
void SetDrawEdges (bool theToDraw) { myToDrawEdges = theToDraw; }
//! Returns true if edges should be drawn.
bool Edge() const { return myToDrawEdges; }
//! The edges of FillAreas are drawn.
void SetEdgeOn() { myToDrawEdges = true; }
//! The edges of FillAreas are not drawn.
void SetEdgeOff() { myToDrawEdges = false; }
//! Return color of edges.
const Quantity_Color& EdgeColor() const { return myEdgeColor.GetRGB(); }
//! Return color of edges.
const Quantity_ColorRGBA& EdgeColorRGBA() const { return myEdgeColor; }
//! Modifies the color of the edge of the face
void SetEdgeColor (const Quantity_Color& theColor) { myEdgeColor.SetRGB (theColor); }
//! Return edges line type.
Aspect_TypeOfLine EdgeLineType() const { return myEdgeType; }
//! Modifies the edge line type
void SetEdgeLineType (const Aspect_TypeOfLine theType) { myEdgeType = theType; }
//! Return width for edges in pixels.
Standard_ShortReal EdgeWidth() const { return myEdgeWidth; }
//! Modifies the edge thickness
//! Warning: Raises AspectFillAreaDefinitionError if the width is a negative value.
void SetEdgeWidth (const Standard_Real theWidth)
{
if (theWidth <= 0.0)
{
throw Aspect_AspectFillAreaDefinitionError("Bad value for EdgeLineWidth");
}
myEdgeWidth = (float )theWidth;
}
public:
//! Returns the hatch type used when InteriorStyle is IS_HATCH
const Handle(Graphic3d_HatchStyle)& HatchStyle() const { return myHatchStyle; }
//! Modifies the hatch type used when InteriorStyle is IS_HATCH
void SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle) { myHatchStyle = theStyle; }
//! Modifies the hatch type used when InteriorStyle is IS_HATCH
//! @warning This method always creates a new handle for a given hatch style
void SetHatchStyle (const Aspect_HatchStyle theStyle)
{
if (theStyle == Aspect_HS_SOLID)
{
myHatchStyle.Nullify();
return;
}
myHatchStyle = new Graphic3d_HatchStyle (theStyle);
}
//! Returns the current values.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Aspect_InteriorStyle& theStyle,
Quantity_Color& theIntColor,
Quantity_Color& theEdgeColor,
Aspect_TypeOfLine& theType,
Standard_Real& theWidth) const
{
theStyle = myInteriorStyle;
theIntColor = myInteriorColor.GetRGB();
theEdgeColor= myEdgeColor.GetRGB();
theType = myEdgeType;
theWidth = myEdgeWidth;
}
//! Returns the current values.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Aspect_InteriorStyle& theStyle,
Quantity_Color& theIntColor,
Quantity_Color& theBackIntColor,
Quantity_Color& theEdgeColor,
Aspect_TypeOfLine& theType,
Standard_Real& theWidth) const
{
theStyle = myInteriorStyle;
theIntColor = myInteriorColor.GetRGB();
theBackIntColor= myBackInteriorColor.GetRGB();
theEdgeColor = myEdgeColor.GetRGB();
theType = myEdgeType;
theWidth = myEdgeWidth;
}
protected:
Handle(Graphic3d_ShaderProgram) myProgram;
Handle(Graphic3d_TextureSet) myTextureSet;
Graphic3d_MaterialAspect myFrontMaterial;
Graphic3d_MaterialAspect myBackMaterial;
Quantity_ColorRGBA myInteriorColor;
Quantity_ColorRGBA myBackInteriorColor;
Quantity_ColorRGBA myEdgeColor;
Aspect_InteriorStyle myInteriorStyle;
Graphic3d_TypeOfShadingModel myShadingModel;
Graphic3d_AlphaMode myAlphaMode;
Standard_ShortReal myAlphaCutoff;
Aspect_TypeOfLine myEdgeType;
Standard_ShortReal myEdgeWidth;
Handle(Graphic3d_HatchStyle) myHatchStyle;
Graphic3d_PolygonOffset myPolygonOffset;
bool myToDistinguishMaterials;
bool myToDrawEdges;
bool myToSuppressBackFaces;
bool myToMapTexture;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectFillArea3d, Graphic3d_Aspects)
DEFINE_STANDARD_HANDLE(Graphic3d_AspectFillArea3d, Standard_Transient)
#endif // _Graphic3d_AspectFillArea3d_HeaderFile

View File

@@ -15,30 +15,33 @@
#include <Graphic3d_AspectLine3d.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectLine3d, Graphic3d_Aspects)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectLine3d, Standard_Transient)
// =======================================================================
// function : Graphic3d_AspectLine3d
// purpose :
// =======================================================================
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d()
: myColor (Quantity_NOC_YELLOW),
myType (Aspect_TOL_SOLID),
myWidth (1.0f)
{
myShadingModel = Graphic3d_TOSM_UNLIT;
myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
myLineType = Aspect_TOL_SOLID;
myLineWidth = 1.0f;
//
}
// =======================================================================
// function : Graphic3d_AspectLine3d
// purpose :
// =======================================================================
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d (const Quantity_Color& theColor,
Aspect_TypeOfLine theType,
Standard_Real theWidth)
Graphic3d_AspectLine3d::Graphic3d_AspectLine3d (const Quantity_Color& theColor,
const Aspect_TypeOfLine theType,
const Standard_Real theWidth)
: myColor (theColor),
myType (theType),
myWidth ((float )theWidth)
{
myShadingModel = Graphic3d_TOSM_UNLIT;
myInteriorColor.SetRGB (theColor);
myLineType = theType;
SetLineWidth ((float)theWidth);
if (myWidth <= 0.0f)
{
throw Aspect_AspectLineDefinitionError("Graphic3d_AspectLine3d, Bad value for LineWidth");
}
}

View File

@@ -16,13 +16,19 @@
#ifndef _Graphic3d_AspectLine3d_HeaderFile
#define _Graphic3d_AspectLine3d_HeaderFile
#include <Graphic3d_Aspects.hxx>
#include <Aspect_AspectLineDefinitionError.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Standard.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <Quantity_ColorRGBA.hxx>
//! Creates and updates a group of attributes for 3d line primitives.
//! This group contains the color, the type of line, and its thickness.
class Graphic3d_AspectLine3d : public Graphic3d_Aspects
class Graphic3d_AspectLine3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectLine3d, Graphic3d_Aspects)
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectLine3d, Standard_Transient)
public:
//! Creates a context table for line primitives
@@ -38,32 +44,85 @@ public:
//! The nominal line width is 1 pixel.
//! The width of the line is determined by applying the line width scale factor to this nominal line width.
//! The supported line widths vary by 1-pixel units.
Standard_EXPORT Graphic3d_AspectLine3d (const Quantity_Color& theColor,
Aspect_TypeOfLine theType,
Standard_Real theWidth);
Standard_EXPORT Graphic3d_AspectLine3d (const Quantity_Color& theColor,
const Aspect_TypeOfLine theType,
const Standard_Real theWidth);
//! Return color.
const Quantity_ColorRGBA& ColorRGBA() const { return myColor; }
//! Return color.
const Quantity_Color& Color() const { return myColor.GetRGB(); }
//! Modifies the color.
void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); }
//! Return line type.
Aspect_TypeOfLine Type() const { return myLineType; }
Aspect_TypeOfLine Type() const { return myType; }
//! Modifies the type of line.
void SetType (const Aspect_TypeOfLine theType) { myLineType = theType; }
void SetType (const Aspect_TypeOfLine theType) { myType = theType; }
//! Return line width.
Standard_ShortReal Width() const { return myLineWidth; }
Standard_ShortReal Width() const { return myWidth; }
//! Modifies the line thickness.
//! Warning: Raises Standard_OutOfRange if the width is a negative value.
//! Warning: Raises AspectLineDefinitionError if the width is a negative value.
void SetWidth (const Standard_Real theWidth) { SetWidth ((float )theWidth); }
//! Modifies the line thickness.
//! Warning: Raises Standard_OutOfRange if the width is a negative value.
void SetWidth (Standard_ShortReal theWidth)
//! Warning: Raises AspectLineDefinitionError if the width is a negative value.
void SetWidth (const Standard_ShortReal theWidth)
{
SetLineWidth (theWidth);
if (theWidth <= 0.0f)
{
throw Aspect_AspectLineDefinitionError("Graphic3d_AspectLine3d, Bad value for LineWidth");
}
myWidth = theWidth;
}
//! Return shader program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
//! Check for equality with another line aspect.
bool IsEqual (const Graphic3d_AspectLine3d& theOther)
{
if (this == &theOther)
{
return true;
}
return myProgram == theOther.myProgram
&& myType == theOther.myType
&& myColor == theOther.myColor
&& myWidth == theOther.myWidth;
}
public:
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Aspect_TypeOfLine& theType,
Standard_Real& theWidth) const
{
theColor = myColor.GetRGB();
theType = myType;
theWidth = myWidth;
}
protected:
Handle(Graphic3d_ShaderProgram) myProgram;
Quantity_ColorRGBA myColor;
Aspect_TypeOfLine myType;
Standard_ShortReal myWidth;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectLine3d, Graphic3d_Aspects)
DEFINE_STANDARD_HANDLE(Graphic3d_AspectLine3d, Standard_Transient)
#endif // _Graphic3d_AspectLine3d_HeaderFile

View File

@@ -15,18 +15,18 @@
#include <Graphic3d_AspectMarker3d.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Graphic3d_Aspects)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Standard_Transient)
// =======================================================================
// function : Graphic3d_AspectMarker3d
// purpose :
// =======================================================================
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
: myColor (Quantity_NOC_YELLOW),
myType (Aspect_TOM_X),
myScale (1.0f)
{
myShadingModel = Graphic3d_TOSM_UNLIT;
myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
myMarkerType = Aspect_TOM_X;
myMarkerScale = 1.0f;
//
}
// =======================================================================
@@ -36,11 +36,14 @@ Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d()
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Aspect_TypeOfMarker theType,
const Quantity_Color& theColor,
const Standard_Real theScale)
: myColor (theColor),
myType (theType),
myScale ((float )theScale)
{
myShadingModel = Graphic3d_TOSM_UNLIT;
myInteriorColor.SetRGB (theColor);
myMarkerType = theType;
SetMarkerScale ((float )theScale);
if (theScale <= 0.0)
{
throw Aspect_AspectMarkerDefinitionError("Bad value for MarkerScale");
}
}
// =======================================================================
@@ -51,12 +54,12 @@ Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theCo
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Handle(TColStd_HArray1OfByte)& theTextureBitMap)
: myMarkerImage (new Graphic3d_MarkerImage (theTextureBitMap, theWidth, theHeight)),
myColor (theColor),
myType (Aspect_TOM_USERDEFINED),
myScale (1.0f)
{
myShadingModel = Graphic3d_TOSM_UNLIT;
myMarkerImage = new Graphic3d_MarkerImage(theTextureBitMap, theWidth, theHeight);
myInteriorColor.SetRGB (theColor),
myMarkerType = Aspect_TOM_USERDEFINED;
myMarkerScale = 1.0f;
//
}
// =======================================================================
@@ -64,12 +67,12 @@ Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Quantity_Color& theCo
// purpose :
// =======================================================================
Graphic3d_AspectMarker3d::Graphic3d_AspectMarker3d (const Handle(Image_PixMap)& theTextureImage)
: myMarkerImage (new Graphic3d_MarkerImage (theTextureImage)),
myColor (Quantity_NOC_YELLOW),
myType (Aspect_TOM_USERDEFINED),
myScale (1.0f)
{
myShadingModel = Graphic3d_TOSM_UNLIT;
myMarkerImage = new Graphic3d_MarkerImage (theTextureImage);
myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
myMarkerType = Aspect_TOM_USERDEFINED;
myMarkerScale = 1.0f;
//
}
// =======================================================================

View File

@@ -16,13 +16,23 @@
#ifndef _Graphic3d_AspectMarker3d_HeaderFile
#define _Graphic3d_AspectMarker3d_HeaderFile
#include <Graphic3d_Aspects.hxx>
#include <Aspect_AspectMarkerDefinitionError.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Graphic3d_MarkerImage.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Image_PixMap.hxx>
#include <Standard.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HArray1OfByte.hxx>
#include <Quantity_ColorRGBA.hxx>
//! Creates and updates an attribute group for marker type primitives.
//! This group contains the type of marker, its color, and its scale factor.
class Graphic3d_AspectMarker3d : public Graphic3d_Aspects
class Graphic3d_AspectMarker3d : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Graphic3d_Aspects)
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectMarker3d, Standard_Transient)
public:
//! Creates a context table for marker primitives
@@ -43,26 +53,39 @@ public:
//! defined with the specified values.
Standard_EXPORT Graphic3d_AspectMarker3d(const Handle(Image_PixMap)& theTextureImage);
//! Return color.
const Quantity_ColorRGBA& ColorRGBA() const { return myColor; }
//! Return the color.
const Quantity_Color& Color() const { return myColor.GetRGB(); }
//! Modifies the color.
void SetColor (const Quantity_Color& theColor) { myColor.SetRGB (theColor); }
//! Return scale factor.
Standard_ShortReal Scale() const { return myMarkerScale; }
Standard_ShortReal Scale() const { return myScale; }
//! Modifies the scale factor.
//! Marker type Aspect_TOM_POINT is not affected by the marker size scale factor.
//! It is always the smallest displayable dot.
//! Warning: Raises Standard_OutOfRange if the scale is a negative value.
//! Warning: Raises AspectMarkerDefinitionError if the scale is a negative value.
void SetScale (const Standard_ShortReal theScale)
{
SetMarkerScale (theScale);
if (theScale <= 0.0f)
{
throw Aspect_AspectMarkerDefinitionError("Bad value for MarkerScale");
}
myScale = theScale;
}
//! Assign scale factor.
void SetScale (const Standard_Real theScale) { SetScale ((float )theScale); }
//! Return marker type.
Aspect_TypeOfMarker Type() const { return myMarkerType; }
Aspect_TypeOfMarker Type() const { return myType; }
//! Modifies the type of marker.
void SetType (const Aspect_TypeOfMarker theType) { myMarkerType = theType; }
void SetType (const Aspect_TypeOfMarker theType) { myType = theType; }
//! Returns marker's texture size.
Standard_EXPORT void GetTextureSize (Standard_Integer& theWidth, Standard_Integer& theHeight) const;
@@ -71,10 +94,40 @@ public:
//! Could be null handle if marker aspect has been initialized as default type of marker.
const Handle(Graphic3d_MarkerImage)& GetMarkerImage() const { return myMarkerImage; }
//! Set marker's image texture.
void SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage) { myMarkerImage = theImage; }
Standard_EXPORT void SetBitMap (const Standard_Integer theWidth, const Standard_Integer theHeight, const Handle(TColStd_HArray1OfByte)& theTexture);
//! Return the program.
const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const { return myProgram; }
//! Sets up OpenGL/GLSL shader program.
void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram) { myProgram = theProgram; }
public:
//! Returns the current values of the group.
Standard_DEPRECATED("Deprecated method Values() should be replaced by individual property getters")
void Values (Quantity_Color& theColor,
Aspect_TypeOfMarker& theType,
Standard_Real& theScale) const
{
theColor = myColor.GetRGB();
theType = myType;
theScale = myScale;
}
protected:
Handle(Graphic3d_ShaderProgram) myProgram;
Handle(Graphic3d_MarkerImage) myMarkerImage;
Quantity_ColorRGBA myColor;
Aspect_TypeOfMarker myType;
Standard_ShortReal myScale;
};
DEFINE_STANDARD_HANDLE(Graphic3d_AspectMarker3d, Graphic3d_Aspects)
DEFINE_STANDARD_HANDLE(Graphic3d_AspectMarker3d, Standard_Transient)
#endif // _Graphic3d_AspectMarker3d_HeaderFile

View File

@@ -15,43 +15,55 @@
#include <Graphic3d_AspectText3d.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Graphic3d_Aspects)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Standard_Transient)
// =======================================================================
// function : Graphic3d_AspectText3d
// purpose :
// =======================================================================
Graphic3d_AspectText3d::Graphic3d_AspectText3d()
: myFont (Font_NOF_ASCII_MONO),
myColor (Quantity_NOC_YELLOW),
myFactor (1.0),
mySpace (0.0),
myStyle (Aspect_TOST_NORMAL),
myDisplayType (Aspect_TODT_NORMAL),
myColorSubTitle (Quantity_NOC_WHITE),
myTextZoomable (false),
myTextAngle (0.0),
myTextFontAspect(Font_FA_Regular)
{
// actually this should be a special state Graphic3d_AlphaMode_MaskBlend
// since text is drawn in usual order with normal opaque objects (thanks to alpha test),
// but blending is also enabled to smoothen boundaries
SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
myShadingModel = Graphic3d_TOSM_UNLIT;
myInteriorColor.SetRGB (Quantity_NOC_YELLOW);
myEdgeColor.SetRGB (Quantity_NOC_WHITE);
//
}
// =======================================================================
// function : Graphic3d_AspectText3d
// purpose :
// =======================================================================
Graphic3d_AspectText3d::Graphic3d_AspectText3d (const Quantity_Color& theColor,
Standard_CString theFont,
Standard_Real ,
Standard_Real ,
Aspect_TypeOfStyleText theStyle,
Aspect_TypeOfDisplayText theDisplayType)
Graphic3d_AspectText3d::Graphic3d_AspectText3d (const Quantity_Color& theColor,
const Standard_CString theFont,
const Standard_Real theExpansionFactor,
const Standard_Real theSpace,
const Aspect_TypeOfStyleText theStyle,
const Aspect_TypeOfDisplayText theDisplayType)
: myFont (theFont),
myColor (theColor),
myFactor (theExpansionFactor),
mySpace (theSpace),
myStyle (theStyle),
myDisplayType (theDisplayType),
myColorSubTitle (Quantity_NOC_WHITE),
myTextZoomable (false),
myTextAngle (0.0),
myTextFontAspect(Font_FA_Regular)
{
SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
myShadingModel = Graphic3d_TOSM_UNLIT;
myTextStyle = theStyle;
myTextDisplayType = theDisplayType;
myInteriorColor.SetRGB (theColor);
myEdgeColor.SetRGB (Quantity_NOC_WHITE);
if (theFont != NULL
&& *theFont != '\0')
if (myFont.IsEmpty())
{
myTextFont = new TCollection_HAsciiString (theFont);
myFont = Font_NOF_ASCII_MONO;
}
if (theExpansionFactor <= 0.0)
{
throw Graphic3d_AspectTextDefinitionError("Bad value for TextScaleFactor");
}
}

Some files were not shown because too many files have changed in this diff Show More