1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

0024704: Visualization - inherit OpenGl_Structure from Graphic3d_CStructure

Graphic3d_Structure - store Graphic3d_CStructure as handle.
Graphic3d_Structure class implementation clean up.
Graphic3d_Structure::SetManager() - remove unused method.
Graphic3d_GraphicDriver - move structure-related methods to Graphic3d_CStructure interface.

Remove unsupported Aspect_TOHM_BLINK value.

Remove field-duplicate OpenGl_Structure::myClipPlanes

Fixing warnings
This commit is contained in:
kgv 2014-03-13 14:35:13 +04:00 committed by bugmaster
parent 3dfe95cdb9
commit 63bcc44896
25 changed files with 2109 additions and 2339 deletions

View File

@ -453,14 +453,12 @@ is
---Category: Enumerations
enumeration TypeOfHighlightMethod is TOHM_COLOR,
TOHM_BLINK,
TOHM_BOUNDBOX
end TypeOfHighlightMethod;
---Purpose: Definition of a highlight method
--
-- TOHM_COLOR drawn in the highlight color
-- (default white)
-- TOHM_BLINK blinking
-- TOHM_BOUNDBOX enclosed by the boundary box
-- (default white)
--

View File

@ -2,6 +2,7 @@ Graphic3d_CGroup.cxx
Graphic3d_CGroup.hxx
Graphic3d_CStructure.cxx
Graphic3d_CStructure.hxx
Graphic3d_CStructure_Handle.hxx
Graphic3d_CBitFields16.cxx
Graphic3d_CBitFields16.hxx
Graphic3d_CBitFields20.cxx

View File

@ -21,7 +21,6 @@
-- 1/08/97 ; PCT : Ajout texture mapping
-- 11/97 ; CAL : retrait de la dependance avec math
-- 11/97 ; CAL : retrait des DataStructure
-- 11/97 ; CAL : ajout pointer StructPtr
-- 04/98 ; FGU : ajout champs 'TOR_EMISSION'
-- 16-09-98; BGN: (S3819) Ajout TypeOfTriedronEcho,
-- TypeOfTriedronPosition.
@ -367,6 +366,8 @@ is
---Purpose: Defines the C structure <astructure>
---Category: Imported types
imported CStructure_Handle;
imported CLight;
---Purpose: Defines the C structure <alight>
---Category: Imported types
@ -492,6 +493,8 @@ is
---Purpose: Visualiser with which the graphic objects are associated.
---Category: Classes
pointer StructureManagerPtr to StructureManager from Graphic3d;
deferred class DataStructureManager;
---Purpose: Visualiser with which the graphic objects are associated.
---Category: Classes
@ -508,13 +511,6 @@ is
---Purpose: 3d vertex
---Category: Classes
---------------------
-- Category: Pointers
---------------------
pointer StructPtr to Structure from Graphic3d;
---Category: Pointers
---------------------------------
-- Category: Instantiated classes
---------------------------------

View File

@ -223,6 +223,7 @@ is
BackMaterial ( me )
returns MaterialAspect from Graphic3d
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the surface material of internal faces
---Category: Inquire methods
@ -230,6 +231,7 @@ is
FrontMaterial ( me )
returns MaterialAspect from Graphic3d
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the surface material of external faces
---Category: Inquire methods

View File

@ -64,16 +64,14 @@ void Graphic3d_AspectFillArea3d::SetFrontMaterial (const Graphic3d_MaterialAspec
}
Graphic3d_MaterialAspect Graphic3d_AspectFillArea3d::BackMaterial () const {
return (MyBackMaterial);
const Graphic3d_MaterialAspect& Graphic3d_AspectFillArea3d::BackMaterial() const
{
return MyBackMaterial;
}
Graphic3d_MaterialAspect Graphic3d_AspectFillArea3d::FrontMaterial () const {
return (MyFrontMaterial);
const Graphic3d_MaterialAspect& Graphic3d_AspectFillArea3d::FrontMaterial() const
{
return MyFrontMaterial;
}
void Graphic3d_AspectFillArea3d::AllowBackFace () {

View File

@ -14,9 +14,52 @@
#include <Graphic3d_CStructure.hxx>
const Handle(Standard_Type)& TYPE(Graphic3d_CStructure)
#include <Graphic3d_Structure.pxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_TransModeFlags.hxx>
IMPLEMENT_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure, Standard_Transient)
//=============================================================================
//function : Graphic3d_CStructure
//purpose :
//=============================================================================
Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager)
: Id (theManager->NewIdentification()),
Priority (Structure_MAX_PRIORITY / 2),
PreviousPriority (Structure_MAX_PRIORITY / 2),
Composition (Graphic3d_TOC_REPLACE),
ContainsFacet (0),
IsInfinite (0),
stick (0),
highlight (0),
visible (1),
pick (1),
HLRValidation (0),
myGraphicDriver (theManager->GraphicDriver())
{
static Handle(Standard_Type) _atype =
new Standard_Type ("Graphic3d_CStructure", sizeof (Graphic3d_CStructure));
return _atype;
for (Standard_Integer i = 0; i <= 3; ++i)
{
for (Standard_Integer j = 0; j <= 3; ++j)
{
Transformation[i][j] = (i == j) ? 1.0f : 0.0f;
}
}
ContextLine.IsDef = 1,
ContextFillArea.IsDef = 1,
ContextMarker.IsDef = 1,
ContextText.IsDef = 1;
ContextLine.IsSet = 0,
ContextFillArea.IsSet = 0,
ContextMarker.IsSet = 0,
ContextText.IsSet = 0;
TransformPersistence.IsSet = 0;
TransformPersistence.Flag = Graphic3d_TMF_None;
TransformPersistence.Point.x = 0.0;
TransformPersistence.Point.y = 0.0;
TransformPersistence.Point.z = 0.0;
}

View File

@ -15,17 +15,67 @@
#ifndef _Graphic3d_CStructure_HeaderFile
#define _Graphic3d_CStructure_HeaderFile
#include <Graphic3d_CStructure_Handle.hxx>
#include <Graphic3d_CGroup.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_TypeOfComposition.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Standard_Transient.hxx>
#include <Handle_Graphic3d_GraphicDriver.hxx>
class Graphic3d_CStructure
class Handle(Graphic3d_StructureManager);
//! Low-level graphic structure interface
class Graphic3d_CStructure : public Standard_Transient
{
public:
int Id;
void* ptrStructure;
//! @return graphic driver created this structure
const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
{
return myGraphicDriver;
}
//! @return associated clip planes
const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
{
return myClipPlanes;
}
//! Pass clip planes to the associated graphic driver structure
void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
public:
//! Update structure visibility state
virtual void UpdateNamedStatus() = 0;
//! Clear graphic data
virtual void Clear() = 0;
//! Connect other structure to this one
virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
//! Disconnect other structure to this one
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
//! Synchronize structure aspects
virtual void UpdateAspects() = 0;
//! Synchronize structure transformation
virtual void UpdateTransformation() = 0;
//! Highlight entire structure with color
virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
const Standard_Boolean theToCreate) = 0;
//! Highlight structure using boundary box
virtual void HighlightWithBndBox (const Standard_Boolean theToCreate) = 0;
public:
int Id;
int Priority;
int PreviousPriority;
@ -37,12 +87,10 @@ public:
CALL_DEF_BOUNDBOX BoundBox;
float Transformation[4][4];
int Composition;
Graphic3d_TypeOfComposition Composition;
int ContainsFacet;
unsigned IsDeleted : 1;
unsigned IsOpen : 1;
unsigned IsInfinite : 1;
unsigned stick : 1;
unsigned highlight : 1;
@ -52,11 +100,20 @@ public:
CALL_DEF_TRANSFORM_PERSISTENCE TransformPersistence;
Graphic3d_SequenceOfHClipPlane ClipPlanes;
protected:
//! Create empty structure.
Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
protected:
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
public:
DEFINE_STANDARD_RTTI(Graphic3d_CStructure) // Type definition
};
///typedef Graphic3d_CStructure CALL_DEF_STRUCTURE;
const Handle(Standard_Type)& TYPE(Graphic3d_CStructure);
#endif // Graphic3d_CStructure_HeaderFile
#endif // _Graphic3d_CStructure_HeaderFile

View File

@ -0,0 +1,24 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_CStructure_Handle_H__
#define _Graphic3d_CStructure_Handle_H__
#include <Standard_DefineHandle.hxx>
#include <Handle_Standard_Transient.hxx>
class Graphic3d_CStructure;
DEFINE_STANDARD_HANDLE(Graphic3d_CStructure, Standard_Transient)
typedef Handle(Graphic3d_CStructure) Graphic3d_CStructure_Handle;
#endif // _Graphic3d_CStructure_Handle_H__

View File

@ -64,9 +64,11 @@ uses
CPick from Graphic3d,
CPlane from Graphic3d,
CStructure from Graphic3d,
CStructure_Handle from Graphic3d,
CView from Graphic3d,
BufferType from Graphic3d,
Structure from Graphic3d,
StructureManager from Graphic3d,
TextPath from Graphic3d,
TypeOfComposition from Graphic3d,
TypeOfPrimitive from Graphic3d,
@ -133,36 +135,6 @@ is
is deferred;
---Purpose: call_togl_inquireview
------------------------------
-- Category: Highlight methods
------------------------------
Blink ( me : mutable;
ACStructure : CStructure from Graphic3d;
Create : Boolean from Standard )
is deferred;
---Purpose: call_togl_blink
BoundaryBox ( me : mutable;
ACStructure : CStructure from Graphic3d;
Create : Boolean from Standard )
is deferred;
---Purpose: call_togl_boundarybox
HighlightColor ( me : mutable;
ACStructure : CStructure from Graphic3d;
R : ShortReal from Standard;
G : ShortReal from Standard;
B : ShortReal from Standard;
Create : Boolean from Standard )
is deferred;
---Purpose: call_togl_highlightcolor
NameSetStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_namesetstructure
-------------------------------------
-- Category: Group management methods
-------------------------------------
@ -210,50 +182,29 @@ is
-- Category: Structure management methods
-----------------------------------------
ClearStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_clearstructure
Connect ( me : mutable;
AFather : CStructure from Graphic3d;
ASon : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_connect
ContextStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_contextstructure
Disconnect ( me : mutable;
AFather : CStructure from Graphic3d;
ASon : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_disconnect
DisplayStructure ( me : mutable;
ACView : CView from Graphic3d;
ACStructure : CStructure from Graphic3d;
APriority : Integer from Standard )
DisplayStructure ( me : mutable;
theCView : CView from Graphic3d;
theCStructure : in out CStructure from Graphic3d;
thePriority : Integer from Standard )
is deferred;
---Purpose: call_togl_displaystructure
EraseStructure ( me : mutable;
ACView : CView from Graphic3d;
ACStructure : CStructure from Graphic3d )
EraseStructure ( me : mutable;
theCView : CView from Graphic3d;
theCStructure : in out CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_erasestructure
RemoveStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
theCStructure : in out CStructure_Handle from Graphic3d )
is deferred;
---Purpose: call_togl_removestructure
Structure ( me : mutable;
ACStructure : in out CStructure from Graphic3d )
Structure (me : mutable;
theManager : StructureManager from Graphic3d)
returns CStructure_Handle from Graphic3d
is deferred;
---Purpose: call_togl_structure
---Purpose: Creates new empty graphic structure
------------------------------------
-- Category: Structured mode methods
@ -348,9 +299,6 @@ is
SetClipPlanes (me : mutable; theCView : CView from Graphic3d) is deferred;
---Purpose: Pass clip planes to the associated graphic driver view.
SetClipPlanes (me : mutable; theCStructure : CStructure from Graphic3d) is deferred;
---Purpose: Pass clip planes to the associated graphic driver structure.
SetCamera (me : mutable; theCView : CView from Graphic3d)
is deferred;
---Purpose: Inform graphic driver if camera assigned to view changes.
@ -360,11 +308,6 @@ is
is deferred;
---Purpose: call_togl_setvisualisation
TransformStructure ( me : mutable;
ACStructure : CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_transformstructure
Transparency ( me : mutable;
ACView : CView from Graphic3d;
AFlag : Boolean from Standard )

View File

@ -77,7 +77,7 @@ MyListOfPArray()
MyContainsFacet = Standard_False,
MyIsEmpty = Standard_True;
MyCGroup.Struct = MyStructure->CStructure();
MyCGroup.Struct = MyStructure->CStructure().operator->();
MyCGroup.Struct->Id = int (MyStructure->Identification ());
MyCGroup.ptrGroup = NULL;

View File

@ -248,6 +248,7 @@ is
Color ( me )
returns Color from Quantity
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the ambient colour of the surface.
---Category: Inquire methods
@ -255,6 +256,7 @@ is
AmbientColor ( me )
returns Color from Quantity
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the ambient colour of the surface.
---Category: Inquire methods
@ -262,6 +264,7 @@ is
DiffuseColor ( me )
returns Color from Quantity
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the diffuse colour of the surface.
---Category: Inquire methods
@ -269,6 +272,7 @@ is
SpecularColor ( me )
returns Color from Quantity
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the specular colour of the surface.
---Category: Inquire methods
@ -276,6 +280,7 @@ is
EmissiveColor ( me )
returns Color from Quantity
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the emissive colour of the surface.
---Category: Inquire methods

View File

@ -690,32 +690,29 @@ void Graphic3d_MaterialAspect::SetTransparency (const Standard_Real AValue) {
MyTransparencyCoef = Standard_ShortReal (AValue);
}
Quantity_Color Graphic3d_MaterialAspect::Color () const {
return (MyAmbientColor);
const Quantity_Color& Graphic3d_MaterialAspect::Color() const
{
return MyAmbientColor;
}
/* Access to the color of the ambient lighting */
Quantity_Color Graphic3d_MaterialAspect::AmbientColor () const {
return (MyAmbientColor);
const Quantity_Color& Graphic3d_MaterialAspect::AmbientColor() const
{
return MyAmbientColor;
}
/* Access to the color of the dispersed lighting */
Quantity_Color Graphic3d_MaterialAspect::DiffuseColor () const {
return (MyDiffuseColor);
const Quantity_Color& Graphic3d_MaterialAspect::DiffuseColor() const
{
return MyDiffuseColor;
}
/* Access to the color of the specular lighting */
Quantity_Color Graphic3d_MaterialAspect::SpecularColor () const {
return (MySpecularColor);
const Quantity_Color& Graphic3d_MaterialAspect::SpecularColor() const
{
return MySpecularColor;
}
/* Access to the color of emission */
Quantity_Color Graphic3d_MaterialAspect::EmissiveColor () const {
return (MyEmissiveColor);
const Quantity_Color& Graphic3d_MaterialAspect::EmissiveColor() const
{
return MyEmissiveColor;
}
/* Access to the type of material */

View File

@ -53,7 +53,8 @@ uses
AspectLine3d from Graphic3d,
AspectMarker3d from Graphic3d,
AspectText3d from Graphic3d,
CStructure from Graphic3d,
CStructure from Graphic3d,
CStructure_Handle from Graphic3d,
GraphicDriver from Graphic3d,
Group from Graphic3d,
SequenceOfGroup from Graphic3d,
@ -63,6 +64,7 @@ uses
MapOfStructure from Graphic3d,
Plotter from Graphic3d,
StructureManager from Graphic3d,
StructureManagerPtr from Graphic3d,
TypeOfComposition from Graphic3d,
TypeOfConnection from Graphic3d,
TypeOfPrimitive from Graphic3d,
@ -324,15 +326,6 @@ is
-- Standard_True.
---Category: Methods to modify the class definition
SetManager ( me : mutable;
AManager : StructureManager from Graphic3d;
WithPropagation : Boolean from Standard = Standard_False)
is static;
---Level: Public
---Purpose: Moves the graphic object <me> in the manager <AManager>.
-- If <WithPropagation> is Standard_True then all the connected
-- graphic objects to <me> are moved.
SetVisual ( me : mutable;
AVisual : TypeOfStructure from Graphic3d )
is virtual;
@ -463,6 +456,7 @@ is
HighlightColor ( me )
returns Color from Quantity
is static;
---C++: return const&
---Level: Public
---Purpose: Returns the highlight color for the Highlight method
-- with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
@ -996,13 +990,11 @@ is
---Purpose: Updates the c structure associated to <me>.
---Category: Private methods
CStructure ( me : mutable )
returns CStructure from Graphic3d
is static;
---Level: Internal
---Purpose: Returns the c structure associated to <me>.
---Category: Private methods
---C++: return *
CStructure (me)
returns CStructure_Handle from Graphic3d
is static;
---Purpose: Returns the c structure associated to <me>.
---C++: return const &
fields
@ -1015,33 +1007,30 @@ fields
-- It is a sequence of groups of primitives.
--
-- the associated C structure
MyCStructure : CStructure from Graphic3d;
-- the associated low-level structure
myCStructure : CStructure_Handle from Graphic3d;
-- the structures to which the structure is attached
MyAncestors : SequenceOfAddress from TColStd;
myAncestors : SequenceOfAddress from TColStd;
-- the structures attached to the structure
MyDescendants : SequenceOfAddress from TColStd;
myDescendants : SequenceOfAddress from TColStd;
-- the sequence of groups
MyGroups : SequenceOfGroup from Graphic3d;
-- the graphic driver used
MyGraphicDriver : GraphicDriver from Graphic3d;
myGroups : SequenceOfGroup from Graphic3d;
-- the highlight method of the structure
MyHighlightColor : Color from Quantity;
MyHighlightMethod : TypeOfHighlightMethod from Aspect;
myHighlightColor : Color from Quantity;
myHighlightMethod : TypeOfHighlightMethod from Aspect;
-- the manager accepting the structure
MyPtrStructureManager : Address from Standard is protected;
MyFirstPtrStructureManager : Address from Standard is protected;
MyOwner : Address from Standard;
myStructureManager : StructureManagerPtr from Graphic3d is protected;
myFirstStructureManager : StructureManagerPtr from Graphic3d is protected;
myOwner : Address from Standard;
-- the type of visualisation accepted by the structure
MyVisual : TypeOfStructure from Graphic3d;
MyComputeVisual : TypeOfStructure from Graphic3d is protected;
myVisual : TypeOfStructure from Graphic3d;
myComputeVisual : TypeOfStructure from Graphic3d is protected;
friends

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,4 @@
#include <Graphic3d_Group.pxx>
#define MyStructureManager ((Graphic3d_StructureManager*) MyPtrStructureManager)
#define MyFirstStructureManager ((Graphic3d_StructureManager*) MyFirstPtrStructureManager)
#endif

View File

@ -426,11 +426,9 @@ is
NewIdentification ( me : mutable )
returns Integer from Standard
is static private;
is static;
---Level: Internal
---Purpose: Returns a new identification number for a new structure
-- in the manager.
---Category: Private methods
---Purpose: Returns a new identification number for a new structure in the manager.
Remove ( me : mutable;
AnId : Integer from Standard )

View File

@ -278,12 +278,7 @@ void OpenGl_GraphicDriver::ClearImmediatMode (const Graphic3d_CView& theCView,
// =======================================================================
void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& theCStructure)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
{
return;
}
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (!myImmediateWS.IsNull())
{
myImmediateWS->DrawStructure (aStructure);

View File

@ -107,10 +107,6 @@ public:
Standard_EXPORT Standard_Integer InquireLightLimit ();
Standard_EXPORT Standard_Integer InquireViewLimit ();
Standard_EXPORT void Blink (const Graphic3d_CStructure& ACStructure,const Standard_Boolean Create);
Standard_EXPORT void BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create);
Standard_EXPORT void HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create);
Standard_EXPORT void NameSetStructure (const Graphic3d_CStructure& ACStructure);
public: // Methods for graphical groups
@ -128,19 +124,13 @@ public: // Methods for graphical groups
public: // Methods for graphical structures
Standard_EXPORT void ClearStructure (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void ContextStructure (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void Connect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon);
Standard_EXPORT void Disconnect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon);
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority);
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void RemoveStructure (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void Structure (Graphic3d_CStructure& theCStructure);
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority);
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure);
Standard_EXPORT void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure);
Standard_EXPORT Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager);
public:
@ -159,10 +149,8 @@ public:
Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
Standard_EXPORT void SetLight (const Graphic3d_CView& ACView);
Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
Standard_EXPORT void SetClipPlanes (const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView);
Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure);
Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer);
Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
@ -336,8 +324,6 @@ public:
Standard_EXPORT Standard_Boolean GetOpenClDeviceInfo (const Graphic3d_CView& theCView,
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theInfo);
private:
//! Method to retrieve valid GL context.
//! Could return NULL-handle if no window created by this driver.
Standard_EXPORT const Handle(OpenGl_Context)& GetSharedContext() const;

View File

@ -39,8 +39,8 @@ void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
if (aStructure)
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
if (aStructure != NULL)
{
theCGroup.ptrGroup = aStructure->AddGroup();
}
@ -64,7 +64,7 @@ void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup
void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
if (aStructure == NULL)
return;

View File

@ -19,102 +19,47 @@
#include <OpenGl_Structure.hxx>
#include <OpenGl_CView.hxx>
void OpenGl_GraphicDriver::ClearStructure (const Graphic3d_CStructure& theCStructure)
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
aStructure->Clear (GetSharedContext());
}
void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& theCStructure)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
aStructure->SetTransformPersistence (theCStructure.TransformPersistence);
if (theCStructure.ContextLine.IsDef)
aStructure->SetAspectLine (theCStructure.ContextLine);
if (theCStructure.ContextFillArea.IsDef)
aStructure->SetAspectFace (theCStructure.ContextFillArea);
if (theCStructure.ContextMarker.IsDef)
aStructure->SetAspectMarker (theCStructure.ContextMarker);
if (theCStructure.ContextText.IsDef)
aStructure->SetAspectText (theCStructure.ContextText);
}
void OpenGl_GraphicDriver::Connect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon)
{
OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure;
OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure;
if (aFather && aSon)
aFather->Connect(aSon);
}
void OpenGl_GraphicDriver::Disconnect (const Graphic3d_CStructure& theFather,
const Graphic3d_CStructure& theSon)
{
OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure;
OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure;
if (aFather && aSon)
aFather->Disconnect(aSon);
}
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority)
{
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aCView == NULL || aStructure == NULL)
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL)
return;
aCView->View->DisplayStructure (aStructure, thePriority);
}
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure)
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure)
{
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL || aStructure == NULL)
return;
aCView->View->EraseStructure (aStructure);
}
void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& theCStructure)
void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
{
if (!myMapOfStructure.IsBound (theCStructure.Id))
OpenGl_Structure* aStructure = NULL;
if (!myMapOfStructure.Find (theCStructure->Id, aStructure))
{
return;
}
OpenGl_Structure* aStructure = myMapOfStructure.Find (theCStructure.Id);
myMapOfStructure.UnBind (theCStructure.Id);
Graphic3d_CStructure& aCStruct = const_cast<Graphic3d_CStructure&>(theCStructure);
aCStruct.ptrStructure = 0;
OpenGl_Element::Destroy (GetSharedContext(), aStructure);
myMapOfStructure.UnBind (theCStructure->Id);
aStructure->Release (GetSharedContext());
theCStructure.Nullify();
}
void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& theCStructure)
Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::Structure (const Handle(Graphic3d_StructureManager)& theManager)
{
RemoveStructure (theCStructure);
OpenGl_Structure* aStructure = new OpenGl_Structure();
Standard_Integer aStatus = 0;
if (theCStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
if (!theCStructure.visible) aStatus |= OPENGL_NS_HIDE;
aStructure->SetNamedStatus (aStatus);
theCStructure.ptrStructure = aStructure;
myMapOfStructure.Bind (theCStructure.Id, aStructure);
Handle(OpenGl_Structure) aStructure = new OpenGl_Structure (theManager);
myMapOfStructure.Bind (aStructure->Id, aStructure.operator->());
return aStructure;
}
//=======================================================================

View File

@ -59,52 +59,6 @@ void OpenGl_GraphicDriver::GradientBackground (const Graphic3d_CView& ACView,
}
}
void OpenGl_GraphicDriver::Blink (const Graphic3d_CStructure &, const Standard_Boolean)
{
// Do nothing
}
void OpenGl_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& theCStructure,
const Standard_Boolean toCreate)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
if (toCreate)
aStructure->SetHighlightBox (GetSharedContext(), theCStructure.BoundBox);
else
aStructure->ClearHighlightBox (GetSharedContext());
}
void OpenGl_GraphicDriver::HighlightColor (const Graphic3d_CStructure& theCStructure,
const Standard_ShortReal R,
const Standard_ShortReal G,
const Standard_ShortReal B,
const Standard_Boolean toCreate)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
if (aStructure == NULL)
return;
if (toCreate)
aStructure->SetHighlightColor (GetSharedContext(), R, G, B);
else
aStructure->ClearHighlightColor (GetSharedContext());
}
void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStructure)
{
OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
if (astructure)
{
Standard_Integer aStatus = 0;
if (ACStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
if (!ACStructure.visible) aStatus |= OPENGL_NS_HIDE;
astructure->SetNamedStatus( aStatus );
}
}
void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
@ -457,15 +411,6 @@ void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CView& theCView)
}
}
void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CStructure& theCStructure)
{
OpenGl_Structure* aStructure = (OpenGl_Structure *)theCStructure.ptrStructure;
if (aStructure)
{
aStructure->SetClipPlanes (theCStructure.ClipPlanes);
}
}
//=======================================================================
//function : SetCamera
//purpose :
@ -489,13 +434,6 @@ void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView)
}
}
void OpenGl_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ACStructure)
{
OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
if (astructure)
astructure->SetTransformation(&(ACStructure.Transformation[0][0]));
}
void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
{
const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;

View File

@ -17,10 +17,10 @@
#include <config.h>
#endif
#include <OpenGl_CappingAlgo.hxx>
#include <OpenGl_Context.hxx>
#include <OpenGl_GlCore11.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OpenGl_ShaderManager.hxx>
#include <OpenGl_ShaderProgram.hxx>
#include <OpenGl_Structure.hxx>
@ -31,6 +31,9 @@
#include <Graphic3d_SequenceOfHClipPlane_Handle.hxx>
IMPLEMENT_STANDARD_HANDLE (OpenGl_Structure, Graphic3d_CStructure)
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Structure, Graphic3d_CStructure)
//! Auxiliary class for bounding box presentation
class OpenGl_BndBoxPrs : public OpenGl_Element
{
@ -132,8 +135,9 @@ static void call_util_transpose_mat (float tmat[16], float mat[4][4])
// function : OpenGl_Structure
// purpose :
// =======================================================================
OpenGl_Structure::OpenGl_Structure ()
: myTransformation(NULL),
OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
: Graphic3d_CStructure (theManager),
myTransformation(NULL),
myTransPers(NULL),
myAspectLine(NULL),
myAspectFace(NULL),
@ -144,6 +148,7 @@ OpenGl_Structure::OpenGl_Structure ()
myNamedStatus(0),
myZLayer(0)
{
UpdateNamedStatus();
#if HAVE_OPENCL
myIsRaytracable = Standard_False;
myModificationState = 0;
@ -162,17 +167,38 @@ OpenGl_Structure::~OpenGl_Structure()
}
// =======================================================================
// function : SetTransformation
// function : UpdateAspects
// purpose :
// =======================================================================
void OpenGl_Structure::SetTransformation (const float *theMatrix)
void OpenGl_Structure::UpdateAspects()
{
if (!myTransformation)
SetTransformPersistence (TransformPersistence);
if (ContextLine.IsDef)
SetAspectLine (ContextLine);
if (ContextFillArea.IsDef)
SetAspectFace (ContextFillArea);
if (ContextMarker.IsDef)
SetAspectMarker (ContextMarker);
if (ContextText.IsDef)
SetAspectText (ContextText);
}
// =======================================================================
// function : UpdateTransformation
// purpose :
// =======================================================================
void OpenGl_Structure::UpdateTransformation()
{
if (myTransformation == NULL)
{
myTransformation = new OpenGl_Matrix();
}
matcpy (myTransformation->mat, theMatrix);
matcpy (myTransformation->mat, &Graphic3d_CStructure::Transformation[0][0]);
#ifdef HAVE_OPENCL
if (myIsRaytracable)
@ -298,14 +324,39 @@ void OpenGl_Structure::ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx
}
}
// =======================================================================
// function : HighlightWithColor
// purpose :
// =======================================================================
void OpenGl_Structure::HighlightWithColor (const Graphic3d_Vec3& theColor,
const Standard_Boolean theToCreate)
{
const Handle(OpenGl_Context)& aCtx = GlDriver()->GetSharedContext();
if (theToCreate)
SetHighlightColor (aCtx, theColor);
else
ClearHighlightColor (aCtx);
}
// =======================================================================
// function : HighlightWithBndBox
// purpose :
// =======================================================================
void OpenGl_Structure::HighlightWithBndBox (const Standard_Boolean theToCreate)
{
const Handle(OpenGl_Context)& aCtx = GlDriver()->GetSharedContext();
if (theToCreate)
SetHighlightBox (aCtx, BoundBox);
else
ClearHighlightBox (aCtx);
}
// =======================================================================
// function : SetHighlightColor
// purpose :
// =======================================================================
void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
const Standard_ShortReal R,
const Standard_ShortReal G,
const Standard_ShortReal B)
const Graphic3d_Vec3& theColor)
{
ClearHighlightBox (theGlCtx);
if (myHighlightColor == NULL)
@ -313,9 +364,9 @@ void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx
myHighlightColor = new TEL_COLOUR();
}
myHighlightColor->rgb[0] = R;
myHighlightColor->rgb[1] = G;
myHighlightColor->rgb[2] = B;
myHighlightColor->rgb[0] = theColor.r();
myHighlightColor->rgb[1] = theColor.g();
myHighlightColor->rgb[2] = theColor.b();
myHighlightColor->rgb[3] = 1.F;
}
@ -331,12 +382,14 @@ void OpenGl_Structure::ClearHighlightColor (const Handle(OpenGl_Context)& theGlC
}
// =======================================================================
// function : SetNamedStatus
// function : UpdateNamedStatus
// purpose :
// =======================================================================
void OpenGl_Structure::SetNamedStatus (const Standard_Integer aStatus)
void OpenGl_Structure::UpdateNamedStatus()
{
myNamedStatus = aStatus;
myNamedStatus = 0;
if (highlight) myNamedStatus |= OPENGL_NS_HIGHLIGHT;
if (!visible) myNamedStatus |= OPENGL_NS_HIDE;
#ifdef HAVE_OPENCL
if (myIsRaytracable)
@ -456,19 +509,20 @@ void OpenGl_Structure::SetRaytracableWithAncestorStructures() const
// function : Connect
// purpose :
// =======================================================================
void OpenGl_Structure::Connect (const OpenGl_Structure *theStructure)
void OpenGl_Structure::Connect (Graphic3d_CStructure& theStructure)
{
OpenGl_Structure* aStruct = (OpenGl_Structure* )&theStructure;
Disconnect (theStructure);
myConnected.Append (theStructure);
myConnected.Append (aStruct);
#ifdef HAVE_OPENCL
if (theStructure->IsRaytracable())
if (aStruct->IsRaytracable())
{
UpdateStateWithAncestorStructures();
SetRaytracableWithAncestorStructures();
}
theStructure->RegisterAncestorStructure (this);
aStruct->RegisterAncestorStructure (this);
#endif
}
@ -476,29 +530,27 @@ void OpenGl_Structure::Connect (const OpenGl_Structure *theStructure)
// function : Disconnect
// purpose :
// =======================================================================
void OpenGl_Structure::Disconnect (const OpenGl_Structure *theStructure)
void OpenGl_Structure::Disconnect (Graphic3d_CStructure& theStructure)
{
OpenGl_ListOfStructure::Iterator its (myConnected);
while (its.More())
OpenGl_Structure* aStruct = (OpenGl_Structure* )&theStructure;
for (OpenGl_ListOfStructure::Iterator anIter (myConnected); anIter.More(); anIter.Next())
{
// Check for the given structure
if (its.Value() == theStructure)
if (anIter.Value() == aStruct)
{
myConnected.Remove (its);
myConnected.Remove (anIter);
#ifdef HAVE_OPENCL
if (theStructure->IsRaytracable())
if (aStruct->IsRaytracable())
{
UpdateStateWithAncestorStructures();
UpdateRaytracableWithAncestorStructures();
}
theStructure->UnregisterAncestorStructure (this);
aStruct->UnregisterAncestorStructure (this);
#endif
return;
}
its.Next();
}
}
@ -548,6 +600,15 @@ void OpenGl_Structure::RemoveGroup (const Handle(OpenGl_Context)& theGlCtx,
}
}
// =======================================================================
// function : Clear
// purpose :
// =======================================================================
void OpenGl_Structure::Clear()
{
Clear (GlDriver()->GetSharedContext());
}
// =======================================================================
// function : Clear
// purpose :

View File

@ -16,8 +16,8 @@
#ifndef OpenGl_Structure_Header
#define OpenGl_Structure_Header
#include <NCollection_List.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <Graphic3d_CStructure.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <OpenGl_AspectLine.hxx>
#include <OpenGl_AspectFace.hxx>
@ -28,21 +28,55 @@
#include <OpenGl_Matrix.hxx>
#include <OpenGl_NamedStatus.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <NCollection_List.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class OpenGl_Structure;
class OpenGl_GraphicDriver;
typedef NCollection_List<const OpenGl_Structure* > OpenGl_ListOfStructure;
class OpenGl_Structure : public OpenGl_Element
class OpenGl_Structure : public Graphic3d_CStructure
{
friend class OpenGl_Group;
public:
OpenGl_Structure();
//! Create empty structure
OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
void SetTransformation (const float *AMatrix);
//! Setup structure graphic state
virtual void UpdateNamedStatus();
//! Clear graphic data
virtual void Clear();
//! Connect other structure to this one
virtual void Connect (Graphic3d_CStructure& theStructure);
//! Disconnect other structure to this one
virtual void Disconnect (Graphic3d_CStructure& theStructure);
//! Synchronize structure aspects
virtual void UpdateAspects();
//! Synchronize structure transformation
virtual void UpdateTransformation();
//! Highlight entire structure with color
virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
const Standard_Boolean theToCreate);
//! Highlight structure using boundary box
virtual void HighlightWithBndBox (const Standard_Boolean theToCreate);
public:
//! Access graphic driver
OpenGl_GraphicDriver* GlDriver() const
{
return (OpenGl_GraphicDriver* )myGraphicDriver.operator->();
}
void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers);
@ -57,21 +91,12 @@ public:
void ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
void SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
const Standard_ShortReal R,
const Standard_ShortReal G,
const Standard_ShortReal B);
const Graphic3d_Vec3& theColor);
void ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
void SetNamedStatus (const Standard_Integer aStatus);
Standard_Boolean IsVisible() const { return !(myNamedStatus & OPENGL_NS_HIDE); }
void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
void Connect (const OpenGl_Structure *astructure);
void Disconnect (const OpenGl_Structure *astructure);
OpenGl_Group* AddGroup();
void RemoveGroup (const Handle(OpenGl_Context)& theGlCtx,
const OpenGl_Group* theGroup);
@ -150,24 +175,21 @@ protected:
protected:
//Structure_LABBegin
OpenGl_Matrix* myTransformation;
TEL_TRANSFORM_PERSISTENCE* myTransPers;
OpenGl_AspectLine* myAspectLine;
OpenGl_AspectFace* myAspectFace;
OpenGl_AspectMarker* myAspectMarker;
OpenGl_AspectText* myAspectText;
//Structure_LABHighlight
OpenGl_Group* myHighlightBox;
TEL_COLOUR* myHighlightColor;
//Structure_LABVisibility
//Structure_LABPick
int myNamedStatus; //Structure_LABNameSet
int myNamedStatus;
int myZLayer;
OpenGl_ListOfStructure myConnected;
OpenGl_ListOfGroup myGroups;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
#ifdef HAVE_OPENCL
mutable OpenGl_ListOfStructure myAncestorStructures;
@ -177,8 +199,10 @@ protected:
public:
DEFINE_STANDARD_ALLOC
DEFINE_STANDARD_RTTI(OpenGl_Structure) // Type definition
};
#endif //OpenGl_Structure_Header
DEFINE_STANDARD_HANDLE(OpenGl_Structure, Graphic3d_CStructure)
#endif // OpenGl_Structure_Header

View File

@ -1209,17 +1209,11 @@ Standard_Integer Index = IsComputed (AStructure);
<< ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush;
#endif
MyGraphicDriver->EraseStructure
(MyCView,
*(Graphic3d_CStructure *)
MyCOMPUTEDSequence.Value (Index)->CStructure ());
MyGraphicDriver->DisplayStructure
(MyCView,
*(Graphic3d_CStructure *)
MyCOMPUTEDSequence.Value (Index)->CStructure (),
int (NewPriority));
MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), NewPriority);
}
else {
else
{
#ifdef TRACE
Standard_Integer StructId = AStructure->Identification ();
cout << "Visual3d_View" << MyCView.ViewId << "::ChangeDisplayPriority ("
@ -1227,13 +1221,8 @@ Standard_Integer Index = IsComputed (AStructure);
<< ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush;
#endif
MyGraphicDriver->EraseStructure
(MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure ());
MyGraphicDriver->DisplayStructure
(MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure (),
int (NewPriority));
MyGraphicDriver->EraseStructure (MyCView, *(AStructure->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(AStructure->CStructure()), NewPriority);
}
}
@ -1361,11 +1350,7 @@ Standard_Integer Index = IsComputed (AStructure);
if (Answer == Visual3d_TOA_YES ) {
if (IsDisplayed (AStructure)) return;
MyGraphicDriver->DisplayStructure (
MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure (),
int (AStructure->DisplayPriority ())
);
MyGraphicDriver->DisplayStructure (MyCView, *(AStructure->CStructure()), AStructure->DisplayPriority());
MyDisplayedStructure.Add (AStructure);
if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
}
@ -1381,11 +1366,7 @@ Standard_Integer OldStructId =
// to be displayed
if (! IsDisplayed (AStructure)) {
MyDisplayedStructure.Add (AStructure);
MyGraphicDriver->DisplayStructure (
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure (),
int (AStructure->DisplayPriority ())
);
MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), AStructure->DisplayPriority ());
if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
}
return;
@ -1409,11 +1390,7 @@ Standard_Integer OldStructId =
OldStructId = MyCOMPUTEDSequence.Value (NewIndex)->
Identification ();
MyDisplayedStructure.Add (AStructure);
MyGraphicDriver->DisplayStructure (
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (NewIndex)->CStructure (),
int (AStructure->DisplayPriority ())
);
MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (NewIndex)->CStructure()), AStructure->DisplayPriority ());
if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
}
return;
@ -1423,10 +1400,7 @@ Standard_Integer OldStructId =
else {
// COMPUTED is removed if displayed
if (IsDisplayed (AStructure))
MyGraphicDriver->EraseStructure (
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure ()
);
MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
}
}
} // if (Index != 0)
@ -1504,11 +1478,7 @@ Standard_Boolean ComputeShading = ((ViewType == Visual3d_TOV_SHADING) &&
if (Answer != Visual3d_TOA_NO) {
if (! IsDisplayed (AStructure))
MyDisplayedStructure.Add (AStructure);
MyGraphicDriver->DisplayStructure (
MyCView,
*(Graphic3d_CStructure *)TheStructure->CStructure (),
int (AStructure->DisplayPriority ())
);
MyGraphicDriver->DisplayStructure (MyCView, *(TheStructure->CStructure()), AStructure->DisplayPriority ());
if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
}
} // Visual3d_TOA_COMPUTE
@ -1539,10 +1509,7 @@ Visual3d_TypeOfAnswer Answer = AcceptDisplay (AStructure);
}
if (Answer != Visual3d_TOA_COMPUTE) {
MyGraphicDriver->EraseStructure (
MyCView,
*(Graphic3d_CStructure *)AStructure->CStructure ()
);
MyGraphicDriver->EraseStructure (MyCView, *(AStructure->CStructure()));
}
if (Answer == Visual3d_TOA_COMPUTE) {
@ -1565,8 +1532,7 @@ Standard_Integer Index = IsComputed (AStructure);
<< StructId << " is removed. \n";
cout << flush;
#endif
MyGraphicDriver->EraseStructure
(MyCView, *(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure ());
MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
}
// else is impossible
}
@ -2189,14 +2155,8 @@ Standard_Boolean ComputeShading = ((ViewType == Visual3d_TOV_SHADING) &&
NewStructId = TheStructure->Identification ();
// The previous calculation is removed and the new one is dislayed
MyGraphicDriver->EraseStructure (
MyCView,
*(Graphic3d_CStructure *)MyCOMPUTEDSequence.Value (Index)->CStructure ());
MyGraphicDriver->DisplayStructure (
MyCView,
*(Graphic3d_CStructure *)TheStructure->CStructure (),
int (AStructure->DisplayPriority ())
);
MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(TheStructure->CStructure()), AStructure->DisplayPriority());
#ifdef TRACE_LENGTH
if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) {
@ -2645,17 +2605,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode )
StructId = MyCOMPUTEDSequence.Value ( Index ) -> Identification ();
MyGraphicDriver -> EraseStructure (
MyCView,
*( Graphic3d_CStructure* )
MyCOMPUTEDSequence.Value ( Index ) -> CStructure ()
);
MyGraphicDriver -> DisplayStructure (
MyCView,
*( Graphic3d_CStructure* )
S1Iterator.Key () -> CStructure (),
int ( S1Iterator.Key () -> DisplayPriority () )
);
MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(S1Iterator.Key()->CStructure()), S1Iterator.Key()->DisplayPriority());
} // end if ( Index != 0 ) . . .
} // end if ( Answer . . . )
@ -2678,17 +2629,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode )
StructId = MyCOMPUTEDSequence.Value ( Index ) -> Identification ();
MyGraphicDriver -> EraseStructure (
MyCView,
*( Graphic3d_CStructure* )
S1Iterator.Key () -> CStructure ()
);
MyGraphicDriver -> DisplayStructure (
MyCView,
*( Graphic3d_CStructure* )
MyCOMPUTEDSequence.Value ( Index ) -> CStructure (),
int ( S1Iterator.Key () -> DisplayPriority () )
);
MyGraphicDriver->EraseStructure (MyCView, *(S1Iterator.Key()->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), S1Iterator.Key()->DisplayPriority());
Display ( S1Iterator.Key (), Aspect_TOU_WAIT );
@ -2800,16 +2742,8 @@ void Visual3d_View :: SetComputedMode ( const Standard_Boolean aMode )
} // end else
MyGraphicDriver -> EraseStructure (
MyCView,
*( Graphic3d_CStructure* )
S1Iterator.Key () -> CStructure ()
);
MyGraphicDriver -> DisplayStructure (
MyCView,
*( Graphic3d_CStructure* )TheStructure -> CStructure (),
int ( S1Iterator.Key () -> DisplayPriority () )
);
MyGraphicDriver->EraseStructure (MyCView, *(S1Iterator.Key()->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(TheStructure->CStructure()), S1Iterator.Key()->DisplayPriority());
} // end else
} // end if
@ -2988,6 +2922,5 @@ void Visual3d_View::RemoveZLayer (const Standard_Integer theLayerId)
void Visual3d_View::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer theLayerId)
{
MyGraphicDriver->ChangeZLayer (
(*(Graphic3d_CStructure*)theStructure->CStructure()), MyCView, theLayerId);
MyGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), MyCView, theLayerId);
}

View File

@ -747,8 +747,7 @@ void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theS
}
// tell graphic driver to update the structure's display layer
MyGraphicDriver->ChangeZLayer (
(*(Graphic3d_CStructure*)theStructure->CStructure ()), theLayerId);
MyGraphicDriver->ChangeZLayer (*(theStructure->CStructure()), theLayerId);
}
//=======================================================================
@ -758,10 +757,7 @@ void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theS
Standard_Integer Visual3d_ViewManager::GetZLayer (const Handle(Graphic3d_Structure)& theStructure) const
{
Graphic3d_CStructure& aStructure =
(*(Graphic3d_CStructure*)theStructure->CStructure ());
return MyGraphicDriver->GetZLayer (aStructure);
return MyGraphicDriver->GetZLayer (*theStructure->CStructure ());
}
//=======================================================================