mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0024837: Visualization - revise design and implementation of connected Interactive Objects
0023422: Selection problems when using SetLocation. 0024756: AIS_ConnectedInteractive does not support nested AIS_ConnectedInteractive 0025103: Visualization - Regression in interactive detection Each PrsMgr_PresentableObject has list of PrsMgr _PresentableObject called myChildren. Transformation PrsMgr_PresentableObject applied to its children every time when its own transformation affected. This hierarchy does not propagate to Graphic3d level and below. PrsMgr_PresentableObject send its combined (according to hierarchy) transform down to Graphic3d_Structure. AIS_ConnectedInteractive and AIS_MultiplyConnectedInteractive are reused but behavior has been changed. AIS_ConnectedInteractive now is an instance of object. It reuses geometry of connected object but have own transformation, material, visibility flag etc. This connection propagated down to OpenGl level to OpenGl_Structure. For this task old “connected” mechanism has been reused. AIS_MultiplyConnectedInteractive represents assembly which doesn’t have its own presentation. Assemblies are able to participate is scene hierarchy and intended to handle a grouped set of instanced objects. It behaves as single object in terms of selection. It applies high level transform to all sub-elements since it located above in the hierarchy. All AIS_MultiplyConnectedInteractive are able to have child assemblies. Deep copy of object instances performed when one assembly attached to another. Correction test cases for CR24837 Test cases for issue CR23422 Test cases for issue CR24756 Test cases for issue CR25103 Viewer3d sample fixed.
This commit is contained in:
@@ -360,9 +360,6 @@ is
|
||||
|
||||
---Category: Object of type Shape
|
||||
class Shape; --signature 0
|
||||
class ConnectedShape; --signature 1
|
||||
class MultipleConnectedShape; --signature 2
|
||||
|
||||
|
||||
|
||||
---Category: General Objects
|
||||
|
@@ -16,38 +16,30 @@
|
||||
|
||||
class ConnectedInteractive from AIS inherits InteractiveObject from AIS
|
||||
|
||||
---Purpose: Defines an Interactive Object through a connection to
|
||||
-- another Interactive Object, which serves as a
|
||||
-- reference, and which is located elsewhere in the viewer.
|
||||
---Purpose: Creates an arbitrary located instance of another Interactive Object,
|
||||
-- which serves as a reference.
|
||||
-- This allows you to use the Connected Interactive
|
||||
-- Object without having to recalculate presentation,
|
||||
-- selection or graphic structure. These are deduced
|
||||
-- from your reference object.
|
||||
-- The relation between the connected interactive object
|
||||
-- and its source is generally one of geometric transformation.
|
||||
-- AIS_ConnectedInteractive class doesn't support selection
|
||||
-- modes different from 0. Descendants should redefine ComputeSelection()
|
||||
-- method in order to handle other selection modes and generate connected
|
||||
-- sensitive entities properly. Refer to AIS_ConnectedShape class
|
||||
-- for exisiting implementation of a connected interactive object
|
||||
-- for AIS_Shape that supports all standard sub-shape selection modes.
|
||||
-- Warning
|
||||
-- An Interactive entity which is view (or projector)
|
||||
-- dependent requires recalculation of views in hidden
|
||||
-- parts mode depending on the position of the
|
||||
-- projector in each view. You should derive the entity's
|
||||
-- inheritance from ConnectedInteractive and redefine
|
||||
-- its compute method to enable this type of calculation.
|
||||
-- AIS_ConnectedInteractive class supports selection mode 0 for any InteractiveObject and
|
||||
-- all standard modes if its reference based on AIS_Shape.
|
||||
-- Descendants may redefine ComputeSelection() though.
|
||||
-- Also ConnectedInteractive will handle HLR if its reference based on AIS_Shape.
|
||||
|
||||
uses
|
||||
Location from TopLoc,
|
||||
Shape from TopoDS,
|
||||
Transformation from Geom,
|
||||
PresentationManager3d from PrsMgr,
|
||||
Presentation from Prs3d,
|
||||
TypeOfPresentation3d from PrsMgr,
|
||||
Selection from SelectMgr,
|
||||
Projector from Prs3d,
|
||||
KindOfInteractive from AIS
|
||||
KindOfInteractive from AIS,
|
||||
Trsf from gp
|
||||
raises
|
||||
NotImplemented from Standard
|
||||
|
||||
@@ -73,16 +65,15 @@ is
|
||||
Connect(me : mutable;
|
||||
anotherIObj : InteractiveObject from AIS) is virtual;
|
||||
---Purpose: Establishes the connection between the Connected
|
||||
-- Interactive Object, anotherIobj, and its reference
|
||||
-- entity. If a previous connection with an Interactive
|
||||
-- Object already exists, it is removed by Disconnect.
|
||||
-- The second syntax also initiates the location of the
|
||||
-- Connected Interactive Object.
|
||||
-- Interactive Object, anotherIobj, and its reference.
|
||||
|
||||
|
||||
Connect(me:mutable;
|
||||
anotherIobj: InteractiveObject from AIS;
|
||||
aLocation : Location from TopLoc) is virtual;
|
||||
---Purpose:
|
||||
aLocation : Trsf from gp) is virtual;
|
||||
---Purpose: Establishes the connection between the Connected
|
||||
-- Interactive Object, anotherIobj, and its reference.
|
||||
-- Locates instance in aLocation.
|
||||
|
||||
|
||||
HasConnection(me) returns Boolean from Standard;
|
||||
@@ -123,7 +114,7 @@ is
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : Presentation from Prs3d)
|
||||
is redefined;
|
||||
is redefined virtual private;
|
||||
---Purpose: Computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
-- To be Used when the associated degenerated Presentations
|
||||
@@ -136,34 +127,46 @@ is
|
||||
Compute(me:mutable;
|
||||
aProjector: Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d)
|
||||
is redefined;
|
||||
is redefined virtual private;
|
||||
---Purpose: Computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
|
||||
ComputeSelection(me:mutable; aSelection : Selection from SelectMgr;
|
||||
aMode : Integer) is redefined virtual private;
|
||||
ComputeSelection(me:mutable; theSelection : Selection from SelectMgr;
|
||||
theMode : Integer) is redefined virtual private;
|
||||
---Level: Public
|
||||
---Purpose: Generates sensitive entities by copying
|
||||
-- them from myReference selection, creates and sets an entity
|
||||
-- owner for this entities and adds them to aSelection
|
||||
-- owner for this entities and adds them to theSelection
|
||||
|
||||
computeSubShapeSelection (me:mutable; theSelection : Selection from SelectMgr;
|
||||
theMode : Integer) is private;
|
||||
---Level: Public
|
||||
---Purpose: Generates sensitive entities by copying
|
||||
-- them from myReference sub shapes selection, creates and sets an entity
|
||||
-- owner for this entities and adds them to theSelection
|
||||
|
||||
AcceptShapeDecomposition(me) returns Boolean from Standard is
|
||||
redefined virtual;
|
||||
---C++: inline
|
||||
---C++: inline
|
||||
---Purpose: Informs the graphic context that the interactive Object
|
||||
-- may be decomposed into sub-shapes for dynamic selection.
|
||||
|
||||
|
||||
UpdateLocation(me:mutable) is redefined virtual;
|
||||
|
||||
UpdateLocation(me:mutable;aSel:Selection from SelectMgr) is redefined virtual;
|
||||
---Purpose: For this class, the location effect is treated in the
|
||||
-- compute & computeSelection methods. So the
|
||||
-- UpdateLocation Methods are redefined to do nothing else
|
||||
|
||||
-- UpdateLocation(me:mutable;P : Presentation from Prs3d) is redefined virtual;
|
||||
updateShape(me:mutable;WithLocation:Boolean from Standard = Standard_True)
|
||||
is static private;
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d;
|
||||
aShape : Shape from TopoDS)
|
||||
is private;
|
||||
---Purpose: Computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
|
||||
fields
|
||||
|
||||
myReference : InteractiveObject from AIS is protected;
|
||||
---Purpose: To have the time to Disconnect below, the old is kept for a while.
|
||||
myOldReference : InteractiveObject from AIS is protected;
|
||||
myReference : InteractiveObject from AIS is protected; -- reference object
|
||||
myShape : Shape from TopoDS; -- used for HLR
|
||||
|
||||
end ConnectedInteractive;
|
||||
|
||||
|
@@ -23,7 +23,25 @@
|
||||
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_Presentation.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
|
||||
#include <StdSelect.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_OrientedShapeMapHasher.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <StdPrs_WFDeflectionShape.hxx>
|
||||
#include <StdPrs_HLRPolyShape.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -32,7 +50,7 @@
|
||||
//=======================================================================
|
||||
AIS_ConnectedInteractive::AIS_ConnectedInteractive(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
|
||||
AIS_InteractiveObject(aTypeOfPresentation3d)
|
||||
{
|
||||
{
|
||||
SetHilightMode(0);
|
||||
}
|
||||
|
||||
@@ -41,44 +59,52 @@ AIS_InteractiveObject(aTypeOfPresentation3d)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_KindOfInteractive AIS_ConnectedInteractive::Type() const
|
||||
{return AIS_KOI_Object;}
|
||||
{
|
||||
return AIS_KOI_Object;
|
||||
}
|
||||
|
||||
Standard_Integer AIS_ConnectedInteractive::Signature() const
|
||||
{return 0; }
|
||||
|
||||
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::
|
||||
Connect(const Handle(AIS_InteractiveObject)& anotherIObj)
|
||||
void AIS_ConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj)
|
||||
{
|
||||
// To have the time to Disconnect below,
|
||||
// the old is kept for a while.
|
||||
if(myReference==anotherIObj) return;
|
||||
myOldReference = myReference;
|
||||
//Disconnect();
|
||||
myReference = anotherIObj ;
|
||||
if (myReference == theAnotherObj) return;
|
||||
|
||||
Handle(AIS_ConnectedInteractive) aConnected = Handle(AIS_ConnectedInteractive)::DownCast (theAnotherObj);
|
||||
if (!aConnected.IsNull())
|
||||
{
|
||||
myReference = aConnected->myReference;
|
||||
}
|
||||
else if (theAnotherObj->HasOwnPresentations())
|
||||
{
|
||||
myReference = theAnotherObj;
|
||||
}
|
||||
|
||||
if (!myReference.IsNull())
|
||||
{
|
||||
myTypeOfPresentation3d = myReference->TypeOfPresentation3d();
|
||||
}
|
||||
|
||||
theAnotherObj->AddChild (this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::
|
||||
Connect(const Handle(AIS_InteractiveObject)& anotherIobj,
|
||||
const TopLoc_Location& aLocation)
|
||||
void AIS_ConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
|
||||
const gp_Trsf& theLocation)
|
||||
{
|
||||
if(myLocation!=aLocation)
|
||||
myLocation = aLocation;
|
||||
if(myReference!=anotherIobj) {
|
||||
myOldReference = myReference; // necessary to disconnect below..
|
||||
// Disconnect();
|
||||
myReference = anotherIobj;}
|
||||
|
||||
Connect (theAnotherObj);
|
||||
|
||||
SetLocalTransformation (theLocation);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,11 +132,6 @@ void AIS_ConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (!(HasLocation() || HasConnection()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasConnection())
|
||||
{
|
||||
thePrs->Clear (Standard_False);
|
||||
@@ -127,77 +148,246 @@ void AIS_ConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3
|
||||
}
|
||||
}
|
||||
|
||||
if (HasLocation())
|
||||
if (!thePrs.IsNull())
|
||||
{
|
||||
Handle(Geom_Transformation) aPrsTrans = new Geom_Transformation (myLocation.Transformation());
|
||||
thePrsMgr->Transform (this, aPrsTrans, theMode);
|
||||
thePrs->ReCompute();
|
||||
}
|
||||
thePrs->ReCompute();
|
||||
}
|
||||
|
||||
void AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTransformation,
|
||||
const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
|
||||
updateShape (Standard_False);
|
||||
if (myShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
const TopLoc_Location& aLocation = myShape.Location();
|
||||
TopoDS_Shape aShape = myShape.Located (TopLoc_Location (theTransformation->Trsf()) * aLocation);
|
||||
Compute (theProjector, thePresentation, aShape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::Compute(const Handle(Prs3d_Projector)&, const Handle(Prs3d_Presentation)&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
|
||||
updateShape (Standard_True);
|
||||
Compute (aProjector, aPresentation, myShape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
if (myShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theShape.ShapeType())
|
||||
{
|
||||
case TopAbs_VERTEX:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_WIRE:
|
||||
{
|
||||
thePresentation->SetDisplayPriority (4);
|
||||
StdPrs_WFDeflectionShape::Add (thePresentation, theShape, myDrawer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Handle(Prs3d_Drawer) aDefaultDrawer = GetContext()->DefaultDrawer();
|
||||
if (aDefaultDrawer->DrawHiddenLine())
|
||||
{
|
||||
myDrawer->EnableDrawHiddenLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
myDrawer->DisableDrawHiddenLine();
|
||||
}
|
||||
|
||||
Aspect_TypeOfDeflection aPrevDeflection = aDefaultDrawer->TypeOfDeflection();
|
||||
aDefaultDrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
||||
|
||||
// process HLRAngle and HLRDeviationCoefficient()
|
||||
Standard_Real aPrevAngle = myDrawer->HLRAngle();
|
||||
Standard_Real aNewAngle = aDefaultDrawer->HLRAngle();
|
||||
if (Abs (aNewAngle - aPrevAngle) > Precision::Angular())
|
||||
{
|
||||
BRepTools::Clean (theShape);
|
||||
}
|
||||
|
||||
myDrawer->SetHLRAngle (aNewAngle);
|
||||
myDrawer->SetHLRDeviationCoefficient (aDefaultDrawer->HLRDeviationCoefficient());
|
||||
StdPrs_HLRPolyShape::Add (thePresentation, theShape, myDrawer, theProjector);
|
||||
aDefaultDrawer->SetTypeOfDeflection (aPrevDeflection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : updateShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::updateShape (const Standard_Boolean isWithLocation)
|
||||
{
|
||||
Handle(AIS_Shape) anAisShape = Handle(AIS_Shape)::DownCast (myReference);
|
||||
if (anAisShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = anAisShape->Shape();
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isWithLocation)
|
||||
{
|
||||
myShape = aShape;
|
||||
}
|
||||
else
|
||||
{
|
||||
myShape = aShape.Moved (TopLoc_Location (Transformation()));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_ConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& aSel,
|
||||
const Standard_Integer aMode)
|
||||
void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if(!(HasLocation() ||HasConnection())) return;
|
||||
|
||||
aSel->Clear();
|
||||
if(!myReference->HasSelection(aMode))
|
||||
myReference->UpdateSelection(aMode);
|
||||
|
||||
const Handle(SelectMgr_Selection)& TheRefSel = myReference->Selection(aMode);
|
||||
Handle(SelectMgr_EntityOwner) OWN = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveEntity) SE3D, SNew;
|
||||
|
||||
if(TheRefSel->IsEmpty())
|
||||
myReference->UpdateSelection(aMode);
|
||||
for(TheRefSel->Init();TheRefSel->More();TheRefSel->Next())
|
||||
if (!HasConnection())
|
||||
{
|
||||
SE3D = Handle(Select3D_SensitiveEntity)::DownCast(TheRefSel->Sensitive());
|
||||
if(!SE3D.IsNull())
|
||||
return;
|
||||
}
|
||||
|
||||
if (theMode != 0 && myReference->AcceptShapeDecomposition())
|
||||
{
|
||||
computeSubShapeSelection (theSelection, theMode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myReference->HasSelection (theMode))
|
||||
{
|
||||
myReference->UpdateSelection (theMode);
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_Selection)& TheRefSel = myReference->Selection (theMode);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
|
||||
Handle(Select3D_SensitiveEntity) aSensitive, aNewSensitive;
|
||||
|
||||
if (TheRefSel->IsEmpty())
|
||||
{
|
||||
myReference->UpdateSelection (theMode);
|
||||
}
|
||||
|
||||
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
|
||||
{
|
||||
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive());
|
||||
if (!aSensitive.IsNull())
|
||||
{
|
||||
TopLoc_Location aLocation (Transformation());
|
||||
// Get the copy of SE3D
|
||||
SNew = SE3D->GetConnected(myLocation);
|
||||
if(aMode==0)
|
||||
{
|
||||
SNew->Set(OWN);
|
||||
// In case if SE3D caches some location-dependent data
|
||||
// that must be updated after setting OWN
|
||||
SNew->SetLocation(myLocation);
|
||||
}
|
||||
aSel->Add(SNew);
|
||||
aNewSensitive = aSensitive->GetConnected (aLocation);
|
||||
|
||||
aNewSensitive->Set(anOwner);
|
||||
// In case if SE3D caches some location-dependent data
|
||||
// that must be updated after setting OWN
|
||||
aNewSensitive->SetLocation (aLocation);
|
||||
|
||||
theSelection->Add (aNewSensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AIS_ConnectedInteractive::UpdateLocation()
|
||||
//=======================================================================
|
||||
//function : ComputeSubShapeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::UpdateLocation()");
|
||||
SelectMgr_SelectableObject::UpdateLocation() ;
|
||||
typedef NCollection_List<Handle(Select3D_SensitiveEntity)> SensitiveList;
|
||||
typedef NCollection_DataMap<TopoDS_Shape, SensitiveList, TopTools_OrientedShapeMapHasher>
|
||||
Shapes2EntitiesMap;
|
||||
|
||||
if (!myReference->HasSelection (theMode))
|
||||
myReference->UpdateSelection (theMode);
|
||||
|
||||
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode);
|
||||
|
||||
if (aRefSel->IsEmpty() || aRefSel->UpdateStatus() == SelectMgr_TOU_Full)
|
||||
{
|
||||
myReference->UpdateSelection (theMode);
|
||||
}
|
||||
|
||||
Handle(StdSelect_BRepOwner) anOwner;
|
||||
TopLoc_Location aDummyLoc;
|
||||
|
||||
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
|
||||
Shapes2EntitiesMap aShapes2EntitiesMap;
|
||||
|
||||
SensitiveList aSEList;
|
||||
TopoDS_Shape aSubShape;
|
||||
|
||||
// Fill in the map of subshapes and corresponding
|
||||
// sensitive entities associated with aMode
|
||||
for (aRefSel->Init(); aRefSel->More(); aRefSel->Next())
|
||||
{
|
||||
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive());
|
||||
if(!aSE.IsNull())
|
||||
{
|
||||
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId());
|
||||
if(!anOwner.IsNull())
|
||||
{
|
||||
aSubShape = anOwner->Shape();
|
||||
if(!aShapes2EntitiesMap.IsBound (aSubShape))
|
||||
{
|
||||
aShapes2EntitiesMap.Bind (aSubShape, aSEList);
|
||||
}
|
||||
aShapes2EntitiesMap (aSubShape).Append (aSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in selection from aShapes2EntitiesMap
|
||||
for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next())
|
||||
{
|
||||
aSEList = aMapIt.Value();
|
||||
anOwner = new StdSelect_BRepOwner (aMapIt.Key(),
|
||||
this,
|
||||
aSEList.First()->OwnerId()->Priority(),
|
||||
Standard_True);
|
||||
|
||||
for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next())
|
||||
{
|
||||
aSE = aListIt.Value();
|
||||
|
||||
TopLoc_Location aLocation (Transformation());
|
||||
aNewSE = aSE->GetConnected (aDummyLoc);
|
||||
aNewSE->Set (anOwner);
|
||||
// In case if aSE caches some location-dependent data
|
||||
// that must be updated after setting anOwner
|
||||
aNewSE->SetLocation (aLocation);
|
||||
|
||||
theSelection->Add (aNewSE);
|
||||
}
|
||||
}
|
||||
|
||||
StdSelect::SetDrawerForBRepOwner (theSelection, myDrawer);
|
||||
}
|
||||
void AIS_ConnectedInteractive::UpdateLocation(const Handle(SelectMgr_Selection)& Sel)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::UpdateLocation(const Handle(SelectMgr_Selection)& Sel)");
|
||||
SelectMgr_SelectableObject::UpdateLocation(Sel) ;
|
||||
}
|
||||
/*void AIS_ConnectedInteractive::UpdateLocation(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::UpdateLocation(const Handle(Prs3d_Presentation)&)");
|
||||
SelectMgr_SelectableObject::UpdateLocation(aPresentation) ;
|
||||
}*/
|
||||
|
@@ -1,139 +0,0 @@
|
||||
-- Created on: 1997-01-08
|
||||
-- Created by: Robert COUBLANC
|
||||
-- Copyright (c) 1997-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-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.
|
||||
|
||||
--Modified by rob on Jul-28-97
|
||||
|
||||
|
||||
class ConnectedShape from AIS inherits ConnectedInteractive from AIS
|
||||
|
||||
---Purpose: Constructs a Connected Interactive Object with an
|
||||
-- AIS_Shape presentation as its reference Interactive Object.
|
||||
-- In topological decomposition of the shape, this class
|
||||
-- assigns the same owners to the sensitive primitives
|
||||
-- as those in AIS_Shape. Like AIS_Shape, it allows a
|
||||
-- presentation of hidden parts. These are calculated
|
||||
-- automatically from the shape of its reference entity.
|
||||
|
||||
|
||||
|
||||
uses
|
||||
|
||||
Shape from TopoDS,
|
||||
Projector from Prs3d,
|
||||
Presentation from Prs3d,
|
||||
Selection from SelectMgr,
|
||||
Integer from Standard,
|
||||
Shape from AIS,
|
||||
TypeOfPresentation3d from PrsMgr,
|
||||
PresentationManager3d from PrsMgr,
|
||||
InteractiveObject from AIS,
|
||||
KindOfInteractive from AIS,
|
||||
Location from TopLoc,
|
||||
Transformation from Geom
|
||||
raises
|
||||
NotImplemented from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (aTypeOfPresentation : TypeOfPresentation3d from PrsMgr
|
||||
=PrsMgr_TOP_ProjectorDependant)
|
||||
returns ConnectedShape from AIS;
|
||||
---Purpose: Initializes the type of 3d presentation aTypeOfPresentation
|
||||
|
||||
Create (aInteractiveShape : Shape from AIS;
|
||||
aTypeOfPresentation : TypeOfPresentation3d from PrsMgr
|
||||
=PrsMgr_TOP_ProjectorDependant)
|
||||
returns ConnectedShape from AIS;
|
||||
---Purpose: Initializes the entity aInteractiveShape and the type of 3d presentation aTypeOfPresentation.
|
||||
|
||||
Create(aConnectedShape : ConnectedShape from AIS;
|
||||
aTypeOfPresentation : TypeOfPresentation3d from PrsMgr
|
||||
=PrsMgr_TOP_ProjectorDependant)
|
||||
returns ConnectedShape from AIS;
|
||||
---Purpose: Initializes the entity aConnectedShape and the type of 3d presentation aTypeOfPresentation.
|
||||
|
||||
---Category: Redefined methods...
|
||||
|
||||
Type(me) returns KindOfInteractive from AIS
|
||||
is redefined virtual;
|
||||
|
||||
Signature(me) returns Integer from Standard
|
||||
is redefined virtual;
|
||||
|
||||
AcceptShapeDecomposition(me)
|
||||
returns Boolean from Standard is redefined;
|
||||
|
||||
|
||||
|
||||
|
||||
Connect(me : mutable;
|
||||
anotherIObj : InteractiveObject from AIS) is redefined ;
|
||||
---Purpose: Establishes the connection between the Connected
|
||||
-- Interactive Object, anotherIobj, and its reference
|
||||
-- entity. If there is already a previous connection with
|
||||
-- an Interactive Object, this connection is removed.
|
||||
|
||||
Connect(me:mutable;
|
||||
anotherIobj: InteractiveObject from AIS;
|
||||
aLocation : Location from TopLoc) is redefined;
|
||||
---Purpose: Establishes the connection between the Connected
|
||||
-- Interactive Object, anotherIobj, and its reference
|
||||
-- entity. If there is already a previous connection with
|
||||
-- an Interactive Object, this connection is removed.
|
||||
-- This syntax also initiates the location of the Connected Interactive Object.
|
||||
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d)
|
||||
is redefined virtual private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : Presentation from Prs3d)
|
||||
is redefined virtual private;
|
||||
|
||||
ComputeSelection(me:mutable; aSelection : Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined virtual private;
|
||||
---Purpose: Generates sensitive entities by copying
|
||||
-- them from myReferense selection specified by aMode,
|
||||
-- creates and sets an entity owner for this entities and adds
|
||||
-- them to aSelection.
|
||||
|
||||
Shape(me:mutable) returns Shape from TopoDS;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the topological shape which is the reference
|
||||
-- for the connected shape. Sets hilight mode to index
|
||||
-- 0. This returns a wireframe presentation.
|
||||
|
||||
|
||||
UpdateShape(me:mutable;WithLocation:Boolean from Standard = Standard_True)
|
||||
is static private;
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d;
|
||||
aShape : Shape from TopoDS)
|
||||
is private;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myOwnSh : Shape from TopoDS; -- used for HLR and selection...
|
||||
|
||||
end ConnectedShape;
|
@@ -1,335 +0,0 @@
|
||||
// Created on: 1996-04-10
|
||||
// Created by: Guest Design
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-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.
|
||||
|
||||
// <g_design>
|
||||
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <AIS_ConnectedShape.ixx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <StdPrs_WFDeflectionShape.hxx>
|
||||
#include <StdPrs_HLRPolyShape.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Aspect_TypeOfDeflection.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <StdSelect_BRepSelectionTool.hxx>
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <StdSelect.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_OrientedShapeMapHasher.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <AIS_MultipleConnectedShape.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_ConnectedShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_ConnectedShape::AIS_ConnectedShape (const Handle(AIS_Shape)& TheAISShape,
|
||||
const PrsMgr_TypeOfPresentation3d TheType):
|
||||
AIS_ConnectedInteractive(TheType)
|
||||
{
|
||||
myReference = TheAISShape;
|
||||
}
|
||||
|
||||
AIS_ConnectedShape::AIS_ConnectedShape (const Handle(AIS_ConnectedShape)& TheConnectedShape,
|
||||
const PrsMgr_TypeOfPresentation3d TheType):
|
||||
AIS_ConnectedInteractive(TheType)
|
||||
{
|
||||
myReference = TheConnectedShape;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_KindOfInteractive AIS_ConnectedShape::Type() const
|
||||
{return AIS_KOI_Shape;}
|
||||
|
||||
//=======================================================================
|
||||
//function : Signature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_ConnectedShape::Signature() const
|
||||
{return 1;}
|
||||
|
||||
//=======================================================================
|
||||
//function : AcceptShapeDecomposition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ConnectedShape::AcceptShapeDecomposition() const
|
||||
{return Standard_True;}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute Hidden Lines
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_ConnectedShape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
UpdateShape(Standard_True);
|
||||
Compute(aProjector,aPresentation,myOwnSh);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedShape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Geom_Transformation)& TheTrsf,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
UpdateShape(Standard_False);
|
||||
const TopLoc_Location& loc = myOwnSh.Location();
|
||||
TopoDS_Shape shbis = myOwnSh.Located(TopLoc_Location(TheTrsf->Trsf())*loc);
|
||||
Compute(aProjector,aPresentation,shbis);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_ConnectedShape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const TopoDS_Shape& SH)
|
||||
{
|
||||
// Standard_Boolean recompute = Standard_False;
|
||||
// Standard_Boolean myFirstCompute = Standard_True;
|
||||
switch (SH.ShapeType()){
|
||||
case TopAbs_VERTEX:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_WIRE:
|
||||
{
|
||||
aPresentation->SetDisplayPriority(4);
|
||||
StdPrs_WFDeflectionShape::Add(aPresentation,SH,myDrawer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
|
||||
if (defdrawer->DrawHiddenLine())
|
||||
{myDrawer->EnableDrawHiddenLine();}
|
||||
else {myDrawer->DisableDrawHiddenLine();}
|
||||
|
||||
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
|
||||
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
||||
|
||||
// process HLRAngle and HLRDeviationCoefficient()
|
||||
Standard_Real prevangl = myDrawer->HLRAngle();
|
||||
Standard_Real newangl = defdrawer->HLRAngle();
|
||||
if (Abs(newangl- prevangl) > Precision::Angular()) {
|
||||
#ifdef DEB
|
||||
cout << "AIS_MultipleConnectedShape : compute"<<endl;
|
||||
cout << "newangl : " << newangl << " # de " << "prevangl : " << prevangl << endl;
|
||||
#endif
|
||||
BRepTools::Clean(SH);
|
||||
}
|
||||
myDrawer->SetHLRAngle(newangl);
|
||||
myDrawer->SetHLRDeviationCoefficient(defdrawer->HLRDeviationCoefficient());
|
||||
StdPrs_HLRPolyShape::Add(aPresentation,SH,myDrawer,aProjector);
|
||||
defdrawer->SetTypeOfDeflection (prevdef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose : Attention fragile...
|
||||
//=======================================================================
|
||||
|
||||
void AIS_ConnectedShape::ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
typedef NCollection_List<Handle(Select3D_SensitiveEntity)> SensitiveList;
|
||||
typedef NCollection_DataMap<TopoDS_Shape, SensitiveList, TopTools_OrientedShapeMapHasher>
|
||||
Shapes2EntitiesMap;
|
||||
|
||||
UpdateShape();
|
||||
aSelection->Clear();
|
||||
// It is checked if there is nothing to do with the reference
|
||||
// of type update...
|
||||
|
||||
if(!myReference->HasSelection(aMode))
|
||||
myReference->UpdateSelection(aMode);
|
||||
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection(aMode);
|
||||
if(aRefSel->IsEmpty())
|
||||
myReference->UpdateSelection(aMode);
|
||||
|
||||
if(aRefSel->UpdateStatus()==SelectMgr_TOU_Full)
|
||||
myReference->UpdateSelection(aMode);
|
||||
|
||||
Handle(StdSelect_BRepOwner) anOwner;
|
||||
TopLoc_Location aBidLoc;
|
||||
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
|
||||
Shapes2EntitiesMap aShapes2EntitiesMap;
|
||||
SensitiveList aSEList;
|
||||
TopoDS_Shape aSubShape;
|
||||
|
||||
// Fill in the map of subshapes and corresponding
|
||||
// sensitive entities associated with aMode
|
||||
for(aRefSel->Init(); aRefSel->More(); aRefSel->Next())
|
||||
{
|
||||
aSE = Handle(Select3D_SensitiveEntity)::DownCast(aRefSel->Sensitive());
|
||||
if(!aSE.IsNull())
|
||||
{
|
||||
anOwner = Handle(StdSelect_BRepOwner)::DownCast(aSE->OwnerId());
|
||||
if(!anOwner.IsNull())
|
||||
{
|
||||
aSubShape = anOwner->Shape();
|
||||
if(!aShapes2EntitiesMap.IsBound(aSubShape))
|
||||
{
|
||||
aShapes2EntitiesMap.Bind(aSubShape, aSEList);
|
||||
}
|
||||
aShapes2EntitiesMap(aSubShape).Append(aSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in selection from aShapes2EntitiesMap
|
||||
Shapes2EntitiesMap::Iterator aMapIt(aShapes2EntitiesMap);
|
||||
for(; aMapIt.More(); aMapIt.Next())
|
||||
{
|
||||
aSEList = aMapIt.Value();
|
||||
anOwner = new StdSelect_BRepOwner(aMapIt.Key(),
|
||||
this,
|
||||
aSEList.First()->OwnerId()->Priority(),
|
||||
Standard_True);
|
||||
|
||||
SensitiveList::Iterator aListIt(aSEList);
|
||||
for(; aListIt.More(); aListIt.Next())
|
||||
{
|
||||
aSE = aListIt.Value();
|
||||
if(myLocation.IsIdentity())
|
||||
{
|
||||
aNewSE = aSE->GetConnected(aBidLoc);
|
||||
aNewSE->Set(anOwner);
|
||||
// In case if aSE caches some location-dependent data
|
||||
// that must be updated after setting anOwner
|
||||
aNewSE->SetLocation(aBidLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewSE = aSE->GetConnected(myLocation);
|
||||
aNewSE->Set(anOwner);
|
||||
// In case if aSE caches some location-dependent data
|
||||
// that must be updated after setting anOwner
|
||||
aNewSE->SetLocation(myLocation);
|
||||
}
|
||||
aSelection->Add(aNewSE);
|
||||
}
|
||||
}
|
||||
|
||||
StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopoDS_Shape& AIS_ConnectedShape::Shape()
|
||||
{
|
||||
UpdateShape();
|
||||
return myOwnSh;
|
||||
}
|
||||
AIS_ConnectedShape::AIS_ConnectedShape(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
|
||||
AIS_ConnectedInteractive(aTypeOfPresentation3d)
|
||||
{
|
||||
SetHilightMode(0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateShape
|
||||
//purpose : if<WithLocation=False> computes only the deducted shape
|
||||
// from reference; does not put "myLocation"
|
||||
//=======================================================================
|
||||
void AIS_ConnectedShape::UpdateShape(const Standard_Boolean WithTheLocation)
|
||||
{
|
||||
if(myReference.IsNull()) return;
|
||||
|
||||
// attention great line...
|
||||
if(myReference->Type()!=AIS_KOI_Shape) return;
|
||||
|
||||
Standard_Integer Sig = myReference->Signature();
|
||||
|
||||
TopoDS_Shape S ;
|
||||
switch(Sig){
|
||||
case 0:
|
||||
S = (*((Handle(AIS_Shape)*) &myReference))->Shape();
|
||||
break;
|
||||
case 1:
|
||||
S = (*((Handle(AIS_ConnectedShape)*) &myReference))->Shape();
|
||||
break;
|
||||
case 2:
|
||||
S=(*((Handle(AIS_MultipleConnectedShape)*) &myReference))->Shape();
|
||||
break;
|
||||
default:
|
||||
S = myOwnSh;
|
||||
}
|
||||
if(S.IsNull()) return;
|
||||
if(myLocation.IsIdentity() || !WithTheLocation)
|
||||
myOwnSh = S;
|
||||
else
|
||||
myOwnSh = S.Moved(myLocation);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedShape::
|
||||
Connect(const Handle(AIS_InteractiveObject)& anotherIObj)
|
||||
{
|
||||
if(anotherIObj->Type()== AIS_KOI_Shape){
|
||||
Standard_Integer Sig = anotherIObj->Signature();
|
||||
if(Sig <=2)
|
||||
AIS_ConnectedInteractive::Connect(anotherIObj);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedShape::
|
||||
Connect(const Handle(AIS_InteractiveObject)& anotherIObj,
|
||||
const TopLoc_Location& aLocation)
|
||||
{
|
||||
if(anotherIObj->Type()== AIS_KOI_Shape){
|
||||
Standard_Integer Sig = anotherIObj->Signature();
|
||||
if(Sig <=2)
|
||||
AIS_ConnectedInteractive::Connect(anotherIObj,aLocation);
|
||||
}
|
||||
}
|
||||
|
@@ -526,7 +526,6 @@ is
|
||||
returns Location from TopLoc;
|
||||
---Purpose:
|
||||
-- Returns the location of the entity aniobj.
|
||||
---C++: return const&
|
||||
|
||||
|
||||
|
||||
|
@@ -47,8 +47,8 @@
|
||||
#include <Precision.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
|
||||
#include <AIS_ConnectedShape.hxx>
|
||||
#include <AIS_MultipleConnectedShape.hxx>
|
||||
#include <AIS_ConnectedInteractive.hxx>
|
||||
#include <AIS_MultipleConnectedInteractive.hxx>
|
||||
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
|
||||
#include <AIS_GlobalStatus.hxx>
|
||||
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
|
||||
@@ -1319,19 +1319,19 @@ void AIS_InteractiveContext::SetLocation(const Handle(AIS_InteractiveObject)& an
|
||||
if(anIObj.IsNull()) return;
|
||||
|
||||
|
||||
if(anIObj->HasLocation() && aLoc.IsIdentity()){
|
||||
anIObj->ResetLocation();
|
||||
if(anIObj->HasTransformation() && aLoc.IsIdentity()){
|
||||
anIObj->ResetTransformation();
|
||||
mgrSelector->Update(anIObj,Standard_False);
|
||||
return;
|
||||
}
|
||||
if(aLoc.IsIdentity()) return ;
|
||||
|
||||
// first reset the previous location to properly clean everything...
|
||||
if(anIObj->HasLocation())
|
||||
anIObj->ResetLocation();
|
||||
if(anIObj->HasTransformation())
|
||||
anIObj->ResetTransformation();
|
||||
|
||||
|
||||
anIObj->SetLocation(aLoc);
|
||||
anIObj->SetLocalTransformation (aLoc.Transformation());
|
||||
|
||||
if(!HasOpenedContext())
|
||||
mgrSelector->Update(anIObj,Standard_False);
|
||||
@@ -1352,7 +1352,7 @@ void AIS_InteractiveContext::ResetLocation(const Handle(AIS_InteractiveObject)&
|
||||
{
|
||||
if(anIObj.IsNull()) return;
|
||||
|
||||
anIObj->ResetLocation();
|
||||
anIObj->ResetTransformation();
|
||||
mgrSelector->Update(anIObj,Standard_False);
|
||||
}
|
||||
|
||||
@@ -1366,13 +1366,13 @@ HasLocation(const Handle(AIS_InteractiveObject)& anIObj) const
|
||||
{
|
||||
if(anIObj.IsNull()) return Standard_False;
|
||||
|
||||
return anIObj->HasLocation();
|
||||
return anIObj->HasTransformation();
|
||||
}
|
||||
|
||||
const TopLoc_Location& AIS_InteractiveContext::
|
||||
TopLoc_Location AIS_InteractiveContext::
|
||||
Location(const Handle(AIS_InteractiveObject)& anIObj) const
|
||||
{
|
||||
return anIObj->Location();
|
||||
return anIObj->Transformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1489,8 +1489,8 @@ void AIS_InteractiveContext::SetDisplayMode(const AIS_DisplayMode aMode,
|
||||
Handle(AIS_InteractiveObject) anObj = It.Key();
|
||||
// ENDCLE
|
||||
Standard_Boolean Processed = (anObj->IsKind(STANDARD_TYPE(AIS_Shape)) ||
|
||||
anObj->IsKind(STANDARD_TYPE(AIS_ConnectedShape)) ||
|
||||
anObj->IsKind(STANDARD_TYPE(AIS_MultipleConnectedShape)) );
|
||||
anObj->IsKind(STANDARD_TYPE(AIS_ConnectedInteractive)) ||
|
||||
anObj->IsKind(STANDARD_TYPE(AIS_MultipleConnectedInteractive)) );
|
||||
|
||||
if ((!anObj->HasDisplayMode()) && Processed)
|
||||
{
|
||||
|
@@ -1120,17 +1120,17 @@ Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
|
||||
|
||||
TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
|
||||
{
|
||||
|
||||
if(!HasOpenedContext()){
|
||||
if (!HasOpenedContext())
|
||||
{
|
||||
TopoDS_Shape sh;
|
||||
#ifdef IMP280200
|
||||
Handle(AIS_Shape) shape =
|
||||
Handle(AIS_Shape)::DownCast(SelectedInteractive());
|
||||
if( !shape.IsNull() ) sh = shape->Shape();
|
||||
#endif
|
||||
Handle(AIS_Shape) shape = Handle(AIS_Shape)::DownCast(SelectedInteractive());
|
||||
if (!shape.IsNull()) sh = shape->Shape().Located (SelectedInteractive()->Transformation());
|
||||
return sh;
|
||||
} else
|
||||
return myLocalContexts(myCurLocalIndex)->SelectedShape();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myLocalContexts (myCurLocalIndex)->SelectedShape();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -521,37 +521,6 @@ is
|
||||
State(me) returns Integer from Standard ;
|
||||
---C++: inline
|
||||
|
||||
SetTransformation ( me : mutable;
|
||||
aTranformation: Transformation from Geom;
|
||||
postConcatenate: Boolean from Standard = Standard_False;
|
||||
updateSelection: Boolean from Standard = Standard_True)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Transforms all presentations of the object
|
||||
-- and replace the actual transformation matrix if <postConcatenate> is FALSE.
|
||||
-- Note that the selection must be updated only at the end of
|
||||
-- object animation when <updateSelection> is TRUE
|
||||
---Category: Transformation method
|
||||
|
||||
UnsetTransformation ( me : mutable )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Deactivate the current transformation
|
||||
---Category: Transformation method
|
||||
|
||||
Transformation ( me : mutable ) returns Transformation from Geom
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the current transformation associated
|
||||
-- to the first available presentation of this object.
|
||||
---Category: Inquire transformation method
|
||||
|
||||
HasTransformation ( me ) returns Boolean from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns TRUE when this object is transformed
|
||||
---Category: Inquire transformation method
|
||||
|
||||
HasPresentation ( me ) returns Boolean from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
@@ -657,7 +626,6 @@ fields
|
||||
|
||||
myToRecomputeModes : ListOfInteger from TColStd is protected;
|
||||
mystate : Integer from Standard;
|
||||
myHasTransformation : Boolean from Standard;
|
||||
|
||||
|
||||
friends
|
||||
|
@@ -72,8 +72,7 @@ myCTXPtr(NULL),
|
||||
mySelPriority(-1),
|
||||
myDisplayMode (-1),
|
||||
mySelectionMode(0),
|
||||
mystate(0),
|
||||
myHasTransformation(Standard_False)
|
||||
mystate(0)
|
||||
{
|
||||
Handle (AIS_InteractiveContext) Bid;
|
||||
myCTXPtr = Bid.operator->();
|
||||
@@ -545,79 +544,6 @@ void AIS_InteractiveObject::SetInfiniteState(const Standard_Boolean aFlag)
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::SetTransformation (const Handle(Geom_Transformation)& theTrsf,
|
||||
const Standard_Boolean theToPostConcatenate,
|
||||
const Standard_Boolean theToUpdateSelection)
|
||||
{
|
||||
if (GetContext().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
myHasTransformation = Standard_True;
|
||||
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
|
||||
{
|
||||
const Standard_Integer aMode = aPrsList (aPrsIter).Mode();
|
||||
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, aMode)->Presentation();
|
||||
theToPostConcatenate ? aPrs->Multiply (theTrsf)
|
||||
: aPrs->Transform (theTrsf);
|
||||
if (theToUpdateSelection)
|
||||
{
|
||||
myCTXPtr->ClearSelected (Standard_True);
|
||||
myCTXPtr->RecomputeSelectionOnly (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveObject::UnsetTransformation() {
|
||||
#ifdef OCC708
|
||||
static Handle(Geom_Transformation) trsf = new Geom_Transformation( gp_Trsf() );
|
||||
#else
|
||||
Handle(Geom_Transformation) trsf;
|
||||
#endif
|
||||
|
||||
SetTransformation(trsf); // Set identity transformation
|
||||
myHasTransformation = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transformation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Geom_Transformation) AIS_InteractiveObject::Transformation()
|
||||
{
|
||||
if (GetContext().IsNull())
|
||||
{
|
||||
return Handle(Geom_Transformation)();
|
||||
}
|
||||
|
||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||
if (aPrsList.Length() > 0)
|
||||
{
|
||||
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation();
|
||||
return aPrs->Transformation();
|
||||
}
|
||||
return Handle(Geom_Transformation)();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasTransformation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_InteractiveObject::HasTransformation() const {
|
||||
|
||||
return myHasTransformation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasPresentation
|
||||
//purpose :
|
||||
|
@@ -379,7 +379,6 @@ is
|
||||
---Purpose: returns TRUE if the detected entity is a shape
|
||||
-- coming from a Decomposition of an element.
|
||||
SelectedShape(me) returns Shape from TopoDS;
|
||||
---C++: return const &
|
||||
|
||||
SelectedOwner(me) returns EntityOwner from SelectMgr;
|
||||
IsSelected(me;aniobj: InteractiveObject from AIS) returns Boolean from Standard;
|
||||
|
@@ -774,8 +774,7 @@ HasShape() const
|
||||
// Function:
|
||||
// Purpose :
|
||||
//==================================================
|
||||
const TopoDS_Shape& AIS_LocalContext::
|
||||
SelectedShape() const
|
||||
TopoDS_Shape AIS_LocalContext::SelectedShape() const
|
||||
{
|
||||
static TopoDS_Shape aSh;
|
||||
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
|
||||
@@ -785,7 +784,7 @@ SelectedShape() const
|
||||
{
|
||||
return aSh;
|
||||
}
|
||||
return BRO->Shape();
|
||||
return BRO->Shape().Located (BRO->Location());
|
||||
}
|
||||
|
||||
//==================================================
|
||||
|
@@ -37,22 +37,27 @@ uses
|
||||
Projector from Prs3d,
|
||||
Transformation from Geom,
|
||||
Integer from Standard,
|
||||
Selection from SelectMgr
|
||||
Selection from SelectMgr,
|
||||
Trsf from gp
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create (aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView)
|
||||
Create
|
||||
returns MultipleConnectedInteractive from AIS;
|
||||
---Purpose: Initializes the Interactive Object with multiple
|
||||
-- presentation connections. If aTypeOfPresentation3d
|
||||
-- does not have the affectation PrsMgr_TOP_AllView,
|
||||
-- it is projector dependent.
|
||||
-- connections to AIS_Interactive objects.
|
||||
|
||||
Connect(me : mutable;
|
||||
anotherIObj : InteractiveObject from AIS);
|
||||
---Purpose: Add anotherIObj in the presentation of me
|
||||
Connect(me : mutable;
|
||||
theInteractive : InteractiveObject from AIS);
|
||||
---Purpose: Adds instance of theInteractive to child list.
|
||||
|
||||
Connect(me:mutable;
|
||||
anotherIobj: InteractiveObject from AIS;
|
||||
aLocation : Trsf from gp) is virtual;
|
||||
---Purpose: Establishes the connection between the Connected
|
||||
-- Interactive Object, anotherIobj, and its reference.
|
||||
-- Locates instance in aLocation.
|
||||
|
||||
Type(me) returns KindOfInteractive from AIS
|
||||
is redefined virtual;
|
||||
@@ -63,16 +68,9 @@ is
|
||||
HasConnection(me) returns Boolean from Standard;
|
||||
---Purpose: Returns true if the object is connected to others.
|
||||
|
||||
ConnectedTo(me) returns SequenceOfInteractive from AIS;
|
||||
---Purpose:
|
||||
-- Returns the connection references of the previous
|
||||
-- Interactive Objects in view.
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
Disconnect(me:mutable;
|
||||
anotherIObj : InteractiveObject from AIS);
|
||||
---Purpose: Removes the connection anotherIObj to an entity.
|
||||
Disconnect(me : mutable;
|
||||
theInteractive : InteractiveObject from AIS);
|
||||
---Purpose: Removes the connection with theInteractive.
|
||||
|
||||
DisconnectAll(me:mutable);
|
||||
---Purpose: Clears all the connections to objects.
|
||||
@@ -106,17 +104,20 @@ is
|
||||
Compute(me:mutable;
|
||||
aProjector: Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d)
|
||||
is redefined ;
|
||||
is redefined ;
|
||||
|
||||
AcceptShapeDecomposition(me) returns Boolean from Standard is redefined virtual;
|
||||
---C++: inline
|
||||
---Purpose: Informs the graphic context that the interactive Object
|
||||
-- may be decomposed into sub-shapes for dynamic selection.
|
||||
|
||||
|
||||
ComputeSelection(me:mutable; aSelection : Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined virtual private;
|
||||
---Purpose: Computes the selection for whole subtree in scene hierarchy.
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myReferences : SequenceOfInteractive from AIS;
|
||||
myPreviousReferences : SequenceOfInteractive from AIS;
|
||||
|
||||
end MultipleConnectedInteractive;
|
||||
|
@@ -14,34 +14,139 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// <g_design>
|
||||
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <AIS_MultipleConnectedInteractive.ixx>
|
||||
#include <AIS_ConnectedInteractive.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_Presentation.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive& theSeq,
|
||||
const Handle(AIS_InteractiveObject)& theItem)
|
||||
namespace
|
||||
{
|
||||
Standard_Integer I = theSeq.Length();
|
||||
while ( I>0 && theSeq.Value(I) != theItem) {
|
||||
I--;
|
||||
}
|
||||
return (I>0);
|
||||
//! SelectMgr_AssemblyEntityOwner replaces original owners in sensitive entities
|
||||
//! copied from reference objects to AIS_MultipleConnectedInteractive in order to
|
||||
//! redirect all selection queries to multiply connected (assembly).
|
||||
class SelectMgr_AssemblyEntityOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Copies another SelectMgr_EntityOwner.
|
||||
SelectMgr_AssemblyEntityOwner (const Handle(SelectMgr_EntityOwner) theOwner,
|
||||
SelectMgr_SelectableObject* theAssembly);
|
||||
|
||||
void SetAssembly (SelectMgr_SelectableObject* theAssembly)
|
||||
{
|
||||
myAssembly = theAssembly;
|
||||
}
|
||||
|
||||
//! Selectable() method modified to return myAssembly.
|
||||
virtual Handle_SelectMgr_SelectableObject Selectable() const;
|
||||
|
||||
Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode) const;
|
||||
|
||||
void Hilight (const Handle(PrsMgr_PresentationManager)& PM,const Standard_Integer aMode);
|
||||
|
||||
void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& PM,
|
||||
const Quantity_NameOfColor aColor,
|
||||
const Standard_Integer aMode);
|
||||
|
||||
void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer aMode);
|
||||
|
||||
private:
|
||||
|
||||
SelectMgr_SelectableObject* myAssembly;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
static Standard_Integer RangeInSeq (const AIS_SequenceOfInteractive& theSeq ,
|
||||
const Handle(AIS_InteractiveObject)& theItem)
|
||||
//=======================================================================
|
||||
//function : SelectMgr_AssemblyEntityOwner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SelectMgr_AssemblyEntityOwner::SelectMgr_AssemblyEntityOwner (const Handle(SelectMgr_EntityOwner) theOwner,
|
||||
SelectMgr_SelectableObject* theAssembly)
|
||||
:
|
||||
SelectMgr_EntityOwner (theOwner),
|
||||
myAssembly (theAssembly)
|
||||
{
|
||||
Standard_Integer I = theSeq.Length();
|
||||
while ( I>0 && theSeq.Value(I) != theItem) {
|
||||
I--;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Selectable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(SelectMgr_SelectableObject) SelectMgr_AssemblyEntityOwner::Selectable() const
|
||||
{
|
||||
return myAssembly;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_AssemblyEntityOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,
|
||||
const Standard_Integer aMode) const
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
return PM->IsHighlighted (myAssembly, aMode);
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_AssemblyEntityOwner::Hilight (const Handle(PrsMgr_PresentationManager)& PM,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
PM->Highlight (myAssembly, aMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_AssemblyEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& PM,
|
||||
const Quantity_NameOfColor aColor,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
if (IsAutoHilight())
|
||||
{
|
||||
PM->Color (myAssembly, aColor, aMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
myAssembly->HilightOwnerWithColor (PM, aColor, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SelectMgr_AssemblyEntityOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& PM,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
PM->Unhighlight (myAssembly, aMode);
|
||||
}
|
||||
return I;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +155,11 @@ static Standard_Integer RangeInSeq (const AIS_SequenceOfInteractive& theSeq ,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive
|
||||
(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
|
||||
AIS_InteractiveObject(aTypeOfPresentation3d)
|
||||
{
|
||||
SetHilightMode(0);
|
||||
AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
|
||||
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
|
||||
{
|
||||
myHasOwnPresentations = Standard_False;
|
||||
SetHilightMode (0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -62,25 +167,68 @@ AIS_InteractiveObject(aTypeOfPresentation3d)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_KindOfInteractive AIS_MultipleConnectedInteractive::Type() const
|
||||
{return AIS_KOI_Object;}
|
||||
{
|
||||
return AIS_KOI_Object;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Signature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_MultipleConnectedInteractive::Signature() const
|
||||
{return 1;}
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_MultipleConnectedInteractive::Connect(const Handle(AIS_InteractiveObject)& anotherIObj)
|
||||
void AIS_MultipleConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
|
||||
const gp_Trsf& theTransformation)
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObjectToAdd;
|
||||
|
||||
if (!IsInSeq (myReferences, anotherIObj)) {
|
||||
myReferences.Append(anotherIObj);
|
||||
Handle(AIS_MultipleConnectedInteractive) aMultiConnected = Handle(AIS_MultipleConnectedInteractive)::DownCast (theAnotherObj);
|
||||
if (!aMultiConnected.IsNull())
|
||||
{
|
||||
Handle(AIS_MultipleConnectedInteractive) aNewMultiConnected = new AIS_MultipleConnectedInteractive();
|
||||
aNewMultiConnected->SetLocalTransformation (aMultiConnected->LocalTransformation());
|
||||
|
||||
// Perform deep copy of instance tree
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (aMultiConnected->Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (anInteractive.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aNewMultiConnected->Connect (anInteractive);
|
||||
}
|
||||
|
||||
anObjectToAdd = aNewMultiConnected;
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(AIS_ConnectedInteractive) aNewConnected = new AIS_ConnectedInteractive();
|
||||
aNewConnected->Connect (theAnotherObj);
|
||||
aNewConnected->SetLocalTransformation (theAnotherObj->LocalTransformation());
|
||||
|
||||
anObjectToAdd = aNewConnected;
|
||||
}
|
||||
|
||||
anObjectToAdd->SetLocalTransformation (theTransformation);
|
||||
AddChild (anObjectToAdd);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_MultipleConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj)
|
||||
{
|
||||
Connect (theAnotherObj, theAnotherObj->LocalTransformation());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -89,7 +237,7 @@ void AIS_MultipleConnectedInteractive::Connect(const Handle(AIS_InteractiveObjec
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_MultipleConnectedInteractive::HasConnection() const
|
||||
{
|
||||
return (myReferences.Length() != 0);
|
||||
return (Children().Size() != 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -99,11 +247,7 @@ Standard_Boolean AIS_MultipleConnectedInteractive::HasConnection() const
|
||||
|
||||
void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveObject)& anotherIObj)
|
||||
{
|
||||
Standard_Integer I = RangeInSeq (myReferences, anotherIObj);
|
||||
if (I != 0) {
|
||||
myReferences.Remove(I);
|
||||
|
||||
}
|
||||
RemoveChild (anotherIObj);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -111,49 +255,36 @@ void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveOb
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_MultipleConnectedInteractive::DisconnectAll ()
|
||||
void AIS_MultipleConnectedInteractive::DisconnectAll()
|
||||
{
|
||||
/* for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
|
||||
{
|
||||
const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation();
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT);
|
||||
}
|
||||
}*/
|
||||
myPreviousReferences = myReferences; // pour garder les poignees au chaud!!!!
|
||||
myReferences.Clear();
|
||||
Standard_Integer aNbItemsToRemove = Children().Size();
|
||||
for (Standard_Integer anIter = 0; anIter < aNbItemsToRemove; ++anIter)
|
||||
{
|
||||
RemoveChild (Children().First());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePrsMgr*/,
|
||||
const Handle(Prs3d_Presentation)& /*thePrs*/,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
thePrs->Clear (Standard_False);
|
||||
thePrs->RemoveAll();
|
||||
if (HasConnection())
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
for (Standard_Integer aRefIter = 1; aRefIter <= myReferences.Length(); ++aRefIter)
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
const Handle (AIS_InteractiveObject)& aRef = myReferences.Value (aRefIter);
|
||||
if (!aRef->HasInteractiveContext())
|
||||
{
|
||||
aRef->SetContext (GetContext());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
thePrsMgr->Connect (this, aRef, theMode, theMode);
|
||||
if (thePrsMgr->Presentation (aRef, theMode)->MustBeUpdated())
|
||||
{
|
||||
thePrsMgr->Update (aRef, theMode);
|
||||
}
|
||||
if (!aChild->HasInteractiveContext())
|
||||
{
|
||||
aChild->SetContext (GetContext());
|
||||
}
|
||||
}
|
||||
|
||||
thePrs->ReCompute();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -164,8 +295,7 @@ void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_Presentation
|
||||
void AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)&, const Handle(Prs3d_Presentation)&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -177,15 +307,109 @@ void AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aP
|
||||
const Handle(Geom_Transformation)& aTransformation,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AcceptShapeDecomposition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() const
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aChild->AcceptShapeDecomposition())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_MultipleConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSel*/,
|
||||
const Standard_Integer /*aMode*/)
|
||||
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
{
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aChild->HasSelection(theMode))
|
||||
{
|
||||
aChild->UpdateSelection(theMode);
|
||||
}
|
||||
|
||||
aChild->ComputeSelection (theSelection, theMode);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||
if (aChild.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!aChild->HasSelection (theMode))
|
||||
{
|
||||
aChild->UpdateSelection (theMode);
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_Selection)& TheRefSel = aChild->Selection (theMode);
|
||||
|
||||
// To redirect selection we must replace owners in sensitives, but we don't want new owner for each SE.
|
||||
// Only for each existing owner.
|
||||
NCollection_DataMap <Handle(SelectMgr_EntityOwner), Handle(SelectMgr_EntityOwner)> anOwnerMap;
|
||||
|
||||
Handle(Select3D_SensitiveEntity) aSensitive, aNewSensitive;
|
||||
|
||||
if (TheRefSel->IsEmpty())
|
||||
{
|
||||
aChild->UpdateSelection(theMode);
|
||||
}
|
||||
|
||||
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
|
||||
{
|
||||
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast(TheRefSel->Sensitive());
|
||||
|
||||
if (!aSensitive.IsNull())
|
||||
{
|
||||
TopLoc_Location aLocation (Transformation());
|
||||
// Get the copy of aSensitive
|
||||
aNewSensitive = aSensitive->GetConnected (aLocation);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aNewSensitive->OwnerId());
|
||||
|
||||
if (!anOwnerMap.IsBound (anOwner))
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) aNewOwner = new SelectMgr_AssemblyEntityOwner (anOwner, this);
|
||||
anOwnerMap.Bind (anOwner, aNewOwner);
|
||||
}
|
||||
|
||||
aNewSensitive->Set (anOwnerMap.Find (anOwner));
|
||||
// In case if aSensitive caches some location-dependent data
|
||||
// that must be updated after setting OWN
|
||||
aNewSensitive->SetLocation (aLocation);
|
||||
|
||||
theSelection->Add (aNewSensitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,14 +13,3 @@
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// <g_design>
|
||||
//=======================================================================
|
||||
//function : ConnectedTo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const AIS_SequenceOfInteractive& AIS_MultipleConnectedInteractive::ConnectedTo() const
|
||||
{
|
||||
return myReferences;
|
||||
}
|
||||
|
@@ -1,107 +0,0 @@
|
||||
-- Created on: 1997-04-22
|
||||
-- Created by: Guest Design
|
||||
-- Copyright (c) 1997-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-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.
|
||||
|
||||
class MultipleConnectedShape from AIS inherits MultipleConnectedInteractive from AIS
|
||||
|
||||
|
||||
---Purpose: Constructs an Interactive Object connected to a list of
|
||||
-- Interactive Objects having a Shape. These include
|
||||
-- AIS_Shape, and AIS_ConnectedShape.
|
||||
-- Presentation of Hidden parts is calculated automatically.
|
||||
-- You define the Interactive Object by gathering
|
||||
-- together several other object presentations as in
|
||||
-- AIS_MultipleConnectedInteractive.
|
||||
|
||||
uses
|
||||
|
||||
PresentationManager3d from PrsMgr,
|
||||
Shape from TopoDS,
|
||||
Projector from Prs3d,
|
||||
Presentation from Prs3d,
|
||||
Selection from SelectMgr,
|
||||
Integer from Standard,
|
||||
Transformation from Geom,
|
||||
KindOfInteractive from AIS
|
||||
|
||||
raises
|
||||
NotImplemented from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (aShape : Shape from TopoDS)
|
||||
returns MultipleConnectedShape from AIS;
|
||||
---Purpose: Initializes the shape aShape, a multiple connected
|
||||
-- Interactive Object grouping different
|
||||
-- projector-dependent representations of an entity.
|
||||
Type(me) returns KindOfInteractive from AIS
|
||||
is redefined virtual;
|
||||
|
||||
Signature(me) returns Integer from Standard
|
||||
is redefined virtual;
|
||||
|
||||
AcceptShapeDecomposition(me)
|
||||
returns Boolean from Standard is redefined virtual;
|
||||
---Purpose: Returns true is shape decomposition is accepted.
|
||||
|
||||
Set(me:mutable;ashap : Shape from TopoDS) is static;
|
||||
---Purpose: Constructs the reference shape ashap.
|
||||
---C++: inline
|
||||
|
||||
Shape(me) returns Shape from TopoDS ;
|
||||
---Purpose: Returns the shape which is constructed in Set.
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d)
|
||||
is redefined virtual protected;
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation: Presentation from Prs3d)
|
||||
is redefined virtual protected;
|
||||
|
||||
ComputeSelection(me:mutable; aSelection : Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined virtual protected;
|
||||
|
||||
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation: Presentation from Prs3d;
|
||||
aShape : Shape from TopoDS)
|
||||
is private;
|
||||
|
||||
Compute(me:mutable;
|
||||
aPresentationManager : PresentationManager3d from PrsMgr;
|
||||
aPresentation : Presentation from Prs3d;
|
||||
aMode : Integer from Standard = 0)
|
||||
---Level: Internal
|
||||
---Purpose: this method is redefined virtual;
|
||||
-- when the instance is connected to another
|
||||
-- InteractiveObject,this method doesn't
|
||||
-- compute anything, but just uses the
|
||||
-- presentation of this last object, with
|
||||
-- a transformation if there's one stored.
|
||||
is redefined virtual private;
|
||||
|
||||
fields
|
||||
myShape : Shape from TopoDS; -- celle qui sert au compute Hidden lines et selection
|
||||
end MultipleConnectedShape;
|
@@ -1,231 +0,0 @@
|
||||
// Created on: 1997-04-22
|
||||
// Created by: Guest Design
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-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.
|
||||
|
||||
// <g_design>
|
||||
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <AIS_MultipleConnectedShape.ixx>
|
||||
|
||||
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <StdPrs_WFDeflectionShape.hxx>
|
||||
#include <StdPrs_HLRPolyShape.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Aspect_TypeOfDeflection.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <StdSelect_BRepSelectionTool.hxx>
|
||||
#include <StdSelect.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_ConnectedShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_MultipleConnectedShape::AIS_MultipleConnectedShape (const TopoDS_Shape& aShape):
|
||||
AIS_MultipleConnectedInteractive(PrsMgr_TOP_ProjectorDependant),
|
||||
myShape(aShape)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_KindOfInteractive AIS_MultipleConnectedShape::Type() const
|
||||
{return AIS_KOI_Shape;}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Signature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_MultipleConnectedShape::Signature() const
|
||||
{return 2;}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AcceptShapeDecomposition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_MultipleConnectedShape::AcceptShapeDecomposition() const
|
||||
{return Standard_True;}
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute Hidden Lines
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_MultipleConnectedShape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
Compute(aProjector,aPresentation,myShape);
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_MultipleConnectedShape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Geom_Transformation)& aTrsf,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
aPresentation->Clear();
|
||||
|
||||
const TopLoc_Location& loc = myShape.Location();
|
||||
TopoDS_Shape shbis = myShape.Located(TopLoc_Location(aTrsf->Trsf())*loc);
|
||||
Compute(aProjector,aPresentation,shbis);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AIS_MultipleConnectedShape::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const TopoDS_Shape& SH)
|
||||
{
|
||||
//Standard_Boolean recompute = Standard_False;
|
||||
//Standard_Boolean myFirstCompute = Standard_True;
|
||||
switch (SH.ShapeType()){
|
||||
case TopAbs_VERTEX:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_WIRE:
|
||||
{
|
||||
aPresentation->SetDisplayPriority(4);
|
||||
StdPrs_WFDeflectionShape::Add(aPresentation,SH,myDrawer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
|
||||
if (defdrawer->DrawHiddenLine())
|
||||
{myDrawer->EnableDrawHiddenLine();}
|
||||
else {myDrawer->DisableDrawHiddenLine();}
|
||||
|
||||
Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
|
||||
defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
|
||||
|
||||
// traitement HLRAngle et HLRDeviationCoefficient()
|
||||
Standard_Real prevangl = myDrawer->HLRAngle();
|
||||
Standard_Real newangl = defdrawer->HLRAngle();
|
||||
if (Abs(newangl- prevangl) > Precision::Angular()) {
|
||||
#ifdef DEB
|
||||
cout << "AIS_MultipleConnectedShape : compute"<<endl;
|
||||
cout << "newangl : " << newangl << " # de " << "prevangl : " << prevangl << endl;
|
||||
#endif
|
||||
BRepTools::Clean(SH);
|
||||
}
|
||||
myDrawer->SetHLRAngle(newangl);
|
||||
myDrawer->SetHLRDeviationCoefficient(defdrawer->HLRDeviationCoefficient());
|
||||
|
||||
StdPrs_HLRPolyShape::Add(aPresentation,SH,myDrawer,aProjector);
|
||||
|
||||
|
||||
defdrawer->SetTypeOfDeflection (prevdef);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_MultipleConnectedShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager3d,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const int anint)
|
||||
{
|
||||
AIS_MultipleConnectedInteractive::Compute( aPresentationManager3d , aPresentation , anint ) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_MultipleConnectedShape::ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
//cout<<"AIS_MultipleConnectedShape::ComputeSelection"<<endl;
|
||||
|
||||
Standard_Real aDeviationAngle = myDrawer->DeviationAngle();
|
||||
Standard_Real aDeflection = myDrawer->MaximalChordialDeviation();
|
||||
if (myDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
|
||||
{
|
||||
// On calcule la fleche en fonction des min max globaux de la piece:
|
||||
Bnd_Box aBndBox; //= BoundingBox(); ?
|
||||
BRepBndLib::Add (myShape, aBndBox);
|
||||
if (!aBndBox.IsVoid())
|
||||
{
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
aBndBox.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
aDeflection = Max (aXmax - aXmin, Max (aYmax - aYmin, aZmax - aZmin)) * myDrawer->DeviationCoefficient();
|
||||
}
|
||||
}
|
||||
|
||||
switch(aMode){
|
||||
case 1:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_VERTEX, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 2:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_EDGE, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 3:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_WIRE, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 4:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_FACE, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 5:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_SHELL, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 6:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_SOLID, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 7:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_COMPOUND, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
case 8:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_COMPSOLID, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
default:
|
||||
StdSelect_BRepSelectionTool::Load(aSelection,this,myShape,TopAbs_SHAPE, aDeflection, aDeviationAngle);
|
||||
break;
|
||||
}
|
||||
// insert the drawer in the BrepOwners for hilight...
|
||||
StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -1,29 +0,0 @@
|
||||
// Created on: 1997-04-22
|
||||
// Created by: Guest Design
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-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.
|
||||
|
||||
// <g_design>
|
||||
|
||||
inline void AIS_MultipleConnectedShape::Set(const TopoDS_Shape& ashap)
|
||||
{
|
||||
myShape = ashap;
|
||||
}
|
||||
|
||||
inline const TopoDS_Shape&
|
||||
AIS_MultipleConnectedShape::Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
@@ -411,8 +411,8 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
TypOfSel = AIS_Shape::SelectionType(aMode);
|
||||
TopoDS_Shape shape = myshape;
|
||||
if( HasTransformation() ) {
|
||||
Handle(Geom_Transformation) trsf = Transformation();
|
||||
shape = shape.Located(TopLoc_Location(trsf->Trsf())*shape.Location());
|
||||
gp_Trsf trsf = Transformation();
|
||||
shape = shape.Located(TopLoc_Location(trsf)*shape.Location());
|
||||
}
|
||||
|
||||
// POP protection against crash in low layers
|
||||
|
@@ -47,6 +47,7 @@ class Trihedron from AIS inherits InteractiveObject from AIS
|
||||
|
||||
uses
|
||||
Axis2Placement from Geom,
|
||||
Trsf from gp,
|
||||
Presentation from Prs3d,
|
||||
PresentationManager3d from PrsMgr,
|
||||
NameOfColor from Quantity,
|
||||
@@ -152,9 +153,7 @@ is
|
||||
|
||||
-- Methods from PresentableObject
|
||||
|
||||
SetLocation(me : mutable;
|
||||
aLoc : Location from TopLoc)
|
||||
is redefined static;
|
||||
SetLocalTransformation(me:mutable; theTransformation:Trsf from gp) is redefined static;
|
||||
|
||||
-- Methods from SelectableObject
|
||||
|
||||
|
@@ -107,14 +107,14 @@ void AIS_Trihedron::SetComponent(const Handle(Geom_Axis2Placement)& aComponent)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Trihedron::SetLocation(const TopLoc_Location& aLoc)
|
||||
void AIS_Trihedron::SetLocalTransformation (const gp_Trsf& theTransformation)
|
||||
{
|
||||
// Update location to the subshapes
|
||||
Standard_Integer anIdx;
|
||||
for (anIdx = 0; anIdx < 7; anIdx++)
|
||||
myShapes[anIdx]->SetLocation (aLoc);
|
||||
myShapes[anIdx]->SetLocalTransformation (theTransformation);
|
||||
|
||||
AIS_InteractiveObject::SetLocation (aLoc);
|
||||
AIS_InteractiveObject::SetLocalTransformation (theTransformation);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Reference in New Issue
Block a user