mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
63
src/PrsMgr/PrsMgr.cdl
Executable file
63
src/PrsMgr/PrsMgr.cdl
Executable file
@@ -0,0 +1,63 @@
|
||||
-- File: PrsMgr.cdl
|
||||
-- Created: Wed Jan 25 08:44:01 1995
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@pernox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
package PrsMgr
|
||||
---Purpose: The PrsMgr package provides low level services
|
||||
-- and is only to be used when you do not want to use
|
||||
-- the services provided by AIS.
|
||||
-- PrsMgr manages display through the following services:
|
||||
-- - supplying a graphic structure for the object to be presented
|
||||
-- - recalculating presentations when required, e.g. by
|
||||
-- moving the object or changing its color
|
||||
-- - defining the display mode of the object to be
|
||||
-- presented; in the case of AIS_Shape, for example,
|
||||
-- this determines whether the object is to be displayed in:
|
||||
-- - wireframe 0
|
||||
-- - shading 1.
|
||||
-- Note that each new Interactive Object must have all its display modes defined.
|
||||
|
||||
uses
|
||||
|
||||
MMgt,TCollection,
|
||||
Graphic2d,
|
||||
TopLoc,
|
||||
Prs3d,Graphic3d,
|
||||
Quantity,Geom,
|
||||
Viewer,
|
||||
TColStd,
|
||||
gp
|
||||
|
||||
is
|
||||
|
||||
enumeration KindOfPrs is KOP_2D,KOP_3D
|
||||
end KindOfPrs;
|
||||
|
||||
enumeration TypeOfPresentation3d is TOP_AllView, TOP_ProjectorDependant
|
||||
end TypeOfPresentation3d;
|
||||
---Purpose: To declare the type of presentation as follows
|
||||
-- - AllView for display involving no recalculation for
|
||||
-- new projectors (points of view)in hidden line removal mode
|
||||
-- - ProjectorDependant for display in hidden line
|
||||
-- removal mode, where every new point of view
|
||||
-- entails recalculation of the display.
|
||||
|
||||
deferred class PresentationManager;
|
||||
deferred class Presentation;
|
||||
deferred class PresentableObject;
|
||||
|
||||
class PresentationManager2d;
|
||||
class PresentationManager3d;
|
||||
|
||||
class Prs;
|
||||
class Presentation2d;
|
||||
class Presentation3d;
|
||||
|
||||
class ModedPresentation;
|
||||
class Presentations instantiates Sequence from TCollection
|
||||
(ModedPresentation from PrsMgr);
|
||||
pointer Presentation3dPointer to Presentation3d from PrsMgr;
|
||||
pointer PresentableObjectPointer to PresentableObject from PrsMgr;
|
||||
end PrsMgr;
|
32
src/PrsMgr/PrsMgr_ModedPresentation.cdl
Executable file
32
src/PrsMgr/PrsMgr_ModedPresentation.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: PrsMgr_ModedPresentation.cdl
|
||||
-- Created: Mon Jan 30 17:56:50 1995
|
||||
-- Author: Mister rmi
|
||||
-- <rmi@pernox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class ModedPresentation from PrsMgr
|
||||
|
||||
uses
|
||||
Presentation from PrsMgr
|
||||
|
||||
is
|
||||
Create
|
||||
returns ModedPresentation from PrsMgr;
|
||||
|
||||
Create(aPresentation:Presentation from PrsMgr;
|
||||
aMode: Integer from Standard)
|
||||
returns ModedPresentation from PrsMgr;
|
||||
|
||||
Presentation(me) returns Presentation from PrsMgr
|
||||
is static;
|
||||
|
||||
Mode(me) returns Integer from Standard;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myPresentation: Presentation from PrsMgr;
|
||||
myMode: Integer from Standard;
|
||||
|
||||
end ModedPresentation from PrsMgr;
|
||||
|
16
src/PrsMgr/PrsMgr_ModedPresentation.cxx
Executable file
16
src/PrsMgr/PrsMgr_ModedPresentation.cxx
Executable file
@@ -0,0 +1,16 @@
|
||||
#include <PrsMgr_ModedPresentation.ixx>
|
||||
|
||||
PrsMgr_ModedPresentation::PrsMgr_ModedPresentation() {}
|
||||
|
||||
PrsMgr_ModedPresentation::PrsMgr_ModedPresentation(const Handle(PrsMgr_Presentation)& aPresentation, const Standard_Integer aMode): myPresentation(aPresentation), myMode(aMode) {
|
||||
}
|
||||
|
||||
Handle(PrsMgr_Presentation) PrsMgr_ModedPresentation::Presentation () const {
|
||||
|
||||
return myPresentation;
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer PrsMgr_ModedPresentation::Mode () const {
|
||||
return myMode;
|
||||
}
|
256
src/PrsMgr/PrsMgr_PresentableObject.cdl
Executable file
256
src/PrsMgr/PrsMgr_PresentableObject.cdl
Executable file
@@ -0,0 +1,256 @@
|
||||
-- File: PrsMgr_PresentableObject.cdl
|
||||
-- Created: Wed Jan 25 09:23:00 1995
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- Modified by Rob (18/12/96) -> information about modes to update.
|
||||
-- Rob (04/07/97) -> TypeOfPresentation3d () Method
|
||||
-- changed to Public Method.
|
||||
-- -> Option Projector Dependant/Independant
|
||||
-- may be set at any time , not only in
|
||||
-- the constructor or the presentable.
|
||||
-- ->Insert Locations Methods...
|
||||
-- Rob (16/12/97) -> Get the list of modes to be updated
|
||||
-- -> Flags all the Prs to be updated...
|
||||
-- GG IMP020200 -> Presentations() method become protected
|
||||
-- and no more private.
|
||||
-- SAN (22/03/04) -> OCC4895 High-level interface for controlling
|
||||
-- polygon offsets: Fill() made protected virtual.
|
||||
--
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
deferred class PresentableObject from PrsMgr inherits TShared from MMgt
|
||||
|
||||
|
||||
---Purpose: A framework to supply the Graphic2d or Graphic3d
|
||||
-- structure of the object to be presented. On the first
|
||||
-- display request, this structure is created by calling the
|
||||
-- appropriate algorithm and retaining this frameworkfor
|
||||
-- further display.
|
||||
-- This abstract framework is inherited in Application
|
||||
-- Interactive Services (AIS), notably in:
|
||||
-- - AIS_InteractiveObject
|
||||
-- - AIS_ConnectedInteractive
|
||||
-- - AIS_MultipleConnectedInteractive
|
||||
-- - AIS_Shape
|
||||
-- Consequently, 3D presentation should be handled by
|
||||
-- the relevant daughter classes and their member
|
||||
-- functions in AIS. This is particularly true in the
|
||||
-- creation of new interactive objects.
|
||||
|
||||
uses
|
||||
Presentation from PrsMgr,
|
||||
Presentation from Prs3d,
|
||||
GraphicObject from Graphic2d,
|
||||
Presentations from PrsMgr,
|
||||
PresentationManager from PrsMgr,
|
||||
PresentationManager2d from PrsMgr,
|
||||
PresentationManager3d from PrsMgr,
|
||||
TypeOfPresentation3d from PrsMgr,
|
||||
DataStructureManager from Graphic3d,
|
||||
Projector from Prs3d,
|
||||
Transformation from Geom,
|
||||
ListOfInteger from TColStd,
|
||||
Location from TopLoc,
|
||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
||||
TransModeFlags from Graphic3d,
|
||||
Pnt from gp,
|
||||
CTransPersStruct from Graphic3d
|
||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
||||
|
||||
raises
|
||||
NotImplemented from Standard
|
||||
is
|
||||
|
||||
|
||||
Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
|
||||
|
||||
---Category: deferred methods.
|
||||
--
|
||||
Compute(me:mutable;
|
||||
aPresentationManager: PresentationManager2d from PrsMgr;
|
||||
aPresentation: mutable GraphicObject from Graphic2d;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Calculates the 2D view aPresentation and its
|
||||
-- updates. The latter are managed by aPresentationManager.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe display mode.
|
||||
-- Note that this syntax is not used in AIS as that
|
||||
-- package only concerns 3D display.
|
||||
|
||||
raises NotImplemented from Standard
|
||||
is virtual protected;
|
||||
|
||||
Compute(me:mutable;
|
||||
aPresentationManager: PresentationManager3d from PrsMgr;
|
||||
aPresentation: mutable Presentation from Prs3d;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Calculates the 3D view aPresentation and its
|
||||
-- updates. The latter are managed by aPresentationManager.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe display mode.
|
||||
raises NotImplemented from Standard
|
||||
is virtual protected;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
---Purpose: Calculates the 3D view aPresentation and its
|
||||
-- updates. The latter are managed by
|
||||
-- aPresentationManager. Each of the views in the
|
||||
-- viewer and every modification such as rotation, for
|
||||
-- example, entails recalculation.
|
||||
-- It must be redefined to implement hidden line removal
|
||||
-- for the object. The user never calls this method
|
||||
-- himself. This is done via the InteractiveContext object
|
||||
-- and is dependent on the point of view from which the
|
||||
-- object is displayed.
|
||||
raises NotImplemented from Standard
|
||||
is virtual protected;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is virtual protected;
|
||||
---Purpose: Calculates the 3D view aPresentation and its
|
||||
-- updates. The latter are managed by
|
||||
-- aPresentationManager. A point of view is provided
|
||||
-- by the projector aProjector, and the geometric
|
||||
-- transformation which has transformed associated
|
||||
-- presentable objects is specified by aTrsf.
|
||||
-- This function is to be used in case where a hidden
|
||||
-- line removal display cannot be calculated
|
||||
-- automatically. This occurs when associated
|
||||
-- presentable objects have been transformed
|
||||
-- geometrically, but not translated.
|
||||
-- Warning
|
||||
-- The transformation aTrsf must be applied to the
|
||||
-- object before computation.
|
||||
|
||||
Update(me: mutable;AllModes: Boolean=Standard_False)
|
||||
---Purpose: recomputes all presentations of the object.
|
||||
---Level: Public
|
||||
is protected;
|
||||
|
||||
Update(me: mutable; aMode: Integer from Standard; ClearOther: Boolean from Standard)
|
||||
---Purpose: Recomputes the presentation in the given mode.
|
||||
-- If ClearOther is true, other presentation will be cleared.
|
||||
is protected;
|
||||
|
||||
Fill(me: mutable;
|
||||
aPresentationManager: PresentationManager from PrsMgr;
|
||||
aPresentation: mutable Presentation from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
-- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
|
||||
is virtual protected;
|
||||
--- Purpose: High-level interface for controlling polygon offsets
|
||||
|
||||
-- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
|
||||
|
||||
|
||||
-- Presentations(me: mutable) returns Presentations from PrsMgr
|
||||
-- is static private;
|
||||
|
||||
Presentations(me : mutable) returns Presentations from PrsMgr
|
||||
is static protected;
|
||||
---C++: return &
|
||||
|
||||
TypeOfPresentation3d(me) returns TypeOfPresentation3d from PrsMgr
|
||||
is static;
|
||||
---Purpose: Returns information on whether the object accepts display in HLR mode or not.
|
||||
|
||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
||||
SetTransformPersistence( me : mutable;
|
||||
aFlag : TransModeFlags from Graphic3d;
|
||||
APoint : Pnt from gp )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: 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:
|
||||
-- - 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 persistence mode selected APoint 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).
|
||||
---Category: Graphic attributes management
|
||||
|
||||
SetTransformPersistence( me : mutable;
|
||||
aFlag : TransModeFlags from Graphic3d )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Calls previous method with point (0,0,0)
|
||||
---Category: Graphic attributes management
|
||||
|
||||
|
||||
GetTransformPersistenceMode( me ) returns TransModeFlags from Graphic3d is static;
|
||||
|
||||
---Level: Public
|
||||
---Purpose: Gets Transform Persistence Mode for this object
|
||||
---Category: Graphic attributes management
|
||||
|
||||
GetTransformPersistencePoint( me ) returns Pnt from gp is static;
|
||||
|
||||
---Level: Public
|
||||
---Purpose: Gets point of transform persistence for this object
|
||||
---Category: Graphic attributes management
|
||||
|
||||
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
|
||||
|
||||
SetTypeOfPresentation(me:mutable; aType: TypeOfPresentation3d from PrsMgr);
|
||||
|
||||
SetToUpdate (me:mutable;aMode:Integer from Standard);
|
||||
---Purpose: flags the Prs of mode <AMode> to be Updated.
|
||||
-- the Update will be done when needed.
|
||||
|
||||
SetToUpdate(me:mutable);
|
||||
---Purpose: flags all the Presentations to be Updated.
|
||||
|
||||
ToBeUpdated(me;ListOfMode : out ListOfInteger from TColStd);
|
||||
---Purpose: gives the list of modes which are flagged "to be updated".
|
||||
|
||||
SetLocation(me:mutable;aLoc:Location from TopLoc) is virtual;
|
||||
|
||||
HasLocation(me) returns Boolean from Standard;
|
||||
|
||||
Location(me) returns any Location from TopLoc;
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
ResetLocation(me:mutable) is virtual;
|
||||
|
||||
UpdateLocation(me:mutable) is virtual;
|
||||
|
||||
UpdateLocation(me:mutable;P : mutable Presentation from Prs3d) is virtual;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
myPresentations: Presentations from PrsMgr is protected;
|
||||
myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
|
||||
myLocation : Location from TopLoc is protected;
|
||||
--myTransformPersistence : TransModeFlags from Graphic3d;
|
||||
myTransformPersistence : CTransPersStruct from Graphic3d;
|
||||
|
||||
friends
|
||||
class PresentationManager from PrsMgr,
|
||||
Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d),
|
||||
Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;
|
||||
aGivenStruct : Structure from Graphic3d),
|
||||
Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;
|
||||
TheTrsf : Transformation from Geom),
|
||||
Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;
|
||||
TheTrsf : Transformation from Geom;
|
||||
aGivenStruct : Structure from Graphic3d)
|
||||
end PresentableObject from PrsMgr;
|
337
src/PrsMgr/PrsMgr_PresentableObject.cxx
Executable file
337
src/PrsMgr/PrsMgr_PresentableObject.cxx
Executable file
@@ -0,0 +1,337 @@
|
||||
// File: PrsMgr_PresentableObject.cxx
|
||||
// Created: Tue Dec 16 10:36:49 1997
|
||||
// Author: Jean Louis Frenkel
|
||||
// Modified by Rob
|
||||
// 16-dec-1997 : Update Flag for Presentations.
|
||||
// <rob@robox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <PrsMgr_PresentableObject.ixx>
|
||||
#include <PrsMgr_Presentation.hxx>
|
||||
#include <PrsMgr_Presentation2d.hxx>
|
||||
#include <PrsMgr_Presentation3d.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <Graphic3d_TypeOfStructure.hxx>
|
||||
#include <Geom_Transformation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : PrsMgr_PresentableObject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
PrsMgr_PresentableObject::PrsMgr_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
|
||||
:myPresentations(),myTypeOfPresentation3d(aTypeOfPresentation3d)
|
||||
{
|
||||
myTransformPersistence.Flag = 0;
|
||||
myTransformPersistence.Point.x = 0.0;
|
||||
myTransformPersistence.Point.y = 0.0;
|
||||
myTransformPersistence.Point.z = 0.0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Fill
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::Fill(const Handle(PrsMgr_PresentationManager)& aPresentationManager,
|
||||
const Handle(PrsMgr_Presentation)& aPresentation,
|
||||
const Standard_Integer aMode) {
|
||||
if (aPresentation->DynamicType() == STANDARD_TYPE(PrsMgr_Presentation2d)) {
|
||||
Compute(((Handle(PrsMgr_PresentationManager2d)&)aPresentationManager),((Handle(PrsMgr_Presentation2d)&)aPresentation)->Presentation(),aMode);
|
||||
}
|
||||
else if (aPresentation->DynamicType() == STANDARD_TYPE(PrsMgr_Presentation3d)) {
|
||||
Compute(((Handle(PrsMgr_PresentationManager3d)&)aPresentationManager),((Handle(PrsMgr_Presentation3d)&)aPresentation)->Presentation(),aMode);
|
||||
UpdateLocation(((Handle(PrsMgr_Presentation3d)&)aPresentation)->Presentation());
|
||||
Handle(Graphic3d_Structure) aStruct = Handle(Graphic3d_Structure)::DownCast( ((Handle(PrsMgr_Presentation3d)&)aPresentation)->Presentation() );
|
||||
if ( !aStruct.IsNull() ) {
|
||||
aStruct->SetTransformPersistence( GetTransformPersistenceMode(), GetTransformPersistencePoint() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager2d)& /*aPresentationManager*/,
|
||||
const Handle(Graphic2d_GraphicObject)& /*aPresentation*/,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
Standard_NotImplemented::Raise("cannot compute in a 2d visualizer");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& /*aPresentation*/,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
Standard_NotImplemented::Raise("cannot compute in a 3d visualizer");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::Compute(const Handle(Prs3d_Projector)& /*aProjector*/,
|
||||
const Handle(Prs3d_Presentation)& /*aPresentation*/)
|
||||
{
|
||||
Standard_NotImplemented::Raise("cannot compute under a specific projector");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::Compute(const Handle(Prs3d_Projector)& /* aProjector*/,
|
||||
const Handle(Geom_Transformation)& /*aTrsf*/,
|
||||
const Handle(Prs3d_Presentation)& /*aPresentation*/)
|
||||
{
|
||||
Standard_NotImplemented::Raise("cannot compute under a specific projector");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Update
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::Update (const Standard_Boolean AllModes) {
|
||||
Standard_Integer l = myPresentations.Length();
|
||||
Handle(PrsMgr_PresentationManager) PM;
|
||||
for (Standard_Integer i=1; i <= l; i++) {
|
||||
PM = myPresentations(i).Presentation()->PresentationManager();
|
||||
if(AllModes)
|
||||
PM->Update(this,myPresentations(i).Mode());
|
||||
else{
|
||||
if(PM->IsDisplayed(this,myPresentations(i).Mode()) ||
|
||||
PM->IsHighlighted(this,myPresentations(i).Mode())){
|
||||
PM->Update(this,myPresentations(i).Mode());
|
||||
}
|
||||
else
|
||||
SetToUpdate(myPresentations(i).Mode());
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Update
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentableObject::Update (const Standard_Integer aMode, const Standard_Boolean ClearOther) {
|
||||
Standard_Integer l = myPresentations.Length();
|
||||
for (Standard_Integer i=1; i <= l; i++) {
|
||||
if( myPresentations(i).Mode() == aMode){
|
||||
Handle(PrsMgr_PresentationManager) PM=
|
||||
myPresentations(i).Presentation()->PresentationManager();
|
||||
|
||||
if(PM->IsDisplayed(this,aMode) ||
|
||||
PM->IsHighlighted(this,aMode)){
|
||||
PM->Update(this,aMode);
|
||||
myPresentations(i).Presentation()->SetUpdateStatus(Standard_False);
|
||||
|
||||
}
|
||||
else
|
||||
SetToUpdate(myPresentations(i).Mode());
|
||||
}
|
||||
|
||||
}
|
||||
if(ClearOther) {
|
||||
PrsMgr_Presentations save;
|
||||
save = myPresentations;
|
||||
myPresentations.Clear();
|
||||
for (Standard_Integer i=1; i <= l; i++) {
|
||||
if( save(i).Mode() == aMode) myPresentations.Append(save(i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Presentations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
PrsMgr_Presentations& PrsMgr_PresentableObject::Presentations() {
|
||||
return myPresentations;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean PrsMgr_PresentableObject::HasLocation() const
|
||||
{
|
||||
return !Location().IsIdentity();}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetToUpdate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentableObject::SetToUpdate(const Standard_Integer aMode)
|
||||
{
|
||||
for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
|
||||
if(myPresentations(IP).Mode()==aMode)
|
||||
myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True);
|
||||
}
|
||||
}
|
||||
void PrsMgr_PresentableObject::SetToUpdate()
|
||||
{
|
||||
for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
|
||||
myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ToBeUpdated
|
||||
//purpose : gets the list of modes to be updated
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::ToBeUpdated(TColStd_ListOfInteger& OutList) const
|
||||
{
|
||||
OutList.Clear();
|
||||
// on dimensionne les buckets a la taille de la seq.
|
||||
static TColStd_MapOfInteger MI(myPresentations.Length());
|
||||
|
||||
for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
|
||||
const PrsMgr_ModedPresentation& MP = myPresentations(IP);
|
||||
if(MP.Presentation()->MustBeUpdated())
|
||||
if(!MI.Contains(MP.Mode())){
|
||||
OutList.Append(MP.Mode());
|
||||
MI.Add(MP.Mode());
|
||||
}
|
||||
}
|
||||
MI.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTypeOfPresentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentableObject::SetTypeOfPresentation(const PrsMgr_TypeOfPresentation3d aType)
|
||||
{
|
||||
myTypeOfPresentation3d = aType;
|
||||
|
||||
for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
|
||||
const Handle(PrsMgr_Presentation)& P = myPresentations(IP).Presentation();
|
||||
if(P->KindOfPresentation()==PrsMgr_KOP_3D){
|
||||
Graphic3d_TypeOfStructure Typ =
|
||||
(myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant)?
|
||||
Graphic3d_TOS_COMPUTED : Graphic3d_TOS_ALL;
|
||||
(*(Handle(PrsMgr_Presentation3d)*)&P)->Presentation()->SetVisual(Typ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLocation
|
||||
//purpose : WARNING : use with only 3D objects...
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::SetLocation(const TopLoc_Location& aLoc)
|
||||
{
|
||||
if(aLoc.IsIdentity()) return;
|
||||
myLocation = aLoc;
|
||||
UpdateLocation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReSetLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::ResetLocation()
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Geom_Transformation) G = new Geom_Transformation(aLoc.Transformation());
|
||||
|
||||
for(Standard_Integer i=1;i<=myPresentations.Length();i++){
|
||||
const Handle(PrsMgr_Presentation)& P = myPresentations(i).Presentation();
|
||||
if(P->KindOfPresentation()==PrsMgr_KOP_3D){
|
||||
(*((Handle(PrsMgr_Presentation3d)*)&P))->Transform(G);
|
||||
}
|
||||
}
|
||||
myLocation = aLoc;
|
||||
}
|
||||
|
||||
void PrsMgr_PresentableObject::UpdateLocation()
|
||||
{
|
||||
if(!HasLocation()) return;
|
||||
Handle(Geom_Transformation) G = new Geom_Transformation(Location().Transformation());
|
||||
if(G->Trsf().Form()==gp_Identity) return;
|
||||
for (Standard_Integer i=1;i<=myPresentations.Length();i++){
|
||||
const Handle(PrsMgr_Presentation)& P = myPresentations(i).Presentation();
|
||||
if(P->KindOfPresentation()==PrsMgr_KOP_3D){
|
||||
(*((Handle(PrsMgr_Presentation3d)*)&P))->Transform(G);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentableObject::UpdateLocation(const Handle(Prs3d_Presentation)& P)
|
||||
{
|
||||
if(myLocation.IsIdentity()) return;
|
||||
Handle(Geom_Transformation) G = new Geom_Transformation(Location().Transformation());
|
||||
P->Transform(G);
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformPersistence
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::SetTransformPersistence( const Graphic3d_TransModeFlags& TheFlag,
|
||||
const gp_Pnt& ThePoint )
|
||||
{
|
||||
myTransformPersistence.Flag = TheFlag;
|
||||
myTransformPersistence.Point.x = ThePoint.X();
|
||||
myTransformPersistence.Point.y = ThePoint.Y();
|
||||
myTransformPersistence.Point.z = ThePoint.Z();
|
||||
|
||||
Handle(Graphic3d_Structure) aStruct;
|
||||
for( Standard_Integer i = 1, n = myPresentations.Length(); i <= n; i++ )
|
||||
{
|
||||
Handle(PrsMgr_Presentation3d) aPrs3d =
|
||||
Handle(PrsMgr_Presentation3d)::DownCast( myPresentations(i).Presentation() );
|
||||
if ( !aPrs3d.IsNull() )
|
||||
{
|
||||
aStruct = Handle(Graphic3d_Structure)::DownCast( aPrs3d->Presentation() );
|
||||
if( !aStruct.IsNull() )
|
||||
aStruct->SetTransformPersistence( TheFlag, ThePoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformPersistence
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentableObject::SetTransformPersistence(
|
||||
const Graphic3d_TransModeFlags& TheFlag )
|
||||
{
|
||||
SetTransformPersistence( TheFlag, gp_Pnt(0,0,0) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTransformPersistence
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Graphic3d_TransModeFlags PrsMgr_PresentableObject::GetTransformPersistenceMode() const
|
||||
{
|
||||
return myTransformPersistence.Flag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTransformPersistence
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt PrsMgr_PresentableObject::GetTransformPersistencePoint() const
|
||||
{
|
||||
return gp_Pnt( myTransformPersistence.Point.x, myTransformPersistence.Point.y, myTransformPersistence.Point.z );
|
||||
}
|
11
src/PrsMgr/PrsMgr_PresentableObject.lxx
Executable file
11
src/PrsMgr/PrsMgr_PresentableObject.lxx
Executable file
@@ -0,0 +1,11 @@
|
||||
// File: PrsMgr_PresentableObject.lxx
|
||||
// Created: Fri Jul 4 15:18:54 1997
|
||||
// Author: Robert COUBLANC
|
||||
// <rob@robox.paris1.matra-dtv.fr>
|
||||
|
||||
inline PrsMgr_TypeOfPresentation3d PrsMgr_PresentableObject::TypeOfPresentation3d() const
|
||||
{return myTypeOfPresentation3d;}
|
||||
|
||||
|
||||
inline const TopLoc_Location& PrsMgr_PresentableObject::Location() const
|
||||
{return myLocation;}
|
81
src/PrsMgr/PrsMgr_Presentation.cdl
Executable file
81
src/PrsMgr/PrsMgr_Presentation.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: PrsMgr_Presentation.cdl
|
||||
-- Created: Wed Jan 25 08:49:40 1995
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@pernox>
|
||||
-- Modified by Rob : 20-feb-1997
|
||||
-- Modified by Rob : 16-dec-1997 : kind of presentation
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
deferred class Presentation from PrsMgr
|
||||
inherits TShared from MMgt
|
||||
|
||||
uses
|
||||
|
||||
PresentationManager from PrsMgr,
|
||||
KindOfPrs from PrsMgr
|
||||
|
||||
is
|
||||
|
||||
Initialize(aPresentationManager: PresentationManager from PrsMgr)
|
||||
is protected;
|
||||
|
||||
KindOfPresentation(me) returns KindOfPrs from PrsMgr is deferred;
|
||||
---Purpose: 2D or 3D
|
||||
|
||||
Display(me: mutable) is deferred private;
|
||||
|
||||
Erase(me) is deferred private;
|
||||
|
||||
Highlight(me: mutable) is deferred private;
|
||||
|
||||
Unhighlight (me) is deferred private;
|
||||
|
||||
IsHighlighted(me) returns Boolean from Standard
|
||||
is deferred private;
|
||||
|
||||
IsDisplayed(me) returns Boolean from Standard
|
||||
is deferred private;
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destructor
|
||||
---C++: alias ~
|
||||
|
||||
DisplayPriority(me) returns Integer from Standard
|
||||
is deferred private;
|
||||
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is deferred private;
|
||||
|
||||
Clear(me: mutable)
|
||||
is deferred private;
|
||||
|
||||
---Category: Inquire Methods
|
||||
--
|
||||
PresentationManager(me) returns mutable PresentationManager
|
||||
---Purpose: returns the PresentationManager in which the
|
||||
-- presentation has been created.
|
||||
is static;
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
|
||||
---Category: Internal Methods
|
||||
|
||||
SetUpdateStatus(me:mutable; aStat : Boolean from Standard);
|
||||
---C++: inline
|
||||
|
||||
MustBeUpdated(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myPresentationManager: PresentationManager from PrsMgr is protected;
|
||||
myMustBeUpdated : Boolean from Standard is protected;
|
||||
|
||||
friends
|
||||
class PresentationManager from PrsMgr
|
||||
|
||||
end Presentation from PrsMgr;
|
8
src/PrsMgr/PrsMgr_Presentation.cxx
Executable file
8
src/PrsMgr/PrsMgr_Presentation.cxx
Executable file
@@ -0,0 +1,8 @@
|
||||
#include <PrsMgr_Presentation.ixx>
|
||||
|
||||
PrsMgr_Presentation::PrsMgr_Presentation
|
||||
(const Handle(PrsMgr_PresentationManager)& aPresentationManager)
|
||||
:myPresentationManager(aPresentationManager),myMustBeUpdated(Standard_False) {}
|
||||
|
||||
void PrsMgr_Presentation::Destroy () {
|
||||
}
|
15
src/PrsMgr/PrsMgr_Presentation.lxx
Executable file
15
src/PrsMgr/PrsMgr_Presentation.lxx
Executable file
@@ -0,0 +1,15 @@
|
||||
// File: PrsMgr_Presentation.lxx
|
||||
// Created: Thu Feb 20 15:08:40 1997
|
||||
// Author: Robert COUBLANC
|
||||
// <rob@robox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
|
||||
inline void PrsMgr_Presentation::SetUpdateStatus(const Standard_Boolean TheUpdateStatus)
|
||||
{myMustBeUpdated = TheUpdateStatus ;}
|
||||
|
||||
inline Standard_Boolean PrsMgr_Presentation::MustBeUpdated() const
|
||||
{return myMustBeUpdated;}
|
||||
|
||||
inline const Handle(PrsMgr_PresentationManager)& PrsMgr_Presentation::PresentationManager() const
|
||||
{return myPresentationManager;}
|
106
src/PrsMgr/PrsMgr_Presentation2d.cdl
Executable file
106
src/PrsMgr/PrsMgr_Presentation2d.cdl
Executable file
@@ -0,0 +1,106 @@
|
||||
-- File: PrsMgr_Presentation2d.cdl
|
||||
-- Created: Thu Oct 21 13:09:32 1993
|
||||
-- Author: Jean-Louis FRENKEL
|
||||
-- <jlf@stylox>
|
||||
--Modified by rob Dec-16-97
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Presentation2d from PrsMgr inherits Presentation from PrsMgr
|
||||
|
||||
---Purpose: A framework to manage 2D displays, graphic entities
|
||||
-- and their updates. Plotters, Highlights, Minima
|
||||
-- maxima, immediate display.
|
||||
|
||||
uses
|
||||
GraphicObject from Graphic2d,
|
||||
PresentationManager2d from PrsMgr,
|
||||
KindOfPrs from PrsMgr
|
||||
is
|
||||
Create(aPresentationManager2d: PresentationManager2d from PrsMgr)
|
||||
returns mutable Presentation2d from PrsMgr
|
||||
is private;
|
||||
---Purpose: Creates a framework to manage displays and graphic
|
||||
-- entities with the 2D view aStructureManager.
|
||||
|
||||
KindOfPresentation(me) returns KindOfPrs from PrsMgr is redefined static;
|
||||
|
||||
Destroy(me: mutable) is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Destructor.
|
||||
---C++: alias ~
|
||||
|
||||
Display(me: mutable) is redefined static private;
|
||||
|
||||
Erase(me) is redefined static private;
|
||||
|
||||
Highlight(me: mutable) is redefined static private;
|
||||
|
||||
Unhighlight (me) is redefined static private;
|
||||
|
||||
IsDisplayed(me) returns Boolean from Standard
|
||||
is redefined static private;
|
||||
|
||||
IsHighlighted(me) returns Boolean from Standard
|
||||
is redefined static private;
|
||||
|
||||
DisplayPriority(me) returns Integer from Standard
|
||||
is redefined static private;
|
||||
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is redefined static private;
|
||||
|
||||
|
||||
Clear(me:mutable)
|
||||
---Purpose: removes the whole content of the presentation.
|
||||
|
||||
is redefined;
|
||||
|
||||
Highlight(me; anIndex: Integer from Standard)
|
||||
is static private;
|
||||
|
||||
---Category: 2d specialized methods.
|
||||
|
||||
EnablePlot (me)
|
||||
---Purpose: Allows the drawing on a plotter of the graphic object
|
||||
-- aPresentableObject with the display mode aMode.
|
||||
is static private;
|
||||
|
||||
DisablePlot (me)
|
||||
---Purpose: Forbids the drawing on a plotter of the graphic object
|
||||
-- aPresentableObject with the display mode aMode.
|
||||
is static private;
|
||||
|
||||
IsPlottable (me)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Returns true if the graphic object aPresentableObject
|
||||
-- with the display mode aMode can be plotted.
|
||||
is static private;
|
||||
|
||||
SetOffset (me: mutable;anOffset: Integer from Standard)
|
||||
is static ;
|
||||
---Purpose: Specifies an Offset applied to the original color
|
||||
-- index of all primitives in the graphic object <me>.
|
||||
-- Warning: To reset the real color of the primitives
|
||||
-- you have to call this method with <anOffset> = 0.
|
||||
|
||||
Offset (me) returns Integer from Standard
|
||||
is static ;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Offset applied to the original color
|
||||
-- index of all primitives in the graphic object <me>.
|
||||
---Category: Methods to manage the highlight
|
||||
|
||||
Presentation (me) returns mutable GraphicObject from Graphic2d
|
||||
is static ;
|
||||
|
||||
fields
|
||||
|
||||
myStructure: GraphicObject from Graphic2d;
|
||||
|
||||
friends
|
||||
class PresentationManager2d from PrsMgr,
|
||||
class PresentableObject from PrsMgr
|
||||
|
||||
end Presentation2d from PrsMgr;
|
80
src/PrsMgr/PrsMgr_Presentation2d.cxx
Executable file
80
src/PrsMgr/PrsMgr_Presentation2d.cxx
Executable file
@@ -0,0 +1,80 @@
|
||||
// File: PrsMgr_Presentation2d.cxx
|
||||
// Created: Thu Oct 21 13:11:19 1993
|
||||
// Author: Jean-Louis FRENKEL
|
||||
// Modified by rob 09-oct-96
|
||||
// <jlf@stylox>
|
||||
|
||||
|
||||
#include <PrsMgr_Presentation2d.ixx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
|
||||
PrsMgr_Presentation2d::PrsMgr_Presentation2d(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager)
|
||||
:PrsMgr_Presentation(aPresentationManager), myStructure(new Graphic2d_GraphicObject(aPresentationManager->StructureManager())) {}
|
||||
|
||||
PrsMgr_KindOfPrs PrsMgr_Presentation2d::KindOfPresentation() const
|
||||
{return PrsMgr_KOP_2D;}
|
||||
|
||||
void PrsMgr_Presentation2d::Display (){
|
||||
myStructure->Display();}
|
||||
|
||||
void PrsMgr_Presentation2d::Erase () const {
|
||||
myStructure->Erase();}
|
||||
|
||||
void PrsMgr_Presentation2d::Highlight () {
|
||||
myStructure->Highlight();}
|
||||
|
||||
void PrsMgr_Presentation2d::Unhighlight () const {
|
||||
myStructure->Unhighlight();}
|
||||
|
||||
void PrsMgr_Presentation2d::Highlight(const Standard_Integer anIndex) const{
|
||||
myStructure->Highlight(anIndex);}
|
||||
|
||||
Standard_Boolean PrsMgr_Presentation2d::IsDisplayed () const {
|
||||
return myStructure->IsDisplayed();
|
||||
}
|
||||
|
||||
Standard_Boolean PrsMgr_Presentation2d::IsHighlighted () const {
|
||||
return myStructure->IsHighlighted();
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer PrsMgr_Presentation2d::DisplayPriority() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation2d::SetDisplayPriority(const Standard_Integer TheNewPrior)
|
||||
{
|
||||
// peut etre Raise ?
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PrsMgr_Presentation2d::EnablePlot () const {
|
||||
myStructure->EnablePlot();
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation2d::DisablePlot () const {
|
||||
myStructure->DisablePlot();
|
||||
}
|
||||
|
||||
Standard_Boolean PrsMgr_Presentation2d::IsPlottable () const {
|
||||
return myStructure->IsPlottable();
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation2d::Clear () {
|
||||
myStructure->RemovePrimitives();
|
||||
}
|
||||
|
||||
Handle(Graphic2d_GraphicObject) PrsMgr_Presentation2d::Presentation() const {
|
||||
return myStructure;
|
||||
}
|
||||
void PrsMgr_Presentation2d::SetOffset(const Standard_Integer anOffset) {
|
||||
myStructure->SetOffSet(anOffset);}
|
||||
|
||||
Standard_Integer PrsMgr_Presentation2d::Offset () const {
|
||||
return myStructure->OffSet();}
|
||||
|
||||
|
||||
void PrsMgr_Presentation2d::Destroy () {
|
||||
}
|
141
src/PrsMgr/PrsMgr_Presentation3d.cdl
Executable file
141
src/PrsMgr/PrsMgr_Presentation3d.cdl
Executable file
@@ -0,0 +1,141 @@
|
||||
-- File: P3rsMgr_Presentation3d.cdl
|
||||
-- Created: Thu Oct 21 13:09:32 1993
|
||||
-- Author: Jean-Louis FRENKEL
|
||||
-- <jlf@stylox>
|
||||
-- Modified by rob 09-oct-96
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class Presentation3d from PrsMgr inherits Presentation from PrsMgr
|
||||
|
||||
uses
|
||||
PresentationManager3d from PrsMgr,
|
||||
Presentation from Prs3d,
|
||||
NameOfColor from Quantity,
|
||||
Transformation from Geom,
|
||||
Length from Quantity,
|
||||
ShadingAspect from Prs3d,
|
||||
TypeOfPresentation3d from PrsMgr,
|
||||
DataStructureManager from Graphic3d,
|
||||
Structure from Graphic3d,
|
||||
PresentableObjectPointer from PrsMgr,PresentableObject from PrsMgr,
|
||||
Prs from PrsMgr,
|
||||
Projector from Prs3d,
|
||||
KindOfPrs from PrsMgr
|
||||
is
|
||||
Create(aPresentationManager: PresentationManager3d from PrsMgr;
|
||||
aPresentableObject: PresentableObject from PrsMgr)
|
||||
returns mutable Presentation3d from PrsMgr
|
||||
is private;
|
||||
|
||||
KindOfPresentation(me) returns KindOfPrs from PrsMgr is redefined static;
|
||||
|
||||
Destroy(me: mutable) is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Destructor
|
||||
---C++: alias ~
|
||||
|
||||
Display(me: mutable)
|
||||
is redefined static private;
|
||||
|
||||
Erase(me) is redefined static private;
|
||||
|
||||
Highlight(me: mutable) is redefined static private;
|
||||
|
||||
Unhighlight (me) is redefined static private;
|
||||
|
||||
IsDisplayed (me) returns Boolean from Standard
|
||||
is redefined static private;
|
||||
|
||||
IsHighlighted (me) returns Boolean from Standard
|
||||
is redefined static private;
|
||||
|
||||
|
||||
DisplayPriority(me) returns Integer from Standard
|
||||
is redefined static private;
|
||||
|
||||
SetDisplayPriority(me:mutable;aNewPrior:Integer from Standard)
|
||||
is redefined static private;
|
||||
|
||||
Clear(me:mutable)
|
||||
---Purpose: removes the whole content of the presentation.
|
||||
-- Does not remove the other connected presentations.
|
||||
--
|
||||
is redefined static private;
|
||||
|
||||
|
||||
Color(me:mutable; aColor: NameOfColor from Quantity)
|
||||
is static private;
|
||||
|
||||
BoundBox(me)
|
||||
is static private;
|
||||
|
||||
---Category: references to other presentation.
|
||||
|
||||
Connect(me; anOtherPresentation: Presentation3d from PrsMgr)
|
||||
is static private;
|
||||
|
||||
---Category: Transformation methods.
|
||||
|
||||
Transform (me; aTransformation: Transformation from Geom)
|
||||
is static private;
|
||||
|
||||
Place (me; X,Y,Z: Length from Quantity)
|
||||
is static private;
|
||||
|
||||
Multiply (me; aTransformation: Transformation from Geom)
|
||||
is static private;
|
||||
|
||||
Move (me; X,Y,Z: Length from Quantity)
|
||||
is static private;
|
||||
|
||||
---Category: Global Aspect methods
|
||||
|
||||
SetShadingAspect(me;
|
||||
aShadingAspect: ShadingAspect from Prs3d)
|
||||
is static private;
|
||||
|
||||
Presentation (me) returns mutable Presentation from Prs3d
|
||||
is static;
|
||||
|
||||
|
||||
---Category: Computed Structures
|
||||
|
||||
Compute(me : mutable; aProjector: DataStructureManager from Graphic3d)
|
||||
returns Structure from Graphic3d
|
||||
is static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : DataStructureManager from Graphic3d;
|
||||
TheTrsf : Transformation from Geom)
|
||||
returns Structure from Graphic3d
|
||||
is static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : DataStructureManager from Graphic3d;
|
||||
aGivenStruct : Structure from Graphic3d)
|
||||
is static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : DataStructureManager from Graphic3d;
|
||||
TheTrsf : Transformation from Geom;
|
||||
aGivenStruct : Structure from Graphic3d)
|
||||
is static private;
|
||||
|
||||
|
||||
|
||||
Projector(myclass; aProjector: DataStructureManager from Graphic3d)
|
||||
returns Projector from Prs3d
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
myStructure: Prs from PrsMgr;
|
||||
myDisplayReason: Boolean from Standard;
|
||||
myPresentableObject: PresentableObjectPointer from PrsMgr;
|
||||
friends
|
||||
class PresentationManager3d from PrsMgr,
|
||||
class PresentableObject from PrsMgr,
|
||||
class Prs from PrsMgr
|
||||
end Presentation3d from PrsMgr;
|
309
src/PrsMgr/PrsMgr_Presentation3d.cxx
Executable file
309
src/PrsMgr/PrsMgr_Presentation3d.cxx
Executable file
@@ -0,0 +1,309 @@
|
||||
// File: PrsMgr_Presentation3d.cxx
|
||||
// Created: Thu Oct 21 13:11:19 1993
|
||||
// Author: Jean-Louis FRENKEL
|
||||
// Modified by rob 09-oct-96
|
||||
// <jlf@stylox>
|
||||
// rob 18-may-98 : Pb de la Trsf dont le type n'est pas calcule en fonction
|
||||
// des coefficients.
|
||||
|
||||
#define IMP040200 //GG Recompute HLR after transformation
|
||||
// in all the case.
|
||||
|
||||
#include <PrsMgr_Presentation3d.ixx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <PrsMgr_Prs.hxx>
|
||||
#include <Visual3d_View.hxx>
|
||||
#include <Visual3d_ViewOrientation.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
PrsMgr_Presentation3d::PrsMgr_Presentation3d (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject)
|
||||
: PrsMgr_Presentation(aPresentationManager),
|
||||
myDisplayReason(Standard_False),
|
||||
myPresentableObject (aPresentableObject.operator->())
|
||||
{
|
||||
myStructure = new PrsMgr_Prs(aPresentationManager->StructureManager(),
|
||||
this, aPresentableObject->TypeOfPresentation3d());
|
||||
myStructure->SetOwner(myPresentableObject);
|
||||
}
|
||||
|
||||
PrsMgr_KindOfPrs PrsMgr_Presentation3d::KindOfPresentation() const
|
||||
{return PrsMgr_KOP_3D;}
|
||||
|
||||
|
||||
void PrsMgr_Presentation3d::Display () {
|
||||
myStructure->Display();
|
||||
myDisplayReason = Standard_False;
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Erase () const {
|
||||
myStructure->Erase();}
|
||||
|
||||
void PrsMgr_Presentation3d::Highlight () {
|
||||
if(!myStructure->IsDisplayed()) {
|
||||
myStructure->Display();
|
||||
myDisplayReason = Standard_True;
|
||||
}
|
||||
myStructure->Highlight();}
|
||||
|
||||
void PrsMgr_Presentation3d::Unhighlight () const {
|
||||
myStructure->UnHighlight();
|
||||
if(myDisplayReason) myStructure->Erase();
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Clear() {
|
||||
// This modification remove the contain of the structure:
|
||||
// Consequence:
|
||||
// 1. The memory zone of the group is reused
|
||||
// 2. The speed for animation is constant
|
||||
myStructure->Clear(Standard_True);
|
||||
// myStructure->Clear(Standard_False);
|
||||
|
||||
myStructure->RemoveAll();
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Color(const Quantity_NameOfColor aColor){
|
||||
Standard_Boolean ImmMode = myPresentationManager->IsImmediateModeOn();
|
||||
if(!ImmMode){
|
||||
if(!myStructure->IsDisplayed()) {
|
||||
myStructure->Display();
|
||||
myDisplayReason = Standard_True;
|
||||
}
|
||||
}
|
||||
myStructure->Color(aColor);
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::BoundBox() const {
|
||||
myStructure->BoundBox();
|
||||
}
|
||||
|
||||
Standard_Boolean PrsMgr_Presentation3d::IsDisplayed () const {
|
||||
return myStructure->IsDisplayed() && !myDisplayReason;
|
||||
}
|
||||
|
||||
Standard_Boolean PrsMgr_Presentation3d::IsHighlighted () const {
|
||||
return myStructure->IsHighlighted();
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer PrsMgr_Presentation3d::DisplayPriority() const {
|
||||
return myStructure->DisplayPriority();
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::SetDisplayPriority(const Standard_Integer TheNewPrior)
|
||||
{
|
||||
myStructure->SetDisplayPriority(TheNewPrior);
|
||||
}
|
||||
|
||||
Handle(Prs3d_Presentation) PrsMgr_Presentation3d::Presentation() const {
|
||||
return myStructure;
|
||||
}
|
||||
void PrsMgr_Presentation3d::Connect(const Handle(PrsMgr_Presentation3d)& anOtherPresentation) const {
|
||||
myStructure->Connect(anOtherPresentation->Presentation());
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Transform (const Handle(Geom_Transformation)& aTransformation) const {
|
||||
myStructure->Transform(aTransformation);
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Place (const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
const Quantity_Length Z) const {
|
||||
myStructure->Place(X,Y,Z);
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Multiply (const Handle(Geom_Transformation)& aTransformation) const {
|
||||
myStructure->Multiply(aTransformation);
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Move (const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
const Quantity_Length Z) const {
|
||||
myStructure->Move(X,Y,Z);
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::SetShadingAspect(const Handle(Prs3d_ShadingAspect)& aShadingAspect) const {
|
||||
myStructure->SetShadingAspect(aShadingAspect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose : Les methodes pour les parties cachees...
|
||||
//=======================================================================
|
||||
|
||||
Handle(Graphic3d_Structure) PrsMgr_Presentation3d::
|
||||
Compute(const Handle(Graphic3d_DataStructureManager)& aProjector)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"passage dans g = Compute(P) "<<endl;
|
||||
#endif
|
||||
Handle(Prs3d_Presentation) g = new Prs3d_Presentation(Handle(PrsMgr_PresentationManager3d)::DownCast(PresentationManager())->StructureManager());
|
||||
myPresentableObject->Compute(Projector(aProjector),g);
|
||||
return g;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_Presentation3d::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
|
||||
const Handle(Graphic3d_Structure)& TheStructToFill)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"passage dans Compute(P,Str)"<<endl;
|
||||
#endif
|
||||
TheStructToFill->Clear();
|
||||
const Handle(Prs3d_Presentation)& P = *((Handle(Prs3d_Presentation)*) &TheStructToFill);
|
||||
myPresentableObject->Compute(Projector(aProjector),P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_Structure) PrsMgr_Presentation3d::
|
||||
Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
|
||||
const Handle(Geom_Transformation)& TheTrsf)
|
||||
{
|
||||
#ifdef DEB
|
||||
cout<<"passage dans G = Compute(P,Trsf)"<<endl;
|
||||
#endif
|
||||
Handle(Prs3d_Presentation) g = new Prs3d_Presentation(Handle(PrsMgr_PresentationManager3d)::DownCast(PresentationManager())->StructureManager());
|
||||
|
||||
|
||||
if(TheTrsf->Form()== gp_Translation){
|
||||
#ifdef DEB
|
||||
cout<<"\tla Trsf est une translation"<<endl;
|
||||
#endif
|
||||
|
||||
myPresentableObject->Compute(Projector(aProjector),g);
|
||||
g->Transform(TheTrsf);
|
||||
}
|
||||
else{
|
||||
// en attendant que la chose soit effectue dans gp_Trsf...rob
|
||||
Standard_Boolean good (Standard_True);
|
||||
for (Standard_Integer i=1;i<=3 && good ;i++){
|
||||
for (Standard_Integer j=1;j<=3 && good ;j++){
|
||||
if(i!=j){
|
||||
if(Abs(TheTrsf->Value(i,j)) > Precision::Confusion())
|
||||
good = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(good){
|
||||
#ifdef DEB
|
||||
cout<<"\ton a verifie que la Trsf est une Translation"<<endl;
|
||||
#endif
|
||||
myPresentableObject->Compute(Projector(aProjector),g);
|
||||
g->Transform(TheTrsf);
|
||||
|
||||
}
|
||||
else{
|
||||
#ifdef DEB
|
||||
cout<<"\tla Trsf n'est pas seulement translation..."<<endl;
|
||||
#endif
|
||||
myPresentableObject->Compute(Projector(aProjector),TheTrsf,g);
|
||||
}
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_Presentation3d::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
|
||||
const Handle(Geom_Transformation)& TheTrsf,
|
||||
const Handle(Graphic3d_Structure)& TheStructToFill)
|
||||
{
|
||||
|
||||
#ifdef DEB
|
||||
cout<<"passage dans Compute(P,Trsf,Str)"<<endl;
|
||||
#endif
|
||||
|
||||
Handle(Prs3d_Presentation) P = *((Handle(Prs3d_Presentation)*)&TheStructToFill);
|
||||
|
||||
#ifdef IMP040200
|
||||
TheStructToFill->Clear();
|
||||
myPresentableObject->Compute(Projector(aProjector),TheTrsf,P);
|
||||
#else //Does not work properly ,HLR seems deactivated for view rotation
|
||||
if(TheTrsf->Form()== gp_Translation){
|
||||
#ifdef DEB
|
||||
cout<<"\tla Trsf est une translation"<<endl;
|
||||
#endif
|
||||
// myPresentableObject->Compute(Projector(aProjector),P);
|
||||
P->Transform(TheTrsf);
|
||||
}
|
||||
else{
|
||||
// en attendant que la chose soit effectue dans gp_Trsf...rob
|
||||
Standard_Boolean good (Standard_True);
|
||||
for (Standard_Integer i=1;i<=3 && good ;i++){
|
||||
for (Standard_Integer j=1;j<=3 && good ;j++){
|
||||
if(i!=j){
|
||||
if(Abs(TheTrsf->Value(i,j)) > Precision::Confusion())
|
||||
good = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(good && !TheStructToFill->IsEmpty()){
|
||||
#ifdef DEB
|
||||
cout<<"\ton a verifie que la Trsf est une Translation"<<endl;
|
||||
#endif
|
||||
|
||||
P->Transform(TheTrsf);
|
||||
}
|
||||
else{
|
||||
TheStructToFill->Clear();
|
||||
|
||||
#ifdef DEB
|
||||
cout<<"\tla Trsf n'est pas seulement translation..."<<endl;
|
||||
#endif
|
||||
|
||||
myPresentableObject->Compute(Projector(aProjector),TheTrsf,P);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Projector
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Prs3d_Projector) PrsMgr_Presentation3d::Projector(const Handle(Graphic3d_DataStructureManager)& aProjector) {
|
||||
Visual3d_ViewOrientation VO = Handle(Visual3d_View)::DownCast(aProjector)->ViewOrientation();
|
||||
Standard_Real DX, DY, DZ,XAt, YAt , ZAt,XUp, YUp, ZUp;
|
||||
VO.ViewReferencePlane().Coord(DX, DY, DZ);
|
||||
VO.ViewReferencePoint().Coord(XAt,YAt,ZAt);
|
||||
VO.ViewReferenceUp().Coord(XUp, YUp, ZUp);
|
||||
Visual3d_ViewMapping VM = Handle(Visual3d_View)::DownCast(aProjector)->ViewMapping();
|
||||
Standard_Boolean pers = (VM.Projection() == Visual3d_TOP_PERSPECTIVE);
|
||||
Standard_Real focale = 0.0 ;
|
||||
if (pers) {
|
||||
Standard_Real Xrp,Yrp,Zrp,ViewPlane,FrontPlane ;
|
||||
Graphic3d_Vertex Prp = VM.ProjectionReferencePoint() ;
|
||||
Prp.Coord(Xrp,Yrp,Zrp);
|
||||
FrontPlane = VM.FrontPlaneDistance() ;
|
||||
ViewPlane = VM.ViewPlaneDistance() ;
|
||||
focale = FrontPlane + Zrp - ViewPlane ;
|
||||
}
|
||||
Handle(Prs3d_Projector) Proj = new Prs3d_Projector(pers,focale,DX, DY, DZ,XAt, YAt , ZAt,XUp, YUp, ZUp);
|
||||
return Proj;
|
||||
|
||||
}
|
||||
|
||||
void PrsMgr_Presentation3d::Destroy () {
|
||||
if (!myStructure.IsNull())
|
||||
myStructure->Clear();
|
||||
myStructure.Nullify();
|
||||
}
|
185
src/PrsMgr/PrsMgr_PresentationManager.cdl
Executable file
185
src/PrsMgr/PrsMgr_PresentationManager.cdl
Executable file
@@ -0,0 +1,185 @@
|
||||
-- File: PrsMgr_PresentationManager.cdl
|
||||
-- Created: Wed Jan 25 08:45:35 1995
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@pernox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
deferred class PresentationManager from PrsMgr
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: This class represents any kind of entity able to collect
|
||||
-- representations of an object, to show or erase them.
|
||||
-- Example: StructureManager from Graphic3d
|
||||
-- View from Graphic2d
|
||||
|
||||
uses
|
||||
Presentation from PrsMgr,
|
||||
PresentableObject from PrsMgr,
|
||||
View from Viewer,
|
||||
ListOfTransient from TColStd
|
||||
|
||||
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
is
|
||||
|
||||
Initialize;
|
||||
|
||||
Is3D(me) returns Boolean from Standard is deferred;
|
||||
|
||||
Display(me: mutable; aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Displays the presentation of the object in the given
|
||||
-- Presentation manager with the given mode.
|
||||
-- The mode should be enumerated by the object which
|
||||
-- inherits PresentableObject.
|
||||
is static;
|
||||
|
||||
Erase(me:mutable; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Level: public
|
||||
---Purpose: erases the presentation of the object in the given
|
||||
-- Presentation manager with the given mode.
|
||||
is static;
|
||||
|
||||
Clear(me:mutable; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
is virtual;
|
||||
---Purpose:
|
||||
-- Clears the presentation of the presentable object
|
||||
-- aPresentableObject in this framework with the
|
||||
-- display mode aMode.
|
||||
|
||||
Highlight(me: mutable; aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Highlights the presentation of the presentable object
|
||||
-- aPresentableObject in this framework with the display mode aMode.
|
||||
is static;
|
||||
|
||||
Unhighlight(me:mutable; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Removes highlighting from the presentation of the
|
||||
-- presentable object aPresentableObject in this
|
||||
-- framework with the display mode aMode.
|
||||
is static;
|
||||
|
||||
SetDisplayPriority(me;aPresentableObject: PresentableObject from PrsMgr;
|
||||
amode:Integer from Standard;
|
||||
aNewPrior:Integer from Standard);
|
||||
---Purpose:
|
||||
-- Sets the display priority aNewPrior of the
|
||||
-- presentable object aPresentableObject in this
|
||||
-- framework with the display mode aMode.
|
||||
|
||||
DisplayPriority(me;aPresentableObject: PresentableObject from PrsMgr;
|
||||
amode:Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose:
|
||||
-- Returns the display priority of the presentable object
|
||||
-- aPresentableObject in this framework with the
|
||||
-- display mode aMode.
|
||||
|
||||
IsDisplayed(me;aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Returns true if the presentation of the presentable
|
||||
-- object aPresentableObject in this framework with the
|
||||
-- display mode aMode is displayed.
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
IsHighlighted(me;aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Returns true if the presentation of the presentable
|
||||
-- object aPresentableObject in this framework with the
|
||||
-- display mode aMode is highlighted.
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
Update(me; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Updates the presentation of the presentable object
|
||||
-- aPresentableObject in this framework with the display mode aMode.
|
||||
is static;
|
||||
|
||||
---Category: Immediate display methods.
|
||||
|
||||
BeginDraw(me: mutable) is virtual;
|
||||
---Purpose: initializes the list of Prs to be displayed in transient mode
|
||||
|
||||
Add(me: mutable ; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0);
|
||||
---Purpose: Performs an iteration of the transient objects to look
|
||||
-- for the presentable objects with the display mode aMode.
|
||||
-- Appends the presentation of the presentable object
|
||||
-- aPresentableObject with the mode aMode to the list
|
||||
-- of objects in immediate mode.
|
||||
|
||||
Remove(me: mutable ; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0);
|
||||
---Purpose: Performs an iteration of the transient objects to look
|
||||
-- for the presentable objects with the display mode aMode.
|
||||
-- Removes the presentation of the presentable object
|
||||
-- aPresentableObject with the mode aMode from the
|
||||
-- list of objects in immediate mode.
|
||||
|
||||
EndDraw(me: mutable; aView: View from Viewer; DoubleBuffer: Boolean from Standard = Standard_False)
|
||||
---Purpose: Allows rapid drawing of the view aView by avoiding
|
||||
-- an update of the whole background. If DoubleBuffer
|
||||
-- is true, the background is drawn.
|
||||
is deferred;
|
||||
|
||||
IsImmediateModeOn(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
---Purpose: Returns true if immediate (transient) mode is on.
|
||||
|
||||
|
||||
|
||||
---Category: Private & deferred methods.
|
||||
|
||||
HasPresentation (me;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Returns true if there is a presentation of the
|
||||
-- presentable object aPresentableObject in this
|
||||
-- framework, aPresentableObject having the display mode aMode.
|
||||
|
||||
Presentation (me;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
returns mutable Presentation from PrsMgr
|
||||
raises NoSuchObject from Standard
|
||||
is static;
|
||||
---Purpose: Returns the presentation Presentation of the
|
||||
-- presentable object aPresentableObject in this
|
||||
-- framework. aPresentableObject has the display mode aMode.
|
||||
|
||||
AddPresentation(me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Adds a presentation of the presentable object
|
||||
-- aPresentableObject to this framework.
|
||||
-- aPresentableObject has the display mode aMode.
|
||||
is protected;
|
||||
|
||||
RemovePresentation(me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Removes a presentation of the presentable object
|
||||
-- aPresentableObject to this framework.
|
||||
-- aPresentableObject has the display mode aMode.
|
||||
is protected;
|
||||
|
||||
newPresentation(me: mutable; aPresentableObject: PresentableObject from PrsMgr)
|
||||
returns mutable Presentation from PrsMgr
|
||||
---Level: Internal
|
||||
---Purpose: Creates a new presentation in the presentation manager.
|
||||
is deferred private;
|
||||
|
||||
fields
|
||||
myImmediateMode: Boolean from Standard is protected;
|
||||
myImmediateList: ListOfTransient from TColStd is protected;
|
||||
|
||||
end PresentationManager from PrsMgr;
|
224
src/PrsMgr/PrsMgr_PresentationManager.cxx
Executable file
224
src/PrsMgr/PrsMgr_PresentationManager.cxx
Executable file
@@ -0,0 +1,224 @@
|
||||
#include <PrsMgr_PresentationManager.ixx>
|
||||
#include <PrsMgr_PresentableObject.hxx>
|
||||
#include <PrsMgr_Presentation.hxx>
|
||||
#include <PrsMgr_Presentations.hxx>
|
||||
#include <PrsMgr_ModedPresentation.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfTransient.hxx>
|
||||
|
||||
|
||||
PrsMgr_PresentationManager::PrsMgr_PresentationManager ():
|
||||
myImmediateMode(Standard_False){}
|
||||
|
||||
|
||||
void PrsMgr_PresentationManager::Display(
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
else if(Presentation(aPresentableObject,aMode)->MustBeUpdated()){
|
||||
Update(aPresentableObject,aMode);
|
||||
}
|
||||
|
||||
if(myImmediateMode)
|
||||
Add(aPresentableObject,aMode);
|
||||
else
|
||||
Presentation(aPresentableObject,aMode)->Display();
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager::Erase(
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (HasPresentation(aPresentableObject,aMode)){
|
||||
if(myImmediateMode)
|
||||
Remove(aPresentableObject,aMode);
|
||||
else
|
||||
Presentation(aPresentableObject,aMode)->Erase();}
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager::Clear(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (HasPresentation(aPresentableObject,aMode)){
|
||||
if(myImmediateMode)
|
||||
Remove(aPresentableObject,aMode);
|
||||
else
|
||||
Presentation(aPresentableObject,aMode)->Clear();}
|
||||
}
|
||||
|
||||
|
||||
void PrsMgr_PresentationManager::Highlight(
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
else if(Presentation(aPresentableObject,aMode)->MustBeUpdated()){
|
||||
Update(aPresentableObject,aMode);
|
||||
}
|
||||
Presentation(aPresentableObject,aMode)->Highlight();
|
||||
|
||||
if(myImmediateMode)
|
||||
Add(aPresentableObject,aMode);
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager::Unhighlight(
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
if (HasPresentation(aPresentableObject,aMode)){
|
||||
Presentation(aPresentableObject,aMode)->Unhighlight();
|
||||
if(myImmediateMode)
|
||||
Remove(aPresentableObject,aMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrsMgr_PresentationManager::
|
||||
SetDisplayPriority(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode,
|
||||
const Standard_Integer theNewPrior) const
|
||||
{
|
||||
if (HasPresentation(aPresentableObject,aMode))
|
||||
Presentation(aPresentableObject,aMode)->SetDisplayPriority(theNewPrior);
|
||||
}
|
||||
|
||||
Standard_Integer PrsMgr_PresentationManager::
|
||||
DisplayPriority(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) const
|
||||
{
|
||||
if (HasPresentation(aPresentableObject,aMode))
|
||||
return Presentation(aPresentableObject,aMode)->DisplayPriority();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) const {
|
||||
if (HasPresentation(aPresentableObject,aMode))
|
||||
return Presentation(aPresentableObject,aMode)->IsDisplayed();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) const {
|
||||
if (HasPresentation(aPresentableObject,aMode))
|
||||
return Presentation(aPresentableObject,aMode)->IsHighlighted();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager::Update (const Handle(PrsMgr_PresentableObject)& aPresentableObject,const Standard_Integer aMode ) const {
|
||||
if(HasPresentation(aPresentableObject,aMode)) {
|
||||
Handle(PrsMgr_Presentation) P = Presentation(aPresentableObject,aMode);
|
||||
if (!P.IsNull()) {
|
||||
P->Clear();
|
||||
aPresentableObject->Fill(this,P,aMode);
|
||||
P->SetUpdateStatus(Standard_False);
|
||||
}
|
||||
}
|
||||
}
|
||||
void PrsMgr_PresentationManager::BeginDraw() {
|
||||
myImmediateMode = Standard_True;
|
||||
myImmediateList.Clear();
|
||||
}
|
||||
|
||||
|
||||
void PrsMgr_PresentationManager::Add(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) {
|
||||
if (myImmediateMode ) {
|
||||
Handle(PrsMgr_Presentation) P = Presentation(aPresentableObject,aMode);
|
||||
for (TColStd_ListIteratorOfListOfTransient it(myImmediateList);it.More();it.Next()){
|
||||
if(it.Value()==P) return;
|
||||
}
|
||||
myImmediateList.Append(P);
|
||||
}
|
||||
}
|
||||
void PrsMgr_PresentationManager::Remove(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) {
|
||||
if (myImmediateMode ) {
|
||||
Handle(PrsMgr_Presentation) P = Presentation(aPresentableObject,aMode);
|
||||
for (TColStd_ListIteratorOfListOfTransient it(myImmediateList);it.More();it.Next()){
|
||||
if(it.Value()==P) {
|
||||
myImmediateList.Remove(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Standard_Boolean PrsMgr_PresentationManager::HasPresentation
|
||||
(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) const {
|
||||
|
||||
const PrsMgr_Presentations& S = aPresentableObject->Presentations();
|
||||
Standard_Boolean found = Standard_False;
|
||||
Standard_Integer i=1; Standard_Integer l= S.Length();
|
||||
while (i<= l && !found) {
|
||||
// modif WOK++ : operator == is ambiguous
|
||||
// found = aMode == S(i).Mode()
|
||||
// && this == S(i).Presentation()->PresentationManager();
|
||||
const Handle (PrsMgr_Presentation)& popPrs = S(i).Presentation();
|
||||
const Handle (PrsMgr_PresentationManager)& popPrsMgr = popPrs->PresentationManager();
|
||||
if ( aMode == S(i).Mode() && this == popPrsMgr )
|
||||
found = Standard_True;
|
||||
i++;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
Handle (PrsMgr_Presentation)
|
||||
PrsMgr_PresentationManager::Presentation(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) const
|
||||
{
|
||||
Handle(PrsMgr_Presentation) P;
|
||||
const PrsMgr_Presentations& S = aPresentableObject->Presentations();
|
||||
Standard_Boolean found = Standard_False;
|
||||
Standard_Integer i=1; Standard_Integer l= S.Length();
|
||||
while (i<= l && !found) {
|
||||
P = S(i).Presentation();
|
||||
const Handle (PrsMgr_PresentationManager)& popPrsMgr = P->PresentationManager();
|
||||
if (aMode == S(i).Mode() && this == popPrsMgr) {
|
||||
found = Standard_True;
|
||||
|
||||
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return P;
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager::AddPresentation
|
||||
(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) {
|
||||
|
||||
Handle(PrsMgr_Presentation) P = newPresentation(aPresentableObject);
|
||||
aPresentableObject->Presentations().Append(PrsMgr_ModedPresentation(P,aMode));
|
||||
aPresentableObject->Fill(this,P,aMode);
|
||||
P->SetUpdateStatus(Standard_False);
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager::RemovePresentation(const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
PrsMgr_Presentations& S = aPresentableObject->Presentations();
|
||||
Standard_Integer i = 1;
|
||||
Standard_Integer n = S.Length();
|
||||
while (i<= n) {
|
||||
if (aMode == S(i).Mode()) {
|
||||
S.Remove(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
7
src/PrsMgr/PrsMgr_PresentationManager.lxx
Executable file
7
src/PrsMgr/PrsMgr_PresentationManager.lxx
Executable file
@@ -0,0 +1,7 @@
|
||||
// File: PrsMgr_PresentationManager.lxx
|
||||
// Created: Thu Apr 23 11:19:22 1998
|
||||
// Author: Robert COUBLANC
|
||||
// <rob@robox.paris1.matra-dtv.fr>
|
||||
|
||||
inline Standard_Boolean PrsMgr_PresentationManager::IsImmediateModeOn() const
|
||||
{return myImmediateMode;}
|
162
src/PrsMgr/PrsMgr_PresentationManager2d.cdl
Executable file
162
src/PrsMgr/PrsMgr_PresentationManager2d.cdl
Executable file
@@ -0,0 +1,162 @@
|
||||
-- File: PrsMgr_PresentationManager2d.cdl
|
||||
-- Created: Thu Oct 21 12:45:31 1993
|
||||
-- Author: Jean-Louis FRENKEL
|
||||
-- <jlf@stylox>
|
||||
-- Modified by rob Aug 20 98 :
|
||||
-- new Methods : Is3D() , AddToImmediateList (GO)
|
||||
-- BeginDraw redefined
|
||||
-- new field : myGOList
|
||||
-- => allows users to store independant Graphic
|
||||
-- Objects, which will be displayed in immediate mode
|
||||
-- when EndDraw is applied
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class PresentationManager2d from PrsMgr inherits PresentationManager from PrsMgr
|
||||
|
||||
---Purpose: A framework to manage 2D displays, graphic entities
|
||||
-- and their updates. Plotters, Highlights, Minima
|
||||
-- maxima, immediate display (of transient graphic data???].
|
||||
|
||||
uses
|
||||
ListOfTransient from TColStd,
|
||||
View from Graphic2d,
|
||||
TransientManager from Graphic2d,
|
||||
PresentableObject from PrsMgr,
|
||||
Presentation from PrsMgr,
|
||||
Presentation2d from PrsMgr,
|
||||
DisplayList from Graphic2d,
|
||||
GraphicObject from Graphic2d,
|
||||
Buffer from Graphic2d,
|
||||
View from Viewer
|
||||
|
||||
is
|
||||
|
||||
Create(aStructureManager: View from Graphic2d)
|
||||
returns mutable PresentationManager2d from PrsMgr;
|
||||
---Purpose: Creates a framework to manage displays and graphic
|
||||
-- entities with the 2D view aStructureManager.
|
||||
|
||||
Is3D(me) returns Boolean from Standard is redefined static;
|
||||
|
||||
ColorHighlight(me: mutable;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
anIndex: Integer from Standard;
|
||||
aMode: Integer from Standard = 0)
|
||||
is static;
|
||||
---Purpose: Highlights the graphic object aPresentableObject in
|
||||
-- color by the color index anIndex. aPresentableObject
|
||||
-- has the display mode aMode.
|
||||
|
||||
EnablePlot (me: mutable;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
is static;
|
||||
---Purpose: Allows the drawing on a plotter of the graphic object
|
||||
-- aPresentableObject with the display mode aMode.
|
||||
|
||||
DisablePlot (me: mutable;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Forbids the drawing on a plotter of the graphic object
|
||||
-- aPresentableObject with the display mode aMode.
|
||||
is static;
|
||||
|
||||
IsPlottable (me;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns Standard_True if the graphic object <me>
|
||||
-- is plottable, Standard_False if not.
|
||||
---Category: Methods to manage the plotter
|
||||
is static;
|
||||
|
||||
SetOffset (me: mutable;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
anOffset: Integer from Standard;
|
||||
aMode: Integer from Standard = 0)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Specifies an Offset applied to the original color
|
||||
-- index of all primitives in the graphic object <me>.
|
||||
-- Warning: To reset the real color of the primitives
|
||||
-- you have to call this method with <anOffset> = 0.
|
||||
---Category: Methods to manage the highlight
|
||||
|
||||
Offset (me;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Offset applied to the original color
|
||||
-- index of all primitives in the graphic object <me>.
|
||||
---Category: Methods to manage the highlight
|
||||
|
||||
|
||||
InitMinMax(me: mutable)
|
||||
---Purpose: Initializes a list of 2D objects for which minima and
|
||||
-- maxima will be calculated.
|
||||
is static;
|
||||
|
||||
AddMinMax(me: mutable; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Appends the graphic object aPresentableObject with
|
||||
-- the display mode aMode to the list of objects for
|
||||
-- which minima and maxima will be calculated.
|
||||
is static;
|
||||
|
||||
MinMax(me; MinX,MaxX,MinY,MaxY: out Real from Standard)
|
||||
---Purpose: Returns the minima and maxima for all the graphic
|
||||
-- objects listed by the AddMinMax function.
|
||||
is static;
|
||||
|
||||
SetHighlightColor(me:mutable; anIndex: Integer from Standard)
|
||||
is static;
|
||||
--- Purpose: Sets the highlight color index anIndex.
|
||||
|
||||
StructureManager(me) returns mutable View from Graphic2d
|
||||
is static;
|
||||
---Purpose: Returns the structure manager.
|
||||
|
||||
|
||||
|
||||
BeginDraw(me:mutable) is redefined static;
|
||||
|
||||
AddToImmediateList(me:mutable;aGO:GraphicObject from Graphic2d);
|
||||
|
||||
EndDraw(me: mutable; aView: View from Viewer; DoubleBuffer: Boolean from Standard = Standard_False)
|
||||
is redefined static;
|
||||
---Purpose: Allows rapid drawing of the view aView by avoiding
|
||||
-- an update of the whole background. If DoubleBuffer is true, the background is drawn.
|
||||
|
||||
|
||||
Dump (me: mutable;
|
||||
aBuffer: Buffer from Graphic2d;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0) is static;
|
||||
---Level: Public
|
||||
---Purpose: Dumps the Graphic Primitives of the PresentatbleObject in the buffer
|
||||
|
||||
|
||||
CastPresentation(me; aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
returns mutable Presentation2d from PrsMgr
|
||||
is static;
|
||||
|
||||
newPresentation(me: mutable; aPresentableObject: PresentableObject from PrsMgr)
|
||||
returns mutable Presentation from PrsMgr
|
||||
---Level: Internal
|
||||
---Purpose: Creates a new presentation in the presentation manager.
|
||||
is redefined static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myStructureManager: View from Graphic2d;
|
||||
MinMaxList: DisplayList from Graphic2d;
|
||||
myTM : TransientManager from Graphic2d;
|
||||
myGOList : ListOfTransient from TColStd;
|
||||
end PresentationManager2d from PrsMgr;
|
149
src/PrsMgr/PrsMgr_PresentationManager2d.cxx
Executable file
149
src/PrsMgr/PrsMgr_PresentationManager2d.cxx
Executable file
@@ -0,0 +1,149 @@
|
||||
#define G002 // TCL 040500 The Transientmanager has changed
|
||||
// to avoid unavailable cyclic dependency under WNT.
|
||||
|
||||
#include <PrsMgr_PresentationManager2d.ixx>
|
||||
#include <PrsMgr_Presentation2d.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Graphic2d_TransientManager.hxx>
|
||||
#include <V2d_View.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfTransient.hxx>
|
||||
|
||||
|
||||
|
||||
PrsMgr_PresentationManager2d::PrsMgr_PresentationManager2d (const Handle(Graphic2d_View)& aStructureManager):myStructureManager(aStructureManager) {
|
||||
#ifdef G002
|
||||
myTM = new Graphic2d_TransientManager(myStructureManager.operator -> ());
|
||||
#else
|
||||
myTM = new Graphic2d_TransientManager(myStructureManager);
|
||||
#endif
|
||||
myTM->SetOverrideColor(32);
|
||||
myTM->SetMapping(Standard_True);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean PrsMgr_PresentationManager2d::Is3D() const
|
||||
{return Standard_False;}
|
||||
|
||||
void PrsMgr_PresentationManager2d::ColorHighlight(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aColor, const Standard_Integer aMode) {
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
CastPresentation(aPresentableObject,aMode)->Highlight(aColor);
|
||||
|
||||
// immediate mode
|
||||
// Add(aPresentableObject,aMode);
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager2d::EnablePlot(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) {
|
||||
CastPresentation(aPresentableObject,aMode)->EnablePlot();
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager2d::DisablePlot(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) {
|
||||
CastPresentation(aPresentableObject,aMode)->DisablePlot();
|
||||
}
|
||||
|
||||
Standard_Boolean PrsMgr_PresentationManager2d::IsPlottable(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) const {
|
||||
return CastPresentation(aPresentableObject,aMode)->IsPlottable();
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager2d::SetHighlightColor(const Standard_Integer anIndex) {
|
||||
myStructureManager->SetDefaultOverrideColor(anIndex);
|
||||
}
|
||||
|
||||
Handle(PrsMgr_Presentation) PrsMgr_PresentationManager2d::newPresentation(const Handle(PrsMgr_PresentableObject) & aPresentableObject) {
|
||||
return new PrsMgr_Presentation2d(this);
|
||||
}
|
||||
|
||||
Handle(Graphic2d_View) PrsMgr_PresentationManager2d::StructureManager () const {
|
||||
return myStructureManager;
|
||||
}
|
||||
|
||||
|
||||
void PrsMgr_PresentationManager2d::Dump
|
||||
(const Handle(Graphic2d_Buffer)& aBuffer,
|
||||
const Handle(PrsMgr_PresentableObject)& aPresentableObject,
|
||||
const Standard_Integer aMode) {
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
aBuffer->Add(CastPresentation(aPresentableObject,aMode)->Presentation());
|
||||
|
||||
}
|
||||
|
||||
Handle(PrsMgr_Presentation2d) PrsMgr_PresentationManager2d::CastPresentation(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) const {
|
||||
return Handle(PrsMgr_Presentation2d)::DownCast(Presentation(aPresentableObject,aMode));
|
||||
}
|
||||
void PrsMgr_PresentationManager2d::InitMinMax() {
|
||||
MinMaxList = new Graphic2d_DisplayList;
|
||||
}
|
||||
void PrsMgr_PresentationManager2d::AddMinMax(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) {
|
||||
|
||||
if (HasPresentation(aPresentableObject,aMode)){
|
||||
MinMaxList->Append(CastPresentation(aPresentableObject,aMode)->Presentation());}
|
||||
}
|
||||
|
||||
|
||||
void PrsMgr_PresentationManager2d::MinMax(Standard_Real& MinX,
|
||||
Standard_Real& MaxX,
|
||||
Standard_Real& MinY,
|
||||
Standard_Real& MaxY) const {
|
||||
|
||||
myStructureManager->MinMax(MinMaxList,MinX,MaxX,MinY,MaxY);
|
||||
}
|
||||
void PrsMgr_PresentationManager2d::SetOffset(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer anOffset,const Standard_Integer aMode) {
|
||||
if (HasPresentation(aPresentableObject,aMode)){
|
||||
CastPresentation(aPresentableObject,aMode)->SetOffset(anOffset);
|
||||
}
|
||||
|
||||
// immediate mode
|
||||
// Add(aPresentableObject,aMode);
|
||||
}
|
||||
|
||||
Standard_Integer PrsMgr_PresentationManager2d::Offset(const Handle(PrsMgr_PresentableObject)& aPresentableObject,const Standard_Integer aMode) const{
|
||||
return CastPresentation(aPresentableObject,aMode)->Offset();}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BeginDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentationManager2d::BeginDraw()
|
||||
{
|
||||
PrsMgr_PresentationManager::BeginDraw();
|
||||
myGOList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddToImmediateList
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentationManager2d::AddToImmediateList(const Handle(Graphic2d_GraphicObject)& GO)
|
||||
{myGOList.Append(GO);}
|
||||
|
||||
//=======================================================================
|
||||
//function : EndDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager2d::EndDraw(const Handle(Viewer_View)& aView, const Standard_Boolean DoubleBuffer) {
|
||||
Handle(V2d_View) aV2d = Handle(V2d_View)::DownCast(aView);
|
||||
myTM->BeginDraw(Handle(Aspect_WindowDriver)::DownCast(aV2d->Driver()),Standard_True);
|
||||
|
||||
TColStd_ListIteratorOfListOfTransient it(myImmediateList);
|
||||
while (it.More()) {
|
||||
Handle(Graphic2d_GraphicObject) aGO = Handle(PrsMgr_Presentation2d)::DownCast(it.Value())->Presentation();
|
||||
if (!aGO.IsNull()) myTM->Draw(aGO);
|
||||
it.Next();
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) Tr;
|
||||
for(it.Initialize(myGOList);it.More();it.Next()){
|
||||
Tr =it.Value();
|
||||
myTM->Draw(*((Handle(Graphic2d_GraphicObject)*)&Tr));
|
||||
}
|
||||
|
||||
myTM->EndDraw(Standard_True);
|
||||
myImmediateMode = Standard_False;
|
||||
}
|
||||
|
180
src/PrsMgr/PrsMgr_PresentationManager3d.cdl
Executable file
180
src/PrsMgr/PrsMgr_PresentationManager3d.cdl
Executable file
@@ -0,0 +1,180 @@
|
||||
-- File: PrsMgr_PresentationManager3d.cdl
|
||||
-- Created: Thu Oct 21 12:45:31 1993
|
||||
-- Author: Jean-Louis FRENKEL
|
||||
-- <jlf@stylox>
|
||||
-- Modified by rob Aug 20 98 :
|
||||
-- new Methods : Is3D() , AddToImmediateList (Prs)
|
||||
-- BeginDraw redefined
|
||||
-- new field : myStrList
|
||||
-- => allows users to store independant Graphic Structures
|
||||
-- which will be displayed in immediate mode when EndDraw
|
||||
-- is applied
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class PresentationManager3d from PrsMgr inherits PresentationManager from PrsMgr
|
||||
|
||||
---Purpose: A framework to manage 3D displays, graphic entities
|
||||
-- and their updates.
|
||||
-- Used in the AIS package (Application Interactive
|
||||
-- Services), to enable the advanced user to define the
|
||||
-- default display mode of a new interactive object which
|
||||
-- extends the list of signatures and types.
|
||||
-- Definition of new display types is handled by calling
|
||||
-- the presentation algorithms provided by the StdPrs package.
|
||||
|
||||
uses
|
||||
ListOfTransient from TColStd,
|
||||
StructureManager from Graphic3d,
|
||||
PresentableObject from PrsMgr,
|
||||
Length,NameOfColor from Quantity,
|
||||
Transformation from Geom,
|
||||
NameOfMaterial from Graphic3d,
|
||||
--NameOfMaterialPhysic from Graphic3d,
|
||||
--NameOfPhysicalMaterial from Graphic3d,
|
||||
Presentation from PrsMgr,
|
||||
Presentation3d from PrsMgr,
|
||||
View from Viewer,
|
||||
ShadingAspect from Prs3d,
|
||||
Presentation from Prs3d
|
||||
is
|
||||
|
||||
Create(aStructureManager: StructureManager from Graphic3d)
|
||||
returns mutable PresentationManager3d from PrsMgr;
|
||||
---Purpose:
|
||||
-- Creates a framework to manage displays and graphic
|
||||
-- entities with the 3D view aStructureManager.
|
||||
|
||||
Is3D(me) returns Boolean from Standard is redefined;
|
||||
|
||||
Color(me: mutable;
|
||||
aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aColor: NameOfColor from Quantity = Quantity_NOC_YELLOW;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: Highlights the graphic object aPresentableObject in
|
||||
-- the color aColor.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe display mode.
|
||||
is static;
|
||||
|
||||
|
||||
BoundBox(me: mutable; aPresentableObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: highlights the boundbox of the presentation
|
||||
|
||||
is static;
|
||||
|
||||
---Category: Immediate display methods.
|
||||
--
|
||||
|
||||
BeginDraw(me:mutable) is redefined static;
|
||||
|
||||
AddToImmediateList(me:mutable;aPrs:Presentation from Prs3d);
|
||||
---Purpose: stores <aPrs> in a list of structure to be displayed
|
||||
-- in immediate mode. will be taken in account in EndDraw Method.
|
||||
|
||||
EndDraw(me: mutable; aView: View from Viewer; DoubleBuffer: Boolean from Standard = Standard_False)
|
||||
is redefined static;
|
||||
|
||||
|
||||
---Category: references to other presentation.
|
||||
|
||||
Connect(me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
anOtherObject: mutable PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0;
|
||||
anOtherMode: Integer from Standard = 0)
|
||||
is static;
|
||||
|
||||
---Category: Transformation methods.
|
||||
|
||||
Transform (me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aTransformation: Transformation from Geom;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose:
|
||||
-- Sets the transformation aTransformation for the
|
||||
-- presentable object aPresentableObject.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe
|
||||
-- display mode.
|
||||
is static;
|
||||
|
||||
Place (me: mutable; aPresentableObject: PresentableObject from PrsMgr;
|
||||
X,Y,Z: Length from Quantity;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose:
|
||||
-- Sets a position to move the presentable object
|
||||
-- aPresentableObject to. This position is defined by the
|
||||
-- lengths along the x, y and z axes: X, Y and Z respectively.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe display mode.
|
||||
is static;
|
||||
|
||||
Multiply (me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aTransformation: Transformation from Geom;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose:
|
||||
-- Defines the transformation aTransformation for the
|
||||
-- presentable object aPresentableObject.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe
|
||||
-- display mode.
|
||||
is static;
|
||||
|
||||
Move (me: mutable; aPresentableObject: PresentableObject from PrsMgr;
|
||||
X,Y,Z: Length from Quantity;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose:
|
||||
-- Sets a position to move the presentable object
|
||||
-- aPresentableObject to. This position is defined by the
|
||||
-- lengths along the x, y and z axes: X, Y and Z respectively.
|
||||
-- aPresentableObject has the display mode aMode;
|
||||
-- this has the default value of 0, that is, the wireframe
|
||||
-- display mode.
|
||||
is static;
|
||||
|
||||
StructureManager(me) returns mutable StructureManager from Graphic3d
|
||||
is static;
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
---Purpose: Returns the structure manager.
|
||||
|
||||
SetShadingAspect(me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aColor: NameOfColor from Quantity;
|
||||
aMaterial: NameOfMaterial from Graphic3d;
|
||||
--aMaterial: NameOfPhysicalMaterial from Graphic3d;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: this method will change the color and the aspect
|
||||
-- of the presentations containg shaded structures.
|
||||
is static;
|
||||
|
||||
|
||||
SetShadingAspect(me: mutable;
|
||||
aPresentableObject: PresentableObject from PrsMgr;
|
||||
aShadingAspect: ShadingAspect from Prs3d;
|
||||
aMode: Integer from Standard = 0)
|
||||
---Purpose: this method will change the color and the aspect
|
||||
-- of the presentations containg shaded structures.
|
||||
is static;
|
||||
|
||||
|
||||
CastPresentation(me; aPresentableObject: PresentableObject from PrsMgr;
|
||||
aMode: Integer from Standard = 0)
|
||||
returns mutable Presentation3d from PrsMgr
|
||||
is static ;
|
||||
|
||||
newPresentation(me: mutable; aPresentableObject: PresentableObject from PrsMgr)
|
||||
returns mutable Presentation from PrsMgr
|
||||
---Level: Internal
|
||||
---Purpose: Creates a new presentation in the presentation manager.
|
||||
is redefined static private;
|
||||
|
||||
fields
|
||||
|
||||
myStructureManager : StructureManager from Graphic3d;
|
||||
myStrList : ListOfTransient from TColStd;
|
||||
|
||||
end PresentationManager3d from PrsMgr;
|
186
src/PrsMgr/PrsMgr_PresentationManager3d.cxx
Executable file
186
src/PrsMgr/PrsMgr_PresentationManager3d.cxx
Executable file
@@ -0,0 +1,186 @@
|
||||
|
||||
#include <PrsMgr_PresentationManager3d.ixx>
|
||||
#include <PrsMgr_Presentation3d.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Visual3d_TransientManager.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfTransient.hxx>
|
||||
|
||||
PrsMgr_PresentationManager3d::PrsMgr_PresentationManager3d (const Handle(Graphic3d_StructureManager)& aStructureManager):myStructureManager(aStructureManager) {}
|
||||
|
||||
Standard_Boolean PrsMgr_PresentationManager3d::Is3D() const
|
||||
{return Standard_True;}
|
||||
|
||||
Handle(PrsMgr_Presentation) PrsMgr_PresentationManager3d::newPresentation (const Handle(PrsMgr_PresentableObject) & aPresentableObject) {
|
||||
|
||||
return new PrsMgr_Presentation3d(this,aPresentableObject);
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager3d::Connect(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Handle(PrsMgr_PresentableObject)& anOtherObject, const Standard_Integer aMode, const Standard_Integer anOtherMode) {
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
if (!HasPresentation(anOtherObject,anOtherMode)){
|
||||
AddPresentation(anOtherObject,anOtherMode);
|
||||
}
|
||||
CastPresentation(aPresentableObject,aMode)->Connect(CastPresentation(anOtherObject,aMode));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentationManager3d::Transform(const Handle(PrsMgr_PresentableObject)& aPresentableObject,const Handle(Geom_Transformation)& aTransformation, const Standard_Integer aMode) {
|
||||
CastPresentation(aPresentableObject,aMode)->Transform(aTransformation);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Place
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::Place(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Quantity_Length X,const Quantity_Length Y,const Quantity_Length Z,const Standard_Integer aMode) {
|
||||
CastPresentation(aPresentableObject,aMode)->Place(X,Y,Z);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Multiply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::Multiply(const Handle(PrsMgr_PresentableObject)& aPresentableObject,const Handle(Geom_Transformation)& aTransformation, const Standard_Integer aMode) {
|
||||
CastPresentation(aPresentableObject,aMode)->Multiply(aTransformation);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Move
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::Move(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Quantity_Length X,const Quantity_Length Y,const Quantity_Length Z,const Standard_Integer aMode) {
|
||||
CastPresentation(aPresentableObject,aMode)->Move(X,Y,Z);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Color
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::Color(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Quantity_NameOfColor aColor, const Standard_Integer aMode) {
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
else if(Presentation(aPresentableObject,aMode)->MustBeUpdated()){
|
||||
Update(aPresentableObject,aMode);
|
||||
}
|
||||
CastPresentation(aPresentableObject,aMode)->Color(aColor);
|
||||
|
||||
if(myImmediateMode)
|
||||
Add(aPresentableObject,aMode);
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BoundBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::BoundBox(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) {
|
||||
if (!HasPresentation(aPresentableObject,aMode)){
|
||||
AddPresentation(aPresentableObject,aMode);
|
||||
}
|
||||
else if(Presentation(aPresentableObject,aMode)->MustBeUpdated()){
|
||||
Update(aPresentableObject,aMode);
|
||||
}
|
||||
CastPresentation(aPresentableObject,aMode)->BoundBox();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetShadingAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
//POP pour K4L
|
||||
void PrsMgr_PresentationManager3d::SetShadingAspect(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Quantity_NameOfColor aColor, const Graphic3d_NameOfMaterial aMaterial, const Standard_Integer aMode) {
|
||||
//void PrsMgr_PresentationManager3d::SetShadingAspect(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Quantity_NameOfColor aColor, const Graphic3d_NameOfPhysicalMaterial aMaterial, const Standard_Integer aMode) {
|
||||
|
||||
Handle(Prs3d_ShadingAspect) sa = new Prs3d_ShadingAspect;
|
||||
sa->SetColor(aColor);
|
||||
sa->SetMaterial(aMaterial);
|
||||
SetShadingAspect(aPresentableObject,sa,aMode);
|
||||
}
|
||||
|
||||
void PrsMgr_PresentationManager3d::SetShadingAspect(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Handle(Prs3d_ShadingAspect)& aShadingAspect, const Standard_Integer aMode) {
|
||||
|
||||
if (HasPresentation(aPresentableObject,aMode)){
|
||||
CastPresentation(aPresentableObject,aMode)->SetShadingAspect(aShadingAspect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CastPresentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(PrsMgr_Presentation3d) PrsMgr_PresentationManager3d::CastPresentation(const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Standard_Integer aMode) const {
|
||||
return Handle(PrsMgr_Presentation3d)::DownCast(Presentation(aPresentableObject,aMode));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BeginDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::BeginDraw()
|
||||
{
|
||||
PrsMgr_PresentationManager::BeginDraw();
|
||||
myStrList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EndDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_PresentationManager3d::EndDraw(const Handle(Viewer_View)& aView, const Standard_Boolean DoubleBuffer) {
|
||||
|
||||
|
||||
Handle(V3d_View) v;
|
||||
v =*((Handle(V3d_View)*)&aView);
|
||||
if (!v->TransientManagerBeginDraw(DoubleBuffer,Standard_True))
|
||||
{
|
||||
myImmediateMode = Standard_False;
|
||||
return;
|
||||
}
|
||||
if(myImmediateList.IsEmpty() && myStrList.IsEmpty()) {
|
||||
Visual3d_TransientManager::EndDraw();
|
||||
myImmediateMode = Standard_False;
|
||||
return;
|
||||
}
|
||||
TColStd_ListIteratorOfListOfTransient it(myImmediateList);
|
||||
Handle(PrsMgr_Presentation3d) P3d;
|
||||
for (; it.More(); it.Next()) {
|
||||
P3d = *((Handle(PrsMgr_Presentation3d)*)&(it.Value()));
|
||||
Visual3d_TransientManager::DrawStructure(P3d->Presentation());
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) Tr;
|
||||
for(it.Initialize(myStrList);it.More();it.Next()){
|
||||
Tr = it.Value();
|
||||
Visual3d_TransientManager::DrawStructure(*((Handle(Prs3d_Presentation)*)&Tr));
|
||||
}
|
||||
|
||||
Visual3d_TransientManager::EndDraw();
|
||||
myImmediateMode = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void PrsMgr_PresentationManager3d::AddToImmediateList(const Handle(Prs3d_Presentation)& P){
|
||||
myStrList.Append(P);
|
||||
}
|
7
src/PrsMgr/PrsMgr_PresentationManager3d.lxx
Executable file
7
src/PrsMgr/PrsMgr_PresentationManager3d.lxx
Executable file
@@ -0,0 +1,7 @@
|
||||
// File: PrsMgr_PresentationManager3d.lxx
|
||||
// Created: Thu Aug 20 10:00:41 1998
|
||||
// Author: Robert COUBLANC
|
||||
// <rob@robox.paris1.matra-dtv.fr>
|
||||
inline const Handle(Graphic3d_StructureManager)& PrsMgr_PresentationManager3d::StructureManager () const {
|
||||
return myStructureManager;
|
||||
}
|
64
src/PrsMgr/PrsMgr_Prs.cdl
Executable file
64
src/PrsMgr/PrsMgr_Prs.cdl
Executable file
@@ -0,0 +1,64 @@
|
||||
-- File: P3D_Prs.cdl
|
||||
-- Created: Tue Jan 31 14:19:42 1995
|
||||
-- Author: Mister rmi
|
||||
-- <rmi@pernox>
|
||||
--Modified by rob 11-mar-98 : Implement virtual methods from Graphic3d_Structure
|
||||
-- to optimize HLR Display...
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
class Prs from PrsMgr inherits Presentation from Prs3d
|
||||
|
||||
uses
|
||||
Array2OfReal from TColStd,
|
||||
StructureManager from Graphic3d,
|
||||
Structure from Graphic3d,
|
||||
DataStructureManager from Graphic3d,
|
||||
TypeOfPresentation3d from PrsMgr,
|
||||
Presentation3dPointer from PrsMgr
|
||||
|
||||
is
|
||||
Create(aStructureManager : StructureManager from Graphic3d;
|
||||
aPresentation : Presentation3dPointer from PrsMgr;
|
||||
aTypeOfPresentation3d : TypeOfPresentation3d from PrsMgr)
|
||||
returns mutable Prs from PrsMgr;
|
||||
|
||||
Compute(me : mutable; aProjector: DataStructureManager from Graphic3d)
|
||||
returns Structure from Graphic3d
|
||||
is redefined static;
|
||||
|
||||
Compute ( me : mutable;
|
||||
aProjector: DataStructureManager from Graphic3d;
|
||||
AMatrix : Array2OfReal from TColStd )
|
||||
returns Structure from Graphic3d is
|
||||
redefined static;
|
||||
---Purpose: the "degenerated" Structure is displayed with
|
||||
-- a transformation defined by <AMatrix>
|
||||
-- which is not a Pure Translation.
|
||||
-- We have to take in account this Transformation
|
||||
-- in the computation of hidden line removal...
|
||||
-- returns a filled Graphic Structure.
|
||||
|
||||
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : DataStructureManager from Graphic3d;
|
||||
ComputedStruct : in out Structure from Graphic3d)
|
||||
is redefined static;
|
||||
---Purpose: No need to return a structure, just to fill
|
||||
-- <ComputedStruct> ....
|
||||
|
||||
|
||||
Compute ( me : mutable;
|
||||
aProjector: DataStructureManager from Graphic3d;
|
||||
AMatrix : Array2OfReal from TColStd ;
|
||||
aStructure: in out Structure from Graphic3d )
|
||||
is redefined static;
|
||||
---Purpose: No Need to return a Structure, just to
|
||||
-- Fill <aStructure>. The Trsf has to be taken in account
|
||||
-- in the computation (Rotation Part....)
|
||||
|
||||
|
||||
|
||||
fields
|
||||
myPresentation3d: Presentation3dPointer from PrsMgr;
|
||||
end Prs from PrsMgr;
|
75
src/PrsMgr/PrsMgr_Prs.cxx
Executable file
75
src/PrsMgr/PrsMgr_Prs.cxx
Executable file
@@ -0,0 +1,75 @@
|
||||
#include <PrsMgr_Prs.ixx>
|
||||
#include <PrsMgr_Presentation3d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <Geom_Transformation.hxx>
|
||||
|
||||
PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& aStructureManager,
|
||||
const PrsMgr_Presentation3dPointer& aPresentation3d,
|
||||
const PrsMgr_TypeOfPresentation3d aTypeOfPresentation)
|
||||
:Prs3d_Presentation(aStructureManager),myPresentation3d(aPresentation3d)
|
||||
{
|
||||
|
||||
if (aTypeOfPresentation == PrsMgr_TOP_ProjectorDependant)
|
||||
SetVisual(Graphic3d_TOS_COMPUTED);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) {
|
||||
return myPresentation3d->Compute(aProjector);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
|
||||
const TColStd_Array2OfReal& AMatrix)
|
||||
{
|
||||
gp_Trsf TheTrsf;
|
||||
Standard_Integer LC(AMatrix.LowerCol()),LR(AMatrix.LowerRow());
|
||||
TheTrsf.SetValues(AMatrix(LR,LC),AMatrix(LR,LC+1),AMatrix(LR,LC+2),AMatrix(LR,LC+3),
|
||||
AMatrix(LR+1,LC),AMatrix(LR+1,LC+1),AMatrix(LR+1,LC+2),AMatrix(LR+1,LC+3),
|
||||
AMatrix(LR+2,LC),AMatrix(LR+2,LC+1),AMatrix(LR+2,LC+2),AMatrix(LR+2,LC+3),
|
||||
Precision::Angular(),Precision::Confusion());
|
||||
Handle(Geom_Transformation) G = new Geom_Transformation(TheTrsf);
|
||||
|
||||
return myPresentation3d->Compute(aProjector,G);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
|
||||
Handle(Graphic3d_Structure)& aGivenStruct)
|
||||
{
|
||||
myPresentation3d->Compute(aProjector,aGivenStruct);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
|
||||
const TColStd_Array2OfReal& AMatrix,
|
||||
Handle(Graphic3d_Structure)& aGivenStruct)
|
||||
{
|
||||
gp_Trsf TheTrsf;
|
||||
Standard_Integer LC(AMatrix.LowerCol()),LR(AMatrix.LowerRow());
|
||||
TheTrsf.SetValues(AMatrix(LR,LC),AMatrix(LR,LC+1),AMatrix(LR,LC+2),AMatrix(LR,LC+3),
|
||||
AMatrix(LR+1,LC),AMatrix(LR+1,LC+1),AMatrix(LR+1,LC+2),AMatrix(LR+1,LC+3),
|
||||
AMatrix(LR+2,LC),AMatrix(LR+2,LC+1),AMatrix(LR+2,LC+2),AMatrix(LR+2,LC+3),
|
||||
Precision::Angular(),Precision::Confusion());
|
||||
Handle(Geom_Transformation) G = new Geom_Transformation(TheTrsf);
|
||||
|
||||
|
||||
myPresentation3d->Compute(aProjector,G,aGivenStruct);
|
||||
}
|
Reference in New Issue
Block a user