]> OCCT Git - occt.git/commitdiff
0024837: Visualization - revise design and implementation of connected Interactive...
authorduv <duv@opencascade.com>
Thu, 28 Aug 2014 12:38:28 +0000 (16:38 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 28 Aug 2014 13:38:17 +0000 (17:38 +0400)
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.

62 files changed:
samples/mfc/standard/04_Viewer3d/src/ModelClippingDlg.cpp
src/AIS/AIS.cdl
src/AIS/AIS_ConnectedInteractive.cdl
src/AIS/AIS_ConnectedInteractive.cxx
src/AIS/AIS_ConnectedShape.cdl [deleted file]
src/AIS/AIS_ConnectedShape.cxx [deleted file]
src/AIS/AIS_InteractiveContext.cdl
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext_1.cxx
src/AIS/AIS_InteractiveObject.cdl
src/AIS/AIS_InteractiveObject.cxx
src/AIS/AIS_LocalContext.cdl
src/AIS/AIS_LocalContext_1.cxx
src/AIS/AIS_MultipleConnectedInteractive.cdl
src/AIS/AIS_MultipleConnectedInteractive.cxx
src/AIS/AIS_MultipleConnectedInteractive.lxx
src/AIS/AIS_MultipleConnectedShape.cdl [deleted file]
src/AIS/AIS_MultipleConnectedShape.cxx [deleted file]
src/AIS/AIS_MultipleConnectedShape.lxx [deleted file]
src/AIS/AIS_Shape.cxx
src/AIS/AIS_Trihedron.cdl
src/AIS/AIS_Trihedron.cxx
src/Graphic3d/Graphic3d_Structure.cdl
src/Graphic3d/Graphic3d_Structure.cxx
src/OpenGl/OpenGl_Structure.cxx
src/OpenGl/OpenGl_Structure.hxx
src/OpenGl/OpenGl_Workspace.hxx
src/OpenGl/OpenGl_Workspace_Raytrace.cxx [changed mode: 0755->0644]
src/PrsMgr/FILES
src/PrsMgr/PrsMgr.cdl
src/PrsMgr/PrsMgr_ListOfPresentableObjects.hxx [new file with mode: 0644]
src/PrsMgr/PrsMgr_PresentableObject.cdl
src/PrsMgr/PrsMgr_PresentableObject.cxx
src/PrsMgr/PrsMgr_PresentableObject.lxx
src/PrsMgr/PrsMgr_PresentationManager.cdl
src/PrsMgr/PrsMgr_PresentationManager.cxx
src/QABugs/QABugs_11.cxx
src/Select3D/Select3D_SensitiveEntity.cdl
src/Select3D/Select3D_SensitiveEntity.cxx
src/SelectBasics/SelectBasics_EntityOwner.cdl
src/SelectMgr/SelectMgr_EntityOwner.cdl
src/SelectMgr/SelectMgr_EntityOwner.cxx
src/SelectMgr/SelectMgr_SelectableObject.cdl
src/SelectMgr/SelectMgr_SelectableObject.cxx
src/SelectMgr/SelectMgr_SelectionManager.cxx
src/TPrsStd/TPrsStd_AxisDriver.cxx
src/TPrsStd/TPrsStd_ConstraintDriver.cxx
src/TPrsStd/TPrsStd_GeometryDriver.cxx
src/TPrsStd/TPrsStd_NamedShapeDriver.cxx
src/TPrsStd/TPrsStd_PlaneDriver.cxx
src/TPrsStd/TPrsStd_PointDriver.cxx
src/ViewerTest/ViewerTest.cxx
src/ViewerTest/ViewerTest_ObjectCommands.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
tests/bugs/vis/bug12121
tests/bugs/vis/bug23422 [new file with mode: 0644]
tests/bugs/vis/bug24358
tests/bugs/vis/bug24756 [new file with mode: 0644]
tests/bugs/vis/bug24837_1 [new file with mode: 0644]
tests/bugs/vis/bug24837_2 [new file with mode: 0644]
tests/bugs/vis/bug25103 [new file with mode: 0644]
tests/v3d/raytrace/connected

index 90236005349892f91b36373c4204775385f82a88..86fd233f07d679bcad674f632e4ed0f627a759fb 100755 (executable)
@@ -86,7 +86,7 @@ void CModelClippingDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBa
   }
   else
   {
-    myShape->SetLocation (TopLoc_Location (myTrsf));
+    myShape->SetLocalTransformation (myTrsf);
   }
 
   TCollection_AsciiString aMessage (
@@ -174,7 +174,7 @@ void CModelClippingDlg::OnChangeEditModelclippingZ()
   }
   else
   {
-    myShape->SetLocation (TopLoc_Location (myTrsf));
+    myShape->SetLocalTransformation (myTrsf);
   }
 
   myModelClipping_Z = m_ModelClipping_Z;
index 1340559f41ed92bbbb76e329f330795c7f365812..3abdfc8c15bf686dfb237d92e4bd42d768a5190b 100644 (file)
@@ -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
index 595878d7f127cc4329268827a1b999add73ebc8f..e4b8a41d93ca6d1c0fa607bafe41fbceb1be140d 100644 (file)
 
 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
-
-
-    UpdateLocation(me:mutable) is redefined virtual;
+        ---C++: inline
+        ---Purpose:  Informs the graphic context that the interactive Object
+        -- may be decomposed into sub-shapes for dynamic selection.
 
-    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;
 
index a6a81ae4a518bc0ffe500fd6363f9fe9bf2eaa12..31e3c51f62ee9cf414d677a69a044b76c0b34f4d 100644 (file)
 
 #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 : ComputeSelection
-//purpose  : 
+//function : Compute
+//purpose  :
 //=======================================================================
-
-void AIS_ConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& aSel, 
-                                                const Standard_Integer aMode)
+void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjector,
+                                        const Handle(Prs3d_Presentation)& thePresentation,
+                                        const TopoDS_Shape& theShape)
 {
-  if(!(HasLocation() ||HasConnection())) return;
-  
-  aSel->Clear();
-  if(!myReference->HasSelection(aMode))
-    myReference->UpdateSelection(aMode);
+  if (myShape.IsNull())
+  {
+    return;
+  }
 
-  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())
+  switch (theShape.ShapeType())
   {
-    SE3D = Handle(Select3D_SensitiveEntity)::DownCast(TheRefSel->Sensitive());
-    if(!SE3D.IsNull())
+    case TopAbs_VERTEX:
+    case TopAbs_EDGE:
+    case TopAbs_WIRE:
     {
-      // Get the copy of SE3D
-      SNew = SE3D->GetConnected(myLocation);
-      if(aMode==0)
+      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())
       {
-        SNew->Set(OWN);
-        // In case if SE3D caches some location-dependent data
-        // that must be updated after setting OWN
-        SNew->SetLocation(myLocation);
+        BRepTools::Clean (theShape);
       }
-      aSel->Add(SNew);
+
+      myDrawer->SetHLRAngle (aNewAngle);
+      myDrawer->SetHLRDeviationCoefficient (aDefaultDrawer->HLRDeviationCoefficient());
+      StdPrs_HLRPolyShape::Add (thePresentation, theShape, myDrawer, theProjector);
+      aDefaultDrawer->SetTypeOfDeflection (aPrevDeflection);
     }
   }
 }
 
-void AIS_ConnectedInteractive::UpdateLocation()
+//=======================================================================
+//function : updateShape
+//purpose  : 
+//=======================================================================
+void AIS_ConnectedInteractive::updateShape (const Standard_Boolean isWithLocation)
 {
-// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::UpdateLocation()");
- SelectMgr_SelectableObject::UpdateLocation() ;
+  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()));
+  }
 }
-void AIS_ConnectedInteractive::UpdateLocation(const Handle(SelectMgr_Selection)& Sel)
+
+//=======================================================================
+//function : ComputeSelection
+//purpose  : 
+//=======================================================================
+void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, 
+                                                 const Standard_Integer theMode)
 {
-// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::UpdateLocation(const Handle(SelectMgr_Selection)& Sel)");
- SelectMgr_SelectableObject::UpdateLocation(Sel) ;
+  if (!HasConnection())
+  {
+    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
+      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(const Handle(Prs3d_Presentation)& aPresentation)
+
+//=======================================================================
+//function : ComputeSubShapeSelection 
+//purpose  :
+//=======================================================================
+void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_Selection)& theSelection, 
+                                                         const Standard_Integer theMode)
 {
-// Standard_NotImplemented::Raise("AIS_ConnectedInteractive::UpdateLocation(const Handle(Prs3d_Presentation)&)");
- SelectMgr_SelectableObject::UpdateLocation(aPresentation) ;
-}*/
+  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);  
+}
diff --git a/src/AIS/AIS_ConnectedShape.cdl b/src/AIS/AIS_ConnectedShape.cdl
deleted file mode 100644 (file)
index ee75a33..0000000
+++ /dev/null
@@ -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;
diff --git a/src/AIS/AIS_ConnectedShape.cxx b/src/AIS/AIS_ConnectedShape.cxx
deleted file mode 100644 (file)
index 1d46b87..0000000
+++ /dev/null
@@ -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);
-  }
-}
-
index f9bf5b1690b5749340f99b62e73dc4bed7629cee..5ea726746e4a894e6ec3b83aa8b595043b401fc0 100644 (file)
@@ -526,7 +526,6 @@ is
     returns Location from TopLoc;
        ---Purpose:
        -- Returns the location of the entity aniobj.
-       ---C++: return const&
 
 
 
index 46a326202a94e8bfb0682f3721c2ce63dc29dd71..8dc78cea558011a933542703bd8e27607c103875 100644 (file)
@@ -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) 
       {
index 73cebca4fa04f28a1ddad1f8b0470638bf788c0a..9d041b02970bd85bae8825a3026db0bf48bacb31 100644 (file)
@@ -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();
+  }
 }
 
 //=======================================================================
index cf6cea7afa288a980cf428769c8b310a2a0c1683..8b4f4480a65d8a56de2a4c5d662fd8bb8326b6fb 100644 (file)
@@ -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
index c568148927da94c1cc573801b9f90850074be87e..3e97b9c3aee0bf4a51ae02800aa427f190d66532 100644 (file)
@@ -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  :
index 1cca3f47681ace001e98f5f9cd466a7adcf3435a..5dc11609343763a296f8a4edc16c01d7f137b5c3 100644 (file)
@@ -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;
index 30f05e2ee8dc56a154329edaaddb9ff620e54b25..7ce7815cf0615c2fac10f01db228a84b5826d7c7 100644 (file)
@@ -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());
 }
 
 //==================================================
index 5ce6b7b16768fc134afa1bf679178994d1a095a1..5815d3fc204630ddcf9c80818340a14b9915fd65 100644 (file)
@@ -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;
index 10ba1c1e38590d634c4b01c769de9d1338dd7fa4..91c37f53bc5bb0c15d0877b467b793b9d2665397 100644 (file)
 // 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>
+
+namespace
+{
+  //! 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;
+  };
+
+}
+
+//=======================================================================
+//function : SelectMgr_AssemblyEntityOwner
+//purpose  : 
+//=======================================================================
+SelectMgr_AssemblyEntityOwner::SelectMgr_AssemblyEntityOwner (const Handle(SelectMgr_EntityOwner) theOwner,
+                                                              SelectMgr_SelectableObject* theAssembly)
+:
+  SelectMgr_EntityOwner (theOwner),
+  myAssembly (theAssembly)
+{
+}
+
+//=======================================================================
+//function : Selectable
+//purpose  : 
+//=======================================================================
+Handle(SelectMgr_SelectableObject) SelectMgr_AssemblyEntityOwner::Selectable() const
+{  
+  return myAssembly;
+}
 
-static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive&      theSeq,
-                                const Handle(AIS_InteractiveObject)&  theItem) 
+//=======================================================================
+//function : IsHilighted
+//purpose  : 
+//=======================================================================
+Standard_Boolean SelectMgr_AssemblyEntityOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& PM,
+                                                             const Standard_Integer aMode) const 
 {
-  Standard_Integer I = theSeq.Length();
-  while ( I>0 && theSeq.Value(I) != theItem) {    
-    I--;
+  if (HasSelectable())
+  {
+   return PM->IsHighlighted (myAssembly, aMode);
   }
-  return (I>0);
+
+  return Standard_False;
 }
 
-static Standard_Integer RangeInSeq (const AIS_SequenceOfInteractive& theSeq ,
-                                   const Handle(AIS_InteractiveObject)&     theItem) 
+//=======================================================================
+//function : Hilight
+//purpose  : 
+//=======================================================================
+void SelectMgr_AssemblyEntityOwner::Hilight (const Handle(PrsMgr_PresentationManager)& PM,
+                                             const Standard_Integer aMode)
 {
-  Standard_Integer I = theSeq.Length();
-  while ( I>0 && theSeq.Value(I) != theItem) {    
-    I--;
+  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;
+
+  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);     
+    }
 
-  if (!IsInSeq (myReferences, anotherIObj)) {
-    myReferences.Append(anotherIObj);
+    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);
+      }
+    }
+  }
 }
index 97908392497bb57fd1c102d6d88b8c0f98b5f098..9c37240705d2619bb8be9dfcc82f8715a18904fb 100644 (file)
 //
 // 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;
-}
diff --git a/src/AIS/AIS_MultipleConnectedShape.cdl b/src/AIS/AIS_MultipleConnectedShape.cdl
deleted file mode 100644 (file)
index c58a5b1..0000000
+++ /dev/null
@@ -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;
diff --git a/src/AIS/AIS_MultipleConnectedShape.cxx b/src/AIS/AIS_MultipleConnectedShape.cxx
deleted file mode 100644 (file)
index 4fef33c..0000000
+++ /dev/null
@@ -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);
-  
-}
-
-  
-  
-  
diff --git a/src/AIS/AIS_MultipleConnectedShape.lxx b/src/AIS/AIS_MultipleConnectedShape.lxx
deleted file mode 100644 (file)
index 91cf033..0000000
+++ /dev/null
@@ -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;
-}
-
index 51aa9ab578e7a2659905618920d37b876e0edad8..416f39274c508bac6e79d0bb0db08eb5dcad81cc 100644 (file)
@@ -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
index 660f5505dd733e26c528320211d864f61cfe357c..544e5b04a22dba2e8c73a2c76fb4471a4bf63211 100644 (file)
@@ -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
 
index 1cc77c89c94ba1470451752afb5f78b17afaf768..a53df314f6e0f98a6747d202dc94ffe79601c7ca 100644 (file)
@@ -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);
 }
 
 //=======================================================================
index f0231affd90dcb81c0cf753480d053580e96a4a4..7c5d470b498794e6468ce2b4c05efae29609feae 100644 (file)
@@ -911,10 +911,17 @@ is
   is static private;
   ---Purpose: Returns the extreme coordinates found in the structure <me> without transformation applied.
 
+  getBox (me;
+          theBox : out BndBox4d from Graphic3d;
+          theToIgnoreInfiniteFlag : Boolean from Standard = Standard_False)
+  is static private;
+  ---Purpose: Gets untransformed bounding box from structure.
+
   addTransformed (me;
                   theBox : out BndBox4d from Graphic3d;
                   theToIgnoreInfiniteFlag : Boolean from Standard = Standard_False)
   is static private;
+  ---Purpose: Adds transformed (with myCStructure->Transformation) bounding box of structure to theBox.
 
        PrintNetwork ( myclass;
                       AStructure       : Structure from Graphic3d;
index 884967a9af92942f96ab8a742fdcec1ad8077be0..e66e2ec58de52affc88beb4becfdd8708240f82a 100644 (file)
@@ -1838,29 +1838,28 @@ Graphic3d_BndBox4f Graphic3d_Structure::minMaxCoord (const Standard_Boolean theT
 //function : addTransformed
 //purpose  :
 //=============================================================================
-void Graphic3d_Structure::addTransformed (Graphic3d_BndBox4d&    theBox,
-                                          const Standard_Boolean theToIgnoreInfiniteFlag) const
+void Graphic3d_Structure::getBox (Graphic3d_BndBox4d&    theBox,
+                                  const Standard_Boolean theToIgnoreInfiniteFlag) const
 {
-  Graphic3d_BndBox4d aBox;
   Graphic3d_BndBox4f aBoxF = minMaxCoord (theToIgnoreInfiniteFlag);
   if (aBoxF.IsValid())
   {
-    aBox = Graphic3d_BndBox4d (Graphic3d_Vec4d ((Standard_Real )aBoxF.CornerMin().x(),
-                                                (Standard_Real )aBoxF.CornerMin().y(),
-                                                (Standard_Real )aBoxF.CornerMin().z(),
-                                                (Standard_Real )aBoxF.CornerMin().w()),
-                               Graphic3d_Vec4d ((Standard_Real )aBoxF.CornerMax().x(),
-                                                (Standard_Real )aBoxF.CornerMax().y(),
-                                                (Standard_Real )aBoxF.CornerMax().z(),
-                                                (Standard_Real )aBoxF.CornerMax().w()));
+    theBox = Graphic3d_BndBox4d (Graphic3d_Vec4d ((Standard_Real )aBoxF.CornerMin().x(),
+                                                  (Standard_Real )aBoxF.CornerMin().y(),
+                                                  (Standard_Real )aBoxF.CornerMin().z(),
+                                                  (Standard_Real )aBoxF.CornerMin().w()),
+                                 Graphic3d_Vec4d ((Standard_Real )aBoxF.CornerMax().x(),
+                                                  (Standard_Real )aBoxF.CornerMax().y(),
+                                                  (Standard_Real )aBoxF.CornerMax().z(),
+                                                  (Standard_Real )aBoxF.CornerMax().w()));
     if (IsInfinite()
     && !theToIgnoreInfiniteFlag)
     {
-      const Graphic3d_Vec4d aDiagVec = aBox.CornerMax() - aBox.CornerMin();
+      const Graphic3d_Vec4d aDiagVec = theBox.CornerMax() - theBox.CornerMin();
       if (aDiagVec.xyz().SquareModulus() >= 500000.0 * 500000.0)
       {
         // bounding borders of infinite line has been calculated as own point in center of this line
-        aBox = Graphic3d_BndBox4d ((aBox.CornerMin() + aBox.CornerMax()) * 0.5);
+        theBox = Graphic3d_BndBox4d ((theBox.CornerMin() + theBox.CornerMax()) * 0.5);
       }
       else
       {
@@ -1870,20 +1869,42 @@ void Graphic3d_Structure::addTransformed (Graphic3d_BndBox4d&    theBox,
       }
     }
   }
+}
+
+//=============================================================================
+//function : addTransformed
+//purpose  :
+//=============================================================================
+void Graphic3d_Structure::addTransformed (Graphic3d_BndBox4d&    theBox,
+                                          const Standard_Boolean theToIgnoreInfiniteFlag) const
+{
+  Graphic3d_BndBox4d aCombinedBox, aBox;
+  getBox (aCombinedBox, theToIgnoreInfiniteFlag);
 
   for (Standard_Integer aStructIt = 1; aStructIt <= myDescendants.Length(); ++aStructIt)
   {
     const Graphic3d_Structure* aStruct = (const Graphic3d_Structure* )myDescendants.Value (aStructIt);
-    aStruct->addTransformed (aBox, theToIgnoreInfiniteFlag);
+    aStruct->getBox (aBox, theToIgnoreInfiniteFlag);
+    aCombinedBox.Combine (aBox);
   }
 
+  aBox = aCombinedBox;
   if (aBox.IsValid())
   {
     TColStd_Array2OfReal aTrsf (0, 3, 0, 3);
     Transform (aTrsf);
     TransformBoundaries (aTrsf, aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
                                 aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
-    theBox.Combine (aBox);
+
+    // if box is still valid after transformation
+    if (aBox.IsValid())
+    {
+      theBox.Combine (aBox);
+    }
+    else // it was infinite, return untransformed
+    {
+      theBox.Combine (aCombinedBox);
+    }
   }
 }
 
index ec54411052287f7556575cb37ac3ecd690f07b65..d9c27b1c7b980fb9e463cec9f074738f39254638 100644 (file)
@@ -606,6 +606,20 @@ void OpenGl_Structure::Clear (const Handle(OpenGl_Context)& theGlCtx)
   IsForHighlight = Standard_False;
 }
 
+// =======================================================================
+// function : RenderGeometry
+// purpose  :
+// =======================================================================
+void OpenGl_Structure::RenderGeometry (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+  // Render groups
+  const Graphic3d_SequenceOfGroup& aGroups = DrawGroups();
+  for (OpenGl_Structure::GroupIterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
+  {
+    aGroupIter.Value()->Render (AWorkspace);
+  }
+}
+
 // =======================================================================
 // function : Render
 // purpose  :
@@ -693,7 +707,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
   OpenGl_ListOfStructure::Iterator its(myConnected);
   while (its.More())
   {
-    its.Value()->Render(AWorkspace);
+    its.Value()->RenderGeometry (AWorkspace);
     its.Next();
   }
 
index 48569aefa01827228d99ee8676f6c11c34a44ec4..d603cea93d4902f3ea7429b2d3685edeaa432117 100644 (file)
@@ -139,8 +139,14 @@ public:
   //! Get z layer ID
   Standard_EXPORT Standard_Integer GetZLayer() const;
 
+  //! Renders groups of structure without applying any attributes (i.e. transform, material etc).
+  virtual void RenderGeometry  (const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+  //! Renders the structure.
   virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
-  virtual void Release (const Handle(OpenGl_Context)&   theGlCtx);
+
+  //! Releases structure resources.
+  virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
 
   //! Marks structure as not overlapping view volume (as it is by default).
   void ResetCullingStatus() const
index d122e43e340198651dbb0ee74d7ece7240ef93d8..fa4a05f2bc0fdacf4a12b6e085d857fbecd255f1 100755 (executable)
@@ -448,8 +448,12 @@ protected: //! @name methods related to ray-tracing
   Standard_Boolean UpdateRaytraceEnvironmentMap();
 
   //! Adds OpenGL structure to ray-traced scene geometry.
-  Standard_Boolean AddRaytraceStructure (const OpenGl_Structure* theStructure,
-    const Standard_ShortReal* theTransform, std::set<const OpenGl_Structure*>& theElements);
+  Standard_Boolean AddRaytraceStructure (const OpenGl_Structure* theStructure, std::set<const OpenGl_Structure*>& theElements);
+
+  //! Adds OpenGL groups to ray-traced scene geometry.
+  Standard_Boolean AddRaytraceGroups (const OpenGl_Structure*   theStructure,
+                                      const Standard_Integer    theStructMatId,
+                                      const Standard_ShortReal* theTransform);
 
   //! Adds OpenGL primitive array to ray-traced scene geometry.
   OpenGl_TriangleSet* AddRaytracePrimitiveArray (
old mode 100755 (executable)
new mode 100644 (file)
index f336ac9..3c408ce
@@ -105,8 +105,6 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
 
       for (aStructIt.Init (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
       {
-        Standard_ShortReal* aTransform (NULL);
-
         const OpenGl_Structure* aStructure = aStructIt.Value();
 
         if (theMode == OpenGl_GUM_CHECK)
@@ -142,22 +140,8 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
           if (!aStructure->IsRaytracable())
             continue;
 
-          if (aStructure->Transformation()->mat != NULL)
-          {
-            if (aTransform == NULL)
-              aTransform = new Standard_ShortReal[16];
-
-            for (Standard_Integer i = 0; i < 4; ++i)
-              for (Standard_Integer j = 0; j < 4; ++j)
-              {
-                aTransform[j * 4 + i] = aStructure->Transformation()->mat[i][j];
-              }
-          }
-
-          AddRaytraceStructure (aStructure, aTransform, anElements);
+          AddRaytraceStructure (aStructure, anElements);
         }
-
-        delete [] aTransform;
       }
     }
   }
@@ -311,8 +295,7 @@ void CreateMaterial (const OPENGL_SURF_PROP& theProp, OpenGl_RaytraceMaterial& t
 // function : AddRaytraceStructure
 // purpose  : Adds OpenGL structure to ray-traced scene geometry
 // =======================================================================
-Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure* theStructure,
-  const Standard_ShortReal* theTransform, std::set<const OpenGl_Structure*>& theElements)
+Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure* theStructure, std::set<const OpenGl_Structure*>& theElements)
 {
   theElements.insert (theStructure);
 
@@ -335,6 +318,41 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
     myRaytraceGeometry.Materials.push_back (aStructMaterial);
   }
 
+  Standard_ShortReal  aStructTransformArr[16];
+  Standard_ShortReal* aStructTransform = NULL;
+  if (theStructure->Transformation()->mat != NULL)
+  {
+    aStructTransform = aStructTransformArr;
+    for (Standard_Integer i = 0; i < 4; ++i)
+    {
+      for (Standard_Integer j = 0; j < 4; ++j)
+      {
+        aStructTransform[j * 4 + i] = theStructure->Transformation()->mat[i][j];
+      }
+    }
+  }
+
+  AddRaytraceGroups (theStructure, aStructMatID, aStructTransform);
+
+  // Process all connected OpenGL structures
+  for (OpenGl_ListOfStructure::Iterator anIts (theStructure->ConnectedStructures()); anIts.More(); anIts.Next())
+  {
+    if (anIts.Value()->IsRaytracable())
+      AddRaytraceGroups (anIts.Value(), aStructMatID, aStructTransform);
+  }
+
+  myStructureStates[theStructure] = theStructure->ModificationState();
+  return Standard_True;
+}
+
+// =======================================================================
+// function : AddRaytraceGroups
+// purpose  : Adds OpenGL groups to ray-traced scene geometry
+// =======================================================================
+Standard_Boolean OpenGl_Workspace::AddRaytraceGroups (const OpenGl_Structure*   theStructure,
+                                                      const Standard_Integer    theStructMatId,
+                                                      const Standard_ShortReal* theTransform)
+{
   for (OpenGl_Structure::GroupIterator aGroupIter (theStructure->DrawGroups()); aGroupIter.More(); aGroupIter.Next())
   {
     // Get group material
@@ -349,7 +367,7 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
       myRaytraceGeometry.Materials.push_back (aGroupMaterial);
     }
 
-    Standard_Integer aMatID = aGroupMatID < 0 ? aStructMatID : aGroupMatID;
+    Standard_Integer aMatID = aGroupMatID < 0 ? theStructMatId : aGroupMatID;
 
     if (aMatID < 0)
     {
@@ -421,32 +439,6 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
     }
   }
 
-  Standard_ShortReal* aTransform = NULL;
-
-  // Process all connected OpenGL structures
-  for (OpenGl_ListOfStructure::Iterator anIts (theStructure->ConnectedStructures()); anIts.More(); anIts.Next())
-  {
-    if (anIts.Value()->Transformation()->mat != NULL)
-    {
-      if (aTransform == NULL)
-        aTransform = new Standard_ShortReal[16];
-
-      for (Standard_Integer i = 0; i < 4; ++i)
-        for (Standard_Integer j = 0; j < 4; ++j)
-        {
-          aTransform[j * 4 + i] =
-            anIts.Value()->Transformation()->mat[i][j];
-        }
-    }
-
-    if (anIts.Value()->IsRaytracable())
-      AddRaytraceStructure (anIts.Value(), aTransform != NULL ? aTransform : theTransform, theElements);
-  }
-
-  delete[] aTransform;
-
-  myStructureStates[theStructure] = theStructure->ModificationState();
-
   return Standard_True;
 }
 
index bc7af4c88d17ae17033c608cfdb3674896300b42..6c58657be7f6f3581dc17b79e19e67581351c0a3 100644 (file)
@@ -1 +1,2 @@
 PrsMgr_ListOfPresentations.hxx
+PrsMgr_ListOfPresentableObjects.hxx
index e6f817ec66cf2ae7f41e80238a8d43d2d7a46b10..990c74914d8a0a438f1e51a599fc4f69187c6bf6 100644 (file)
@@ -57,6 +57,7 @@ is
     deferred class PresentableObject;
 
     imported ListOfPresentations;
+    imported ListOfPresentableObjects;
 
     class Prs;
 
diff --git a/src/PrsMgr/PrsMgr_ListOfPresentableObjects.hxx b/src/PrsMgr/PrsMgr_ListOfPresentableObjects.hxx
new file mode 100644 (file)
index 0000000..873aec4
--- /dev/null
@@ -0,0 +1,26 @@
+// Created on: 2014-08-11
+// Created by: duv
+// Copyright (c) 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 _PrsMgr_ListOfPresentableObjects_HeaderFile
+#define _PrsMgr_ListOfPresentableObjects_HeaderFile
+
+#include <PrsMgr_PresentableObject.hxx>
+#include <NCollection_List.hxx>
+
+typedef NCollection_List<Handle(PrsMgr_PresentableObject)> PrsMgr_ListOfPresentableObjects;
+typedef NCollection_List<Handle(PrsMgr_PresentableObject)>::Iterator PrsMgr_ListOfPresentableObjectsIter;
+
+
+#endif // _PrsMgr_ListOfPresentableObjects_HeaderFile
index 9b88fe54fff6100a5fe7ece4f4963102d651d963..c4a26f70de0e21f44785ba6e2b9b560ce92a717d 100644 (file)
@@ -48,23 +48,26 @@ deferred class PresentableObject from PrsMgr inherits TShared from MMgt
        -- creation of new interactive objects.
 
 uses
-    Presentation          from PrsMgr,
-    Presentation          from Prs3d,
-    Presentations         from PrsMgr,
-    PresentationManager   from PrsMgr,
-    PresentationManager3d from PrsMgr,
-    TypeOfPresentation3d  from PrsMgr,
-    DataStructureManager  from Graphic3d,
-    Projector             from Prs3d,
-    Transformation        from Geom,
-    ListOfInteger         from TColStd,
-    Location              from TopLoc, 
-    ClipPlane_Handle      from Graphic3d,
-    SequenceOfHClipPlane  from Graphic3d,
+    Presentation           from PrsMgr,
+    Presentation           from Prs3d,
+    Presentations          from PrsMgr,
+    PresentationManager    from PrsMgr,
+    PresentationManager3d  from PrsMgr,
+    TypeOfPresentation3d   from PrsMgr,
+    ListOfPresentableObjects from PrsMgr,
+    PresentableObjectPointer from PrsMgr,
+    DataStructureManager   from Graphic3d,
+    Projector              from Prs3d,
+    Transformation         from Geom,
+    ListOfInteger          from TColStd,
+    Location               from TopLoc, 
+    ClipPlane_Handle       from Graphic3d,
+    SequenceOfHClipPlane   from Graphic3d,
     --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
-    TransModeFlags        from Graphic3d, 
-    Pnt                   from gp, 
-    CTransPersStruct      from  Graphic3d      
+    TransModeFlags         from Graphic3d, 
+    Pnt                    from gp,
+    Trsf                   from gp, 
+    CTransPersStruct       from  Graphic3d      
     --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
 
 raises
@@ -73,6 +76,7 @@ is
 
 
     Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
+      ---C++: alias "Standard_EXPORT virtual ~PrsMgr_PresentableObject();"
     
 ---Category: deferred methods.
 --           
@@ -149,7 +153,7 @@ is
     -- is static private;
     
     Presentations(me : mutable) returns Presentations from PrsMgr
-    is static protected;
+    is static;
        ---C++: return &
             
    TypeOfPresentation3d(me) returns TypeOfPresentation3d from PrsMgr
@@ -218,19 +222,30 @@ is
    ToBeUpdated(me;ListOfMode : out ListOfInteger from TColStd);
    ---Purpose: gives the list of modes which are flagged "to be updated".
     
-   SetLocation(me:mutable;aLoc:Location from TopLoc) is virtual;
+   SetLocalTransformation(me:mutable; theTransformation:Trsf from gp) is virtual;
+   ---Purpose: Sets local transformation to theTransformation.
+
+   SetCombinedParentTransform(me:mutable; theTransformation:Trsf from gp) is virtual protected;
+   ---Purpose: Sets myCombinedParentTransform to theTransformation. Thus object receives transformation
+   -- from parent node and able to derive its own.
     
-   HasLocation(me) returns Boolean from Standard;
+   HasTransformation(me) returns Boolean from Standard;
+   ---Purpose: Returns true if object has a transformation that is different from the identity.
    
-   Location(me) returns any Location from TopLoc;
+   LocalTransformation(me) returns any Trsf from gp;
+   ---C++: inline
+   ---C++: return const&
+
+   Transformation(me) returns any Trsf from gp;
    ---C++: inline
    ---C++: return const&
    
-   ResetLocation(me:mutable)  is virtual;
+   ResetTransformation(me:mutable)  is virtual;
+   ---Purpose: resets local transformation to identity.
 
-   UpdateLocation(me:mutable) is virtual;
+   UpdateTransformation(me:mutable) is virtual;
     
-   UpdateLocation(me:mutable;P : Presentation from Prs3d) is virtual;
+   UpdateTransformation(me:mutable;P : Presentation from Prs3d) is virtual;
     
    SetZLayer ( me         : mutable;
                thePrsMgr  : PresentationManager from PrsMgr;
@@ -287,6 +302,26 @@ is
   ---Purpose: Returns true if object has mutable nature (content or location are be changed regularly).
   -- Mutable object will be managed in different way than static onces (another optimizations).
 
+  AddChild ( me           : mutable;
+             theObject    : PresentableObject from PrsMgr ) is virtual;
+    --- Purpose: Makes theObject child of current object in scene hierarchy. 
+
+  RemoveChild ( me           : mutable;
+                theObject    : PresentableObject from PrsMgr ) is virtual;
+    --- Purpose: Removes theObject from children of current object in scene hierarchy. 
+
+  Children (me) returns ListOfPresentableObjects from PrsMgr is static;
+    ---C++: return const&
+    --- Purpose: Returns children of the current object.
+
+  HasOwnPresentations (me) returns Boolean from Standard is static;
+    ---C++: return const
+    --- Purpose: Returns true if object should have own presentations.
+
+  Parent (me) returns PresentableObjectPointer from PrsMgr is static;
+    ---C++: return const
+    --- Purpose: Returns parent of current object in scene hierarchy.
+
    UpdateClipping (me : mutable) is virtual protected;
    ---Purpose: General virtual method for internal update of presentation state
    -- when some modifications on list of clip planes occurs. Base 
@@ -295,11 +330,21 @@ is
 fields
     myPresentations: Presentations from PrsMgr is protected;
     myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
-    myLocation  : Location from TopLoc is protected; 
     myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected;
     myTransformPersistence  :  CTransPersStruct  from  Graphic3d;
     myIsMutable : Boolean from Standard is protected;
 
+
+    myHasOwnPresentations : Boolean from Standard is protected; -- shows if object should have own presentations.
+
+    myParent : PresentableObjectPointer from PrsMgr; -- Reference to parent object in scene hierarchy.
+    myLocalTransformation : Trsf from gp;     -- Own transformation of presentable object.
+    myTransformation : Trsf from gp;          -- Combined transformation of presentable object.
+    myCombinedParentTransform : Trsf from gp; -- Combined transformation of presentable object excepting local transformation.
+
+    myChildren : ListOfPresentableObjects from PrsMgr; -- Child objects in scene hierarchy.
+
 friends
     class Presentation        from PrsMgr,
     class PresentationManager from PrsMgr,
index b1535eb5efff3a384263666fb3ef61dc9ddc097f..84c928485e7a5ca20fbcca9eeee63e8eb56d677f 100644 (file)
@@ -29,7 +29,9 @@
 //=======================================================================
 PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
 : myTypeOfPresentation3d (theType),
-  myIsMutable (Standard_False)
+  myIsMutable (Standard_False),
+  myHasOwnPresentations (Standard_True),
+  myParent (NULL)
 {
   myTransformPersistence.Flag = 0;
   myTransformPersistence.Point.x = 0.0;
@@ -37,6 +39,20 @@ PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentat
   myTransformPersistence.Point.z = 0.0;
 }
 
+//=======================================================================
+//function : ~PrsMgr_PresentableObject
+//purpose  : destructor
+//=======================================================================
+PrsMgr_PresentableObject::~PrsMgr_PresentableObject()
+{
+  gp_Trsf anIdentity;
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (myChildren); anIter.More(); anIter.Next())
+  {
+    anIter.Value()->SetCombinedParentTransform (anIdentity);
+    anIter.Value()->myParent = NULL;
+  }
+}
+
 //=======================================================================
 //function : Fill
 //purpose  : 
@@ -47,7 +63,7 @@ void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& t
 {
   Handle(Prs3d_Presentation) aStruct3d = thePrs->Presentation();
   Compute (thePrsMgr, aStruct3d, theMode);
-  UpdateLocation (aStruct3d);
+  UpdateTransformation (aStruct3d);
   aStruct3d->SetClipPlanes (myClipPlanes);
   aStruct3d->SetTransformPersistence (GetTransformPersistenceMode(), GetTransformPersistencePoint());
 }
@@ -148,12 +164,12 @@ PrsMgr_Presentations& PrsMgr_PresentableObject::Presentations() {
 }
 
 //=======================================================================
-//function : HasLocation
+//function : HasTransformation
 //purpose  : 
 //=======================================================================
-Standard_Boolean PrsMgr_PresentableObject::HasLocation() const 
+Standard_Boolean PrsMgr_PresentableObject::HasTransformation() const 
 {
-  return !Location().IsIdentity();
+  return myTransformation.Form() != gp_Identity;
 }
 
 //=======================================================================
@@ -217,64 +233,64 @@ void PrsMgr_PresentableObject::SetTypeOfPresentation (const PrsMgr_TypeOfPresent
 }
 
 //=======================================================================
-//function : SetLocation
+//function : SetLocalTransformation
 //purpose  : WARNING : use with only 3D objects...
 //=======================================================================
-void PrsMgr_PresentableObject::SetLocation(const TopLoc_Location& aLoc
+void PrsMgr_PresentableObject::SetLocalTransformation (const gp_Trsf& theTransformation
 {
-  if(aLoc.IsIdentity()) return;
-  myLocation = aLoc;
-  UpdateLocation();
+  myLocalTransformation = theTransformation;
+  UpdateTransformation();
 }
 
 //=======================================================================
-//function : ReSetLocation
+//function : ResetTransformation
 //purpose  : 
 //=======================================================================
-void PrsMgr_PresentableObject::ResetLocation() 
+void PrsMgr_PresentableObject::ResetTransformation() 
 {
-  TopLoc_Location aLoc;
-  Handle(Geom_Transformation) aTrsf = new Geom_Transformation (aLoc.Transformation());
-  for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
-  {
-    myPresentations (aPrsIter).Presentation()->Transform (aTrsf);
-  }
-  myLocation = aLoc;
+  SetLocalTransformation (gp_Trsf());  
 }
 
 //=======================================================================
-//function : UpdateLocation
+//function : SetCombinedParentTransform
+//purpose  : 
+//=======================================================================
+void PrsMgr_PresentableObject::SetCombinedParentTransform (const gp_Trsf& theTransformation) 
+{
+  myCombinedParentTransform = theTransformation;
+  UpdateTransformation();
+}
+
+//=======================================================================
+//function : UpdateTransformation
 //purpose  :
 //=======================================================================
-void PrsMgr_PresentableObject::UpdateLocation()
+void PrsMgr_PresentableObject::UpdateTransformation()
 {
-  if (!HasLocation())
-  {
-    return;
-  }
+  myTransformation = myCombinedParentTransform * myLocalTransformation;
+  Handle(Geom_Transformation) aTrsf = new Geom_Transformation (myTransformation);
 
-  Handle(Geom_Transformation) aTrsf = new Geom_Transformation (Location().Transformation());
-  if (aTrsf->Trsf().Form() == gp_Identity)
+  for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
   {
-    return;
+    myPresentations (aPrsIter).Presentation()->Transform (aTrsf);
   }
+  
+  PrsMgr_ListOfPresentableObjectsIter anIter (myChildren);
 
-  for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
+  for (; anIter.More(); anIter.Next())
   {
-    myPresentations (aPrsIter).Presentation()->Transform (aTrsf);
+    anIter.Value()->SetCombinedParentTransform (myTransformation);
   }
 }
 
 //=======================================================================
-//function : UpdateLocation
+//function : UpdateTransformation
 //purpose  : 
 //=======================================================================
-void PrsMgr_PresentableObject::UpdateLocation(const Handle(Prs3d_Presentation)& P)
+void PrsMgr_PresentableObject::UpdateTransformation(const Handle(Prs3d_Presentation)& P)
 {
-  if(myLocation.IsIdentity()) return;
-  Handle(Geom_Transformation) G = new Geom_Transformation(Location().Transformation());
-  P->Transform(G);
-  
+  Handle(Geom_Transformation) aTrsf = new Geom_Transformation (myTransformation);
+  P->Transform (aTrsf);  
 }
 
 //=======================================================================
@@ -328,6 +344,42 @@ gp_Pnt  PrsMgr_PresentableObject::GetTransformPersistencePoint() const
   return gp_Pnt( myTransformPersistence.Point.x, myTransformPersistence.Point.y, myTransformPersistence.Point.z );
 }
 
+//=======================================================================
+//function : AddChild
+//purpose  : 
+//=======================================================================
+void PrsMgr_PresentableObject::AddChild (const Handle(PrsMgr_PresentableObject)& theObject)
+{
+  Handle(PrsMgr_PresentableObject) aHandleGuard = theObject;
+  if (theObject->myParent != NULL)
+  {
+    theObject->myParent->RemoveChild (aHandleGuard);
+  }
+
+  myChildren.Append (theObject);  
+  theObject->myParent = this;
+  theObject->SetCombinedParentTransform (myTransformation);
+}
+
+//=======================================================================
+//function : RemoveChild
+//purpose  : 
+//=======================================================================
+void PrsMgr_PresentableObject::RemoveChild (const Handle(PrsMgr_PresentableObject)& theObject)
+{
+  PrsMgr_ListOfPresentableObjectsIter anIter (myChildren);
+  for (; anIter.More(); anIter.Next())
+  {
+    if (anIter.Value() == theObject)
+    {
+      theObject->myParent = NULL;
+      theObject->SetCombinedParentTransform (gp_Trsf());
+      myChildren.Remove (anIter);
+      break;
+    }
+  }
+}
+
 //=======================================================================
 //function : SetZLayer
 //purpose  :
index 4a27926598497f9686e42c606e27071edabcb825..86f34921ae367cf31fe62521ea3616eecee1aedf 100644 (file)
@@ -18,8 +18,30 @@ inline PrsMgr_TypeOfPresentation3d PrsMgr_PresentableObject::TypeOfPresentation3
 {return myTypeOfPresentation3d;}
 
 
-inline const TopLoc_Location& PrsMgr_PresentableObject::Location() const
-{return myLocation;}
+inline const gp_Trsf& PrsMgr_PresentableObject::LocalTransformation() const
+{
+  return myLocalTransformation;
+}
+
+inline const gp_Trsf& PrsMgr_PresentableObject::Transformation() const
+{
+  return myTransformation;
+}
+
+inline const PrsMgr_ListOfPresentableObjects& PrsMgr_PresentableObject::Children() const 
+{
+  return myChildren;
+}
+
+inline const Standard_Boolean PrsMgr_PresentableObject::HasOwnPresentations() const
+{
+  return myHasOwnPresentations;
+}
+
+inline const PrsMgr_PresentableObjectPointer PrsMgr_PresentableObject::Parent() const
+{
+  return myParent;
+}
 
 inline const Graphic3d_SequenceOfHClipPlane& PrsMgr_PresentableObject::GetClipPlanes() const
 {
index 8bda94e299b3977573f9b429e2a0b721e9b7a6c3..970982d2b2c0e9a15722ac1c06b4c22ca73ae692 100644 (file)
@@ -199,36 +199,6 @@ is
   -- thePrsObject has the display mode theMode; this has the default value of 0, that is, the wireframe display mode.
   is static;
 
-  Place (me           : mutable;
-         thePrsObject : PresentableObject from PrsMgr;
-         X, Y, Z      : Length from Quantity;
-         theMode      : Integer from Standard = 0)
-  ---Purpose:
-  -- Sets a position to move the presentable object
-  -- aPresentableObject to. This position is defined by the
-  -- lengths along the x, y and z axes: X, Y and Z respectively.
-  -- aPresentableObject has the display mode aMode;
-  -- this has the default value of 0, that is, the wireframe display mode.
-  is static;
-
-  Multiply  (me                : mutable;
-             thePrsObject      : PresentableObject from PrsMgr;
-             theTransformation : Transformation from Geom;
-             theMode           : Integer from Standard = 0)
-  ---Purpose:
-  -- Defines the transformation theTransformation for the presentable object thePrsObject.
-  -- thePrsObject has the display mode aMode; this has the default value of 0, that is, the wireframe display mode.
-  is static;
-
-  Move (me           : mutable;
-        thePrsObject : PresentableObject from PrsMgr;
-        X, Y, Z      : Length from Quantity;
-        theMode      : Integer from Standard = 0)
-  ---Purpose:
-  -- Sets a position to move the presentable object thePrsObject to. This position is defined by the lengths along the x, y and z axes: X, Y and Z respectively.
-  -- thePrsObject has the display mode aMode; this has the default value of 0, that is, the wireframe display mode.
-  is static;
-
   StructureManager (me) returns StructureManager from Graphic3d
   is static;
   ---C++: inline
index 72028a7ccecd69d01f1c1e129e8386a41b794b64..a834ed4d03ba1f804e9eec244195f7b9b283a354 100644 (file)
@@ -43,24 +43,39 @@ PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_S
 void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                           const Standard_Integer                  theMode)
 {
-  if (!HasPresentation (thePrsObj, theMode))
+  if (thePrsObj->HasOwnPresentations())
   {
-    AddPresentation (thePrsObj, theMode);
-  }
+    if (!HasPresentation (thePrsObj, theMode))
+    {
+      AddPresentation (thePrsObj, theMode);
+    }
 
-  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
-  if (aPrs->MustBeUpdated())
-  {
-    Update (thePrsObj, theMode);
-  }
+    Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
 
-  if (myImmediateModeOn > 0)
-  {
-    AddToImmediateList (aPrs->Presentation());
+    if (aPrs.IsNull()) return;
+
+    if (aPrs->MustBeUpdated())
+    {
+      Update (thePrsObj, theMode);
+    }
+
+    if (myImmediateModeOn > 0)
+    {
+      AddToImmediateList (aPrs->Presentation());
+    }
+    else
+    {
+      aPrs->Display();
+    }
   }
   else
   {
-    aPrs->Display();
+    thePrsObj->Compute (this, Handle(Prs3d_Presentation)(), theMode);
+  }
+
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Display (anIter.Value(), theMode);
   }
 }
 
@@ -71,6 +86,11 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)
 void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                         const Standard_Integer                  theMode)
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Erase (anIter.Value(), theMode);
+  }
+
   if (HasPresentation (thePrsObj, theMode))
   {
     Presentation (thePrsObj, theMode)->Erase();
@@ -85,6 +105,11 @@ void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)&
 void PrsMgr_PresentationManager::Clear (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                         const Standard_Integer                  theMode)
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Clear (anIter.Value(), theMode);
+  }
+
   if (HasPresentation (thePrsObj, theMode))
   {
     Presentation (thePrsObj, theMode)->Clear();
@@ -95,11 +120,20 @@ void PrsMgr_PresentationManager::Clear (const Handle(PrsMgr_PresentableObject)&
 // function : SetVisibility
 // purpose  :
 // =======================================================================
-void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableObject)& thePresentableObject,
+void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                 const Standard_Integer theMode,
                                                 const Standard_Boolean theValue)
 {
-  Presentation(thePresentableObject, theMode)->SetVisible (theValue);
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    SetVisibility (anIter.Value(), theMode, theValue);
+  }
+  if (!thePrsObj->HasOwnPresentations())
+  {
+    return;
+  }
+
+  Presentation (thePrsObj, theMode)->SetVisible (theValue);
 }
 
 // =======================================================================
@@ -109,11 +143,22 @@ void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableO
 void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                             const Standard_Integer                  theMode)
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Highlight (anIter.Value(), theMode);
+  }
+  if (!thePrsObj->HasOwnPresentations())
+  {
+    return;
+  }
+
   if (!HasPresentation (thePrsObj, theMode))
   {
     AddPresentation (thePrsObj, theMode);
   }
 
+  if (!HasPresentation (thePrsObj, theMode)) return;
+
   Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
   if (aPrs->MustBeUpdated())
   {
@@ -139,6 +184,11 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
 void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                               const Standard_Integer                  theMode)
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Unhighlight (anIter.Value(), theMode);
+  }
+
   if (HasPresentation (thePrsObj, theMode))
   {
     Presentation (thePrsObj, theMode)->Unhighlight();
@@ -153,6 +203,11 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present
                                                      const Standard_Integer                  theMode,
                                                      const Standard_Integer                  theNewPrior) const
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    SetDisplayPriority (anIter.Value(), theMode, theNewPrior);
+  }
+
   if (HasPresentation (thePrsObj, theMode))
   {
     Presentation (thePrsObj, theMode)->SetDisplayPriority (theNewPrior);
@@ -166,6 +221,15 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present
 Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                               const Standard_Integer                  theMode) const
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Standard_Integer aPriority = DisplayPriority (anIter.Value(), theMode);
+    if (aPriority != 0)
+    {
+      return aPriority;
+    }
+  }
+
   return HasPresentation (thePrsObj, theMode)
        ? Presentation (thePrsObj, theMode)->DisplayPriority()
        : 0;
@@ -178,6 +242,14 @@ Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMg
 Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                           const Standard_Integer                  theMode) const
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    if (IsDisplayed (anIter.Value(), theMode))
+    {
+      return Standard_True;
+    }
+  }
+
   return HasPresentation (thePrsObj, theMode)
       && Presentation    (thePrsObj, theMode)->IsDisplayed();
 }
@@ -189,6 +261,14 @@ Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (const Handle(PrsMgr_Pr
 Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                             const Standard_Integer                  theMode) const
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    if (IsHighlighted (anIter.Value(), theMode))
+    {
+      return Standard_True;
+    }
+  }
+
   return HasPresentation (thePrsObj, theMode)
       && Presentation    (thePrsObj, theMode)->IsHighlighted();
 }
@@ -200,6 +280,10 @@ Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (const Handle(PrsMgr_
 void PrsMgr_PresentationManager::Update (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                          const Standard_Integer                  theMode) const
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Update (anIter.Value(), theMode);
+  }
   if (!HasPresentation(thePrsObj, theMode))
   {
     return;
@@ -299,6 +383,9 @@ void PrsMgr_PresentationManager::AddToImmediateList (const Handle(Prs3d_Presenta
 Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                               const Standard_Integer                  theMode) const
 {
+  if (!thePrsObj->HasOwnPresentations())
+    return Standard_False;
+
   const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
   for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
   {
@@ -388,6 +475,14 @@ void PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_Present
 void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                             const Standard_Integer                  theLayerId)
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    SetZLayer (anIter.Value(), theLayerId);
+  }
+  if (!thePrsObj->HasOwnPresentations())
+  {
+    return;
+  }
   PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
   for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
   {
@@ -405,6 +500,18 @@ void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObjec
 // =======================================================================
 Standard_Integer PrsMgr_PresentationManager::GetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj) const
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Standard_Integer aLayer = GetZLayer (anIter.Value());
+    if (aLayer != -1)
+    {
+      return aLayer;
+    }
+  }
+  if (!thePrsObj->HasOwnPresentations())
+  {
+    return -1;
+  }
   const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
   for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
   {
@@ -448,42 +555,6 @@ void PrsMgr_PresentationManager::Transform (const Handle(PrsMgr_PresentableObjec
   Presentation (thePrsObj, theMode)->Transform (theTransformation);
 }
 
-// =======================================================================
-// function : Place
-// purpose  :
-// =======================================================================
-void PrsMgr_PresentationManager::Place (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                        const Quantity_Length                   theX,
-                                        const Quantity_Length                   theY,
-                                        const Quantity_Length                   theZ,
-                                        const Standard_Integer                  theMode)
-{
-  Presentation (thePrsObj, theMode)->Place (theX, theY, theZ);
-}
-
-// =======================================================================
-// function : Multiply
-// purpose  :
-// =======================================================================
-void PrsMgr_PresentationManager::Multiply (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                           const Handle(Geom_Transformation)&      theTransformation,
-                                           const Standard_Integer                  theMode)
-{
-  Presentation (thePrsObj, theMode)->Multiply (theTransformation);
-}
-
-// =======================================================================
-// function : Move
-// purpose  :
-// =======================================================================
-void PrsMgr_PresentationManager::Move (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                       const Quantity_Length                   theX,
-                                       const Quantity_Length                   theY,
-                                       const Quantity_Length                   theZ,
-                                       const Standard_Integer                  theMode)
-{
-  Presentation (thePrsObj, theMode)->Move (theX, theY, theZ);
-}
 
 // =======================================================================
 // function : Color
@@ -493,11 +564,22 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
                                         const Quantity_NameOfColor              theColor,
                                         const Standard_Integer                  theMode)
 {
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
+  {
+    Color (anIter.Value(), theColor, theMode);
+  }
+  if (!thePrsObj->HasOwnPresentations())
+  {
+    return;
+  }
+
   if (!HasPresentation (thePrsObj, theMode))
   {
     AddPresentation (thePrsObj, theMode);
   }
 
+  if (!HasPresentation (thePrsObj, theMode)) return;
+
   Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
   if (aPrs->MustBeUpdated())
   {
index b6785d51ab9da3fdd135dd600e125eaf899f209d..a7099d56810872630a099bc5bbf705578c7e5e60 100644 (file)
@@ -1675,7 +1675,7 @@ static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, con
       di << argv[1] << " : No interactive object" << "\n";
       return 1;
     } 
-    AISObj->UnsetTransformation();
+    AISObj->ResetTransformation();
     if (!aContext->HasOpenedContext()) {
       aContext->OpenLocalContext();
     }
index c46a03d66b995f22f403cd15714b98ae9b1767c1..866954303e55de1e5cbd442b454ef3ab13c409d1 100644 (file)
@@ -110,7 +110,7 @@ is
     ---Purpose: Returns true if this framework has a location defined.
 
     Location(me) returns Location from TopLoc is virtual;
-    ---C++: return const&
+    ---C++: return const
 
     ResetLocation(me:mutable) is virtual;
     ---Purpose: sets the location to Identity
index e8d08bd9bbc993b8cae3d75e456e0abd08edf288..913e715e985a6775e0d2f82076f9b7de7962dfbd 100644 (file)
@@ -120,9 +120,9 @@ void Select3D_SensitiveEntity::UpdateLocation(const TopLoc_Location& aLoc)
 //purpose  : 
 //=======================================================================
 
-const TopLoc_Location& Select3D_SensitiveEntity::Location() const 
+const TopLoc_Location Select3D_SensitiveEntity::Location() const 
 {
-  static TopLoc_Location anIdentity;   
+  TopLoc_Location anIdentity;  
   Handle(SelectBasics_EntityOwner) anOwner = OwnerId();
   return anOwner.IsNull() ? anIdentity : anOwner->Location();
 }
index 576e4f353f411b20cedbdb9ad860db785302d910..8f8039da180651aa3425429b8656fdd21b6ad421 100644 (file)
@@ -60,7 +60,6 @@ is
     ResetLocation(me:mutable) is deferred;
     
     Location(me) returns Location from TopLoc is deferred;
-    ---C++: return const&
 
 
 
index d08eeadf112ad85d1dc93cfbebce6a63609e0361..38a5ca23986f0ef93f020a08b91cb2b0cccf2278 100644 (file)
@@ -49,6 +49,12 @@ is
     returns EntityOwner from SelectMgr;
        ---Purpose: Constructs a framework with the selectable object
        -- anSO being attributed the selection priority aPriority.
+
+    Create (theOwner : EntityOwner from SelectMgr;
+            aPriority : Integer=0)
+      returns EntityOwner from SelectMgr;
+        ---Purpose: Constructs a framework from existing one
+        -- anSO being attributed the selection priority aPriority.
        
     HasSelectable(me) returns Boolean from Standard;
        ---Purpose: Returns true if there is a selectable object to serve as an owner.
@@ -56,7 +62,7 @@ is
     Selectable(me) returns any SelectableObject from SelectMgr
         ---Purpose: Returns a selectable object detected in the working context.
     raises NoSuchObject from Standard
-    is static;
+    is  virtual;
     
     Set(me:mutable; aSO : SelectableObject) is static;    
         ---Purpose: Sets the selectable object anSO to be used by the
@@ -124,9 +130,6 @@ is
     SetLocation(me:mutable; aLoc : Location from TopLoc) is redefined;
     ResetLocation(me:mutable) is redefined;
     Location(me) returns Location from TopLoc is redefined;
-    ---C++: return const&
-    
-    
 
     --very Internal method (to be used in selection process only...)
 
index cc670f6246ed66c8304677ab3be6ad3326d5f0f2..692713c76d016d8b850ccfd767d20194ae31ad3c 100644 (file)
@@ -37,6 +37,13 @@ myIsSelected (Standard_False)
   mySelectable = aSO.operator->();
 }
 
+SelectMgr_EntityOwner::SelectMgr_EntityOwner (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer aPriority)
+:
+  SelectBasics_EntityOwner(aPriority),
+  mySelectable (theOwner->mySelectable)
+{
+}
+
 
 //=======================================================================
 //function : About Selectable...
@@ -106,25 +113,23 @@ void SelectMgr_EntityOwner::
 Hilight(){}
 
 
-
 //=======================================================================
-//function : about Location
+//function : about Transformation
 //purpose  : 
 //=======================================================================
 
 Standard_Boolean SelectMgr_EntityOwner::HasLocation() const
 {
-  return (HasSelectable() && mySelectable->HasLocation());
+  return (HasSelectable() && mySelectable->HasTransformation());
 }
 
 void SelectMgr_EntityOwner::SetLocation(const TopLoc_Location&)
 {
 }
 
-const TopLoc_Location& SelectMgr_EntityOwner::Location() const
+TopLoc_Location SelectMgr_EntityOwner::Location() const
 {
-  static TopLoc_Location anIdentity;
-  return HasSelectable() ? mySelectable->Location() : anIdentity;
+  return !HasSelectable() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
 }
 
 void SelectMgr_EntityOwner::ResetLocation()
index f1beb54812de4c781b05f9ad760f23db9437221a..5fe6db9b32117ccb65081b6d5d1036814104fa11 100644 (file)
@@ -53,7 +53,7 @@ is
     Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
 
     ComputeSelection(me:mutable; aSelection : Selection from SelectMgr;
-                                 aMode      : Integer) is deferred private;
+                                 aMode      : Integer) is deferred;
         ---Purpose: Recovers and calculates any sensitive primitive,
        -- aSelection, available in Shape mode, specified by
        -- aMode. As a rule, these are sensitive faces.
@@ -133,12 +133,12 @@ is
     ---C++: inline
     
 
-    ResetLocation(me:mutable) is redefined static;
+    ResetTransformation(me:mutable) is redefined static;
     
-    UpdateLocation(me:mutable) is redefined virtual;
+    UpdateTransformation(me:mutable) is redefined virtual;
         ---Purpose: Recomputes the location of the selection aSelection.
 
-    UpdateLocation(me:mutable;aSelection: Selection from SelectMgr) is virtual protected;
+    UpdateTransformation(me:mutable;aSelection: Selection from SelectMgr) is virtual protected;
     ---Level: Internal
     ---Purpose: Updates locations in all sensitive entities from <aSelection> 
     --          and in corresponding entity owners.
index 856ee5b17074e9c0937e8adda39021c180b83781..bf2ce86f21e5dcd49d63a5a3d93e01106e9c32de 100644 (file)
@@ -24,6 +24,7 @@
 #include <SelectMgr_EntityOwner.hxx>
 #include <PrsMgr_PresentationManager3d.hxx>
 
+#include <TopLoc_Location.hxx>
 #include <gp_Pnt.hxx>
 
 static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq,
@@ -160,13 +161,14 @@ void SelectMgr_SelectableObject
 
 
 //=======================================================================
-//function : ReSetLocation
+//function : ReSetTransformation
 //purpose  : 
 //=======================================================================
-void SelectMgr_SelectableObject::ResetLocation() 
+void SelectMgr_SelectableObject::ResetTransformation() 
 {
   TopLoc_Location aLoc;
 
+  TopLoc_Location aSelfLocation (Transformation());
 
   // les selections
   Handle(Select3D_SensitiveEntity) SE;
@@ -176,13 +178,13 @@ void SelectMgr_SelectableObject::ResetLocation()
       SE =  *((Handle(Select3D_SensitiveEntity)*) &(Sel->Sensitive()));
       if(!SE.IsNull()){
         if(SE->HasLocation()) {
-          if( SE->Location()==myLocation){
+          if( SE->Location()==aSelfLocation){
             SE->ResetLocation();
             const Handle(SelectBasics_EntityOwner)& EO = SE->OwnerId();
             (*((Handle(SelectMgr_EntityOwner)*)&EO))->ResetLocation();}
           else{
             const TopLoc_Location& iniloc =SE->Location();
-            SE->SetLocation(iniloc*myLocation.Inverted());
+            SE->SetLocation(iniloc*aSelfLocation.Inverted());
             const Handle(SelectBasics_EntityOwner)& EO = SE->OwnerId();
             (*((Handle(SelectMgr_EntityOwner)*)&EO))->SetLocation(SE->Location());}
         }
@@ -191,15 +193,15 @@ void SelectMgr_SelectableObject::ResetLocation()
     Sel->UpdateStatus(SelectMgr_TOU_None);
   }
 
-  PrsMgr_PresentableObject::ResetLocation();
+  PrsMgr_PresentableObject::ResetTransformation();
 }
 
 
 //=======================================================================
-//function : UpdateLocation
+//function : UpdateTransformation
 //purpose  : 
 //=======================================================================
-void SelectMgr_SelectableObject::UpdateLocation() 
+void SelectMgr_SelectableObject::UpdateTransformation() 
 {
   
   Handle(Select3D_SensitiveEntity) SE;
@@ -207,28 +209,29 @@ void SelectMgr_SelectableObject::UpdateLocation()
     const Handle(SelectMgr_Selection) & Sel =  CurrentSelection();
     Sel->UpdateStatus(SelectMgr_TOU_Partial);
   }
-  PrsMgr_PresentableObject::UpdateLocation();
+  PrsMgr_PresentableObject::UpdateTransformation();
 
 }
 
 
 //=======================================================================
-//function : UpdateLocation
+//function : UpdateTransformation
 //purpose  : 
 //=======================================================================
-void SelectMgr_SelectableObject::UpdateLocation(const Handle(SelectMgr_Selection)& Sel)
+void SelectMgr_SelectableObject::UpdateTransformation(const Handle(SelectMgr_Selection)& Sel)
 {
+  TopLoc_Location aSelfLocation (Transformation());
   Handle(Select3D_SensitiveEntity) SE;
-  if(myLocation.IsIdentity()) return;
+  if(aSelfLocation.IsIdentity()) return;
   for(Sel->Init();Sel->More();Sel->Next()){
     SE =  *((Handle(Select3D_SensitiveEntity)*) &(Sel->Sensitive()));
     if(!SE.IsNull()){
-      SE->UpdateLocation(myLocation);
+      SE->UpdateLocation(aSelfLocation);
       const Handle(SelectBasics_EntityOwner)& aEOwner = SE->OwnerId();
       Handle(SelectMgr_EntityOwner) aMgrEO =
                               Handle(SelectMgr_EntityOwner)::DownCast (aEOwner);
       if (!aMgrEO.IsNull())
-        aMgrEO->SetLocation (myLocation);
+        aMgrEO->SetLocation (aSelfLocation);
     }
   }
 }
index 96465d811b104e522430551cfa175231db9d9e03..f0935758ac1110efd407729b204fbf70a5eb63c2 100644 (file)
@@ -263,8 +263,8 @@ Activate(const Handle(SelectMgr_SelectableObject)& anObject,
         anObject->UpdateSelection(aMode); // pas de break expres...
       case SelectMgr_TOU_Partial:
         {
-          if(anObject->HasLocation())
-            anObject->UpdateLocation(Sel);
+          if(anObject->HasTransformation())
+            anObject->UpdateTransformation(Sel);
           Sel->UpdateStatus(SelectMgr_TOU_None);
           break;
         }
@@ -302,8 +302,8 @@ Activate(const Handle(SelectMgr_SelectableObject)& anObject,
     anObject->UpdateSelection(aMode); 
   case SelectMgr_TOU_Partial:
     {
-      if(anObject->HasLocation())
-        anObject->UpdateLocation(Sel);
+      if(anObject->HasTransformation())
+        anObject->UpdateTransformation(Sel);
       break;
     }
   default:
@@ -580,11 +580,11 @@ RecomputeSelection (const Handle(SelectMgr_SelectableObject)& anObject,
     if( SelectDebugModeOnSM() ) cout<<"\t Global Recalculation of selections"<<endl;
     if(aMode==-1){
       anObject->UpdateSelection();
-      anObject->UpdateLocation();
+      anObject->UpdateTransformation();
     }
     else if(anObject->HasSelection(aMode)){
       anObject->UpdateSelection(aMode);
-      anObject->UpdateLocation();
+      anObject->UpdateTransformation();
     }
     return;
   }
@@ -628,7 +628,7 @@ RecomputeSelection (const Handle(SelectMgr_SelectableObject)& anObject,
     case SelectMgr_TOU_Full:
       anObject->UpdateSelection(curmode); // no break on purpose...
     case SelectMgr_TOU_Partial:
-      anObject->UpdateLocation(Sel);
+      anObject->UpdateTransformation(Sel);
       break;
     default:
       break;
@@ -653,6 +653,17 @@ RecomputeSelection (const Handle(SelectMgr_SelectableObject)& anObject,
 void SelectMgr_SelectionManager::Update(const Handle(SelectMgr_SelectableObject)& anObject,
                                         const Standard_Boolean ForceUpdate)
 {
+  PrsMgr_ListOfPresentableObjectsIter anIter (anObject->Children());
+  for (; anIter.More(); anIter.Next())
+  {
+    const Handle(SelectMgr_SelectableObject) aSelectable = Handle(SelectMgr_SelectableObject)::DownCast (anIter.Value());
+
+    if (!aSelectable.IsNull())
+    {
+      Update (aSelectable, ForceUpdate);
+    }
+  }
+
   Standard_Boolean wasrecomputed;
 
   for(anObject->Init();anObject->More();anObject->Next()){
@@ -663,7 +674,7 @@ void SelectMgr_SelectionManager::Update(const Handle(SelectMgr_SelectableObject)
       case SelectMgr_TOU_Full:
         anObject->UpdateSelection(Sel->Mode()); // no break on purpose...
       case SelectMgr_TOU_Partial:
-        anObject->UpdateLocation(Sel);
+        anObject->UpdateTransformation(Sel);
         wasrecomputed = Standard_True;
         break;
       default:
@@ -683,7 +694,7 @@ void SelectMgr_SelectionManager::Update(const Handle(SelectMgr_SelectableObject)
   case SelectMgr_TOU_Full:
     anObject->UpdateSelection(Sel->Mode()); // no break on purpose...
   case SelectMgr_TOU_Partial:
-    anObject->UpdateLocation(Sel);
+    anObject->UpdateTransformation(Sel);
     wasrecomputed = Standard_True;
     break;
   default:
@@ -725,7 +736,7 @@ Update(const Handle(SelectMgr_SelectableObject)& anObject,
       case SelectMgr_TOU_Full:
         anObject->UpdateSelection(Sel->Mode()); //  no break on purpose...
       case SelectMgr_TOU_Partial:
-        anObject->UpdateLocation(Sel);
+        anObject->UpdateTransformation(Sel);
         wasrecomputed = Standard_True;
         break;
       default:
@@ -739,8 +750,8 @@ Update(const Handle(SelectMgr_SelectableObject)& anObject,
       case SelectMgr_TOU_Full:
         anObject->UpdateSelection(Sel->Mode());
       case SelectMgr_TOU_Partial:
-        if(anObject->HasLocation())
-          anObject->UpdateLocation(Sel);
+        if(anObject->HasTransformation())
+          anObject->UpdateTransformation(Sel);
         wasrecomputed = Standard_True;
         break;
       default:
index 5cefbe7c619762c80947de50de950bde73dda585..03fdd3b1ecfeae33930cba8196fbe0ea2b4021b3 100644 (file)
@@ -70,7 +70,7 @@ Standard_Boolean TPrsStd_AxisDriver::Update (const TDF_Label& aLabel,
        aistrihed = new AIS_Axis(apt);
       else {
        aistrihed->SetComponent(apt);
-        aistrihed->ResetLocation();
+        aistrihed->ResetTransformation();
         aistrihed->SetToUpdate();
         aistrihed->UpdateSelection();
       }
index 06b49866affe76a3122158aff9f7b1447291325c..1898ad049a0a6b51922c7ef5f916c2bb8f203b12 100644 (file)
@@ -165,7 +165,7 @@ Standard_Boolean TPrsStd_ConstraintDriver::Update (const TDF_Label& aLabel,
   }
   if (anAIS.IsNull()) return Standard_False;
  
-  anAIS->ResetLocation();
+  anAIS->ResetTransformation();
   anAIS->SetToUpdate();
   anAIS->UpdateSelection();
   
index a120661a7caeb092e1ee74e1a17d24708a22184e..369361f4f5a719da30aa69de024edf634dbea60e 100644 (file)
@@ -84,7 +84,7 @@ Standard_Boolean TPrsStd_GeometryDriver::Update(const TDF_Label& aLabel,
          ais1 = new AIS_Point(apt);
        else {
          ais1->SetComponent(apt);
-         ais1->ResetLocation();
+         ais1->ResetTransformation();
          ais1->SetToUpdate();
          ais1->UpdateSelection();
        }
@@ -107,7 +107,7 @@ Standard_Boolean TPrsStd_GeometryDriver::Update(const TDF_Label& aLabel,
          ais2 = new AIS_Line(aln);
        else {
          ais2->SetLine(aln);
-         ais2->ResetLocation();
+         ais2->ResetTransformation();
          ais2->SetToUpdate();
          ais2->UpdateSelection();
        }
@@ -131,7 +131,7 @@ Standard_Boolean TPrsStd_GeometryDriver::Update(const TDF_Label& aLabel,
          ais3 = new AIS_Circle(acir);
        else {
          ais3->SetCircle(acir);
-         ais3->ResetLocation();
+         ais3->ResetTransformation();
          ais3->SetToUpdate();
          ais3->UpdateSelection();
        }
@@ -153,7 +153,7 @@ Standard_Boolean TPrsStd_GeometryDriver::Update(const TDF_Label& aLabel,
          if (ais.IsNull()) 
            ais = new AIS_Shape(mkEdge);
          else {
-           ais->ResetLocation();
+           ais->ResetTransformation();
            ais->Set(mkEdge);
            ais->SetToUpdate();
            ais->UpdateSelection();
index d99ca67d46ebf88649f1ef82d9a3c71506b3b1d7..745c1f29e0ead146e46e8ce10661096fe6a16393 100644 (file)
@@ -82,7 +82,7 @@ Standard_Boolean TPrsStd_NamedShapeDriver::Update (const TDF_Label& aLabel,
     else {
       TopoDS_Shape oldShape = AISShape->Shape();
       if(oldShape != S) {
-       AISShape->ResetLocation();
+       AISShape->ResetTransformation();
 
 #ifdef OPTIM_UPDATE
        Handle(AIS_InteractiveContext) ctx = AISShape->GetContext();
index c0302b860f58d6c9748e8c32d8439bf210689d45..6c30f3dc42823ed2ea00002484b353db211d9edd 100644 (file)
@@ -63,7 +63,7 @@ Standard_Boolean TPrsStd_PlaneDriver::Update (const TDF_Label& aLabel,
     else {
       aisplane->SetComponent(apt); 
       aisplane->SetCenter(pln.Location());
-      aisplane->ResetLocation();
+      aisplane->ResetTransformation();
       aisplane->SetToUpdate();
       aisplane->UpdateSelection();
     }
index c90a5b7ee96b1746e7f865ff8c74d0b0fb2cb7cf..2b2115ea87aeae007c239dd22ed3c514e452bb95 100644 (file)
@@ -63,7 +63,7 @@ Standard_Boolean TPrsStd_PointDriver::Update (const TDF_Label& aLabel,
       aistrihed = new AIS_Point(apt);
     else {
       aistrihed->SetComponent(apt);
-      aistrihed->ResetLocation();
+      aistrihed->ResetTransformation();
       aistrihed->SetToUpdate();
       aistrihed->UpdateSelection();
     }
index 7698ebd1ffaf81cc28896e4c10fa526ac0e023f5..326c6814fbc286163246aafb1728250ae8d18e6d 100644 (file)
@@ -3154,11 +3154,11 @@ static int VAnimation (Draw_Interpretor& di, Standard_Integer argc, const char**
     TheAISContext()->UpdateCurrentViewer();
   }
 
-  TopoDS_Shape myNewCrankArm  =myAisCrankArm ->Shape().Located( myAisCrankArm ->Location() );
-  TopoDS_Shape myNewPropeller =myAisPropeller->Shape().Located( myAisPropeller->Location() );
+  TopoDS_Shape myNewCrankArm  =myAisCrankArm ->Shape().Located( myAisCrankArm ->Transformation() );
+  TopoDS_Shape myNewPropeller =myAisPropeller->Shape().Located( myAisPropeller->Transformation() );
 
-  myAisCrankArm ->ResetLocation();
-  myAisPropeller->ResetLocation();
+  myAisCrankArm ->ResetTransformation();
+  myAisPropeller->ResetTransformation();
 
   myAisCrankArm  -> Set(myNewCrankArm );
   myAisPropeller -> Set(myNewPropeller);
index 8e05ff422d8851f1ef8f2a0e3fd94a552302c0d3..140462570d019d93cec1cea42973795a7c3ca9f7 100644 (file)
 #include <StdPrs_ShadedShape.hxx>
 #include <TopoDS_Wire.hxx>
 
-#include <AIS_ConnectedShape.hxx>
 #include <AIS_MultipleConnectedInteractive.hxx>
-#include <AIS_MultipleConnectedShape.hxx>
+#include <AIS_ConnectedInteractive.hxx>
 #include <TopLoc_Location.hxx>
 #include <TColStd_ListOfInteger.hxx>
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
@@ -3498,13 +3497,13 @@ static Standard_Integer VSetLocation (Draw_Interpretor& di,
   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
   if (aContext.IsNull())
   {
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    std::cout << argv[0] << "ERROR : use 'vinit' command before " << "\n";
     return 1;
   }
 
   if (argc != 5)
   {
-    di << "ERROR : Usage : " << argv[0] << " name x y z; new location" << "\n";
+    std::cout << "ERROR : Usage : " << argv[0] << " name x y z; new location" << "\n";
     return 1;
   }
 
@@ -3518,7 +3517,7 @@ static Standard_Integer VSetLocation (Draw_Interpretor& di,
   Handle(AIS_InteractiveObject) anIObj;
   if (!aMap.IsBound2 (aName))
   {
-    di << "Use 'vdisplay' before" << "\n";
+    std::cout << "Use 'vdisplay' before" << "\n";
     return 1;
   }
   else
@@ -3528,7 +3527,7 @@ static Standard_Integer VSetLocation (Draw_Interpretor& di,
     // not an AIS_InteractiveObject
     if (anIObj.IsNull())
     {
-      di << argv[1] << " : Not an AIS interactive object" << "\n";
+      std::cout << argv[1] << " : Not an AIS interactive object" << "\n";
       return 1;
     }
 
@@ -3545,12 +3544,12 @@ static Standard_Integer VSetLocation (Draw_Interpretor& di,
 //===============================================================================================
 //function : VConnect
 //purpose  : Creates and displays AIS_ConnectedInteractive object from input object and location 
-//Draw arg : vconnect name Xo Yo Zo Xu Xv Xw Zu Zv Zw object1 object2 ... [color=NAME]
+//Draw arg : vconnect name Xo Yo Zo object1 object2 ... [color=NAME]
 //===============================================================================================
 
-static Standard_Integer VConnect(Draw_Interpretor& /*di*/, 
-                                 Standard_Integer argc, 
-                                 const char ** argv) 
+static Standard_Integer VConnect (Draw_Interpretor& /*di*/, 
+                                  Standard_Integer argc, 
+                                  const char ** argv) 
 {
   // Check the viewer
   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
@@ -3560,16 +3559,16 @@ static Standard_Integer VConnect(Draw_Interpretor& /*di*/,
     return 1; // TCL_ERROR
   }
   // Check argumnets 
-  if (argc < 12)
+  if (argc < 6)
   {
-    std::cout << "vconnect error: expect at least 11 arguments\n";
+    std::cout << "vconnect error: expect at least 5 arguments\n";
     return 1; // TCL_ERROR
   }
 
   // Get values
   Standard_Integer anArgIter = 1;
   TCollection_AsciiString aName (argv[anArgIter++]);
-  Handle(AIS_InteractiveObject) anOriginObject;
+  Handle(AIS_MultipleConnectedInteractive) anOriginObject;
   TCollection_AsciiString aColorString (argv[argc-1]);
   Standard_CString aColorName = "";
   Standard_Boolean hasColor = Standard_False;
@@ -3581,23 +3580,24 @@ static Standard_Integer VConnect(Draw_Interpretor& /*di*/,
   }
   Handle(AIS_InteractiveObject) anObject;
 
-  // AIS_ConnectedInteractive
-  if (argc == 12 || (argc == 13 && hasColor))
+  // AIS_MultipleConnectedInteractive
+  const Standard_Integer aNbShapes = hasColor ? (argc - 1) : argc;
+  for (Standard_Integer i = 5; i < aNbShapes; ++i)
   {
-    TCollection_AsciiString anOriginObjectName(argv[11]);
+    TCollection_AsciiString anOriginObjectName (argv[i]);
     if (aName.IsEqual (anOriginObjectName))
     {
-      std::cout << "vconnect error: equal names for connected objects\n"; 
-      return 1; // TCL_ERROR
+      std::cout << "vconnect error: equal names for connected objects\n";
+      continue;
     }
     if (GetMapOfAIS().IsBound2 (anOriginObjectName))
     {
       Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginObjectName);
-      anOriginObject = Handle(AIS_InteractiveObject)::DownCast(anObj);
-      if (anOriginObject.IsNull())
+      anObject = Handle(AIS_InteractiveObject)::DownCast(anObj);
+      if (anObject.IsNull())
       {
         std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
-        return 1; // TCL_ERROR
+        continue;
       }
     }
     else
@@ -3607,101 +3607,38 @@ static Standard_Integer VConnect(Draw_Interpretor& /*di*/,
       if (aTDShape.IsNull())
       {
         std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
-        return 1; // TCL_ERROR
-      }
-      anOriginObject = new AIS_Shape (aTDShape);
-      if (hasColor)
-      {
-        anOriginObject->SetColor (ViewerTest::GetColorFromName (aColorName));
-      }
-    }
-  }
-  // AIS_MultipleConnectedInteractive
-  else
-  {
-    const Standard_Integer aNbShapes = hasColor ? (argc - 1) : argc;
-    for (Standard_Integer i = 11; i < aNbShapes; ++i)
-    {
-      TCollection_AsciiString anOriginObjectName (argv[i]);
-      if (aName.IsEqual (anOriginObjectName))
-      {
-        std::cout << "vconnect error: equal names for connected objects\n";
         continue;
       }
-      if (GetMapOfAIS().IsBound2 (anOriginObjectName))
-      {
-        Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginObjectName);
-        anObject = Handle(AIS_InteractiveObject)::DownCast(anObj);
-        if (anObject.IsNull())
-        {
-          std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
-          continue;
-        }
-      }
-      else
-      {
-        Standard_CString aName = anOriginObjectName.ToCString();
-        TopoDS_Shape aTDShape = DBRep::Get (aName);
-        if (aTDShape.IsNull())
-        {
-          std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
-          continue;
-        }
-        anObject = new AIS_Shape (aTDShape);
-        anObject->SetColor (ViewerTest::GetColorFromName (aColorName));
-      }
-      if (anOriginObject.IsNull())
-      {
-        anOriginObject = new AIS_MultipleConnectedInteractive();
-        Handle(AIS_MultipleConnectedInteractive)::DownCast(anOriginObject)->Connect (anObject);
-      }
-      else
-      {
-        Handle(AIS_MultipleConnectedInteractive)::DownCast(anOriginObject)->Connect (anObject);
-      }
+      anObject = new AIS_Shape (aTDShape);
+      anObject->SetColor (ViewerTest::GetColorFromName (aColorName));
     }
+
     if (anOriginObject.IsNull())
     {
-      std::cout << "vconect error : can't connect input objects\n";
-      return 1; // TCL_ERROR
+      anOriginObject = new AIS_MultipleConnectedInteractive();
     }
+
+    anOriginObject->Connect (anObject);
+  }
+  if (anOriginObject.IsNull())
+  {
+    std::cout << "vconect error : can't connect input objects\n";
+    return 1; // TCL_ERROR
   }
 
   // Get location data
   Standard_Real aXo = Draw::Atof (argv[anArgIter++]);
   Standard_Real aYo = Draw::Atof (argv[anArgIter++]);
   Standard_Real aZo = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aXu = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aXv = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aXw = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aZu = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aZv = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aZw = Draw::Atof (argv[anArgIter++]);
 
   // Create transformation
-  gp_Pnt aPoint(aXo, aYo, aZo);
-  gp_Dir anXDir(aXu, aXv, aXw), aZDir(aZu, aZv, aZw);
-  if(!anXDir.IsNormal(aZDir, Precision::Angular()))
-  {
-    std::cout << "vconnect error : XDir expects to be normal to ZDir\n"; 
-    return 1; // TCL_ERROR
-  } 
-  gp_Ax3 anAx3(aPoint, aZDir, anXDir); 
+  gp_Vec aTranslation (aXo, aYo, aZo);
+
   gp_Trsf aTrsf; 
-  aTrsf.SetTransformation(anAx3); 
-  TopLoc_Location aLocation(aTrsf);
+  aTrsf.SetTranslationPart (aTranslation);
+  TopLoc_Location aLocation (aTrsf);
 
-  // Create connected object
-  Handle(AIS_ConnectedInteractive) aConnected = new AIS_ConnectedInteractive();
-  Handle(AIS_MultipleConnectedInteractive) anOrigin = Handle(AIS_MultipleConnectedInteractive)::DownCast(anOriginObject);
-  if (anOrigin.IsNull())
-  {
-    aConnected->Connect (anOriginObject, aLocation);
-  }
-  else
-  {
-    aConnected->Connect (anOrigin, aLocation);
-  }
+  anOriginObject->SetLocalTransformation (aTrsf);
 
   // Check if there is another object with given name
   // and remove it from context
@@ -3714,179 +3651,87 @@ static Standard_Integer VConnect(Draw_Interpretor& /*di*/,
   }
 
   // Bind connected object to its name
-  GetMapOfAIS().Bind (aConnected, aName);
+  GetMapOfAIS().Bind (anOriginObject, aName);
 
   // Display connected object
-  TheAISContext()->Display (aConnected);
+  TheAISContext()->Display (anOriginObject);
 
   return 0;
 }
 
 //===============================================================================================
-//function : VConnectShape
-//purpose  : Creates and displays AIS_ConnectedShape from input shape and location 
-//Draw arg : vconnectsh name Xo Yo Zo Xu Xv Xw Zu Zv Zw shape1 shape2 ... [color=NAME]
+//function : VConnectTo
+//purpose  : Creates and displays AIS_ConnectedInteractive object from input object and location 
+//Draw arg : vconnectto name Xo Yo Zo object
 //===============================================================================================
 
-static Standard_Integer VConnectShape(Draw_Interpretor& /*di*/, 
-                                      Standard_Integer argc, 
-                                      const char ** argv) 
+static Standard_Integer VConnectTo (Draw_Interpretor& /*di*/, 
+                                    Standard_Integer argc, 
+                                    const char ** argv) 
 {
   // Check the viewer
   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
   if (aContext.IsNull())
   {
-    std::cout << "vconnectsh error : call vinit before\n";
+    std::cout << "vconnect error : call vinit before\n";
     return 1; // TCL_ERROR
   }
-  // Check argumnets
-  if (argc < 12)
+  // Check argumnets 
+  if (argc != 6)
   {
-    std::cout << "vconnectsh error: expect at least 11 arguments\n";
+    std::cout << "vconnect error: expect at least 5 arguments\n";
     return 1; // TCL_ERROR
   }
 
   // Get values
   Standard_Integer anArgIter = 1;
   TCollection_AsciiString aName (argv[anArgIter++]);
-  Handle(AIS_InteractiveObject) anOriginShape;
-  TCollection_AsciiString aColorString(argv[argc-1]);
-  Standard_CString aColorName = "";
-  Standard_Boolean hasColor = Standard_False;
-  if (aColorString.Search ("color=") != -1)
+  Handle(AIS_InteractiveObject) anOriginObject;
+
+  TCollection_AsciiString anOriginObjectName(argv[5]);
+  if (aName.IsEqual (anOriginObjectName))
   {
-    hasColor = Standard_True;
-    aColorString.Remove (1, 6);
-    aColorName = aColorString.ToCString();
+    std::cout << "vconnect error: equal names for connected objects\n"; 
+    return 1; // TCL_ERROR
   }
-  Handle(AIS_Shape) aShape;
-
-  // AIS_ConnectedShape
-  if (argc == 12 || (argc == 13 && hasColor))
+  if (GetMapOfAIS().IsBound2 (anOriginObjectName))
   {
-    TCollection_AsciiString anOriginShapeName (argv[11]);
-    if (aName.IsEqual (anOriginShapeName))
+    Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginObjectName);
+    anOriginObject = Handle(AIS_InteractiveObject)::DownCast(anObj);
+    if (anOriginObject.IsNull())
     {
-      std::cout << "vconnectsh error: equal names for connected shapes\n";
+      std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
       return 1; // TCL_ERROR
     }
-    if (GetMapOfAIS().IsBound2 (anOriginShapeName))
-    {
-      Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginShapeName);
-      anOriginShape = Handle(AIS_Shape)::DownCast(anObj);
-      if (anOriginShape.IsNull())
-      {
-        std::cout << "Shape " << anOriginShapeName << " is used for non AIS viewer\n!";
-        return 1; // TCL_ERROR
-      }
-    }
-    else
-    {
-      Standard_CString aName = anOriginShapeName.ToCString();
-      TopoDS_Shape aTDShape = DBRep::Get (aName);
-      if (aTDShape.IsNull())
-      {
-        std::cout << "vconnectsh error: object " << anOriginShapeName << " doesn't exist\n";
-        return 1; // TCL_ERROR
-      }
-      anOriginShape = new AIS_Shape (aTDShape);
-      if (hasColor)
-      {
-        anOriginShape->SetColor (ViewerTest::GetColorFromName (aColorName));
-      }
-    }
   }
-  // AIS_MultipleConnectedShape
   else
   {
-    const Standard_Integer aNbShapes = hasColor ? (argc - 1) : argc;
-    for (Standard_Integer i = 11; i < aNbShapes; ++i)
+    Standard_CString aName = anOriginObjectName.ToCString();
+    TopoDS_Shape aTDShape = DBRep::Get (aName);
+    if (aTDShape.IsNull())
     {
-      TCollection_AsciiString anOriginShapeName (argv[i]);
-      if (aName.IsEqual (anOriginShapeName))
-      {
-        std::cout << "vconnectsh error: equal names for connected shapes\n";
-        continue;
-      }
-      if (GetMapOfAIS().IsBound2 (anOriginShapeName))
-      {
-        Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginShapeName);
-        aShape = Handle(AIS_Shape)::DownCast(anObj);
-        if (aShape.IsNull())
-        {
-          std::cout << "Shape " << anOriginShapeName << " is used for non AIS viewer\n";
-          continue;
-        }
-      }
-      else
-      {
-        Standard_CString aName = anOriginShapeName.ToCString();
-        TopoDS_Shape aTDShape = DBRep::Get (aName);
-        if (aTDShape.IsNull())
-        {
-          std::cout << "vconnectsh error: object " << anOriginShapeName << " doesn't exist\n";
-          continue;
-        }
-        aShape = new AIS_Shape (aTDShape);
-        if (hasColor)
-        {
-          aShape->SetColor (ViewerTest::GetColorFromName (aColorName));
-        }
-      }
-      if (anOriginShape.IsNull())
-      {
-        anOriginShape = new AIS_MultipleConnectedShape (aShape->Shape());
-        Handle(AIS_MultipleConnectedShape)::DownCast(anOriginShape)->Connect (aShape);
-      }
-      else
-      {
-        Handle(AIS_MultipleConnectedShape)::DownCast(anOriginShape)->Connect (aShape);
-      }
-    }
-    if (anOriginShape.IsNull())
-    {
-      std::cout << "vconectsh error : can't connect input objects\n";
+      std::cout << "vconnect error: object " << anOriginObjectName << " doesn't exist\n";
       return 1; // TCL_ERROR
     }
+    anOriginObject = new AIS_Shape (aTDShape);
   }
-
-  // Get location data  
+  // Get location data
   Standard_Real aXo = Draw::Atof (argv[anArgIter++]);
   Standard_Real aYo = Draw::Atof (argv[anArgIter++]);
   Standard_Real aZo = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aXu = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aXv = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aXw = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aZu = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aZv = Draw::Atof (argv[anArgIter++]);
-  Standard_Real aZw = Draw::Atof (argv[anArgIter++]);
 
   // Create transformation
-  gp_Pnt aPoint(aXo, aYo, aZo);
-  gp_Dir anXDir(aXu, aXv, aXw), aZDir(aZu, aZv, aZw);
-  if(!anXDir.IsNormal(aZDir, Precision::Angular()))
-  {
-    std::cout << "vconnectsh error : XDir expects to be normal to ZDir\n"; 
-    return 1; // TCL_ERROR
-  } 
-  gp_Ax3 anAx3(aPoint, aZDir, anXDir); 
-  gp_Trsf aTrsf; 
-  aTrsf.SetTransformation(anAx3); 
-  TopLoc_Location aLocation(aTrsf);
+  gp_Vec aTranslation (aXo, aYo, aZo);
 
-  // Create connected shape
+  gp_Trsf aTrsf; 
+  aTrsf.SetTranslationPart (aTranslation);
   Handle(AIS_ConnectedInteractive) aConnected;
-  Handle(AIS_Shape) anOrigin = Handle(AIS_Shape)::DownCast(anOriginShape);
-  if (!anOrigin.IsNull())
-  {
-    aConnected = new AIS_ConnectedShape (anOrigin);
-    aConnected->Connect (anOrigin, aLocation);
-  }
-  else
-  {
-    aConnected = new AIS_ConnectedInteractive();
-    aConnected->Connect (anOriginShape, aLocation);
-  }
+
+  aConnected = new AIS_ConnectedInteractive();
+
+  aConnected->Connect (anOriginObject, aTrsf);
 
   // Check if there is another object with given name
   // and remove it from context
@@ -3898,15 +3743,220 @@ static Standard_Integer VConnectShape(Draw_Interpretor& /*di*/,
     GetMapOfAIS().UnBind2(aName);
   }
 
-  // Bind connected shape to its name
+  // Bind connected object to its name
   GetMapOfAIS().Bind (aConnected, aName);
 
-  // Display connected shape
+  // Display connected object
   TheAISContext()->Display (aConnected);
 
   return 0;
 }
 
+//=======================================================================
+//function : VDisconnect
+//purpose  :
+//=======================================================================
+static Standard_Integer VDisconnect (Draw_Interpretor& di,
+                                     Standard_Integer argc,
+                                     const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    std::cout << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+  
+  if (argc != 3)
+  {
+    std::cout << "ERROR : Usage : " << argv[0] << " name object" << "\n";
+    return 1;
+  }
+
+  TCollection_AsciiString aName (argv[1]);
+  TCollection_AsciiString anObject (argv[2]);
+  Standard_Integer anObjectNumber = Draw::Atoi (argv[2]);
+
+  // find objects
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  Handle(AIS_MultipleConnectedInteractive) anAssembly;
+  if (!aMap.IsBound2 (aName) )
+  {
+    std::cout << "Use 'vdisplay' before" << "\n";
+    return 1;
+  }
+
+  anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
+  if (anAssembly.IsNull())
+  {
+    di << "Not an assembly" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveObject) anIObj;
+  if (!aMap.IsBound2 (anObject))
+  {
+    // try to interpret second argument as child number
+    if (anObjectNumber > 0 && anObjectNumber <= anAssembly->Children().Size())
+    {
+      Standard_Integer aCounter = 1;
+      for (PrsMgr_ListOfPresentableObjectsIter anIter (anAssembly->Children()); anIter.More(); anIter.Next())
+      {
+        if (aCounter == anObjectNumber)
+        {
+          anIObj = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
+          break;
+        }
+        ++aCounter;
+      }
+    }
+    else
+    {
+      std::cout << "Use 'vdisplay' before" << "\n";
+      return 1;
+    }    
+  }
+
+  // if object was found by name
+  if (anIObj.IsNull())
+  {
+    anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (anObject));
+  }
+
+  anAssembly->Disconnect (anIObj);
+  aContext->UpdateCurrentViewer();
+
+  return 0;
+}
+
+//=======================================================================
+//function : VAddConnected
+//purpose  :
+//=======================================================================
+static Standard_Integer VAddConnected (Draw_Interpretor& di,
+                                       Standard_Integer argc,
+                                       const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    std::cout << argv[0] << "error : use 'vinit' command before " << "\n";
+    return 1;
+  }
+  
+  if (argc != 6)
+  {
+    std::cout << argv[0] << " error: expect 5 arguments\n";
+    return 1;
+  }
+
+  TCollection_AsciiString aName (argv[1]);
+  TCollection_AsciiString anObject (argv[5]);
+  Standard_Real aX = Draw::Atof (argv[2]);
+  Standard_Real aY = Draw::Atof (argv[3]);
+  Standard_Real aZ = Draw::Atof (argv[4]);
+
+  // find object
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  Handle(AIS_MultipleConnectedInteractive) anAssembly;
+  if (!aMap.IsBound2 (aName) )
+  {
+    std::cout << "Use 'vdisplay' before" << "\n";
+    return 1;
+  }
+
+  anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
+  if (anAssembly.IsNull())
+  {
+    di << "Not an assembly" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveObject) anIObj;
+  if (!aMap.IsBound2 (anObject))
+  {
+      std::cout << "Use 'vdisplay' before" << "\n";
+      return 1; 
+  }
+
+  anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (anObject));
+
+  gp_Trsf aTrsf;
+  aTrsf.SetTranslation (gp_Vec (aX, aY, aZ));
+  anAssembly->Connect (anIObj, aTrsf);
+  TheAISContext()->Display (anAssembly);
+  TheAISContext()->RecomputeSelectionOnly (anAssembly);
+  aContext->UpdateCurrentViewer();
+
+  return 0;
+}
+
+//=======================================================================
+//function : VListConnected
+//purpose  :
+//=======================================================================
+static Standard_Integer VListConnected (Draw_Interpretor& di,
+                                        Standard_Integer argc,
+                                        const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    std::cout << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+  
+  if (argc != 2)
+  {
+    std::cout << "ERROR : Usage : " << argv[0] << " name" << "\n";
+    return 1;
+  }
+
+  TCollection_AsciiString aName (argv[1]);
+
+  // find object
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  Handle(AIS_MultipleConnectedInteractive) anAssembly;
+  if (!aMap.IsBound2 (aName) )
+  {
+    std::cout << "Use 'vdisplay' before" << "\n";
+    return 1;
+  }
+
+  anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
+  if (anAssembly.IsNull())
+  {
+    std::cout << "Not an assembly" << "\n";
+    return 1;
+  }
+
+  std::cout << "Children of " << aName << ":\n";
+
+  Standard_Integer aCounter = 1;
+  for (PrsMgr_ListOfPresentableObjectsIter anIter (anAssembly->Children()); anIter.More(); anIter.Next())
+  {
+    if (GetMapOfAIS().IsBound1 (anIter.Value()))
+    {
+      TCollection_AsciiString aName = GetMapOfAIS().Find1 (anIter.Value());
+      std::cout << aCounter << ")  " << aName << "    (" << anIter.Value()->DynamicType()->Name() << ")";
+    }
+
+    std::cout << aCounter << ")  " << anIter.Value()->DynamicType()->Name();
+
+    Handle(AIS_ConnectedInteractive) aConnected = Handle(AIS_ConnectedInteractive)::DownCast (anIter.Value());
+    if (!aConnected.IsNull() && !aConnected->ConnectedTo().IsNull() && aMap.IsBound1 (aConnected->ConnectedTo()))
+    {
+      std::cout << " connected to " << aMap.Find1 (aConnected->ConnectedTo());
+    }
+    std::cout << std::endl;
+    
+    ++aCounter;
+  }
+
+  return 0;
+}
+
 namespace
 {
   //! Checks if theMode is already turned on for theObj.
@@ -5402,12 +5452,30 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
     __FILE__,VDrawPArray,group);
 
   theCommands.Add("vconnect", 
-    "vconnect : name Xo Yo Zo Xu Xv Xw Zu Zv Zw object1 object2 ... [color=NAME]", 
+    "vconnect : assembly_name Xo Yo Zo object1 object2 ..."
+    "  Makes an assembly of object instances located in point (Xo Yo Zo).",
     __FILE__, VConnect, group);
 
-  theCommands.Add("vconnectsh", 
-    "vconnectsh : name Xo Yo Zo Xu Xv Xw Zu Zv Zw shape1 shape2 ... [color=NAME]", 
-    __FILE__, VConnectShape, group);
+  theCommands.Add("vconnectto",
+    "vconnectto : instance_name Xo Yo Zo object"
+    "  Makes an instance 'instance_name' of 'object' with position (Xo Yo Zo).", 
+    __FILE__, VConnectTo,group);
+
+  theCommands.Add("vdisconnect",
+    "vdisconnect assembly_name (object_name | object_number | 'all')"
+    "  Disconnects all objects from assembly or disconnects object by name or number (use vlistconnected to enumerate assembly children).",
+    __FILE__,VDisconnect,group);
+
+  theCommands.Add("vaddconnected",
+    "vaddconnected assembly_name object_name"
+    "Adds object to assembly.",
+    __FILE__,VAddConnected,group);
+
+  theCommands.Add("vlistconnected",
+    "vlistconnected assembly_name"
+    "Lists objects in assembly.",
+    __FILE__,VListConnected,group);
+
 
   theCommands.Add("vselmode", 
     "vselmode : [object] mode_number is_turned_on=(1|0)\n"
index 345a2441e3d8a459682b942473638ca5cad4fddc..5d5e01658236c494ffdd470dee6b5995afdfcab3 100644 (file)
@@ -6713,6 +6713,53 @@ static int VHighlightSelected (Draw_Interpretor& theDI,
   return 0;
 }
 
+//=======================================================================
+//function : VXRotate
+//purpose  :
+//=======================================================================
+static Standard_Integer VXRotate (Draw_Interpretor& di,
+                                   Standard_Integer argc,
+                                   const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull())
+  {
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+  
+  if (argc != 3)
+  {
+    di << "ERROR : Usage : " << argv[0] << " name angle" << "\n";
+    return 1;
+  }
+
+  TCollection_AsciiString aName (argv[1]);
+  Standard_Real anAngle = Draw::Atof (argv[2]);
+
+  // find object
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  Handle(AIS_InteractiveObject) anIObj;
+  if (!aMap.IsBound2 (aName) )
+  {
+    di << "Use 'vdisplay' before" << "\n";
+    return 1;
+  }
+  else
+  {
+    anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
+
+    gp_Trsf aTransform;
+    aTransform.SetRotation (gp_Ax1 (gp_Pnt (0.0, 0.0, 0.0), gp_Vec (1.0, 0.0, 0.0)), anAngle);
+    aTransform.SetTranslationPart (anIObj->LocalTransformation().TranslationPart());
+
+    aContext->SetLocation (anIObj, aTransform);
+    aContext->UpdateCurrentViewer();
+  }
+
+  return 0;
+}
+
 //=======================================================================
 //function : ViewerCommands
 //purpose  :
@@ -7086,4 +7133,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
     "Without arguments it shows if highlighting of selected objects is enabled now.",
     __FILE__,VHighlightSelected,group);
 
+
+  theCommands.Add("vxrotate",
+    "vxrotate",
+    __FILE__,VXRotate,group);
+
 }
index 9c6af2fbef6696e7a835042f77c04716cd842e21..dda4aca3898d059515e36c5537ea663108f68fca 100755 (executable)
@@ -58,7 +58,7 @@ set y_refresh 10
 restore [locate_data_file OCC12121-CrankArm.brep] obj 
 vinit
 vdisplay obj
-vconnectsh new 50 50 50 1 0 0 0 0 1 obj
+vconnect new 50 50 50 obj
 vfit
 vmoveto $x1 $y1
 set ColorObj1 [QAGetPixelColor ${x2} ${y2}]
@@ -68,12 +68,12 @@ vselect $x1 $y1
 set ColorObj2 [QAGetPixelColor ${x2} ${y2}]
 set ColorNew2 [QAGetPixelColor ${x3} ${y3}]
 
-puts "Check vconnectsh command"
-set status_vconnectsh 0
+puts "Check vconnect command"
+set status_vconnect 0
 if { ${ColorObj1} == ${ColorNew1} && ${ColorObj2} == ${ColorNew2} } {   
-    set status_vconnectsh 0
+    set status_vconnect 0
 } else {
-    set status_vconnectsh 1
+    set status_vconnect 1
 }
 
 vselect ${x_refresh} ${y_refresh}
@@ -124,7 +124,7 @@ vselect ${x_refresh} ${y_refresh}
 
 ##Resume
 puts ""
-if { ${status_vconnectsh} == 0 } {
+if { ${status_vconnect} == 1 } {
    puts "OK ${BugNumber}"
 } else {
    puts "Faulty ${BugNumber}"
diff --git a/tests/bugs/vis/bug23422 b/tests/bugs/vis/bug23422
new file mode 100644 (file)
index 0000000..477fb0b
--- /dev/null
@@ -0,0 +1,20 @@
+puts "============"
+puts "CR23422"
+puts "============"
+puts ""
+#######################################################################
+#  Selection problems when using SetLocation.
+#######################################################################
+
+box b 50 50 50
+vinit
+vsetdispmode 1
+vdisplay b
+vtrihedron t
+
+vsetlocation b 30 30 130
+
+vmoveto 240 150
+
+set anImage ${imagedir}/${casename}.png
+vdump ${anImage}
index e6fb3cc8b75dc3f417a135309984ce5eee2b23a2..d13af6161ff73fdb40dba63c6839f73f6858f509 100644 (file)
@@ -17,7 +17,7 @@ vinit View1
 vclear
 vaxo
 vsetdispmode 1
-vconnectsh b1c -3 0 0 1 0 0 0 0 1 b1 b2
+vconnect b1c -3 0 0 b1 b2
 vfit
 
 vdump $Image1
diff --git a/tests/bugs/vis/bug24756 b/tests/bugs/vis/bug24756
new file mode 100644 (file)
index 0000000..9b46631
--- /dev/null
@@ -0,0 +1,18 @@
+puts "============"
+puts "CR24756"
+puts "============"
+puts ""
+#######################################################################
+#  AIS_ConnectedInteractive does not support nested AIS_ConnectedInteractive
+#######################################################################
+
+vinit
+box b 1 1 1
+vdisplay b
+vconnectto b1 2 0 0 b
+vconnectto b2 2 0 0 b1
+vsetlocation b1 2 1 0
+vfit
+
+set anImage ${imagedir}/${casename}.png
+vdump ${anImage}
diff --git a/tests/bugs/vis/bug24837_1 b/tests/bugs/vis/bug24837_1
new file mode 100644 (file)
index 0000000..cffd324
--- /dev/null
@@ -0,0 +1,41 @@
+puts "============"
+puts "CR24837_1"
+puts "============"
+puts ""
+#######################################################################
+#  Visualization - revise design and implementation of connected Interactive Objects
+#######################################################################
+
+pload MODELING VISUALIZATION
+vinit
+box b 1 1 1
+psphere s 0.5
+vdisplay b s
+vsetlocation s 0 2.5 0
+box d 0.5 0.5 3
+box d2 0.5 3 0.5
+vdisplay d d2
+vconnectto b1 -2 0 0 b
+vconnect z 2 0 0 b s
+vconnect z2 4 0 0 d d2
+vconnect z3 6 0 0 z z2
+vconnect z4 10 0 0 z3 z2
+vfit
+set anImage ${imagedir}/${casename}_1_1.png
+vdump ${anImage}
+
+vaddconnected z4 0 4 0 s
+vdisconnect z4 1
+vfit
+set anImage ${imagedir}/${casename}_1_2.png
+vdump ${anImage}
+
+vhlr on
+set anImage ${imagedir}/${casename}_1_3.png
+vdump ${anImage}
+
+vhlr off
+vsetdispmode 1
+vmoveto 320 330
+set anImage ${imagedir}/${casename}_1_4.png
+vdump ${anImage}
diff --git a/tests/bugs/vis/bug24837_2 b/tests/bugs/vis/bug24837_2
new file mode 100644 (file)
index 0000000..d3b99f8
--- /dev/null
@@ -0,0 +1,38 @@
+puts "============"
+puts "CR24837_2"
+puts "============"
+puts ""
+#######################################################################
+#  Visualization - revise design and implementation of connected Interactive Objects
+#######################################################################
+
+pload MODELING VISUALIZATION
+box o1 -10 -10 -5 1 1 10
+box o2  10  10 -5 1 1 10
+box b1 0 0 0 1 2 3
+box b2 3 0 0 3 2 1
+vinit View1
+vclear
+vtop
+vsetdispmode 0
+vdisplay o1 o2
+vdisplay b1 b2
+vfit
+vdrawtext "b1"   0 -3 3 255  25  25 2 0 000 0 14 1 Arial
+vdrawtext "b2"   3  0 3  25 255  25 2 0 000 0 14 1 Arial
+vdrawtext "bc_1" 0 -9 3 255 225 225 2 0 000 0 14 1 Arial
+vdrawtext "bc_2" 3 -6 3 255 225 225 2 0 000 0 14 1 Arial
+vsetdispmode 1
+set anImage ${imagedir}/${casename}_2_1.png
+vdump ${anImage}
+
+vsetmaterial b1 b2 plastic
+vsetcolor b1 RED
+vsetcolor b2 GREEN
+set anImage ${imagedir}/${casename}_2_2.png
+vdump ${anImage}
+
+vsetlocation b1 0 -3 0
+vconnect bc 0 -6 0 b1 b2
+set anImage ${imagedir}/${casename}_2_3.png
+vdump ${anImage}
diff --git a/tests/bugs/vis/bug25103 b/tests/bugs/vis/bug25103
new file mode 100644 (file)
index 0000000..edbfd9e
--- /dev/null
@@ -0,0 +1,48 @@
+puts "============"
+puts "CR25103"
+puts "============"
+puts ""
+#######################################################################
+#  Visualization - Regression in interactive detection
+#######################################################################
+
+vinit
+vsetdispmode 1
+
+box wall1 1 8 8
+box wall2 1 8 8
+box wall3 16 8 1
+
+vdisplay wall1
+vdisplay wall2
+vdisplay wall3
+
+vsetlocation wall1 -10 0 0
+vsetlocation wall2 5 0 0
+vsetlocation wall3 -10 0 -1
+
+vsetmaterial wall1 stone
+vsetmaterial wall2 stone
+vsetmaterial wall3 pewter
+
+vsetcolor wall1 red
+vsetcolor wall2 green
+
+vright
+vturnview 0 -0.3 0
+vfit
+
+set anImage ${imagedir}/${casename}_1.png
+vdump ${anImage}
+
+# The next line should highlight the green box (wall2) but it does not
+vmoveto 394 205
+
+set anImage ${imagedir}/${casename}_2.png
+vdump ${anImage}
+
+# The next line should not hit any object but it highlights the green box
+vmoveto 264 205
+
+set anImage ${imagedir}/${casename}_3.png
+vdump ${anImage}
index b53631d5302bd23f4049331b2c7349ea18117173..aac69bef39dd87a2a2f90a5d80df107fcb6331db 100644 (file)
@@ -12,12 +12,12 @@ vclear
 vrenderparams -rasterization
 vsetdispmode 1
 vaxo
-vconnectsh b1c -3 0 0 1 0 0 0 0 1 b1 b2
+vconnect b1c -3 0 0 b1 b2
 vfit
 vrotate 0.2 0.0 0.0
 vfit
 vclear
-vconnectsh b1c -3 0 0 1 0 0 0 0 1 b1 b2
+vconnect b1c -3 0 0 b1 b2
 
 # take snapshot with fixed pipeline
 vdump $::imagedir/${::casename}_OFF.png
@@ -27,4 +27,4 @@ vrenderparams -raytrace
 vdump $::imagedir/${::casename}_rt1.png
 
 vclear
-vconnectsh b1c -3 0 0 1 0 0 0 0 1 b1 b2
+vconnect b1c -3 0 0 b1 b2