]> OCCT Git - occt-copy.git/commitdiff
0027860: Visualization - clean up Transformation Persistence API
authorkgv <kgv@opencascade.com>
Mon, 19 Sep 2016 20:40:07 +0000 (23:40 +0300)
committerkgv <kgv@opencascade.com>
Fri, 30 Sep 2016 06:43:12 +0000 (09:43 +0300)
Graphic3d_Camera::TransformMatrices redundant NCollection_Handle usage
has been replaced with validity flags.

Graphic3d_TransModeFlags now defined as enumeration, not integer bit flags.
Graphic3d_TMF_PanPers and Graphic3d_TMF_FullPers have been removed.
Graphic3d_TMF_ZoomRotatePers has been introduced.

Graphic3d_TransformPers is now inherits Standard_Transient.
Graphic3d_TransformPers now defines dedicated constructors
for 3D persistence (zoom / rotate) and 2D persistence (2d / trihedron).
2D persistence now supports dedicated values for X and Y offsets.
The corner is now specified by enumeration Aspect_TypeOfTriedronPosition
instead of indirect interpretation of anchor point values.
Fixed handling of Graphic3d_TMF_ZoomRotatePers (combination of Graphic3d_TMF_RotatePers + Graphic3d_TMF_ZoomPers).

PrsMgr_PresentableObject, Graphic3d_CStructure now hold
Handle(Graphic3d_TransformPers) instead of a value.
Method ::SetTransformPersistence(), ::TransformPersistence()
now works with Handle(Graphic3d_TransformPers).
Old methods have been marked deprecated.

53 files changed:
dox/dev_guides/upgrade/upgrade.md
samples/mfc/standard/Common/OCC_BaseView.cpp
samples/mfc/standard/Common/Primitive/Sample2D_Face.cpp
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_Manipulator.cxx
src/AIS/AIS_Manipulator.hxx
src/AIS/AIS_MultipleConnectedInteractive.cxx
src/AIS/AIS_MultipleConnectedInteractive.hxx
src/AIS/AIS_RubberBand.cxx
src/AIS/AIS_TextLabel.cxx
src/Aspect/Aspect_TypeOfTriedronPosition.hxx
src/Graphic3d/FILES
src/Graphic3d/Graphic3d_CStructure.hxx
src/Graphic3d/Graphic3d_CView.cxx
src/Graphic3d/Graphic3d_Camera.cxx
src/Graphic3d/Graphic3d_Camera.hxx
src/Graphic3d/Graphic3d_Structure.cxx
src/Graphic3d/Graphic3d_Structure.hxx
src/Graphic3d/Graphic3d_Structure.lxx [deleted file]
src/Graphic3d/Graphic3d_TransModeFlags.hxx
src/Graphic3d/Graphic3d_TransformPers.cxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_TransformPers.hxx
src/MeshVS/MeshVS_Mesh.cxx
src/NCollection/NCollection_Mat4.hxx
src/OpenGl/OpenGl_BVHClipPrimitiveTrsfPersSet.cxx
src/OpenGl/OpenGl_BackgroundArray.cxx
src/OpenGl/OpenGl_GraduatedTrihedron.cxx
src/OpenGl/OpenGl_Layer.cxx
src/OpenGl/OpenGl_Structure.cxx
src/OpenGl/OpenGl_Structure.hxx
src/OpenGl/OpenGl_StructureShadow.cxx
src/OpenGl/OpenGl_View.cxx
src/PrsMgr/PrsMgr_PresentableObject.cxx
src/PrsMgr/PrsMgr_PresentableObject.hxx
src/QABugs/QABugs_11.cxx
src/SelectMgr/SelectMgr_SelectableObject.cxx
src/SelectMgr/SelectMgr_SelectableObjectSet.cxx
src/SelectMgr/SelectMgr_SelectableObjectSet.hxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/StdSelect/StdSelect_BRepOwner.cxx
src/StdSelect/StdSelect_ViewerSelector3d.cxx
src/StdSelect/StdSelect_ViewerSelector3d.hxx
src/V3d/V3d_View.cxx
src/ViewerTest/ViewerTest.cxx
src/ViewerTest/ViewerTest_ObjectCommands.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
tests/bugs/vis/bug23120
tests/bugs/vis/bug25783_1
tests/bugs/vis/bug26149
tests/bugs/vis/bug26344
tests/bugs/vis/bug27739
tests/v3d/glsl/tiles

index 58db74b63ee179ed316e759bbc93fdff7dbcdd0a..740b5dfd1b710e7406416ac8d9c3a8e08d429f84 100644 (file)
@@ -1034,10 +1034,17 @@ Thus the recommended way to generate vector image of a 3D model or scene is to u
 
 @subsection upgrade_710_trsfpers Transformation persistence
 
-The behavior of transformation persistence flags Graphic3d_TMF_ZoomPers and Graphic3d_TMF_TriedronPers have been changed to be consistent with textured fixed-size 2D text.
+The behavior of transformation persistence flags *Graphic3d_TMF_ZoomPers* and *Graphic3d_TMF_TriedronPers* have been changed to be consistent with textured fixed-size 2D text.
 Object with these flags is considered to be defined in pixel units, and presentation is no more scaled depending on view height.
 Applications that need to scale such objects depending on viewport size should update them manually.
 
+Flags *Graphic3d_TMF_PanPers* and *Graphic3d_TMF_FullPers* has been removed.
+*Graphic3d_TMF_TriedronPers* or *Graphic3d_TMF_2d* can be used instead depending on context.
+
+*Graphic3d_TransModeFlags* is not an integer bitmask anymore - enumeration values should be specified instead.
+Several transformation persistence methods in PrsMgr_PresentableObject have been marked deprecated.
+Transformation persistence should be defined using directly Graphic3d_TransformPers constructor and passed by a handle, not value.
+
 @subsection upgrade_710_removed Removed features
 
 The following obsolete features have been removed:
index b03d65116ce880c47b92fcc1753b9546336e4968..1f5853a163f0f3af033e240ff18abfe32ec4bfcc 100755 (executable)
@@ -17,7 +17,7 @@ OCC_BaseView::OCC_BaseView()
     myCurZoom (0.0),
     myRect (new AIS_RubberBand (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0) )
 {
-  myRect->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));
+  myRect->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   if (myRect->ZLayer() != Graphic3d_ZLayerId_TopOSD)
   {
     myRect->SetZLayer (Graphic3d_ZLayerId_TopOSD);
index d2e227a9f0e7ecd523be7cdc6897c266aba0c8a1..264de85a3d46758c70cc2920d0c962e3aa69fca6 100755 (executable)
@@ -267,7 +267,7 @@ void Sample2D_Face::HilightSelected
   Handle(Graphic3d_AspectLine3d) aLineAspect =
     new Graphic3d_AspectLine3d(Quantity_NOC_ANTIQUEWHITE, Aspect_TOL_SOLID,2);
   if( HasPresentation() )
-    aSelectionPrs->SetTransformPersistence( Presentation()->TransformPersistenceMode(), Presentation()->TransformPersistencePoint() );
+    aSelectionPrs->SetTransformPersistence (Presentation()->TransformPersistence());
 
   Standard_Integer aLength = theOwners.Length();
   Handle (SelectMgr_EntityOwner) anOwner;
@@ -337,7 +337,7 @@ void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationMana
   Handle( Prs3d_Presentation ) aHighlightPrs;
   aHighlightPrs = GetHilightPresentation( thePM );
   if( HasPresentation() )
-    aHighlightPrs->SetTransformPersistence( Presentation()->TransformPersistenceMode(), Presentation()->TransformPersistencePoint() );
+    aHighlightPrs->SetTransformPersistence (Presentation()->TransformPersistence());
   if(theOwner.IsNull())
     return;
   aHighlightPrs->Clear();
index a55caec2b583e5d83d830e8efe99c633afc402db..60404c11c6bef27134bf0df179ffec48a52a8310 100644 (file)
@@ -2932,11 +2932,9 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
 //purpose  :
 //=======================================================================
 void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
-                                                      const Graphic3d_TransModeFlags&      theFlag,
-                                                      const gp_Pnt&                        thePoint)
+                                                      const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
-  theObject->SetTransformPersistence (theFlag, thePoint);
-
+  theObject->SetTransformPersistence (theTrsfPers);
   if (!myObjects.IsBound (theObject))
   {
     return;
index 148ec6a4676ea262977f51176599404fb026cfbd..5ea873516241294c234ef2d5d3dffe25bac79082 100644 (file)
@@ -599,9 +599,16 @@ public:
   Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
   
   //! Sets transform persistence.
-  Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
-                                                const Graphic3d_TransModeFlags&      theFlag,
-                                                const gp_Pnt&                        thePoint = gp_Pnt (0.0, 0.0, 0.0));
+  Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
+                                                const Handle(Graphic3d_TransformPers)& theTrsfPers);
+
+  Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
+  void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
+                                const Graphic3d_TransModeFlags&      theFlag,
+                                const gp_Pnt&                        thePoint = gp_Pnt (0.0, 0.0, 0.0))
+  {
+    SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
+  }
 
   //! Updates the current viewer, the viewer in Neutral Point.
   //! Objects selected when there is no open local context
index 370ec76a448554da994e0855ad81d48ccc25dbd4..2bd71c1cbdf59da21d1c0a89a83ee394c69abfe4 100644 (file)
@@ -651,10 +651,11 @@ void AIS_Manipulator::updateTransformation()
 
   if (myIsZoomPersistentMode)
   {
-    if (!(GetTransformPersistenceMode () == Graphic3d_TMF_ZoomPers
-       && GetTransformPersistencePoint().IsEqual (myPosition.Location(), 0.)))
+    if (TransformPersistence().IsNull()
+    ||  TransformPersistence()->Mode() != Graphic3d_TMF_ZoomPers
+    || !TransformPersistence()->AnchorPoint().IsEqual (myPosition.Location(), 0.0))
     {
-      setTransformPersistence (Graphic3d_TMF_ZoomPers, myPosition.Location());
+      setTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_ZoomPers, myPosition.Location()));
     }
   }
 }
@@ -734,7 +735,7 @@ void AIS_Manipulator::SetZoomPersistence (const Standard_Boolean theToEnable)
 
   if (!theToEnable)
   {
-    setTransformPersistence (Graphic3d_TMF_None, gp::Origin());
+    setTransformPersistence (Handle(Graphic3d_TransformPers)());
   }
 
   updateTransformation();
@@ -742,28 +743,28 @@ void AIS_Manipulator::SetZoomPersistence (const Standard_Boolean theToEnable)
 
 //=======================================================================
 //function : SetTransformPersistence
-//purpose  : 
+//purpose  :
 //=======================================================================
-void AIS_Manipulator::SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint)
+void AIS_Manipulator::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
   Standard_ASSERT_RETURN (!myIsZoomPersistentMode,
     "AIS_Manipulator::SetTransformPersistence: "
-    "Custom settings are not supported by this class in ZoomPersistence mode",);
+    "Custom settings are not allowed by this class in ZoomPersistence mode",);
 
-  setTransformPersistence (theFlag, thePoint);
+  setTransformPersistence (theTrsfPers);
 }
 
 //=======================================================================
 //function : setTransformPersistence
 //purpose  : 
 //=======================================================================
-void AIS_Manipulator::setTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint)
+void AIS_Manipulator::setTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
-  AIS_InteractiveObject::SetTransformPersistence (theFlag, thePoint);
+  AIS_InteractiveObject::SetTransformPersistence (theTrsfPers);
 
   for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
   {
-    myAxes[anIt].SetTransformPersistence (theFlag, thePoint);
+    myAxes[anIt].SetTransformPersistence (theTrsfPers);
   }
 }
 
@@ -814,8 +815,7 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
     anAspectAx->SetColor (myAxes[anIt].Color());
     aGroup->SetGroupPrimitivesAspect (anAspectAx->Aspect());
     myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx);
-    myAxes[anIt].SetTransformPersistence (GetTransformPersistenceMode(),
-                                          GetTransformPersistencePoint());
+    myAxes[anIt].SetTransformPersistence (TransformPersistence());
   }
 
   updateTransformation();
index 15d7c5c6b001321633e22adf73b6394c7bf04c83..358ee17e206484cf55dd766838848e17f4729164 100644 (file)
@@ -250,7 +250,7 @@ public: //! @name Configuration of graphical transformations
   //! silently does nothing in release mode.
   //! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
   //! when enabling zoom persistence.
-  Standard_EXPORT virtual void SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint) Standard_OVERRIDE;
+  Standard_EXPORT virtual void SetTransformPersistence (const  Handle(Graphic3d_TransformPers)& theTrsfPers) Standard_OVERRIDE;
 
   //! Redefines local transformation management method to inform user of inproper use.
   //! @warning this interactive object does not support setting custom local transformation,
@@ -347,7 +347,7 @@ protected:
 
   Standard_EXPORT void adjustSize (const Bnd_Box& theBox);
 
-  Standard_EXPORT void setTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint);
+  Standard_EXPORT void setTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
 
 protected: //! @name Auxilliary classes to fill presentation with proper primitives
 
@@ -489,28 +489,24 @@ protected: //! @name Auxilliary classes to fill presentation with proper primiti
 
     const gp_Ax1& Position() const { return myPosition; }
 
-    void SetTransformPersistence (const Graphic3d_TransModeFlags& theFlags, const gp_Pnt& thePoint)
+    void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
     {
       if (!myHighlightTranslator.IsNull())
       {
-        myHighlightTranslator->SetTransformPersistence (theFlags, thePoint);
+        myHighlightTranslator->SetTransformPersistence (theTrsfPers);
       }
 
       if (!myHighlightScaler.IsNull())
       {
-        myHighlightScaler->SetTransformPersistence (theFlags, thePoint);
+        myHighlightScaler->SetTransformPersistence (theTrsfPers);
       }
 
       if (!myHighlightRotator.IsNull())
       {
-        myHighlightRotator->SetTransformPersistence (theFlags, thePoint);
+        myHighlightRotator->SetTransformPersistence (theTrsfPers);
       }
     }
 
-    Graphic3d_TransModeFlags GetTransformPersistenceMode() const { return myHighlightTranslator->TransformPersistenceMode(); }
-
-    gp_Pnt GetTransformPersistencePoint() const { return myHighlightTranslator->TransformPersistencePoint(); }
-
     void Transform (const Handle(Geom_Transformation)& theTransformation)
     {
       if (!myHighlightTranslator.IsNull())
index ed5cc6f377a5834d593c27bb0c35344f22007130..087b82460d0827d11f76fc5a615a5d4b3afb1944 100644 (file)
@@ -195,8 +195,7 @@ Standard_Integer AIS_MultipleConnectedInteractive::Signature() const
 //=======================================================================
 Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
                                                                          const gp_Trsf&                       theTransformation,
-                                                                         const Graphic3d_TransModeFlags&      theTrsfPersFlag,
-                                                                         const gp_Pnt&                        theTrsfPersPoint)
+                                                                         const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
   if (myAssemblyOwner.IsNull())
     myAssemblyOwner = new SelectMgr_EntityOwner (this);
@@ -234,9 +233,9 @@ Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const H
   }
 
   anObjectToAdd->SetLocalTransformation (theTransformation);
-  if (theTrsfPersFlag != Graphic3d_TMF_None)
+  if (!theTrsfPers.IsNull())
   {
-    anObjectToAdd->SetTransformPersistence (theTrsfPersFlag, theTrsfPersPoint);
+    anObjectToAdd->SetTransformPersistence (theTrsfPers);
   }
   AddChild (anObjectToAdd);
   return anObjectToAdd;
@@ -248,9 +247,7 @@ Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const H
 //=======================================================================
 Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj)
 {
-  return Connect (theAnotherObj, theAnotherObj->LocalTransformation(),
-                  theAnotherObj->GetTransformPersistenceMode(),
-                  theAnotherObj->GetTransformPersistencePoint());
+  return Connect (theAnotherObj, theAnotherObj->LocalTransformation(), theAnotherObj->TransformPersistence());
 }
 
 //=======================================================================
@@ -260,9 +257,7 @@ Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const H
 Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
                                                                          const gp_Trsf&                       theTransformation)
 {
-  return Connect (theAnotherObj, theTransformation,
-                  theAnotherObj->GetTransformPersistenceMode(),
-                  theAnotherObj->GetTransformPersistencePoint());
+  return Connect (theAnotherObj, theTransformation, theAnotherObj->TransformPersistence());
 }
 
 //=======================================================================
index c22b5bd77423be84cdc552c7a86053bb77b1157f..b90e5051ccd94163b6dbd5a150fcccb531d75234 100644 (file)
@@ -66,7 +66,18 @@ public:
   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
   //! Locates instance in theLocation and applies specified transformation persistence mode.
   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
-  Standard_EXPORT virtual Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theInteractive, const gp_Trsf& theLocation, const Graphic3d_TransModeFlags& theTrsfPersFlag, const gp_Pnt& theTrsfPersPoint);
+  Standard_EXPORT virtual Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theInteractive,
+                                                                 const gp_Trsf& theLocation,
+                                                                 const Handle(Graphic3d_TransformPers)& theTrsfPers);
+
+  Standard_DEPRECATED("This method is deprecated - Connect() taking Graphic3d_TransformPers should be called instead")
+  Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theInteractive,
+                                         const gp_Trsf& theLocation,
+                                         const Graphic3d_TransModeFlags& theTrsfPersFlag,
+                                         const gp_Pnt& theTrsfPersPoint)
+  {
+    return Connect (theInteractive, theLocation, Graphic3d_TransformPers::FromDeprecatedParams (theTrsfPersFlag, theTrsfPersPoint));
+  }
   
   Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
   
index b9ccdb3f1b70bbaeb755c2bdb0f501b08dbe9f0a..b822316486293d85a2fd006b81752526860176e4 100644 (file)
@@ -47,7 +47,7 @@ AIS_RubberBand::AIS_RubberBand()
   myDrawer->ShadingAspect()->SetTransparency (1.0);
   myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
 
-  SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));
+  SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   SetZLayer (Graphic3d_ZLayerId_TopOSD);
 }
 
@@ -66,7 +66,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
   myDrawer->ShadingAspect()->SetTransparency (1.0);
   myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
 
-  SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));
+  SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   SetZLayer (Graphic3d_ZLayerId_TopOSD);
 }
 
@@ -87,7 +87,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
   myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
   myDrawer->ShadingAspect()->SetTransparency (theTransparency);
 
-  SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));
+  SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   SetZLayer (Graphic3d_ZLayerId_TopOSD);
 }
 
index 9066b18c50a733c98a0784f1d1e9b60c1b1560ec..5ba7e3773e43bde7245402bc9fbb31ddbf486b50 100644 (file)
@@ -284,10 +284,12 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
               aCenterOfLabel.ChangeCoord() -= myOrientation3D.XDirection().XYZ() * aWidth * 0.5;
             }
 
-            if (!anAsp->Aspect()->GetTextZoomable())
+            if (!anAsp->Aspect()->GetTextZoomable()
+             && (TransformPersistence().IsNull()
+              || TransformPersistence()->Mode() == Graphic3d_TMF_ZoomPers))
             {
               anAsp->Aspect()->SetTextZoomable (Standard_True);
-              SetTransformPersistence (GetTransformPersistenceMode() | Graphic3d_TMF_ZoomPers, aPosition);
+              SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_ZoomPers, aPosition));
               aPosition = gp::Origin();
             }
 
index cbc875aeb511a9c282b2194c9c64eb41383bc5e9..987e95e08a4845a97c1998296ba77d209e33f244 100644 (file)
 #ifndef _Aspect_TypeOfTriedronPosition_HeaderFile
 #define _Aspect_TypeOfTriedronPosition_HeaderFile
 
-//! Definition of the Triedron position in the views
-//!
-//! TOTP_CENTER         at the center of the view
-//! TOTP_LEFT_LOWER     at the left lower corner
-//! TOTP_LEFT_UPPER     at the left upper corner
-//! TOTP_RIGHT_LOWER    at the right lower corner
-//! TOTP_RIGHT_UPPER    at the right upper corner
-//! TOTP_01 to TOTP_10  not yet implemented.
+//! Definition of the Trihedron position in the views.
+//! It is defined as a bitmask to simplify handling vertical and horizontal alignment independently.
 enum Aspect_TypeOfTriedronPosition
 {
-Aspect_TOTP_CENTER,
-Aspect_TOTP_LEFT_LOWER,
-Aspect_TOTP_LEFT_UPPER,
-Aspect_TOTP_RIGHT_LOWER,
-Aspect_TOTP_RIGHT_UPPER,
-Aspect_TOTP_01,
-Aspect_TOTP_02,
-Aspect_TOTP_03,
-Aspect_TOTP_04,
-Aspect_TOTP_05,
-Aspect_TOTP_06,
-Aspect_TOTP_07,
-Aspect_TOTP_08,
-Aspect_TOTP_09,
-Aspect_TOTP_10
+  Aspect_TOTP_CENTER      = 0x0000,             //!< at the center of the view
+  Aspect_TOTP_TOP         = 0x0001,             //!< at the middle of the top    side
+  Aspect_TOTP_BOTTOM      = 0x0002,             //!< at the middle of the bottom side
+  Aspect_TOTP_LEFT        = 0x0004,             //!< at the middle of the left   side
+  Aspect_TOTP_RIGHT       = 0x0008,             //!< at the middle of the right  side
+  Aspect_TOTP_LEFT_LOWER  = Aspect_TOTP_BOTTOM
+                          | Aspect_TOTP_LEFT,   //!< at the left lower corner
+  Aspect_TOTP_LEFT_UPPER  = Aspect_TOTP_TOP
+                          | Aspect_TOTP_LEFT,   //!< at the left upper corner
+  Aspect_TOTP_RIGHT_LOWER = Aspect_TOTP_BOTTOM
+                          | Aspect_TOTP_RIGHT,  //!< at the right lower corner
+  Aspect_TOTP_RIGHT_UPPER = Aspect_TOTP_TOP
+                          | Aspect_TOTP_RIGHT,  //!< at the right upper corner
+
 };
 
 #endif // _Aspect_TypeOfTriedronPosition_HeaderFile
index 59ed3159f22341ab2b4978b3b1aed9c76263d201..6d6274f99bf7a666f5c2ef0fa2d400a4bdd0c8bc 100755 (executable)
@@ -98,7 +98,6 @@ Graphic3d_SortType.hxx
 Graphic3d_StereoMode.hxx
 Graphic3d_Structure.cxx
 Graphic3d_Structure.hxx
-Graphic3d_Structure.lxx
 Graphic3d_Structure.pxx
 Graphic3d_StructureDefinitionError.hxx
 Graphic3d_StructureManager.cxx
@@ -126,6 +125,7 @@ Graphic3d_TextureRoot.cxx
 Graphic3d_TextureRoot.hxx
 Graphic3d_TransformError.hxx
 Graphic3d_TransformPers.hxx
+Graphic3d_TransformPers.cxx
 Graphic3d_TransformUtils.hxx
 Graphic3d_TransModeFlags.hxx
 Graphic3d_TypeOfAnswer.hxx
index ae7bd3331c919793a33b097f56400bb4a7a6e7ef..bbfeb655daa5ef2c3a05a02427672bc27a2569a9 100644 (file)
@@ -46,6 +46,12 @@ public:
     return myGroups;
   }
 
+  //! Return transformation persistence.
+  const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
+
+  //! Set transformation persistence.
+  void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers) { myTrsfPers = theTrsfPers; }
+
   //! @return associated clip planes
   const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const
   {
@@ -143,8 +149,6 @@ public:
   unsigned IsMutable      : 1;
   unsigned Is2dText       : 1;
 
-  Graphic3d_TransformPers TransformPersistence;
-
 protected:
 
   //! Create empty structure.
@@ -155,6 +159,7 @@ protected:
   Handle(Graphic3d_GraphicDriver) myGraphicDriver;
   Graphic3d_SequenceOfGroup       myGroups;
   Graphic3d_BndBox4f              myBndBox;
+  Handle(Graphic3d_TransformPers) myTrsfPers;
   Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
 
 public:
index dbbd5d0000a38caab3e0c886be999e85d3bc14bc..047d5bf3e83b24986fd472dbb5970d600b588032 100644 (file)
@@ -530,14 +530,12 @@ Bnd_Box Graphic3d_CView::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
     }
 
     // "FitAll" operation ignores object with transform persistence parameter
-    if (aStructure->TransformPersistence().Flags != Graphic3d_TMF_None)
+    if (!aStructure->TransformPersistence().IsNull())
     {
       // Panning and 2d persistence apply changes to projection or/and its translation components.
       // It makes them incompatible with z-fitting algorithm. Ignored by now.
-      if (!theToIgnoreInfiniteFlag ||
-          (aStructure->TransformPersistence().Flags & Graphic3d_TMF_2d) ||
-          (aStructure->TransformPersistence().Flags & Graphic3d_TMF_PanPers) ||
-          (aStructure->TransformPersistence().Flags & Graphic3d_TMF_TriedronPers))
+      if (!theToIgnoreInfiniteFlag
+       || aStructure->TransformPersistence()->IsTrihedronOr2d())
       {
         continue;
       }
@@ -550,11 +548,11 @@ Bnd_Box Graphic3d_CView::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
       continue;
     }
 
-    if (aStructure->TransformPersistence().Flags != Graphic3d_TMF_None)
+    if (!aStructure->TransformPersistence().IsNull())
     {
       const Graphic3d_Mat4d& aProjectionMat = aCamera->ProjectionMatrix();
       const Graphic3d_Mat4d& aWorldViewMat  = aCamera->OrientationMatrix();
-      aStructure->TransformPersistence().Apply (aCamera, aProjectionMat, aWorldViewMat, aWinWidth, aWinHeight, aBox);
+      aStructure->TransformPersistence()->Apply (aCamera, aProjectionMat, aWorldViewMat, aWinWidth, aWinHeight, aBox);
     }
 
     // To prevent float overflow at camera parameters calculation and further
index 754af59094d16980428c05c442daf90ec45d7238..f9f5c034c21915e01160fe63f4f8d359f00b501b 100644 (file)
@@ -74,6 +74,7 @@ Graphic3d_Camera::Graphic3d_Camera()
   myAxialScale (1.0, 1.0, 1.0),
   myProjType (Projection_Orthographic),
   myFOVy (45.0),
+  myFOVyTan (Tan (DTR_HALF * 45.0)),
   myZNear (DEFAULT_ZNEAR),
   myZFar (DEFAULT_ZFAR),
   myAspect (1.0),
@@ -271,7 +272,7 @@ void Graphic3d_Camera::SetScale (const Standard_Real theScale)
     case Projection_MonoLeftEye  :
     case Projection_MonoRightEye :
     {
-      Standard_Real aDistance = theScale * 0.5 / Tan(DTR_HALF * myFOVy);
+      Standard_Real aDistance = theScale * 0.5 / myFOVyTan;
       SetDistance (aDistance);
     }
 
@@ -298,7 +299,7 @@ Standard_Real Graphic3d_Camera::Scale() const
     // case Projection_MonoLeftEye  :
     // case Projection_MonoRightEye :
     default :
-      return Distance() * 2.0 * Tan (DTR_HALF * myFOVy);
+      return Distance() * 2.0 * myFOVyTan;
   }
 }
 
@@ -344,6 +345,7 @@ void Graphic3d_Camera::SetFOVy (const Standard_Real theFOVy)
   }
 
   myFOVy = theFOVy;
+  myFOVyTan = Tan(DTR_HALF * myFOVy);
 
   InvalidateProjection();
 }
@@ -646,7 +648,7 @@ gp_Pnt Graphic3d_Camera::ConvertView2World (const gp_Pnt& thePnt) const
 gp_XYZ Graphic3d_Camera::ViewDimensions (const Standard_Real theZValue) const
 {
   // view plane dimensions
-  Standard_Real aSize = IsOrthographic() ? myScale : (2.0 * theZValue * Tan (DTR_HALF * myFOVy));
+  Standard_Real aSize = IsOrthographic() ? myScale : (2.0 * theZValue * myFOVyTan);
   Standard_Real aSizeX, aSizeY;
   if (myAspect > 1.0)
   {
@@ -719,7 +721,7 @@ void Graphic3d_Camera::Frustum (gp_Pln& theLeft,
 // =======================================================================
 const Graphic3d_Mat4d& Graphic3d_Camera::OrientationMatrix() const
 {
-  return *UpdateOrientation (myMatricesD).Orientation;
+  return UpdateOrientation (myMatricesD).Orientation;
 }
 
 // =======================================================================
@@ -728,7 +730,7 @@ const Graphic3d_Mat4d& Graphic3d_Camera::OrientationMatrix() const
 // =======================================================================
 const Graphic3d_Mat4& Graphic3d_Camera::OrientationMatrixF() const
 {
-  return *UpdateOrientation (myMatricesF).Orientation;
+  return UpdateOrientation (myMatricesF).Orientation;
 }
 
 // =======================================================================
@@ -737,7 +739,7 @@ const Graphic3d_Mat4& Graphic3d_Camera::OrientationMatrixF() const
 // =======================================================================
 const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionMatrix() const
 {
-  return *UpdateProjection (myMatricesD).MProjection;
+  return UpdateProjection (myMatricesD).MProjection;
 }
 
 // =======================================================================
@@ -746,7 +748,7 @@ const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionMatrix() const
 // =======================================================================
 const Graphic3d_Mat4& Graphic3d_Camera::ProjectionMatrixF() const
 {
-  return *UpdateProjection (myMatricesF).MProjection;
+  return UpdateProjection (myMatricesF).MProjection;
 }
 
 // =======================================================================
@@ -755,7 +757,7 @@ const Graphic3d_Mat4& Graphic3d_Camera::ProjectionMatrixF() const
 // =======================================================================
 const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionStereoLeft() const
 {
-  return *UpdateProjection (myMatricesD).LProjection;
+  return UpdateProjection (myMatricesD).LProjection;
 }
 
 // =======================================================================
@@ -764,7 +766,7 @@ const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionStereoLeft() const
 // =======================================================================
 const Graphic3d_Mat4& Graphic3d_Camera::ProjectionStereoLeftF() const
 {
-  return *UpdateProjection (myMatricesF).LProjection;
+  return UpdateProjection (myMatricesF).LProjection;
 }
 
 // =======================================================================
@@ -773,7 +775,7 @@ const Graphic3d_Mat4& Graphic3d_Camera::ProjectionStereoLeftF() const
 // =======================================================================
 const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionStereoRight() const
 {
-  return *UpdateProjection (myMatricesD).RProjection;
+  return UpdateProjection (myMatricesD).RProjection;
 }
 
 // =======================================================================
@@ -782,7 +784,7 @@ const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionStereoRight() const
 // =======================================================================
 const Graphic3d_Mat4& Graphic3d_Camera::ProjectionStereoRightF() const
 {
-  return *UpdateProjection (myMatricesF).RProjection;
+  return UpdateProjection (myMatricesF).RProjection;
 }
 
 // =======================================================================
@@ -813,8 +815,8 @@ Graphic3d_Camera::TransformMatrices<Elem_t>&
   }
   else
   {
-    aDXHalf = aZNear * Elem_t (Tan (DTR_HALF * myFOVy));
-    aDYHalf = aZNear * Elem_t (Tan (DTR_HALF * myFOVy));
+    aDXHalf = aZNear * Elem_t (myFOVyTan);
+    aDYHalf = aZNear * Elem_t (myFOVyTan);
   }
 
   if (anAspect > 1.0)
@@ -854,19 +856,19 @@ Graphic3d_Camera::TransformMatrices<Elem_t>&
   switch (myProjType)
   {
     case Projection_Orthographic :
-      OrthoProj (aLeft, aRight, aBot, aTop, aZNear, aZFar, *theMatrices.MProjection);
+      OrthoProj (aLeft, aRight, aBot, aTop, aZNear, aZFar, theMatrices.MProjection);
       break;
 
     case Projection_Perspective :
-      PerspectiveProj (aLeft, aRight, aBot, aTop, aZNear, aZFar, *theMatrices.MProjection);
+      PerspectiveProj (aLeft, aRight, aBot, aTop, aZNear, aZFar, theMatrices.MProjection);
       break;
 
     case Projection_MonoLeftEye :
     {
       StereoEyeProj (aLeft, aRight, aBot, aTop,
                      aZNear, aZFar, aIOD, aFocus,
-                     Standard_True, *theMatrices.MProjection);
-      *theMatrices.LProjection = *theMatrices.MProjection;
+                     Standard_True, theMatrices.MProjection);
+      theMatrices.LProjection = theMatrices.MProjection;
       break;
     }
 
@@ -874,24 +876,24 @@ Graphic3d_Camera::TransformMatrices<Elem_t>&
     {
       StereoEyeProj (aLeft, aRight, aBot, aTop,
                      aZNear, aZFar, aIOD, aFocus,
-                     Standard_False, *theMatrices.MProjection);
-      *theMatrices.RProjection = *theMatrices.MProjection;
+                     Standard_False, theMatrices.MProjection);
+      theMatrices.RProjection = theMatrices.MProjection;
       break;
     }
 
     case Projection_Stereo :
     {
-      PerspectiveProj (aLeft, aRight, aBot, aTop, aZNear, aZFar, *theMatrices.MProjection);
+      PerspectiveProj (aLeft, aRight, aBot, aTop, aZNear, aZFar, theMatrices.MProjection);
 
       StereoEyeProj (aLeft, aRight, aBot, aTop,
                      aZNear, aZFar, aIOD, aFocus,
                      Standard_True,
-                     *theMatrices.LProjection);
+                     theMatrices.LProjection);
 
       StereoEyeProj (aLeft, aRight, aBot, aTop,
                      aZNear, aZFar, aIOD, aFocus,
                      Standard_False,
-                     *theMatrices.RProjection);
+                     theMatrices.RProjection);
       break;
     }
   }
@@ -930,7 +932,7 @@ Graphic3d_Camera::TransformMatrices<Elem_t>&
                                          static_cast<Elem_t> (myAxialScale.Y()),
                                          static_cast<Elem_t> (myAxialScale.Z()));
 
-  LookOrientation (anEye, aCenter, anUp, anAxialScale, *theMatrices.Orientation);
+  LookOrientation (anEye, aCenter, anUp, anAxialScale, theMatrices.Orientation);
 
   return theMatrices; // for inline accessors
 }
index fe9e44b6583ac4586f1c6c5e49341476aeb18e2b..bc710d32306908cc9c3a8b45ee69249c35ac229d 100644 (file)
@@ -22,8 +22,6 @@
 #include <Graphic3d_Vec3.hxx>
 #include <Graphic3d_WorldViewProjState.hxx>
 
-#include <NCollection_Handle.hxx>
-
 #include <gp_Dir.hxx>
 #include <gp_Pnt.hxx>
 
@@ -45,46 +43,50 @@ private:
   template<typename Elem_t>
   struct TransformMatrices
   {
+
+    //! Default constructor.
+    TransformMatrices() : myIsOrientationValid (Standard_False), myIsProjectionValid (Standard_False) {}
+
+    //! Initialize orientation.
     void InitOrientation()
     {
-      Orientation = new NCollection_Mat4<Elem_t>();
+      myIsOrientationValid = Standard_True;
+      Orientation.InitIdentity();
     }
 
+    //! Initialize projection.
     void InitProjection()
     {
-      MProjection = new NCollection_Mat4<Elem_t>();
-      LProjection = new NCollection_Mat4<Elem_t>();
-      RProjection = new NCollection_Mat4<Elem_t>();
+      myIsProjectionValid = Standard_True;
+      MProjection.InitIdentity();
+      LProjection.InitIdentity();
+      RProjection.InitIdentity();
     }
 
-    void ResetOrientation()
-    {
-      Orientation.Nullify();
-    }
+    //! Invalidate orientation.
+    void ResetOrientation() { myIsOrientationValid = Standard_False; }
 
-    void ResetProjection()
-    {
-      MProjection.Nullify();
-      LProjection.Nullify();
-      RProjection.Nullify();
-    }
+    //! Invalidate projection.
+    void ResetProjection()  { myIsProjectionValid  = Standard_False; }
 
-    Standard_Boolean IsOrientationValid()
-    {
-      return !Orientation.IsNull();
-    }
+    //! Return true if Orientation was not invalidated.
+    Standard_Boolean IsOrientationValid() const { return myIsOrientationValid; }
 
-    Standard_Boolean IsProjectionValid()
-    {
-      return !MProjection.IsNull() &&
-             !LProjection.IsNull() &&
-             !RProjection.IsNull();
-    }
+    //! Return true if Projection was not invalidated.
+    Standard_Boolean IsProjectionValid()  const { return myIsProjectionValid;  }
+
+  public:
+
+    NCollection_Mat4<Elem_t> Orientation;
+    NCollection_Mat4<Elem_t> MProjection;
+    NCollection_Mat4<Elem_t> LProjection;
+    NCollection_Mat4<Elem_t> RProjection;
+
+  private:
+
+    Standard_Boolean myIsOrientationValid;
+    Standard_Boolean myIsProjectionValid;
 
-    NCollection_Handle< NCollection_Mat4<Elem_t> > Orientation;
-    NCollection_Handle< NCollection_Mat4<Elem_t> > MProjection;
-    NCollection_Handle< NCollection_Mat4<Elem_t> > LProjection;
-    NCollection_Handle< NCollection_Mat4<Elem_t> > RProjection;
   };
 
 public:
@@ -637,6 +639,7 @@ private:
 
   Projection    myProjType; //!< Projection type used for rendering.
   Standard_Real myFOVy;     //!< Field Of View in y axis.
+  Standard_Real myFOVyTan;  //!< Field Of View as Tan(DTR_HALF * myFOVy)
   Standard_Real myZNear;    //!< Distance to near clipping plane.
   Standard_Real myZFar;     //!< Distance to far clipping plane.
   Standard_Real myAspect;   //!< Width to height display ratio.
index c08ed0258f8857bf519e5060fc1f35baa471f108..1c51cef632bbda88e1666ef08ecd2614b4805d6a 100644 (file)
@@ -1103,46 +1103,14 @@ Standard_Integer Graphic3d_Structure::Identification() const
 //function : SetTransformPersistence
 //purpose  :
 //=============================================================================
-void Graphic3d_Structure::SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag)
+void Graphic3d_Structure::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
-  SetTransformPersistence (theFlag, gp_Pnt (0.0, 0.0, 0.0));
-}
-
-//=============================================================================
-//function : SetTransformPersistence
-//purpose  :
-//=============================================================================
-void Graphic3d_Structure::SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag,
-                                                   const gp_Pnt&                   thePoint)
-{
-  if (IsDeleted()) return;
-
-  myCStructure->TransformPersistence.Flags     = theFlag;
-  myCStructure->TransformPersistence.Point.x() = thePoint.X();
-  myCStructure->TransformPersistence.Point.y() = thePoint.Y();
-  myCStructure->TransformPersistence.Point.z() = thePoint.Z();
-}
-
-//=============================================================================
-//function : TransformPersistenceMode
-//purpose  :
-//=============================================================================
-Graphic3d_TransModeFlags Graphic3d_Structure::TransformPersistenceMode() const
-{
-  return myCStructure->TransformPersistence.Flags;
-}
+  if (IsDeleted())
+  {
+    return;
+  }
 
-//=============================================================================
-//function : TransformPersistencePoint
-//purpose  :
-//=============================================================================
-gp_Pnt Graphic3d_Structure::TransformPersistencePoint() const
-{
-  gp_Pnt aPnt (0.0, 0.0, 0.0);
-  aPnt.SetX (myCStructure->TransformPersistence.Point.x());
-  aPnt.SetY (myCStructure->TransformPersistence.Point.y());
-  aPnt.SetZ (myCStructure->TransformPersistence.Point.z());
-  return aPnt;
+  myCStructure->SetTransformPersistence (theTrsfPers);
 }
 
 //=============================================================================
index 5bf3474d05771cfc50ca23543de2f1b309ed7d33..e99a3f6882a13c757a28956bef5304696467bb19 100644 (file)
@@ -377,20 +377,12 @@ public:
   //! Returns the transformation associated with
   //! the structure <me>.
   Standard_EXPORT void Transform (TColStd_Array2OfReal& AMatrix) const;
-  
-  //! Modifies the current modelling transform persistence (pan, zoom or rotate)
-  Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag, const gp_Pnt& APoint);
-  
-  Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag);
-  
-  //! Get the current modelling transform persistence (pan, zoom or rotate)
-  Standard_EXPORT Graphic3d_TransModeFlags TransformPersistenceMode() const;
-  
-  //! Get the current point of relative modelling transform persistence
-  Standard_EXPORT gp_Pnt TransformPersistencePoint() const;
+
+  //! Modifies the current transform persistence (pan, zoom or rotate)
+  Standard_EXPORT void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
 
   //! @return transform persistence of the presentable object.
-  const Graphic3d_TransformPers& TransformPersistence() const;
+  const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myCStructure->TransformPersistence(); }
 
   //! Sets if the structure location has mutable nature (content or location will be changed regularly).
   Standard_EXPORT void SetMutable (const Standard_Boolean theIsMutable);
@@ -439,7 +431,7 @@ public:
   Standard_EXPORT static Graphic3d_Vertex Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vertex& Coord);
   
   //! Returns the low-level structure
-    const Handle(Graphic3d_CStructure)& CStructure() const;
+  const Handle(Graphic3d_CStructure)& CStructure() const { return myCStructure; }
 
 friend class Graphic3d_Group;
 
@@ -505,14 +497,6 @@ protected:
   Standard_Address myOwner;
   Graphic3d_TypeOfStructure myVisual;
 
-
 };
 
-
-#include <Graphic3d_Structure.lxx>
-
-
-
-
-
 #endif // _Graphic3d_Structure_HeaderFile
diff --git a/src/Graphic3d/Graphic3d_Structure.lxx b/src/Graphic3d/Graphic3d_Structure.lxx
deleted file mode 100644 (file)
index 7fd5ec2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Created on: 2014-03-23
-// Created by: Kirill Gavrilov
-// 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.
-
-// =======================================================================
-// function : CStructure
-// purpose  : Returns the low-level structure
-// =======================================================================
-inline const Handle(Graphic3d_CStructure)& Graphic3d_Structure::CStructure() const
-{
-  return myCStructure;
-}
-
-// =======================================================================
-// function : TransformPersistence
-// purpose  :
-// =======================================================================
-inline const Graphic3d_TransformPers& Graphic3d_Structure::TransformPersistence() const
-{
-  return myCStructure->TransformPersistence;
-}
index f7e2512f1cad6cd25571e36cfb8d3ce929c30cb6..550851f896db57233cc1db02d2373bc4b8dfd861 100644 (file)
 #ifndef Graphic3d_TRANS_MODE_FLAGS_HXX
 #define Graphic3d_TRANS_MODE_FLAGS_HXX
 
-typedef Standard_Integer Graphic3d_TransModeFlags;
-
-enum {
-  Graphic3d_TMF_None               = 0x0000,
-  Graphic3d_TMF_PanPers            = 0x0001,
-  Graphic3d_TMF_ZoomPers           = 0x0002,
-  Graphic3d_TMF_RotatePers         = 0x0008,
-  Graphic3d_TMF_TriedronPers       = 0x0020,
-  Graphic3d_TMF_2d                 = 0x0040,
-  Graphic3d_TMF_FullPers           = Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers
+//! Transform Persistence Mode defining whether to lock in object position, rotation and / or zooming relative to camera position.
+enum Graphic3d_TransModeFlags
+{
+  Graphic3d_TMF_None           = 0x0000,                  //!< no persistence attributes (normal 3D object)
+  Graphic3d_TMF_ZoomPers       = 0x0002,                  //!< object does not resize
+  Graphic3d_TMF_RotatePers     = 0x0008,                  //!< object does not rotate;
+  Graphic3d_TMF_TriedronPers   = 0x0020,                  //!< object behaves like trihedron - it is fixed at the corner of view and does not resizing (but rotating)
+  Graphic3d_TMF_2d             = 0x0040,                  //!< object is defined in 2D screen coordinates (pixels) and does not resize, pan and rotate
+  Graphic3d_TMF_ZoomRotatePers = Graphic3d_TMF_ZoomPers
+                               | Graphic3d_TMF_RotatePers //!< object doesn't resize and rotate
 };
 
-
 #endif
diff --git a/src/Graphic3d/Graphic3d_TransformPers.cxx b/src/Graphic3d/Graphic3d_TransformPers.cxx
new file mode 100644 (file)
index 0000000..d171a7d
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Graphic3d_TransformPers.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_TransformPers, Standard_Transient)
+
+// =======================================================================
+// function : FromDeprecatedParams
+// purpose  :
+// =======================================================================
+Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (Graphic3d_TransModeFlags theFlag,
+                                                                               const gp_Pnt&            thePoint)
+{
+  Handle(Graphic3d_TransformPers) aTrsfPers;
+  if (Graphic3d_TransformPers::IsZoomOrRotate (theFlag))
+  {
+    aTrsfPers = new Graphic3d_TransformPers (theFlag, thePoint);
+  }
+  else if (Graphic3d_TransformPers::IsTrihedronOr2d (theFlag))
+  {
+    Standard_Integer aCorner = Aspect_TOTP_CENTER;
+    const Graphic3d_Vec2i anOffset (Standard_Integer(thePoint.Z()), Standard_Integer(thePoint.Z()));
+    if (thePoint.X() > 0.0)
+    {
+      aCorner |= Aspect_TOTP_RIGHT;
+    }
+    else if (thePoint.X() < 0.0)
+    {
+      aCorner |= Aspect_TOTP_LEFT;
+    }
+    if (thePoint.Y() > 0.0)
+    {
+      aCorner |= Aspect_TOTP_TOP;
+    }
+    else if (thePoint.Y() < 0.0)
+    {
+      aCorner |= Aspect_TOTP_BOTTOM;
+    }
+    aTrsfPers = new Graphic3d_TransformPers (theFlag, Aspect_TypeOfTriedronPosition(aCorner), anOffset);
+  }
+  return aTrsfPers;
+}
index 3ad72c1ee21df8de70ba088238513cbcf7bb6ecc..7e6afc6c415000b2505bb9bc3802384e8f5a7f8f 100644 (file)
 #ifndef _Graphic3d_TransformPers_HeaderFile
 #define _Graphic3d_TransformPers_HeaderFile
 
+#include <Aspect_TypeOfTriedronPosition.hxx>
 #include <Bnd_Box.hxx>
 #include <BVH_Box.hxx>
 #include <Graphic3d_Camera.hxx>
 #include <Graphic3d_TransformUtils.hxx>
 #include <Graphic3d_TransModeFlags.hxx>
+#include <Graphic3d_Vec.hxx>
 #include <NCollection_Mat4.hxx>
-#include <NCollection_Vec4.hxx>
+
+DEFINE_STANDARD_HANDLE(Graphic3d_TransformPers, Standard_Transient)
 
 //! Class for keeping and computing transformation persistence.
-class Graphic3d_TransformPers
+//! Note that instance of this class can not define
+//! no transformation persistence Graphic3d_TMF_None - NULL handle should be used for this purpose.
+class Graphic3d_TransformPers : public Standard_Transient
 {
+  DEFINE_STANDARD_RTTIEXT(Graphic3d_TransformPers, Standard_Transient)
 public:
 
-  DEFINE_STANDARD_ALLOC
+  //! Return true if specified mode is zoom/rotate transformation persistence.
+  static Standard_Boolean IsZoomOrRotate (Graphic3d_TransModeFlags theMode)
+  {
+    return (theMode & (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers)) != 0;
+  }
+
+  //! Return true if specified mode is 2d/trihedron transformation persistence.
+  static Standard_Boolean IsTrihedronOr2d (Graphic3d_TransModeFlags theMode)
+  {
+    return (theMode & (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_2d)) != 0;
+  }
 
-  //! Default constructor.
-  Graphic3d_TransformPers()
-  : Flags (Graphic3d_TMF_None),
-    Point (0.0, 0.0, 0.0) {}
+  //! Create Graphic3d_TransformPers instance from deprecated parameters set
+  //! decoding 2D corner + offset parameters from 3D point.
+  Standard_EXPORT static Handle(Graphic3d_TransformPers) FromDeprecatedParams (Graphic3d_TransModeFlags theFlag,
+                                                                               const gp_Pnt&            thePoint);
+
+public:
+
+  //! Set transformation persistence.
+  Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode)
+  : myMode (theMode)
+  {
+    if (IsZoomOrRotate (theMode))
+    {
+      SetPersistence (theMode, gp_Pnt(0.0, 0.0, 0.0));
+    }
+    else if (IsTrihedronOr2d (theMode))
+    {
+      SetPersistence (theMode, Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (0, 0));
+    }
+    else
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
+    }
+  }
+
+  //! Set Zoom/Rotate transformation persistence with an anchor 3D point.
+  //! Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.
+  Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode,
+                           const gp_Pnt& thePnt)
+  : myMode (Graphic3d_TMF_None)
+  {
+    SetPersistence (theMode, thePnt);
+  }
+
+  //! Set 2d/trihedron transformation persistence with a corner and 2D offset.
+  //! Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d.
+  //! The offset is a positive displacement from the view corner in pixels.
+  Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode,
+                           const Aspect_TypeOfTriedronPosition theCorner,
+                           const Graphic3d_Vec2i& theOffset = Graphic3d_Vec2i (0, 0))
+  : myMode (Graphic3d_TMF_None)
+  {
+    SetPersistence (theMode, theCorner, theOffset);
+  }
+
+  //! Return true for Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers modes.
+  Standard_Boolean IsZoomOrRotate() const { return IsZoomOrRotate (myMode); }
+
+  //! Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes.
+  Standard_Boolean IsTrihedronOr2d() const { return IsTrihedronOr2d (myMode); }
 
   //! Transformation persistence mode flags.
-  Graphic3d_TransModeFlags Flags;
+  Graphic3d_TransModeFlags Mode() const { return myMode; }
 
-  //! Reference point for transformation.
-  Graphic3d_Vec3d Point;
+  //! Transformation persistence mode flags.
+  Graphic3d_TransModeFlags Flags() const { return myMode; }
+
+  //! Set Zoom/Rotate transformation persistence with an anchor 3D point.
+  //! Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.
+  void SetPersistence (const Graphic3d_TransModeFlags theMode,
+                       const gp_Pnt& thePnt)
+  {
+    if (!IsZoomOrRotate (theMode))
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
+    }
+
+    myMode = theMode;
+    myParams.Params3d.PntX = thePnt.X();
+    myParams.Params3d.PntY = thePnt.Y();
+    myParams.Params3d.PntZ = thePnt.Z();
+  }
+
+  //! Set 2d/trihedron transformation persistence with a corner and 2D offset.
+  //! Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d.
+  void SetPersistence (const Graphic3d_TransModeFlags theMode,
+                       const Aspect_TypeOfTriedronPosition theCorner,
+                       const Graphic3d_Vec2i& theOffset)
+  {
+    if (!IsTrihedronOr2d (theMode))
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
+    }
+
+    myMode = theMode;
+    myParams.Params2d.Corner  = theCorner;
+    myParams.Params2d.OffsetX = theOffset.x();
+    myParams.Params2d.OffsetY = theOffset.y();
+  }
+
+public:
+
+  //! Return the anchor point for zoom/rotate transformation persistence.
+  gp_Pnt AnchorPoint() const
+  {
+    if (!IsZoomOrRotate())
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::AnchorPoint(), wrong persistence mode.");
+    }
+
+    return gp_Pnt (myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ);
+  }
+
+  //! Set the anchor point for zoom/rotate transformation persistence.
+  void SetAnchorPoint (const gp_Pnt& thePnt)
+  {
+    if (!IsZoomOrRotate())
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::SetAnchorPoint(), wrong persistence mode.");
+    }
+
+    myParams.Params3d.PntX = thePnt.X();
+    myParams.Params3d.PntY = thePnt.Y();
+    myParams.Params3d.PntZ = thePnt.Z();
+  }
+
+  //! Return the corner for 2d/trihedron transformation persistence.
+  Aspect_TypeOfTriedronPosition Corner2d() const
+  {
+    if (!IsTrihedronOr2d())
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::Corner2d(), wrong persistence mode.");
+    }
+
+    return myParams.Params2d.Corner;
+  }
+
+  //! Set the corner for 2d/trihedron transformation persistence.
+  void SetCorner2d (const Aspect_TypeOfTriedronPosition thePos)
+  {
+    if (!IsTrihedronOr2d())
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::SetCorner2d(), wrong persistence mode.");
+    }
+
+    myParams.Params2d.Corner = thePos;
+  }
+
+  //! Return the offset from the corner for 2d/trihedron transformation persistence.
+  Graphic3d_Vec2i Offset2d() const
+  {
+    if (!IsTrihedronOr2d())
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::Offset2d(), wrong persistence mode.");
+    }
+
+    return Graphic3d_Vec2i (myParams.Params2d.OffsetX, myParams.Params2d.OffsetY);
+  }
+
+  //! Set the offset from the corner for 2d/trihedron transformation persistence.
+  void SetOffset2d (const Graphic3d_Vec2i& theOffset)
+  {
+    if (!IsTrihedronOr2d())
+    {
+      Standard_ProgramError::Raise ("Graphic3d_TransformPers::SetOffset2d(), wrong persistence mode.");
+    }
+
+    myParams.Params2d.OffsetX = theOffset.x();
+    myParams.Params2d.OffsetY = theOffset.y();
+  }
 
 public:
 
@@ -98,16 +264,37 @@ public:
   //! @param theViewportHeight viewport height
   template<class T>
   void Apply (const Handle(Graphic3d_Camera)& theCamera,
-              NCollection_Mat4<T>& theProjection,
+              const NCollection_Mat4<T>& theProjection,
               NCollection_Mat4<T>& theWorldView,
               const Standard_Integer theViewportWidth,
               const Standard_Integer theViewportHeight) const;
 
-  //! Return true if transformation persistence alters projection matrix.
-  bool AltersProjectionMatrix() const
+private:
+
+  //! 3D anchor point for zoom/rotate transformation persistence.
+  struct PersParams3d
   {
-    return (Flags & Graphic3d_TMF_PanPers) != 0;
-  }
+    Standard_Real PntX;
+    Standard_Real PntY;
+    Standard_Real PntZ;
+  };
+
+  //! 2d/trihedron transformation persistence parameters.
+  struct PersParams2d
+  {
+    Standard_Integer OffsetX;
+    Standard_Integer OffsetY;
+    Aspect_TypeOfTriedronPosition Corner;
+  };
+
+private:
+
+  Graphic3d_TransModeFlags myMode;  //!< Transformation persistence mode flags
+  union
+  {
+    PersParams3d Params3d;
+    PersParams2d Params2d;
+  } myParams;
 
 };
 
@@ -117,20 +304,26 @@ public:
 // =======================================================================
 template<class T>
 void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
-                                     NCollection_Mat4<T>& theProjection,
+                                     const NCollection_Mat4<T>& theProjection,
                                      NCollection_Mat4<T>& theWorldView,
                                      const Standard_Integer theViewportWidth,
                                      const Standard_Integer theViewportHeight) const
 {
   (void )theViewportWidth;
-  if (Flags == Graphic3d_TMF_None
+  (void )theProjection;
+  if (myMode == Graphic3d_TMF_None
    || theViewportHeight == 0)
   {
     return;
   }
 
+  // use total size when tiling is active
   const Standard_Integer aVPSizeY = theCamera->Tile().IsValid() ? theCamera->Tile().TotalSize.y() : theViewportHeight;
-  if (Flags == Graphic3d_TMF_TriedronPers)
+
+  // a small enough jitter compensation offset
+  // to avoid image dragging within single pixel in corner cases
+  const Standard_Real aJitterComp = 0.001;
+  if (myMode == Graphic3d_TMF_TriedronPers)
   {
     // reset Z focus for trihedron persistence
     const Standard_Real aFocus = theCamera->IsOrthographic()
@@ -142,41 +335,43 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
     // scale factor to pixels
     const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
     const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
-
-    // offset from the corner
-    const Standard_Real anOffset = Point.z() * aScale;
-
     const gp_Dir aForward (theCamera->Center().XYZ() - theCamera->Eye().XYZ());
     gp_XYZ aCenter = theCamera->Center().XYZ() + aForward.XYZ() * (aFocus - theCamera->Distance());
-    if (Point.x() != 0.0)
+    if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
     {
-      const gp_Dir aSide = aForward.Crossed (theCamera->Up());
-      if (Point.x() > 0.0)
+      const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
+      const gp_Dir aSide   = aForward.Crossed (theCamera->Up());
+      const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * 0.5 - anOffsetX);
+      if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
       {
-        aCenter += aSide.XYZ() * (Abs(aViewDim.X()) * 0.5 - anOffset);
+        aCenter += aDeltaX;
       }
       else
       {
-        aCenter -= aSide.XYZ() * (Abs(aViewDim.X()) * 0.5 - anOffset);
+        aCenter -= aDeltaX;
       }
     }
-    if (Point.y() != 0.0)
+    if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
     {
-      if (Point.y() > 0.0)
+      const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
+      const gp_XYZ aDeltaY = theCamera->Up().XYZ() * (Abs(aViewDim.Y()) * 0.5 - anOffsetY);
+      if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
       {
-        aCenter += theCamera->Up().XYZ() * (Abs(aViewDim.Y()) * 0.5 - anOffset);
+        aCenter += aDeltaY;
       }
       else
       {
-        aCenter -= theCamera->Up().XYZ() * (Abs(aViewDim.Y()) * 0.5 - anOffset);
+        aCenter -= aDeltaY;
       }
     }
 
-    Graphic3d_TransformUtils::Translate (theWorldView, T(aCenter.X()), T(aCenter.Y()), T(aCenter.Z()));
-    Graphic3d_TransformUtils::Scale     (theWorldView, T(aScale),      T(aScale),      T(aScale));
+    NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
+    Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
+    Graphic3d_TransformUtils::Scale     (aWorldView, aScale,      aScale,      aScale);
+    theWorldView.ConvertFrom (aWorldView);
     return;
   }
-  else if (Flags == Graphic3d_TMF_2d)
+  else if (myMode == Graphic3d_TMF_2d)
   {
     const Standard_Real aFocus = theCamera->IsOrthographic()
                                ? theCamera->Distance()
@@ -188,18 +383,18 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
     const gp_XYZ        aViewDim = theCamera->ViewDimensions (aFocus);
     const Standard_Real aScale   = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
     gp_XYZ aCenter (0.0, 0.0, -aFocus);
-    if (Point.x() != 0.0)
+    if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
     {
-      aCenter.SetX (-aViewDim.X() * 0.5 + Point.z() * aScale);
-      if (Point.x() > 0.0)
+      aCenter.SetX (-aViewDim.X() * 0.5 + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
+      if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
       {
         aCenter.SetX (-aCenter.X());
       }
     }
-    if (Point.y() != 0.0)
+    if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
     {
-      aCenter.SetY (-aViewDim.Y() * 0.5 + Point.z() * aScale);
-      if (Point.y() > 0.0)
+      aCenter.SetY (-aViewDim.Y() * 0.5 + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
+      if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
       {
         aCenter.SetY (-aCenter.Y());
       }
@@ -210,92 +405,42 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
     Graphic3d_TransformUtils::Scale     (theWorldView, T(aScale),      T(aScale),      T(aScale));
     return;
   }
-
+  else
   {
     // Compute reference point for transformation in untransformed projection space.
-    NCollection_Vec4<T> aRefPoint (static_cast<T> (Point.x()),
-                                   static_cast<T> (Point.y()),
-                                   static_cast<T> (Point.z()),
+    NCollection_Vec4<T> aRefPoint (static_cast<T> (myParams.Params3d.PntX),
+                                   static_cast<T> (myParams.Params3d.PntY),
+                                   static_cast<T> (myParams.Params3d.PntZ),
                                    static_cast<T> (1.0));
-    NCollection_Vec4<T> aRefPointProj;
-    if ((Flags & Graphic3d_TMF_PanPers) != Graphic3d_TMF_PanPers)
-    {
-      aRefPointProj  = theProjection * (theWorldView * aRefPoint);
-      aRefPointProj /= aRefPointProj.w();
-    }
-
-    // Prevent zooming.
-    if ((Flags & Graphic3d_TMF_ZoomPers) != 0)
-    {
-      const T aSize = static_cast<T> (1.0);
-      const Standard_Integer aViewport[4] = { 0, 0, theViewportHeight, theViewportHeight };
-      NCollection_Mat4<T> aWorldView;
-      aWorldView.InitIdentity();
-
-      NCollection_Vec3<T> aWinCoordsRefPoint;
-      Graphic3d_TransformUtils::Project (static_cast<T> (Point.x()),
-                                         static_cast<T> (Point.y()),
-                                         static_cast<T> (Point.z()),
-                                         theWorldView, theProjection, aViewport,
-                                         aWinCoordsRefPoint.x(), aWinCoordsRefPoint.y(), aWinCoordsRefPoint.z());
-
-      NCollection_Vec3<T> anUnProj1;
-      Graphic3d_TransformUtils::UnProject (aWinCoordsRefPoint.x(), aWinCoordsRefPoint.y(), aWinCoordsRefPoint.z(),
-                                           aWorldView, theProjection, aViewport,
-                                           anUnProj1.x(), anUnProj1.y(), anUnProj1.z());
-
-      NCollection_Vec3<T> anUnProj2;
-      Graphic3d_TransformUtils::UnProject (aWinCoordsRefPoint.x(), aWinCoordsRefPoint.y() + aSize, aWinCoordsRefPoint.z(),
-                                           aWorldView, theProjection, aViewport,
-                                           anUnProj2.x(), anUnProj2.y(), anUnProj2.z());
-
-      const T aScale = (anUnProj2.y() - anUnProj1.y()) / aSize;
-
-      Graphic3d_TransformUtils::Scale (theWorldView, aScale, aScale, aScale);
-    }
-
-    // Prevent translation by nullifying translation component.
-    if ((Flags & Graphic3d_TMF_PanPers) != 0)
-    {
-      theWorldView .SetValue (0, 3, static_cast<T> (0.0));
-      theWorldView .SetValue (1, 3, static_cast<T> (0.0));
-      theWorldView .SetValue (2, 3, static_cast<T> (0.0));
-      theProjection.SetValue (0, 3, static_cast<T> (0.0));
-      theProjection.SetValue (1, 3, static_cast<T> (0.0));
-      theProjection.SetValue (2, 3, static_cast<T> (0.0));
-    }
 
-    // Prevent rotation by nullifying rotation component.
-    if (Flags & Graphic3d_TMF_RotatePers)
+    Graphic3d_TransformUtils::Translate<T> (theWorldView, aRefPoint.x(), aRefPoint.y(), aRefPoint.z());
+    if ((myMode & Graphic3d_TMF_RotatePers) != 0)
     {
-      theWorldView.SetValue (0, 0, static_cast<T> (1.0));
-      theWorldView.SetValue (1, 0, static_cast<T> (0.0));
-      theWorldView.SetValue (2, 0, static_cast<T> (0.0));
-
-      theWorldView.SetValue (0, 1, static_cast<T> (0.0));
-      theWorldView.SetValue (1, 1, static_cast<T> (1.0));
-      theWorldView.SetValue (2, 1, static_cast<T> (0.0));
-
-      theWorldView.SetValue (0, 2, static_cast<T> (0.0));
-      theWorldView.SetValue (1, 2, static_cast<T> (0.0));
-      theWorldView.SetValue (2, 2, static_cast<T> (1.0));
+      // lock rotation by nullifying rotation component
+      theWorldView.SetValue (0, 0, static_cast<T> (1));
+      theWorldView.SetValue (1, 0, static_cast<T> (0));
+      theWorldView.SetValue (2, 0, static_cast<T> (0));
+
+      theWorldView.SetValue (0, 1, static_cast<T> (0));
+      theWorldView.SetValue (1, 1, static_cast<T> (1));
+      theWorldView.SetValue (2, 1, static_cast<T> (0));
+
+      theWorldView.SetValue (0, 2, static_cast<T> (0));
+      theWorldView.SetValue (1, 2, static_cast<T> (0));
+      theWorldView.SetValue (2, 2, static_cast<T> (1));
     }
 
-    if ((Flags & Graphic3d_TMF_PanPers) != Graphic3d_TMF_PanPers)
+    if ((myMode & Graphic3d_TMF_ZoomPers) != 0)
     {
-      NCollection_Mat4<T> anUnviewMat;
-
-      if (!(theProjection * theWorldView).Inverted (anUnviewMat))
-      {
-        Standard_ProgramError::Raise ("Graphic3d_TransformPers::Apply, can not inverse world view projection matrix.");
-      }
-
-      // Move to reference point location in transformed view projection space.
-      aRefPoint  = anUnviewMat * aRefPointProj;
-      aRefPoint /= aRefPoint.w();
-
-      Graphic3d_TransformUtils::Translate<T> (theWorldView, aRefPoint.x(), aRefPoint.y(), aRefPoint.z());
+      // lock zooming
+      gp_Vec aVecToEye (theCamera->Direction());
+      gp_Vec aVecToObj (theCamera->Eye(), gp_Pnt (myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ));
+      const Standard_Real aFocus = aVecToObj.Dot (aVecToEye);
+      const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
+      const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
+      Graphic3d_TransformUtils::Scale (theWorldView, T(aScale), T(aScale), T(aScale));
     }
+    return;
   }
 }
 
@@ -384,26 +529,13 @@ NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Cam
                                                       const Standard_Integer theViewportWidth,
                                                       const Standard_Integer theViewportHeight) const
 {
-  if (Flags == Graphic3d_TMF_None)
+  if (myMode == Graphic3d_TMF_None)
   {
     return NCollection_Mat4<T>();
   }
 
-  NCollection_Mat4<T> aProjection (theProjection);
-  NCollection_Mat4<T> aWorldView  (theWorldView);
+  NCollection_Mat4<T> aWorldView (theWorldView);
   NCollection_Mat4<T> anUnviewMat;
-  if (AltersProjectionMatrix())
-  {
-    // destructive transformation persistence which directly modifies projection matrix
-    if (!(theProjection * theWorldView).Inverted (anUnviewMat))
-    {
-      return NCollection_Mat4<T>();
-    }
-
-    Apply (theCamera, aProjection, aWorldView, theViewportWidth, theViewportHeight);
-    return anUnviewMat * (aProjection * aWorldView);
-  }
-
   if (!theWorldView.Inverted (anUnviewMat))
   {
     return NCollection_Mat4<T>();
@@ -411,7 +543,7 @@ NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Cam
 
   // compute only world-view matrix difference to avoid floating point instability
   // caused by projection matrix modifications outside of this algorithm (e.g. by Z-fit)
-  Apply (theCamera, aProjection, aWorldView, theViewportWidth, theViewportHeight);
+  Apply (theCamera, theProjection, aWorldView, theViewportWidth, theViewportHeight);
   return anUnviewMat * aWorldView;
 }
 
index e8fb5be73387fc9f6b85735bce4e3fa98fe50117..a1a911cf202fcdbf74c4e25907de9c34b154b12b 100644 (file)
@@ -929,7 +929,7 @@ void MeshVS_Mesh::HilightSelected ( const Handle(PrsMgr_PresentationManager3d)&
   aSelectionPrs = GetSelectPresentation( thePM );
 
   if( HasPresentation() )
-    aSelectionPrs->SetTransformPersistence( Presentation()->TransformPersistenceMode(), Presentation()->TransformPersistencePoint() );
+    aSelectionPrs->SetTransformPersistence (Presentation()->TransformPersistence());
   //----------------
 
   //   It is very important to call this parent method, because it check whether
@@ -1083,7 +1083,7 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage
 
   //new functionality
   if( HasPresentation() )
-    aHilightPrs->SetTransformPersistence( Presentation()->TransformPersistenceMode(), Presentation()->TransformPersistencePoint() );
+    aHilightPrs->SetTransformPersistence (Presentation()->TransformPersistence());
   //----------------
 
   const Standard_Boolean isMeshEntityOwner = Owner->IsKind ( STANDARD_TYPE ( MeshVS_MeshEntityOwner ) );
index 9481fcf72cda54147b2ae2e8ba414b5bb2b98fe7..0f7484484718f1126ff4ce15d04dce05bec03ffb 100755 (executable)
@@ -410,16 +410,20 @@ public:
     return true;
   }
 
-  // Converts NCollection_Mat4 with different element type.
+  //! Take values from NCollection_Mat4 with a different element type with type conversion.
   template <typename Other_t>
-  void Convert (const NCollection_Mat4<Other_t>& theOther)
+  void ConvertFrom (const NCollection_Mat4<Other_t>& theFrom)
   {
     for (int anIdx = 0; anIdx < 16; ++anIdx)
     {
-      myMat[anIdx] = static_cast<Element_t> (theOther.myMat[anIdx]);
+      myMat[anIdx] = static_cast<Element_t> (theFrom.myMat[anIdx]);
     }
   }
 
+  //! Take values from NCollection_Mat4 with a different element type with type conversion.
+  template <typename Other_t>
+  void Convert (const NCollection_Mat4<Other_t>& theFrom) { ConvertFrom (theFrom); }
+
   //! Maps plain C array to matrix type.
   static NCollection_Mat4<Element_t>& Map (Element_t* theData)
   {
index c1c880a37a26614cc8d82881caf80ec23a24f1dc..158aef24def24f661403a2acee023eb97aea8e9b 100644 (file)
@@ -155,7 +155,10 @@ const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >&
 
     HBndBox4f aBoundingBox = new Graphic3d_BndBox4f;
     *aBoundingBox = aStructure->BoundingBox();
-     aStructure->TransformPersistence.Apply (theCamera, theProjectionMatrix, theWorldViewMatrix, theViewportWidth, theViewportHeight, *aBoundingBox);
+    if (!aStructure->TransformPersistence().IsNull())
+    {
+      aStructure->TransformPersistence()->Apply (theCamera, theProjectionMatrix, theWorldViewMatrix, theViewportWidth, theViewportHeight, *aBoundingBox);
+    }
 
     myStructBoxes.Add (aBoundingBox);
   }
index 0dce18bb4d095efed73801352caac508637eda20..b49b4d97a57890e3c1cadb88b68770cbe981a286 100644 (file)
@@ -27,6 +27,7 @@
 // =======================================================================
 OpenGl_BackgroundArray::OpenGl_BackgroundArray (const Graphic3d_TypeOfBackground theType)
 : OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_TRIANGLESTRIPS, NULL, NULL, NULL),
+  myTrsfPers (Graphic3d_TMF_2d, theType == Graphic3d_TOB_TEXTURE ? Aspect_TOTP_CENTER : Aspect_TOTP_LEFT_LOWER),
   myType (theType),
   myFillMethod (Aspect_FM_NONE),
   myViewWidth (0),
@@ -41,18 +42,6 @@ OpenGl_BackgroundArray::OpenGl_BackgroundArray (const Graphic3d_TypeOfBackground
   myGradientParams.color1 = OpenGl_Vec4 (0.0f, 0.0f, 0.0f, 1.0f);
   myGradientParams.color2 = OpenGl_Vec4 (0.0f, 0.0f, 0.0f, 1.0f);
   myGradientParams.type   = Aspect_GFM_NONE;
-
-  myTrsfPers.Flags = Graphic3d_TMF_2d;
-  if (myType == Graphic3d_TOB_TEXTURE)
-  {
-    myTrsfPers.Point.x() = 0.0;
-    myTrsfPers.Point.y() = 0.0;
-  }
-  else
-  {
-    myTrsfPers.Point.x() = -1.0;
-    myTrsfPers.Point.y() = -1.0;
-  }
 }
 
 // =======================================================================
index 655043aecc96edf9ca35defa9a57502d08ce0450..48469d7ff510f1a344f9f21c3ec7ded55068f3db 100755 (executable)
@@ -411,12 +411,9 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
   // Render arrow
   OpenGl_Vec3 anArrowVec = myMin + anAxis.Direction * (myMax - myMin);
 
-  Graphic3d_TransformPers aTransMode;
-  aTransMode.Flags = Graphic3d_TMF_ZoomPers;
-  aTransMode.Point.x() = anArrowVec.x();
-  aTransMode.Point.y() = anArrowVec.y();
-  aTransMode.Point.z() = anArrowVec.z();
-
+  Graphic3d_TransformPers aTransMode (Graphic3d_TMF_ZoomPers, gp_Pnt (Standard_Real(anArrowVec.x()),
+                                                                      Standard_Real(anArrowVec.y()),
+                                                                      Standard_Real(anArrowVec.z())));
   const OpenGl_Mat4& aProjection = aContext->ProjectionState.Current();
   const OpenGl_Mat4& aWorldView  = aContext->WorldViewState.Current();
   const Standard_Integer aWidth  = theWorkspace->Width();
index 54b9f0f6450e31ca8a4489aaf7f365af1463dd6c..e73975b19dd340ae9541a859a14f3a3e733f72ef 100644 (file)
@@ -68,7 +68,7 @@ void OpenGl_Layer::Add (const OpenGl_Structure* theStruct,
   }
   else if (!isForChangePriority)
   {
-    if (theStruct->TransformPersistence.Flags == Graphic3d_TMF_None)
+    if (theStruct->TransformPersistence().IsNull())
     {
       myBVHPrimitives.Add (theStruct);
     }
@@ -198,14 +198,15 @@ Graphic3d_BndBox4f OpenGl_Layer::BoundingBox (const Standard_Integer          th
 
         // "FitAll" operation ignores object with transform persistence parameter
         // but adds transform persistence point in a bounding box of layer (only zoom pers. objects).
-        if (aStructure->TransformPersistence.Flags != Graphic3d_TMF_None)
+        if (!aStructure->TransformPersistence().IsNull())
         {
           if (!theToIncludeAuxiliary
-           && (aStructure->TransformPersistence.Flags & Graphic3d_TMF_ZoomPers) != 0)
+            && aStructure->TransformPersistence()->IsZoomOrRotate())
           {
-            BVH_Vec4f aTPPoint (static_cast<float> (aStructure->TransformPersistence.Point.x()),
-                                static_cast<float> (aStructure->TransformPersistence.Point.y()),
-                                static_cast<float> (aStructure->TransformPersistence.Point.z()),
+            const gp_Pnt anAnchor = aStructure->TransformPersistence()->AnchorPoint();
+            BVH_Vec4f aTPPoint (static_cast<float> (anAnchor.X()),
+                                static_cast<float> (anAnchor.Y()),
+                                static_cast<float> (anAnchor.Z()),
                                 1.0f);
 
             myBoundingBox[aBoxId].Combine (aTPPoint);
@@ -214,7 +215,7 @@ Graphic3d_BndBox4f OpenGl_Layer::BoundingBox (const Standard_Integer          th
           // Panning and 2d persistence apply changes to projection or/and its translation components.
           // It makes them incompatible with z-fitting algorithm. Ignored by now.
           else if (!theToIncludeAuxiliary
-                || (aStructure->TransformPersistence.Flags & (Graphic3d_TMF_2d | Graphic3d_TMF_PanPers | Graphic3d_TMF_TriedronPers)) != 0)
+                 || aStructure->TransformPersistence()->IsTrihedronOr2d())
           {
             continue;
           }
@@ -233,14 +234,9 @@ Graphic3d_BndBox4f OpenGl_Layer::BoundingBox (const Standard_Integer          th
           aBox = centerOfinfiniteBndBox (aBox);
         }
 
-        if (aStructure->TransformPersistence.Flags != Graphic3d_TMF_None)
+        if (!aStructure->TransformPersistence().IsNull())
         {
-          aStructure->TransformPersistence.Apply (theCamera,
-                                                  aProjectionMat,
-                                                  aWorldViewMat,
-                                                  theWindowWidth,
-                                                  theWindowHeight,
-                                                  aBox);
+          aStructure->TransformPersistence()->Apply (theCamera, aProjectionMat, aWorldViewMat, theWindowWidth, theWindowHeight, aBox);
         }
 
         // skip too big boxes to prevent float overflow at camera parameters calculation
@@ -269,7 +265,8 @@ Graphic3d_BndBox4f OpenGl_Layer::BoundingBox (const Standard_Integer          th
     {
       continue;
     }
-    else if ((aStructure->TransformPersistence.Flags & (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_2d)) == 0)
+    else if (aStructure->TransformPersistence().IsNull()
+         || !aStructure->TransformPersistence()->IsTrihedronOr2d())
     {
       continue;
     }
@@ -280,12 +277,7 @@ Graphic3d_BndBox4f OpenGl_Layer::BoundingBox (const Standard_Integer          th
       continue;
     }
 
-    aStructure->TransformPersistence.Apply (theCamera,
-                                            aProjectionMat,
-                                            aWorldViewMat,
-                                            theWindowWidth,
-                                            theWindowHeight,
-                                            aBox);
+    aStructure->TransformPersistence()->Apply (theCamera, aProjectionMat, aWorldViewMat, theWindowWidth, theWindowHeight, aBox);
     if (!isInfiniteBndBox (aBox))
     {
       aResBox.Combine (aBox);
@@ -321,7 +313,8 @@ Standard_Real OpenGl_Layer::considerZoomPersistenceObjects (const Standard_Integ
     {
       OpenGl_Structure* aStructure = const_cast<OpenGl_Structure*> (aStructures.FindKey (aStructIdx));
       if (!aStructure->IsVisible (theViewId)
-       || (aStructure->TransformPersistence.Flags & Graphic3d_TMF_ZoomPers) == 0)
+       ||  aStructure->TransformPersistence().IsNull()
+       || !aStructure->TransformPersistence()->IsZoomOrRotate())
       {
         continue;
       }
@@ -332,7 +325,7 @@ Standard_Real OpenGl_Layer::considerZoomPersistenceObjects (const Standard_Integ
         continue;
       }
 
-      aStructure->TransformPersistence.Apply (theCamera, aProjectionMat, aWorldViewMat, theWindowWidth, theWindowHeight, aBox);
+      aStructure->TransformPersistence()->Apply (theCamera, aProjectionMat, aWorldViewMat, theWindowWidth, theWindowHeight, aBox);
 
       const BVH_Vec4f&       aCornerMin           = aBox.CornerMin();
       const BVH_Vec4f&       aCornerMax           = aBox.CornerMax();
@@ -372,9 +365,7 @@ Standard_Real OpenGl_Layer::considerZoomPersistenceObjects (const Standard_Integ
         continue;
       }
 
-      const gp_Pnt aTPPoint (aStructure->TransformPersistence.Point.x(),
-                             aStructure->TransformPersistence.Point.y(),
-                             aStructure->TransformPersistence.Point.z());
+      const gp_Pnt aTPPoint = aStructure->TransformPersistence()->AnchorPoint();
       gp_Pnt aConvertedTPPoint = theCamera->Project (aTPPoint);
       aConvertedTPPoint.SetZ (0.0);
 
@@ -473,7 +464,7 @@ void OpenGl_Layer::updateBVH() const
         aStruct->MarkAsNotCulled();
         myAlwaysRenderedMap.Add (aStruct);
       }
-      else if (aStruct->TransformPersistence.Flags == Graphic3d_TMF_None)
+      else if (aStruct->TransformPersistence().IsNull())
       {
         myBVHPrimitives.Add (aStruct);
       }
index 2b1b9e364a18bf73b5169403b455d06cad99c34a..0921824a921ac226e506cedfeccbea547599c02e 100644 (file)
@@ -471,18 +471,14 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
   }
 #endif
 
-  if (TransformPersistence.Flags)
+  if (!myTrsfPers.IsNull())
   {
-    OpenGl_Mat4 aProjection = aCtx->ProjectionState.Current();
-    OpenGl_Mat4 aWorldView  = aCtx->WorldViewState.Current();
-    TransformPersistence.Apply (theWorkspace->View()->Camera(), aProjection, aWorldView,
-                                aCtx->Viewport()[2], aCtx->Viewport()[3]);
+    OpenGl_Mat4 aWorldView = aCtx->WorldViewState.Current();
+    myTrsfPers->Apply (theWorkspace->View()->Camera(), aCtx->ProjectionState.Current(), aWorldView,
+                       aCtx->Viewport()[2], aCtx->Viewport()[3]);
 
-    aCtx->ProjectionState.Push();
     aCtx->WorldViewState.Push();
-    aCtx->ProjectionState.SetCurrent (aProjection);
     aCtx->WorldViewState.SetCurrent (aWorldView);
-    aCtx->ApplyProjectionMatrix();
 
   #if !defined(GL_ES_VERSION_2_0)
     if (!aCtx->IsGlNormalizeEnabled()
@@ -526,8 +522,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
   if (aCtx->Clipping().IsClippingOrCappingOn())
   {
     const Graphic3d_BndBox4f& aBBox = BoundingBox();
-    if (TransformPersistence.Flags == Graphic3d_TMF_TriedronPers
-     || TransformPersistence.Flags == Graphic3d_TMF_2d
+    if ((!myTrsfPers.IsNull() && myTrsfPers->IsTrihedronOr2d())
      || (!myClipPlanes.IsNull() && myClipPlanes->ToOverrideGlobal()))
     {
       aCtx->ChangeClipping().DisableGlobal (aCtx);
@@ -537,7 +532,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
     // Set of clipping planes that do not intersect the structure,
     // and thus can be disabled to improve rendering performance
     if (aBBox.IsValid()
-     && TransformPersistence.Flags == Graphic3d_TMF_None)
+     && myTrsfPers.IsNull())
     {
       for (OpenGl_ClippingIterator aPlaneIt (aCtx->Clipping()); aPlaneIt.More(); aPlaneIt.Next())
       {
@@ -617,11 +612,9 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
   // Restore local transformation
   aCtx->ModelWorldState.Pop();
   aCtx->SetGlNormalizeEnabled (anOldGlNormalize);
-  if (TransformPersistence.Flags)
+  if (!myTrsfPers.IsNull())
   {
-    aCtx->ProjectionState.Pop();
     aCtx->WorldViewState.Pop();
-    aCtx->ApplyProjectionMatrix();
   }
 
   // Restore highlight color
index 68147108cd05e3f97345679ca4d2bbb008f2af96..ed82a470c51b996168e6b2ce2b12c6e2640ab2f2 100644 (file)
@@ -145,9 +145,7 @@ public:
         || IsForHighlight
         || IsMutable
         || Is2dText
-        || (TransformPersistence.Flags & Graphic3d_TMF_2d)           != 0
-        || (TransformPersistence.Flags & Graphic3d_TMF_PanPers)      != 0
-        || (TransformPersistence.Flags & Graphic3d_TMF_TriedronPers) != 0;
+        || (!myTrsfPers.IsNull() && myTrsfPers->IsTrihedronOr2d());
   }
 
   //! This method releases GL resources without actual elements destruction.
index 0f7277be669193ee6f6719d87db1c0aa2d58cf7f..b17b4442a6dd7e73c2c0d347643478fc26f2e97f 100644 (file)
@@ -38,7 +38,7 @@ OpenGl_StructureShadow::OpenGl_StructureShadow (const Handle(Graphic3d_Structure
 
   UpdateTransformation();
   myInstancedStructure = const_cast<OpenGl_Structure*> (myParent->InstancedStructure());
-  TransformPersistence = myParent->TransformPersistence;
+  myTrsfPers = myParent->TransformPersistence();
 
   // reuse instanced structure API
   myInstancedStructure = myParent.operator->();
index 98730438089074f142e52081ab1674b0cc624c93..5a4bbc371118b90f2e355666adab914323b353b2 100644 (file)
@@ -576,9 +576,7 @@ Graphic3d_BndBox4f OpenGl_View::ZLayerBoundingBox (const Graphic3d_ZLayerId
     Graphic3d_BndBox4f aBox2d (Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f),
                                Graphic3d_Vec4 (float(theWindowWidth), float(theWindowHeight), 0.0f, 0.0f));
 
-    Graphic3d_TransformPers aTrsfPers;
-    aTrsfPers.Flags = Graphic3d_TMF_2d;
-    aTrsfPers.Point = Graphic3d_Vec3d(-1.0, -1.0, 0.0);
+    Graphic3d_TransformPers aTrsfPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER);
     aTrsfPers.Apply (theCamera,
                      aProjectionMat,
                      aWorldViewMat,
index c2ff8c8d4ced3b17fb385da7c486953276184fdd..ca7a5ec7fc8430ca6f345bd04122b30b51de8aee 100644 (file)
@@ -14,6 +14,7 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <PrsMgr_PresentableObject.hxx>
 
 #include <Geom_Transformation.hxx>
 #include <gp_Pnt.hxx>
@@ -24,7 +25,6 @@
 #include <Prs3d_Presentation.hxx>
 #include <Prs3d_Projector.hxx>
 #include <PrsMgr_ModedPresentation.hxx>
-#include <PrsMgr_PresentableObject.hxx>
 #include <PrsMgr_Presentation.hxx>
 #include <PrsMgr_PresentationManager.hxx>
 #include <Standard_NotImplemented.hxx>
@@ -74,7 +74,7 @@ void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& t
   Compute (thePrsMgr, aStruct3d, theMode);
   UpdateTransformation (aStruct3d);
   aStruct3d->SetClipPlanes (myClipPlanes);
-  aStruct3d->SetTransformPersistence (GetTransformPersistenceMode(), GetTransformPersistencePoint());
+  aStruct3d->SetTransformPersistence (TransformPersistence());
 }
 
 //=======================================================================
@@ -306,20 +306,16 @@ void PrsMgr_PresentableObject::UpdateTransformation(const Handle(Prs3d_Presentat
 //function : SetTransformPersistence
 //purpose  :
 //=======================================================================
-void PrsMgr_PresentableObject::SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag,
-                                                        const gp_Pnt&                   thePoint)
+void PrsMgr_PresentableObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
-  myTransformPersistence.Flags     = theFlag;
-  myTransformPersistence.Point.x() = thePoint.X();
-  myTransformPersistence.Point.y() = thePoint.Y();
-  myTransformPersistence.Point.z() = thePoint.Z();
+  myTransformPersistence = theTrsfPers;
   for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
   {
     const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
     if (!aPrs3d.IsNull()
      && !aPrs3d->Presentation().IsNull())
     {
-      aPrs3d->Presentation()->SetTransformPersistence (theFlag, thePoint);
+      aPrs3d->Presentation()->SetTransformPersistence (myTransformPersistence);
       aPrs3d->Presentation()->ReCompute();
     }
   }
@@ -327,22 +323,44 @@ void PrsMgr_PresentableObject::SetTransformPersistence (const Graphic3d_TransMod
 
 //=======================================================================
 //function : GetTransformPersistence
-//purpose  : 
-//=======================================================================
-Graphic3d_TransModeFlags PrsMgr_PresentableObject::GetTransformPersistenceMode() const
-{
-  return myTransformPersistence.Flags;
-}
-
-//=======================================================================
-//function : GetTransformPersistence
-//purpose  : 
+//purpose  :
 //=======================================================================
 gp_Pnt PrsMgr_PresentableObject::GetTransformPersistencePoint() const
 {
-  return gp_Pnt (myTransformPersistence.Point.x(),
-                 myTransformPersistence.Point.y(),
-                 myTransformPersistence.Point.z());
+  if (myTransformPersistence.IsNull())
+  {
+    return gp_Pnt();
+  }
+  else if (myTransformPersistence->IsZoomOrRotate())
+  {
+    return myTransformPersistence->AnchorPoint();
+  }
+  else if (!myTransformPersistence->IsTrihedronOr2d())
+  {
+    return gp_Pnt();
+  }
+
+  Standard_Real anX = 0.0;
+  if ((myTransformPersistence->Corner2d() & Aspect_TOTP_RIGHT) != 0)
+  {
+    anX = 1.0;
+  }
+  else if ((myTransformPersistence->Corner2d() & Aspect_TOTP_LEFT) != 0)
+  {
+    anX = -1.0;
+  }
+
+  Standard_Real anY = 0.0;
+  if ((myTransformPersistence->Corner2d() & Aspect_TOTP_TOP) != 0)
+  {
+    anY = 1.0;
+  }
+  else if ((myTransformPersistence->Corner2d() & Aspect_TOTP_BOTTOM) != 0)
+  {
+    anY = -1.0;
+  }
+
+  return gp_Pnt (anX, anY, myTransformPersistence->Offset2d().x());
 }
 
 //=======================================================================
index 9b7a2eeda80e4f86aac4ae9444a8f5cd89f75733..da8466f2232ca0ddb4d90b1d71c2f50a95186472 100644 (file)
@@ -78,37 +78,48 @@ public:
   //! Returns information on whether the object accepts display in HLR mode or not.
   PrsMgr_TypeOfPresentation3d TypeOfPresentation3d() const { return myTypeOfPresentation3d; }
 
+  //! @return transform persistence of the presentable object.
+  const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTransformPersistence; }
+
+  //! Sets up Transform Persistence for this object.
+  Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
+
   //! Sets up Transform Persistence Mode for this object.
   //! This function used to lock in object position, rotation and / or zooming relative to camera position.
-  //! Object will be drawn in the origin setted by APoint parameter (except Graphic3d_TMF_TriedronPers flag
-  //! - see description later). aFlag should be:
+  //! Object will be drawn in the origin setted by thePoint parameter (except Graphic3d_TMF_TriedronPers flag
+  //! - see description later). theMode should be:
   //! -   Graphic3d_TMF_None - no persistence attributes (reset);
-  //! -   Graphic3d_TMF_PanPers - object doesn't move;
   //! -   Graphic3d_TMF_ZoomPers - object doesn't resize;
   //! -   Graphic3d_TMF_RotatePers - object doesn't rotate;
-  //! -   Graphic3d_TMF_FullPers - pan, zoom and rotate transform persistence;
-  //! -   Graphic3d_TMF_TriedronPers - object behaves like trihedron;
-  //! -   combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers);
-  //! -   combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_RotatePers);
-  //! -   combination (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers).
-  //! If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected APoint coordinates X and Y means:
+  //! -   Graphic3d_TMF_ZoomRotatePers - object doesn't resize and rotate;
+  //! -   Graphic3d_TMF_RotatePers - object doesn't rotate;
+  //! -   Graphic3d_TMF_TriedronPers - object behaves like trihedron.
+  //! If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected thePoint coordinates X and Y means:
   //! -   X = 0.0, Y = 0.0 - center of view window;
   //! -   X > 0.0, Y > 0.0 - right upper corner of view window;
   //! -   X > 0.0, Y < 0.0 - right lower corner of view window;
   //! -   X < 0.0, Y > 0.0 - left  upper corner of view window;
   //! -   X < 0.0, Y < 0.0 - left  lower corner of view window.
   //! And Z coordinate defines the gap from border of view window (except center position).
-  Standard_EXPORT virtual void SetTransformPersistence (const Graphic3d_TransModeFlags& aFlag, const gp_Pnt& APoint = gp_Pnt (0.0, 0.0, 0.0));
+  Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
+  void SetTransformPersistence (const Graphic3d_TransModeFlags theMode, const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
+  {
+    SetTransformPersistence (Graphic3d_TransformPers::FromDeprecatedParams (theMode, thePoint));
+  }
 
   //! Gets  Transform  Persistence Mode  for  this  object
-  Standard_EXPORT Graphic3d_TransModeFlags GetTransformPersistenceMode() const;
-  
+  Standard_DEPRECATED("This method is deprecated - TransformPersistence() should be called instead")
+  Graphic3d_TransModeFlags GetTransformPersistenceMode() const
+  {
+    return myTransformPersistence.IsNull()
+         ? Graphic3d_TMF_None
+         : myTransformPersistence->Mode();
+  }
+
   //! Gets  point  of  transform  persistence for  this  object
+  Standard_DEPRECATED("This method is deprecated - TransformPersistence() should be called instead")
   Standard_EXPORT gp_Pnt GetTransformPersistencePoint() const;
 
-  //! @return transform persistence of the presentable object.
-  const Graphic3d_TransformPers& TransformPersistence() const { return myTransformPersistence; }
-
   Standard_EXPORT void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d aType);
   
   //! flags the Prs of mode <AMode> to be Updated.
@@ -289,7 +300,7 @@ protected:
 
 private:
 
-  Graphic3d_TransformPers myTransformPersistence;
+  Handle(Graphic3d_TransformPers) myTransformPersistence;
   PrsMgr_PresentableObjectPointer myParent;
   gp_Trsf myLocalTransformation;
   gp_Trsf myTransformation;
index fc6890bb7f62a0bc857b1da38b7b4e5bbd316169..6029068aaf388273d2d3395b87c22615f86e1a4a 100644 (file)
@@ -4556,9 +4556,10 @@ static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, c
   {
     aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
   }
-  if (aCS->GetTransformPersistenceMode() != Graphic3d_TMF_2d)
+  if (aCS->TransformPersistence().IsNull()
+   || aCS->TransformPersistence()->Mode() != Graphic3d_TMF_2d)
   {
-    aContext->SetTransformPersistence (aCS, Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
+    aContext->SetTransformPersistence (aCS, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   }
   Standard_Integer aWinWidth, aWinHeight;
   V->Window()->Size (aWinWidth, aWinHeight);
index c7af451374a758b61280e7fdd2c6e60827a8b866..8b18242bb4c5b48aa8f0c9c2344cbddd364fd19f 100644 (file)
@@ -348,14 +348,13 @@ void SelectMgr_SelectableObject::SetAutoHilight ( const Standard_Boolean newAuto
 //function : GetHilightPresentation
 //purpose  : 
 //=======================================================================
-Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetHilightPresentation( const Handle(PrsMgr_PresentationManager3d)& TheMgr )
+Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetHilightPresentation (const Handle(PrsMgr_PresentationManager3d)& theMgr)
 {
-  if( myHilightPrs.IsNull() && !TheMgr.IsNull() )
-    {
-      myHilightPrs = new Prs3d_Presentation( TheMgr->StructureManager() );
-      myHilightPrs->SetTransformPersistence( GetTransformPersistenceMode(), 
-                                        GetTransformPersistencePoint() );
-    }
+  if (myHilightPrs.IsNull() && !theMgr.IsNull())
+  {
+    myHilightPrs = new Prs3d_Presentation (theMgr->StructureManager());
+    myHilightPrs->SetTransformPersistence (TransformPersistence());
+  }
 
   return myHilightPrs;
 }
@@ -365,13 +364,14 @@ Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetHilightPresentation( c
 //function : GetSelectPresentation
 //purpose  : 
 //=======================================================================
-Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetSelectPresentation( const Handle(PrsMgr_PresentationManager3d)& TheMgr )
+Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetSelectPresentation (const Handle(PrsMgr_PresentationManager3d)& theMgr)
 {
-  if( mySelectionPrs.IsNull() && !TheMgr.IsNull() ) {
-    mySelectionPrs = new Prs3d_Presentation( TheMgr->StructureManager() );
-    mySelectionPrs->SetTransformPersistence( GetTransformPersistenceMode(), 
-                                            GetTransformPersistencePoint() );
+  if (mySelectionPrs.IsNull() && !theMgr.IsNull())
+  {
+    mySelectionPrs = new Prs3d_Presentation (theMgr->StructureManager());
+    mySelectionPrs->SetTransformPersistence (TransformPersistence());
   }
+
   return mySelectionPrs;
 }
 
index 6aa38decef0aa893f30b21fbe8977e2db1b995e3..763980c7ef83fc84349a483decf12c2e6d4e196c 100644 (file)
@@ -125,14 +125,14 @@ namespace
 
         Bnd_Box aBoundingBox;
         anObject->BoundingBox (aBoundingBox);
-        if (aBoundingBox.IsVoid())
+        if (aBoundingBox.IsVoid()
+         || anObject->TransformPersistence().IsNull())
         {
           myBoundings.Add (new Select3D_HBndBox3d());
         }
         else
         {
-          anObject->TransformPersistence().Apply (
-            theCamera, theProjectionMat, theWorldViewMat, theWidth, theHeight, aBoundingBox);
+          anObject->TransformPersistence()->Apply (theCamera, theProjectionMat, theWorldViewMat, theWidth, theHeight, aBoundingBox);
 
           const gp_Pnt aMin = aBoundingBox.CornerMin();
           const gp_Pnt aMax = aBoundingBox.CornerMax();
index 770f182d44d2b3f06e2915135afa6cce1a75c908..978337cf8fe2666d31aeec3836838757b7485298 100644 (file)
@@ -184,11 +184,11 @@ private:
   //! Returns an appropriate subset of theObject given depending on its persistence type.
   Standard_Integer appropriateSubset (const Handle(SelectMgr_SelectableObject)& theObject)
   {
-    if (!theObject->TransformPersistence().Flags)
+    if (theObject->TransformPersistence().IsNull())
     {
       return SelectMgr_SelectableObjectSet::BVHSubset_3d;
     }
-    else if (theObject->TransformPersistence().Flags & Graphic3d_TMF_2d)
+    else if (theObject->TransformPersistence()->Mode() == Graphic3d_TMF_2d)
     {
       return SelectMgr_SelectableObjectSet::BVHSubset_2dPersistent;
     }
index 0f162e9079cb7e8b8e20dd962d452a64882adbc5..84d50631da1a873a093959c21d5ed33165998b45 100644 (file)
@@ -171,8 +171,7 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
   if (!anOwner.IsNull())
   {
     aSelectable = anOwner->Selectable();
-    if (aSelectable->TransformPersistence().Flags == Graphic3d_TMF_TriedronPers
-     || aSelectable->TransformPersistence().Flags == Graphic3d_TMF_2d
+    if ((!aSelectable->TransformPersistence().IsNull() && aSelectable->TransformPersistence()->IsTrihedronOr2d())
      || (!aSelectable->ClipPlanes().IsNull() && aSelectable->ClipPlanes()->ToOverrideGlobal()))
     {
       theMgr.SetViewClippingEnabled (Standard_False);
@@ -289,17 +288,16 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
 
   gp_GTrsf aInversedTrsf;
 
-  if (theObject->HasTransformation() || theObject->TransformPersistence().Flags)
+  if (theObject->HasTransformation() || !theObject->TransformPersistence().IsNull())
   {
-    if (!theObject->TransformPersistence().Flags)
+    if (theObject->TransformPersistence().IsNull())
     {
       aInversedTrsf = theObject->InversedTransformation();
     }
     else
     {
       gp_GTrsf aTPers;
-      Graphic3d_Mat4d aMat = theObject->TransformPersistence().Compute (
-        theCamera, theProjectionMat, theWorldViewMat, theViewportWidth, theViewportHeight);
+      Graphic3d_Mat4d aMat = theObject->TransformPersistence()->Compute (theCamera, theProjectionMat, theWorldViewMat, theViewportWidth, theViewportHeight);
 
       aTPers.SetValue (1, 1, aMat.GetValue (0, 0));
       aTPers.SetValue (1, 2, aMat.GetValue (0, 1));
index 2654518ef2f7feaf051377b80a434b017f24a0ef..16068860056eba30fadcdbc6abc6f3c08ced3b13 100644 (file)
@@ -114,7 +114,7 @@ void StdSelect_BRepOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
     if (!aSel.IsNull())
     {
       myPrsSh->SetZLayer (aSel->ZLayer());
-      myPrsSh->SetTransformPersistence (aSel->GetTransformPersistenceMode(), aSel->GetTransformPersistencePoint());
+      myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
     }
 
     // highlight and set layer
@@ -177,7 +177,7 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
     if (!aSel.IsNull())
     {
       myPrsSh->SetZLayer (aSel->ZLayer());
-      myPrsSh->SetTransformPersistence (aSel->GetTransformPersistenceMode(), aSel->GetTransformPersistencePoint());
+      myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
     }
 
     // highlight with color and set layer
index 67840be3f4e1a33e03a6ee5a189ff1cb8d8f7cd5..6b29cf708cec46622bcf3f9d871282e399349f2f 100644 (file)
@@ -195,7 +195,7 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theVi
     {
       if (anObj->CurrentSelection()->GetSelectionState() == SelectMgr_SOS_Activated)
       {
-        computeSensitivePrs (aStruct, anObj->CurrentSelection(), anObj->Transformation(), Graphic3d_TransformPers());
+        computeSensitivePrs (aStruct, anObj->CurrentSelection(), anObj->Transformation(), Handle(Graphic3d_TransformPers)());
       }
     }
 
@@ -247,7 +247,7 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(SelectMgr_Select
 
   Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (theView->Viewer()->StructureManager());
 
-  computeSensitivePrs (aStruct, theSel, theTrsf, Graphic3d_TransformPers());
+  computeSensitivePrs (aStruct, theSel, theTrsf, Handle(Graphic3d_TransformPers)());
 
   myStructs.Append (aStruct);
   myStructs.Last()->SetDisplayPriority (10);
@@ -263,11 +263,9 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(SelectMgr_Select
 void StdSelect_ViewerSelector3d::computeSensitivePrs (const Handle(Graphic3d_Structure)& theStructure,
                                                       const Handle(SelectMgr_Selection)& theSel,
                                                       const gp_Trsf& theLoc,
-                                                      const Graphic3d_TransformPers& theTransPers)
+                                                      const Handle(Graphic3d_TransformPers)& theTrsfPers)
 {
-  theStructure->SetTransformPersistence (theTransPers.Flags, gp_Pnt (theTransPers.Point.x(),
-                                                                     theTransPers.Point.y(),
-                                                                     theTransPers.Point.z()));
+  theStructure->SetTransformPersistence (theTrsfPers);
 
   Handle(Graphic3d_Group) aSensGroup  = theStructure->NewGroup();
 
index 37ac0072ddbb3d9618c1aa1a0dcd2a00ff482af2..48c428322da8c1e5b6ba532b8f1beba669ab2269 100644 (file)
@@ -88,7 +88,7 @@ protected:
   Standard_EXPORT void computeSensitivePrs (const Handle(Graphic3d_Structure)& theStructure,
                                             const Handle(SelectMgr_Selection)& theSel,
                                             const gp_Trsf& theLoc,
-                                            const Graphic3d_TransformPers& theTransPers);
+                                            const Handle(Graphic3d_TransformPers)& theTrsfPers);
 
   //! Update z-layers order map.
   Standard_EXPORT void updateZLayers (const Handle(V3d_View)& theView);
index 668d78e71f7356b0217fdf6f6b77e4be52c48859..a01ab03502b9b23f0e862a73e9a3989085d9ce07 100644 (file)
@@ -2126,7 +2126,7 @@ void V3d_View::Gravity (Standard_Real& theX,
     }
 
     // skip transformation-persistent objects
-    if (aStruct->TransformPersistence().Flags != Graphic3d_TMF_None)
+    if (!aStruct->TransformPersistence().IsNull())
     {
       continue;
     }
index a342d1ab954fd00011fad719e2884ac230baf1f3..113dbfda6cdceec13c656603d66dfdc89c0faad9 100644 (file)
@@ -3385,27 +3385,24 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
 
 //! Auxiliary method to parse transformation persistence flags
 inline Standard_Boolean parseTrsfPersFlag (const TCollection_AsciiString& theFlagString,
-                                           Standard_Integer&              theFlags)
+                                           Graphic3d_TransModeFlags&      theFlags)
 {
-  if (theFlagString == "pan")
+  if (theFlagString == "zoom")
   {
-    theFlags |= Graphic3d_TMF_PanPers;
-  }
-  else if (theFlagString == "zoom")
-  {
-    theFlags |= Graphic3d_TMF_ZoomPers;
+    theFlags = Graphic3d_TMF_ZoomPers;
   }
   else if (theFlagString == "rotate")
   {
-    theFlags |= Graphic3d_TMF_RotatePers;
+    theFlags = Graphic3d_TMF_RotatePers;
   }
-  else if (theFlagString == "trihedron")
+  else if (theFlagString == "zoomrotate")
   {
-    theFlags = Graphic3d_TMF_TriedronPers;
+    theFlags = Graphic3d_TMF_ZoomRotatePers;
   }
-  else if (theFlagString == "full")
+  else if (theFlagString == "trihedron"
+        || theFlagString == "triedron")
   {
-    theFlags = Graphic3d_TMF_FullPers;
+    theFlags = Graphic3d_TMF_TriedronPers;
   }
   else if (theFlagString == "none")
   {
@@ -3419,6 +3416,66 @@ inline Standard_Boolean parseTrsfPersFlag (const TCollection_AsciiString& theFla
   return Standard_True;
 }
 
+//! Auxiliary method to parse transformation persistence flags
+inline Standard_Boolean parseTrsfPersCorner (const TCollection_AsciiString& theString,
+                                             Aspect_TypeOfTriedronPosition& theCorner)
+{
+  TCollection_AsciiString aString (theString);
+  aString.LowerCase();
+  if (aString == "center")
+  {
+    theCorner = Aspect_TOTP_CENTER;
+  }
+  else if (aString == "top"
+        || aString == "upper")
+  {
+    theCorner = Aspect_TOTP_TOP;
+  }
+  else if (aString == "bottom"
+        || aString == "lower")
+  {
+    theCorner = Aspect_TOTP_BOTTOM;
+  }
+  else if (aString == "left")
+  {
+    theCorner = Aspect_TOTP_LEFT;
+  }
+  else if (aString == "right")
+  {
+    theCorner = Aspect_TOTP_RIGHT;
+  }
+  else if (aString == "topleft"
+        || aString == "leftupper"
+        || aString == "upperleft")
+  {
+    theCorner = Aspect_TOTP_LEFT_UPPER;
+  }
+  else if (aString == "bottomleft"
+        || aString == "leftlower"
+        || aString == "lowerleft")
+  {
+    theCorner = Aspect_TOTP_LEFT_LOWER;
+  }
+  else if (aString == "topright"
+        || aString == "rightupper"
+        || aString == "upperright")
+  {
+    theCorner = Aspect_TOTP_RIGHT_UPPER;
+  }
+  else if (aString == "bottomright"
+        || aString == "lowerright"
+        || aString == "rightlower")
+  {
+    theCorner = Aspect_TOTP_RIGHT_LOWER;
+  }
+  else
+  {
+    return Standard_False;
+  }
+
+  return Standard_True;
+}
+
 //==============================================================================
 //function : VDisplay2
 //author   : ege
@@ -3451,8 +3508,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
   Standard_Integer   anObjDispMode  = -2;
   Standard_Integer   anObjHighMode  = -2;
   Standard_Boolean   toSetTrsfPers  = Standard_False;
-  Graphic3d_TransModeFlags aTrsfPersFlags = Graphic3d_TMF_None;
-  gp_Pnt aTPPosition;
+  Handle(Graphic3d_TransformPers) aTrsfPers;
   TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
   AIS_DisplayStatus aDispStatus = AIS_DS_None;
   Standard_Integer toDisplayInView = Standard_False;
@@ -3528,51 +3584,71 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     else if (aNameCase == "-3d")
     {
       toSetTrsfPers  = Standard_True;
-      aTrsfPersFlags = Graphic3d_TMF_None;
+      aTrsfPers.Nullify();
     }
-    else if (aNameCase == "-2d")
+    else if (aNameCase == "-2d"
+          || aNameCase == "-trihedron"
+          || aNameCase == "-triedron")
     {
       toSetTrsfPers  = Standard_True;
-      aTrsfPersFlags = Graphic3d_TMF_2d;
+      aTrsfPers = new Graphic3d_TransformPers (aNameCase == "-2d" ? Graphic3d_TMF_2d : Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER);
+
+      if (anArgIter + 1 < theArgNb)
+      {
+        Aspect_TypeOfTriedronPosition aCorner = Aspect_TOTP_CENTER;
+        if (parseTrsfPersCorner (theArgVec[anArgIter + 1], aCorner))
+        {
+          ++anArgIter;
+          aTrsfPers->SetCorner2d (aCorner);
+
+          if (anArgIter + 2 < theArgNb)
+          {
+            TCollection_AsciiString anX (theArgVec[anArgIter + 1]);
+            TCollection_AsciiString anY (theArgVec[anArgIter + 2]);
+            if (anX.IsIntegerValue()
+             && anY.IsIntegerValue())
+            {
+              anArgIter += 2;
+              aTrsfPers->SetOffset2d (Graphic3d_Vec2i (anX.IntegerValue(), anY.IntegerValue()));
+            }
+          }
+        }
+      }
     }
     else if (aNameCase == "-trsfpers"
           || aNameCase == "-pers")
     {
-      if (++anArgIter >= theArgNb)
+      if (++anArgIter >= theArgNb
+       || !aTrsfPers.IsNull())
       {
         std::cerr << "Error: wrong syntax at " << aName << ".\n";
         return 1;
       }
 
       toSetTrsfPers  = Standard_True;
-      aTrsfPersFlags = Graphic3d_TMF_None;
+      Graphic3d_TransModeFlags aTrsfPersFlags = Graphic3d_TMF_None;
       TCollection_AsciiString aPersFlags (theArgVec [anArgIter]);
       aPersFlags.LowerCase();
-      for (Standard_Integer aParserPos = aPersFlags.Search ("|");; aParserPos = aPersFlags.Search ("|"))
+      if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
       {
-        if (aParserPos == -1)
-        {
-          if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
-          {
-            std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
-            return 1;
-          }
-          break;
-        }
+        std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
+        return 1;
+      }
 
-        TCollection_AsciiString anOtherFlags = aPersFlags.Split (aParserPos - 1);
-        if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
-        {
-          std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
-          return 1;
-        }
-        aPersFlags = anOtherFlags;
+      if (aTrsfPersFlags == Graphic3d_TMF_TriedronPers)
+      {
+        aTrsfPers = new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER);
+      }
+      else if (aTrsfPersFlags != Graphic3d_TMF_None)
+      {
+        aTrsfPers = new Graphic3d_TransformPers (aTrsfPersFlags, gp_Pnt());
       }
     }
     else if (aNameCase == "-trsfperspos"
           || aNameCase == "-perspos")
     {
-      if (anArgIter + 2 >= theArgNb)
+      if (anArgIter + 2 >= theArgNb
+       || aTrsfPers.IsNull())
       {
         std::cerr << "Error: wrong syntax at " << aName << ".\n";
         return 1;
@@ -3581,8 +3657,8 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       TCollection_AsciiString aX (theArgVec[++anArgIter]);
       TCollection_AsciiString aY (theArgVec[++anArgIter]);
       TCollection_AsciiString aZ = "0";
-      if (!aX.IsIntegerValue()
-       || !aY.IsIntegerValue())
+      if (!aX.IsRealValue()
+       || !aY.IsRealValue())
       {
         std::cerr << "Error: wrong syntax at " << aName << ".\n";
         return 1;
@@ -3590,13 +3666,22 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       if (anArgIter + 1 < theArgNb)
       {
         TCollection_AsciiString aTemp = theArgVec[anArgIter + 1];
-        if (aTemp.IsIntegerValue())
+        if (aTemp.IsRealValue())
         {
           aZ = aTemp;
           ++anArgIter;
         }
       }
-      aTPPosition.SetCoord (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue());
+
+      const gp_Pnt aPnt (aX.RealValue(), aY.RealValue(), aZ.RealValue());
+      if (aTrsfPers->IsZoomOrRotate())
+      {
+        aTrsfPers->SetAnchorPoint (aPnt);
+      }
+      else if (aTrsfPers->IsTrihedronOr2d())
+      {
+        aTrsfPers = Graphic3d_TransformPers::FromDeprecatedParams (aTrsfPers->Mode(), aPnt);
+      }
     }
     else if (aNameCase == "-layer")
     {
@@ -3672,7 +3757,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
         }
         if (toSetTrsfPers)
         {
-          aCtx->SetTransformPersistence (aShape, aTrsfPersFlags, aTPPosition);
+          aCtx->SetTransformPersistence (aShape, aTrsfPers);
         }
         if (anObjDispMode != -2)
         {
@@ -3726,7 +3811,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     }
     if (toSetTrsfPers)
     {
-      aCtx->SetTransformPersistence (aShape, aTrsfPersFlags, aTPPosition);
+      aCtx->SetTransformPersistence (aShape, aTrsfPers);
     }
     if (anObjDispMode != -2)
     {
@@ -5523,7 +5608,11 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
 
   theCommands.Add("vdisplay",
               "vdisplay [-noupdate|-update] [-local] [-mutable] [-neutral]"
-      "\n\t\t:          [-trsfPers {pan|zoom|rotate|trihedron|full|none}=none] [-trsfPersPos X Y [Z]] [-3d|-2d]"
+      "\n\t\t:          [-trsfPers {zoom|rotate|zoomRotate|none}=none]"
+      "\n\t\t:                            [-trsfPersPos X Y [Z]] [-3d]"
+      "\n\t\t:          [-2d|-trihedron [{top|bottom|left|right|topLeft"
+      "\n\t\t:                           |topRight|bottomLeft|bottomRight}"
+      "\n\t\t:                                         [offsetX offsetY]]]"
       "\n\t\t:          [-dispMode mode] [-highMode mode]"
       "\n\t\t:          [-layer index] [-top|-topmost|-overlay|-underlay]"
       "\n\t\t:          [-redisplay]"
@@ -5532,21 +5621,28 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t: Option -local enables displaying of objects in local"
       "\n\t\t: selection context. Local selection context will be opened"
       "\n\t\t: if there is not any."
-      "\n\t\t:  -noupdate    suppresses viewer redraw call."
-      "\n\t\t:  -mutable     enables optimizations for mutable objects."
-      "\n\t\t:  -neutral     draws objects in main viewer."
-      "\n\t\t:  -layer       sets z-layer for objects. It can use -overlay|-underlay|-top|-topmost instead of -layer index for the default z-layers."
-      "\n\t\t:  -top         draws objects on top of main presentations but below topmost."
-      "\n\t\t:  -topmost     draws in overlay for 3D presentations with independent Depth."
-      "\n\t\t:  -overlay     draws objects in overlay for 2D presentations (On-Screen-Display)."
-      "\n\t\t:  -underlay    draws objects in underlay for 2D presentations (On-Screen-Display)."
-      "\n\t\t:  -selectable|-noselect controls selection of objects."
-      "\n\t\t:  -trsfPers    sets a transform persistence flags. Flag 'full' is pan, zoom and rotate."
-      "\n\t\t:  -trsfPersPos sets an anchor point for transform persistence."
-      "\n\t\t:  -2d          displays object in screen coordinates (DY looks up)."
-      "\n\t\t:  -dispmode sets display mode for objects."
-      "\n\t\t:  -highmode sets hilight mode for objects."
-      "\n\t\t:  -redisplay recomputes presentation of objects.",
+      "\n\t\t:  -noupdate    Suppresses viewer redraw call."
+      "\n\t\t:  -mutable     Enables optimizations for mutable objects."
+      "\n\t\t:  -neutral     Draws objects in main viewer."
+      "\n\t\t:  -layer       Sets z-layer for objects."
+      "\n\t\t:               Alternatively -overlay|-underlay|-top|-topmost"
+      "\n\t\t:               options can be used for the default z-layers."
+      "\n\t\t:  -top         Draws object on top of main presentations"
+      "\n\t\t:               but below topmost."
+      "\n\t\t:  -topmost     Draws in overlay for 3D presentations."
+      "\n\t\t:               with independent Depth."
+      "\n\t\t:  -overlay     Draws objects in overlay for 2D presentations."
+      "\n\t\t:               (On-Screen-Display)"
+      "\n\t\t:  -underlay    Draws objects in underlay for 2D presentations."
+      "\n\t\t:               (On-Screen-Display)"
+      "\n\t\t:  -selectable|-noselect Controls selection of objects."
+      "\n\t\t:  -trsfPers    Sets a transform persistence flags."
+      "\n\t\t:  -trsfPersPos Sets an anchor point for transform persistence."
+      "\n\t\t:  -2d          Displays object in screen coordinates."
+      "\n\t\t:               (DY looks up)"
+      "\n\t\t:  -dispmode    Sets display mode for objects."
+      "\n\t\t:  -highmode    Sets hilight mode for objects."
+      "\n\t\t:  -redisplay   Recomputes presentation of objects.",
       __FILE__, VDisplay2, group);
 
   theCommands.Add ("vupdate",
index 1cad752d8a02d70a7f8acd7ba4648a4cdae94466..15a7f9fcad79604a6994b10143d02c16bcd24d31 100644 (file)
 #include <TColStd_HArray1OfAsciiString.hxx>
 #include <TColStd_HSequenceOfAsciiString.hxx>
 
-#if defined(_MSC_VER)
-# define _CRT_SECURE_NO_DEPRECATE
-# pragma warning (disable:4996)
-#endif
-
 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
 extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
                                            const Handle(AIS_InteractiveObject)& theAISObj,
@@ -2508,11 +2503,9 @@ static int VDrawText (Draw_Interpretor& theDI,
 
   aTextPrs->SetText (aText);
 
-  Graphic3d_TransModeFlags aTrsfPersFlags = Graphic3d_TMF_None;
-  gp_Pnt aTPPosition;
+  Handle(Graphic3d_TransformPers) aTrsfPers;
   Aspect_TypeOfDisplayText aDisplayType = Aspect_TODT_NORMAL;
 
-
   Standard_Boolean aHasPlane = Standard_False;
   gp_Dir           aNormal;
   gp_Dir           aDirection;
@@ -2799,7 +2792,7 @@ static int VDrawText (Draw_Interpretor& theDI,
     }
     else if (aParam == "-2d")
     {
-      aTrsfPersFlags = Graphic3d_TMF_2d;
+      aTrsfPers = new Graphic3d_TransformPers (Graphic3d_TMF_2d);
     }
     else if (aParam == "-trsfperspos"
           || aParam == "-perspos")
@@ -2828,7 +2821,8 @@ static int VDrawText (Draw_Interpretor& theDI,
           ++anArgIt;
         }
       }
-      aTPPosition.SetCoord (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue());
+
+      aTrsfPers = Graphic3d_TransformPers::FromDeprecatedParams (Graphic3d_TMF_2d, gp_Pnt (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue()));
     }
     else
     {
@@ -2844,18 +2838,18 @@ static int VDrawText (Draw_Interpretor& theDI,
 
   aTextPrs->SetDisplayType (aDisplayType);
 
-  if (aTrsfPersFlags != Graphic3d_TMF_None)
+  if (!aTrsfPers.IsNull())
   {
-    aContext->SetTransformPersistence (aTextPrs, aTrsfPersFlags, aTPPosition);
+    aContext->SetTransformPersistence (aTextPrs, aTrsfPers);
     aTextPrs->SetZLayer(Graphic3d_ZLayerId_TopOSD);
     if (aTextPrs->Position().Z() != 0)
     {
       aTextPrs->SetPosition (gp_Pnt(aTextPrs->Position().X(), aTextPrs->Position().Y(), 0));
     }
   }
-  else if (aTrsfPersFlags != aTextPrs->TransformPersistence().Flags)
+  else if (!aTextPrs->TransformPersistence().IsNull())
   {
-    aContext->SetTransformPersistence (aTextPrs, aTrsfPersFlags);
+    aContext->SetTransformPersistence (aTextPrs, Handle(Graphic3d_TransformPers)());
   }
   ViewerTest::Display (aName, aTextPrs, Standard_False);
   return 0;
index 6992046e1fa7fed6cb67b02e91e4587acfda3f55..844b1fb79bfa2446da229f03c854542c9fdc1b0f 100644 (file)
@@ -3478,9 +3478,10 @@ static int VColorScale (Draw_Interpretor& theDI,
   {
     aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
   }
-  if (aCS->GetTransformPersistenceMode() != Graphic3d_TMF_2d)
+  if (aCS->TransformPersistence().IsNull()
+   || aCS->TransformPersistence()->Mode() != Graphic3d_TMF_2d)
   {
-    aContext->SetTransformPersistence (aCS, Graphic3d_TMF_2d, gp_Pnt (-1.0, -1.0, 0.0));
+    aContext->SetTransformPersistence (aCS, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   }
 
   Standard_Real                   aMinRange    = aCS->GetMin();
@@ -4746,7 +4747,7 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char**
                             aLineType, aWidth,
                             aTransparency);
 
-  aContext->SetTransformPersistence (aLine, Graphic3d_TMF_2d, gp_Pnt (-1.0, -1.0, 0.0));
+  aContext->SetTransformPersistence (aLine, new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
   aLine->SetZLayer (Graphic3d_ZLayerId_TopOSD);
   aLine->SetToUpdate();
   aContext->Display (aLine, Standard_True);
index 9b8cc7ad9e39d683814bdb9fade1d7572b2e3769..d75da7e2dbfd81745c26a5d7589dc5f400fb7683 100755 (executable)
@@ -10,7 +10,7 @@ box b1 10 20 30
 box b2 10 20 30
 ttranslate b2 50 50 0
 vinit
-vdisplay b1 -trsfPers trihedron
+vdisplay b1 -trihedron center
 
 vdisplay b2
 vfit
index 4f9623a8bb4b7a2a15f66b0e7bac3235c3803b5e..de8509fc235ccb273bc71e75d919b5058bb88143 100644 (file)
@@ -12,32 +12,32 @@ vaxo
 
 # display polyline in overlay
 text2brep tcc "Center" -font SansFont -height 30
-vdisplay  tcc -2d -osd
+vdisplay  tcc -2d center -osd
 polyline  lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
-vdisplay  lcc -2d -overlay
+vdisplay  lcc -2d center -overlay
 
 # display polyline in overlay in the bottom left corner of the view
 text2brep tbl "Bottom-Left" -font SansFont -height 30
-vdisplay  tbl -2d -trsfPersPos -1 -1 5 -osd
+vdisplay  tbl -2d bottomLeft 5 5 -osd
 polyline  lbl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
-vdisplay  lbl -2d -trsfPersPos -1 -1 3 -overlay
+vdisplay  lbl -2d bottomLeft 3 3 -overlay
 
 # display polyline in overlay in the top left corner of the view
 text2brep ttl "Top-Left" -font SansFont -height 30 -pos -27 0 0
-vdisplay  ttl -2d -trsfPersPos -1 1 30 -osd
+vdisplay  ttl -2d topLeft 30 30 -osd
 polyline  ltl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
-vdisplay  ltl -2d -trsfPersPos -1 1 3  -overlay
+vdisplay  ltl -2d topLeft  3  3 -overlay
 
 # display polyline in overlay in the top right corner of the view
 text2brep ttr "Top-Right" -font SansFont -height 30 -pos -100 0 0
-vdisplay  ttr -2d -trsfPersPos 1 1 30 -osd
+vdisplay  ttr -2d topRight 30 30 -osd
 polyline  ltr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
-vdisplay  ltr -2d -trsfPersPos 1 1 3  -overlay
+vdisplay  ltr -2d topRight  3  3 -overlay
 
 # display polyline in overlay in the bottom right corner of the view
 text2brep tbr "Bottom-Right" -font SansFont -height 30 -pos -165 0 0
-vdisplay  tbr -2d -trsfPersPos 1 -1 5 -osd
+vdisplay  tbr -2d bottomRight 5 5 -osd
 polyline  lbr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
-vdisplay  lbr -2d -trsfPersPos 1 -1 3 -overlay
+vdisplay  lbr -2d bottomRight 3 3 -overlay
 
 vdump ${imagedir}/${casename}.png
index 19e096e85ccb4b748c9e740d9ea5d4f124825478..d5b5a598da1c3dfd7c8218c7c9804c5a5a001a18 100644 (file)
@@ -11,29 +11,29 @@ vclear
 vaxo
 
 text2brep tcc "Center" -font SansFont -height 30
-vdisplay  tcc -2d -underlay
+vdisplay  tcc -2d center -underlay
 polyline  lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
-vdisplay  lcc -2d -underlay
+vdisplay  lcc -2d center -underlay
 
 text2brep tbl "Bottom-Left" -font SansFont -height 30
-vdisplay  tbl -2d -trsfPersPos -1 -1 5 -underlay
+vdisplay  tbl -2d bottomLeft 5 5 -underlay
 polyline  lbl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
-vdisplay  lbl -2d -trsfPersPos -1 -1 3 -underlay
+vdisplay  lbl -2d bottomLeft 3 3 -underlay
 
 text2brep ttl "Top-Left" -font SansFont -height 30 -pos -27 0 0
-vdisplay  ttl -2d -trsfPersPos -1 1 30 -underlay
+vdisplay  ttl -2d topLeft 30 30 -underlay
 polyline  ltl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
-vdisplay  ltl -2d -trsfPersPos -1 1 3  -underlay
+vdisplay  ltl -2d topLeft  3  3 -underlay
 
 text2brep ttr "Top-Right" -font SansFont -height 30 -pos -100 0 0
-vdisplay  ttr -2d -trsfPersPos 1 1 30 -underlay
+vdisplay  ttr -2d topRight 30 30 -underlay
 polyline  ltr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
-vdisplay  ltr -2d -trsfPersPos 1 1 3  -underlay
+vdisplay  ltr -2d topRight  3  3 -underlay
 
 text2brep tbr "Bottom-Right" -font SansFont -height 30 -pos -165 0 0
-vdisplay  tbr -2d -trsfPersPos 1 -1 5 -underlay
+vdisplay  tbr -2d bottomRight 5 5 -underlay
 polyline  lbr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
-vdisplay  lbr -2d -trsfPersPos 1 -1 3 -underlay
+vdisplay  lbr -2d bottomRight 3 3 -underlay
 
 box b 1 2 3
 vdisplay b
index 7ea8a20e0c702e1cee5de820db18bf1a03ed2017..d96000a25cd7468e8a61753550f0910ebac03011 100644 (file)
@@ -13,18 +13,18 @@ vinit View1 w=409 h=409
 vtrihedron tri
 vpan 50 50
 
-box b1 25 25 25
-box b2 25 25 25
-box b3 100 100 100
-box b4 100 100 100
-box b5 100 100 100
+box bz1 25 25 25
+box bz2 25 25 25
+box br 100 100 100
+box bzr 50 25 20
+box bt 100 100 100
 
 # 1) Zoom persistence
-vpoint p1 200 200 200
+vpoint pz 200 200 200
 
-vdisplay b1 -dispMode 1 -highMode 1 -trsfPers zoom -trsfPersPos 200 200 200
-vdisplay b2 -dispMode 1 -highMode 1 -trsfPers zoom -trsfPersPos 200 200 200
-vsetlocation b2 -25 -25 -25
+vdisplay bz1 -dispMode 1 -highMode 1 -trsfPers zoom -trsfPersPos 200 200 200
+vdisplay bz2 -dispMode 1 -highMode 1 -trsfPers zoom -trsfPersPos 200 200 200
+vsetlocation bz2 -25 -25 -25
 
 vselect 0 0
 vselect 387 77
@@ -36,8 +36,9 @@ if { [vreadpixel 387 77 rgb name] != "GRAY66" || [vreadpixel 352 96 rgb name] !=
 
 # 2) Rotate persistence
 
-vdisplay b3 -dispMode 1 -highMode 1 -trsfPers rotate -trsfPersPos -200 -200 -200
-vsetmaterial b3 PLASTIC
+vpoint pr -200 -200 -200
+vdisplay br -dispMode 1 -highMode 1 -trsfPers rotate -trsfPersPos -200 -200 -200
+vsetmaterial br PLASTIC
 vselect 0 0
 vselect 160 200
 if { [vreadpixel 160 180 rgb name] != "WHITE" } { puts "Error picking rotate persistence object" }
@@ -46,19 +47,22 @@ vselect 0 0
 vselect 130 230 190 170
 if { [vreadpixel 160 180 rgb name] != "WHITE" } { puts "Error selecting rotate persistence object" }
 
-# 3) Pan persistence
+# 3) Zoom + Rotate persistence
 
-vdisplay b4 -dispMode 1 -highMode 1 -trsfPers pan
+vpoint pzr -200 100 0
+vdisplay bzr -dispMode 1 -highMode 1 -trsfPers zoomRotate -trsfPersPos -200 100 0
+
+vsetmaterial bzr PLASTIC
 vselect 0 0
-vselect 233 188
-if { [vreadpixel 233 188 rgb name] != "GRAY66" } { puts "Error picking pan persistence object" }
+vselect 250 90
+if { [vreadpixel 250 90 rgb name] != "WHITE" } { puts "Error picking zoom-rotate persistence object" }
 vselect 0 0
-vselect 200 230 270 140
-if { [vreadpixel 233 188 rgb name] != "GRAY66" } { puts "Error selecting pan persistence object" }
+vselect 200 70 286 110
+if { [vreadpixel 250 90 rgb name] != "WHITE" } { puts "Error selecting zoom-rotate persistence object" }
 
 # 4) Trihedron persistence
 
-vdisplay b5 -dispMode 1 -highMode 1 -trsfPers trihedron -trsfPersPos -1 -1 62
+vdisplay bt -dispMode 1 -highMode 1 -trsfPers trihedron -trsfPersPos -1 -1 62
 vselect 0 0
 vselect 132 300
 if { [vreadpixel 132 300 rgb name] != "GRAY66" } { puts "Error picking trihedron persistence object" }
index 91afe263622f70b6a72402e9349c361060318f45..2b33d24e4062a11ad5e7fcfbec01c1f345c4b35f 100644 (file)
@@ -22,9 +22,9 @@ box box2d_loc 100 100 1
 box box_zoom  100 100 100
 
 vdisplay box3d     -dispMode 1 -highMode 0
-vdisplay box2d     -dispMode 1 -highMode 1 -2d
-vdisplay box2d_pos -dispMode 1 -highMode 1 -2d -trsfPersPos -1 -1
-vdisplay box2d_loc -dispMode 1 -highMode 1 -2d
+vdisplay box2d     -dispMode 1 -highMode 1 -2d center
+vdisplay box2d_pos -dispMode 1 -highMode 1 -2d bottomLeft
+vdisplay box2d_loc -dispMode 1 -highMode 1 -2d center
 vdisplay box_zoom  -dispMode 1 -highMode 0 -trsfPers zoom
 vdisplay box2d
 vsetlocation box2d_loc  100  0   0
index d8906c9cc3dbbd10e36a876c8e4854de9fe5268a..099c79a17d9a20ed3cc0ac17a3e5751ad2d3166f 100644 (file)
@@ -30,36 +30,36 @@ vzlayer add 1
 vzlayer enable 1 depthclear
 
 vtrihedron trh
-vdisplay  -noupdate trh -layer 1 -trsfPers trihedron -trsfPersPos 1 1 100
+vdisplay  -noupdate trh -layer 1 -trihedron topRight 100 100
 
 text2brep tcc "Center" -font $aLabelFont -height 30 -pos -40 0 0
-vdisplay  -noupdate tcc -2d -layer 1 -dispMode 1
+vdisplay  -noupdate tcc -2d center -layer 1 -dispMode 1
 polyline  lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
-vdisplay  -noupdate lcc -2d -layer 1
+vdisplay  -noupdate lcc -2d center -layer 1
 vsetwidth -noupdate lcc 2
 
 text2brep tbl "Bottom-Left" -font $aLabelFont -height 30 -pos 0 3 5
-vdisplay  -noupdate tbl -2d -layer 1 -trsfPersPos -1 -1 -dispMode 1
+vdisplay  -noupdate tbl -2d bottomLeft -layer 1 -dispMode 1
 polyline  lbl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
-vdisplay  -noupdate lbl -2d -layer 1 -trsfPersPos -1 -1
+vdisplay  -noupdate lbl -2d bottomLeft -layer 1
 vsetwidth -noupdate lbl 2
 
 text2brep ttl "Top-Left" -font $aLabelFont -height 30 -pos 0 -30 0
-vdisplay  -noupdate ttl -2d -layer 1 -trsfPersPos -1 1 -dispMode 1
+vdisplay  -noupdate ttl -2d topLeft -layer 1 -dispMode 1
 polyline  ltl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
-vdisplay  -noupdate ltl -2d -layer 1 -trsfPersPos -1 1
+vdisplay  -noupdate ltl -2d topLeft -layer 1
 vsetwidth -noupdate ltl 2
 
 text2brep ttr "Top-Right" -font $aLabelFont -height 30 -pos -130 -30 0
-vdisplay  -noupdate ttr -2d -layer 1 -trsfPersPos 1 1 -dispMode 1
+vdisplay  -noupdate ttr -2d topRight -layer 1 -dispMode 1
 polyline  ltr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
-vdisplay  -noupdate ltr -2d -layer 1 -trsfPersPos 1 1
+vdisplay  -noupdate ltr -2d topRight -layer 1
 vsetwidth -noupdate ltr 2
 
 text2brep tbr "Bottom-Right" -font $aLabelFont -height 30 -pos -180 3 0
-vdisplay  -noupdate tbr -2d -layer 1 -trsfPersPos 1 -1 -dispMode 1
+vdisplay  -noupdate tbr -2d bottomRight -layer 1 -dispMode 1
 polyline  lbr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
-vdisplay  -noupdate lbr -2d -layer 1 -trsfPersPos 1 -1
+vdisplay  -noupdate lbr -2d bottomRight -layer 1
 vsetwidth -noupdate lbr 2
 
 vdrawtext t2 "Label" -pos 1 0 1 -font $aLabelFont