1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

2 Commits

Author SHA1 Message Date
nds
bf5b2a4753 remarks correction 2020-09-07 20:44:55 +03:00
nds
e5b2dec838 0031457: Visualization - interface to find an active frame buffer 2020-09-07 10:51:36 +03:00
656 changed files with 15113 additions and 10898 deletions

View File

@@ -71,7 +71,6 @@ BOPTools::MapShapesAndAncestors TopExp::MapShapesAndAncestors
BOPCol_Box2DBndTreeSelector BOPTools_BoxSelector<Bnd_Box2d>
BiTgte_DataMapOfShapeBox TopTools_DataMapOfShapeBox
CDM_MessageDriver Message_Messenger
Message_ProgressSentry Message_ProgressScope
[tcollection]
AdvApp2Var_SequenceOfNode

View File

@@ -1935,118 +1935,6 @@ Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating value
Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
subsection upgrade_750_ProgressIndicator Change of Message_ProgressIndicator
The progress indication mechanism has been revised to eliminate its weak points in previous design (leading to ambiguity and unprotected from an error-prone behavior).
Redesign also allows using progress indicator in multi-threaded algorithms in more straight-forward way with minimal overhead.
Note, however, that multi-threaded algorithm should pre-allocate per-thread progress scopes in advance to ensure thread-safety - check new classes API for details.
Classes Message_ProgressSentry and Message_ProgressScale have been removed.
New classes Message_ProgressScope and Messge_ProgressRange replace them and should be used as main API classes to organize progress indication in the algorithms.
Instances of the class Message_ProgressRange are used to pass the progress capability to nested levels of the algorithm
and an instance of the class Message_ProgressScope is to be created (preferably as local variable) to manage progress at each level of the algorithm.
The instance of Message_ProgressIndicator is not passed anymore to sub-algorithms.
See documentation of the class Message_ProgressScope for more details and examples.
Methods to deal with progress scopes and to advance progress are removed from class Message_ProgressIndicator; now it only provides interface to the application-level progress indicator.
Virtual method Message_ProgressIndicator::Show() has changed its signature and should be updated accordingly in descendants of Message_ProgressIndicator.
The scope passed as argument to this method can be used to obtain information on context of the current process (instead of calling method GetScope() in previous implementation).
Methods Show(), UserBreak(), and Reset() are made protected in class Message_ProgressIndicator; method More() of Message_ProgressScope should be used to know if the cancel event has come.
See documentation of the class Message_ProgressIndicator for more details and implementation of Draw_ProgressIndicator for an example.
Lets take a look onto typical algorithm using an old API:
@code
class MyAlgo
{
public:
//! Algorithm entry point taking an optional Progress Indicator.
bool Perform (const TCollection_AsciiString& theFileName,
const Handle(Message_ProgressIndicator)& theProgress = Handle(Message_ProgressIndicator)())
{
Message_ProgressSentry aPSentry (theProgress, (TCollection_AsciiString("Processing ") + theFileName).ToCString(), 2);
{
Message_ProgressSentry aPSentry1 (theProgress, "Stage 1", 0, 153, 1);
for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
{ if (!aPSentry1.More()) { return false; } }
}
aPSentry.Next();
{
perform2 (theProgress);
}
aPSentry.Next();
bool wasAborted = !theProgress.IsNull() && theProgress->UserBreak();
return !wasAborted;
}
private:
//! Nested sub-algorithm taking Progress Indicator.
bool perform2 (const Handle(Message_ProgressIndicator)& theProgress)
{
Message_ProgressSentry aPSentry2 (theProgress, "Stage 2", 0, 561, 1);
for (int anIter = 0; anIter < 561 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
return aPSentry2.More();
}
};
// application executing an algorithm
Handle(Message_ProgressIndicator) aProgress = new MyProgress();
MyAlgo anAlgo;
anAlgo.Perform ("FileName", aProgress);
@endcode
The following guidance can be used to update such code:
- Replace `const Handle(Message_ProgressIndicator)&` with `const Message_ProgressRange&`.
Message_ProgressIndicator object should be now created only at place where application starts algorithms.
- Replace `Message_ProgressSentry` with `Message_ProgressScope`.
Take note that Message_ProgressScope has smaller number of arguments (no "minimal value").
In other aspects, Message_ProgressScope mimics an iterator-style interface (with methods More() and Next())
close to the old Message_ProgressSentry (pay attention to extra functionality of Message_ProgressScope::Next() method below).
- Each Message_ProgressScope should take the next Range to fill in.
Within old API, Message_ProgressSentry received the root Progress Indicator object and implicitly split it into ranges using error-prone logic.
Message_ProgressScope in new API takes Message_ProgressRange, which should be created from the Range of the parent Scope using value returned by Message_ProgressScope::Next() method.
Don't use the same Range passed to the algorithm for all sub-Scopes like it was possible in old API.
- Check user abortion state using Message_ProgressScope::UserBreak() method;
Message_ProgressRange is a temporary object with the only purpose to create a new Message_ProgressScope,
and Message_ProgressIndicator should be never passed directly to algorithms.
Take a look onto ported code and compare with code above to see differences:
@code
class MyAlgo
{
public:
//! Algorithm entry point taking an optional Progress Range.
bool Perform (const TCollection_AsciiString& theFileName,
const Message_ProgressRange& theProgress = Message_ProgressRange())
{
Message_ProgressScope aPSentry (theProgress, TCollection_AsciiString("Processing ") + theFileName, 2);
{
Message_ProgressScope aPSentry1 (aPSentry.Next(), "Stage 1", 153);
for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
{ if (!aPSentry1.More()) { return false; }; }
}
{
perform2 (aPSentry.Next());
}
bool wasAborted = aPSentry.UserBreak();
return !wasAborted;
}
//! Nested sub-algorithm taking Progress sub-Range.
bool perform2 (const Message_ProgressRange& theProgress)
{
Message_ProgressScope aPSentry2 (theProgress, "Stage 2", 561);
for (int anIter = 0; anIter < 561 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
return aPSentry2.More();
}
};
// application executing an algorithm
Handle(Message_ProgressIndicator) aProgress = new MyProgress();
MyAlgo anAlgo;
anAlgo.Perform ("FileName", aProgress->Start());
@endcode
@subsection upgrade_750_message_messenger Message_Messenger interface change
Operators << with left argument *Handle(Message_Messenger)*, used to output messages with

View File

@@ -1542,38 +1542,40 @@ Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (aDispCon
// create a Viewer to this Driver
Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver);
aViewer->SetDefaultBackgroundColor (Quantity_NOC_DARKVIOLET);
aViewer->SetDefaultViewProj (V3d_Xpos);
// Create a structure in this Viewer
Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (aViewer->StructureManager());
Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (aViewer->Viewer());
aStruct->SetVisual (Graphic3d_TOS_SHADING); // Type of structure
// Create a group of primitives in this structure
Handle(Graphic3d_Group) aPrsGroup = aStruct->NewGroup();
Handle(Graphic3d_Group) aPrsGroup = new Graphic3d_Group (aStruct);
// Fill this group with one quad of size 100
Handle(Graphic3d_ArrayOfTriangleStrips) aTriangles = new Graphic3d_ArrayOfTriangleStrips (4);
aTriangles->AddVertex (-100./2., -100./2., 0.0);
aTriangles->AddVertex (-100./2., 100./2., 0.0);
aTriangles->AddVertex ( 100./2., -100./2., 0.0);
aTriangles->AddVertex ( 100./2., 100./2., 0.0);
Handle(Graphic3d_AspectFillArea3d) anAspects = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_RED,
Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0f,
Graphic3d_NOM_GOLD, Graphic3d_NOM_GOLD);
aPrsGroup->SetGroupPrimitivesAspect (anAspects);
aPrsGroup->AddPrimitiveArray (aTriangles);
aPrsGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectFillArea3d());
// Create Ambient and Infinite Lights in this Viewer
Handle(V3d_AmbientLight) aLight1 = new V3d_AmbientLight (Quantity_NOC_GRAY50);
Handle(V3d_DirectionalLight) aLight2 = new V3d_DirectionalLight (V3d_Zneg, Quantity_NOC_WHITE, true);
Handle(V3d_DirectionalLight) aLight2 = new V3d_DirectionalLight (V3d_XnegYnegZneg, Quantity_NOC_WHITE);
aViewer->AddLight (aLight1);
aViewer->AddLight (aLight2);
aViewer->SetLightOn();
// Create a 3D quality Window with the same DisplayConnection
Handle(Xw_Window) aWindow = new Xw_Window (aDispConnection, "Test V3d", 100, 100, 500, 500);
aWindow->Map(); // Map this Window to this screen
// Create a Perspective View in this Viewer
Handle(V3d_View) aView = new V3d_View (aViewer);
aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
// Associate this View with the Window
aView->SetWindow (aWindow);
// Display presentation in this View
aStruct->Display();
// Display ALL structures in this View
aViewer->Viewer()->Display();
// Finally update the Visualization in this View
aView->Update();
// Fit view to object size

View File

@@ -1,7 +1,6 @@
// include required OCCT headers
#include <Standard_Version.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressScope.hxx>
//for OCC graphic
#include <Aspect_DisplayConnection.hxx>
#include <WNT_Window.hxx>

View File

@@ -4,7 +4,6 @@
// include required OCCT headers
#include <Standard_Version.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressScope.hxx>
//for OCC graphic
#include <WNT_Window.hxx>
#include <WNT_WClass.hxx>

View File

@@ -128,7 +128,7 @@ myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
myToHilightSelected(Standard_True),
mySelection(new AIS_Selection()),
myFilters (new SelectMgr_AndOrFilter(SelectMgr_FilterType_OR)),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
myCurDetected(0),
myCurHighlighted(0),

View File

@@ -32,7 +32,6 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHighlight.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <SelectMgr_AndOrFilter.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_ListOfFilter.hxx>
#include <SelectMgr_PickingStrategy.hxx>
@@ -47,6 +46,7 @@
class SelectMgr_SelectionManager;
class V3d_Viewer;
class SelectMgr_OrFilter;
class V3d_View;
class TopLoc_Location;
class TCollection_ExtendedString;
@@ -736,15 +736,6 @@ public: //! @name management of active Selection Modes
public: //! @name Selection Filters management
//! @return the context selection filter type.
SelectMgr_FilterType FilterType() const { return myFilters->FilterType(); }
//! Sets the context selection filter type.
//! SelectMgr_TypeFilter_OR selection filter is used by default.
//! @param theFilterType the filter type.
void SetFilterType (const SelectMgr_FilterType theFilterType)
{ myFilters->SetFilterType (theFilterType); }
//! Returns the list of filters active in a local context.
Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
@@ -1341,7 +1332,14 @@ protected: //! @name internal methods
if (myLastPicked.IsNull())
return;
myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
if (myLastPicked->IsAutoHilight())
{
myMainPM->ClearImmediateDraw();
}
else
{
myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
}
}
//! Bind/Unbind status to object and its children
@@ -1363,8 +1361,7 @@ protected: //! @name internal fields
Handle(SelectMgr_EntityOwner) myLastPicked;
Standard_Boolean myToHilightSelected;
Handle(AIS_Selection) mySelection;
Handle(SelectMgr_AndOrFilter) myFilters; //!< context filter (the content active filters
//! can be applied with AND or OR operation)
Handle(SelectMgr_OrFilter) myFilters;
Handle(Prs3d_Drawer) myDefaultDrawer;
Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
TColStd_SequenceOfInteger myDetectedSeq;

View File

@@ -172,8 +172,8 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anInteractive);
if (!aStatusPtr)
Handle(AIS_GlobalStatus) aStatus;
if (!myObjects.Find (anInteractive, aStatus))
{
continue;
}
@@ -183,9 +183,9 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity)
{
if ((*aStatusPtr)->IsSubIntensityOn())
if (aStatus->IsSubIntensityOn())
{
const Standard_Integer aHiMode = getHilightMode (anInteractive, (*aStatusPtr)->HilightStyle(), (*aStatusPtr)->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode);
}
}
@@ -196,7 +196,7 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
}
if (anOwner == anInteractive->GlobalSelOwner())
{
(*aStatusPtr)->SetHilightStatus (Standard_False);
aStatus->SetHilightStatus (Standard_False);
}
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
@@ -746,15 +746,11 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
continue;
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
continue;
}
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
if (anOwner == anObj->GlobalSelOwner())
{
(*aStatusPtr)->SetHilightStatus (Standard_True);
(*aStatusPtr)->SetHilightStyle (anObjSelStyle);
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
}
if (!anOwner->IsAutoHilight())
{
@@ -772,7 +768,7 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
}
else
{
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, (*aStatusPtr)->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
}
}
@@ -876,10 +872,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
}
if (aSelOwner == aSelectable->GlobalSelOwner())
{
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (aSelectable))
{
(*aStatusPtr)->SetHilightStatus (Standard_False);
}
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
}
}
@@ -997,12 +990,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
return;
}
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (theOwner->IsSelected())
{
highlightSelected (theOwner);
@@ -1013,7 +1001,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
anOwners.Append (theOwner);
unhighlightOwners (anOwners);
(*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}

View File

@@ -23,6 +23,7 @@
#include <Quantity_Color.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Filter.hxx>
#include <SelectMgr_OrFilter.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>

View File

@@ -56,20 +56,6 @@ void AIS_InteractiveObject::Redisplay (const Standard_Boolean AllModes)
myCTXPtr->Redisplay (this, Standard_False, AllModes);
}
//=======================================================================
//function : ProcessDragging
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveObject::ProcessDragging (const Handle(AIS_InteractiveContext)&,
const Handle(V3d_View)&,
const Handle(SelectMgr_EntityOwner)&,
const Graphic3d_Vec2i&,
const Graphic3d_Vec2i&,
const AIS_DragAction)
{
return Standard_False;
}
//=======================================================================
//function :
//purpose :

View File

@@ -18,14 +18,12 @@
#define _AIS_InteractiveObject_HeaderFile
#include <AIS_KindOfInteractive.hxx>
#include <AIS_DragAction.hxx>
#include <SelectMgr_SelectableObject.hxx>
class AIS_InteractiveContext;
class Graphic3d_MaterialAspect;
class Prs3d_BasicAspect;
class Bnd_Box;
class V3d_View;
//! Defines a class of objects with display and selection services.
//! Entities which are visualized and selected are Interactive Objects.
@@ -105,21 +103,6 @@ public:
//! This method removes the owner from the graphic entity.
void ClearOwner() { myOwner.Nullify(); }
//! Drag object in the viewer.
//! @param theCtx [in] interactive context
//! @param theView [in] active View
//! @param theOwner [in] the owner of detected entity
//! @param theDragFrom [in] drag start point
//! @param theDragTo [in] drag end point
//! @param theAction [in] drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction);
public:
//! Returns the context pointer to the interactive context.

View File

@@ -639,44 +639,6 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
return Standard_False;
}
//=======================================================================
//function : ProcessDragging
//purpose :
//=======================================================================
Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveContext)&,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)&,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction)
{
switch (theAction)
{
case AIS_DragAction_Start:
{
if (HasActiveMode())
{
StartTransform (theDragFrom.x(), theDragFrom.y(), theView);
return Standard_True;
}
break;
}
case AIS_DragAction_Update:
{
Transform (theDragTo.x(), theDragTo.y(), theView);
return Standard_True;
}
case AIS_DragAction_Abort:
{
StopTransform (false);
return Standard_True;
}
case AIS_DragAction_Stop:
break;
}
return Standard_False;
}
//=======================================================================
//function : StartTransform
//purpose :

View File

@@ -163,20 +163,6 @@ public:
}
public:
//! Drag object in the viewer.
//! @param theCtx [in] interactive context
//! @param theView [in] active View
//! @param theOwner [in] the owner of detected entity
//! @param theDragFrom [in] drag start point
//! @param theDragTo [in] drag end point
//! @param theAction [in] drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction) Standard_OVERRIDE;
//! Init start (reference) transformation.
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform

View File

@@ -20,7 +20,6 @@
#include <Font_Rect.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_RenderingParams.hxx>
#include <Graphic3d_Text.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
@@ -309,9 +308,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
{
aHasOwnAnchor = Standard_False; // always not using own anchor if flipping
}
Handle(Graphic3d_Text) aText =
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, anOrientation, aHasOwnAnchor);
aText->SetTextFormatter (myFormatter);
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, anOrientation, aHasOwnAnchor);
if (myHasFlipping && isInit)
{
thePrs->CurrentGroup()->SetFlippingOptions (Standard_False, gp_Ax2());
@@ -319,9 +316,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
}
else
{
Handle(Graphic3d_Text) aText =
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, aPosition);
aText->SetTextFormatter (myFormatter);
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, aPosition);
}
if (isInit)

View File

@@ -24,8 +24,6 @@
#include <Font_FontAspect.hxx>
#include <TCollection_ExtendedString.hxx>
class Font_TextFormatter;
//! Presentation of the text.
class AIS_TextLabel : public AIS_InteractiveObject
{
@@ -123,12 +121,6 @@ public:
//! and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
Standard_EXPORT void SetColorSubTitle (const Quantity_Color& theColor);
//! Returns text presentation formatter; NULL by default, which means standard text formatter will be used.
const Handle(Font_TextFormatter)& TextFormatter() const { return myFormatter; }
//! Setup text formatter for presentation. It's empty by default.
void SetTextFormatter (const Handle(Font_TextFormatter)& theFormatter) { myFormatter = theFormatter; }
protected:
//! Compute
@@ -152,8 +144,6 @@ protected:
protected:
Handle(Font_TextFormatter) myFormatter;
TCollection_ExtendedString myText;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;

View File

@@ -15,6 +15,7 @@
#include <AIS_AnimationCamera.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Manipulator.hxx>
#include <AIS_Point.hxx>
#include <AIS_RubberBand.hxx>
#include <AIS_XRTrackedDevice.hxx>
@@ -2610,20 +2611,19 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
case AIS_DragAction_Start:
{
myDragObject.Nullify();
myDragOwner.Nullify();
if (!theCtx->HasDetected())
{
return;
}
const Handle(SelectMgr_EntityOwner)& aDetectedOwner = theCtx->DetectedOwner();
Handle(AIS_InteractiveObject) aDetectedPrs = Handle(AIS_InteractiveObject)::DownCast (aDetectedOwner->Selectable());
if (aDetectedPrs->ProcessDragging (theCtx, theView, aDetectedOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction))
Handle(AIS_InteractiveObject) aPrs = theCtx->DetectedInteractive();
if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (aPrs))
{
myDragObject = aDetectedPrs;
myDragOwner = aDetectedOwner;
if (aManip->HasActiveMode())
{
myDragObject = aManip;
aManip->StartTransform (myGL.Dragging.PointStart.x(), myGL.Dragging.PointStart.y(), theView);
}
}
return;
}
@@ -2638,9 +2638,10 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
{
theCtx->SetSelectedState (aGlobOwner, true);
}
myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction);
if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (myDragObject))
{
aManip->Transform (myGL.Dragging.PointTo.x(), myGL.Dragging.PointTo.y(), theView);
}
theView->Invalidate();
return;
}
@@ -2654,8 +2655,10 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
myGL.Dragging.PointTo = myGL.Dragging.PointStart;
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction);
if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (myDragObject))
{
aManip->StopTransform (false);
}
Standard_FALLTHROUGH
}
case AIS_DragAction_Stop:
@@ -2670,11 +2673,8 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
theCtx->SetSelectedState (aGlobOwner, false);
}
myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction);
theView->Invalidate();
myDragObject.Nullify();
myDragOwner.Nullify();
return;
}
}

View File

@@ -40,7 +40,6 @@ class AIS_Point;
class AIS_RubberBand;
class AIS_XRTrackedDevice;
class Graphic3d_Camera;
class SelectMgr_EntityOwner;
class V3d_View;
class WNT_HIDSpaceMouse;
@@ -738,7 +737,6 @@ protected:
Handle(AIS_AnimationCamera) myViewAnimation; //!< view animation
Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation
Handle(SelectMgr_EntityOwner) myDragOwner; //!< detected owner of currently dragged object
Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation

View File

@@ -357,7 +357,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
aChecker.SetNonDestructive(Standard_True);
aChecker.SetRunParallel(myRunParallel);
aChecker.SetFuzzyValue(myFuzzyValue);
aChecker.SetProgressIndicator(*myProgressScope);
aChecker.SetProgressIndicator(myProgressIndicator);
//
aChecker.Perform();
Standard_Boolean hasError = aChecker.HasErrors();

View File

@@ -388,7 +388,7 @@ void BOPAlgo_BOP::Perform()
pPF=new BOPAlgo_PaveFiller(aAllocator);
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -195,7 +195,7 @@ void BOPAlgo_Builder::Perform()
//
pPF->SetArguments(myArguments);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
@@ -632,7 +632,7 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects,
aBS.SetRunParallel(myRunParallel);
aBS.SetContext(myContext);
aBS.SetFuzzyValue(myFuzzyValue);
aBS.SetProgressIndicator(*myProgressScope);
aBS.SetProgressIndicator(myProgressIndicator);
aBS.Perform();
// Resulting solids

View File

@@ -438,7 +438,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
aBF.SetFace(aF);
aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel);
aBF.SetProgressIndicator(*myProgressScope);
aBF.SetProgressIndicator(myProgressIndicator);
//
}// for (i=0; i<aNbS; ++i) {
//
@@ -625,7 +625,7 @@ void BOPAlgo_Builder::FillSameDomainFaces()
aPSB.Shape1() = aF1;
aPSB.Shape2() = aF2;
aPSB.SetFuzzyValue(myFuzzyValue);
aPSB.SetProgressIndicator(*myProgressScope);
aPSB.SetProgressIndicator(myProgressIndicator);
}
}
}
@@ -778,7 +778,7 @@ void BOPAlgo_Builder::FillInternalVertices()
aVFI.SetVertex(aV);
aVFI.SetFace(aFIm);
aVFI.SetFuzzyValue(myFuzzyValue);
aVFI.SetProgressIndicator(*myProgressScope);
aVFI.SetProgressIndicator(myProgressIndicator);
}
}
}

View File

@@ -432,7 +432,7 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
aBS.SetSolid(aSolid);
aBS.SetShapes(aSFS);
aBS.SetRunParallel(myRunParallel);
aBS.SetProgressIndicator(*myProgressScope);
aBS.SetProgressIndicator(myProgressIndicator);
}//for (i=0; i<aNbS; ++i) {
//
Standard_Integer k, aNbBS;

View File

@@ -432,7 +432,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
aFaceSelfIntersect.SetFace(aF);
aFaceSelfIntersect.SetTolF(aTolF);
//
aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
aFaceSelfIntersect.SetProgressIndicator(myProgressIndicator);
}
Standard_Integer aNbFace = aVFace.Length();

View File

@@ -86,7 +86,7 @@ void BOPAlgo_MakerVolume::Perform()
}
//
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -15,9 +15,8 @@
#include <BOPAlgo_Options.hxx>
#include <Message_MsgFile.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressIndicator.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TCollection_AsciiString.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>
@@ -52,7 +51,6 @@ BOPAlgo_Options::BOPAlgo_Options()
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion()),
myProgressScope(0L),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
@@ -69,7 +67,6 @@ BOPAlgo_Options::BOPAlgo_Options
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion()),
myProgressScope(0L),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
@@ -135,21 +132,22 @@ void BOPAlgo_Options::SetFuzzyValue(const Standard_Real theFuzz)
//purpose :
//=======================================================================
void BOPAlgo_Options::SetProgressIndicator
(const Message_ProgressScope& theScope)
(const Handle(Message_ProgressIndicator)& theObj)
{
myProgressScope = &theScope;
if (!theObj.IsNull()) {
myProgressIndicator = theObj;
}
}
//=======================================================================
//function : UserBreak
//purpose :
//=======================================================================
void BOPAlgo_Options::UserBreak() const
{
if (!myProgressScope) {
if (myProgressIndicator.IsNull()) {
return;
}
if (myProgressScope->UserBreak()) {
if (myProgressIndicator->UserBreak()) {
throw Standard_NotImplemented("BOPAlgo_Options::UserBreak(), method is not implemented");
}
}

View File

@@ -20,7 +20,7 @@
#include <NCollection_BaseAllocator.hxx>
class Message_ProgressScope;
class Message_ProgressIndicator;
//! The class provides the following options for the algorithms in Boolean Component:
//! - *Memory allocation tool* - tool for memory allocations;
@@ -156,7 +156,7 @@ public:
//!@name Progress indicator
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator(const Message_ProgressScope& theProgress);
Standard_EXPORT void SetProgressIndicator(const Handle(Message_ProgressIndicator)& theObj);
public:
//!@name Usage of Oriented Bounding boxes
@@ -185,7 +185,7 @@ protected:
Handle(Message_Report) myReport;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
const Message_ProgressScope* myProgressScope;
Handle(Message_ProgressIndicator) myProgressIndicator;
Standard_Boolean myUseOBB;
};

View File

@@ -264,7 +264,7 @@ void BOPAlgo_PaveFiller::IntersectVE
aVESolver.SetEdge(aE);
aVESolver.SetPaveBlock(aPB);
aVESolver.SetFuzzyValue(myFuzzyValue);
aVESolver.SetProgressIndicator(*myProgressScope);
aVESolver.SetProgressIndicator(myProgressIndicator);
}
}
//

View File

@@ -253,7 +253,7 @@ void BOPAlgo_PaveFiller::PerformEE()
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetBoxes (aBB1, aBB2);
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(*myProgressScope);
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
}//for (; aIt2.More(); aIt2.Next()) {
}//for (; aIt1.More(); aIt1.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
@@ -1073,7 +1073,7 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
else
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(*myProgressScope);
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
}
}
}

View File

@@ -217,7 +217,7 @@ void BOPAlgo_PaveFiller::PerformVF()
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
aVertexFace.SetFuzzyValue(myFuzzyValue);
aVertexFace.SetProgressIndicator(*myProgressScope);
aVertexFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Length();

View File

@@ -278,7 +278,7 @@ void BOPAlgo_PaveFiller::PerformEF()
aSR = aPBRange;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
aEdgeFace.SetRange (aPBRange);
aEdgeFace.SetProgressIndicator(*myProgressScope);
aEdgeFace.SetProgressIndicator(myProgressIndicator);
// Save the pair to avoid their forced intersection
BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF);
if (!pMPB)
@@ -999,7 +999,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd);
aEdgeFace.UseQuickCoincidenceCheck(Standard_True);
aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()));
aEdgeFace.SetProgressIndicator(*myProgressScope);
aEdgeFace.SetProgressIndicator(myProgressIndicator);
}
}
}

View File

@@ -306,7 +306,7 @@ void BOPAlgo_PaveFiller::PerformFF()
//
aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol);
aFaceFace.SetFuzzyValue(myFuzzyValue);
aFaceFace.SetProgressIndicator(*myProgressScope);
aFaceFace.SetProgressIndicator(myProgressIndicator);
}
else {
// for the Glue mode just add all interferences of that type
@@ -1007,7 +1007,7 @@ void BOPAlgo_PaveFiller::PostTreatFF
}
//
// 2 Fuse shapes
aPF.SetProgressIndicator(*myProgressScope);
aPF.SetProgressIndicator(myProgressIndicator);
aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS);
aPF.Perform();

View File

@@ -484,7 +484,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
aBSE.SetCommonBlock(aCB);
}
aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(*myProgressScope);
aBSE.SetProgressIndicator(myProgressIndicator);
} // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) {
//
@@ -596,7 +596,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPC& aMPC=aVMPC.Appended();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(*myProgressScope);
aMPC.SetProgressIndicator(myProgressIndicator);
}
//
// On
@@ -660,7 +660,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(*myProgressScope);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}// for (i=0; i<aNbFI; ++i) {
//
@@ -710,7 +710,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(Standard_True);
aMPC.SetProgressIndicator(*myProgressScope);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}
}

View File

@@ -89,7 +89,7 @@ void BOPAlgo_Splitter::Perform()
BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -24,9 +24,10 @@
#include <Standard_Boolean.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
#include <BOPAlgo_Options.hxx>
class Message_ProgressIndicator;
class TopoDS_Shape;
//! Provides the root interface for the API algorithms
class BRepAlgoAPI_Algo : public BRepBuilderAPI_MakeShape,

View File

@@ -125,7 +125,7 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg
myDSFiller->SetArguments(theArgs);
// Set options for intersection
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(*myProgressScope);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
@@ -145,7 +145,7 @@ void BRepAlgoAPI_BuilderAlgo::BuildResult()
{
// Set options to the builder
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(*myProgressScope);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetCheckInverted(myCheckInverted);
myBuilder->SetToFillHistory(myFillHistory);
// Perform building of the result with pre-calculated intersections

View File

@@ -94,7 +94,7 @@ void BRepAlgoAPI_Check::Perform()
anAnalyzer.SelfInterMode() = myTestSI;
// Set options from BOPAlgo_Options
anAnalyzer.SetRunParallel(myRunParallel);
anAnalyzer.SetProgressIndicator(*myProgressScope);
anAnalyzer.SetProgressIndicator(myProgressIndicator);
anAnalyzer.SetFuzzyValue(myFuzzyValue);
// Perform the check
anAnalyzer.Perform();

View File

@@ -85,7 +85,8 @@
#include <GeomLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <Precision.hxx>
#include <Standard_ErrorHandler.hxx>
@@ -1811,10 +1812,10 @@ void BRepBuilderAPI_Sewing::Add(const TopoDS_Shape& aShape)
#include <OSD_Timer.hxx>
#endif
void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& thePI)
{
const Standard_Integer aNumberOfStages = myAnalysis + myCutting + mySewing + 2;
Message_ProgressScope aPS (theProgress, "Sewing", aNumberOfStages);
Message_ProgressSentry aPS (thePI, "Sewing", 0, aNumberOfStages, 1);
#ifdef OCCT_DEBUG
Standard_Real t_total = 0., t_analysis = 0., t_assembling = 0., t_cutting = 0., t_merging = 0.;
OSD_Chronometer chr_total, chr_local;
@@ -1830,9 +1831,10 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
chr_local.Reset();
chr_local.Start();
#endif
FaceAnalysis (aPS.Next());
FaceAnalysis (thePI);
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_analysis);
@@ -1853,9 +1855,10 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
chr_local.Reset();
chr_local.Start();
#endif
VerticesAssembling (aPS.Next());
VerticesAssembling (thePI);
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_assembling);
@@ -1868,9 +1871,10 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
chr_local.Reset();
chr_local.Start();
#endif
Cutting (aPS.Next());
Cutting (thePI);
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_cutting);
@@ -1882,9 +1886,10 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
chr_local.Reset();
chr_local.Start();
#endif
Merging (Standard_True, aPS.Next());
Merging (Standard_True, thePI);
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_merging);
@@ -1893,10 +1898,10 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
}
else
{
aPS.Next();
aPS.Next( 1, Handle(TCollection_HAsciiString)());
if (myCutting)
aPS.Next();
aPS.Next();
aPS.Next( 1, Handle(TCollection_HAsciiString)());
aPS.Next( 1, Handle(TCollection_HAsciiString)());
if (!aPS.More())
return;
}
@@ -1908,7 +1913,7 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
std::cout << "Creating sewed shape..." << std::endl;
#endif
// examine the multiple edges if any and process sameparameter for edges if necessary
EdgeProcessing (aPS.Next());
EdgeProcessing (thePI);
if (!aPS.More())
return;
CreateSewedShape();
@@ -1918,7 +1923,7 @@ void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
return;
}
EdgeRegularity (aPS.Next());
EdgeRegularity (thePI);
if (mySameParameterMode && myFaceMode)
SameParameterShape();
@@ -2230,7 +2235,7 @@ void BRepBuilderAPI_Sewing::Dump() const
// myDegenerated
//=======================================================================
void BRepBuilderAPI_Sewing::FaceAnalysis(const Message_ProgressRange& theProgress)
void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)& thePI)
{
if (!myShape.IsNull() && myOldShapes.IsEmpty()) {
Add(myShape);
@@ -2241,7 +2246,7 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Message_ProgressRange& theProgres
TopTools_MapOfShape SmallEdges;
TopTools_IndexedDataMapOfShapeListOfShape GluedVertices;
Standard_Integer i = 1;
Message_ProgressScope aPS (theProgress, "Shape analysis", myOldShapes.Extent());
Message_ProgressSentry aPS (thePI, "Shape analysis", 0, myOldShapes.Extent(), 1);
for (i = 1; i <= myOldShapes.Extent() && aPS.More(); i++, aPS.Next()) {
for (TopExp_Explorer fexp(myOldShapes(i),TopAbs_FACE); fexp.More(); fexp.Next()) {
@@ -2772,7 +2777,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
TopTools_DataMapOfShapeListOfShape& aNodeEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& aBoundFaces,
const Standard_Real Tolerance,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& theProgress)
{
// Create map of node -> vertices
TopTools_IndexedDataMapOfShapeListOfShape NodeVertices;
@@ -2800,7 +2805,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
#endif
// Merge nearest nodes
TopTools_IndexedDataMapOfShapeShape NodeNearestNode;
Message_ProgressScope aPS (theProgress, "Glueing nodes", nbNodes, Standard_True);
Message_ProgressSentry aPS (theProgress, "Glueing nodes", 0, nbNodes, 1, Standard_True);
for (Standard_Integer i = 1; i <= nbNodes && aPS.More(); i++, aPS.Next()) {
const TopoDS_Vertex& node1 = TopoDS::Vertex(NodeVertices.FindKey(i));
// Find near nodes
@@ -2933,11 +2938,11 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
return CreateNewNodes(NodeNearestNode,NodeVertices,aVertexNode,aNodeEdges);
}
void BRepBuilderAPI_Sewing::VerticesAssembling(const Message_ProgressRange& theProgress)
void BRepBuilderAPI_Sewing::VerticesAssembling(const Handle(Message_ProgressIndicator)& thePI)
{
Standard_Integer nbVert = myVertexNode.Extent();
Standard_Integer nbVertFree = myVertexNodeFree.Extent();
Message_ProgressScope aPS (theProgress, "Vertices assembling", 2);
Message_ProgressSentry aPS (thePI, "Vertices assembling", 0, 2, 1);
if (nbVert || nbVertFree) {
// Fill map node -> sections
Standard_Integer i;
@@ -2959,15 +2964,16 @@ void BRepBuilderAPI_Sewing::VerticesAssembling(const Message_ProgressRange& theP
#ifdef OCCT_DEBUG
std::cout << "Assemble " << nbVert << " vertices on faces..." << std::endl;
#endif
while (GlueVertices(myVertexNode,myNodeSections,myBoundFaces,myTolerance, aPS.Next()));
while (GlueVertices(myVertexNode,myNodeSections,myBoundFaces,myTolerance, thePI));
}
if (!aPS.More())
return;
aPS.Next();
if (nbVertFree) {
#ifdef OCCT_DEBUG
std::cout << "Assemble " << nbVertFree << " vertices on floating edges..." << std::endl;
#endif
while (GlueVertices(myVertexNodeFree,myNodeSections,myBoundFaces,myTolerance, aPS.Next()));
while (GlueVertices(myVertexNodeFree,myNodeSections,myBoundFaces,myTolerance, thePI));
}
}
}
@@ -3127,11 +3133,11 @@ static void ReplaceEdge(const TopoDS_Shape& oldEdge,
//=======================================================================
void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& thePI)
{
BRep_Builder B;
// TopTools_MapOfShape MergedEdges;
Message_ProgressScope aPS (theProgress, "Merging bounds", myBoundFaces.Extent());
Message_ProgressSentry aPS (thePI, "Merging bounds", 0, myBoundFaces.Extent(), 1);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
@@ -3617,7 +3623,7 @@ Standard_Boolean BRepBuilderAPI_Sewing::MergedNearestEdges(const TopoDS_Shape& e
// myCuttingNode
//=======================================================================
void BRepBuilderAPI_Sewing::Cutting(const Message_ProgressRange& theProgress)
void BRepBuilderAPI_Sewing::Cutting(const Handle(Message_ProgressIndicator)& thePI)
{
Standard_Integer i, nbVertices = myVertexNode.Extent();
if (!nbVertices) return;
@@ -3640,7 +3646,7 @@ void BRepBuilderAPI_Sewing::Cutting(const Message_ProgressRange& theProgress)
Standard_Real first, last;
// Iterate on all boundaries
Standard_Integer nbBounds = myBoundFaces.Extent();
Message_ProgressScope aPS (theProgress, "Cutting bounds", nbBounds);
Message_ProgressSentry aPS (thePI, "Cutting bounds", 0, nbBounds, 1);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Edge& bound = TopoDS::Edge(anIterB.Key());
@@ -3980,12 +3986,12 @@ static TopoDS_Edge DegeneratedSection(const TopoDS_Shape& section, const TopoDS_
// - make the contigous edges sameparameter
//=======================================================================
void BRepBuilderAPI_Sewing::EdgeProcessing(const Message_ProgressRange& theProgress)
void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicator)& thePI)
{
// constructs sectionEdge
TopTools_IndexedMapOfShape MapFreeEdges;
TopTools_DataMapOfShapeShape EdgeFace;
Message_ProgressScope aPS (theProgress, "Edge processing", myBoundFaces.Extent());
Message_ProgressSentry aPS (thePI, "Edge processing", 0, myBoundFaces.Extent(), 1);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Shape& bound = anIterB.Key();
@@ -4045,12 +4051,12 @@ void BRepBuilderAPI_Sewing::EdgeProcessing(const Message_ProgressRange& theProgr
//purpose : update Continuity flag on newly created edges
//=======================================================================
void BRepBuilderAPI_Sewing::EdgeRegularity(const Message_ProgressRange& theProgress)
void BRepBuilderAPI_Sewing::EdgeRegularity(const Handle(Message_ProgressIndicator)& thePI)
{
TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
TopExp::MapShapesAndAncestors(mySewedShape, TopAbs_EDGE, TopAbs_FACE, aMapEF);
Message_ProgressScope aPS(theProgress, "Encode edge regularity", myMergedEdges.Extent());
Message_ProgressSentry aPS(thePI, "Encode edge regularity", 0, myMergedEdges.Extent(), 1);
for (TopTools_MapIteratorOfMapOfShape aMEIt(myMergedEdges); aMEIt.More() && aPS.More(); aMEIt.Next(), aPS.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(myReShape->Apply(aMEIt.Value()));

View File

@@ -41,12 +41,13 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <Message_ProgressRange.hxx>
#include <Message_ProgressIndicator.hxx>
class BRepTools_ReShape;
class Standard_OutOfRange;
class Standard_NoSuchObject;
class TopoDS_Shape;
class Message_ProgressIndicator;
class TopoDS_Edge;
class TopoDS_Face;
class Geom_Surface;
@@ -104,8 +105,8 @@ public:
Standard_EXPORT void Add (const TopoDS_Shape& shape);
//! Computing
//! theProgress - progress indicator of algorithm
Standard_EXPORT void Perform (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! thePI - progress indicator of algorithm
Standard_EXPORT void Perform (const Handle(Message_ProgressIndicator)& thePI = 0);
//! Gives the sewed shape
//! a null shape if nothing constructed
@@ -247,10 +248,10 @@ protected:
//! Performs cutting of sections
//! theProgress - progress indicator of processing
Standard_EXPORT void Cutting (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! thePI - progress indicator of processing
Standard_EXPORT void Cutting (const Handle(Message_ProgressIndicator)& thePI = 0);
Standard_EXPORT void Merging (const Standard_Boolean passage, const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Merging (const Standard_Boolean passage, const Handle(Message_ProgressIndicator)& thePI = 0);
Standard_EXPORT Standard_Boolean IsMergedClosed (const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const TopoDS_Face& fase) const;
@@ -261,10 +262,10 @@ protected:
//! Merged nearest edges.
Standard_EXPORT Standard_Boolean MergedNearestEdges (const TopoDS_Shape& edge, TopTools_SequenceOfShape& SeqMergedEdge, TColStd_SequenceOfBoolean& SeqMergedOri);
Standard_EXPORT void EdgeProcessing (const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void EdgeProcessing (const Handle(Message_ProgressIndicator)& thePI = 0);
//! Recompute regularity on merged edges
Standard_EXPORT void EdgeRegularity (const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void EdgeRegularity (const Handle(Message_ProgressIndicator)& thePI = 0);
Standard_EXPORT void CreateOutputInformations();
@@ -276,8 +277,8 @@ protected:
//! This method is called from Perform only
//! theProgress - progress indicator of processing
Standard_EXPORT virtual void FaceAnalysis (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! thePI - progress indicator of processing
Standard_EXPORT virtual void FaceAnalysis (const Handle(Message_ProgressIndicator)& thePI = 0);
//! This method is called from Perform only
@@ -285,8 +286,8 @@ protected:
//! This method is called from Perform only
//! theProgress - progress indicator of processing
Standard_EXPORT virtual void VerticesAssembling (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! thePI - progress indicator of processing
Standard_EXPORT virtual void VerticesAssembling (const Handle(Message_ProgressIndicator)& thePI = 0);
//! This method is called from Perform only

View File

@@ -154,7 +154,7 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
const TopoDS_Shape& aShape1 = theMap1 (aPair.Index1);
const TopoDS_Shape& aShape2 = theMap2 (aPair.Index2);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps, myFlag);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
if (aDistTool.IsDone())
{
if (aDistTool.DistValue() < myDistRef - myEps)
@@ -199,7 +199,8 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (Extrema_ExtFlag_MINMAX)
myFlag (Extrema_ExtFlag_MINMAX),
myAlgo (Extrema_ExtAlgo_Grad)
{
//
}
@@ -210,14 +211,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
//=======================================================================
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Extrema_ExtFlag F)
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F)
myFlag (F),
myAlgo (A)
{
LoadS1(Shape1);
LoadS2(Shape2);
@@ -232,14 +235,16 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Standard_Real theDeflection,
const Extrema_ExtFlag F)
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (theDeflection),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F)
myFlag (F),
myAlgo (A)
{
LoadS1(Shape1);
LoadS2(Shape2);

View File

@@ -18,6 +18,7 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <BRepExtrema_SolutionElem.hxx>
#include <BRepExtrema_SupportType.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Extrema_ExtFlag.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
@@ -38,9 +39,9 @@ class BRepExtrema_DistShapeShape
Standard_EXPORT BRepExtrema_DistShapeShape();
//! computation of the minimum distance (value and pair of points) using default deflection <br>
//! Default value is Precision::Confusion(). <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
//! create tool and load both shapes into it <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
void SetDeflection(const Standard_Real theDeflection)
{
@@ -128,6 +129,11 @@ class BRepExtrema_DistShapeShape
myFlag = F;
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
//! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
@@ -150,6 +156,7 @@ private:
Standard_Boolean myIsInitS1;
Standard_Boolean myIsInitS2;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
Bnd_SeqOfBox myBV1;
Bnd_SeqOfBox myBV2;
Bnd_SeqOfBox myBE1;

View File

@@ -772,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S1,S2,myFlag);
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
@@ -828,7 +828,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S2,S1,myFlag);
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{

View File

@@ -16,6 +16,7 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Precision.hxx>
#include <Standard_DefineAlloc.hxx>
@@ -38,8 +39,9 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
{
Perform(S1, S2, B1, B2);
}
@@ -50,8 +52,9 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef, const Standard_Real aDeflection,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
{
Perform(S1, S2, B1, B2);
}
@@ -80,6 +83,11 @@ class BRepExtrema_DistanceSS
{
myFlag = F;
}
//! sets the flag controlling ...
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
@@ -122,6 +130,7 @@ class BRepExtrema_DistanceSS
Standard_Boolean myModif;
Standard_Real myEps;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
};
#endif

View File

@@ -32,9 +32,9 @@
//=======================================================================
BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag)
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
{
Initialize(TheFace,TheFlag);
Initialize(TheFace,TheFlag,TheAlgo);
Perform(TheVertex,TheFace);
}
@@ -44,7 +44,7 @@ BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoD
//=======================================================================
void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag)
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
{
// cette surface doit etre en champ. Extrema ne fait
// pas de copie et prend seulement un pointeur dessus.
@@ -60,6 +60,7 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
Standard_Real U1, U2, V1, V2;
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
myExtPS.SetFlag(TheFlag);
myExtPS.SetAlgo(TheAlgo);
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
}

View File

@@ -21,6 +21,7 @@
#include <Extrema_SequenceOfPOnSurf.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
class TopoDS_Vertex;
class TopoDS_Face;
@@ -37,10 +38,12 @@ class BRepExtrema_ExtPF
{}
//! It calculates all the distances. <br>
Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
//! An exception is raised if the fields have not been initialized. <br>
//! Be careful: this method uses the Face only for classify not for the fields. <br>
@@ -76,6 +79,11 @@ class BRepExtrema_ExtPF
myExtPS.SetFlag(F);
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myExtPS.SetAlgo(A);
}
private:
Extrema_ExtPS myExtPS;

View File

@@ -23,7 +23,6 @@
#include <BRepLib_MakeFace.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <GCPnts.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
@@ -182,6 +181,39 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S,
namespace
{
static void fillParams (const TColStd_Array1OfReal& theKnots,
Standard_Integer theDegree,
Standard_Real theParMin,
Standard_Real theParMax,
NCollection_Vector<Standard_Real>& theParams)
{
Standard_Real aPrevPar = theParMin;
theParams.Append (aPrevPar);
Standard_Integer aNbP = Max (theDegree, 1);
for (Standard_Integer i = 1;
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
{
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
continue;
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
for (Standard_Integer k = 1; k <= aNbP ; ++k)
{
Standard_Real aPar = theKnots (i) + k * aStep;
if (aPar > theParMax - Precision::PConfusion())
break;
if (aPar > aPrevPar + Precision::PConfusion())
{
theParams.Append (aPar);
aPrevPar = aPar;
}
}
}
theParams.Append (theParMax);
}
static void fillPoints (const BRepAdaptor_Curve& theCurve,
const NCollection_Vector<Standard_Real> theParams,
@@ -329,13 +361,13 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aKnots.SetValue (1, GC->FirstParameter());
aKnots.SetValue (2, GC->LastParameter());
GCPnts::FillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
fillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_BSplineCurve:
{
Handle(Geom_BSplineCurve) GC = c.BSpline();
GCPnts::FillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
fillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_Line:
@@ -362,7 +394,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aBounds.SetValue (1, dfUf);
aBounds.SetValue (2, dfUl);
GCPnts::FillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
fillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
}
}

View File

@@ -73,7 +73,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
if (n == 5)
aDeflection = Draw::Atof(a[4]);
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection, Extrema_ExtFlag_MIN);
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
if (dst.IsDone())
{

View File

@@ -36,7 +36,6 @@
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TCollection_AsciiString.hxx>
#include <Geom_Surface.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <TopTools_ListOfShape.hxx>
@@ -456,7 +455,7 @@ static Standard_Integer sewing (Draw_Interpretor& theDi,
aSewing.Add(aSeq.Value(i));
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDi, 1);
aSewing.Perform (aProgress->Start());
aSewing.Perform (aProgress);
aSewing.Dump();
const TopoDS_Shape& aRes = aSewing.SewedShape();
@@ -619,9 +618,9 @@ static Standard_Integer getedgeregul
//=======================================================================
static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 3 || n > 4) {
if (n < 3 || n > 5) {
di << "Project point on the face.\n";
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax]\n";
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n";
return 1;
}
// get face
@@ -644,6 +643,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
//
// get projection options
// default values;
Extrema_ExtAlgo anExtAlgo = Extrema_ExtAlgo_Grad;
Extrema_ExtFlag anExtFlag = Extrema_ExtFlag_MINMAX;
//
for (Standard_Integer i = 3; i < n; ++i) {
@@ -656,6 +656,12 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
else if (!strcasecmp(a[i], "-minmax")) {
anExtFlag = Extrema_ExtFlag_MINMAX;
}
else if (!strcasecmp(a[i], "-t")) {
anExtAlgo = Extrema_ExtAlgo_Tree;
}
else if (!strcasecmp(a[i], "-g")) {
anExtAlgo = Extrema_ExtAlgo_Grad;
}
}
//
// get surface
@@ -672,6 +678,7 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
GeomAPI_ProjectPointOnSurf aProjPS;
aProjPS.Init(aSurf, aUMin, aUMax, aVMin, aVMax);
// set the options
aProjPS.SetExtremaAlgo(anExtAlgo);
aProjPS.SetExtremaFlag(anExtFlag);
// perform projection
aProjPS.Perform(aP);
@@ -760,7 +767,7 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
theCommands.Add ("projponf",
"projponf face pnt [extrema flag: -min/-max/-minmax]\n"
"projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n"
"\t\tProject point on the face.",
__FILE__, projponf, g);
}

View File

@@ -127,8 +127,7 @@ Handle(Transfer_FinderProcess) BRepToIGES_BREntity::GetTransferProcess() const
//purpose :
//=======================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BREntity::TransferShape
(const TopoDS_Shape& start,
const Message_ProgressRange& theProgress)
(const TopoDS_Shape& start)
{
Handle(IGESData_IGESEntity) res;
// TopoDS_Shape theShape;
@@ -165,31 +164,31 @@ Handle(IGESData_IGESEntity) BRepToIGES_BREntity::TransferShape
TopoDS_Face F = TopoDS::Face(start);
BRepToIGES_BRShell BS(*this);
BS.SetModel(GetModel());
res = BS.TransferFace(F, theProgress);
res = BS.TransferFace(F);
}
else if (start.ShapeType() == TopAbs_SHELL) {
TopoDS_Shell S = TopoDS::Shell(start);
BRepToIGES_BRShell BS(*this);
BS.SetModel(GetModel());
res = BS.TransferShell(S, theProgress);
res = BS.TransferShell(S);
}
else if (start.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid M = TopoDS::Solid(start);
BRepToIGES_BRSolid BS(*this);
BS.SetModel(GetModel());
res = BS.TransferSolid(M, theProgress);
res = BS.TransferSolid(M);
}
else if (start.ShapeType() == TopAbs_COMPSOLID) {
TopoDS_CompSolid C = TopoDS::CompSolid(start);
BRepToIGES_BRSolid BS(*this);
BS.SetModel(GetModel());
res = BS.TransferCompSolid(C, theProgress);
res = BS.TransferCompSolid(C);
}
else if (start.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Compound C = TopoDS::Compound(start);
BRepToIGES_BRSolid BS(*this);
BS.SetModel(GetModel());
res = BS.TransferCompound(C, theProgress);
res = BS.TransferCompound(C);
}
else {
// message d`erreur

View File

@@ -24,8 +24,6 @@
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Message_ProgressRange.hxx>
class IGESData_IGESModel;
class Transfer_FinderProcess;
class IGESData_IGESEntity;
@@ -66,9 +64,7 @@ public:
//! Returns the result of the transfert of any Shape
//! If the transfer has failed, this member return a NullEntity.
Standard_EXPORT virtual Handle(IGESData_IGESEntity) TransferShape
(const TopoDS_Shape& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT virtual Handle(IGESData_IGESEntity) TransferShape (const TopoDS_Shape& start);
//! Records a new Fail message
Standard_EXPORT void AddFail (const TopoDS_Shape& start, const Standard_CString amess);

View File

@@ -43,7 +43,7 @@
#include <IGESGeom_SurfaceOfRevolution.hxx>
#include <IGESGeom_TrimmedSurface.hxx>
#include <Interface_Macros.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressIndicator.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Map.hxx>
#include <ShapeAlgo.hxx>
@@ -86,8 +86,7 @@ BRepToIGES_BRShell::BRepToIGES_BRShell
// TransferShell
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferShell(const TopoDS_Shape& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferShell(const TopoDS_Shape& start)
{
Handle(IGESData_IGESEntity) res;
@@ -95,11 +94,11 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferShell(const TopoDS_Shap
if (start.ShapeType() == TopAbs_FACE) {
TopoDS_Face F = TopoDS::Face(start);
res = TransferFace(F, theProgress);
res = TransferFace(F);
}
else if (start.ShapeType() == TopAbs_SHELL) {
TopoDS_Shell S = TopoDS::Shell(start);
res = TransferShell(S, theProgress);
res = TransferShell(S);
}
else {
// message d`erreur
@@ -113,10 +112,15 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferShell(const TopoDS_Shap
//
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferFace(const TopoDS_Face& start,
const Message_ProgressRange&)
Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferFace(const TopoDS_Face& start)
{
Handle(IGESData_IGESEntity) res;
Handle(Message_ProgressIndicator) progress = GetTransferProcess()->GetProgress();
if ( ! progress.IsNull() ) {
if ( progress->UserBreak() ) return res;
progress->Increment();
}
if ( start.IsNull()) {
return res;
@@ -336,8 +340,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferFace(const TopoDS_Face&
// TransferShell
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRShell::TransferShell(const TopoDS_Shell& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGES_BRShell::TransferShell(const TopoDS_Shell& start)
{
Handle(IGESData_IGESEntity) res;
if ( start.IsNull()) return res;
@@ -347,19 +350,13 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRShell::TransferShell(const TopoDS_Shell
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
Handle(IGESData_IGESEntity) IFace;
Standard_Integer nbshapes = 0;
for (Ex.Init(start, TopAbs_FACE); Ex.More(); Ex.Next())
nbshapes++;
Message_ProgressScope aPS(theProgress, NULL, nbshapes);
for (Ex.Init(start,TopAbs_FACE); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start,TopAbs_FACE); Ex.More(); Ex.Next()) {
TopoDS_Face F = TopoDS::Face(Ex.Current());
if (F.IsNull()) {
AddWarning(start," a Face is a null entity");
}
else {
IFace = TransferFace (F, aRange);
IFace = TransferFace(F);
if (!IFace.IsNull()) Seq->Append(IFace);
}
}

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx>
#include <BRepToIGES_BREntity.hxx>
#include <Message_ProgressRange.hxx>
class BRepToIGES_BREntity;
class IGESData_IGESEntity;
class TopoDS_Shape;
@@ -50,18 +48,15 @@ public:
//! Transfert an Shape entity from TopoDS to IGES
//! This entity must be a Face or a Shell.
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferShell (const TopoDS_Shape& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferShell (const TopoDS_Shape& start);
//! Transfert an Shell entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferShell (const TopoDS_Shell& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferShell (const TopoDS_Shell& start);
//! Transfert a Face entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferFace (const TopoDS_Face& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferFace (const TopoDS_Face& start);

View File

@@ -25,7 +25,6 @@
#include <IGESData_HArray1OfIGESEntity.hxx>
#include <IGESData_IGESEntity.hxx>
#include <Interface_Macros.hxx>
#include <Message_ProgressScope.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
@@ -65,8 +64,7 @@ BRepToIGES_BRSolid::BRepToIGES_BRSolid
// TransferSolid
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Shape& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Shape& start)
{
Handle(IGESData_IGESEntity) res;
@@ -74,15 +72,15 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Shap
if (start.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid M = TopoDS::Solid(start);
res = TransferSolid(M, theProgress);
res = TransferSolid(M);
}
else if (start.ShapeType() == TopAbs_COMPSOLID) {
TopoDS_CompSolid C = TopoDS::CompSolid(start);
res = TransferCompSolid(C, theProgress);
res = TransferCompSolid(C);
}
else if (start.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Compound C = TopoDS::Compound(start);
res = TransferCompound(C, theProgress);
res = TransferCompound(C);
}
else {
// error message
@@ -96,8 +94,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Shap
//
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Solid& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Solid& start)
{
Handle(IGESData_IGESEntity) res;
if ( start.IsNull()) return res;
@@ -107,19 +104,13 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Soli
BRepToIGES_BRShell BS(*this);
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
Standard_Integer nbshapes = 0;
for (Ex.Init(start, TopAbs_SHELL); Ex.More(); Ex.Next())
nbshapes++;
Message_ProgressScope aPS(theProgress, NULL, nbshapes);
for (Ex.Init(start,TopAbs_SHELL); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start,TopAbs_SHELL); Ex.More(); Ex.Next()) {
TopoDS_Shell S = TopoDS::Shell(Ex.Current());
if (S.IsNull()) {
AddWarning(start," an Shell is a null entity");
}
else {
IShell = BS.TransferShell (S, aRange);
IShell = BS.TransferShell(S);
if (!IShell.IsNull()) Seq->Append(IShell);
}
}
@@ -154,8 +145,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferSolid(const TopoDS_Soli
// TransferCompSolid
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompSolid(const TopoDS_CompSolid& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompSolid(const TopoDS_CompSolid& start)
{
Handle(IGESData_IGESEntity) res;
if ( start.IsNull()) return res;
@@ -164,19 +154,13 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompSolid(const TopoDS_
Handle(IGESData_IGESEntity) ISolid;
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
Standard_Integer nbshapes = 0;
for (Ex.Init(start, TopAbs_SOLID); Ex.More(); Ex.Next())
nbshapes++;
Message_ProgressScope aPS(theProgress, NULL, nbshapes);
for (Ex.Init(start,TopAbs_SOLID); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start,TopAbs_SOLID); Ex.More(); Ex.Next()) {
TopoDS_Solid S = TopoDS::Solid(Ex.Current());
if (S.IsNull()) {
AddWarning(start," an Solid is a null entity");
}
else {
ISolid = TransferSolid (S, aRange);
ISolid = TransferSolid(S);
if (!ISolid.IsNull()) Seq->Append(ISolid);
}
}
@@ -211,8 +195,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompSolid(const TopoDS_
// TransferCompound
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompound(const TopoDS_Compound& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompound(const TopoDS_Compound& start)
{
Handle(IGESData_IGESEntity) res;
if ( start.IsNull()) return res;
@@ -224,69 +207,46 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompound(const TopoDS_C
BRepToIGES_BRWire BW(*this);
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
// count numbers of subshapes
Standard_Integer nbshapes = 0;
for (Ex.Init(start, TopAbs_SOLID); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_FACE, TopAbs_SHELL); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next())
nbshapes++;
Message_ProgressScope aPS(theProgress, NULL, nbshapes);
// take all Solids
for (Ex.Init(start, TopAbs_SOLID); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start, TopAbs_SOLID); Ex.More(); Ex.Next()) {
TopoDS_Solid S = TopoDS::Solid(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Solid is a null entity");
}
else {
IShape = TransferSolid (S, aRange);
IShape = TransferSolid(S);
if (!IShape.IsNull()) Seq->Append(IShape);
}
}
// take all isolated Shells
for (Ex.Init(start, TopAbs_SHELL, TopAbs_SOLID); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next()) {
TopoDS_Shell S = TopoDS::Shell(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Shell is a null entity");
}
else {
IShape = BS.TransferShell (S, aRange);
IShape = BS.TransferShell(S);
if (!IShape.IsNull()) Seq->Append(IShape);
}
}
// take all isolated Faces
for (Ex.Init(start, TopAbs_FACE, TopAbs_SHELL); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start, TopAbs_FACE, TopAbs_SHELL); Ex.More(); Ex.Next()) {
TopoDS_Face S = TopoDS::Face(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Face is a null entity");
}
else {
IShape = BS.TransferFace (S, aRange);
IShape = BS.TransferFace(S);
if (!IShape.IsNull()) Seq->Append(IShape);
}
}
// take all isolated Wires
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More(); Ex.Next()) {
TopoDS_Wire S = TopoDS::Wire(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Wire is a null entity");
@@ -299,8 +259,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompound(const TopoDS_C
// take all isolated Edges
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More(); Ex.Next()) {
TopoDS_Edge S = TopoDS::Edge(Ex.Current());
if (S.IsNull()) {
AddWarning(start," an Edge is a null entity");
@@ -313,8 +272,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompound(const TopoDS_C
// take all isolated Vertices
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next()) {
TopoDS_Vertex S = TopoDS::Vertex(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Vertex is a null entity");
@@ -326,7 +284,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRSolid ::TransferCompound(const TopoDS_C
}
// construct the group
nbshapes = Seq->Length();
Standard_Integer nbshapes = Seq->Length();
Handle(IGESData_HArray1OfIGESEntity) Tab;
if (nbshapes >=1) {
Tab = new IGESData_HArray1OfIGESEntity(1,nbshapes);

View File

@@ -49,23 +49,19 @@ public:
//! Transfert a Shape entity from TopoDS to IGES
//! this entity must be a Solid or a CompSolid or a Compound.
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferSolid (const TopoDS_Shape& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferSolid (const TopoDS_Shape& start);
//! Transfert a Solid entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferSolid (const TopoDS_Solid& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferSolid (const TopoDS_Solid& start);
//! Transfert an CompSolid entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompSolid (const TopoDS_CompSolid& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompSolid (const TopoDS_CompSolid& start);
//! Transfert a Compound entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompound (const TopoDS_Compound& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompound (const TopoDS_Compound& start);

View File

@@ -79,7 +79,7 @@
#include <IGESSolid_VertexList.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressIndicator.hxx>
#include <ShapeAlgo.hxx>
#include <ShapeAlgo_AlgoContainer.hxx>
#include <TColgp_HArray1OfXYZ.hxx>
@@ -282,8 +282,7 @@ Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
//purpose :
//=======================================================================
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferShape
(const TopoDS_Shape& start,
const Message_ProgressRange& theProgress)
(const TopoDS_Shape& start)
{
Handle(IGESData_IGESEntity) res;
//TopoDS_Shape theShape;
@@ -322,19 +321,19 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferShape
}
else if (start.ShapeType() == TopAbs_SHELL) {
TopoDS_Shell S = TopoDS::Shell(start);
res = TransferShell(S, theProgress);
res = TransferShell(S);
}
else if (start.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid M = TopoDS::Solid(start);
res = TransferSolid(M, theProgress);
res = TransferSolid(M);
}
else if (start.ShapeType() == TopAbs_COMPSOLID) {
TopoDS_CompSolid C = TopoDS::CompSolid(start);
res = TransferCompSolid(C, theProgress);
res = TransferCompSolid(C);
}
else if (start.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Compound C = TopoDS::Compound(start);
res = TransferCompound(C, theProgress);
res = TransferCompound(C);
}
else {
// error message
@@ -513,6 +512,12 @@ Handle(IGESSolid_Loop) BRepToIGESBRep_Entity::TransferWire (const TopoDS_Wire& m
Handle(IGESSolid_Face) BRepToIGESBRep_Entity ::TransferFace(const TopoDS_Face& start)
{
Handle(Message_ProgressIndicator) progress = GetTransferProcess()->GetProgress();
if ( ! progress.IsNull() ) {
if ( progress->UserBreak() ) return 0;
progress->Increment();
}
Handle(IGESSolid_Face) myent = new IGESSolid_Face;
if ( start.IsNull()) return myent;
Handle(IGESData_IGESEntity) ISurf;
@@ -618,8 +623,7 @@ Handle(IGESSolid_Face) BRepToIGESBRep_Entity ::TransferFace(const TopoDS_Face& s
// TransferShell
//=============================================================================
Handle(IGESSolid_Shell) BRepToIGESBRep_Entity ::TransferShell(const TopoDS_Shell& start,
const Message_ProgressRange& theProgress)
Handle(IGESSolid_Shell) BRepToIGESBRep_Entity ::TransferShell(const TopoDS_Shell& start)
{
Handle(IGESSolid_Shell) myshell = new IGESSolid_Shell;
if ( start.IsNull()) return myshell;
@@ -629,11 +633,7 @@ Handle(IGESSolid_Shell) BRepToIGESBRep_Entity ::TransferShell(const TopoDS_Shell
TColStd_SequenceOfInteger SeqFlag;
Handle(IGESSolid_Face) IFace;
Standard_Integer nbf = 0;
for (Ex.Init(start, TopAbs_FACE); Ex.More(); Ex.Next())
nbf++;
Message_ProgressScope aPS(theProgress, NULL, nbf);
for (Ex.Init(start,TopAbs_FACE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next()) {
for (Ex.Init(start,TopAbs_FACE); Ex.More(); Ex.Next()) {
TopoDS_Face F = TopoDS::Face(Ex.Current());
if ( start.Orientation() == TopAbs_REVERSED ) F.Reverse(); //:l4 abv 12 Jan 99: CTS22022-2: writing reversed shells
if (F.IsNull()) {
@@ -673,8 +673,7 @@ Handle(IGESSolid_Shell) BRepToIGESBRep_Entity ::TransferShell(const TopoDS_Shell
// with a Solid
//=============================================================================
Handle(IGESSolid_ManifoldSolid) BRepToIGESBRep_Entity ::TransferSolid (const TopoDS_Solid& start,
const Message_ProgressRange& theProgress)
Handle(IGESSolid_ManifoldSolid) BRepToIGESBRep_Entity ::TransferSolid (const TopoDS_Solid& start)
{
Handle(IGESSolid_ManifoldSolid) mysol = new IGESSolid_ManifoldSolid;
if ( start.IsNull()) return mysol;
@@ -685,19 +684,13 @@ Handle(IGESSolid_ManifoldSolid) BRepToIGESBRep_Entity ::TransferSolid (const Top
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
TColStd_SequenceOfInteger SeqFlag;
Standard_Integer nbs = 0;
for (Ex.Init(start, TopAbs_SHELL); Ex.More(); Ex.Next())
nbs++;
Message_ProgressScope aPS(theProgress, NULL, nbs);
for (Ex.Init(start,TopAbs_SHELL); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start,TopAbs_SHELL); Ex.More(); Ex.Next()) {
TopoDS_Shell S = TopoDS::Shell(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Shell is a null entity");
}
else {
IShell = TransferShell (S, aRange);
IShell = TransferShell(S);
if (!IShell.IsNull()) {
Seq->Append(IShell);
if (S.Orientation() == TopAbs_FORWARD ) SeqFlag.Append(1);
@@ -750,8 +743,7 @@ Handle(IGESSolid_ManifoldSolid) BRepToIGESBRep_Entity ::TransferSolid (const Top
// with a CompSolid
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompSolid (const TopoDS_CompSolid& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompSolid (const TopoDS_CompSolid& start)
{
Handle(IGESData_IGESEntity) myent;
if ( start.IsNull()) return myent;
@@ -760,19 +752,13 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompSolid (const Topo
Handle(IGESSolid_ManifoldSolid) ISolid = new IGESSolid_ManifoldSolid;
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
Standard_Integer nbs = 0;
for (Ex.Init(start, TopAbs_SOLID); Ex.More(); Ex.Next())
nbs++;
Message_ProgressScope aPS(theProgress, NULL, nbs);
for (Ex.Init(start,TopAbs_SOLID); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start,TopAbs_SOLID); Ex.More(); Ex.Next()) {
TopoDS_Solid S = TopoDS::Solid(Ex.Current());
if (S.IsNull()) {
AddWarning(start," an Solid is a null entity");
}
else {
ISolid = TransferSolid (S, aRange);
ISolid = TransferSolid(S);
if (!ISolid.IsNull()) Seq->Append(ISolid);
}
}
@@ -808,8 +794,7 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompSolid (const Topo
// with a Compound
//=============================================================================
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoDS_Compound& start,
const Message_ProgressRange& theProgress)
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoDS_Compound& start)
{
Handle(IGESData_IGESEntity) res;
if ( start.IsNull()) return res;
@@ -819,54 +804,33 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
Handle(IGESData_IGESEntity) IShape;
Handle(TColStd_HSequenceOfTransient) Seq = new TColStd_HSequenceOfTransient();
// count numbers of subshapes
Standard_Integer nbshapes = 0;
for (Ex.Init(start, TopAbs_SOLID); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_FACE, TopAbs_SHELL); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More(); Ex.Next())
nbshapes++;
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next())
nbshapes++;
Message_ProgressScope aPS(theProgress, NULL, nbshapes);
// take all Solids
for (Ex.Init(start, TopAbs_SOLID); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start, TopAbs_SOLID); Ex.More(); Ex.Next()) {
TopoDS_Solid S = TopoDS::Solid(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Solid is a null entity");
}
else {
IShape = TransferSolid (S, aRange);
IShape = TransferSolid(S);
if (!IShape.IsNull()) Seq->Append(IShape);
}
}
// take all isolated Shells
for (Ex.Init(start, TopAbs_SHELL, TopAbs_SOLID); Ex.More() && aPS.More(); Ex.Next())
{
Message_ProgressRange aRange = aPS.Next();
for (Ex.Init(start, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next()) {
TopoDS_Shell S = TopoDS::Shell(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Shell is a null entity");
}
else {
IShape = TransferShell (S, aRange);
IShape = TransferShell(S);
if (!IShape.IsNull()) Seq->Append(IShape);
}
}
// take all isolated Faces
for (Ex.Init(start, TopAbs_FACE, TopAbs_SHELL); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_FACE, TopAbs_SHELL); Ex.More(); Ex.Next()) {
TopoDS_Face S = TopoDS::Face(Ex.Current());
if (S.IsNull()) {
AddWarning(start," a Face is a null entity");
@@ -879,8 +843,7 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
// take all isolated Wires
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More(); Ex.Next()) {
TopoDS_Wire S = TopoDS::Wire(Ex.Current());
BRepToIGES_BRWire BW(*this);
@@ -891,8 +854,7 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
// take all isolated Edges
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More(); Ex.Next()) {
TopoDS_Edge S = TopoDS::Edge(Ex.Current());
BRepToIGES_BRWire BW(*this);
@@ -903,8 +865,7 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
// take all isolated Vertices
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More() && aPS.More(); Ex.Next(), aPS.Next())
{
for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next()) {
TopoDS_Vertex S = TopoDS::Vertex(Ex.Current());
BRepToIGES_BRWire BW(*this);
@@ -914,7 +875,7 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
}
// construct the group
nbshapes = Seq->Length();
Standard_Integer nbshapes = Seq->Length();
if (nbshapes > 0) {
Handle(IGESData_HArray1OfIGESEntity) Tab =
new IGESData_HArray1OfIGESEntity(1,nbshapes);

View File

@@ -26,8 +26,6 @@
#include <BRepToIGES_BREntity.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Message_ProgressRange.hxx>
class IGESSolid_EdgeList;
class IGESSolid_VertexList;
class TopoDS_Vertex;
@@ -45,6 +43,7 @@ class TopoDS_Solid;
class TopoDS_CompSolid;
class TopoDS_Compound;
//! provides methods to transfer BRep entity from CASCADE to IGESBRep.
class BRepToIGESBRep_Entity : public BRepToIGES_BREntity
{
@@ -81,9 +80,7 @@ public:
//! Returns the result of the transfert of any Shape
//! If the transfer has failed, this member return a NullEntity.
Standard_EXPORT virtual Handle(IGESData_IGESEntity) TransferShape
(const TopoDS_Shape& start,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(IGESData_IGESEntity) TransferShape (const TopoDS_Shape& start) Standard_OVERRIDE;
//! Transfert an Edge entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
@@ -104,23 +101,19 @@ public:
//! Transfert an Shell entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESSolid_Shell) TransferShell (const TopoDS_Shell& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESSolid_Shell) TransferShell (const TopoDS_Shell& start);
//! Transfert a Solid entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESSolid_ManifoldSolid) TransferSolid (const TopoDS_Solid& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESSolid_ManifoldSolid) TransferSolid (const TopoDS_Solid& start);
//! Transfert an CompSolid entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompSolid (const TopoDS_CompSolid& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompSolid (const TopoDS_CompSolid& start);
//! Transfert a Compound entity from TopoDS to IGES
//! If this Entity could not be converted, this member returns a NullEntity.
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompound (const TopoDS_Compound& start,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCompound (const TopoDS_Compound& start);

View File

@@ -667,7 +667,7 @@ void BRepTools::Dump(const TopoDS_Shape& Sh, Standard_OStream& S)
//=======================================================================
void BRepTools::Write(const TopoDS_Shape& Sh, Standard_OStream& S,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& theProgress)
{
BRepTools_ShapeSet SS;
SS.Add(Sh);
@@ -684,7 +684,7 @@ void BRepTools::Write(const TopoDS_Shape& Sh, Standard_OStream& S,
void BRepTools::Read(TopoDS_Shape& Sh,
std::istream& S,
const BRep_Builder& B,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& theProgress)
{
BRepTools_ShapeSet SS(B);
SS.Read(S, theProgress);
@@ -698,7 +698,7 @@ void BRepTools::Read(TopoDS_Shape& Sh,
Standard_Boolean BRepTools::Write(const TopoDS_Shape& Sh,
const Standard_CString File,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& theProgress)
{
std::ofstream os;
OSD_OpenStream(os, File, std::ios::out);
@@ -735,7 +735,7 @@ Standard_Boolean BRepTools::Write(const TopoDS_Shape& Sh,
Standard_Boolean BRepTools::Read(TopoDS_Shape& Sh,
const Standard_CString File,
const BRep_Builder& B,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& theProgress)
{
std::filebuf fic;
std::istream in(&fic);

View File

@@ -27,7 +27,8 @@
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Standard_CString.hxx>
#include <Message_ProgressRange.hxx>
#include <Message_ProgressIndicator.hxx>
class TopoDS_Face;
class TopoDS_Wire;
@@ -206,22 +207,23 @@ public:
//! Writes <Sh> on <S> in an ASCII format.
Standard_EXPORT static void Write (const TopoDS_Shape& Sh, Standard_OStream& S,
const Message_ProgressRange& theProgress = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads a Shape from <S> in returns it in <Sh>.
//! <B> is used to build the shape.
Standard_EXPORT static void Read (TopoDS_Shape& Sh, Standard_IStream& S, const BRep_Builder& B,
const Message_ProgressRange& theProgress = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Writes <Sh> in <File>.
Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& Sh, const Standard_CString File,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT static Standard_Boolean Write
(const TopoDS_Shape& Sh, const Standard_CString File,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads a Shape from <File>, returns it in <Sh>.
//! <B> is used to build the shape.
Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& Sh, const Standard_CString File,
const BRep_Builder& B,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT static Standard_Boolean Read
(TopoDS_Shape& Sh, const Standard_CString File, const BRep_Builder& B,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Evals real tolerance of edge <theE>.
//! <theC3d>, <theC2d>, <theS>, <theF>, <theL> are
@@ -251,18 +253,8 @@ public:
Standard_EXPORT static void RemoveInternals (TopoDS_Shape& theS,
const Standard_Boolean theForce = Standard_False);
protected:
private:
friend class BRepTools_WireExplorer;
friend class BRepTools_Modification;
friend class BRepTools_Modifier;

View File

@@ -18,6 +18,7 @@
#include <BRepTools_Modification.hxx>
#include <BRepTools_Modifier.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_NullObject.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>
@@ -53,7 +54,7 @@
#include <Standard_NullObject.hxx>
#include <gp_Trsf.hxx>
#include <BRepTools_TrsfModification.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressSentry.hxx>
#include <Geom_Surface.hxx>
static void SetShapeFlags(const TopoDS_Shape& theInSh, TopoDS_Shape& theOutSh);
@@ -115,8 +116,7 @@ void BRepTools_Modifier::Init(const TopoDS_Shape& S)
static TopTools_IndexedMapOfShape MapE, MapF;
#endif
void BRepTools_Modifier::Perform(const Handle(BRepTools_Modification)& M,
const Message_ProgressRange& theProgress)
void BRepTools_Modifier::Perform(const Handle(BRepTools_Modification)& M, const Handle(Message_ProgressIndicator) & aProgress)
{
if (myShape.IsNull()) {
throw Standard_NullObject();
@@ -128,7 +128,7 @@ void BRepTools_Modifier::Perform(const Handle(BRepTools_Modification)& M,
#endif
TopTools_DataMapIteratorOfDataMapOfShapeShape theIter(myMap);
Message_ProgressScope aPS(theProgress, "Converting Shape", 2);
Message_ProgressSentry aPSentry(aProgress, "Converting Shape", 0, 2, 1);
TopTools_IndexedDataMapOfShapeListOfShape aMVE, aMEF;
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
@@ -144,14 +144,16 @@ void BRepTools_Modifier::Perform(const Handle(BRepTools_Modification)& M,
CreateOtherVertices(aMVE, aMEF, M);
Standard_Boolean aNewGeom;
Rebuild(myShape, M, aNewGeom, aPS.Next());
Rebuild(myShape, M, aNewGeom, aProgress);
if (!aPS.More())
if (!aPSentry.More())
{
// The processing was broken
return;
}
aPSentry.Next();
if (myShape.ShapeType() == TopAbs_FACE) {
if (myShape.Orientation() == TopAbs_REVERSED) {
myMap(myShape).Reverse();
@@ -240,7 +242,7 @@ Standard_Boolean BRepTools_Modifier::Rebuild
(const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M,
Standard_Boolean& theNewGeom,
const Message_ProgressRange& theProgress)
const Handle(Message_ProgressIndicator)& aProgress)
{
#ifdef DEBUG_Modifier
int iF = MapF.Contains(S) ? MapF.FindIndex(S) : 0;
@@ -355,16 +357,16 @@ Standard_Boolean BRepTools_Modifier::Rebuild
for (it.Initialize(S, Standard_False); it.More(); it.Next()) ++aShapeCount;
}
Message_ProgressScope aPS(theProgress, "Converting SubShapes", aShapeCount);
Message_ProgressSentry aPSentry(aProgress, "Converting SubShapes", 0, aShapeCount, 1);
//
for (it.Initialize(S, Standard_False); it.More() && aPS.More(); it.Next()) {
for (it.Initialize(S, Standard_False); it.More() && aPSentry.More(); it.Next(), aPSentry.Next()) {
// always call Rebuild
Standard_Boolean isSubNewGeom = Standard_False;
Standard_Boolean subrebuilt = Rebuild(it.Value(), M, isSubNewGeom, aPS.Next());
Standard_Boolean subrebuilt = Rebuild(it.Value(), M, isSubNewGeom, aProgress);
rebuild = subrebuilt || rebuild ;
theNewGeom = theNewGeom || isSubNewGeom;
}
if (!aPS.More())
if (!aPSentry.More())
{
// The processing was broken
return Standard_False;

View File

@@ -29,16 +29,17 @@
#include <TopoDS_Vertex.hxx>
#include <Standard_Boolean.hxx>
#include <Message_ProgressIndicator.hxx>
#include <NCollection_DataMap.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <TopLoc_Location.hxx>
#include <Message_ProgressRange.hxx>
class Standard_NullObject;
class Standard_NoSuchObject;
class TopoDS_Shape;
class BRepTools_Modification;
class Message_ProgressIndicator;
class Geom_Curve;
class Geom_Surface;
@@ -63,8 +64,7 @@ public:
Standard_EXPORT void Init (const TopoDS_Shape& S);
//! Performs the modifications described by <M>.
Standard_EXPORT void Perform (const Handle(BRepTools_Modification)& M,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Perform (const Handle(BRepTools_Modification)& M, const Handle(Message_ProgressIndicator)& aProgress = NULL);
//! Returns Standard_True if the modification has
//! been computed successfully.
@@ -109,7 +109,7 @@ private:
Standard_EXPORT Standard_Boolean Rebuild (const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M,
Standard_Boolean& theNewGeom,
const Message_ProgressRange& theProgress = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& aProgress = NULL);
Standard_EXPORT void CreateNewVertices(
const TopTools_IndexedDataMapOfShapeListOfShape& theMVE,

View File

@@ -39,7 +39,8 @@
#include <BRepTools.hxx>
#include <BRepTools_ShapeSet.hxx>
#include <GeomTools.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <Poly.hxx>
#include <Poly_Polygon2D.hxx>
#include <Poly_Polygon3D.hxx>
@@ -245,27 +246,32 @@ void BRepTools_ShapeSet::DumpGeometry (Standard_OStream& OS)const
//purpose :
//=======================================================================
void BRepTools_ShapeSet::WriteGeometry(Standard_OStream& OS, const Message_ProgressRange& theProgress)
void BRepTools_ShapeSet::WriteGeometry (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)
{
// Make nested progress scope for processing geometry
Message_ProgressScope aPS(theProgress, "Geometry", 100);
myCurves2d.Write(OS, aPS.Next(20));
if (aPS.UserBreak()) return;
myCurves.Write(OS, aPS.Next(20));
if (aPS.UserBreak()) return;
WritePolygon3D(OS, Standard_True, aPS.Next(10));
if (aPS.UserBreak()) return;
WritePolygonOnTriangulation(OS, Standard_True, aPS.Next(10));
if (aPS.UserBreak()) return;
mySurfaces.Write(OS, aPS.Next(20));
if (aPS.UserBreak()) return;
WriteTriangulation(OS, Standard_True, aPS.Next(20));
//OCC19559
Message_ProgressSentry aPS(theProgress, "Writing geometry", 0, 6, 1);
myCurves2d.Write (OS, theProgress);
if (!aPS.More())
return;
aPS.Next();
myCurves.Write (OS, theProgress);
if (!aPS.More())
return;
aPS.Next();
WritePolygon3D (OS, true, theProgress);
if (!aPS.More())
return;
aPS.Next();
WritePolygonOnTriangulation (OS, true, theProgress);
if (!aPS.More())
return;
aPS.Next();
mySurfaces.Write (OS, theProgress);
if (!aPS.More())
return;
aPS.Next();
WriteTriangulation (OS, true, theProgress);
}
@@ -274,27 +280,35 @@ void BRepTools_ShapeSet::WriteGeometry(Standard_OStream& OS, const Message_Prog
//purpose :
//=======================================================================
void BRepTools_ShapeSet::ReadGeometry(Standard_IStream& IS, const Message_ProgressRange& theProgress)
void BRepTools_ShapeSet::ReadGeometry (Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress)
{
// Make nested progress scope for processing geometry
Message_ProgressScope aPS(theProgress, "Geometry", 100);
myCurves2d.Read(IS, aPS.Next(20));
if (aPS.UserBreak()) return;
myCurves.Read(IS, aPS.Next(20));
if (aPS.UserBreak()) return;
ReadPolygon3D(IS, aPS.Next(15));
if (aPS.UserBreak()) return;
ReadPolygonOnTriangulation(IS, aPS.Next(15));
if (aPS.UserBreak()) return;
mySurfaces.Read(IS, aPS.Next(15));
if (aPS.UserBreak()) return;
ReadTriangulation(IS, aPS.Next(15));
//OCC19559
Message_ProgressSentry aPS(theProgress, "Reading geometry", 0, 6, 1);
myCurves2d.Read(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
myCurves.Read(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
ReadPolygon3D(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
ReadPolygonOnTriangulation(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
mySurfaces.Read(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
ReadTriangulation(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
}
//=======================================================================
@@ -1154,13 +1168,13 @@ void BRepTools_ShapeSet::Check(const TopAbs_ShapeEnum T,
//purpose :
//=======================================================================
void BRepTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS,
const Standard_Boolean Compact,
const Message_ProgressRange& theProgress)const
void BRepTools_ShapeSet::WritePolygonOnTriangulation (Standard_OStream& OS,
const Standard_Boolean Compact,
const Handle(Message_ProgressIndicator)& theProgress)const
{
Standard_Integer i, j, nbpOntri = myNodes.Extent();
Message_ProgressScope aPS(theProgress, "Polygons On Triangulation", nbpOntri);
Message_ProgressSentry PS(theProgress, "Polygons On Triangulation", 0, nbpOntri, 1);
if (Compact)
OS << "PolygonOnTriangulations " << nbpOntri << "\n";
else {
@@ -1171,7 +1185,7 @@ void BRepTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS,
Handle(Poly_PolygonOnTriangulation) Poly;
Handle(TColStd_HArray1OfReal) Param;
for (i=1; i<=nbpOntri && aPS.More(); i++, aPS.Next()) {
for (i=1; i<=nbpOntri && PS.More(); i++, PS.Next()) {
Poly = Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(i));
const TColStd_Array1OfInteger& Nodes = Poly->Nodes();
if (!Compact) {
@@ -1219,8 +1233,8 @@ void BRepTools_ShapeSet::DumpPolygonOnTriangulation(Standard_OStream& OS)const
//purpose :
//=======================================================================
void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS,
const Message_ProgressRange& theProgress)
void BRepTools_ShapeSet::ReadPolygonOnTriangulation (Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress)
{
char buffer[255];
IS >> buffer;
@@ -1232,8 +1246,8 @@ void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS,
Handle(Poly_PolygonOnTriangulation) Poly;
IS >> nbpol;
//OCC19559
Message_ProgressScope aPS(theProgress, "Polygons On Triangulation", nbpol);
for (i=1; i<=nbpol&& aPS.More(); i++, aPS.Next()) {
Message_ProgressSentry PS(theProgress, "Polygons On Triangulation", 0, nbpol, 1);
for (i=1; i<=nbpol&& PS.More(); i++, PS.Next()) {
IS >> nbnodes;
TColStd_Array1OfInteger Nodes(1, nbnodes);
for (j = 1; j <= nbnodes; j++) {
@@ -1273,13 +1287,13 @@ void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS,
//purpose :
//=======================================================================
void BRepTools_ShapeSet::WritePolygon3D(Standard_OStream& OS,
const Standard_Boolean Compact,
const Message_ProgressRange& theProgress)const
void BRepTools_ShapeSet::WritePolygon3D (Standard_OStream& OS,
const Standard_Boolean Compact,
const Handle(Message_ProgressIndicator) &theProgress)const
{
Standard_Integer i, j, nbpol = myPolygons3D.Extent();
Message_ProgressScope aPS(theProgress, "3D Polygons", nbpol);
Message_ProgressSentry PS(theProgress, "3D Polygons", 0, nbpol, 1);
if (Compact)
OS << "Polygon3D " << nbpol << "\n";
@@ -1290,7 +1304,7 @@ void BRepTools_ShapeSet::WritePolygon3D(Standard_OStream& OS,
}
Handle(Poly_Polygon3D) P;
for (i = 1; i <= nbpol && aPS.More(); i++, aPS.Next()) {
for (i = 1; i <= nbpol && PS.More(); i++, PS.Next()) {
P = Handle(Poly_Polygon3D)::DownCast(myPolygons3D(i));
if (Compact) {
OS << P->NbNodes() << " ";
@@ -1351,7 +1365,8 @@ void BRepTools_ShapeSet::DumpPolygon3D(Standard_OStream& OS)const
//purpose :
//=======================================================================
void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS, const Message_ProgressRange& theProgress)
void BRepTools_ShapeSet::ReadPolygon3D (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
// Standard_Integer i, j, p, val, nbpol, nbnodes, hasparameters;
@@ -1363,8 +1378,8 @@ void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS, const Message_Progr
Handle(Poly_Polygon3D) P;
IS >> nbpol;
//OCC19559
Message_ProgressScope aPS(theProgress, "3D Polygons", nbpol);
for (i=1; i<=nbpol && aPS.More(); i++, aPS.Next()) {
Message_ProgressSentry PS(theProgress, "3D Polygons", 0, nbpol, 1);
for (i=1; i<=nbpol && PS.More(); i++, PS.Next()) {
IS >> nbnodes;
IS >> hasparameters;
TColgp_Array1OfPnt Nodes(1, nbnodes);
@@ -1397,12 +1412,12 @@ void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS, const Message_Progr
void BRepTools_ShapeSet::WriteTriangulation(Standard_OStream& OS,
const Standard_Boolean Compact,
const Message_ProgressRange& theProgress)const
const Handle(Message_ProgressIndicator) &theProgress)const
{
Standard_Integer i, j, nbNodes, nbtri = myTriangulations.Extent();
Standard_Integer nbTriangles = 0, n1, n2, n3;
Message_ProgressScope aPS(theProgress, "Triangulations", nbtri);
Message_ProgressSentry PS(theProgress, "Triangulations", 0, nbtri, 1);
if (Compact)
OS << "Triangulations " << nbtri << "\n";
@@ -1413,7 +1428,7 @@ void BRepTools_ShapeSet::WriteTriangulation(Standard_OStream& OS,
}
Handle(Poly_Triangulation) T;
for (i = 1; i <= nbtri && aPS.More(); i++, aPS.Next()) {
for (i = 1; i <= nbtri && PS.More(); i++, PS.Next()) {
T = Handle(Poly_Triangulation)::DownCast(myTriangulations(i));
if (Compact) {
@@ -1499,7 +1514,8 @@ void BRepTools_ShapeSet::DumpTriangulation(Standard_OStream& OS)const
//purpose :
//=======================================================================
void BRepTools_ShapeSet::ReadTriangulation(Standard_IStream& IS, const Message_ProgressRange& theProgress)
void BRepTools_ShapeSet::ReadTriangulation (Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress)
{
char buffer[255];
// Standard_Integer i, j, val, nbtri;
@@ -1515,8 +1531,8 @@ void BRepTools_ShapeSet::ReadTriangulation(Standard_IStream& IS, const Message_P
IS >> nbtri;
//OCC19559
Message_ProgressScope aPS(theProgress, "Triangulations", nbtri);
for (i=1; i<=nbtri && aPS.More();i++, aPS.Next()) {
Message_ProgressSentry PS(theProgress, "Triangulations", 0, nbtri, 1);
for (i=1; i<=nbtri && PS.More();i++, PS.Next()) {
IS >> nbNodes >> nbTriangles >> hasUV;
GeomTools::GetReal(IS, d);

View File

@@ -67,23 +67,28 @@ public:
//! Writes the geometry of me on the stream <OS> in a
//! format that can be read back by Read.
Standard_EXPORT virtual void WriteGeometry (Standard_OStream& OS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual void WriteGeometry
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator) &theProgress = NULL) Standard_OVERRIDE;
//! Reads the geometry of me from the stream <IS>.
Standard_EXPORT virtual void ReadGeometry (Standard_IStream& IS,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual void ReadGeometry
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress = NULL) Standard_OVERRIDE;
//! Dumps the geometry of <S> on the stream <OS>.
Standard_EXPORT virtual void DumpGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
Standard_EXPORT virtual void DumpGeometry
(const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
//! Writes the geometry of <S> on the stream <OS> in a
//! format that can be read back by Read.
Standard_EXPORT virtual void WriteGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
Standard_EXPORT virtual void WriteGeometry
(const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
//! Reads the geometry of a shape of type <T> from the
//! stream <IS> and returns it in <S>.
Standard_EXPORT virtual void ReadGeometry (const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE;
Standard_EXPORT virtual void ReadGeometry
(const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE;
//! Inserts the shape <S2> in the shape <S1>. This
//! method must be redefined to use the correct
@@ -94,15 +99,17 @@ public:
//! Reads the 3d polygons of me
//! from the stream <IS>.
Standard_EXPORT void ReadPolygon3D (Standard_IStream& IS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void ReadPolygon3D
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Writes the 3d polygons
//! on the stream <OS> in a format that can
//! be read back by Read.
Standard_EXPORT void WritePolygon3D (Standard_OStream& OS,
const Standard_Boolean Compact = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()) const;
Standard_EXPORT void WritePolygon3D
(Standard_OStream& OS,
const Standard_Boolean Compact = Standard_True,
const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Dumps the 3d polygons
//! on the stream <OS>.
@@ -110,15 +117,17 @@ public:
//! Reads the triangulation of me
//! from the stream <IS>.
Standard_EXPORT void ReadTriangulation (Standard_IStream& IS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void ReadTriangulation
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Writes the triangulation
//! on the stream <OS> in a format that can
//! be read back by Read.
Standard_EXPORT void WriteTriangulation (Standard_OStream& OS,
const Standard_Boolean Compact = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()) const;
Standard_EXPORT void WriteTriangulation
(Standard_OStream& OS,
const Standard_Boolean Compact = Standard_True,
const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Dumps the triangulation
//! on the stream <OS>.
@@ -126,33 +135,24 @@ public:
//! Reads the polygons on triangulation of me
//! from the stream <IS>.
Standard_EXPORT void ReadPolygonOnTriangulation (Standard_IStream& IS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void ReadPolygonOnTriangulation
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Writes the polygons on triangulation
//! on the stream <OS> in a format that can
//! be read back by Read.
Standard_EXPORT void WritePolygonOnTriangulation (Standard_OStream& OS,
const Standard_Boolean Compact = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()) const;
Standard_EXPORT void WritePolygonOnTriangulation
(Standard_OStream& OS,
const Standard_Boolean Compact = Standard_True,
const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Dumps the polygons on triangulation
//! on the stream <OS>.
Standard_EXPORT void DumpPolygonOnTriangulation (Standard_OStream& OS) const;
protected:
private:
BRep_Builder myBuilder;
GeomTools_SurfaceSet mySurfaces;
GeomTools_CurveSet myCurves;

View File

@@ -189,65 +189,18 @@ public:
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinPoint[0])
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinPoint[0])
}
else if (n == 2)
if (n == 2)
{
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MinPoint", n, myMinPoint[0], myMinPoint[1])
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MaxPoint", n, myMaxPoint[0], myMaxPoint[1])
}
else if (n == 3)
if (n == 3)
{
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MinPoint", n, myMinPoint[0], myMinPoint[1], myMinPoint[2])
OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MaxPoint", n, myMaxPoint[0], myMaxPoint[1], myMaxPoint[2])
}
}
//! Inits the content of me from the stream
Standard_Boolean InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
{
Standard_Integer aPos = theStreamPos;
Standard_Integer anIsInited = 0;
TCollection_AsciiString aStreamStr = Standard_Dump::Text (theSStream);
OCCT_INIT_FIELD_VALUE_INTEGER (aStreamStr, aPos, anIsInited);
myIsInited = anIsInited != 0;
int n = Min (N, 3);
if (n == 1)
{
Standard_Real aValue;
OCCT_INIT_FIELD_VALUE_REAL (aStreamStr, aPos, aValue);
myMinPoint[0] = (T)aValue;
}
else if (n == 2)
{
Standard_Real aValue1, aValue2;
OCCT_INIT_VECTOR_CLASS (aStreamStr, "MinPoint", aPos, n, &aValue1, &aValue2);
myMinPoint[0] = (T)aValue1;
myMinPoint[1] = (T)aValue2;
OCCT_INIT_VECTOR_CLASS (aStreamStr, "MaxPoint", aPos, n, &aValue1, &aValue2);
myMaxPoint[0] = (T)aValue1;
myMaxPoint[1] = (T)aValue2;
}
else if (n == 3)
{
Standard_Real aValue1, aValue2, aValue3;
OCCT_INIT_VECTOR_CLASS (aStreamStr, "MinPoint", aPos, n, &aValue1, &aValue2, &aValue3);
myMinPoint[0] = (T)aValue1;
myMinPoint[1] = (T)aValue2;
myMinPoint[2] = (T)aValue3;
OCCT_INIT_VECTOR_CLASS (aStreamStr, "MaxPoint", aPos, n, &aValue1, &aValue2, &aValue3);
myMaxPoint[0] = (T)aValue1;
myMaxPoint[1] = (T)aValue2;
myMaxPoint[2] = (T)aValue3;
}
theStreamPos = aPos;
return Standard_True;
}
public:
//! Checks if the Box is out of the other box.

View File

@@ -66,18 +66,6 @@ public: //! @name Adding elements in BVH
BVH_Object<NumType, Dimension>::myIsDirty = Standard_True;
}
//! Allows to update the box of the element while the tree is not yet built
virtual void UpdateBox (const Standard_Integer theId, const BVH_Box<NumType, Dimension>& theNewBox)
{
if (BVH_Object<NumType, Dimension>::myIsDirty)
{
if (theId >= 0 && theId < Size())
{
myBoxes[theId] = theNewBox;
}
}
}
public: //! @name BVH construction
//! BVH construction

View File

@@ -84,7 +84,7 @@ public: //! @name Necessary overrides for BVH construction
//! Returns the bounding box with the given index.
virtual BVH_Box <NumType, Dimension> Box (const Standard_Integer theIndex) const Standard_OVERRIDE
{
return this->myBoxes[myIndices[theIndex]];
return myBoxes[myIndices[theIndex]];
}
//! Swaps indices of two specified boxes.
@@ -95,9 +95,9 @@ public: //! @name Necessary overrides for BVH construction
}
//! Returns the Element with the index theIndex.
virtual DataType Element (const Standard_Integer theIndex) const Standard_OVERRIDE
virtual DataType Element (const Standard_Integer theIndex) const
{
return this->myElements[myIndices[theIndex]];
return myElements[myIndices[theIndex]];
}
protected: //! @name Fields

View File

@@ -88,24 +88,6 @@ public: //! @name Point-Box Square distance
return aDist;
}
//! Computes Max square distance between point and bounding box
static T PointBoxMaxSquareDistance (const BVH_VecNt& thePoint,
const BVH_VecNt& theCMin,
const BVH_VecNt& theCMax)
{
T aDist = 0;
for (int i = 0; i < N; ++i)
{
T dmin = 0, dmax = 0;
if (thePoint[i] > theCMin[i]) { dmin = thePoint[i] - theCMin[i]; }
if (thePoint[i] < theCMax[i]) { dmax = theCMax[i] - thePoint[i]; }
T d = dmin > dmax ? dmin : dmax;
d *= d;
aDist += d;
}
return aDist;
}
public: //! @name Point-Box projection
//! Computes projection of point on bounding box
@@ -128,6 +110,7 @@ public: //! @name Point-Box projection
{
return thePoint.cwiseMax (theCMin).cwiseMin (theCMax);
}
public: //! @name Point-Triangle Square distance
//! Computes square distance between point and triangle

View File

@@ -59,7 +59,7 @@ void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
(BinLDrivers_DocumentSection& /*theSection*/,
Standard_IStream& theIS,
const Standard_Boolean /*isMess*/,
const Message_ProgressRange& theRange)
const Handle(Message_ProgressIndicator)& theProgress)
{
// Read Shapes
@@ -70,7 +70,7 @@ void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
OCC_CATCH_SIGNALS
Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
aNamedShapeDriver->ReadShapeSection (theIS, theRange);
aNamedShapeDriver->ReadShapeSection (theIS, theProgress);
}
catch(Standard_Failure const& anException) {
const TCollection_ExtendedString aMethStr

View File

@@ -49,7 +49,7 @@ public:
(BinLDrivers_DocumentSection& theSection,
Standard_IStream& theIS,
const Standard_Boolean isMess = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual void CheckShapeSection
(const Storage_Position& thePos, Standard_IStream& theIS) Standard_OVERRIDE;

View File

@@ -100,7 +100,7 @@ void BinDrivers_DocumentStorageDriver::SetWithTriangles (const Handle(Message_Me
void BinDrivers_DocumentStorageDriver::WriteShapeSection
(BinLDrivers_DocumentSection& theSection,
Standard_OStream& theOS,
const Message_ProgressRange& theRange)
const Handle(Message_ProgressIndicator)& theProgress)
{
const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
@@ -111,7 +111,7 @@ void BinDrivers_DocumentStorageDriver::WriteShapeSection
OCC_CATCH_SIGNALS
Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
aNamedShapeDriver->WriteShapeSection (theOS, theRange);
aNamedShapeDriver->WriteShapeSection (theOS, theProgress);
}
catch(Standard_Failure const& anException) {
TCollection_ExtendedString anErrorStr ("BinDrivers_DocumentStorageDriver, Shape Section :");

View File

@@ -46,7 +46,7 @@ public:
Standard_EXPORT virtual void WriteShapeSection
(BinLDrivers_DocumentSection& theDocSection,
Standard_OStream& theOS,
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
//! Return true if shape should be stored with triangles.
Standard_EXPORT Standard_Boolean IsWithTriangles() const;

View File

@@ -42,7 +42,7 @@
#include <TDF_Label.hxx>
#include <TDocStd_Document.hxx>
#include <TDocStd_Owner.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressSentry.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
@@ -80,7 +80,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read
(const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument,
const Handle(CDM_Application)& theApplication,
const Message_ProgressRange& theRange)
const Handle(Message_ProgressIndicator)& theProgress)
{
std::ifstream aFileStream;
OSD_OpenStream (aFileStream, theFileName, std::ios::in | std::ios::binary);
@@ -90,8 +90,8 @@ void BinLDrivers_DocumentRetrievalDriver::Read
Handle(Storage_Data) dData;
TCollection_ExtendedString aFormat = PCDM_ReadWriter::FileFormat (aFileStream, dData);
Read(aFileStream, dData, theNewDocument, theApplication, theRange);
if (!theRange.More())
Read(aFileStream, dData, theNewDocument, theApplication, theProgress);
if (theProgress->UserBreak())
{
myReaderStatus = PCDM_RS_UserBreak;
return;
@@ -117,7 +117,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
const Handle(Storage_Data)& theStorageData,
const Handle(CDM_Document)& theDoc,
const Handle(CDM_Application)& theApplication,
const Message_ProgressRange& theRange)
const Handle(Message_ProgressIndicator)& theProgress)
{
myReaderStatus = PCDM_RS_DriverFailure;
myMsgDriver = theApplication -> MessageDriver();
@@ -233,7 +233,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
Handle(TDF_Data) aData = new TDF_Data();
std::streampos aDocumentPos = -1;
Message_ProgressScope aPS(theRange, "Reading data", 3);
Message_ProgressSentry aPS(theProgress, "Reading data", 0, 3, 1);
// 2b. Read the TOC of Sections
if (aFileVer >= 3) {
@@ -259,12 +259,13 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
theIStream.seekg ((std::streampos) aCurSection.Offset());
if (aCurSection.Name().IsEqual ((Standard_CString)SHAPESECTION_POS))
{
ReadShapeSection (aCurSection, theIStream, false, aPS.Next());
ReadShapeSection (aCurSection, theIStream, false, theProgress);
if (!aPS.More())
{
myReaderStatus = PCDM_RS_UserBreak;
return;
}
aPS.Next();
}
else
ReadSection (aCurSection, theDoc, theIStream);
@@ -305,12 +306,13 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
CheckShapeSection(aShapeSectionPos, theIStream);
// Read Shapes
BinLDrivers_DocumentSection aCurSection;
ReadShapeSection (aCurSection, theIStream, Standard_False, aPS.Next());
ReadShapeSection (aCurSection, theIStream, Standard_False, theProgress);
if (!aPS.More())
{
myReaderStatus = PCDM_RS_UserBreak;
return;
}
aPS.Next();
}
}
} // end of reading Sections or shape section
@@ -323,13 +325,13 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
theIStream.read ((char*)&aTag, sizeof(Standard_Integer));
// read sub-tree of the root label
Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), aPS.Next());
Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), theProgress);
if (!aPS.More())
{
myReaderStatus = PCDM_RS_UserBreak;
return;
}
aPS.Next();
Clear();
if (!aPS.More())
{
@@ -367,13 +369,13 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
(Standard_IStream& theIS,
const TDF_Label& theLabel,
const Message_ProgressRange& theRange)
const Handle(Message_ProgressIndicator)& theProgress)
{
Standard_Integer nbRead = 0;
TCollection_ExtendedString aMethStr
("BinLDrivers_DocumentRetrievalDriver: ");
Message_ProgressScope aPS(theRange, "Reading sub tree", 2, true);
Message_ProgressSentry aPS(theProgress, "Reading sub tree", 0, 2, 1, true);
// Read attributes:
theIS >> myPAtt;
@@ -462,9 +464,9 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
return -1;
}
aPS.Next();
// read sub-tree
Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, aPS.Next());
Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, theProgress);
// check for error
if (nbSubRead == -1)
return -1;
@@ -520,7 +522,7 @@ void BinLDrivers_DocumentRetrievalDriver::ReadShapeSection
(BinLDrivers_DocumentSection& theSection,
Standard_IStream& /*theIS*/,
const Standard_Boolean isMess,
const Message_ProgressRange &/*theRange*/)
const Handle(Message_ProgressIndicator) &/*theProgress*/)
{
if(isMess && theSection.Length()) {

View File

@@ -62,13 +62,13 @@ public:
Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument,
const Handle(CDM_Application)& theApplication,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
const Handle(Storage_Data)& theStorageData,
const Handle(CDM_Document)& theDoc,
const Handle(CDM_Application)& theApplication,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
@@ -84,7 +84,7 @@ protected:
Standard_EXPORT virtual Standard_Integer ReadSubTree
(Standard_IStream& theIS,
const TDF_Label& theData,
const Message_ProgressRange& theRanges = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! define the procedure of reading a section to file.
@@ -98,7 +98,7 @@ protected:
(BinLDrivers_DocumentSection& theSection,
Standard_IStream& theIS,
const Standard_Boolean isMess = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! checks the shapes section can be correctly retreived.
Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS);

View File

@@ -42,7 +42,7 @@
#include <TDF_Label.hxx>
#include <TDF_Tool.hxx>
#include <TDocStd_Document.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressSentry.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentStorageDriver,PCDM_StorageDriver)
@@ -65,7 +65,7 @@ BinLDrivers_DocumentStorageDriver::BinLDrivers_DocumentStorageDriver ()
void BinLDrivers_DocumentStorageDriver::Write
(const Handle(CDM_Document)& theDocument,
const TCollection_ExtendedString& theFileName,
const Message_ProgressRange& theRange)
const Handle(Message_ProgressIndicator)& theProgress)
{
SetIsError(Standard_False);
SetStoreStatus(PCDM_SS_OK);
@@ -77,7 +77,7 @@ void BinLDrivers_DocumentStorageDriver::Write
if (aFileStream.is_open() && aFileStream.good())
{
Write(theDocument, aFileStream, theRange);
Write(theDocument, aFileStream, theProgress);
}
else
{
@@ -91,9 +91,9 @@ void BinLDrivers_DocumentStorageDriver::Write
//purpose :
//=======================================================================
void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDoc,
Standard_OStream& theOStream,
const Message_ProgressRange& theRange)
void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDoc,
Standard_OStream& theOStream,
const Handle(Message_ProgressIndicator)& theProgress)
{
myMsgDriver = theDoc->Application()->MessageDriver();
myMapUnsupported.Clear();
@@ -140,26 +140,26 @@ void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theD
myRelocTable.Clear();
myPAtt.Init();
Message_ProgressScope aPS(theRange, "Writing document", 3);
Message_ProgressSentry aPS(theProgress, "Writing document", 0, 3, 1);
// Write Doc structure
WriteSubTree (aData->Root(), theOStream, aPS.Next()); // Doc is written
WriteSubTree (aData->Root(), theOStream, theProgress); // Doc is written
if (!aPS.More())
{
SetIsError(Standard_True);
SetStoreStatus(PCDM_SS_UserBreak);
return;
}
aPS.Next();
// 4. Write Shapes section
WriteShapeSection (aShapesSection, theOStream, aPS.Next());
WriteShapeSection (aShapesSection, theOStream, theProgress);
if (!aPS.More())
{
SetIsError(Standard_True);
SetStoreStatus(PCDM_SS_UserBreak);
return;
}
aPS.Next();
// Write application-defined sections
for (anIterS.Init (mySections); anIterS.More(); anIterS.Next()) {
BinLDrivers_DocumentSection& aSection = anIterS.ChangeValue();
@@ -228,16 +228,16 @@ void BinLDrivers_DocumentStorageDriver::UnsupportedAttrMsg
//=======================================================================
void BinLDrivers_DocumentStorageDriver::WriteSubTree
(const TDF_Label& theLabel,
Standard_OStream& theOS,
const Message_ProgressRange& theRange)
(const TDF_Label& theLabel,
Standard_OStream& theOS,
const Handle(Message_ProgressIndicator)& theProgress)
{
// Skip empty labels
if (!myEmptyLabels.IsEmpty() && myEmptyLabels.First() == theLabel) {
myEmptyLabels.RemoveFirst();
return;
}
Message_ProgressScope aPS(theRange, "Writing sub tree", 2, true);
Message_ProgressSentry aPS(theProgress, "Writing sub tree", 0, 2, 1, 1);
// Write label header: tag
Standard_Integer aTag = theLabel.Tag();
#if DO_INVERSE
@@ -298,7 +298,8 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
SetStoreStatus(PCDM_SS_UserBreak);
return;
}
WriteSubTree (aChildLab, theOS, aPS.Next());
aPS.Next();
WriteSubTree (aChildLab, theOS, theProgress);
}
// Write the end label marker
@@ -546,7 +547,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSection
void BinLDrivers_DocumentStorageDriver::WriteShapeSection
(BinLDrivers_DocumentSection& theSection,
Standard_OStream& theOS,
const Message_ProgressRange& /*theRange*/)
const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
theSection.Write (theOS, aShapesSectionOffset);

View File

@@ -54,12 +54,12 @@ public:
//! Write <theDocument> to the binary file <theFileName>
Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
const TCollection_ExtendedString& theFileName,
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
//! Write <theDocument> to theOStream
Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
Standard_OStream& theOStream,
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
@@ -77,7 +77,7 @@ protected:
//! Write the tree under <theLabel> to the stream <theOS>
Standard_EXPORT void WriteSubTree (const TDF_Label& theData,
Standard_OStream& theOS,
const Message_ProgressRange& theRange = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! define the procedure of writing a section to file.
Standard_EXPORT virtual void WriteSection (const TCollection_AsciiString& theName,
@@ -87,7 +87,7 @@ protected:
//! defines the procedure of writing a shape section to file
Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection,
Standard_OStream& theOS,
const Message_ProgressRange& theRange = Message_ProgressRange());
const Handle(Message_ProgressIndicator)& theProgress = NULL);
Handle(BinMDF_ADriverTable) myDrivers;
BinObjMgt_SRelocationTable myRelocTable;

View File

@@ -15,6 +15,12 @@
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDF_ADriver,Standard_Transient)
@@ -28,15 +34,4 @@ BinMDF_ADriver::BinMDF_ADriver (const Handle(Message_Messenger)& theMsgDriver,
{
if (theName)
myTypeName = theName;
}
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
const Handle(Standard_Type)& BinMDF_ADriver::SourceType () const
{
return NewEmpty() -> DynamicType();
}
}

View File

@@ -48,7 +48,7 @@ public:
//! Returns the type of source object,
//! inheriting from Attribute from TDF.
Standard_EXPORT virtual const Handle(Standard_Type)& SourceType() const;
const Handle(Standard_Type)& SourceType() const;
//! Returns the type name of the attribute object
const TCollection_AsciiString& TypeName() const;
@@ -63,8 +63,6 @@ public:
//! <aRelocTable> to keep the sharings.
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& aSource, BinObjMgt_Persistent& aTarget, BinObjMgt_SRelocationTable& aRelocTable) const = 0;
//! Returns the current message driver of this driver
const Handle(Message_Messenger)& MessageDriver() const { return myMessageDriver; }
DEFINE_STANDARD_RTTIEXT(BinMDF_ADriver,Standard_Transient)

View File

@@ -15,6 +15,16 @@
#include <TDF_Attribute.hxx>
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
inline const Handle(Standard_Type)& BinMDF_ADriver::SourceType () const
{
return NewEmpty() -> DynamicType();
}
//=======================================================================
//function : TypeName
//purpose :

View File

@@ -17,12 +17,10 @@
#include <BinMDF_ADriver.hxx>
#include <BinMDF_ADriverTable.hxx>
#include <BinMDF_DataMapIteratorOfTypeADriverMap.hxx>
#include <BinMDF_DerivedDriver.hxx>
#include <BinMDF_StringIdMap.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Type.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TDF_DerivedAttribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDF_ADriverTable,Standard_Transient)
@@ -46,42 +44,6 @@ void BinMDF_ADriverTable::AddDriver
myMap.Bind (aType, theDriver);
}
//=======================================================================
//function : AddDerivedDriver
//purpose :
//=======================================================================
void BinMDF_ADriverTable::AddDerivedDriver (const Handle(TDF_Attribute)& theInstance)
{
const Handle(Standard_Type)& anInstanceType = theInstance->DynamicType();
if (!myMap.IsBound (anInstanceType)) // no direct driver, use a derived one
{
for (Handle(Standard_Type) aType = anInstanceType->Parent(); !aType.IsNull(); aType = aType->Parent())
{
if (myMap.IsBound (aType))
{
Handle(BinMDF_DerivedDriver) aDriver = new BinMDF_DerivedDriver (theInstance, myMap (aType));
myMap.Bind (anInstanceType, aDriver);
return;
}
}
}
}
//=======================================================================
//function : AddDerivedDriver
//purpose :
//=======================================================================
const Handle(Standard_Type)& BinMDF_ADriverTable::AddDerivedDriver (Standard_CString theDerivedType)
{
if (Handle(TDF_Attribute) anInstance = TDF_DerivedAttribute::Attribute (theDerivedType))
{
AddDerivedDriver (anInstance);
return anInstance->DynamicType();
}
static const Handle(Standard_Type) aNullType;
return aNullType;
}
//=======================================================================
//function : AssignIds
//purpose : Assigns the IDs to the drivers of the given Types.
@@ -135,16 +97,4 @@ void BinMDF_ADriverTable::AssignIds
myMapId.Bind (aType, i);
}
}
// try to add derived drivers for attributes not found in myMap
for (BinMDF_StringIdMap::Iterator aStrId (aStringIdMap); aStrId.More(); aStrId.Next())
{
if (!myMapId.IsBound2 (aStrId.Value()))
{
if (Handle(Standard_Type) anAdded = AddDerivedDriver (aStrId.Key().ToCString()))
{
myMapId.Bind (anAdded, aStrId.Value());
}
}
}
}

View File

@@ -48,15 +48,7 @@ public:
//! Adds a translation driver <theDriver>.
Standard_EXPORT void AddDriver (const Handle(BinMDF_ADriver)& theDriver);
//! Adds a translation driver for the derived attribute. The base driver must be already added.
//! @param theInstance is newly created attribute, detached from any label
Standard_EXPORT void AddDerivedDriver (const Handle(TDF_Attribute)& theInstance);
//! Adds a translation driver for the derived attribute. The base driver must be already added.
//! @param theDerivedType is registered attribute type using IMPLEMENT_DERIVED_ATTRIBUTE macro
Standard_EXPORT const Handle(Standard_Type)& AddDerivedDriver (Standard_CString theDerivedType);
//! Assigns the IDs to the drivers of the given Types.
//! It uses indices in the map as IDs.
//! Useful in storage procedure.
@@ -69,11 +61,11 @@ public:
//! Gets a driver <theDriver> according to <theType>.
//! Returns Type ID if the driver was assigned an ID; 0 otherwise.
Standard_Integer GetDriver (const Handle(Standard_Type)& theType, Handle(BinMDF_ADriver)& theDriver);
Standard_Integer GetDriver (const Handle(Standard_Type)& theType, Handle(BinMDF_ADriver)& theDriver) const;
//! Returns a driver according to <theTypeId>.
//! Returns null handle if a driver is not found
Handle(BinMDF_ADriver) GetDriver (const Standard_Integer theTypeId);
Handle(BinMDF_ADriver) GetDriver (const Standard_Integer theTypeId) const;

View File

@@ -33,13 +33,8 @@ inline void BinMDF_ADriverTable::AssignId
inline Standard_Integer BinMDF_ADriverTable::GetDriver
(const Handle(Standard_Type)& theType,
Handle(BinMDF_ADriver)& theDriver)
Handle(BinMDF_ADriver)& theDriver) const
{
if (!myMap.IsBound (theType)) // try to assign driver for derived type
{
AddDerivedDriver (theType->Name());
}
Standard_Integer anId = 0;
if (myMap.IsBound(theType)) {
theDriver = myMap (theType);
@@ -56,7 +51,7 @@ inline Standard_Integer BinMDF_ADriverTable::GetDriver
//=======================================================================
inline Handle(BinMDF_ADriver) BinMDF_ADriverTable::GetDriver
(const Standard_Integer theTypeId)
(const Standard_Integer theTypeId) const
{
Handle(BinMDF_ADriver) aDriver;
if (myMapId.IsBound2(theTypeId)) {

View File

@@ -1,59 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDF_DerivedDriver_HeaderFile
#define _BinMDF_DerivedDriver_HeaderFile
#include <BinMDF_ADriver.hxx>
//! A universal driver for the attribute that inherits another attribute with
//! ready to used persistence mechanism implemented (already has a driver to store/retrieve).
class BinMDF_DerivedDriver : public BinMDF_ADriver
{
DEFINE_STANDARD_RTTIEXT(BinMDF_DerivedDriver, BinMDF_ADriver)
public:
//! Creates a derivative persistence driver for theDerivative attribute by reusage of theBaseDriver
//! @param theDerivative an instance of the attribute, just created, detached from any label
//! @param theBaseDriver a driver of the base attribute, called by Paste methods
BinMDF_DerivedDriver (const Handle(TDF_Attribute)& theDerivative,
const Handle(BinMDF_ADriver)& theBaseDriver)
: BinMDF_ADriver(theBaseDriver->MessageDriver()), myDerivative(theDerivative), myBaseDirver(theBaseDriver) {}
//! Creates a new instance of the derivative attribute
virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE { return myDerivative->NewEmpty(); }
//! Reuses the base driver to read the base fields
virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE
{
Standard_Boolean aResult = myBaseDirver->Paste (theSource, theTarget, theRelocTable);
theTarget->AfterRetrieval(); // to allow synchronization of the derived attribute with the base content
return aResult;
}
//! Reuses the base driver to store the base fields
virtual void Paste (const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE
{
myBaseDirver->Paste(theSource, theTarget, theRelocTable);
}
protected:
Handle(TDF_Attribute) myDerivative; //!< the derivative attribute that inherits the base
Handle(BinMDF_ADriver) myBaseDirver; //!< the base attribute driver to be reused here
};
#endif

View File

@@ -15,5 +15,3 @@ BinMDF_TagSourceDriver.cxx
BinMDF_TagSourceDriver.hxx
BinMDF_TypeADriverMap.hxx
BinMDF_TypeIdMap.hxx
BinMDF_DerivedDriver.cxx
BinMDF_DerivedDriver.hxx

View File

@@ -19,6 +19,8 @@
#include <BinMDataStd_BooleanArrayDriver.hxx>
#include <BinMDataStd_BooleanListDriver.hxx>
#include <BinMDataStd_ByteArrayDriver.hxx>
#include <BinMDataStd_CommentDriver.hxx>
#include <BinMDataStd_DirectoryDriver.hxx>
#include <BinMDataStd_ExpressionDriver.hxx>
#include <BinMDataStd_ExtStringArrayDriver.hxx>
#include <BinMDataStd_ExtStringListDriver.hxx>
@@ -27,13 +29,15 @@
#include <BinMDataStd_IntegerListDriver.hxx>
#include <BinMDataStd_IntPackedMapDriver.hxx>
#include <BinMDataStd_NamedDataDriver.hxx>
#include <BinMDataStd_GenericExtStringDriver.hxx>
#include <BinMDataStd_NameDriver.hxx>
#include <BinMDataStd_NoteBookDriver.hxx>
#include <BinMDataStd_RealArrayDriver.hxx>
#include <BinMDataStd_RealDriver.hxx>
#include <BinMDataStd_RealListDriver.hxx>
#include <BinMDataStd_ReferenceArrayDriver.hxx>
#include <BinMDataStd_ReferenceListDriver.hxx>
#include <BinMDataStd_GenericEmptyDriver.hxx>
#include <BinMDataStd_RelationDriver.hxx>
#include <BinMDataStd_TickDriver.hxx>
#include <BinMDataStd_TreeNodeDriver.hxx>
#include <BinMDataStd_UAttributeDriver.hxx>
#include <BinMDataStd_VariableDriver.hxx>
@@ -48,26 +52,31 @@
void BinMDataStd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
const Handle(Message_Messenger)& theMsgDriver)
{
theDriverTable->AddDriver (new BinMDataStd_ExpressionDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_GenericExtStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_TreeNodeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_UAttributeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_VariableDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_GenericEmptyDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ByteArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NamedDataDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_CommentDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExpressionDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerArrayDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NameDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RelationDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_TreeNodeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_UAttributeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_VariableDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_DirectoryDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NoteBookDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringArrayDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_TickDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntegerListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_RealListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ExtStringListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceListDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_BooleanArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ReferenceArrayDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_ByteArrayDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_NamedDataDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver (theMsgDriver) );
}

View File

@@ -68,17 +68,21 @@ private:
friend class BinMDataStd_GenericExtStringDriver;
friend class BinMDataStd_NameDriver;
friend class BinMDataStd_IntegerDriver;
friend class BinMDataStd_RealDriver;
friend class BinMDataStd_IntegerArrayDriver;
friend class BinMDataStd_RealArrayDriver;
friend class BinMDataStd_UAttributeDriver;
friend class BinMDataStd_DirectoryDriver;
friend class BinMDataStd_CommentDriver;
friend class BinMDataStd_VariableDriver;
friend class BinMDataStd_ExpressionDriver;
friend class BinMDataStd_RelationDriver;
friend class BinMDataStd_NoteBookDriver;
friend class BinMDataStd_TreeNodeDriver;
friend class BinMDataStd_ExtStringArrayDriver;
friend class BinMDataStd_GenericEmptyDriver;
friend class BinMDataStd_TickDriver;
friend class BinMDataStd_AsciiStringDriver;
friend class BinMDataStd_IntPackedMapDriver;
friend class BinMDataStd_IntegerListDriver;

View File

@@ -0,0 +1,71 @@
// Created on: 2001-08-24
// Created by: Alexnder GRIGORIEV
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_CommentDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Comment.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_CommentDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_CommentDriver
//purpose : Constructor
//=======================================================================
BinMDataStd_CommentDriver::BinMDataStd_CommentDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, NULL)
{}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_CommentDriver::NewEmpty() const
{
return (new TDataStd_Comment());
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
Standard_Boolean BinMDataStd_CommentDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& ) const
{
TCollection_ExtendedString aString;
Standard_Boolean ok = theSource >> aString;
if (ok)
Handle(TDataStd_Comment)::DownCast(theTarget) -> Set (aString);
return ok;
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
void BinMDataStd_CommentDriver::Paste (const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
TCollection_ExtendedString aName =
Handle(TDataStd_Comment)::DownCast(theSource) -> Get();
theTarget << aName;
}

View File

@@ -0,0 +1,72 @@
// Created on: 2001-08-24
// Created by: Alexander GRIGORIEV
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_CommentDriver_HeaderFile
#define _BinMDataStd_CommentDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_CommentDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_CommentDriver, BinMDF_ADriver)
//! Attribute Driver.
class BinMDataStd_CommentDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_CommentDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_CommentDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_CommentDriver_HeaderFile

View File

@@ -0,0 +1,71 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_DirectoryDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Directory.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_DirectoryDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_DirectoryDriver
//purpose :
//=======================================================================
BinMDataStd_DirectoryDriver::BinMDataStd_DirectoryDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Directory)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_DirectoryDriver::NewEmpty() const
{
return new TDataStd_Directory();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_DirectoryDriver::Paste
(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{return Standard_True;}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_DirectoryDriver::Paste (const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{}

View File

@@ -0,0 +1,72 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY <szy@opencascade.com>
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_DirectoryDriver_HeaderFile
#define _BinMDataStd_DirectoryDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_DirectoryDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_DirectoryDriver, BinMDF_ADriver)
//! Directory attribute Driver.
class BinMDataStd_DirectoryDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_DirectoryDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_DirectoryDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_DirectoryDriver_HeaderFile

View File

@@ -65,6 +65,7 @@ Standard_Boolean BinMDataStd_IntegerDriver::Paste
ok = theSource >> aGuid;
if (!ok) {
theSource.SetPosition(aPos);
anAtt->SetID(TDataStd_Integer::GetID());
ok = Standard_True;
} else {
anAtt->SetID(aGuid);

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2020 OPEN CASCADE SAS
// Created on: 2002-11-19
// Created by: Edward AGAPOV (eap)
// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -12,7 +14,7 @@
// commercial license or contractual agreement.
#include <BinMDataStd_GenericExtStringDriver.hxx>
#include <BinMDataStd_NameDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
@@ -20,15 +22,15 @@
#include <TDF_Attribute.hxx>
#include <BinMDataStd.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_GenericExtStringDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_NameDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_GenericExtStringDriver
//function : BinMDataStd_NameDriver
//purpose :
//=======================================================================
BinMDataStd_GenericExtStringDriver::BinMDataStd_GenericExtStringDriver
BinMDataStd_NameDriver::BinMDataStd_NameDriver
(const Handle(Message_Messenger)& theMessageDriver)
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_GenericExtString)->Name())
: BinMDF_ADriver (theMessageDriver, STANDARD_TYPE(TDataStd_Name)->Name())
{
}
@@ -37,47 +39,39 @@ BinMDataStd_GenericExtStringDriver::BinMDataStd_GenericExtStringDriver
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_GenericExtStringDriver::NewEmpty() const
Handle(TDF_Attribute) BinMDataStd_NameDriver::NewEmpty() const
{
return new TDataStd_Name;
}
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
Handle(Standard_Type)& BinMDataStd_GenericExtStringDriver::SourceType() const
{
static Handle(Standard_Type) aSourceType = Standard_Type::Instance<TDataStd_GenericExtString>();
return aSourceType;
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_GenericExtStringDriver::Paste
Standard_Boolean BinMDataStd_NameDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
BinObjMgt_RRelocationTable& RelocTable) const
{
Handle(TDataStd_GenericExtString) aStrAttr = Handle(TDataStd_GenericExtString)::DownCast(Target);
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Target);
TCollection_ExtendedString aStr;
Standard_Boolean ok = Source >> aStr;
if (ok)
aStrAttr->Set( aStr );
aName->Set( aStr );
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;
if (!ok) {
Source.SetPosition(aPos);
aName->SetID(TDataStd_Name::GetID());
ok = Standard_True;
} else {
aStrAttr->SetID(aGuid);
aName->SetID(aGuid);
}
}
} else
aName->SetID(TDataStd_Name::GetID());
return ok;
}
@@ -86,13 +80,14 @@ Standard_Boolean BinMDataStd_GenericExtStringDriver::Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_GenericExtStringDriver::Paste
void BinMDataStd_NameDriver::Paste
(const Handle(TDF_Attribute)& Source,
BinObjMgt_Persistent& Target,
BinObjMgt_SRelocationTable& /*RelocTable*/) const
{
Handle(TDataStd_GenericExtString) aStrAttr = Handle(TDataStd_GenericExtString)::DownCast(Source);
Target << aStrAttr->Get();
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Source);
Target << aName->Get();
// process user defined guid
Target << aStrAttr->ID();
if(aName->ID() != TDataStd_Name::GetID())
Target << aName->ID();
}

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2020 OPEN CASCADE SAS
// Created on: 2002-11-19
// Created by: Edward AGAPOV
// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -11,8 +13,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_GenericExtStringDriver_HeaderFile
#define _BinMDataStd_GenericExtStringDriver_HeaderFile
#ifndef _BinMDataStd_NameDriver_HeaderFile
#define _BinMDataStd_NameDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
@@ -26,22 +28,20 @@ class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_GenericExtStringDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_GenericExtStringDriver, BinMDF_ADriver)
class BinMDataStd_NameDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_NameDriver, BinMDF_ADriver)
//! TDataStd_Name attribute Driver.
class BinMDataStd_GenericExtStringDriver : public BinMDF_ADriver
class BinMDataStd_NameDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_GenericExtStringDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT BinMDataStd_NameDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Handle(Standard_Type)& SourceType() const Standard_OVERRIDE;
//! persistent -> transient (retrieve)
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
@@ -51,7 +51,7 @@ public:
DEFINE_STANDARD_RTTIEXT(BinMDataStd_GenericExtStringDriver,BinMDF_ADriver)
DEFINE_STANDARD_RTTIEXT(BinMDataStd_NameDriver,BinMDF_ADriver)
protected:
@@ -71,4 +71,4 @@ private:
#endif // _BinMDataStd_GenericExtStringDriver_HeaderFile
#endif // _BinMDataStd_NameDriver_HeaderFile

View File

@@ -0,0 +1,70 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_NoteBookDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_NoteBook.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_NoteBookDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_NoteBookDriver
//purpose :
//=======================================================================
BinMDataStd_NoteBookDriver::BinMDataStd_NoteBookDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_NoteBook)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_NoteBookDriver::NewEmpty() const
{
return new TDataStd_NoteBook();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_NoteBookDriver::Paste
(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{return Standard_True;}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_NoteBookDriver::Paste (const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{}

View File

@@ -0,0 +1,72 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY <szy@opencascade.com>
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_NoteBookDriver_HeaderFile
#define _BinMDataStd_NoteBookDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_NoteBookDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_NoteBookDriver, BinMDF_ADriver)
//! NoteBook attribute Driver.
class BinMDataStd_NoteBookDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_NoteBookDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_NoteBookDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_NoteBookDriver_HeaderFile

View File

@@ -0,0 +1,122 @@
// Created on: 2001-09-12
// Created by: Julia DOROVSKIKH
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataStd_RelationDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_Relation.hxx>
#include <TDataStd_Variable.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_ListIteratorOfAttributeList.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_RelationDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_RelationDriver
//purpose : Constructor
//=======================================================================
BinMDataStd_RelationDriver::BinMDataStd_RelationDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, NULL)
{}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_RelationDriver::NewEmpty() const
{
return (new TDataStd_Relation());
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_RelationDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
BinObjMgt_RRelocationTable& theRelocTable) const
{
Handle(TDataStd_Relation) aC =
Handle(TDataStd_Relation)::DownCast(theTarget);
// variables
Standard_Integer nbvar;
if (! (theSource >> nbvar) || nbvar < 0)
return Standard_False;
TDF_AttributeList& aList = aC->GetVariables();
for (; nbvar > 0; nbvar--)
{
Handle(TDF_Attribute) aV;
Standard_Integer aNb;
if (! (theSource >> aNb))
return Standard_False;
if (aNb > 0)
{
if (theRelocTable.IsBound(aNb))
aV = Handle(TDataStd_Variable)::DownCast(theRelocTable.Find(aNb));
else
{
aV = new TDataStd_Variable;
theRelocTable.Bind(aNb, aV);
}
}
aList.Append(aV);
}
// expression
TCollection_ExtendedString aString;
if (! (theSource >> aString))
return Standard_False;
aC->SetRelation(aString);
return Standard_True;
}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_RelationDriver::Paste
(const Handle(TDF_Attribute)& theSource,
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& theRelocTable) const
{
Handle(TDataStd_Relation) aC =
Handle(TDataStd_Relation)::DownCast(theSource);
// variables
const TDF_AttributeList& aList = aC->GetVariables();
Standard_Integer nbvar = aList.Extent();
theTarget << nbvar;
TDF_ListIteratorOfAttributeList it;
for (it.Initialize(aList); it.More(); it.Next())
{
const Handle(TDF_Attribute)& TV = it.Value();
Standard_Integer aNb;
if (!TV.IsNull())
aNb = theRelocTable.Add(TV);
else
aNb = -1;
theTarget << aNb;
}
// expression
TCollection_ExtendedString aName = aC->Name();
theTarget << aName;
}

View File

@@ -0,0 +1,72 @@
// Created on: 2001-09-12
// Created by: Julia DOROVSKIKH
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_RelationDriver_HeaderFile
#define _BinMDataStd_RelationDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class Message_Messenger;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_RelationDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_RelationDriver, BinMDF_ADriver)
//! Attribute Driver.
class BinMDataStd_RelationDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_RelationDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinMDataStd_RelationDriver,BinMDF_ADriver)
protected:
private:
};
#endif // _BinMDataStd_RelationDriver_HeaderFile

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2020 OPEN CASCADE SAS
// Created on: 2007-05-29
// Created by: Vlad Romashko
// Copyright (c) 2007-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -12,49 +14,41 @@
// commercial license or contractual agreement.
#include <BinMDataStd_GenericEmptyDriver.hxx>
#include <BinMDataStd_TickDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataStd_GenericEmpty.hxx>
#include <TDataStd_Tick.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_GenericEmptyDriver,BinMDF_ADriver)
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_TickDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataStd_GenericEmptyDriver
//function : BinMDataStd_TickDriver
//purpose :
//=======================================================================
BinMDataStd_GenericEmptyDriver::BinMDataStd_GenericEmptyDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_GenericEmpty)->Name())
{}
BinMDataStd_TickDriver::BinMDataStd_TickDriver(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataStd_Tick)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_GenericEmptyDriver::NewEmpty() const
Handle(TDF_Attribute) BinMDataStd_TickDriver::NewEmpty() const
{
return Handle(TDF_Attribute)(); // this attribute can not be created
}
//=======================================================================
//function : SourceType
//purpose :
//=======================================================================
const Handle(Standard_Type)& BinMDataStd_GenericEmptyDriver::SourceType() const
{
return Standard_Type::Instance<TDataStd_GenericEmpty>();
return new TDataStd_Tick();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataStd_GenericEmptyDriver::Paste(const BinObjMgt_Persistent&,
Standard_Boolean BinMDataStd_TickDriver::Paste(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{
@@ -65,7 +59,7 @@ Standard_Boolean BinMDataStd_GenericEmptyDriver::Paste(const BinObjMgt_Persisten
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataStd_GenericEmptyDriver::Paste(const Handle(TDF_Attribute)&,
void BinMDataStd_TickDriver::Paste(const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2020 OPEN CASCADE SAS
// Created on: 2007-05-29
// Created by: Vlad Romashko
// Copyright (c) 2007-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -11,8 +13,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BinMDataStd_GenericEmptyDriver_HeaderFile
#define _BinMDataStd_GenericEmptyDriver_HeaderFile
#ifndef _BinMDataStd_TickDriver_HeaderFile
#define _BinMDataStd_TickDriver_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
@@ -26,21 +28,19 @@ class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMDataStd_GenericEmptyDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_GenericEmptyDriver, BinMDF_ADriver)
class BinMDataStd_TickDriver;
DEFINE_STANDARD_HANDLE(BinMDataStd_TickDriver, BinMDF_ADriver)
//! GenericEmpty attribute driver.
class BinMDataStd_GenericEmptyDriver : public BinMDF_ADriver
//! Tick attribute driver.
class BinMDataStd_TickDriver : public BinMDF_ADriver
{
public:
Standard_EXPORT BinMDataStd_GenericEmptyDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT BinMDataStd_TickDriver(const Handle(Message_Messenger)& theMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
Standard_EXPORT virtual const Handle(Standard_Type)& SourceType() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
@@ -49,7 +49,7 @@ public:
DEFINE_STANDARD_RTTIEXT(BinMDataStd_GenericEmptyDriver,BinMDF_ADriver)
DEFINE_STANDARD_RTTIEXT(BinMDataStd_TickDriver,BinMDF_ADriver)
protected:
@@ -69,4 +69,4 @@ private:
#endif // _BinMDataStd_GenericEmptyDriver_HeaderFile
#endif // _BinMDataStd_TickDriver_HeaderFile

View File

@@ -8,6 +8,10 @@ BinMDataStd_BooleanListDriver.cxx
BinMDataStd_BooleanListDriver.hxx
BinMDataStd_ByteArrayDriver.cxx
BinMDataStd_ByteArrayDriver.hxx
BinMDataStd_CommentDriver.cxx
BinMDataStd_CommentDriver.hxx
BinMDataStd_DirectoryDriver.cxx
BinMDataStd_DirectoryDriver.hxx
BinMDataStd_ExpressionDriver.cxx
BinMDataStd_ExpressionDriver.hxx
BinMDataStd_ExtStringArrayDriver.cxx
@@ -24,8 +28,10 @@ BinMDataStd_IntPackedMapDriver.cxx
BinMDataStd_IntPackedMapDriver.hxx
BinMDataStd_NamedDataDriver.cxx
BinMDataStd_NamedDataDriver.hxx
BinMDataStd_GenericExtStringDriver.cxx
BinMDataStd_GenericExtStringDriver.hxx
BinMDataStd_NameDriver.cxx
BinMDataStd_NameDriver.hxx
BinMDataStd_NoteBookDriver.cxx
BinMDataStd_NoteBookDriver.hxx
BinMDataStd_RealArrayDriver.cxx
BinMDataStd_RealArrayDriver.hxx
BinMDataStd_RealDriver.cxx
@@ -36,8 +42,10 @@ BinMDataStd_ReferenceArrayDriver.cxx
BinMDataStd_ReferenceArrayDriver.hxx
BinMDataStd_ReferenceListDriver.cxx
BinMDataStd_ReferenceListDriver.hxx
BinMDataStd_GenericEmptyDriver.cxx
BinMDataStd_GenericEmptyDriver.hxx
BinMDataStd_RelationDriver.cxx
BinMDataStd_RelationDriver.hxx
BinMDataStd_TickDriver.cxx
BinMDataStd_TickDriver.hxx
BinMDataStd_TreeNodeDriver.cxx
BinMDataStd_TreeNodeDriver.hxx
BinMDataStd_UAttributeDriver.cxx

View File

@@ -16,9 +16,14 @@
// modified 13.04.2009 Sergey Zaritchny
#include <BinMDataXtd.hxx>
#include <BinMDataXtd_AxisDriver.hxx>
#include <BinMDataXtd_ConstraintDriver.hxx>
#include <BinMDataXtd_GeometryDriver.hxx>
#include <BinMDataXtd_PatternStdDriver.hxx>
#include <BinMDataXtd_PlacementDriver.hxx>
#include <BinMDataXtd_PlaneDriver.hxx>
#include <BinMDataXtd_PointDriver.hxx>
#include <BinMDataXtd_ShapeDriver.hxx>
#include <BinMDF_ADriverTable.hxx>
#include <Message_Messenger.hxx>
#include <BinMDataXtd_PresentationDriver.hxx>
@@ -37,6 +42,11 @@ void BinMDataXtd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
theDriverTable->AddDriver (new BinMDataXtd_ConstraintDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_GeometryDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_PatternStdDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_ShapeDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_PointDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_AxisDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_PlaneDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_PlacementDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_TriangulationDriver(theMsgDriver) );
theDriverTable->AddDriver (new BinMDataXtd_PresentationDriver (theMsgDriver) );

View File

@@ -23,9 +23,14 @@
#include <Standard_Integer.hxx>
class BinMDF_ADriverTable;
class Message_Messenger;
class BinMDataXtd_PointDriver;
class BinMDataXtd_AxisDriver;
class BinMDataXtd_PlaneDriver;
class BinMDataXtd_GeometryDriver;
class BinMDataXtd_ConstraintDriver;
class BinMDataXtd_PlacementDriver;
class BinMDataXtd_PatternStdDriver;
class BinMDataXtd_ShapeDriver;
class BinMDataXtd_TriangulationDriver;
//! Storage and Retrieval drivers for modelling attributes.
@@ -57,9 +62,14 @@ private:
friend class BinMDataXtd_PointDriver;
friend class BinMDataXtd_AxisDriver;
friend class BinMDataXtd_PlaneDriver;
friend class BinMDataXtd_GeometryDriver;
friend class BinMDataXtd_ConstraintDriver;
friend class BinMDataXtd_PlacementDriver;
friend class BinMDataXtd_PatternStdDriver;
friend class BinMDataXtd_ShapeDriver;
friend class BinMDataXtd_TriangulationDriver;
};

View File

@@ -0,0 +1,69 @@
// Created on: 2004-05-13
// Created by: Sergey ZARITCHNY
// Copyright (c) 2004-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinMDataXtd_AxisDriver.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Type.hxx>
#include <TDataXtd_Axis.hxx>
#include <TDF_Attribute.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataXtd_AxisDriver,BinMDF_ADriver)
//=======================================================================
//function : BinMDataXtd_AxisDriver
//purpose :
//=======================================================================
BinMDataXtd_AxisDriver::BinMDataXtd_AxisDriver
(const Handle(Message_Messenger)& theMsgDriver)
: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Axis)->Name())
{
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
Handle(TDF_Attribute) BinMDataXtd_AxisDriver::NewEmpty() const
{
return new TDataXtd_Axis();
}
//=======================================================================
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
Standard_Boolean BinMDataXtd_AxisDriver::Paste
(const BinObjMgt_Persistent&,
const Handle(TDF_Attribute)&,
BinObjMgt_RRelocationTable& ) const
{return Standard_True;}
//=======================================================================
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
void BinMDataXtd_AxisDriver::Paste (const Handle(TDF_Attribute)&,
BinObjMgt_Persistent&,
BinObjMgt_SRelocationTable& ) const
{}

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