mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
78
src/MgtTopLoc/MgtTopLoc.cdl
Executable file
78
src/MgtTopLoc/MgtTopLoc.cdl
Executable file
@@ -0,0 +1,78 @@
|
||||
-- File: MgtTopLoc.cdl
|
||||
-- Created: Wed Mar 3 18:39:33 1993
|
||||
-- Author: Remi LEQUETTE
|
||||
-- <rle@phobox>
|
||||
-- Update: Frederic MAUPAS
|
||||
-- <fma@pronox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
package MgtTopLoc
|
||||
|
||||
---Purpose: The package MgtTopLoc provides methods to store
|
||||
-- and retrieve local coordinate systems. i.e.
|
||||
-- translationg them from Persistent to Transient and
|
||||
-- vice-versa.
|
||||
--
|
||||
-- * Persistent local coordinate systems are provided
|
||||
-- by the package PTopLoc.
|
||||
--
|
||||
-- * Transient local coordinate systems are provided
|
||||
-- by the package TopLoc.
|
||||
--
|
||||
-- This package keeps track of previous translations
|
||||
-- to preserve the incremental feature of coordinate
|
||||
-- systems. i.e. once a data has been translated,
|
||||
-- translating it back will give the original data.
|
||||
--
|
||||
-- Two kinds of objects are managed :
|
||||
--
|
||||
-- * Datum3D : A Datum3D is an elementary local
|
||||
-- coordinate system handled by reference.
|
||||
--
|
||||
-- * Location : A Location is a complex local
|
||||
-- coordinate system made by linking elementary
|
||||
-- coordinate systems (Datum3D). If a Location is
|
||||
-- translated twice only the local coordinate systems
|
||||
-- will be the same. This is not a problem as the
|
||||
-- comparison of Locations is based on the comparison
|
||||
-- of local coordinate systems.
|
||||
|
||||
uses
|
||||
|
||||
TopLoc,
|
||||
PTopLoc,
|
||||
PTColStd
|
||||
|
||||
is
|
||||
Translate(D : Datum3D from TopLoc;
|
||||
M : in out TransientPersistentMap from PTColStd)
|
||||
returns Datum3D from PTopLoc;
|
||||
---Purpose: Translate a transient Datum3D to a persistant
|
||||
-- Datum3D.
|
||||
---Level: Internal
|
||||
|
||||
Translate(D : Datum3D from PTopLoc;
|
||||
M : in out PersistentTransientMap from PTColStd)
|
||||
returns Datum3D from TopLoc;
|
||||
---Purpose: Translate a persistant Datum3D to a transient
|
||||
-- Datum3D.
|
||||
---Level: Internal
|
||||
|
||||
|
||||
Translate(L : Location from TopLoc;
|
||||
M : in out TransientPersistentMap from PTColStd)
|
||||
returns Location from PTopLoc;
|
||||
---Purpose: Translate a non storable Location to a storable
|
||||
-- Location.
|
||||
---Level: Internal
|
||||
|
||||
Translate(L : Location from PTopLoc;
|
||||
M : in out PersistentTransientMap from PTColStd)
|
||||
returns Location from TopLoc;
|
||||
---Purpose: Translate a storable Location to a non storable
|
||||
-- Location.
|
||||
---Level: Internal
|
||||
|
||||
|
||||
end MgtTopLoc;
|
116
src/MgtTopLoc/MgtTopLoc.cxx
Executable file
116
src/MgtTopLoc/MgtTopLoc.cxx
Executable file
@@ -0,0 +1,116 @@
|
||||
// File: MgtTopLoc.cxx
|
||||
// Created: Wed Mar 3 19:06:33 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@phobox>
|
||||
// Update: Frederic Maupas
|
||||
|
||||
#include <MgtTopLoc.ixx>
|
||||
|
||||
// Used for testing DownCast time
|
||||
#define MgtTopLocSpeedDownCast
|
||||
|
||||
#ifdef chrono
|
||||
#include<OSD_Timer.hxx>
|
||||
extern OSD_Timer LocTimer;
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : ... from Transient to Persistent
|
||||
//=======================================================================
|
||||
|
||||
Handle(PTopLoc_Datum3D)
|
||||
MgtTopLoc::Translate(const Handle(TopLoc_Datum3D)& D,
|
||||
PTColStd_TransientPersistentMap& aMap)
|
||||
{
|
||||
|
||||
Handle(PTopLoc_Datum3D) PD;
|
||||
if (aMap.IsBound(D)) {
|
||||
#ifdef MgtTopLocSpeedDownCast
|
||||
Handle(Standard_Persistent) aPers = aMap.Find(D);
|
||||
PD = (Handle(PTopLoc_Datum3D)&) aPers;
|
||||
#else
|
||||
PD = Handle(PTopLoc_Datum3D)::DownCast(aMap.Find(D));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
PD = new PTopLoc_Datum3D(D->Transformation());
|
||||
aMap.Bind(D,PD);
|
||||
}
|
||||
|
||||
return PD;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : ... from Persistent to Transient
|
||||
//=======================================================================
|
||||
|
||||
Handle(TopLoc_Datum3D)
|
||||
MgtTopLoc::Translate(const Handle(PTopLoc_Datum3D)& D,
|
||||
PTColStd_PersistentTransientMap& aMap)
|
||||
{
|
||||
Handle(TopLoc_Datum3D) TD;
|
||||
if (aMap.IsBound(D)) {
|
||||
#ifdef MgtTopLocSpeedDownCast
|
||||
Handle(Standard_Transient) aTrans = aMap.Find(D);
|
||||
TD = (Handle(TopLoc_Datum3D)&) aTrans;
|
||||
#else
|
||||
TD = Handle(TopLoc_Datum3D)::DownCast(aMap.Find(D));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
TD = new TopLoc_Datum3D(D->Transformation());
|
||||
aMap.Bind(D, TD);
|
||||
}
|
||||
|
||||
return TD;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : .. from Transient to Persistent
|
||||
//=======================================================================
|
||||
|
||||
PTopLoc_Location
|
||||
MgtTopLoc::Translate(const TopLoc_Location& L,
|
||||
PTColStd_TransientPersistentMap& aMap)
|
||||
{
|
||||
PTopLoc_Location result;
|
||||
if (!L.IsIdentity()) {
|
||||
result = PTopLoc_Location(Translate(L.FirstDatum(), aMap),
|
||||
L.FirstPower(),
|
||||
Translate(L.NextLocation(), aMap));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : .. from Persistent to Transient
|
||||
//=======================================================================
|
||||
|
||||
TopLoc_Location
|
||||
MgtTopLoc::Translate(const PTopLoc_Location& L,
|
||||
PTColStd_PersistentTransientMap& aMap)
|
||||
{
|
||||
#ifdef chrono
|
||||
LocTimer.Start();
|
||||
#endif
|
||||
|
||||
TopLoc_Location result;
|
||||
if (!L.IsIdentity()) {
|
||||
result = Translate(L.Next(),aMap) *
|
||||
TopLoc_Location(Translate(L.Datum3D(),aMap)).Powered(L.Power());
|
||||
}
|
||||
#ifdef chrono
|
||||
LocTimer.Stop();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user