mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0024752: Visualization - inherit OpenGl_Group from Graphic3d_Group
Graphic3d_Group is now abstract class and should be instantiated using Graphic3d_Structure::NewGroup() method. Graphic3d_CGroup has been removed. The groups list is no more duplicated within Graphic3d_Structure and OpenGl_Structure. Removed unused/duplicated fields from Graphic3d_Group. Prs3d_Presentation - remove redundnant field myCurrentGroup. PrsMgr_Presentation3d::Erase(), ::Clear() - avoid possible NULL dereference. OpenGl_GraphicDriver/Graphic3d_GraphicDriver - group management methods have been removed (moved to Graphic3d_CStructure and Graphic3d_Group interfaces). Graphic3d_Group::GroupPrimitivesAspect() - copy IsEmission flag Fix wrong iterator Fix compilation issues
This commit is contained in:
parent
6b1fe48c8a
commit
b64d84be99
@ -727,20 +727,23 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
|
||||
// Workaround for issue 23115: Need to update also groups, because their
|
||||
// face aspect ALWAYS overrides the structure's.
|
||||
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
|
||||
Standard_Integer aGroupIndex = 1, aGroupNb = aGroups.Length();
|
||||
for ( ; aGroupIndex <= aGroupNb; aGroupIndex++ ) {
|
||||
Handle(Graphic3d_Group) aGrp = aGroups.Value(aGroupIndex);
|
||||
if ( !aGrp.IsNull() && aGrp->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA) ) {
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAsp = new Graphic3d_AspectFillArea3d();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAsp = new Graphic3d_AspectLine3d();
|
||||
Handle(Graphic3d_AspectMarker3d) aPntAsp = new Graphic3d_AspectMarker3d();
|
||||
Handle(Graphic3d_AspectText3d) aTextAsp = new Graphic3d_AspectText3d();
|
||||
// TODO: Add methods for retrieving individual aspects from Graphic3d_Group
|
||||
aGrp->GroupPrimitivesAspect(aLineAsp, aTextAsp, aPntAsp, aFaceAsp);
|
||||
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
|
||||
// TODO: Issue 23118 - This line kills texture data in the group...
|
||||
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
|
||||
if (aGrp.IsNull()
|
||||
|| !aGrp->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) aFaceAsp = new Graphic3d_AspectFillArea3d();
|
||||
Handle(Graphic3d_AspectLine3d) aLineAsp = new Graphic3d_AspectLine3d();
|
||||
Handle(Graphic3d_AspectMarker3d) aPntAsp = new Graphic3d_AspectMarker3d();
|
||||
Handle(Graphic3d_AspectText3d) aTextAsp = new Graphic3d_AspectText3d();
|
||||
// TODO: Add methods for retrieving individual aspects from Graphic3d_Group
|
||||
aGrp->GroupPrimitivesAspect(aLineAsp, aTextAsp, aPntAsp, aFaceAsp);
|
||||
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
|
||||
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
Graphic3d_CGroup.cxx
|
||||
Graphic3d_CGroup.hxx
|
||||
Graphic3d_CAspectFillArea.hxx
|
||||
Graphic3d_CAspectLine.hxx
|
||||
Graphic3d_CAspectMarker.hxx
|
||||
Graphic3d_CAspectText.hxx
|
||||
Graphic3d_CStructure.cxx
|
||||
Graphic3d_CStructure.hxx
|
||||
Graphic3d_CStructure_Handle.hxx
|
||||
@ -25,12 +27,7 @@ Graphic3d_CView.cxx
|
||||
Graphic3d_CView.hxx
|
||||
Graphic3d_CGraduatedTrihedron.cxx
|
||||
Graphic3d_CGraduatedTrihedron.hxx
|
||||
Graphic3d_Structure.pxx
|
||||
Graphic3d_Group.pxx
|
||||
Graphic3d_Group_1.cxx
|
||||
Graphic3d_Group_2.cxx
|
||||
Graphic3d_Group_8.cxx
|
||||
Graphic3d_Group_10.cxx
|
||||
Graphic3d_Structure.lxx
|
||||
Graphic3d_Structure.pxx
|
||||
Graphic3d_ShaderObject.hxx
|
||||
Graphic3d_ShaderObject.cxx
|
||||
@ -49,7 +46,6 @@ Graphic3d.edl
|
||||
Graphic3d_CMPLRS.edl
|
||||
Graphic3d_WOKSteps.edl
|
||||
Graphic3d_PrimitiveArray.hxx
|
||||
Graphic3d_Group_13.cxx
|
||||
Graphic3d_TransModeFlags.hxx
|
||||
Graphic3d_CTransPersStruct.hxx
|
||||
Graphic3d_CTransPersStruct.cxx
|
||||
@ -71,6 +67,7 @@ Graphic3d_MarkerImage_Handle.hxx
|
||||
Graphic3d_ClipPlane.hxx
|
||||
Graphic3d_ClipPlane.cxx
|
||||
Graphic3d_ClipPlane_Handle.hxx
|
||||
Graphic3d_SequenceOfGroup.hxx
|
||||
Graphic3d_SequenceOfHClipPlane.hxx
|
||||
Graphic3d_SequenceOfHClipPlane_Handle.hxx
|
||||
Graphic3d_Camera.cxx
|
||||
|
@ -94,9 +94,6 @@ is
|
||||
exception MaterialDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception PickIdDefinitionError inherits OutOfRange;
|
||||
---Category: Exceptions
|
||||
|
||||
exception PlotterDefinitionError inherits OutOfRange;
|
||||
---Category: The exceptions
|
||||
|
||||
@ -358,14 +355,17 @@ is
|
||||
---Purpose: Defines the C structure
|
||||
---Category: Imported types
|
||||
|
||||
imported CGroup;
|
||||
---Purpose: Defines the C structure <agroup>
|
||||
---Category: Imported types
|
||||
imported CAspectFillArea;
|
||||
imported CAspectMarker;
|
||||
imported CAspectLine;
|
||||
imported CAspectText;
|
||||
|
||||
imported CStructure;
|
||||
---Purpose: Defines the C structure <astructure>
|
||||
---Category: Imported types
|
||||
|
||||
pointer CStructurePtr to CStructure from Graphic3d;
|
||||
|
||||
imported CStructure_Handle;
|
||||
|
||||
imported CLight;
|
||||
@ -474,7 +474,7 @@ is
|
||||
---Purpose: Grouping text attributes.
|
||||
---Category: Classes
|
||||
|
||||
class Group;
|
||||
deferred class Group;
|
||||
---Purpose: For grouping together primitives in a structure
|
||||
---Category: Classes
|
||||
|
||||
@ -486,6 +486,8 @@ is
|
||||
---Purpose: Graphic object.
|
||||
---Category: Classes
|
||||
|
||||
pointer StructurePtr to Structure from Graphic3d;
|
||||
|
||||
deferred class GraphicDriver;
|
||||
---Purpose: Defines a graphic driver for 3d interface
|
||||
|
||||
@ -524,23 +526,8 @@ is
|
||||
(Address from Standard);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SetOfGroup instantiates
|
||||
Set from TCollection (Group from Graphic3d);
|
||||
---Category: Instantiated classes
|
||||
imported SequenceOfGroup;
|
||||
|
||||
class HSetOfGroup instantiates
|
||||
HSet from TCollection
|
||||
(Group from Graphic3d, SetOfGroup);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class SequenceOfGroup instantiates
|
||||
Sequence from TCollection (Group from Graphic3d);
|
||||
|
||||
---Category: Instantiated classes
|
||||
|
||||
class HSequenceOfGroup instantiates
|
||||
HSequence from TCollection
|
||||
(Group from Graphic3d, SequenceOfGroup from Graphic3d);
|
||||
---Category: Instantiated classes
|
||||
|
||||
class MapOfStructure instantiates
|
||||
|
@ -80,6 +80,11 @@ is
|
||||
--- default type of marker.
|
||||
---C++: return const &
|
||||
|
||||
SetMarkerImage (me : mutable;
|
||||
theImage : MarkerImage_Handle from Graphic3d);
|
||||
---Level: Public
|
||||
---Purpose: Set marker's image texture.
|
||||
|
||||
SetBitMap (me: mutable;
|
||||
theWidth : Integer from Standard;
|
||||
theHeight : Integer from Standard;
|
||||
|
@ -84,6 +84,15 @@ const Handle(Graphic3d_MarkerImage)& Graphic3d_AspectMarker3d::GetMarkerImage()
|
||||
return myMarkerImage;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetMarkerImage
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage)
|
||||
{
|
||||
myMarkerImage = theImage;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetBitMap
|
||||
// purpose :
|
||||
|
@ -12,23 +12,19 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_CGroup_HeaderFile
|
||||
#define _Graphic3d_CGroup_HeaderFile
|
||||
#ifndef _Graphic3d_CAspectFillArea_HeaderFile
|
||||
#define _Graphic3d_CAspectFillArea_HeaderFile
|
||||
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
#include <Graphic3d_CTexture.hxx>
|
||||
#include <Graphic3d_MarkerImage_Handle.hxx>
|
||||
#include <Graphic3d_ShaderProgram_Handle.hxx>
|
||||
|
||||
class Graphic3d_CStructure;
|
||||
|
||||
class CALL_DEF_CONTEXTFILLAREA
|
||||
class Graphic3d_CAspectFillArea
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
CALL_DEF_CONTEXTFILLAREA()
|
||||
Graphic3d_CAspectFillArea()
|
||||
: IsDef (0),
|
||||
IsSet (0),
|
||||
Style (0),
|
||||
@ -42,19 +38,17 @@ public:
|
||||
PolygonOffsetFactor (0.0f),
|
||||
PolygonOffsetUnits (0.0f)
|
||||
{
|
||||
memset(&IntColor,0,sizeof(IntColor));
|
||||
memset(&BackIntColor,0,sizeof(BackIntColor));
|
||||
memset(&EdgeColor,0,sizeof(EdgeColor));
|
||||
memset(&Front,0,sizeof(Front));
|
||||
memset(&Back,0,sizeof(Back));
|
||||
memset (&IntColor, 0, sizeof(IntColor));
|
||||
memset (&BackIntColor, 0, sizeof(BackIntColor));
|
||||
memset (&EdgeColor, 0, sizeof(EdgeColor));
|
||||
memset (&Front, 0, sizeof(Front));
|
||||
memset (&Back, 0, sizeof(Back));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
int IsDef;
|
||||
|
||||
int IsSet;
|
||||
|
||||
int Style;
|
||||
|
||||
CALL_DEF_COLOR IntColor;
|
||||
@ -82,52 +76,9 @@ public:
|
||||
float PolygonOffsetUnits;
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
};
|
||||
|
||||
class CALL_DEF_CONTEXTMARKER
|
||||
{
|
||||
public:
|
||||
|
||||
CALL_DEF_CONTEXTMARKER()
|
||||
: IsDef (0),
|
||||
IsSet (0),
|
||||
MarkerType (Aspect_TOM_POINT),
|
||||
Scale (0),
|
||||
MarkerImage (NULL)
|
||||
{
|
||||
memset(&Color,0,sizeof(Color));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Standard_Integer IsDef;
|
||||
Standard_Integer IsSet;
|
||||
CALL_DEF_COLOR Color;
|
||||
Aspect_TypeOfMarker MarkerType;
|
||||
Standard_ShortReal Scale;
|
||||
Handle(Graphic3d_MarkerImage) MarkerImage;
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
|
||||
};
|
||||
|
||||
class Graphic3d_CGroup
|
||||
{
|
||||
typedef Graphic3d_CAspectFillArea CALL_DEF_CONTEXTFILLAREA;
|
||||
|
||||
public:
|
||||
|
||||
void* ptrGroup;
|
||||
|
||||
CALL_DEF_CONTEXTLINE ContextLine;
|
||||
CALL_DEF_CONTEXTFILLAREA ContextFillArea;
|
||||
CALL_DEF_CONTEXTMARKER ContextMarker;
|
||||
CALL_DEF_CONTEXTTEXT ContextText;
|
||||
|
||||
Graphic3d_CStructure* Struct;
|
||||
|
||||
CALL_DEF_PICKID PickId;
|
||||
|
||||
};
|
||||
|
||||
const Handle(Standard_Type)& TYPE(Graphic3d_CGroup);
|
||||
|
||||
#endif // Graphic3d_CGroup_HeaderFile
|
||||
#endif // _Graphic3d_CAspectFillArea_HeaderFile
|
@ -12,21 +12,26 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef GROUP_PXX_INCLUDED
|
||||
#define GROUP_PXX_INCLUDED
|
||||
#ifndef _Graphic3d_CAspectLine_HeaderFile
|
||||
#define _Graphic3d_CAspectLine_HeaderFile
|
||||
|
||||
#include <Graphic3d_Structure.pxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
#include <Graphic3d_CTexture.hxx>
|
||||
#include <Graphic3d_ShaderProgram_Handle.hxx>
|
||||
|
||||
// groups identifiers : possible range
|
||||
#define Group_IDMIN 100
|
||||
// /2 pour eviter les problemes d'overflow
|
||||
#define Group_IDMAX INT_MAX/2
|
||||
class Graphic3d_CAspectLine
|
||||
{
|
||||
public:
|
||||
|
||||
#define MyIsEmpty MyCBitFields.bool1
|
||||
#define MyContainsFacet MyCBitFields.bool2
|
||||
#define MyNotUsed1 MyCBitFields.bool3
|
||||
#define MyNotUsed2 MyCBitFields.bool4
|
||||
int IsDef;
|
||||
int IsSet;
|
||||
CALL_DEF_COLOR Color;
|
||||
int LineType;
|
||||
float Width;
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
|
||||
#define MyStructure ((Graphic3d_Structure *) MyPtrStructure)
|
||||
};
|
||||
|
||||
#endif
|
||||
typedef Graphic3d_CAspectLine CALL_DEF_CONTEXTLINE;
|
||||
|
||||
#endif // _Graphic3d_CAspectLine_HeaderFile
|
52
src/Graphic3d/Graphic3d_CAspectMarker.hxx
Normal file
52
src/Graphic3d/Graphic3d_CAspectMarker.hxx
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_CAspectMarker_HeaderFile
|
||||
#define _Graphic3d_CAspectMarker_HeaderFile
|
||||
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
#include <Graphic3d_CTexture.hxx>
|
||||
#include <Graphic3d_MarkerImage_Handle.hxx>
|
||||
#include <Graphic3d_ShaderProgram_Handle.hxx>
|
||||
|
||||
class Graphic3d_CAspectMarker
|
||||
{
|
||||
public:
|
||||
|
||||
Graphic3d_CAspectMarker()
|
||||
: IsDef (0),
|
||||
IsSet (0),
|
||||
MarkerType (Aspect_TOM_POINT),
|
||||
Scale (0),
|
||||
MarkerImage (NULL)
|
||||
{
|
||||
memset (&Color, 0, sizeof(Color));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Standard_Integer IsDef;
|
||||
Standard_Integer IsSet;
|
||||
CALL_DEF_COLOR Color;
|
||||
Aspect_TypeOfMarker MarkerType;
|
||||
Standard_ShortReal Scale;
|
||||
Handle(Graphic3d_MarkerImage) MarkerImage;
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
|
||||
};
|
||||
|
||||
typedef Graphic3d_CAspectMarker CALL_DEF_CONTEXTMARKER;
|
||||
|
||||
#endif // _Graphic3d_AspectMarker_HeaderFile
|
44
src/Graphic3d/Graphic3d_CAspectText.hxx
Normal file
44
src/Graphic3d/Graphic3d_CAspectText.hxx
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_CAspectText_HeaderFile
|
||||
#define _Graphic3d_CAspectText_HeaderFile
|
||||
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
#include <Graphic3d_CTexture.hxx>
|
||||
#include <Graphic3d_ShaderProgram_Handle.hxx>
|
||||
|
||||
class Graphic3d_CAspectText
|
||||
{
|
||||
public:
|
||||
|
||||
int IsDef;
|
||||
int IsSet;
|
||||
const char* Font;
|
||||
float Space;
|
||||
float Expan;
|
||||
CALL_DEF_COLOR Color;
|
||||
int Style;
|
||||
int DisplayType;
|
||||
CALL_DEF_COLOR ColorSubTitle;
|
||||
int TextZoomable;
|
||||
float TextAngle;
|
||||
int TextFontAspect;
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
|
||||
};
|
||||
|
||||
typedef Graphic3d_CAspectText CALL_DEF_CONTEXTTEXT;
|
||||
|
||||
#endif // _Graphic3d_CAspectText_HeaderFile
|
@ -16,7 +16,8 @@
|
||||
#define _Graphic3d_CStructure_HeaderFile
|
||||
|
||||
#include <Graphic3d_CStructure_Handle.hxx>
|
||||
#include <Graphic3d_CGroup.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_SequenceOfGroup.hxx>
|
||||
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
||||
#include <Graphic3d_TypeOfComposition.hxx>
|
||||
#include <Graphic3d_Vec3.hxx>
|
||||
@ -37,6 +38,12 @@ public:
|
||||
return myGraphicDriver;
|
||||
}
|
||||
|
||||
//! @return graphic groups
|
||||
const Graphic3d_SequenceOfGroup& Groups() const
|
||||
{
|
||||
return myGroups;
|
||||
}
|
||||
|
||||
//! @return associated clip planes
|
||||
const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
|
||||
{
|
||||
@ -71,11 +78,18 @@ public:
|
||||
const Standard_Boolean theToCreate) = 0;
|
||||
|
||||
//! Highlight structure using boundary box
|
||||
virtual void HighlightWithBndBox (const Standard_Boolean theToCreate) = 0;
|
||||
virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
||||
const Standard_Boolean theToCreate) = 0;
|
||||
|
||||
//! Create shadow link to this structure
|
||||
virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
|
||||
|
||||
//! Create new group within this structure
|
||||
virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
|
||||
|
||||
//! Remove group from this structure
|
||||
virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
|
||||
|
||||
public:
|
||||
|
||||
int Id;
|
||||
@ -111,6 +125,7 @@ protected:
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
|
||||
Graphic3d_SequenceOfGroup myGroups;
|
||||
Graphic3d_SequenceOfHClipPlane myClipPlanes;
|
||||
|
||||
public:
|
||||
|
@ -59,7 +59,7 @@ uses
|
||||
AspectFillArea3d from Graphic3d,
|
||||
HorizontalTextAlignment from Graphic3d,
|
||||
CBitFields20 from Graphic3d,
|
||||
CGroup from Graphic3d,
|
||||
Group from Graphic3d,
|
||||
CLight from Graphic3d,
|
||||
CPick from Graphic3d,
|
||||
CPlane from Graphic3d,
|
||||
@ -135,49 +135,6 @@ is
|
||||
is deferred;
|
||||
---Purpose: call_togl_inquireview
|
||||
|
||||
-------------------------------------
|
||||
-- Category: Group management methods
|
||||
-------------------------------------
|
||||
|
||||
ClearGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_cleargroup
|
||||
|
||||
FaceContextGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
NoInsert : Integer from Standard )
|
||||
is deferred;
|
||||
---Purpose: call_togl_facecontextgroup
|
||||
|
||||
Group ( me : mutable;
|
||||
ACGroup : in out CGroup from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_group
|
||||
|
||||
LineContextGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
NoInsert : Integer from Standard )
|
||||
is deferred;
|
||||
---Purpose: call_togl_linecontextgroup
|
||||
|
||||
MarkerContextGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
NoInsert : Integer from Standard )
|
||||
is deferred;
|
||||
---Purpose: call_togl_markercontextgroup
|
||||
|
||||
RemoveGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_removegroup
|
||||
|
||||
TextContextGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
NoInsert : Integer from Standard )
|
||||
is deferred;
|
||||
---Purpose: call_togl_textcontextgroup
|
||||
|
||||
-----------------------------------------
|
||||
-- Category: Structure management methods
|
||||
-----------------------------------------
|
||||
@ -336,86 +293,11 @@ is
|
||||
is deferred;
|
||||
---Purpose:
|
||||
|
||||
SetStencilTestOptions ( me : mutable;
|
||||
theCGroup : CGroup from Graphic3d;
|
||||
theIsEnabled: Boolean from Standard)
|
||||
is deferred;
|
||||
---Purpose: sets the stencil test to theIsEnabled state;
|
||||
|
||||
SetFlippingOptions (me : mutable;
|
||||
theCGroup : CGroup from Graphic3d;
|
||||
theIsEnabled: Boolean from Standard;
|
||||
theRefPlane : Ax2 from gp)
|
||||
is deferred;
|
||||
---Purpose: sets the flipping to theIsEnabled state for the given graphic group.
|
||||
|
||||
----------------------------------------
|
||||
-- Category: Methods to create Text
|
||||
-- for Purpose : see Graphic3d_Group.cdl
|
||||
----------------------------------------
|
||||
|
||||
Text ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
AText : CString from Standard;
|
||||
APoint : Vertex from Graphic3d;
|
||||
AHeight : Real from Standard;
|
||||
AAngle : PlaneAngle from Quantity;
|
||||
ATp : TextPath from Graphic3d;
|
||||
AHta : HorizontalTextAlignment from Graphic3d;
|
||||
AVta : VerticalTextAlignment from Graphic3d;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is deferred;
|
||||
---Purpose: call_togl_text
|
||||
|
||||
Text ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
AText : CString from Standard;
|
||||
APoint : Vertex from Graphic3d;
|
||||
AHeight : Real from Standard;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is deferred;
|
||||
---Purpose: call_togl_text
|
||||
|
||||
Text ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
AText : ExtendedString from TCollection;
|
||||
APoint : Vertex from Graphic3d;
|
||||
AHeight : Real from Standard;
|
||||
AAngle : PlaneAngle from Quantity;
|
||||
ATp : TextPath from Graphic3d;
|
||||
AHta : HorizontalTextAlignment from Graphic3d;
|
||||
AVta : VerticalTextAlignment from Graphic3d;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is deferred;
|
||||
---Purpose: call_togl_text
|
||||
|
||||
Text ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
AText : ExtendedString from TCollection;
|
||||
APoint : Vertex from Graphic3d;
|
||||
AHeight : Real from Standard;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is deferred;
|
||||
---Purpose: call_togl_text
|
||||
|
||||
----------------------------------------
|
||||
---Category: Methods to create Triangle
|
||||
-- for Purpose : see Graphic3d_Group.cdl
|
||||
----------------------------------------
|
||||
|
||||
PrimitiveArray( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
parray : PrimitiveArray from Graphic3d;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is deferred;
|
||||
---Purpose: call_togl_parray
|
||||
|
||||
UserDraw( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
AUserDraw : CUserDraw from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_userdraw
|
||||
|
||||
EnableVBO( me : mutable;
|
||||
status : Boolean from Standard )
|
||||
is deferred;
|
||||
@ -814,10 +696,6 @@ is
|
||||
AComment : CString from Standard;
|
||||
AValue : Boolean from Standard );
|
||||
|
||||
PrintCGroup ( me;
|
||||
ACGroup : CGroup from Graphic3d;
|
||||
AField : Integer from Standard );
|
||||
|
||||
PrintCLight ( me;
|
||||
ACLight : CLight from Graphic3d;
|
||||
AField : Integer from Standard );
|
||||
|
@ -61,16 +61,6 @@ void Graphic3d_GraphicDriver::PrintBoolean (const Standard_CString AComment, con
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_GraphicDriver::PrintCGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer AField) const {
|
||||
|
||||
if (AField) {
|
||||
cout << "\tstruct id " << ACGroup.Struct->Id << "\n";
|
||||
cout << "\tgroup\n";
|
||||
cout << flush;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_GraphicDriver::PrintCLight (const Graphic3d_CLight& theCLight,
|
||||
const Standard_Integer theField) const
|
||||
{
|
||||
|
@ -14,12 +14,7 @@
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
-- 27/09/97 ; PCT : add manual control of textures
|
||||
-- 11/97 ; CAL : ajout polyline par 2 points
|
||||
-- 16/06/2000 : ATS: Study G005 - Group store presentations of it's objects in field
|
||||
-- MyListOfPArray to avoid deletion of handle-manipulating
|
||||
-- primitives.
|
||||
class Group from Graphic3d inherits TShared
|
||||
deferred class Group from Graphic3d inherits TShared
|
||||
|
||||
---Version:
|
||||
|
||||
@ -73,11 +68,16 @@ class Group from Graphic3d inherits TShared
|
||||
AspectMarker3d from Graphic3d,
|
||||
AspectText3d from Graphic3d,
|
||||
AspectFillArea3d from Graphic3d,
|
||||
CAspectLine from Graphic3d,
|
||||
CAspectFillArea from Graphic3d,
|
||||
CAspectMarker from Graphic3d,
|
||||
CAspectText from Graphic3d,
|
||||
CStructurePtr from Graphic3d,
|
||||
HorizontalTextAlignment from Graphic3d,
|
||||
CBitFields4 from Graphic3d,
|
||||
CGroup from Graphic3d,
|
||||
GraphicDriver from Graphic3d,
|
||||
Structure from Graphic3d,
|
||||
StructurePtr from Graphic3d,
|
||||
TextPath from Graphic3d,
|
||||
Vector from Graphic3d,
|
||||
Array1OfVertex from Graphic3d,
|
||||
@ -91,13 +91,13 @@ class Group from Graphic3d inherits TShared
|
||||
Ax2 from gp
|
||||
|
||||
raises
|
||||
|
||||
|
||||
GroupDefinitionError from Graphic3d,
|
||||
PickIdDefinitionError from Graphic3d,
|
||||
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
Create ( AStructure : Structure from Graphic3d )
|
||||
Initialize (theStructure : Structure from Graphic3d)
|
||||
returns mutable Group from Graphic3d;
|
||||
---Level: Public
|
||||
---Purpose: Creates a group in the structure <AStructure>.
|
||||
@ -108,7 +108,7 @@ class Group from Graphic3d inherits TShared
|
||||
|
||||
Clear ( me : mutable;
|
||||
theUpdateStructureMgr : Boolean from Standard = Standard_True )
|
||||
is static;
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Supress all primitives and attributes of <me>.
|
||||
-- To clear group without update in Graphic3d_StructureManager
|
||||
@ -118,7 +118,23 @@ class Group from Graphic3d inherits TShared
|
||||
-- already released (pointers are used here to avoid handle
|
||||
-- cross-reference);
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
|
||||
UpdateAspectLine ( me : mutable;
|
||||
theIsGlobal : Boolean from Standard )
|
||||
is deferred;
|
||||
|
||||
UpdateAspectFace ( me : mutable;
|
||||
theIsGlobal : Boolean from Standard )
|
||||
is deferred;
|
||||
|
||||
UpdateAspectMarker ( me : mutable;
|
||||
theIsGlobal : Boolean from Standard )
|
||||
is deferred;
|
||||
|
||||
UpdateAspectText ( me : mutable;
|
||||
theIsGlobal : Boolean from Standard )
|
||||
is deferred;
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is static;
|
||||
---Level: Public
|
||||
@ -264,7 +280,7 @@ class Group from Graphic3d inherits TShared
|
||||
AHta : HorizontalTextAlignment from Graphic3d;
|
||||
AVta : VerticalTextAlignment from Graphic3d;
|
||||
EvalMinMax : Boolean from Standard = Standard_True )
|
||||
is static;
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Creates the string <AText> at position <APoint>.
|
||||
-- The 3D point of attachment is projected. The text is
|
||||
@ -277,7 +293,7 @@ class Group from Graphic3d inherits TShared
|
||||
-- AAngle : Orientation of the text
|
||||
-- (with respect to the horizontal).
|
||||
---Category: Methods to create Text
|
||||
|
||||
|
||||
Text ( me : mutable;
|
||||
AText : CString from Standard;
|
||||
APoint : Vertex from Graphic3d;
|
||||
@ -350,9 +366,9 @@ class Group from Graphic3d inherits TShared
|
||||
---------------------------------------
|
||||
|
||||
AddPrimitiveArray( me : mutable;
|
||||
elem : ArrayOfPrimitives from Graphic3d;
|
||||
EvalMinMax: Boolean from Standard = Standard_True );
|
||||
---Level: Public
|
||||
thePrim : ArrayOfPrimitives from Graphic3d;
|
||||
theToEvalMinMax : Boolean from Standard = Standard_True ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Adds an array of primitives for display
|
||||
|
||||
Marker ( me : mutable;
|
||||
@ -362,24 +378,23 @@ class Group from Graphic3d inherits TShared
|
||||
---Level: Public
|
||||
---Purpose: Creates a primitive array with single marker using AddPrimitiveArray().
|
||||
|
||||
UserDraw ( me : mutable;
|
||||
AnObject : Address from Standard;
|
||||
EvalMinMax : Boolean from Standard = Standard_True;
|
||||
ContainsFacet: Boolean from Standard = Standard_False
|
||||
)
|
||||
UserDraw ( me : mutable;
|
||||
theObject : Address from Standard;
|
||||
theToEvalMinMax : Boolean from Standard = Standard_True;
|
||||
theContainsFacet : Boolean from Standard = Standard_False )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Creates an UserDraw primitive
|
||||
-- Category: Methods to create UserDraw
|
||||
-- Warning: Raises GroupDefinitionError if ...
|
||||
raises GroupDefinitionError from Graphic3d is static;
|
||||
---Purpose: Creates a UserDraw primitive using obsolete API.
|
||||
|
||||
SetStencilTestOptions (me : mutable;
|
||||
theIsEnabled: Boolean from Standard);
|
||||
theIsEnabled: Boolean from Standard)
|
||||
is deferred;
|
||||
---Purpose: sets the stencil test to theIsEnabled state;
|
||||
|
||||
SetFlippingOptions (me : mutable;
|
||||
theIsEnabled : Boolean from Standard;
|
||||
theRefPlane : Ax2 from gp);
|
||||
theRefPlane : Ax2 from gp)
|
||||
is deferred;
|
||||
---Purpose: sets the flipping to theIsEnabled state.
|
||||
|
||||
----------------------------
|
||||
@ -493,31 +508,26 @@ class Group from Graphic3d inherits TShared
|
||||
--
|
||||
-- Reminder : A group is defined in a structure
|
||||
-- It acts as the smallest editable entity.
|
||||
|
||||
-- the associated C structure
|
||||
MyCGroup : CGroup from Graphic3d;
|
||||
|
||||
-- the graphic driver used
|
||||
MyGraphicDriver : GraphicDriver from Graphic3d;
|
||||
|
||||
-- the state of the different contexts for primitives
|
||||
MyCBitFields : CBitFields4 from Graphic3d;
|
||||
|
||||
-- the structure contains the group
|
||||
MyPtrStructure : Address from Standard;
|
||||
|
||||
-- the min-max
|
||||
MyBounds : CBounds from Graphic3d;
|
||||
|
||||
MyListOfPArray : ListOfPArray from Graphic3d;
|
||||
-- the state of the different contexts for primitives
|
||||
myCBitFields : CBitFields4 from Graphic3d is protected;
|
||||
|
||||
MyMarkArray : HArray1OfByte from TColStd;
|
||||
MyMarkWidth : Integer from Standard;
|
||||
MyMarkHeight : Integer from Standard;
|
||||
-- the structure contains the group
|
||||
myStructure : StructurePtr from Graphic3d is protected;
|
||||
|
||||
friends
|
||||
|
||||
Remove from class Structure from Graphic3d
|
||||
( me : mutable; AGroup : Group from Graphic3d )
|
||||
|
||||
end Group;
|
||||
-- the min-max
|
||||
myBounds : CBounds from Graphic3d is protected;
|
||||
|
||||
ContextLine : CAspectLine from Graphic3d is protected;
|
||||
ContextFillArea : CAspectFillArea from Graphic3d is protected;
|
||||
ContextMarker : CAspectMarker from Graphic3d is protected;
|
||||
ContextText : CAspectText from Graphic3d is protected;
|
||||
|
||||
-- temporary field - to be removed
|
||||
myListOfPArray : ListOfPArray from Graphic3d is protected;
|
||||
|
||||
friends
|
||||
|
||||
class Structure from Graphic3d
|
||||
|
||||
end Group;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,104 +0,0 @@
|
||||
// Created by: NW,JPB,CAL
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux groupes
|
||||
// de primitives
|
||||
|
||||
//-Warning Un groupe est defini dans une structure
|
||||
// Il s'agit de la plus petite entite editable
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Graphic3d_Group.jxx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyCGroup.ContextLine.IsSet = 0,
|
||||
MyCGroup.ContextText.IsSet = 0,
|
||||
MyCGroup.ContextMarker.IsSet = 0,
|
||||
MyCGroup.ContextFillArea.IsSet = 0;
|
||||
|
||||
MyCGroup.ContextLine.IsDef = 0,
|
||||
MyCGroup.ContextText.IsDef = 0,
|
||||
MyCGroup.ContextMarker.IsDef = 0,
|
||||
MyCGroup.ContextFillArea.IsDef = 0;
|
||||
|
||||
MyCGroup.PickId.IsDef = 0,
|
||||
MyCGroup.PickId.IsSet = 0,
|
||||
MyCGroup.PickId.Value = 0;
|
||||
|
||||
MyBounds.XMin = ShortRealLast (),
|
||||
MyBounds.YMin = ShortRealLast (),
|
||||
MyBounds.ZMin = ShortRealLast ();
|
||||
|
||||
MyBounds.XMax = ShortRealFirst (),
|
||||
MyBounds.YMax = ShortRealFirst (),
|
||||
MyBounds.ZMax = ShortRealFirst ();
|
||||
|
||||
if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
|
||||
MyContainsFacet = Standard_False,
|
||||
MyIsEmpty = Standard_True;
|
||||
|
||||
MyGraphicDriver->ClearGroup (MyCGroup);
|
||||
|
||||
// clear method could be used on Graphic3d_Structure destruction,
|
||||
// and its structure manager could be already destroyed, in that
|
||||
// case we don't need to update it;
|
||||
if (theUpdateStructureMgr)
|
||||
Update ();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Destroy ()
|
||||
{
|
||||
// tell graphics driver to clear internal resources of the group
|
||||
if (!IsEmpty () && !MyGraphicDriver.IsNull ())
|
||||
MyGraphicDriver->ClearGroup (MyCGroup);
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Remove ()
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyGraphicDriver->RemoveGroup (MyCGroup);
|
||||
MyStructure->Remove (this);
|
||||
MyCGroup.ptrGroup = NULL;
|
||||
|
||||
Update ();
|
||||
|
||||
MyBounds.XMin = ShortRealLast (),
|
||||
MyBounds.YMin = ShortRealLast (),
|
||||
MyBounds.ZMin = ShortRealLast ();
|
||||
|
||||
MyBounds.XMax = ShortRealFirst (),
|
||||
MyBounds.YMax = ShortRealFirst (),
|
||||
MyBounds.ZMax = ShortRealFirst ();
|
||||
|
||||
if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
|
||||
MyContainsFacet = Standard_False,
|
||||
MyIsEmpty = Standard_True;
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
// Created by: NW,JPB,CAL
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux groupes
|
||||
// de primitives
|
||||
|
||||
//-Warning Un groupe est defini dans une structure
|
||||
// Il s'agit de la plus petite entite editable
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Graphic3d_Group.jxx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
void Graphic3d_Group::Text (
|
||||
const Standard_CString AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Quantity_PlaneAngle AAngle,
|
||||
const Graphic3d_TextPath ATp,
|
||||
const Graphic3d_HorizontalTextAlignment AHta,
|
||||
const Graphic3d_VerticalTextAlignment AVta,
|
||||
const Standard_Boolean EvalMinMax
|
||||
)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_ShortReal X, Y, Z;
|
||||
APoint.Coord (X, Y, Z);
|
||||
if (X < MyBounds.XMin) MyBounds.XMin = X;
|
||||
if (Y < MyBounds.YMin) MyBounds.YMin = Y;
|
||||
if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
|
||||
if (X > MyBounds.XMax) MyBounds.XMax = X;
|
||||
if (Y > MyBounds.YMax) MyBounds.YMax = Y;
|
||||
if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
|
||||
}
|
||||
|
||||
MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Text (
|
||||
const Standard_CString AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Standard_Boolean EvalMinMax
|
||||
)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_ShortReal X, Y, Z;
|
||||
APoint.Coord (X, Y, Z);
|
||||
if (X < MyBounds.XMin) MyBounds.XMin = X;
|
||||
if (Y < MyBounds.YMin) MyBounds.YMin = Y;
|
||||
if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
|
||||
if (X > MyBounds.XMax) MyBounds.XMax = X;
|
||||
if (Y > MyBounds.YMax) MyBounds.YMax = Y;
|
||||
if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
|
||||
}
|
||||
|
||||
MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Text (
|
||||
const TCollection_ExtendedString& AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Quantity_PlaneAngle AAngle,
|
||||
const Graphic3d_TextPath ATp,
|
||||
const Graphic3d_HorizontalTextAlignment AHta,
|
||||
const Graphic3d_VerticalTextAlignment AVta,
|
||||
const Standard_Boolean EvalMinMax
|
||||
)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_ShortReal X, Y, Z;
|
||||
APoint.Coord (X, Y, Z);
|
||||
if (X < MyBounds.XMin) MyBounds.XMin = X;
|
||||
if (Y < MyBounds.YMin) MyBounds.YMin = Y;
|
||||
if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
|
||||
if (X > MyBounds.XMax) MyBounds.XMax = X;
|
||||
if (Y > MyBounds.YMax) MyBounds.YMax = Y;
|
||||
if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
|
||||
}
|
||||
|
||||
MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Text (
|
||||
const TCollection_ExtendedString& AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Standard_Boolean EvalMinMax
|
||||
)
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_ShortReal X, Y, Z;
|
||||
APoint.Coord (X, Y, Z);
|
||||
if (X < MyBounds.XMin) MyBounds.XMin = X;
|
||||
if (Y < MyBounds.YMin) MyBounds.YMin = Y;
|
||||
if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
|
||||
if (X > MyBounds.XMax) MyBounds.XMax = X;
|
||||
if (Y > MyBounds.YMax) MyBounds.YMax = Y;
|
||||
if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
|
||||
}
|
||||
|
||||
MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
|
||||
|
||||
Update ();
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
// Created on: 2000-06-16
|
||||
// Copyright (c) 2000-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.
|
||||
|
||||
#include <Graphic3d_Group.jxx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : AddPrimitiveArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
void Graphic3d_Group :: AddPrimitiveArray ( const Handle(Graphic3d_ArrayOfPrimitives)& elem,const Standard_Boolean EvalMinMax )
|
||||
{
|
||||
if (IsDeleted () ) return;
|
||||
|
||||
if( !elem->IsValid() ) return;
|
||||
|
||||
if( !MyContainsFacet &&
|
||||
(elem->Type() != Graphic3d_TOPA_POLYLINES) &&
|
||||
(elem->Type() != Graphic3d_TOPA_SEGMENTS) &&
|
||||
(elem->Type() != Graphic3d_TOPA_POINTS) ) {
|
||||
MyStructure->GroupsWithFacet (+1);
|
||||
MyContainsFacet = Standard_True;
|
||||
}
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
MyListOfPArray.Append(elem);
|
||||
|
||||
// Min-Max Update
|
||||
if (EvalMinMax) {
|
||||
Standard_Real x,y,z;
|
||||
|
||||
for (int k=1; k<=elem->VertexNumber() ; k++) {
|
||||
elem->Vertice(k,x,y,z);
|
||||
|
||||
if (x < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal(x);
|
||||
if (y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal(y);
|
||||
if (z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal(z);
|
||||
if (x > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal(x);
|
||||
if (y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal(y);
|
||||
if (z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal(z);
|
||||
}
|
||||
}
|
||||
|
||||
MyGraphicDriver->PrimitiveArray(MyCGroup, elem->Array());
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Marker
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
void Graphic3d_Group::Marker (const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (1);
|
||||
aPoints->AddVertex (thePoint.X(), thePoint.Y(), thePoint.Z());
|
||||
AddPrimitiveArray (aPoints, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UserDraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
|
||||
const Standard_Boolean EvalMinMax,
|
||||
const Standard_Boolean ContainsFacet )
|
||||
{
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
// Without this modification, the group assumes the primitive contains
|
||||
// no polygons and does not require the Z-buffer for display.
|
||||
if (!MyContainsFacet && ContainsFacet) {
|
||||
MyStructure->GroupsWithFacet (+1);
|
||||
MyContainsFacet = Standard_True;
|
||||
}
|
||||
|
||||
MyIsEmpty = Standard_False;
|
||||
|
||||
Graphic3d_CUserDraw AUserDraw;
|
||||
AUserDraw.Data = AnObject;
|
||||
AUserDraw.Bounds = ( EvalMinMax? &MyBounds : NULL );
|
||||
MyGraphicDriver->UserDraw (MyCGroup, AUserDraw);
|
||||
|
||||
Update ();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetFlippingOptions
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
void Graphic3d_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
||||
const gp_Ax2& theRefPlane)
|
||||
{
|
||||
MyGraphicDriver->SetFlippingOptions (MyCGroup, theIsEnabled, theRefPlane);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetStencilTestOptions
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
|
||||
{
|
||||
MyGraphicDriver->SetStencilTestOptions (MyCGroup, theIsEnabled);
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
// Created by: NW,JPB,CAL
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration of variables specific to groups
|
||||
// of primitives
|
||||
|
||||
//-Warning A group is defined in a structure
|
||||
// This is the smallest editable entity
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Graphic3d_Group.jxx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
|
||||
// Structures are necessairy for interfacing with routines c
|
||||
// Routines C should be declared externally
|
||||
//-Methods, in order
|
||||
|
||||
Standard_Boolean Graphic3d_Group::IsDeleted () const {
|
||||
|
||||
return ( (MyCGroup.ptrGroup == NULL) || (MyStructure->IsDeleted ()) );
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Graphic3d_Group::ContainsFacet () const {
|
||||
|
||||
return (MyContainsFacet);
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Graphic3d_Group::IsEmpty () const {
|
||||
|
||||
if (IsDeleted ()) return (Standard_True);
|
||||
|
||||
Standard_ShortReal RL = ShortRealLast ();
|
||||
Standard_ShortReal RF = ShortRealFirst ();
|
||||
Standard_Boolean Result = ((MyBounds.XMin == RL) && (MyBounds.YMin == RL) &&
|
||||
(MyBounds.ZMin == RL) && (MyBounds.XMax == RF) &&
|
||||
(MyBounds.YMax == RF) && (MyBounds.ZMax == RF));
|
||||
|
||||
if (Result != MyIsEmpty)
|
||||
cout << "MyIsEmpty != IsEmpty ()\n" << flush;
|
||||
|
||||
return (Result);
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::SetMinMaxValues (const Standard_Real XMin, const Standard_Real YMin, const Standard_Real ZMin, const Standard_Real XMax, const Standard_Real YMax, const Standard_Real ZMax) {
|
||||
|
||||
MyBounds.XMin = Standard_ShortReal (XMin);
|
||||
MyBounds.YMin = Standard_ShortReal (YMin);
|
||||
MyBounds.ZMin = Standard_ShortReal (ZMin);
|
||||
MyBounds.XMax = Standard_ShortReal (XMax);
|
||||
MyBounds.YMax = Standard_ShortReal (YMax);
|
||||
MyBounds.ZMax = Standard_ShortReal (ZMax);
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
|
||||
|
||||
MinMaxCoord (XMin, YMin, ZMin, XMax, YMax, ZMax);
|
||||
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Structure) Graphic3d_Group::Structure () const {
|
||||
|
||||
return MyStructure;
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::MinMaxCoord (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
|
||||
|
||||
if (IsEmpty ()) {
|
||||
// Empty Group
|
||||
XMin = YMin = ZMin = ShortRealFirst ();
|
||||
XMax = YMax = ZMax = ShortRealLast ();
|
||||
}
|
||||
else {
|
||||
XMin = Standard_Real (MyBounds.XMin);
|
||||
YMin = Standard_Real (MyBounds.YMin);
|
||||
ZMin = Standard_Real (MyBounds.ZMin);
|
||||
XMax = Standard_Real (MyBounds.XMax);
|
||||
YMax = Standard_Real (MyBounds.YMax);
|
||||
ZMax = Standard_Real (MyBounds.ZMax);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Update () const {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
if ( (MyStructure->StructureManager ())->UpdateMode () == Aspect_TOU_ASAP )
|
||||
(MyStructure->StructureManager ())->Update ();
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
// Created on: 2014-03-20
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@ -12,11 +13,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Graphic3d_CGroup.hxx>
|
||||
#ifndef _Graphic3d_SequenceOfGroup_HeaderFile
|
||||
#define _Graphic3d_SequenceOfGroup_HeaderFile
|
||||
|
||||
const Handle(Standard_Type)& TYPE(Graphic3d_CGroup)
|
||||
{
|
||||
static Handle(Standard_Type) _atype =
|
||||
new Standard_Type ("Graphic3d_CGroup", sizeof (Graphic3d_CGroup));
|
||||
return _atype;
|
||||
}
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
typedef NCollection_Sequence<Handle(Graphic3d_Group)> Graphic3d_SequenceOfGroup;
|
||||
|
||||
#endif // _Graphic3d_SequenceOfGroup_HeaderFile
|
@ -58,7 +58,6 @@ uses
|
||||
GraphicDriver from Graphic3d,
|
||||
Group from Graphic3d,
|
||||
SequenceOfGroup from Graphic3d,
|
||||
HSequenceOfGroup from Graphic3d,
|
||||
SequenceOfStructure from Graphic3d,
|
||||
HSequenceOfStructure from Graphic3d,
|
||||
MapOfStructure from Graphic3d,
|
||||
@ -457,6 +456,17 @@ is
|
||||
-- structure <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
NewGroup ( me : mutable ) returns Group from Graphic3d
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Append new group to this structure.
|
||||
|
||||
Remove ( me : mutable;
|
||||
theGroup : Group from Graphic3d )
|
||||
is static private;
|
||||
---Purpose: Suppress in the structure <me>, the group theGroup.
|
||||
-- It will be erased at the next screen update.
|
||||
|
||||
HighlightColor ( me )
|
||||
returns Color from Quantity
|
||||
is static;
|
||||
@ -805,14 +815,6 @@ is
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
Add ( me : mutable;
|
||||
AGroup : Group from Graphic3d )
|
||||
is static private;
|
||||
---Level: Internal
|
||||
---Purpose: Inserts in the structure <me>, the group <G>.
|
||||
-- It will be erased at the next screen update.
|
||||
---Category: Private methods
|
||||
|
||||
ComputeVisual ( me )
|
||||
returns TypeOfStructure from Graphic3d
|
||||
is static;
|
||||
@ -923,14 +925,6 @@ is
|
||||
-- of descendants or in the list of ancestors.
|
||||
---Category: Private methods
|
||||
|
||||
Remove ( me : mutable;
|
||||
AGroup : Group from Graphic3d )
|
||||
is static private;
|
||||
---Level: Internal
|
||||
---Purpose: Suppress in the structure <me>, the group <AGroup>.
|
||||
-- It will be erased at the next screen update.
|
||||
---Category: Private methods
|
||||
|
||||
SetComputeVisual ( me : mutable;
|
||||
AVisual : TypeOfStructure from Graphic3d )
|
||||
is static;
|
||||
@ -994,11 +988,12 @@ is
|
||||
---Purpose: Updates the c structure associated to <me>.
|
||||
---Category: Private methods
|
||||
|
||||
CStructure (me)
|
||||
returns CStructure_Handle from Graphic3d
|
||||
is static;
|
||||
---Purpose: Returns the c structure associated to <me>.
|
||||
---C++: return const &
|
||||
CStructure (me)
|
||||
returns CStructure_Handle from Graphic3d
|
||||
is static;
|
||||
---Purpose: Returns the low-level structure
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
|
||||
@ -1012,7 +1007,7 @@ fields
|
||||
--
|
||||
|
||||
-- the associated low-level structure
|
||||
myCStructure : CStructure_Handle from Graphic3d;
|
||||
myCStructure : CStructure_Handle from Graphic3d;
|
||||
|
||||
-- the structures to which the structure is attached
|
||||
myAncestors : SequenceOfAddress from TColStd;
|
||||
@ -1020,9 +1015,6 @@ fields
|
||||
-- the structures attached to the structure
|
||||
myDescendants : SequenceOfAddress from TColStd;
|
||||
|
||||
-- the sequence of groups
|
||||
myGroups : SequenceOfGroup from Graphic3d;
|
||||
|
||||
-- the highlight method of the structure
|
||||
myHighlightColor : Color from Quantity;
|
||||
myHighlightMethod : TypeOfHighlightMethod from Aspect;
|
||||
|
@ -105,15 +105,10 @@ void Graphic3d_Structure::Clear (const Standard_Boolean theWithDestruction)
|
||||
{
|
||||
if (IsDeleted()) return;
|
||||
|
||||
myCStructure->ContainsFacet = 0;
|
||||
|
||||
// clean groups in graphics driver at first
|
||||
GraphicClear (theWithDestruction);
|
||||
|
||||
// only then remove group references
|
||||
if (theWithDestruction)
|
||||
myGroups.Clear();
|
||||
|
||||
myCStructure->ContainsFacet = 0;
|
||||
myStructureManager->Clear (this, theWithDestruction);
|
||||
|
||||
Update();
|
||||
@ -132,27 +127,27 @@ void Graphic3d_Structure::Remove()
|
||||
// Pass Standard_False to Clear(..) method to avoid updating in
|
||||
// structure manager, it isn't necessary, besides of it structure manager
|
||||
// could be already destroyed and invalid pointers used in structure;
|
||||
Standard_Integer Length = myGroups.Length();
|
||||
for (Standard_Integer aGrId = 1; aGrId <= Length; ++aGrId)
|
||||
myGroups.ChangeValue (aGrId)->Clear (Standard_False);
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myCStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
aGroupIter.ChangeValue()->Clear (Standard_False);
|
||||
}
|
||||
|
||||
// Standard_Address APtr = (void *) This ().operator->();
|
||||
Standard_Address APtr = (void *) this;
|
||||
// It is necessary to remove the eventual pointer on the structure
|
||||
// that can be destroyed, in the list of descendants
|
||||
// of ancesters of this structure and in the list of ancesters
|
||||
// of ancestors of this structure and in the list of ancestors
|
||||
// of descendants of the same structure.
|
||||
|
||||
Length = myDescendants.Length();
|
||||
for (Standard_Integer i = 1; i <= Length; ++i)
|
||||
const Standard_Integer aNbDesc = myDescendants.Length();
|
||||
for (Standard_Integer aStructIter = 1; aStructIter <= aNbDesc; ++aStructIter)
|
||||
{
|
||||
((Graphic3d_Structure *)(myDescendants.Value (i)))->Remove (APtr, Graphic3d_TOC_ANCESTOR);
|
||||
((Graphic3d_Structure *)(myDescendants.ChangeValue (aStructIter)))->Remove (APtr, Graphic3d_TOC_ANCESTOR);
|
||||
}
|
||||
|
||||
Length = myAncestors.Length();
|
||||
for (Standard_Integer i = 1; i <= Length; ++i)
|
||||
const Standard_Integer aNbAnces = myAncestors.Length();
|
||||
for (Standard_Integer aStructIter = 1; aStructIter <= aNbAnces; ++aStructIter)
|
||||
{
|
||||
((Graphic3d_Structure *)(myAncestors.Value (i)))->Remove (APtr, Graphic3d_TOC_DESCENDANT);
|
||||
((Graphic3d_Structure *)(myAncestors.ChangeValue (aStructIter)))->Remove (APtr, Graphic3d_TOC_DESCENDANT);
|
||||
}
|
||||
|
||||
myCStructure->ContainsFacet = 0;
|
||||
@ -519,7 +514,7 @@ Standard_Boolean Graphic3d_Structure::ContainsFacet() const
|
||||
const Standard_Integer aNbDesc = myDescendants.Length();
|
||||
for (Standard_Integer aStructIter = 1; aStructIter <= aNbDesc; ++aStructIter)
|
||||
{
|
||||
if (((Graphic3d_Structure *)(myDescendants.Value (aStructIter)))->ContainsFacet())
|
||||
if (((const Graphic3d_Structure *)(myDescendants.Value (aStructIter)))->ContainsFacet())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
@ -542,10 +537,9 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const
|
||||
// - if all these groups are empty
|
||||
// - or if all groups are empty and all their descendants are empty
|
||||
// - or if all its descendants are empty
|
||||
const Standard_Integer aNbGroups = myGroups.Length();
|
||||
for (Standard_Integer aGrpIter = 1; aGrpIter <= aNbGroups; ++aGrpIter)
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myCStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (!myGroups.Value (aGrpIter)->IsEmpty())
|
||||
if (!aGroupIter.Value()->IsEmpty())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@ -555,7 +549,7 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const
|
||||
const Standard_Integer aNbDesc = myDescendants.Length();
|
||||
for (Standard_Integer aDescIter = 1; aDescIter <= aNbDesc; ++aDescIter)
|
||||
{
|
||||
if (!((Graphic3d_Structure* )(myDescendants.Value (aDescIter)))->IsEmpty())
|
||||
if (!((const Graphic3d_Structure* )(myDescendants.Value (aDescIter)))->IsEmpty())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@ -685,23 +679,27 @@ Standard_Boolean Graphic3d_Structure::IsInfinite() const
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::GraphicClear (const Standard_Boolean theWithDestruction)
|
||||
{
|
||||
if (myCStructure.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// clean and empty each group
|
||||
const Standard_Integer aLength = myGroups.Length();
|
||||
for (Standard_Integer aGrId = 1; aGrId <= aLength; ++aGrId)
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myCStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
myGroups.ChangeValue (aGrId)->Clear();
|
||||
aGroupIter.ChangeValue()->Clear();
|
||||
}
|
||||
if (!theWithDestruction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theWithDestruction)
|
||||
while (!myCStructure->Groups().IsEmpty())
|
||||
{
|
||||
while (!myGroups.IsEmpty())
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = myGroups.First();
|
||||
aGroup->Remove();
|
||||
}
|
||||
|
||||
myCStructure->Clear();
|
||||
Handle(Graphic3d_Group) aGroup = myCStructure->Groups().First();
|
||||
aGroup->Remove();
|
||||
}
|
||||
myCStructure->Clear();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -945,7 +943,7 @@ Handle(Graphic3d_AspectFillArea3d) Graphic3d_Structure::FillArea3dAspect() const
|
||||
//=============================================================================
|
||||
const Graphic3d_SequenceOfGroup& Graphic3d_Structure::Groups() const
|
||||
{
|
||||
return myGroups;
|
||||
return myCStructure->Groups();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -954,7 +952,7 @@ const Graphic3d_SequenceOfGroup& Graphic3d_Structure::Groups() const
|
||||
//=============================================================================
|
||||
Standard_Integer Graphic3d_Structure::NumberOfGroups() const
|
||||
{
|
||||
return myGroups.Length();
|
||||
return myCStructure->Groups().Length();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -1782,17 +1780,6 @@ gp_Pnt Graphic3d_Structure::TransformPersistencePoint() const
|
||||
return aPnt;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::Add (const Handle(Graphic3d_Group)& theGroup)
|
||||
{
|
||||
// Method called only by the constructor of Graphic3d_Group
|
||||
// It is easy to check presence of <theGroup> in sequence myGroups.
|
||||
myGroups.Append (theGroup);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
@ -1831,21 +1818,29 @@ void Graphic3d_Structure::Remove (const Standard_Address thePtr,
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : NewGroup
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Handle(Graphic3d_Group) Graphic3d_Structure::NewGroup()
|
||||
{
|
||||
return myCStructure->NewGroup (this);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::Remove (const Handle(Graphic3d_Group)& theGroup)
|
||||
{
|
||||
const Standard_Integer aNbGroups = myGroups.Length();
|
||||
for (Standard_Integer aGrpIter = 1; aGrpIter <= aNbGroups; ++aGrpIter)
|
||||
if (theGroup.IsNull()
|
||||
|| theGroup->myStructure != this)
|
||||
{
|
||||
if (myGroups.Value (aGrpIter) == theGroup)
|
||||
{
|
||||
myGroups.Remove (aGrpIter);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
myCStructure->RemoveGroup (theGroup);
|
||||
theGroup->myStructure = NULL;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -1886,10 +1881,9 @@ void Graphic3d_Structure::MinMaxCoord (Standard_Real& theXMin,
|
||||
Standard_Real aYMax = RealFirst();
|
||||
Standard_Real aZMax = RealFirst();
|
||||
Standard_Real aGroupXMin, aGroupYMin, aGroupZMin, aGroupXMax, aGroupYMax, aGroupZMax;
|
||||
for (Standard_Integer aGroupIt = 1; aGroupIt <= myGroups.Length(); aGroupIt++)
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myCStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Group)& aGroup = myGroups.Value (aGroupIt);
|
||||
|
||||
const Handle(Graphic3d_Group)& aGroup = aGroupIter.Value();
|
||||
if (aGroup->IsEmpty())
|
||||
{
|
||||
continue;
|
||||
@ -2409,7 +2403,7 @@ void Graphic3d_Structure::GraphicHighlight (const Aspect_TypeOfHighlightMethod t
|
||||
myCStructure->BoundBox.Color.r = float (anRGB[0]);
|
||||
myCStructure->BoundBox.Color.g = float (anRGB[1]);
|
||||
myCStructure->BoundBox.Color.b = float (anRGB[2]);
|
||||
myCStructure->HighlightWithBndBox (Standard_True);
|
||||
myCStructure->HighlightWithBndBox (this, Standard_True);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2445,7 +2439,7 @@ void Graphic3d_Structure::GraphicUnHighlight()
|
||||
myCStructure->UpdateNamedStatus();
|
||||
break;
|
||||
case Aspect_TOHM_BOUNDBOX:
|
||||
myCStructure->HighlightWithBndBox (Standard_False);
|
||||
myCStructure->HighlightWithBndBox (this, Standard_False);
|
||||
myCStructure->UpdateNamedStatus();
|
||||
break;
|
||||
}
|
||||
@ -2505,15 +2499,6 @@ Standard_Boolean Graphic3d_Structure::HLRValidation() const
|
||||
&& myCStructure->HLRValidation != 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CStructure
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Graphic3d_CStructure)& Graphic3d_Structure::CStructure() const
|
||||
{
|
||||
return myCStructure;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
|
23
src/Graphic3d/Graphic3d_Structure.lxx
Normal file
23
src/Graphic3d/Graphic3d_Structure.lxx
Normal file
@ -0,0 +1,23 @@
|
||||
// Created on: 2014-03-23
|
||||
// Created by: Kirill Gavrilov
|
||||
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// =======================================================================
|
||||
// function : CStructure
|
||||
// purpose : Returns the low-level structure
|
||||
// =======================================================================
|
||||
inline const Handle(Graphic3d_CStructure)& Graphic3d_Structure::CStructure() const
|
||||
{
|
||||
return myCStructure;
|
||||
}
|
@ -42,6 +42,4 @@
|
||||
// /2 pour eviter les problemes d'overflow
|
||||
#define Structure_IDMAX INT_MAX/2
|
||||
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
#endif
|
||||
|
@ -15,44 +15,9 @@
|
||||
#ifndef InterfaceGraphic_Graphic3dHeader
|
||||
#define InterfaceGraphic_Graphic3dHeader
|
||||
|
||||
#include <Graphic3d_ShaderProgram_Handle.hxx>
|
||||
#include <InterfaceGraphic_PrimitiveArray.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
#ifdef THIS
|
||||
#undef THIS
|
||||
#endif
|
||||
|
||||
#define CALL_DEF_STRUCTHIGHLIGHTED 1
|
||||
#define CALL_DEF_STRUCTPICKABLE 2
|
||||
#define CALL_DEF_STRUCTVISIBLE 3
|
||||
|
||||
#define CALL_DEF_STRUCTNOHIGHLIGHTED 11
|
||||
#define CALL_DEF_STRUCTNOPICKABLE 12
|
||||
#define CALL_DEF_STRUCTNOVISIBLE 13
|
||||
|
||||
/* LISTE D'ENTIERS */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbIntegers;
|
||||
|
||||
int *Integers;
|
||||
|
||||
} CALL_DEF_LISTINTEGERS;
|
||||
|
||||
|
||||
/* LISTE DE REELS */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbReals;
|
||||
|
||||
float *Reals;
|
||||
|
||||
} CALL_DEF_LISTREALS;
|
||||
|
||||
|
||||
/* COULEUR */
|
||||
|
||||
typedef struct {
|
||||
@ -61,47 +26,6 @@ typedef struct {
|
||||
|
||||
} CALL_DEF_COLOR;
|
||||
|
||||
|
||||
/* ARETE */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int Index1, Index2;
|
||||
|
||||
int Type;
|
||||
|
||||
} CALL_DEF_EDGE;
|
||||
|
||||
|
||||
/* LISTE D'ARETES */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbEdges;
|
||||
|
||||
CALL_DEF_EDGE *Edges;
|
||||
|
||||
} CALL_DEF_LISTEDGES;
|
||||
|
||||
|
||||
/* NORMALE */
|
||||
|
||||
typedef struct {
|
||||
|
||||
float dx, dy, dz;
|
||||
|
||||
} CALL_DEF_NORMAL;
|
||||
|
||||
|
||||
/* TEXTURE COORD */
|
||||
|
||||
typedef struct {
|
||||
|
||||
float tx, ty;
|
||||
|
||||
} CALL_DEF_TEXTURE_COORD;
|
||||
|
||||
|
||||
/* POINT */
|
||||
|
||||
typedef struct {
|
||||
@ -110,55 +34,6 @@ typedef struct {
|
||||
|
||||
} CALL_DEF_POINT;
|
||||
|
||||
|
||||
/* POINTC */
|
||||
|
||||
typedef struct {
|
||||
|
||||
CALL_DEF_POINT Point;
|
||||
|
||||
CALL_DEF_COLOR Color;
|
||||
|
||||
} CALL_DEF_POINTC;
|
||||
|
||||
|
||||
/* POINTN */
|
||||
|
||||
typedef struct {
|
||||
|
||||
CALL_DEF_POINT Point;
|
||||
|
||||
CALL_DEF_NORMAL Normal;
|
||||
|
||||
} CALL_DEF_POINTN;
|
||||
|
||||
|
||||
/* POINTNT */
|
||||
|
||||
typedef struct {
|
||||
|
||||
CALL_DEF_POINT Point;
|
||||
|
||||
CALL_DEF_NORMAL Normal;
|
||||
|
||||
CALL_DEF_TEXTURE_COORD TextureCoord;
|
||||
|
||||
} CALL_DEF_POINTNT;
|
||||
|
||||
|
||||
/* POINTNC */
|
||||
|
||||
typedef struct {
|
||||
|
||||
CALL_DEF_POINT Point;
|
||||
|
||||
CALL_DEF_NORMAL Normal;
|
||||
|
||||
CALL_DEF_COLOR Color;
|
||||
|
||||
} CALL_DEF_POINTNC;
|
||||
|
||||
|
||||
/* BOITE ENGLOBANTE */
|
||||
|
||||
typedef struct {
|
||||
@ -171,175 +46,6 @@ typedef struct {
|
||||
|
||||
} CALL_DEF_BOUNDBOX;
|
||||
|
||||
|
||||
/* LISTE DE POINTS */
|
||||
|
||||
typedef union {
|
||||
|
||||
CALL_DEF_POINT *Points;
|
||||
|
||||
CALL_DEF_POINTN *PointsN;
|
||||
|
||||
CALL_DEF_POINTC *PointsC;
|
||||
|
||||
CALL_DEF_POINTNC *PointsNC;
|
||||
|
||||
CALL_DEF_POINTNT *PointsNT;
|
||||
|
||||
} CALL_DEF_UPOINTS;
|
||||
|
||||
|
||||
/* LISTE DE POINTS */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbPoints;
|
||||
|
||||
int TypePoints;
|
||||
|
||||
CALL_DEF_UPOINTS UPoints;
|
||||
|
||||
} CALL_DEF_LISTPOINTS;
|
||||
|
||||
|
||||
/* MARKER */
|
||||
|
||||
typedef struct {
|
||||
|
||||
float x, y, z;
|
||||
|
||||
} CALL_DEF_MARKER;
|
||||
|
||||
|
||||
/* LISTE DE MARKERS */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbMarkers;
|
||||
|
||||
CALL_DEF_MARKER *Markers;
|
||||
|
||||
} CALL_DEF_LISTMARKERS;
|
||||
|
||||
|
||||
/* TEXTE */
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned short *string;
|
||||
|
||||
CALL_DEF_POINT Position;
|
||||
|
||||
float Height;
|
||||
|
||||
float Angle;
|
||||
|
||||
int Path;
|
||||
|
||||
int HAlign;
|
||||
|
||||
int VAlign;
|
||||
|
||||
bool Zoomable;
|
||||
|
||||
} CALL_DEF_TEXT;
|
||||
|
||||
|
||||
/* FACETTE */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NormalIsDefined;
|
||||
|
||||
CALL_DEF_NORMAL Normal;
|
||||
|
||||
int ColorIsDefined;
|
||||
|
||||
CALL_DEF_COLOR Color;
|
||||
|
||||
int TypeFacet;
|
||||
|
||||
int NbPoints;
|
||||
|
||||
int TypePoints;
|
||||
|
||||
CALL_DEF_UPOINTS UPoints;
|
||||
|
||||
} CALL_DEF_FACET;
|
||||
|
||||
|
||||
/* LISTE DE FACETTES */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbFacets;
|
||||
|
||||
CALL_DEF_FACET *LFacets;
|
||||
|
||||
} CALL_DEF_LISTFACETS;
|
||||
|
||||
|
||||
/* QUADRILATERE */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbPoints;
|
||||
|
||||
int TypePoints;
|
||||
|
||||
int SizeRow;
|
||||
int SizeCol;
|
||||
|
||||
CALL_DEF_UPOINTS UPoints;
|
||||
|
||||
} CALL_DEF_QUAD;
|
||||
|
||||
|
||||
/* TRIANGLE */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int NbPoints;
|
||||
|
||||
int TypePoints;
|
||||
|
||||
CALL_DEF_UPOINTS UPoints;
|
||||
|
||||
} CALL_DEF_TRIKE;
|
||||
|
||||
|
||||
/* PICK IDENTIFICATEUR */
|
||||
|
||||
typedef struct {
|
||||
|
||||
int IsDef;
|
||||
|
||||
int IsSet;
|
||||
|
||||
int Value;
|
||||
|
||||
} CALL_DEF_PICKID;
|
||||
|
||||
|
||||
/* CONTEXTE LIGNE */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int IsDef;
|
||||
|
||||
int IsSet;
|
||||
|
||||
CALL_DEF_COLOR Color;
|
||||
|
||||
int LineType;
|
||||
|
||||
float Width;
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
|
||||
} CALL_DEF_CONTEXTLINE;
|
||||
|
||||
|
||||
/* MATERIAL */
|
||||
|
||||
typedef struct {
|
||||
@ -369,39 +75,6 @@ typedef struct {
|
||||
|
||||
} CALL_DEF_MATERIAL;
|
||||
|
||||
|
||||
/* CONTEXTE TEXT */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int IsDef;
|
||||
|
||||
int IsSet;
|
||||
|
||||
const char* Font;
|
||||
|
||||
float Space;
|
||||
|
||||
float Expan;
|
||||
|
||||
CALL_DEF_COLOR Color;
|
||||
|
||||
int Style;
|
||||
|
||||
int DisplayType;
|
||||
|
||||
CALL_DEF_COLOR ColorSubTitle;
|
||||
|
||||
int TextZoomable;
|
||||
|
||||
float TextAngle;
|
||||
|
||||
int TextFontAspect;
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) ShaderProgram;
|
||||
|
||||
} CALL_DEF_CONTEXTTEXT;
|
||||
|
||||
/* Transform persistence struct */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ OpenGl_GraphicDriver.hxx
|
||||
OpenGl_GraphicDriver.cxx
|
||||
OpenGl_GraphicDriver_1.cxx
|
||||
OpenGl_GraphicDriver_2.cxx
|
||||
OpenGl_GraphicDriver_3.cxx
|
||||
OpenGl_GraphicDriver_4.cxx
|
||||
OpenGl_GraphicDriver_7.cxx
|
||||
OpenGl_GraphicDriver_713.cxx
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <OpenGl_Texture.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Graphic3d_CGroup.hxx>
|
||||
#include <Graphic3d_ShaderProgram.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <Graphic3d_TypeOfReflection.hxx>
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <OpenGl_Element.hxx>
|
||||
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_CAspectFillArea.hxx>
|
||||
#include <Graphic3d_ShaderProgram_Handle.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
|
||||
@ -35,8 +36,6 @@
|
||||
#define OPENGL_SPECULAR_MASK (1<<2)
|
||||
#define OPENGL_EMISSIVE_MASK (1<<3)
|
||||
|
||||
class CALL_DEF_CONTEXTFILLAREA;
|
||||
|
||||
struct OPENGL_SURF_PROP
|
||||
{
|
||||
float amb, diff, spec, emsv;
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Graphic3d_CAspectLine.hxx>
|
||||
|
||||
#include <Handle_OpenGl_ShaderProgram.hxx>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <Graphic3d_CGroup.hxx>
|
||||
#include <Graphic3d_CAspectMarker.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <OpenGl_Element.hxx>
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <Font_FontAspect.hxx>
|
||||
#include <Aspect_TypeOfStyleText.hxx>
|
||||
#include <Aspect_TypeOfDisplayText.hxx>
|
||||
#include <Graphic3d_CAspectText.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_CappingPlaneResource.hxx>
|
||||
#include <OpenGl_Vec.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(OpenGl_CappingAlgoFilter, OpenGl_RenderFilter)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_CappingAlgoFilter, OpenGl_RenderFilter)
|
||||
@ -63,8 +64,8 @@ namespace
|
||||
// function : RenderCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_ListOfGroup& theGroups)
|
||||
void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Graphic3d_SequenceOfGroup& theGroups)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
|
||||
@ -134,8 +135,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks
|
||||
glStencilFunc (GL_ALWAYS, 1, 0x01);
|
||||
glStencilOp (GL_KEEP, GL_INVERT, GL_INVERT);
|
||||
|
||||
OpenGl_ListOfGroup::Iterator aGroupIt (theGroups);
|
||||
for (; aGroupIt.More(); aGroupIt.Next())
|
||||
for (OpenGl_Structure::GroupIterator aGroupIt (theGroups); aGroupIt.More(); aGroupIt.Next())
|
||||
{
|
||||
aGroupIt.Value()->Render (theWorkspace);
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <OpenGl_RenderFilter.hxx>
|
||||
#include <OpenGl_Group.hxx>
|
||||
|
||||
#include <Graphic3d_SequenceOfGroup.hxx>
|
||||
|
||||
// Forward declaration
|
||||
class Handle(OpenGl_Workspace);
|
||||
class Handle(Graphic3d_ClipPlane);
|
||||
@ -35,8 +37,8 @@ public:
|
||||
//! for the passed groups.
|
||||
//! @param theWorkspace [in] the GL workspace, context state.
|
||||
//! @param theGroups [in] the group of primitives to be capped.
|
||||
Standard_EXPORT static void RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const OpenGl_ListOfGroup& theGroups);
|
||||
Standard_EXPORT static void RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Graphic3d_SequenceOfGroup& theGroups);
|
||||
|
||||
//! Render infinite capping plane.
|
||||
//! @param theWorkspace [in] the GL workspace, context state.
|
||||
|
@ -198,9 +198,9 @@ void OpenGl_GraduatedTrihedron::Release (const Handle(OpenGl_Context)& theCtx)
|
||||
}
|
||||
|
||||
OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron (const Graphic3d_CGraduatedTrihedron& theData)
|
||||
: myLabelX (theData.xname, OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelY (theData.yname, OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelZ (theData.zname, OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS),
|
||||
: myLabelX (NCollection_String ((Standard_Utf16Char* )theData.xname.ToExtString()).ToCString(), OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelY (NCollection_String ((Standard_Utf16Char* )theData.yname.ToExtString()).ToCString(), OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelZ (NCollection_String ((Standard_Utf16Char* )theData.zname.ToExtString()).ToCString(), OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS),
|
||||
myToDrawXName (theData.xdrawname == Standard_True),
|
||||
myToDrawYName (theData.ydrawname == Standard_True),
|
||||
myToDrawZName (theData.zdrawname == Standard_True),
|
||||
|
@ -273,89 +273,6 @@ Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& theCView,
|
||||
return isPrinted;
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::SetStencilTestOptions (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Boolean theIsEnabled)
|
||||
{
|
||||
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
|
||||
aStencilTest->SetOptions (theIsEnabled);
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aStencilTest);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_GraphicDriver::Text (const Graphic3d_CGroup& theCGroup,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Quantity_PlaneAngle /*theAngle*/,
|
||||
const Graphic3d_TextPath /*theTp*/,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean /*theToEvalMinMax*/)
|
||||
{
|
||||
if (theCGroup.ptrGroup == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_TextParam aParams;
|
||||
aParams.Height = int ((theHeight < 2.0) ? DefaultTextHeight() : theHeight);
|
||||
aParams.HAlign = theHta;
|
||||
aParams.VAlign = theVta;
|
||||
const OpenGl_Vec3 aPoint (thePoint.X(), thePoint.Y(), thePoint.Z());
|
||||
OpenGl_Text* aText = new OpenGl_Text (theText, aPoint, aParams);
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aText);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose : Wrapper CString -> TCollection_ExtendedString
|
||||
// =======================================================================
|
||||
void OpenGl_GraphicDriver::Text (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_CString theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
OpenGl_GraphicDriver::Text (theCGroup, TCollection_ExtendedString (theText),
|
||||
thePoint, theHeight, theAngle, theTp, theHta, theVta, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose : Wrapper CString -> TCollection_ExtendedString
|
||||
// =======================================================================
|
||||
void OpenGl_GraphicDriver::Text (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_CString theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
OpenGl_GraphicDriver::Text (theCGroup, TCollection_ExtendedString (theText), thePoint, theHeight, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose : Wrapper with default values
|
||||
// =======================================================================
|
||||
void OpenGl_GraphicDriver::Text (const Graphic3d_CGroup& theCGroup,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
OpenGl_GraphicDriver::Text (theCGroup,
|
||||
theText, thePoint, theHeight, 0.0,
|
||||
Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM,
|
||||
theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ZBufferTriedronSetup
|
||||
// purpose :
|
||||
@ -509,16 +426,3 @@ void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues (const Standard_ShortR
|
||||
{
|
||||
OpenGl_GraduatedTrihedron::SetMinMax (theMinX, theMinY, theMinZ, theMaxX, theMaxY, theMaxZ);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetFlippingOptions
|
||||
// purpose : Enable or disable flipping option for the given group
|
||||
// =======================================================================
|
||||
void OpenGl_GraphicDriver::SetFlippingOptions (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Boolean theIsEnabled,
|
||||
const gp_Ax2& theRefPlane)
|
||||
{
|
||||
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
|
||||
aFlipper->SetOptions (theIsEnabled);
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aFlipper);
|
||||
}
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Graphic3d_CView.hxx>
|
||||
#include <Graphic3d_CStructure.hxx>
|
||||
#include <Graphic3d_CGroup.hxx>
|
||||
#include <Graphic3d_TypeOfPrimitive.hxx>
|
||||
#include <Graphic3d_CPick.hxx>
|
||||
#include <Graphic3d_TextPath.hxx>
|
||||
@ -108,20 +107,6 @@ public:
|
||||
Standard_EXPORT Standard_Integer InquireLightLimit ();
|
||||
Standard_EXPORT Standard_Integer InquireViewLimit ();
|
||||
|
||||
public: // Methods for graphical groups
|
||||
|
||||
Standard_EXPORT void ClearGroup (const Graphic3d_CGroup& ACGroup);
|
||||
Standard_EXPORT void FaceContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert);
|
||||
Standard_EXPORT void Group (Graphic3d_CGroup& theCGroup);
|
||||
Standard_EXPORT void LineContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert);
|
||||
Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert);
|
||||
Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup);
|
||||
Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert);
|
||||
|
||||
public: // Methods for graphical structures
|
||||
|
||||
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
|
||||
@ -171,13 +156,6 @@ public:
|
||||
Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
|
||||
Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
|
||||
Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
|
||||
Standard_EXPORT void SetStencilTestOptions (const Graphic3d_CGroup& theCGroup, const Standard_Boolean theIsEnabled);
|
||||
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_EXPORT void PrimitiveArray (const Graphic3d_CGroup& ACGroup,const Graphic3d_PrimitiveArray& parray,const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_EXPORT void UserDraw (const Graphic3d_CGroup& ACGroup,const Graphic3d_CUserDraw& AUserDraw);
|
||||
Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
|
||||
Standard_EXPORT void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True);
|
||||
Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
|
||||
@ -202,7 +180,6 @@ public:
|
||||
Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
|
||||
Standard_EXPORT void UnsetTransparency ();
|
||||
Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
|
||||
Standard_EXPORT void SetFlippingOptions (const Graphic3d_CGroup& theCGroup, const Standard_Boolean theIsEnabled, const gp_Ax2& theRefPlane);
|
||||
|
||||
//! Set text attributes for under-/overlayer.
|
||||
//! @param theFontName the name of the font to be used
|
||||
|
@ -1,81 +0,0 @@
|
||||
// Created on: 2011-10-20
|
||||
// Created by: Sergey ZERCHANINOV
|
||||
// Copyright (c) 2011-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.
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
|
||||
#include <OpenGl_Display.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
|
||||
void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup)
|
||||
{
|
||||
if (theCGroup.ptrGroup == NULL)
|
||||
return;
|
||||
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->Release (GetSharedContext());
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert)
|
||||
{
|
||||
if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL)
|
||||
return;
|
||||
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert);
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
|
||||
{
|
||||
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
|
||||
if (aStructure != NULL)
|
||||
{
|
||||
theCGroup.ptrGroup = aStructure->AddGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert)
|
||||
{
|
||||
if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return;
|
||||
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert);
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert)
|
||||
{
|
||||
if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return;
|
||||
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
|
||||
{
|
||||
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct;
|
||||
if (aStructure == NULL)
|
||||
return;
|
||||
|
||||
aStructure->RemoveGroup (GetSharedContext(), (const OpenGl_Group* )theCGroup.ptrGroup);
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup,
|
||||
const Standard_Integer theNoInsert)
|
||||
{
|
||||
if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL)
|
||||
return;
|
||||
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert);
|
||||
}
|
@ -61,28 +61,3 @@ Standard_Boolean OpenGl_GraphicDriver::IsGLLightEnabled( const Graphic3d_CView&
|
||||
return aCView->WS->UseGLLight();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::PrimitiveArray( const Graphic3d_CGroup& ACGroup,
|
||||
const Graphic3d_PrimitiveArray& parray,
|
||||
const Standard_Boolean /*EvalMinMax*/ )
|
||||
{
|
||||
if ( ACGroup.ptrGroup && parray )
|
||||
{
|
||||
OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray );
|
||||
((OpenGl_Group *)ACGroup.ptrGroup)->AddElement (aparray);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::UserDraw (const Graphic3d_CGroup& theCGroup,
|
||||
const Graphic3d_CUserDraw& theUserDraw)
|
||||
{
|
||||
if (theCGroup.ptrGroup != NULL
|
||||
&& myUserDrawCallback != NULL)
|
||||
{
|
||||
OpenGl_Element* aUserDraw = myUserDrawCallback(&theUserDraw);
|
||||
if (aUserDraw != NULL)
|
||||
{
|
||||
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (aUserDraw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,31 +18,42 @@
|
||||
#endif
|
||||
|
||||
#include <OpenGl_Group.hxx>
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OpenGl_Flipper.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_StencilTest.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_Text.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
#include <Graphic3d_CUserDraw.hxx>
|
||||
#include <Graphic3d_GroupDefinitionError.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (OpenGl_Group, Graphic3d_Group)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Group, Graphic3d_Group)
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_Group
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
#ifndef HAVE_OPENCL
|
||||
OpenGl_Group::OpenGl_Group()
|
||||
#else
|
||||
OpenGl_Group::OpenGl_Group (const OpenGl_Structure* theAncestorStructure)
|
||||
#endif
|
||||
: myAspectLine(NULL),
|
||||
OpenGl_Group::OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct)
|
||||
: Graphic3d_Group (theStruct),
|
||||
myAspectLine(NULL),
|
||||
myAspectFace(NULL),
|
||||
myAspectMarker(NULL),
|
||||
myAspectText(NULL),
|
||||
myFirst(NULL),
|
||||
myLast(NULL)
|
||||
myLast(NULL),
|
||||
myIsRaytracable (Standard_False),
|
||||
myModificationState (0)
|
||||
{
|
||||
#ifdef HAVE_OPENCL
|
||||
myAncestorStructure = theAncestorStructure;
|
||||
myIsRaytracable = Standard_False;
|
||||
myModificationState = 0; // initial state
|
||||
#endif
|
||||
Handle(OpenGl_Structure) aStruct = Handle(OpenGl_Structure)::DownCast (myStructure->CStructure());
|
||||
if (aStruct == NULL)
|
||||
{
|
||||
Graphic3d_GroupDefinitionError::Raise ("OpenGl_Group should be created by OpenGl_Structure!");
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -55,109 +66,227 @@ OpenGl_Group::~OpenGl_Group()
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAspectLine
|
||||
// function : UpdateAspectLine
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetAspectLine (const CALL_DEF_CONTEXTLINE& theAspect,
|
||||
const Standard_Boolean theIsGlobal)
|
||||
void OpenGl_Group::UpdateAspectLine (const Standard_Boolean theIsGlobal)
|
||||
{
|
||||
if (!ContextLine.IsDef)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theIsGlobal || myFirst == NULL)
|
||||
{
|
||||
if (myAspectLine == NULL)
|
||||
{
|
||||
myAspectLine = new OpenGl_AspectLine();
|
||||
}
|
||||
myAspectLine->SetAspect (theAspect);
|
||||
myAspectLine->SetAspect (ContextLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine();
|
||||
anAspectLine->SetAspect (theAspect);
|
||||
anAspectLine->SetAspect (ContextLine);
|
||||
AddElement (anAspectLine);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAspectFace
|
||||
// function : UpdateAspectFace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theAspect,
|
||||
const Standard_Boolean theIsGlobal)
|
||||
void OpenGl_Group::UpdateAspectFace (const Standard_Boolean theIsGlobal)
|
||||
{
|
||||
if (!ContextFillArea.IsDef)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theIsGlobal || myFirst == NULL)
|
||||
{
|
||||
if (myAspectFace == NULL)
|
||||
{
|
||||
myAspectFace = new OpenGl_AspectFace();
|
||||
}
|
||||
myAspectFace->SetAspect (theAspect);
|
||||
myAspectFace->SetAspect (ContextFillArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace();
|
||||
anAspectFace->SetAspect (theAspect);
|
||||
anAspectFace->SetAspect (ContextFillArea);
|
||||
AddElement (anAspectFace);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
if (myIsRaytracable)
|
||||
{
|
||||
myModificationState++;
|
||||
|
||||
if (myAncestorStructure != NULL)
|
||||
++myModificationState;
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
if (aStruct != NULL)
|
||||
{
|
||||
myAncestorStructure->UpdateStateWithAncestorStructures();
|
||||
aStruct->UpdateStateWithAncestorStructures();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAspectMarker
|
||||
// function : UpdateAspectMarker
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect,
|
||||
const Standard_Boolean theIsGlobal)
|
||||
void OpenGl_Group::UpdateAspectMarker (const Standard_Boolean theIsGlobal)
|
||||
{
|
||||
if (!ContextMarker.IsDef)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theIsGlobal || myFirst == NULL)
|
||||
{
|
||||
if (myAspectMarker == NULL)
|
||||
{
|
||||
myAspectMarker = new OpenGl_AspectMarker();
|
||||
}
|
||||
myAspectMarker->SetAspect (theAspect);
|
||||
myAspectMarker->SetAspect (ContextMarker);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker();
|
||||
anAspectMarker->SetAspect (theAspect);
|
||||
anAspectMarker->SetAspect (ContextMarker);
|
||||
AddElement (anAspectMarker);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAspectText
|
||||
// function : UpdateAspectText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetAspectText (const CALL_DEF_CONTEXTTEXT& theAspect,
|
||||
const Standard_Boolean theIsGlobal)
|
||||
void OpenGl_Group::UpdateAspectText (const Standard_Boolean theIsGlobal)
|
||||
{
|
||||
if (!ContextText.IsDef)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theIsGlobal || myFirst == NULL)
|
||||
{
|
||||
if (myAspectText == NULL)
|
||||
{
|
||||
myAspectText = new OpenGl_AspectText();
|
||||
}
|
||||
myAspectText->SetAspect (theAspect);
|
||||
myAspectText->SetAspect (ContextText);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenGl_AspectText* anAspectText = new OpenGl_AspectText();
|
||||
anAspectText->SetAspect (theAspect);
|
||||
anAspectText->SetAspect (ContextText);
|
||||
AddElement (anAspectText);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddPrimitiveArray
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted()
|
||||
|| !thePrim->IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_PrimitiveArray* anArray = new OpenGl_PrimitiveArray ((CALL_DEF_PARRAY *)thePrim->Array());
|
||||
AddElement (anArray);
|
||||
|
||||
Graphic3d_Group::AddPrimitiveArray (thePrim, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::Text (const Standard_CString theTextUtf,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_TextParam aParams;
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
aParams.Height = int ((theHeight < 2.0) ? aStruct->GlDriver()->DefaultTextHeight() : theHeight);
|
||||
aParams.HAlign = theHta;
|
||||
aParams.VAlign = theVta;
|
||||
const OpenGl_Vec3 aPoint (thePoint.X(), thePoint.Y(), thePoint.Z());
|
||||
OpenGl_Text* aText = new OpenGl_Text (theTextUtf, aPoint, aParams);
|
||||
AddElement (aText);
|
||||
Graphic3d_Group::Text (theTextUtf, thePoint, theHeight, theAngle,
|
||||
theTp, theHta, theVta, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UserDraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::UserDraw (const Standard_Address theObject,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theContainsFacet)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
if (aStruct->GlDriver()->UserDrawCallback() == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Graphic3d_CUserDraw aUserDraw;
|
||||
aUserDraw.Data = theObject;
|
||||
aUserDraw.Bounds = theToEvalMinMax ? &myBounds : NULL;
|
||||
OpenGl_Element* aUserDrawElem = aStruct->GlDriver()->UserDrawCallback()(&aUserDraw);
|
||||
if (aUserDrawElem != NULL)
|
||||
{
|
||||
AddElement (aUserDrawElem);
|
||||
}
|
||||
Graphic3d_Group::UserDraw (theObject, theToEvalMinMax, theContainsFacet);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetFlippingOptions
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
||||
const gp_Ax2& theRefPlane)
|
||||
{
|
||||
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
|
||||
aFlipper->SetOptions (theIsEnabled);
|
||||
AddElement (aFlipper);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetStencilTestOptions
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
|
||||
{
|
||||
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
|
||||
aStencilTest->SetOptions (theIsEnabled);
|
||||
AddElement (aStencilTest);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddElement
|
||||
// purpose :
|
||||
@ -177,10 +306,11 @@ void OpenGl_Group::AddElement (OpenGl_Element* theElem)
|
||||
myModificationState++;
|
||||
myIsRaytracable = Standard_True;
|
||||
|
||||
if (myAncestorStructure != NULL)
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
if (aStruct != NULL)
|
||||
{
|
||||
myAncestorStructure->UpdateStateWithAncestorStructures();
|
||||
myAncestorStructure->SetRaytracableWithAncestorStructures();
|
||||
aStruct->UpdateStateWithAncestorStructures();
|
||||
aStruct->SetRaytracableWithAncestorStructures();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -222,6 +352,24 @@ void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
theWorkspace->SetAspectText (aBackAspectText);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Clear
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::Clear (const Standard_Boolean theToUpdateStructureMgr)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
const Handle(OpenGl_Context)& aCtx = aStruct->GlDriver()->GetSharedContext();
|
||||
|
||||
Release (aCtx);
|
||||
Graphic3d_Group::Clear (theToUpdateStructureMgr);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Release
|
||||
// purpose :
|
||||
|
@ -16,21 +16,20 @@
|
||||
#ifndef _OpenGl_Group_Header
|
||||
#define _OpenGl_Group_Header
|
||||
|
||||
#include <NCollection_List.hxx>
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
|
||||
#include <OpenGl_Element.hxx>
|
||||
|
||||
#include <NCollection_List.hxx>
|
||||
#include <OpenGl_AspectLine.hxx>
|
||||
#include <OpenGl_AspectFace.hxx>
|
||||
#include <OpenGl_AspectMarker.hxx>
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
|
||||
class OpenGl_Group;
|
||||
class OpenGl_Structure;
|
||||
|
||||
typedef NCollection_List<const OpenGl_Group* > OpenGl_ListOfGroup;
|
||||
|
||||
struct OpenGl_ElementNode
|
||||
{
|
||||
OpenGl_Element* elem;
|
||||
@ -38,25 +37,63 @@ struct OpenGl_ElementNode
|
||||
DEFINE_STANDARD_ALLOC
|
||||
};
|
||||
|
||||
class OpenGl_Group : public OpenGl_Element
|
||||
//! Implementation of low-level graphic group.
|
||||
class OpenGl_Group : public Graphic3d_Group
|
||||
{
|
||||
public:
|
||||
|
||||
#ifndef HAVE_OPENCL
|
||||
OpenGl_Group();
|
||||
#else
|
||||
OpenGl_Group (const OpenGl_Structure* theAncestorStructure);
|
||||
#endif
|
||||
//! Create empty group.
|
||||
//! Will throw exception if not created by OpenGl_Structure.
|
||||
Standard_EXPORT OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct);
|
||||
|
||||
void SetAspectLine (const CALL_DEF_CONTEXTLINE& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
||||
void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
||||
void SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
||||
void SetAspectText (const CALL_DEF_CONTEXTTEXT& theAspect, const Standard_Boolean IsGlobal = Standard_True);
|
||||
Standard_EXPORT virtual void Clear (const Standard_Boolean theToUpdateStructureMgr);
|
||||
|
||||
void AddElement (OpenGl_Element* theElem);
|
||||
//! Update line aspect
|
||||
Standard_EXPORT virtual void UpdateAspectLine (const Standard_Boolean theIsGlobal);
|
||||
|
||||
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
||||
//! Update fill aspect
|
||||
Standard_EXPORT virtual void UpdateAspectFace (const Standard_Boolean theIsGlobal);
|
||||
|
||||
//! Update marker aspect
|
||||
Standard_EXPORT virtual void UpdateAspectMarker (const Standard_Boolean theIsGlobal);
|
||||
|
||||
//! Update text aspect
|
||||
Standard_EXPORT virtual void UpdateAspectText (const Standard_Boolean theIsGlobal);
|
||||
|
||||
//! Add primitive array element
|
||||
Standard_EXPORT virtual void AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim,
|
||||
const Standard_Boolean theToEvalMinMax);
|
||||
|
||||
//! Add text element
|
||||
Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax);
|
||||
|
||||
//! Add UserDraw element using obsolete API
|
||||
Standard_EXPORT virtual void UserDraw (const Standard_Address theObject,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theContainsFacet);
|
||||
|
||||
//! Add flipping element
|
||||
Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
||||
const gp_Ax2& theRefPlane);
|
||||
|
||||
//! Add stencil test element
|
||||
Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled);
|
||||
|
||||
public:
|
||||
|
||||
OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); }
|
||||
|
||||
Standard_EXPORT void AddElement (OpenGl_Element* theElem);
|
||||
|
||||
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Returns first OpenGL element node of the group.
|
||||
const OpenGl_ElementNode* FirstNode() const { return myFirst; }
|
||||
@ -64,19 +101,18 @@ public:
|
||||
//! Returns OpenGL face aspect.
|
||||
const OpenGl_AspectFace* AspectFace() const { return myAspectFace; }
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
//! Returns modification state for ray-tracing.
|
||||
Standard_Size ModificationState() const { return myModificationState; }
|
||||
|
||||
//! Is the group ray-tracable (contains ray-tracable elements)?
|
||||
Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
|
||||
|
||||
#endif
|
||||
//! Accessor to line aspect (to be removed)
|
||||
CALL_DEF_CONTEXTLINE& ChangeContextLine() { return ContextLine; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~OpenGl_Group();
|
||||
Standard_EXPORT virtual ~OpenGl_Group();
|
||||
|
||||
protected:
|
||||
|
||||
@ -88,16 +124,15 @@ protected:
|
||||
OpenGl_ElementNode* myFirst;
|
||||
OpenGl_ElementNode* myLast;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
const OpenGl_Structure* myAncestorStructure;
|
||||
Standard_Boolean myIsRaytracable;
|
||||
Standard_Size myModificationState;
|
||||
#endif
|
||||
Standard_Boolean myIsRaytracable;
|
||||
Standard_Size myModificationState;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_STANDARD_RTTI(OpenGl_Group) // Type definition
|
||||
|
||||
};
|
||||
|
||||
#endif //_OpenGl_Group_Header
|
||||
DEFINE_STANDARD_HANDLE(OpenGl_Group, Graphic3d_Group)
|
||||
|
||||
#endif // _OpenGl_Group_Header
|
||||
|
@ -370,12 +370,12 @@ namespace OpenGl_Raytrace
|
||||
// function : IsRaytracedStructure
|
||||
// purpose : Checks to see if the structure contains ray-trace geometry
|
||||
// =======================================================================
|
||||
Standard_Boolean IsRaytracedStructure (const OpenGl_Structure *theStructure)
|
||||
Standard_Boolean IsRaytracedStructure (const OpenGl_Structure* theStructure)
|
||||
{
|
||||
for (OpenGl_ListOfGroup::Iterator anItg (theStructure->Groups());
|
||||
anItg.More(); anItg.Next())
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (theStructure->DrawGroups());
|
||||
aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
if (anItg.Value()->IsRaytracable())
|
||||
if (aGroupIter.Value()->IsRaytracable())
|
||||
return Standard_True;
|
||||
}
|
||||
for (OpenGl_ListOfStructure::Iterator anIts (theStructure->ConnectedStructures());
|
||||
|
@ -143,7 +143,6 @@ OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& th
|
||||
myAspectFace(NULL),
|
||||
myAspectMarker(NULL),
|
||||
myAspectText(NULL),
|
||||
myHighlightBox(NULL),
|
||||
myHighlightColor(NULL),
|
||||
myNamedStatus(0),
|
||||
myZLayer(0)
|
||||
@ -283,44 +282,15 @@ void OpenGl_Structure::SetAspectText (const CALL_DEF_CONTEXTTEXT &theAspect)
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHighlightBox
|
||||
// function : clearHighlightBox
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::SetHighlightBox (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const CALL_DEF_BOUNDBOX& theBoundBox)
|
||||
void OpenGl_Structure::clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
if (myHighlightBox != NULL)
|
||||
if (!myHighlightBox.IsNull())
|
||||
{
|
||||
myHighlightBox->Release (theGlCtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef HAVE_OPENCL
|
||||
myHighlightBox = new OpenGl_Group();
|
||||
#else
|
||||
myHighlightBox = new OpenGl_Group (this);
|
||||
#endif
|
||||
}
|
||||
|
||||
CALL_DEF_CONTEXTLINE aContextLine;
|
||||
aContextLine.Color = theBoundBox.Color;
|
||||
aContextLine.LineType = Aspect_TOL_SOLID;
|
||||
aContextLine.Width = 1.0f;
|
||||
myHighlightBox->SetAspectLine (aContextLine);
|
||||
|
||||
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (theBoundBox);
|
||||
myHighlightBox->AddElement (aBndBoxPrs);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ClearHighlightBox
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
if (myHighlightBox != NULL)
|
||||
{
|
||||
OpenGl_Element::Destroy (theGlCtx, myHighlightBox);
|
||||
myHighlightBox.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,32 +303,53 @@ void OpenGl_Structure::HighlightWithColor (const Graphic3d_Vec3& theColor,
|
||||
{
|
||||
const Handle(OpenGl_Context)& aCtx = GlDriver()->GetSharedContext();
|
||||
if (theToCreate)
|
||||
SetHighlightColor (aCtx, theColor);
|
||||
setHighlightColor (aCtx, theColor);
|
||||
else
|
||||
ClearHighlightColor (aCtx);
|
||||
clearHighlightColor (aCtx);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : HighlightWithBndBox
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::HighlightWithBndBox (const Standard_Boolean theToCreate)
|
||||
void OpenGl_Structure::HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
||||
const Standard_Boolean theToCreate)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aCtx = GlDriver()->GetSharedContext();
|
||||
if (theToCreate)
|
||||
SetHighlightBox (aCtx, BoundBox);
|
||||
if (!theToCreate)
|
||||
{
|
||||
clearHighlightBox (aCtx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myHighlightBox.IsNull())
|
||||
{
|
||||
myHighlightBox->Release (aCtx);
|
||||
}
|
||||
else
|
||||
ClearHighlightBox (aCtx);
|
||||
{
|
||||
myHighlightBox = new OpenGl_Group (theStruct);
|
||||
}
|
||||
|
||||
CALL_DEF_CONTEXTLINE& aContextLine = myHighlightBox->ChangeContextLine();
|
||||
aContextLine.IsDef = 1;
|
||||
aContextLine.Color = BoundBox.Color;
|
||||
aContextLine.LineType = Aspect_TOL_SOLID;
|
||||
aContextLine.Width = 1.0f;
|
||||
myHighlightBox->UpdateAspectLine (Standard_True);
|
||||
|
||||
OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (BoundBox);
|
||||
myHighlightBox->AddElement (aBndBoxPrs);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHighlightColor
|
||||
// function : setHighlightColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
|
||||
void OpenGl_Structure::setHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const Graphic3d_Vec3& theColor)
|
||||
{
|
||||
ClearHighlightBox (theGlCtx);
|
||||
clearHighlightBox (theGlCtx);
|
||||
if (myHighlightColor == NULL)
|
||||
{
|
||||
myHighlightColor = new TEL_COLOUR();
|
||||
@ -371,12 +362,12 @@ void OpenGl_Structure::SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ClearHighlightColor
|
||||
// function : clearHighlightColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx)
|
||||
void OpenGl_Structure::clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
ClearHighlightBox(theGlCtx);
|
||||
clearHighlightBox(theGlCtx);
|
||||
delete myHighlightColor;
|
||||
myHighlightColor = NULL;
|
||||
}
|
||||
@ -555,46 +546,43 @@ void OpenGl_Structure::Disconnect (Graphic3d_CStructure& theStructure)
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddGroup
|
||||
// function : NewGroup
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_Group * OpenGl_Structure::AddGroup()
|
||||
Handle(Graphic3d_Group) OpenGl_Structure::NewGroup (const Handle(Graphic3d_Structure)& theStruct)
|
||||
{
|
||||
// Create new group
|
||||
#ifndef HAVE_OPENCL
|
||||
OpenGl_Group *g = new OpenGl_Group();
|
||||
#else
|
||||
OpenGl_Group *g = new OpenGl_Group (this);
|
||||
#endif
|
||||
|
||||
myGroups.Append(g);
|
||||
return g;
|
||||
Handle(OpenGl_Group) aGroup = new OpenGl_Group (theStruct);
|
||||
myGroups.Append (aGroup);
|
||||
return aGroup;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RemoveGroup
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::RemoveGroup (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const OpenGl_Group* theGroup)
|
||||
void OpenGl_Structure::RemoveGroup (const Handle(Graphic3d_Group)& theGroup)
|
||||
{
|
||||
for (OpenGl_ListOfGroup::Iterator anIter (myGroups); anIter.More(); anIter.Next())
|
||||
if (theGroup.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
// Check for the given group
|
||||
if (anIter.Value() == theGroup)
|
||||
if (aGroupIter.Value() == theGroup)
|
||||
{
|
||||
myGroups.Remove (anIter);
|
||||
theGroup->Clear (Standard_False);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
if (theGroup->IsRaytracable())
|
||||
#ifdef HAVE_OPENCL
|
||||
if (((OpenGl_Group* )theGroup.operator->())->IsRaytracable())
|
||||
{
|
||||
UpdateStateWithAncestorStructures();
|
||||
UpdateRaytracableWithAncestorStructures();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Delete object
|
||||
OpenGl_Element::Destroy (theGlCtx, const_cast<OpenGl_Group*& > (theGroup));
|
||||
myGroups.Remove (aGroupIter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -620,14 +608,14 @@ void OpenGl_Structure::Clear (const Handle(OpenGl_Context)& theGlCtx)
|
||||
#endif
|
||||
|
||||
// Release groups
|
||||
for (OpenGl_ListOfGroup::Iterator anIter (myGroups); anIter.More(); anIter.Next())
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
#ifdef HAVE_OPENCL
|
||||
aRaytracableGroupDeleted |= anIter.Value()->IsRaytracable();
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
aRaytracableGroupDeleted |= aGroupIter.Value()->IsRaytracable();
|
||||
#endif
|
||||
|
||||
// Delete objects
|
||||
OpenGl_Element::Destroy (theGlCtx, const_cast<OpenGl_Group*& > (anIter.ChangeValue()));
|
||||
aGroupIter.ChangeValue()->Release (theGlCtx);
|
||||
}
|
||||
myGroups.Clear();
|
||||
|
||||
@ -719,8 +707,10 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||
AWorkspace->SetAspectText(myAspectText);
|
||||
|
||||
// Apply highlight box
|
||||
if (myHighlightBox)
|
||||
myHighlightBox->Render( AWorkspace );
|
||||
if (!myHighlightBox.IsNull())
|
||||
{
|
||||
myHighlightBox->Render (AWorkspace);
|
||||
}
|
||||
|
||||
// Apply highlight color
|
||||
const TEL_COLOUR *highlight_color = AWorkspace->HighlightColor;
|
||||
@ -775,12 +765,10 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||
}
|
||||
|
||||
// Render groups
|
||||
const OpenGl_ListOfGroup& aGroups = Groups();
|
||||
OpenGl_ListOfGroup::Iterator itg (aGroups);
|
||||
while (itg.More())
|
||||
const Graphic3d_SequenceOfGroup& aGroups = DrawGroups();
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
itg.Value()->Render(AWorkspace);
|
||||
itg.Next();
|
||||
aGroupIter.Value()->Render (AWorkspace);
|
||||
}
|
||||
|
||||
// Render capping for structure groups
|
||||
@ -856,7 +844,7 @@ void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
|
||||
OpenGl_Element::Destroy (theGlCtx, myAspectFace);
|
||||
OpenGl_Element::Destroy (theGlCtx, myAspectMarker);
|
||||
OpenGl_Element::Destroy (theGlCtx, myAspectText);
|
||||
ClearHighlightColor (theGlCtx);
|
||||
clearHighlightColor (theGlCtx);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
// Remove from connected list of ancestor
|
||||
@ -870,13 +858,9 @@ void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
|
||||
// =======================================================================
|
||||
void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx)
|
||||
{
|
||||
for (OpenGl_ListOfGroup::Iterator anIter (myGroups); anIter.More(); anIter.Next())
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
OpenGl_Group* aGroup = const_cast<OpenGl_Group*& > (anIter.ChangeValue());
|
||||
if (aGroup != NULL)
|
||||
{
|
||||
aGroup->Release (theGlCtx);
|
||||
}
|
||||
aGroupIter.ChangeValue()->Release (theGlCtx);
|
||||
}
|
||||
if (myAspectLine != NULL)
|
||||
{
|
||||
@ -894,7 +878,7 @@ void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCt
|
||||
{
|
||||
myAspectText->Release (theGlCtx);
|
||||
}
|
||||
if (myHighlightBox != NULL)
|
||||
if (!myHighlightBox.IsNull())
|
||||
{
|
||||
myHighlightBox->Release (theGlCtx);
|
||||
}
|
||||
@ -927,7 +911,7 @@ public:
|
||||
OpenGl_StructureShadow (const Handle(Graphic3d_StructureManager)& theManager,
|
||||
const Handle(OpenGl_Structure)& theStructure);
|
||||
|
||||
virtual const OpenGl_ListOfGroup& Groups() const { return myParent->Groups(); }
|
||||
virtual const Graphic3d_SequenceOfGroup& DrawGroups() const { return myParent->DrawGroups(); }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -36,45 +36,77 @@ class OpenGl_GraphicDriver;
|
||||
|
||||
typedef NCollection_List<const OpenGl_Structure* > OpenGl_ListOfStructure;
|
||||
|
||||
//! Implementation of low-level graphic structure.
|
||||
class OpenGl_Structure : public Graphic3d_CStructure
|
||||
{
|
||||
friend class OpenGl_Group;
|
||||
|
||||
public:
|
||||
|
||||
//! Create empty structure
|
||||
OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
|
||||
//! Auxiliary wrapper to iterate OpenGl_Group sequence.
|
||||
class GroupIterator
|
||||
{
|
||||
|
||||
//! Setup structure graphic state
|
||||
virtual void UpdateNamedStatus();
|
||||
public:
|
||||
GroupIterator (const Graphic3d_SequenceOfGroup& theGroups) : myIter (theGroups) {}
|
||||
Standard_Boolean More() const { return myIter.More(); }
|
||||
void Next() { myIter.Next(); }
|
||||
const OpenGl_Group* Value() const { return (const OpenGl_Group* )(myIter.Value().operator->()); }
|
||||
OpenGl_Group* ChangeValue() { return (OpenGl_Group* )(myIter.ChangeValue().operator->()); }
|
||||
|
||||
//! Clear graphic data
|
||||
virtual void Clear();
|
||||
private:
|
||||
Graphic3d_SequenceOfGroup::Iterator myIter;
|
||||
|
||||
//! 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);
|
||||
|
||||
//! Create shadow link to this structure
|
||||
virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Create empty structure
|
||||
Standard_EXPORT OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
|
||||
|
||||
//! Setup structure graphic state
|
||||
Standard_EXPORT virtual void UpdateNamedStatus();
|
||||
|
||||
//! Clear graphic data
|
||||
Standard_EXPORT virtual void Clear();
|
||||
|
||||
//! Connect other structure to this one
|
||||
Standard_EXPORT virtual void Connect (Graphic3d_CStructure& theStructure);
|
||||
|
||||
//! Disconnect other structure to this one
|
||||
Standard_EXPORT virtual void Disconnect (Graphic3d_CStructure& theStructure);
|
||||
|
||||
//! Synchronize structure aspects
|
||||
Standard_EXPORT virtual void UpdateAspects();
|
||||
|
||||
//! Synchronize structure transformation
|
||||
Standard_EXPORT virtual void UpdateTransformation();
|
||||
|
||||
//! Highlight entire structure with color
|
||||
Standard_EXPORT virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
|
||||
const Standard_Boolean theToCreate);
|
||||
|
||||
//! Highlight structure using boundary box
|
||||
Standard_EXPORT virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
|
||||
const Standard_Boolean theToCreate);
|
||||
|
||||
//! Create shadow link to this structure
|
||||
Standard_EXPORT virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const;
|
||||
|
||||
//! Create new group within this structure
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct);
|
||||
|
||||
//! Remove group from this structure
|
||||
Standard_EXPORT virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup);
|
||||
|
||||
public:
|
||||
|
||||
//! @return graphic groups
|
||||
virtual const Graphic3d_SequenceOfGroup& DrawGroups() const
|
||||
{
|
||||
return myGroups;
|
||||
}
|
||||
|
||||
//! Access graphic driver
|
||||
OpenGl_GraphicDriver* GlDriver() const
|
||||
{
|
||||
@ -88,28 +120,22 @@ public:
|
||||
void SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect);
|
||||
void SetAspectText (const CALL_DEF_CONTEXTTEXT &theAspect);
|
||||
|
||||
void SetHighlightBox (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const CALL_DEF_BOUNDBOX& theBoundBox);
|
||||
void clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
void ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
void SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
|
||||
void setHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const Graphic3d_Vec3& theColor);
|
||||
|
||||
void ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
|
||||
void clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
Standard_Boolean IsVisible() const { return !(myNamedStatus & OPENGL_NS_HIDE); }
|
||||
|
||||
OpenGl_Group* AddGroup();
|
||||
void RemoveGroup (const Handle(OpenGl_Context)& theGlCtx,
|
||||
const OpenGl_Group* theGroup);
|
||||
void Clear (const Handle(OpenGl_Context)& theGlCtx);
|
||||
Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Set z layer ID to display the structure in specified layer
|
||||
void SetZLayer (const Standard_Integer theLayerIndex);
|
||||
Standard_EXPORT void SetZLayer (const Standard_Integer theLayerIndex);
|
||||
|
||||
//! Get z layer ID
|
||||
Standard_Integer GetZLayer () const;
|
||||
Standard_EXPORT Standard_Integer GetZLayer() const;
|
||||
|
||||
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
|
||||
@ -120,10 +146,7 @@ public:
|
||||
//!
|
||||
//! Notice however that reusage of this structure after calling this method is incorrect
|
||||
//! and will lead to broken visualization due to loosed data.
|
||||
void ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Returns list of OpenGL groups.
|
||||
virtual const OpenGl_ListOfGroup& Groups() const { return myGroups; }
|
||||
Standard_EXPORT void ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx);
|
||||
|
||||
//! Returns list of connected OpenGL structures.
|
||||
const OpenGl_ListOfStructure& ConnectedStructures() const { return myConnected; }
|
||||
@ -152,7 +175,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~OpenGl_Structure();
|
||||
Standard_EXPORT virtual ~OpenGl_Structure();
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
@ -185,14 +208,13 @@ protected:
|
||||
OpenGl_AspectMarker* myAspectMarker;
|
||||
OpenGl_AspectText* myAspectText;
|
||||
|
||||
OpenGl_Group* myHighlightBox;
|
||||
Handle(OpenGl_Group) myHighlightBox;
|
||||
TEL_COLOUR* myHighlightColor;
|
||||
|
||||
int myNamedStatus;
|
||||
int myZLayer;
|
||||
|
||||
OpenGl_ListOfStructure myConnected;
|
||||
OpenGl_ListOfGroup myGroups;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
mutable OpenGl_ListOfStructure myAncestorStructures;
|
||||
|
@ -158,16 +158,16 @@ OpenGl_Text::OpenGl_Text()
|
||||
// function : OpenGl_Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_Text::OpenGl_Text (const TCollection_ExtendedString& theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
: myWinX (0.0f),
|
||||
myWinY (0.0f),
|
||||
myWinZ (0.0f),
|
||||
myScaleHeight (1.0f),
|
||||
myExportHeight (1.0f),
|
||||
myParams (theParams),
|
||||
myString ((Standard_Utf16Char* )theText.ToExtString()),
|
||||
myString (theText),
|
||||
myPoint (thePoint),
|
||||
myIs2d (false)
|
||||
{
|
||||
|
@ -36,9 +36,9 @@ class OpenGl_Text : public OpenGl_Element
|
||||
public:
|
||||
|
||||
//! Main constructor
|
||||
Standard_EXPORT OpenGl_Text (const TCollection_ExtendedString& theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams);
|
||||
Standard_EXPORT OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams);
|
||||
|
||||
//! Setup new string and position
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
|
@ -596,9 +596,9 @@ OpenGl_Trihedron::OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition thePosit
|
||||
: myPos (thePosition),
|
||||
myScale (theScale),
|
||||
myIsWireframe (theAsWireframe),
|
||||
myLabelX (TCollection_ExtendedString ("X"), OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelY (TCollection_ExtendedString ("Y"), OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelZ (TCollection_ExtendedString ("Z"), OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS)
|
||||
myLabelX ("X", OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelY ("Y", OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS),
|
||||
myLabelZ ("Z", OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS)
|
||||
{
|
||||
Standard_Real R,G,B;
|
||||
Quantity_Color aColor (theColor);
|
||||
|
@ -379,17 +379,16 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
|
||||
myRaytraceGeometry.Materials.push_back (aStructMaterial);
|
||||
}
|
||||
|
||||
for (OpenGl_ListOfGroup::Iterator anItg (theStructure->Groups()); anItg.More(); anItg.Next())
|
||||
for (OpenGl_Structure::GroupIterator aGroupIter (theStructure->DrawGroups()); aGroupIter.More(); aGroupIter.Next())
|
||||
{
|
||||
// Get group material
|
||||
Standard_Integer aGroupMatID = -1;
|
||||
|
||||
if (anItg.Value()->AspectFace() != NULL)
|
||||
if (aGroupIter.Value()->AspectFace() != NULL)
|
||||
{
|
||||
aGroupMatID = static_cast<Standard_Integer> (myRaytraceGeometry.Materials.size());
|
||||
|
||||
OpenGl_RaytraceMaterial aGroupMaterial;
|
||||
CreateMaterial (anItg.Value()->AspectFace()->IntFront(), aGroupMaterial);
|
||||
CreateMaterial (aGroupIter.Value()->AspectFace()->IntFront(), aGroupMaterial);
|
||||
|
||||
myRaytraceGeometry.Materials.push_back (aGroupMaterial);
|
||||
}
|
||||
@ -404,7 +403,7 @@ Standard_Boolean OpenGl_Workspace::AddRaytraceStructure (const OpenGl_Structure*
|
||||
}
|
||||
|
||||
// Add OpenGL elements from group (extract primitives arrays and aspects)
|
||||
for (const OpenGl_ElementNode* aNode = anItg.Value()->FirstNode(); aNode != NULL; aNode = aNode->next)
|
||||
for (const OpenGl_ElementNode* aNode = aGroupIter.Value()->FirstNode(); aNode != NULL; aNode = aNode->next)
|
||||
{
|
||||
OpenGl_AspectFace* anAspect = dynamic_cast<OpenGl_AspectFace*> (aNode->elem);
|
||||
if (anAspect != NULL)
|
||||
|
@ -90,8 +90,6 @@ is
|
||||
---Purpose: displays the whole content of the presentation in the specified color.
|
||||
BoundBox(me: mutable) is static;
|
||||
|
||||
Display ( me : mutable ) is redefined static;
|
||||
|
||||
---Category: Global modification methods.
|
||||
SetShadingAspect(me: mutable; aShadingAspect: ShadingAspect from Prs3d);
|
||||
|
||||
@ -105,13 +103,6 @@ is
|
||||
Multiply (me: mutable; aTransformation: Transformation from Geom);
|
||||
Move (me: mutable; X,Y,Z: Length from Quantity);
|
||||
Transformation (me) returns Transformation from Geom;
|
||||
|
||||
Clear(me:mutable; WithDestruction: Boolean from Standard = Standard_True)
|
||||
is redefined;
|
||||
---Purpose: removes the whole content of the presentation.
|
||||
-- Does not remove the other connected presentations.
|
||||
-- if WithDestruction == Standard_False then
|
||||
-- clears all the groups of primitives in the structure.
|
||||
|
||||
Connect(me: mutable; aPresentation: Presentation from Prs3d);
|
||||
|
||||
@ -120,13 +111,8 @@ is
|
||||
|
||||
SetPickable(me: mutable) is static;
|
||||
SetUnPickable(me: mutable) is static;
|
||||
|
||||
|
||||
CurrentGroup(me) returns mutable Group from Graphic3d is static private;
|
||||
NewGroup(me:mutable) returns mutable Group from Graphic3d is static private;
|
||||
|
||||
fields
|
||||
|
||||
myCurrentGroup : Group from Graphic3d;
|
||||
|
||||
friends
|
||||
|
||||
|
@ -244,20 +244,6 @@ void Prs3d_Presentation::Move (const Quantity_Length X,
|
||||
SetTransform(Array, Graphic3d_TOC_POSTCONCATENATE);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Clear(const Standard_Boolean WithDestruction)
|
||||
{
|
||||
Graphic3d_Structure::Clear(WithDestruction);
|
||||
// myCurrentGroup.Nullify();
|
||||
myCurrentGroup = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
@ -294,35 +280,13 @@ void Prs3d_Presentation::RemoveAll ()
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_Group) Prs3d_Presentation::CurrentGroup () const
|
||||
{
|
||||
if(myCurrentGroup.IsNull()){
|
||||
void *ptr = (void*) this;
|
||||
Prs3d_Presentation* p = (Prs3d_Presentation *)ptr;
|
||||
p->NewGroup();
|
||||
if (Groups().IsEmpty())
|
||||
{
|
||||
return const_cast<Prs3d_Presentation* >(this)->NewGroup();
|
||||
}
|
||||
return myCurrentGroup;
|
||||
return Groups().Last();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewGroup
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_Group) Prs3d_Presentation::NewGroup ()
|
||||
{
|
||||
myCurrentGroup = new Graphic3d_Group(this);
|
||||
return myCurrentGroup;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Display
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Display ()
|
||||
{
|
||||
Graphic3d_Structure::Display();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
|
@ -65,6 +65,11 @@ void PrsMgr_Presentation3d::Display(const Standard_Boolean theIsHighlight)
|
||||
|
||||
void PrsMgr_Presentation3d::Erase ()
|
||||
{
|
||||
if (myStructure.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Erase structure from structure manager
|
||||
myStructure->Erase();
|
||||
myStructure->Clear();
|
||||
@ -95,9 +100,13 @@ void PrsMgr_Presentation3d::Clear() {
|
||||
// 2. The speed for animation is constant
|
||||
//myPresentableObject = NULL;
|
||||
SetUpdateStatus(Standard_True);
|
||||
if (myStructure.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myStructure->Clear(Standard_True);
|
||||
// myStructure->Clear(Standard_False);
|
||||
|
||||
myStructure->RemoveAll();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ void QABugs_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(Graphic3d_Structure) aStructure = Handle(Graphic3d_Structure)::DownCast (thePrs);
|
||||
Handle(Graphic3d_Group) aGroup = new Graphic3d_Group (aStructure);
|
||||
Handle(Graphic3d_Group) aGroup = aStructure->NewGroup();
|
||||
Handle_Prs3d_ShadingAspect anAspect = myDrawer->ShadingAspect();
|
||||
Graphic3d_MaterialAspect aMat = anAspect->Aspect()->FrontMaterial();
|
||||
aMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
|
@ -307,7 +307,7 @@ void StdSelect_ViewerSelector3d::DisplayAreas (const Handle(V3d_View)& theView)
|
||||
|
||||
if (myareagroup.IsNull())
|
||||
{
|
||||
myareagroup = new Graphic3d_Group (mystruct);
|
||||
myareagroup = mystruct->NewGroup();
|
||||
}
|
||||
|
||||
SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive anIt (myentities);
|
||||
@ -545,7 +545,7 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theVi
|
||||
|
||||
if (mysensgroup.IsNull())
|
||||
{
|
||||
mysensgroup = new Graphic3d_Group (mystruct);
|
||||
mysensgroup = mystruct->NewGroup();
|
||||
}
|
||||
|
||||
Quantity_Color aColor (Quantity_NOC_INDIANRED3);
|
||||
@ -609,7 +609,7 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(SelectMgr_Select
|
||||
|
||||
if (mysensgroup.IsNull())
|
||||
{
|
||||
mysensgroup = new Graphic3d_Group (mystruct);
|
||||
mysensgroup = mystruct->NewGroup();
|
||||
Quantity_Color aColor (Quantity_NOC_INDIANRED3);
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect =
|
||||
new Graphic3d_AspectMarker3d (Aspect_TOM_O_PLUS, aColor, 2.0);
|
||||
@ -647,9 +647,8 @@ void StdSelect_ViewerSelector3d::DisplayAreas (const Handle(SelectMgr_Selection)
|
||||
|
||||
if (mysensgroup.IsNull())
|
||||
{
|
||||
myareagroup = new Graphic3d_Group (mystruct);
|
||||
myareagroup->SetGroupPrimitivesAspect (
|
||||
new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
|
||||
myareagroup = mystruct->NewGroup();
|
||||
myareagroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
|
||||
}
|
||||
|
||||
if (theToClearOthers)
|
||||
|
@ -247,7 +247,7 @@ void V3d::DrawSphere(const Handle(V3d_Viewer)& aViewer,const Quantity_Length ray
|
||||
const Standard_Boolean inf = ray < 0;
|
||||
const Standard_Real aRadius = Standard_ShortReal(Abs(ray));
|
||||
Handle(Graphic3d_Structure) Struct = new Graphic3d_Structure(aViewer->Viewer()) ;
|
||||
Handle(Graphic3d_Group) Group = new Graphic3d_Group(Struct) ;
|
||||
Handle(Graphic3d_Group) Group = Struct->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d() ;
|
||||
LineAttrib->SetColor(Quantity_Color(Quantity_NOC_YELLOW));
|
||||
|
@ -69,7 +69,7 @@
|
||||
V3d_CircularGrid::V3d_CircularGrid (const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
||||
: Aspect_CircularGrid (1.,8),
|
||||
myStructure (new Graphic3d_Structure (aViewer->Viewer ())),
|
||||
myGroup (new Graphic3d_Group (myStructure)),
|
||||
myGroup (myStructure->NewGroup()),
|
||||
myViewer (aViewer),
|
||||
myCurAreDefined (Standard_False)
|
||||
{
|
||||
|
@ -230,11 +230,15 @@ void V3d_DirectionalLight::Display( const Handle(V3d_View)& aView,
|
||||
MyGraphicStructure1 = snopick;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) glight = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) glight = MyGraphicStructure->NewGroup();
|
||||
Handle(Graphic3d_Group) gsphere;
|
||||
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) gsphere = new Graphic3d_Group(MyGraphicStructure);
|
||||
if (Pres == V3d_COMPLETE
|
||||
|| Pres == V3d_PARTIAL)
|
||||
{
|
||||
gsphere = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gnopick = new Graphic3d_Group(MyGraphicStructure1);
|
||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||
MyGraphicStructure1->SetPick(Standard_False);
|
||||
|
||||
X0 = MyTarget.X();
|
||||
|
@ -65,8 +65,8 @@ void V3d_Plane::Display (const Handle(V3d_View)& theView,
|
||||
}
|
||||
|
||||
myGraphicStructure = new Graphic3d_Structure (aViewer->Viewer());
|
||||
Handle(Graphic3d_Group) aGroup = new Graphic3d_Group (myGraphicStructure);
|
||||
Handle(Graphic3d_AspectFillArea3d) anAsp = new Graphic3d_AspectFillArea3d();
|
||||
Handle(Graphic3d_Group) aGroup = myGraphicStructure->NewGroup();
|
||||
Handle(Graphic3d_AspectFillArea3d) anAsp = new Graphic3d_AspectFillArea3d();
|
||||
Graphic3d_MaterialAspect aPlastic (Graphic3d_NOM_PLASTIC);
|
||||
aPlastic.SetColor (theColor);
|
||||
aPlastic.SetTransparency (0.5);
|
||||
|
@ -166,22 +166,23 @@ void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
|
||||
MyGraphicStructure1 = snopick;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gradius;
|
||||
Handle(Graphic3d_Group) gExtArrow;
|
||||
Handle(Graphic3d_Group) gIntArrow;
|
||||
|
||||
if (MyType != V3d_DIRECTIONAL) {
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius = new Graphic3d_Group(MyGraphicStructure);
|
||||
gExtArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
gIntArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
}
|
||||
Handle(Graphic3d_Group) gradius, gExtArrow, gIntArrow;
|
||||
if (MyType != V3d_DIRECTIONAL
|
||||
&& Pres == V3d_COMPLETE)
|
||||
{
|
||||
gradius = MyGraphicStructure->NewGroup();
|
||||
gExtArrow = MyGraphicStructure->NewGroup();
|
||||
gIntArrow = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
Handle(Graphic3d_Group) glight = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) glight = MyGraphicStructure->NewGroup();
|
||||
Handle(Graphic3d_Group) gsphere;
|
||||
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) gsphere = new Graphic3d_Group(MyGraphicStructure);
|
||||
if (Pres == V3d_COMPLETE
|
||||
|| Pres == V3d_PARTIAL)
|
||||
{
|
||||
gsphere = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gnopick = new Graphic3d_Group(MyGraphicStructure1);
|
||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||
MyGraphicStructure1->SetPick(Standard_False);
|
||||
|
||||
X0 = MyTarget.X();
|
||||
|
@ -215,19 +215,22 @@ void V3d_PositionalLight::Display( const Handle(V3d_View)& aView,
|
||||
MyGraphicStructure1 = snopick;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gradius;
|
||||
Handle(Graphic3d_Group) gExtArrow;
|
||||
Handle(Graphic3d_Group) gIntArrow;
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius = new Graphic3d_Group(MyGraphicStructure);
|
||||
gExtArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
gIntArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) gradius, gExtArrow, gIntArrow;
|
||||
if (Pres == V3d_COMPLETE)
|
||||
{
|
||||
gradius = MyGraphicStructure->NewGroup();
|
||||
gExtArrow = MyGraphicStructure->NewGroup();
|
||||
gIntArrow = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
Handle(Graphic3d_Group) glight = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) glight = MyGraphicStructure->NewGroup();
|
||||
Handle(Graphic3d_Group) gsphere;
|
||||
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) gsphere = new Graphic3d_Group(MyGraphicStructure);
|
||||
if (Pres == V3d_COMPLETE
|
||||
|| Pres == V3d_PARTIAL)
|
||||
{
|
||||
gsphere = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gnopick = new Graphic3d_Group(MyGraphicStructure1);
|
||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||
MyGraphicStructure1->SetPick(Standard_False);
|
||||
|
||||
X0 = MyTarget.X();
|
||||
|
@ -67,7 +67,7 @@
|
||||
V3d_RectangularGrid::V3d_RectangularGrid (const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
||||
: Aspect_RectangularGrid (1.,1.),
|
||||
myStructure (new Graphic3d_Structure (aViewer->Viewer ())),
|
||||
myGroup (new Graphic3d_Group (myStructure)),
|
||||
myGroup (myStructure->NewGroup()),
|
||||
myViewer (aViewer),
|
||||
myCurAreDefined (Standard_False)
|
||||
{
|
||||
|
@ -233,19 +233,22 @@ void V3d_SpotLight::Display( const Handle(V3d_View)& aView,
|
||||
MyGraphicStructure1 = snopick;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gradius;
|
||||
Handle(Graphic3d_Group) gExtArrow;
|
||||
Handle(Graphic3d_Group) gIntArrow;
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius = new Graphic3d_Group(MyGraphicStructure);
|
||||
gExtArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
gIntArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) gradius, gExtArrow, gIntArrow;
|
||||
if (Pres == V3d_COMPLETE)
|
||||
{
|
||||
gradius = MyGraphicStructure->NewGroup();
|
||||
gExtArrow = MyGraphicStructure->NewGroup();
|
||||
gIntArrow = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
Handle(Graphic3d_Group) glight = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) glight = MyGraphicStructure->NewGroup();
|
||||
Handle(Graphic3d_Group) gsphere;
|
||||
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) gsphere = new Graphic3d_Group(MyGraphicStructure);
|
||||
if (Pres == V3d_COMPLETE
|
||||
|| Pres == V3d_PARTIAL)
|
||||
{
|
||||
gsphere = MyGraphicStructure->NewGroup();
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gnopick = new Graphic3d_Group(MyGraphicStructure1);
|
||||
Handle(Graphic3d_Group) gnopick = MyGraphicStructure1->NewGroup();
|
||||
MyGraphicStructure1->SetPick(Standard_False);
|
||||
|
||||
X0 = MyTarget.X();
|
||||
|
@ -116,7 +116,7 @@ void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Quan
|
||||
else
|
||||
myPlaneStructure->Clear();
|
||||
|
||||
Handle(Graphic3d_Group) Group = new Graphic3d_Group(myPlaneStructure);
|
||||
Handle(Graphic3d_Group) Group = myPlaneStructure->NewGroup();
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d() ;
|
||||
LineAttrib->SetColor(Quantity_Color(Quantity_NOC_GRAY60));
|
||||
|
@ -256,7 +256,7 @@ void V3d_Viewer::SetGridEcho (const Handle(Graphic3d_AspectMarker3d)& theMarker)
|
||||
if (myGridEchoStructure.IsNull())
|
||||
{
|
||||
myGridEchoStructure = new Graphic3d_Structure (Viewer());
|
||||
myGridEchoGroup = new Graphic3d_Group (myGridEchoStructure);
|
||||
myGridEchoGroup = myGridEchoStructure->NewGroup();
|
||||
}
|
||||
|
||||
myGridEchoAspect = theMarker;
|
||||
@ -287,7 +287,7 @@ void V3d_Viewer::ShowGridEcho (const Handle(V3d_View)& theView,
|
||||
if (myGridEchoStructure.IsNull())
|
||||
{
|
||||
myGridEchoStructure = new Graphic3d_Structure (Viewer());
|
||||
myGridEchoGroup = new Graphic3d_Group (myGridEchoStructure);
|
||||
myGridEchoGroup = myGridEchoStructure->NewGroup();
|
||||
|
||||
myGridEchoAspect = new Graphic3d_AspectMarker3d (Aspect_TOM_STAR, Quantity_Color (Quantity_NOC_GRAY90), 3.0);
|
||||
myGridEchoGroup->SetPrimitivesAspect (myGridEchoAspect);
|
||||
|
Loading…
x
Reference in New Issue
Block a user