// 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);
}
}
}
-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
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
Graphic3d_CMPLRS.edl
Graphic3d_WOKSteps.edl
Graphic3d_PrimitiveArray.hxx
-Graphic3d_Group_13.cxx
Graphic3d_TransModeFlags.hxx
Graphic3d_CTransPersStruct.hxx
Graphic3d_CTransPersStruct.cxx
Graphic3d_ClipPlane.hxx
Graphic3d_ClipPlane.cxx
Graphic3d_ClipPlane_Handle.hxx
+Graphic3d_SequenceOfGroup.hxx
Graphic3d_SequenceOfHClipPlane.hxx
Graphic3d_SequenceOfHClipPlane_Handle.hxx
Graphic3d_Camera.cxx
exception MaterialDefinitionError inherits OutOfRange;
---Category: Exceptions
- exception PickIdDefinitionError inherits OutOfRange;
- ---Category: Exceptions
-
exception PlotterDefinitionError inherits OutOfRange;
---Category: The exceptions
---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;
---Purpose: Grouping text attributes.
---Category: Classes
- class Group;
+ deferred class Group;
---Purpose: For grouping together primitives in a structure
---Category: Classes
---Purpose: Graphic object.
---Category: Classes
+ pointer StructurePtr to Structure from Graphic3d;
+
deferred class GraphicDriver;
---Purpose: Defines a graphic driver for 3d interface
(Address from Standard);
---Category: Instantiated classes
- class SetOfGroup instantiates
- Set from TCollection (Group from Graphic3d);
- ---Category: Instantiated classes
-
- class HSetOfGroup instantiates
- HSet from TCollection
- (Group from Graphic3d, SetOfGroup);
- ---Category: Instantiated classes
-
- class SequenceOfGroup instantiates
- Sequence from TCollection (Group from Graphic3d);
+ imported SequenceOfGroup;
---Category: Instantiated classes
- class HSequenceOfGroup instantiates
- HSequence from TCollection
- (Group from Graphic3d, SequenceOfGroup from Graphic3d);
- ---Category: Instantiated classes
-
class MapOfStructure instantiates
Map from TCollection (Structure from Graphic3d,MapTransientHasher from TColStd);
--- 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;
return myMarkerImage;
}
+// =======================================================================
+// function : SetMarkerImage
+// purpose :
+// =======================================================================
+void Graphic3d_AspectMarker3d::SetMarkerImage (const Handle(Graphic3d_MarkerImage)& theImage)
+{
+ myMarkerImage = theImage;
+}
+
// =======================================================================
// function : SetBitMap
// purpose :
--- /dev/null
+// 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_CAspectFillArea_HeaderFile
+#define _Graphic3d_CAspectFillArea_HeaderFile
+
+#include <InterfaceGraphic_Visual3d.hxx>
+#include <Graphic3d_CTexture.hxx>
+#include <Graphic3d_ShaderProgram_Handle.hxx>
+
+class Graphic3d_CAspectFillArea
+{
+
+public:
+
+ Graphic3d_CAspectFillArea()
+ : IsDef (0),
+ IsSet (0),
+ Style (0),
+ LineType (0),
+ Width (0.0f),
+ Hatch (0),
+ Distinguish (0),
+ BackFace (0),
+ Edge (0),
+ PolygonOffsetMode (0),
+ 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));
+ }
+
+public:
+
+ int IsDef;
+ int IsSet;
+ int Style;
+
+ CALL_DEF_COLOR IntColor;
+ CALL_DEF_COLOR BackIntColor;
+ CALL_DEF_COLOR EdgeColor;
+
+ int LineType;
+
+ float Width;
+
+ int Hatch;
+
+ int Distinguish;
+ int BackFace;
+
+ int Edge;
+
+ CALL_DEF_MATERIAL Front;
+ CALL_DEF_MATERIAL Back;
+
+ Graphic3d_CTexture Texture;
+
+ int PolygonOffsetMode;
+ float PolygonOffsetFactor;
+ float PolygonOffsetUnits;
+
+ Handle(Graphic3d_ShaderProgram) ShaderProgram;
+
+};
+
+typedef Graphic3d_CAspectFillArea CALL_DEF_CONTEXTFILLAREA;
+
+#endif // _Graphic3d_CAspectFillArea_HeaderFile
--- /dev/null
+// 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_CAspectLine_HeaderFile
+#define _Graphic3d_CAspectLine_HeaderFile
+
+#include <InterfaceGraphic_Visual3d.hxx>
+#include <Graphic3d_CTexture.hxx>
+#include <Graphic3d_ShaderProgram_Handle.hxx>
+
+class Graphic3d_CAspectLine
+{
+public:
+
+ int IsDef;
+ int IsSet;
+ CALL_DEF_COLOR Color;
+ int LineType;
+ float Width;
+ Handle(Graphic3d_ShaderProgram) ShaderProgram;
+
+};
+
+typedef Graphic3d_CAspectLine CALL_DEF_CONTEXTLINE;
+
+#endif // _Graphic3d_CAspectLine_HeaderFile
--- /dev/null
+// 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
--- /dev/null
+// 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
+++ /dev/null
-// 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.
-
-#include <Graphic3d_CGroup.hxx>
-
-const Handle(Standard_Type)& TYPE(Graphic3d_CGroup)
-{
- static Handle(Standard_Type) _atype =
- new Standard_Type ("Graphic3d_CGroup", sizeof (Graphic3d_CGroup));
- return _atype;
-}
+++ /dev/null
-// 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_CGroup_HeaderFile
-#define _Graphic3d_CGroup_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
-{
-
-public:
-
- CALL_DEF_CONTEXTFILLAREA()
- : IsDef (0),
- IsSet (0),
- Style (0),
- LineType (0),
- Width (0.0f),
- Hatch (0),
- Distinguish (0),
- BackFace (0),
- Edge (0),
- PolygonOffsetMode (0),
- 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));
- }
-
-public:
-
- int IsDef;
-
- int IsSet;
-
- int Style;
-
- CALL_DEF_COLOR IntColor;
- CALL_DEF_COLOR BackIntColor;
- CALL_DEF_COLOR EdgeColor;
-
- int LineType;
-
- float Width;
-
- int Hatch;
-
- int Distinguish;
- int BackFace;
-
- int Edge;
-
- CALL_DEF_MATERIAL Front;
- CALL_DEF_MATERIAL Back;
-
- Graphic3d_CTexture Texture;
-
- int PolygonOffsetMode;
- float PolygonOffsetFactor;
- 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
-{
-
-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
#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>
return myGraphicDriver;
}
+ //! @return graphic groups
+ const Graphic3d_SequenceOfGroup& Groups() const
+ {
+ return myGroups;
+ }
+
//! @return associated clip planes
const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
{
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;
protected:
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
+ Graphic3d_SequenceOfGroup myGroups;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
public:
AspectFillArea3d from Graphic3d,
HorizontalTextAlignment from Graphic3d,
CBitFields20 from Graphic3d,
- CGroup from Graphic3d,
+ Group from Graphic3d,
CLight from Graphic3d,
CPick from Graphic3d,
CPlane from Graphic3d,
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
-----------------------------------------
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;
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 );
}
-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
{
-- 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:
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,
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>.
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
-- 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
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
-- 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;
---------------------------------------
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;
---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.
----------------------------
--
-- 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;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// 11/97 ; CAL : retrait DownCast
+#include <Graphic3d_Group.ixx>
+#include <gp_Pnt.hxx>
+#include <Graphic3d_ArrayOfPoints.hxx>
+#include <Graphic3d_StructureManager.hxx>
+#include <Graphic3d_ShaderProgram.hxx>
+#include <Graphic3d_TransModeFlags.hxx>
+#include <Graphic3d_TextureMap.hxx>
+#include <Message.hxx>
+#include <Message_Messenger.hxx>
+#include <NCollection_String.hxx>
+#include <TCollection_AsciiString.hxx>
-//-Version
+#include <Graphic3d_CStructure.hxx>
+#include <Graphic3d_Structure.pxx>
-//-Design Declaration of variables specific to groups
-// of primitives
+#define MyIsEmpty myCBitFields.bool1
+#define MyContainsFacet myCBitFields.bool2
-//-Warning A group is definedv in a structure
-// This is the smallest editable entity
+// =======================================================================
+// function : Graphic3d_Group
+// purpose :
+// =======================================================================
+Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct)
+{
+ myBounds.XMin = ShortRealLast();
+ myBounds.YMin = ShortRealLast();
+ myBounds.ZMin = ShortRealLast();
+ myBounds.XMax = ShortRealFirst();
+ myBounds.YMax = ShortRealFirst();
+ myBounds.ZMax = ShortRealFirst();
-//-References
+ //
+ // A small commentary on the usage of This!
+ //
+ // Graphic3d_Group is created in a structure. Graphic3d_Structure is a
+ // manager of Graphic3d_Group. In the constructor of Graphic3d_Group
+ // a method Add of Graphic3d_Structure is called. It allows adding
+ // the instance of Graphic3d_Group in its manager. So there are 2 references
+ // to <me> and everything works well.
+ //
+ // This () is the instance of the class, the current group
+ //Handle(Graphic3d_Group) me = Handle(Graphic3d_Group)::DownCast (This());
-//-Language C++ 2.0
+ myStructure = theStruct.operator->();
-//-Declarations
+ MyContainsFacet = Standard_False,
+ MyIsEmpty = Standard_True;
-// for the class
-#include <Graphic3d_Group.ixx>
-#include <Graphic3d_Group.pxx>
+ ContextLine.IsDef = 0;
+ ContextText.IsDef = 0;
+ ContextMarker.IsDef = 0;
+ ContextFillArea.IsDef = 0;
-#include <Graphic3d_GraphicDriver.hxx>
-#include <Graphic3d_StructureManager.hxx>
-#include <Graphic3d_TransModeFlags.hxx>
+ ContextLine.IsSet = 0;
+ ContextText.IsSet = 0;
+ ContextMarker.IsSet = 0;
+ ContextFillArea.IsSet = 0;
+}
+
+// =======================================================================
+// function : Clear
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ ContextLine.IsSet = 0,
+ ContextText.IsSet = 0,
+ ContextMarker.IsSet = 0,
+ ContextFillArea.IsSet = 0;
-//-Aliases
+ ContextLine.IsDef = 0,
+ ContextText.IsDef = 0,
+ ContextMarker.IsDef = 0,
+ ContextFillArea.IsDef = 0;
-//-Global data definitions
+ myBounds.XMin = ShortRealLast();
+ myBounds.YMin = ShortRealLast();
+ myBounds.ZMin = ShortRealLast();
+ myBounds.XMax = ShortRealFirst();
+ myBounds.YMax = ShortRealFirst();
+ myBounds.ZMax = ShortRealFirst();
-//-Constructors
+ if (MyContainsFacet)
+ {
+ myStructure->GroupsWithFacet (-1);
+ MyContainsFacet = Standard_False;
+ }
+ MyIsEmpty = Standard_True;
-//-Destructors
+ // 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();
+ }
+}
-//-Methods, in order
+// =======================================================================
+// function : Destroy
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Destroy()
+{
+ // tell graphics driver to clear internal resources of the group
+ Clear (Standard_False);
+}
-Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& AStructure):
-MyListOfPArray()
+// =======================================================================
+// function : Remove
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Remove()
{
- MyBounds.XMin = ShortRealLast (),
- MyBounds.YMin = ShortRealLast (),
- MyBounds.ZMin = ShortRealLast ();
+ if (IsDeleted())
+ {
+ return;
+ }
- MyBounds.XMax = ShortRealFirst (),
- MyBounds.YMax = ShortRealFirst (),
- MyBounds.ZMax = ShortRealFirst ();
+ if (MyContainsFacet)
+ {
+ myStructure->GroupsWithFacet (-1);
+ MyContainsFacet = Standard_False;
+ }
+ myStructure->Remove (this);
-//
-// A small commentary on the usage of This !
-//
-// Graphic3d_Group is created in a structure. Graphic3d_Structure is a
-// manager of Graphic3d_Group. In the constructor of Graphic3d_Group
-// a method Add of Graphic3d_Structure is called. It allows adding
-// the instance of Graphic3d_Group in its manager. So there are 2 references
-// to <me> and everything works well.
-//
-// This () is the instance of the class, the current groupe
-//Handle(Graphic3d_Group) me = Handle(Graphic3d_Group)::DownCast (This ());
+ Update();
- MyPtrStructure = (void *) AStructure.operator->();
- MyStructure->Add (this);
+ myBounds.XMin = ShortRealLast();
+ myBounds.YMin = ShortRealLast();
+ myBounds.ZMin = ShortRealLast();
+ myBounds.XMax = ShortRealFirst();
+ myBounds.YMax = ShortRealFirst();
+ myBounds.ZMax = ShortRealFirst();
- MyContainsFacet = Standard_False,
- MyIsEmpty = Standard_True;
+ MyIsEmpty = Standard_True;
+}
+
+// =======================================================================
+// function : IsDeleted
+// purpose :
+// =======================================================================
+Standard_Boolean Graphic3d_Group::IsDeleted() const
+{
+ return myStructure == NULL
+ || myStructure->IsDeleted();
+}
+
+// =======================================================================
+// function : ContainsFacet
+// purpose :
+// =======================================================================
+Standard_Boolean Graphic3d_Group::ContainsFacet() const
+{
+ return MyContainsFacet;
+}
+
+// =======================================================================
+// function : IsEmpty
+// purpose :
+// =======================================================================
+Standard_Boolean Graphic3d_Group::IsEmpty() const
+{
+ if (IsDeleted())
+ {
+ return Standard_True;
+ }
+
+ const Standard_ShortReal RL = ShortRealLast();
+ const Standard_ShortReal RF = ShortRealFirst();
+ const Standard_Boolean isEmpty = ((myBounds.XMin == RL) && (myBounds.YMin == RL)
+ && (myBounds.ZMin == RL) && (myBounds.XMax == RF)
+ && (myBounds.YMax == RF) && (myBounds.ZMax == RF));
+ if (isEmpty != MyIsEmpty)
+ {
+ ::Message::DefaultMessenger()->Send ("Graphic3d_Group: MyIsEmpty != IsEmpty()", Message_Trace);
+ }
+ return isEmpty;
+}
+
+// =======================================================================
+// function : SetMinMaxValues
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetMinMaxValues (const Standard_Real theXMin, const Standard_Real theYMin, const Standard_Real theZMin,
+ const Standard_Real theXMax, const Standard_Real theYMax, const Standard_Real theZMax)
+{
+ myBounds.XMin = Standard_ShortReal (theXMin);
+ myBounds.YMin = Standard_ShortReal (theYMin);
+ myBounds.ZMin = Standard_ShortReal (theZMin);
+ myBounds.XMax = Standard_ShortReal (theXMax);
+ myBounds.YMax = Standard_ShortReal (theYMax);
+ myBounds.ZMax = Standard_ShortReal (theZMax);
+}
+
+// =======================================================================
+// function : MinMaxValues
+// purpose :
+// =======================================================================
+void Graphic3d_Group::MinMaxValues (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
+ Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const
+{
+ MinMaxCoord (theXMin, theYMin, theZMin,
+ theXMax, theYMax, theZMax);
+}
+
+// =======================================================================
+// function : Structure
+// purpose :
+// =======================================================================
+Handle(Graphic3d_Structure) Graphic3d_Group::Structure() const
+{
+ return myStructure;
+}
+
+// =======================================================================
+// function : MinMaxCoord
+// purpose :
+// =======================================================================
+void Graphic3d_Group::MinMaxCoord (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
+ Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const
+{
+ if (IsEmpty())
+ {
+ // Empty Group
+ theXMin = theYMin = theZMin = ShortRealFirst();
+ theXMax = theYMax = theZMax = ShortRealLast();
+ }
+ else
+ {
+ theXMin = Standard_Real (myBounds.XMin);
+ theYMin = Standard_Real (myBounds.YMin);
+ theZMin = Standard_Real (myBounds.ZMin);
+ theXMax = Standard_Real (myBounds.XMax);
+ theYMax = Standard_Real (myBounds.YMax);
+ theZMax = Standard_Real (myBounds.ZMax);
+ }
+}
+
+// =======================================================================
+// function : Update
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Update() const
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ if (myStructure->StructureManager()->UpdateMode() == Aspect_TOU_ASAP)
+ {
+ myStructure->StructureManager()->Update();
+ }
+}
+
+// =======================================================================
+// function : SetGroupPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_Real aWidth;
+ Quantity_Color aColor;
+ Aspect_TypeOfLine aLType;
+ theAspLine->Values (aColor, aLType, aWidth);
+
+ ContextLine.IsDef = 1;
+ ContextLine.Color.r = float (aColor.Red());
+ ContextLine.Color.g = float (aColor.Green());
+ ContextLine.Color.b = float (aColor.Blue());
+ ContextLine.LineType = aLType;
+ ContextLine.Width = float (aWidth);
+ ContextLine.ShaderProgram = theAspLine->ShaderProgram();
- MyCGroup.Struct = MyStructure->CStructure().operator->();
- MyCGroup.Struct->Id = int (MyStructure->Identification ());
- MyCGroup.ptrGroup = NULL;
+ UpdateAspectLine (Standard_True);
- MyCGroup.ContextLine.IsDef = 0,
- MyCGroup.ContextText.IsDef = 0,
- MyCGroup.ContextMarker.IsDef = 0,
- MyCGroup.ContextFillArea.IsDef = 0;
+ ContextLine.IsSet = 1;
- MyCGroup.ContextLine.IsSet = 0,
- MyCGroup.ContextText.IsSet = 0,
- MyCGroup.ContextMarker.IsSet = 0,
- MyCGroup.ContextFillArea.IsSet = 0;
+ Update();
+}
+
+// =======================================================================
+// function : SetGroupPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_Real anRGB[3];
+ Standard_Real aWidth;
+ Quantity_Color anIntColor;
+ Quantity_Color aBackIntColor;
+ Quantity_Color anEdgeColor;
+ Aspect_TypeOfLine aLType;
+ Aspect_InteriorStyle aStyle;
+ theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
+
+ anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
+ ContextFillArea.Style = aStyle;
+ ContextFillArea.IntColor.r = float (anRGB[0]);
+ ContextFillArea.IntColor.g = float (anRGB[1]);
+ ContextFillArea.IntColor.b = float (anRGB[2]);
+
+ if (theAspFill->Distinguish())
+ {
+ aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
+ }
+ ContextFillArea.BackIntColor.r = float (anRGB[0]);
+ ContextFillArea.BackIntColor.g = float (anRGB[1]);
+ ContextFillArea.BackIntColor.b = float (anRGB[2]);
+
+ // Edges
+ ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
+ ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
+ ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
+ ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
+ ContextFillArea.LineType = aLType;
+ ContextFillArea.Width = float (aWidth);
+ ContextFillArea.Hatch = theAspFill->HatchStyle();
+
+ // Front and Back face
+ ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
+ ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
+
+ // Back Material
+ const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
+
+ // Light specificity
+ ContextFillArea.Back.Shininess = float (aBack.Shininess());
+ ContextFillArea.Back.Ambient = float (aBack.Ambient());
+ ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
+ ContextFillArea.Back.Specular = float (aBack.Specular());
+ ContextFillArea.Back.Transparency = float (aBack.Transparency());
+ ContextFillArea.Back.Emission = float (aBack.Emissive());
+
+ // Reflection mode
+ ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
+ ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
+ ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
+ ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
+
+ // Material type
+ ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
+
+ // Specular color
+ ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
+ ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
+ ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
+
+ // Ambient color
+ ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
+ ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
+ ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
+
+ // Diffuse color
+ ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
+ ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
+ ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
+
+ // Emissive color
+ ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
+ ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
+ ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
+
+ ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
+
+ // Front Material
+ const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
+ // Light specificity
+ ContextFillArea.Front.Shininess = float (aFront.Shininess());
+ ContextFillArea.Front.Ambient = float (aFront.Ambient());
+ ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
+ ContextFillArea.Front.Specular = float (aFront.Specular());
+ ContextFillArea.Front.Transparency = float (aFront.Transparency());
+ ContextFillArea.Front.Emission = float (aFront.Emissive());
+
+ // Reflection mode
+ ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
+ ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
+ ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
+ ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
+
+ // Material type
+ ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
+
+ // Specular color
+ ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
+ ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
+ ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
+
+ // Ambient color
+ ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
+ ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
+ ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
+
+ // Diffuse color
+ ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
+ ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
+ ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
+
+ // Emissive color
+ ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
+ ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
+ ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
+
+ ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
+
+ ContextFillArea.IsDef = 1; // Definition material ok
+
+ // Texture map
+ ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
+ ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
+
+ Standard_Integer aPolyMode;
+ Standard_ShortReal aPolyFactor, aPolyUnits;
+ theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
+ ContextFillArea.PolygonOffsetMode = aPolyMode;
+ ContextFillArea.PolygonOffsetFactor = aPolyFactor;
+ ContextFillArea.PolygonOffsetUnits = aPolyUnits;
+
+ ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
+
+ UpdateAspectFace (Standard_True);
+
+ ContextFillArea.IsSet = 1;
+
+ Update();
+}
+
+// =======================================================================
+// function : SetGroupPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_Real aScale;
+ Quantity_Color aColor;
+ Aspect_TypeOfMarker aMarkerType;
+ theAspMarker->Values (aColor, aMarkerType, aScale);
+
+ ContextMarker.IsDef = 1;
+ ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
+ ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
+ ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
+ ContextMarker.MarkerType = aMarkerType;
+ ContextMarker.Scale = Standard_ShortReal (aScale);
+ ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
+ ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
+
+ UpdateAspectMarker (Standard_True);
+
+ ContextMarker.IsSet = 1;
+
+ Update();
+}
+
+// =======================================================================
+// function : SetGroupPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_Real anExpansion, aSpace, aTextAngle;
+ Quantity_Color aColor, aColorSubTitle;
+ Standard_CString aFont;
+ Aspect_TypeOfStyleText aStyle;
+ Aspect_TypeOfDisplayText aDisplayType;
+ Standard_Boolean isTextZoomable;
+ Font_FontAspect aTextFontAspect;
+ theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
+ aColorSubTitle, isTextZoomable, aTextAngle, aTextFontAspect);
+
+ ContextText.IsDef = 1;
+ ContextText.Color.r = float (aColor.Red());
+ ContextText.Color.g = float (aColor.Green());
+ ContextText.Color.b = float (aColor.Blue());
+ ContextText.Font = (char* )aFont;
+ ContextText.Expan = float (anExpansion);
+ ContextText.Space = float (aSpace);
+ ContextText.Style = aStyle;
+ ContextText.DisplayType = aDisplayType;
+ ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
+ ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
+ ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
+ ContextText.TextZoomable = isTextZoomable;
+ ContextText.TextAngle = float (aTextAngle);
+ ContextText.TextFontAspect = aTextFontAspect;
+ ContextText.ShaderProgram = theAspText->ShaderProgram();
+
+ UpdateAspectText (Standard_True);
+
+ ContextText.IsSet = 1;
+
+ Update();
+}
+
+// =======================================================================
+// function : SetPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
- MyCGroup.PickId.IsDef = 0,
- MyCGroup.PickId.IsSet = 0,
- MyCGroup.PickId.Value = 0;
+ Standard_Real aWidth;
+ Quantity_Color aColor;
+ Aspect_TypeOfLine aLType;
+ theAspLine->Values (aColor, aLType, aWidth);
- MyGraphicDriver = (MyStructure->StructureManager())->GraphicDriver();
+ ContextLine.IsDef = 1;
+ ContextLine.Color.r = float (aColor.Red());
+ ContextLine.Color.g = float (aColor.Green());
+ ContextLine.Color.b = float (aColor.Blue());
+ ContextLine.LineType = aLType;
+ ContextLine.Width = float (aWidth);
+ ContextLine.ShaderProgram = theAspLine->ShaderProgram();
+ UpdateAspectLine (Standard_False);
- MyGraphicDriver->Group (MyCGroup);
+ ContextLine.IsSet = 1;
- MyMarkWidth = 0;
- MyMarkHeight = 0;
- MyMarkArray.Nullify();
+ Update();
+}
+
+// =======================================================================
+// function : SetPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_Real anRGB[3];
+ Standard_Real aWidth;
+ Quantity_Color anIntColor;
+ Quantity_Color aBackIntColor;
+ Quantity_Color anEdgeColor;
+ Aspect_TypeOfLine aLType;
+ Aspect_InteriorStyle aStyle;
+ theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
+
+ anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
+ ContextFillArea.Style = aStyle;
+ ContextFillArea.IntColor.r = float (anRGB[0]);
+ ContextFillArea.IntColor.g = float (anRGB[1]);
+ ContextFillArea.IntColor.b = float (anRGB[2]);
+
+ if (theAspFill->Distinguish())
+ {
+ aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
+ }
+ ContextFillArea.BackIntColor.r = float(anRGB[0]);
+ ContextFillArea.BackIntColor.g = float(anRGB[1]);
+ ContextFillArea.BackIntColor.b = float(anRGB[2]);
+
+ // Edges
+ ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
+ ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
+ ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
+ ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
+ ContextFillArea.LineType = aLType;
+ ContextFillArea.Width = float (aWidth);
+ ContextFillArea.Hatch = theAspFill->HatchStyle();
+
+ // Front and Back face
+ ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
+ ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
+
+ // Back Material
+ const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
+ // Material state
+ ContextFillArea.Back.Shininess = float (aBack.Shininess());
+ ContextFillArea.Back.Ambient = float (aBack.Ambient());
+ ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
+ ContextFillArea.Back.Specular = float (aBack.Specular());
+ ContextFillArea.Back.Transparency = float (aBack.Transparency());
+ ContextFillArea.Back.Emission = float (aBack.Emissive());
+
+ // Reflection mode
+ ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
+ ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
+ ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
+ ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
+
+ // Material type
+ ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
+
+ // Specular color
+ ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
+ ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
+ ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
+
+ // Ambient color
+ ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
+ ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
+ ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
+
+ // Diffuse color
+ ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
+ ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
+ ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
+
+ // Emissive color
+ ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
+ ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
+ ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
+
+ ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
+
+ // Front Material
+ const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
+ // Light specificity
+ ContextFillArea.Front.Shininess = float (aFront.Shininess());
+ ContextFillArea.Front.Ambient = float (aFront.Ambient());
+ ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
+ ContextFillArea.Front.Specular = float (aFront.Specular());
+ ContextFillArea.Front.Transparency = float (aFront.Transparency());
+ ContextFillArea.Front.Emission = float (aFront.Emissive());
+
+ // Reflection mode
+ ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
+ ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
+ ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
+ ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
+
+ // Material type
+ ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
+
+ // Specular color
+ ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
+ ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
+ ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
+
+ // Ambient color
+ ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
+ ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
+ ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
+
+ // Diffuse color
+ ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
+ ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
+ ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
+
+ // Emissive color
+ ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
+ ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
+ ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
+
+ ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
+
+ ContextFillArea.IsDef = 1; // Material definition ok
+
+ ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
+ ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
+
+ Standard_Integer aPolyMode;
+ Standard_ShortReal aPolyFactor, aPolyUnits;
+ theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
+ ContextFillArea.PolygonOffsetMode = aPolyMode;
+ ContextFillArea.PolygonOffsetFactor = aPolyFactor;
+ ContextFillArea.PolygonOffsetUnits = aPolyUnits;
+
+ ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
+
+ UpdateAspectFace (Standard_False);
+
+ ContextFillArea.IsSet = 1;
+
+ Update();
+}
+
+// =======================================================================
+// function : SetPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_Real aScale;
+ Quantity_Color aColor;
+ Aspect_TypeOfMarker aMarkerType;
+ theAspMarker->Values (aColor, aMarkerType, aScale);
+
+ ContextMarker.IsDef = 1;
+ ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
+ ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
+ ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
+ ContextMarker.MarkerType = aMarkerType;
+ ContextMarker.Scale = Standard_ShortReal (aScale);
+ ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
+
+ ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
+
+ UpdateAspectMarker (Standard_False);
+
+ ContextMarker.IsSet = 1;
+
+ Update();
+}
+
+// =======================================================================
+// function : SetPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ Standard_CString aFont;
+ Standard_Real aSpace, anExpansion, aTextAngle;
+ Quantity_Color aColor, aColorSubTitle;
+ Aspect_TypeOfStyleText aStyle;
+ Aspect_TypeOfDisplayText aDisplayType;
+ Standard_Boolean aTextZoomable;
+ Font_FontAspect aTextFontAspect;
+ theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
+ aColorSubTitle, aTextZoomable, aTextAngle, aTextFontAspect);
+
+ ContextText.IsDef = 1;
+ ContextText.Color.r = float (aColor.Red());
+ ContextText.Color.g = float (aColor.Green());
+ ContextText.Color.b = float (aColor.Blue());
+ ContextText.Font = (char* )aFont;
+ ContextText.Expan = float (anExpansion);
+ ContextText.Space = float (aSpace);
+ ContextText.Style = aStyle;
+ ContextText.DisplayType = aDisplayType;
+ ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
+ ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
+ ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
+ ContextText.TextZoomable = aTextZoomable;
+ ContextText.TextAngle = float (aTextAngle);
+ ContextText.TextFontAspect = aTextFontAspect;
+ ContextText.ShaderProgram = theAspText->ShaderProgram();
+
+ UpdateAspectText (Standard_False);
+
+ ContextText.IsSet = 1;
+
+ Update();
+}
+
+// =======================================================================
+// function : IsGroupPrimitivesAspectSet
+// purpose :
+// =======================================================================
+Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const
+{
+ switch (theAspect)
+ {
+ case Graphic3d_ASPECT_LINE: return ContextLine.IsSet;
+ case Graphic3d_ASPECT_TEXT: return ContextText.IsSet;
+ case Graphic3d_ASPECT_MARKER: return ContextMarker.IsSet;
+ case Graphic3d_ASPECT_FILL_AREA: return ContextFillArea.IsSet;
+ default: return Standard_False;
+ }
+}
+
+// =======================================================================
+// function : GroupPrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
+ const Handle(Graphic3d_AspectText3d)& theAspText,
+ const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
+ const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
+{
+ Quantity_Color aColor;
+ Graphic3d_MaterialAspect aFront, aBack;
+
+ const CALL_DEF_CONTEXTLINE& anAspLine = ContextLine.IsSet ? ContextLine : myStructure->CStructure()->ContextLine;
+ aColor.SetValues (Standard_Real (anAspLine.Color.r),
+ Standard_Real (anAspLine.Color.g),
+ Standard_Real (anAspLine.Color.b), Quantity_TOC_RGB);
+ theAspLine->SetColor (aColor);
+ theAspLine->SetType (Aspect_TypeOfLine (anAspLine.LineType));
+ theAspLine->SetWidth (Standard_Real (anAspLine.Width));
+ theAspLine->SetShaderProgram (anAspLine.ShaderProgram);
+
+ const CALL_DEF_CONTEXTTEXT& anAspText = ContextText.IsSet ? ContextText : myStructure->CStructure()->ContextText;
+ aColor.SetValues (Standard_Real (anAspText.Color.r),
+ Standard_Real (anAspText.Color.g),
+ Standard_Real (anAspText.Color.b), Quantity_TOC_RGB);
+ theAspText->SetColor (aColor);
+ aColor.SetValues (Standard_Real (anAspText.ColorSubTitle.r),
+ Standard_Real (anAspText.ColorSubTitle.g),
+ Standard_Real (anAspText.ColorSubTitle.b), Quantity_TOC_RGB);
+ theAspText->SetColorSubTitle (aColor);
+ theAspText->SetFont (anAspText.Font);
+ theAspText->SetSpace (Standard_Real (anAspText.Space));
+ theAspText->SetExpansionFactor (Standard_Real (anAspText.Expan));
+ theAspText->SetStyle (Aspect_TypeOfStyleText (anAspText.Style));
+ theAspText->SetDisplayType (Aspect_TypeOfDisplayText (anAspText.DisplayType));
+ theAspText->SetShaderProgram (anAspText.ShaderProgram);
+
+ const CALL_DEF_CONTEXTMARKER& anAspMarker = ContextMarker.IsSet ? ContextMarker : myStructure->CStructure()->ContextMarker;
+ aColor.SetValues (Standard_Real (anAspMarker.Color.r),
+ Standard_Real (anAspMarker.Color.g),
+ Standard_Real (anAspMarker.Color.b), Quantity_TOC_RGB);
+ theAspMarker->SetColor (aColor);
+ theAspMarker->SetType (anAspMarker.MarkerType);
+ theAspMarker->SetScale (Standard_Real (anAspMarker.Scale));
+ theAspMarker->SetShaderProgram (anAspMarker.ShaderProgram);
+ if (anAspMarker.MarkerType == Aspect_TOM_USERDEFINED)
+ {
+ theAspMarker->SetMarkerImage (ContextMarker.MarkerImage);
+ }
+
+ const CALL_DEF_CONTEXTFILLAREA& anAspFill = ContextFillArea.IsSet ? ContextFillArea : myStructure->CStructure()->ContextFillArea;
+ // Interior
+ theAspFill->SetInteriorStyle (Aspect_InteriorStyle (anAspFill.Style));
+ aColor.SetValues (Standard_Real (anAspFill.IntColor.r),
+ Standard_Real (anAspFill.IntColor.g),
+ Standard_Real (anAspFill.IntColor.b), Quantity_TOC_RGB);
+ theAspFill->SetInteriorColor (aColor);
+
+ // Edges
+ aColor.SetValues (Standard_Real (anAspFill.EdgeColor.r),
+ Standard_Real (anAspFill.EdgeColor.g),
+ Standard_Real (anAspFill.EdgeColor.b), Quantity_TOC_RGB);
+ theAspFill->SetEdgeColor (aColor);
+ theAspFill->SetEdgeLineType (Aspect_TypeOfLine (anAspFill.LineType));
+ theAspFill->SetEdgeWidth (Standard_Real (anAspFill.Width));
+
+ // Back Material
+ aBack.SetShininess (Standard_Real (anAspFill.Back.Shininess));
+ aBack.SetAmbient (Standard_Real (anAspFill.Back.Ambient));
+ aBack.SetDiffuse (Standard_Real (anAspFill.Back.Diffuse));
+ aBack.SetSpecular (Standard_Real (anAspFill.Back.Specular));
+ aBack.SetTransparency (Standard_Real (anAspFill.Back.Transparency));
+ aBack.SetEmissive (Standard_Real (anAspFill.Back.Emission));
+ anAspFill.Back.IsAmbient == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aBack.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
+ anAspFill.Back.IsDiffuse == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aBack.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
+ anAspFill.Back.IsSpecular == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aBack.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
+ anAspFill.Back.IsEmission == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aBack.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
+
+ aColor.SetValues (Standard_Real (anAspFill.Back.ColorSpec.r),
+ Standard_Real (anAspFill.Back.ColorSpec.g),
+ Standard_Real (anAspFill.Back.ColorSpec.b), Quantity_TOC_RGB);
+ aBack.SetSpecularColor (aColor);
+
+ aColor.SetValues (Standard_Real (anAspFill.Back.ColorAmb.r),
+ Standard_Real (anAspFill.Back.ColorAmb.g),
+ Standard_Real (anAspFill.Back.ColorAmb.b), Quantity_TOC_RGB);
+ aBack.SetAmbientColor (aColor);
+
+ aColor.SetValues (Standard_Real (anAspFill.Back.ColorDif.r),
+ Standard_Real (anAspFill.Back.ColorDif.g),
+ Standard_Real (anAspFill.Back.ColorDif.b), Quantity_TOC_RGB);
+ aBack.SetDiffuseColor (aColor);
+
+ aColor.SetValues (Standard_Real (anAspFill.Back.ColorEms.r),
+ Standard_Real (anAspFill.Back.ColorEms.g),
+ Standard_Real (anAspFill.Back.ColorEms.b), Quantity_TOC_RGB);
+ aBack.SetEmissiveColor (aColor);
+
+ aBack.SetEnvReflexion (anAspFill.Back.EnvReflexion);
+
+ // Front Material
+ aFront.SetShininess (Standard_Real (anAspFill.Front.Shininess));
+ aFront.SetAmbient (Standard_Real (anAspFill.Front.Ambient));
+ aFront.SetDiffuse (Standard_Real (anAspFill.Front.Diffuse));
+ aFront.SetSpecular (Standard_Real (anAspFill.Front.Specular));
+ aFront.SetTransparency (Standard_Real (anAspFill.Front.Transparency));
+ aFront.SetEmissive (Standard_Real (anAspFill.Back.Emission));
+ anAspFill.Front.IsAmbient == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aFront.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
+ anAspFill.Front.IsDiffuse == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aFront.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
+ anAspFill.Front.IsSpecular == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aFront.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
+ anAspFill.Front.IsEmission == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aFront.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
+
+ aColor.SetValues (Standard_Real (anAspFill.Front.ColorSpec.r),
+ Standard_Real (anAspFill.Front.ColorSpec.g),
+ Standard_Real (anAspFill.Front.ColorSpec.b), Quantity_TOC_RGB);
+ aFront.SetSpecularColor (aColor);
+
+ aColor.SetValues (Standard_Real (anAspFill.Front.ColorAmb.r),
+ Standard_Real (anAspFill.Front.ColorAmb.g),
+ Standard_Real (anAspFill.Front.ColorAmb.b), Quantity_TOC_RGB);
+ aFront.SetAmbientColor (aColor);
+
+ aColor.SetValues (Standard_Real (anAspFill.Front.ColorDif.r),
+ Standard_Real (anAspFill.Front.ColorDif.g),
+ Standard_Real (anAspFill.Front.ColorDif.b), Quantity_TOC_RGB);
+ aFront.SetDiffuseColor (aColor);
+
+ aColor.SetValues (Standard_Real (anAspFill.Front.ColorEms.r),
+ Standard_Real (anAspFill.Front.ColorEms.g),
+ Standard_Real (anAspFill.Front.ColorEms.b), Quantity_TOC_RGB);
+ aFront.SetEmissiveColor (aColor);
+
+ aFront.SetEnvReflexion (anAspFill.Front.EnvReflexion);
+
+ // Edges
+ anAspFill.Edge == 1 ? theAspFill->SetEdgeOn() : theAspFill->SetEdgeOff();
+ // Hatch
+ theAspFill->SetHatchStyle (Aspect_HatchStyle (anAspFill.Hatch));
+ // Materials
+ // Front and Back face
+ anAspFill.Distinguish == 1 ? theAspFill->SetDistinguishOn() : theAspFill->SetDistinguishOff();
+ anAspFill.BackFace == 1 ? theAspFill->SuppressBackFace() : theAspFill->AllowBackFace();
+ // Texture
+ theAspFill->SetTextureMap (anAspFill.Texture.TextureMap);
+ anAspFill.Texture.doTextureMap == 1 ? theAspFill->SetTextureMapOn() : theAspFill->SetTextureMapOff();
+ theAspFill->SetShaderProgram (anAspFill.ShaderProgram);
+ theAspFill->SetPolygonOffsets (anAspFill.PolygonOffsetMode,
+ anAspFill.PolygonOffsetFactor,
+ anAspFill.PolygonOffsetUnits);
+ theAspFill->SetBackMaterial (aBack);
+ theAspFill->SetFrontMaterial (aFront);
+}
+
+// =======================================================================
+// function : PrimitivesAspect
+// purpose :
+// =======================================================================
+void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
+ const Handle(Graphic3d_AspectText3d)& theAspText,
+ const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
+ const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
+{
+ GroupPrimitivesAspect (theAspLine, theAspText, theAspMarker, theAspFill);
+}
+
+// =======================================================================
+// function : AddPrimitiveArray
+// purpose :
+// =======================================================================
+void Graphic3d_Group::AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim,
+ const Standard_Boolean theToEvalMinMax)
+{
+ if (IsDeleted()
+ || !thePrim->IsValid())
+ {
+ return;
+ }
+
+ if (!MyContainsFacet
+ && thePrim->Type() != Graphic3d_TOPA_POLYLINES
+ && thePrim->Type() != Graphic3d_TOPA_SEGMENTS
+ && thePrim->Type() != Graphic3d_TOPA_POINTS)
+ {
+ myStructure->GroupsWithFacet (1);
+ MyContainsFacet = Standard_True;
+ }
+
+ MyIsEmpty = Standard_False;
+ myListOfPArray.Append (thePrim);
+ if (theToEvalMinMax)
+ {
+ Standard_Real x, y, z;
+ const Standard_Integer aNbVerts = thePrim->VertexNumber();
+ for (Standard_Integer aVertIter = 1; aVertIter <= aNbVerts; ++aVertIter)
+ {
+ thePrim->Vertice (aVertIter, 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);
+ }
+ }
+
+ 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 /*theObject*/,
+ const Standard_Boolean /*theToEvalMinMax*/,
+ const Standard_Boolean theContainsFacet)
+{
+ 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 && theContainsFacet)
+ {
+ myStructure->GroupsWithFacet (1);
+ MyContainsFacet = Standard_True;
+ }
+
+ MyIsEmpty = Standard_False;
+ Update();
+}
+
+// =======================================================================
+// function : Text
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Text (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)
+{
+ if (IsDeleted())
+ {
+ return;
+ }
+
+ MyIsEmpty = Standard_False;
+ if (theToEvalMinMax)
+ {
+ Standard_ShortReal x, y, z;
+ thePoint.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;
+ }
+ Update();
+}
+
+// =======================================================================
+// function : Text
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Text (const Standard_CString theText,
+ const Graphic3d_Vertex& thePoint,
+ const Standard_Real theHeight,
+ const Standard_Boolean theToEvalMinMax)
+{
+ Text (theText, thePoint, theHeight, 0.0,
+ Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
+}
+
+// =======================================================================
+// function : Text
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Text (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)
+{
+ const NCollection_String aText ((Standard_Utf16Char* )theText.ToExtString());
+ Text (aText.ToCString(), thePoint, theHeight, theAngle,
+ theTp, theHta, theVta, theToEvalMinMax);
+}
+
+// =======================================================================
+// function : Text
+// purpose :
+// =======================================================================
+void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
+ const Graphic3d_Vertex& thePoint,
+ const Standard_Real theHeight,
+ const Standard_Boolean theToEvalMinMax)
+{
+ const NCollection_String aText ((Standard_Utf16Char* )theText.ToExtString());
+ Text (aText.ToCString(), thePoint, theHeight, 0.0,
+ Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
}
+++ /dev/null
-// 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 GROUP_PXX_INCLUDED
-#define GROUP_PXX_INCLUDED
-
-#include <Graphic3d_Structure.pxx>
-
-// groups identifiers : possible range
-#define Group_IDMIN 100
-// /2 pour eviter les problemes d'overflow
-#define Group_IDMAX INT_MAX/2
-
-#define MyIsEmpty MyCBitFields.bool1
-#define MyContainsFacet MyCBitFields.bool2
-#define MyNotUsed1 MyCBitFields.bool3
-#define MyNotUsed2 MyCBitFields.bool4
-
-#define MyStructure ((Graphic3d_Structure *) MyPtrStructure)
-
-#endif
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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 ();
-}
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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 ();
-
-}
+++ /dev/null
-// 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.
-
-// modified: 1/07/97 ; PCT : ajout texture mapping
-// 20/07/97 ; PCT : ajout transparence texture
-// 08/04/98 ; FGU : Ajout emission surface
-// 30/11/98 ; FMN : S4069. Textes always visible.
-// 22/03/04 ; SAN : OCC4895 High-level interface for controlling polygon offsets */
-
-
-//-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
-
-#define OCC1174 //SAV 08/01/03 : Added back face interior color controling
-
-
-// for the class
-#include <Graphic3d_Group.jxx>
-#include <Graphic3d_Group.pxx>
-#include <Graphic3d_TextureMap.hxx>
-#include <Graphic3d_ShaderProgram.hxx>
-
-//-Methods, in order
-
-void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
-
- if (IsDeleted ()) return;
-
- Standard_Real R, G, B;
- Standard_Real AWidth;
- Quantity_Color AColor;
- Aspect_TypeOfLine ALType;
-
- CTX->Values (AColor, ALType, AWidth);
- AColor.Values (R, G, B, Quantity_TOC_RGB);
-
- MyCGroup.ContextLine.Color.r = float (R);
- MyCGroup.ContextLine.Color.g = float (G);
- MyCGroup.ContextLine.Color.b = float (B);
- MyCGroup.ContextLine.LineType = int (ALType);
- MyCGroup.ContextLine.Width = float (AWidth);
- MyCGroup.ContextLine.IsDef = 1;
-
- MyCGroup.ContextLine.ShaderProgram = CTX->ShaderProgram();
-
- int noinsert = 1;
- MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextLine.IsSet = 1;
-
- Update ();
-}
-
-void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
-
- if (IsDeleted ()) return;
-
- Standard_Real R, G, B;
- Standard_Real AWidth;
- //Quantity_Color AColor;
- Quantity_Color AIntColor;
- Quantity_Color BackIntColor;
- Quantity_Color AEdgeColor;
- Aspect_TypeOfLine ALType;
- Aspect_InteriorStyle AStyle;
-
- CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
- AIntColor.Values (R, G, B, Quantity_TOC_RGB);
-
- MyCGroup.ContextFillArea.Style = int (AStyle);
- MyCGroup.ContextFillArea.IntColor.r = float (R);
- MyCGroup.ContextFillArea.IntColor.g = float (G);
- MyCGroup.ContextFillArea.IntColor.b = float (B);
-
-#ifdef OCC1174
- if ( CTX->Distinguish() )
- BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
-#endif
- MyCGroup.ContextFillArea.BackIntColor.r = float( R );
- MyCGroup.ContextFillArea.BackIntColor.g = float( G );
- MyCGroup.ContextFillArea.BackIntColor.b = float( B );
-
- MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
- AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
- MyCGroup.ContextFillArea.EdgeColor.r = float (R);
- MyCGroup.ContextFillArea.EdgeColor.g = float (G);
- MyCGroup.ContextFillArea.EdgeColor.b = float (B);
- MyCGroup.ContextFillArea.LineType = int (ALType);
- MyCGroup.ContextFillArea.Width = float (AWidth);
- MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
-
- /*** Front and Back face ***/
- MyCGroup.ContextFillArea.Distinguish =
- ( CTX->Distinguish () ? 1 : 0 );
- MyCGroup.ContextFillArea.BackFace =
- ( CTX->BackFace () ? 1 : 0 );
-
- /*** Back Material ***/
- // Light specificity
- MyCGroup.ContextFillArea.Back.Shininess =
- float ((CTX->BackMaterial ()).Shininess ());
- MyCGroup.ContextFillArea.Back.Ambient =
- float ((CTX->BackMaterial ()).Ambient ());
- MyCGroup.ContextFillArea.Back.Diffuse =
- float ((CTX->BackMaterial ()).Diffuse ());
- MyCGroup.ContextFillArea.Back.Specular =
- float ((CTX->BackMaterial ()).Specular ());
- MyCGroup.ContextFillArea.Back.Transparency =
- float ((CTX->BackMaterial ()).Transparency ());
- MyCGroup.ContextFillArea.Back.Emission =
- float ((CTX->BackMaterial ()).Emissive ());
-
- // Reflection mode
- MyCGroup.ContextFillArea.Back.IsAmbient =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
- MyCGroup.ContextFillArea.Back.IsDiffuse =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
- MyCGroup.ContextFillArea.Back.IsSpecular =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
- MyCGroup.ContextFillArea.Back.IsEmission =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_EMISSION) ? 1 : 0 );
-
- // Material type
- //JR/Hp
- const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
- Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
- MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
-
- // Specular color
- MyCGroup.ContextFillArea.Back.ColorSpec.r =
- float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorSpec.g =
- float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorSpec.b =
- float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
-
-
- // Ambient color
- MyCGroup.ContextFillArea.Back.ColorAmb.r =
- float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorAmb.g =
- float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorAmb.b =
- float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
-
- // Diffuse color
- MyCGroup.ContextFillArea.Back.ColorDif.r =
- float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorDif.g =
- float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorDif.b =
- float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
-
- // Emissive color
- MyCGroup.ContextFillArea.Back.ColorEms.r =
- float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorEms.g =
- float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorEms.b =
- float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
-
- MyCGroup.ContextFillArea.Back.EnvReflexion =
- float ((CTX->BackMaterial ()).EnvReflexion());
-
- /*** Front Material ***/
- // Light specificity
- MyCGroup.ContextFillArea.Front.Shininess =
- float ((CTX->FrontMaterial ()).Shininess ());
- MyCGroup.ContextFillArea.Front.Ambient =
- float ((CTX->FrontMaterial ()).Ambient ());
- MyCGroup.ContextFillArea.Front.Diffuse =
- float ((CTX->FrontMaterial ()).Diffuse ());
- MyCGroup.ContextFillArea.Front.Specular =
- float ((CTX->FrontMaterial ()).Specular ());
- MyCGroup.ContextFillArea.Front.Transparency =
- float ((CTX->FrontMaterial ()).Transparency ());
- MyCGroup.ContextFillArea.Front.Emission =
- float ((CTX->FrontMaterial ()).Emissive ());
-
- // Reflection mode
- MyCGroup.ContextFillArea.Front.IsAmbient =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
- MyCGroup.ContextFillArea.Front.IsDiffuse =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
- MyCGroup.ContextFillArea.Front.IsSpecular =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
- MyCGroup.ContextFillArea.Front.IsEmission =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_EMISSION) ? 1 : 0 );
-
- // Material type
- //JR/Hp
- const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
- Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
- MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
-
- // Specular color
- MyCGroup.ContextFillArea.Front.ColorSpec.r =
- float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorSpec.g =
- float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorSpec.b =
- float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
-
- // Ambient color
- MyCGroup.ContextFillArea.Front.ColorAmb.r =
- float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorAmb.g =
- float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorAmb.b =
- float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
-
- // Diffuse color
- MyCGroup.ContextFillArea.Front.ColorDif.r =
- float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorDif.g =
- float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorDif.b =
- float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
-
- // Emissive color
- MyCGroup.ContextFillArea.Front.ColorEms.r =
- float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorEms.g =
- float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorEms.b =
- float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
-
- MyCGroup.ContextFillArea.Front.EnvReflexion =
- float ((CTX->FrontMaterial ()).EnvReflexion());
-
- MyCGroup.ContextFillArea.IsDef = 1; // Definition material ok
-
- /*** Texture map ***/
- MyCGroup.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
- MyCGroup.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
-
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
- Standard_Integer aPolyMode;
- Standard_ShortReal aPolyFactor, aPolyUnits;
- CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
- MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
- MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
- MyCGroup.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
-
- MyCGroup.ContextFillArea.ShaderProgram = CTX->ShaderProgram();
-
- int noinsert = 1;
- MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextFillArea.IsSet = 1;
-
- Update();
-}
-
-void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theCtx)
-{
- if (IsDeleted()) return;
-
- Standard_Real aRed, aGreen, aBlue;
- Standard_Real aScale;
- Quantity_Color aColor;
- Aspect_TypeOfMarker aMarkerType;
-
- theCtx->Values (aColor, aMarkerType, aScale);
- aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
-
- MyCGroup.ContextMarker.IsDef = 1;
- MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed);
- MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen);
- MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue);
- MyCGroup.ContextMarker.MarkerType = aMarkerType;
- MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale);
- MyCGroup.ContextMarker.MarkerImage = theCtx->GetMarkerImage();
-
- MyCGroup.ContextMarker.ShaderProgram = theCtx->ShaderProgram();
-
- int noinsert = 1;
- MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- Update();
-}
-
-void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
-
- if (IsDeleted ()) return;
-
- Standard_CString AFont;
- Standard_Real R, G, B;
- Standard_Real Rs, Gs, Bs;
- Standard_Real ASpace;
- Standard_Real AnExpansion;
- Quantity_Color AColor;
- Aspect_TypeOfStyleText AStyle;
- Aspect_TypeOfDisplayText ADisplayType;
- Quantity_Color AColorSubTitle;
- Standard_Boolean ATextZoomable;
- Standard_Real ATextAngle;
- Font_FontAspect ATextFontAspect;
-
- CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
- AColor.Values (R, G, B, Quantity_TOC_RGB);
- AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
-
- MyCGroup.ContextText.Color.r = float (R);
- MyCGroup.ContextText.Color.g = float (G);
- MyCGroup.ContextText.Color.b = float (B);
- MyCGroup.ContextText.Font = (char*)AFont;
- MyCGroup.ContextText.Expan = float (AnExpansion);
- MyCGroup.ContextText.Space = float (ASpace);
- MyCGroup.ContextText.Style = int (AStyle);
- MyCGroup.ContextText.DisplayType= int (ADisplayType);
- MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
- MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
- MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
- MyCGroup.ContextText.TextZoomable = ATextZoomable;
- MyCGroup.ContextText.TextAngle = float (ATextAngle);
- MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
-
- MyCGroup.ContextText.ShaderProgram = CTX->ShaderProgram();
-
- MyCGroup.ContextText.IsDef = 1;
-
- int noinsert = 1;
- MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextText.IsSet = 1;
-
- Update ();
-}
-
-void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
-
- if (IsDeleted ()) return;
-
- Standard_Real R, G, B;
- Standard_Real AWidth;
- Quantity_Color AColor;
- Aspect_TypeOfLine ALType;
-
- CTX->Values (AColor, ALType, AWidth);
- AColor.Values (R, G, B, Quantity_TOC_RGB);
-
- MyCGroup.ContextLine.Color.r = float (R);
- MyCGroup.ContextLine.Color.g = float (G);
- MyCGroup.ContextLine.Color.b = float (B);
- MyCGroup.ContextLine.LineType = int (ALType);
- MyCGroup.ContextLine.Width = float (AWidth);
- MyCGroup.ContextLine.IsDef = 1;
-
- MyCGroup.ContextLine.ShaderProgram = CTX->ShaderProgram();
-
- int noinsert = 0;
- MyGraphicDriver->LineContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextLine.IsSet = 1;
-
- Update ();
-}
-
-void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
-
- if (IsDeleted ()) return;
-
- Standard_Real R, G, B;
- Standard_Real AWidth;
- Quantity_Color AIntColor;
- Quantity_Color BackIntColor;
- Quantity_Color AEdgeColor;
- Aspect_TypeOfLine ALType;
- Aspect_InteriorStyle AStyle;
-
- CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
- AIntColor.Values (R, G, B, Quantity_TOC_RGB);
-
- MyCGroup.ContextFillArea.Style = int (AStyle);
- MyCGroup.ContextFillArea.IntColor.r = float (R);
- MyCGroup.ContextFillArea.IntColor.g = float (G);
- MyCGroup.ContextFillArea.IntColor.b = float (B);
-#ifdef OCC1174
- if ( CTX->Distinguish() )
- BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
-#endif
- MyCGroup.ContextFillArea.BackIntColor.r = float( R );
- MyCGroup.ContextFillArea.BackIntColor.g = float( G );
- MyCGroup.ContextFillArea.BackIntColor.b = float( B );
-
- MyCGroup.ContextFillArea.Edge = (CTX->Edge () ? 1 : 0);
- AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
- MyCGroup.ContextFillArea.EdgeColor.r = float (R);
- MyCGroup.ContextFillArea.EdgeColor.g = float (G);
- MyCGroup.ContextFillArea.EdgeColor.b = float (B);
- MyCGroup.ContextFillArea.LineType = int (ALType);
- MyCGroup.ContextFillArea.Width = float (AWidth);
- MyCGroup.ContextFillArea.Hatch = int (CTX->HatchStyle ());
- // Front and Back face
- MyCGroup.ContextFillArea.Distinguish =
- ( CTX->Distinguish () ? 1 : 0 );
- MyCGroup.ContextFillArea.BackFace =
- ( CTX->BackFace () ? 1 : 0 );
-
- /*** Back Material ***/
- // Material state
- MyCGroup.ContextFillArea.Back.Shininess =
- float ((CTX->BackMaterial ()).Shininess ());
- MyCGroup.ContextFillArea.Back.Ambient =
- float ((CTX->BackMaterial ()).Ambient ());
- MyCGroup.ContextFillArea.Back.Diffuse =
- float ((CTX->BackMaterial ()).Diffuse ());
- MyCGroup.ContextFillArea.Back.Specular =
- float ((CTX->BackMaterial ()).Specular ());
- MyCGroup.ContextFillArea.Back.Transparency =
- float ((CTX->BackMaterial ()).Transparency ());
- MyCGroup.ContextFillArea.Back.Emission =
- float ((CTX->BackMaterial ()).Emissive ());
-
- // Reflection mode
- MyCGroup.ContextFillArea.Back.IsAmbient =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
- MyCGroup.ContextFillArea.Back.IsDiffuse =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
- MyCGroup.ContextFillArea.Back.IsSpecular =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
- MyCGroup.ContextFillArea.Back.IsEmission =
- ( (CTX->BackMaterial ()).ReflectionMode
- (Graphic3d_TOR_EMISSION) ? 1 : 0 );
-
- // Material type
- //JR/Hp
- const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
- Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
- MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
-
- // Specular color
- MyCGroup.ContextFillArea.Back.ColorSpec.r =
- float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorSpec.g =
- float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorSpec.b =
- float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
-
- // Ambient color
- MyCGroup.ContextFillArea.Back.ColorAmb.r =
- float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorAmb.g =
- float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorAmb.b =
- float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
-
- // Diffuse color
- MyCGroup.ContextFillArea.Back.ColorDif.r =
- float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorDif.g =
- float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorDif.b =
- float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
-
- // Emissive color
- MyCGroup.ContextFillArea.Back.ColorEms.r =
- float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
- MyCGroup.ContextFillArea.Back.ColorEms.g =
- float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
- MyCGroup.ContextFillArea.Back.ColorEms.b =
- float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
-
- MyCGroup.ContextFillArea.Back.EnvReflexion =
- float ((CTX->BackMaterial ()).EnvReflexion());
-
- /*** Front Material ***/
- // Ligth specificity
- MyCGroup.ContextFillArea.Front.Shininess =
- float ((CTX->FrontMaterial ()).Shininess ());
- MyCGroup.ContextFillArea.Front.Ambient =
- float ((CTX->FrontMaterial ()).Ambient ());
- MyCGroup.ContextFillArea.Front.Diffuse =
- float ((CTX->FrontMaterial ()).Diffuse ());
- MyCGroup.ContextFillArea.Front.Specular =
- float ((CTX->FrontMaterial ()).Specular ());
- MyCGroup.ContextFillArea.Front.Transparency =
- float ((CTX->FrontMaterial ()).Transparency ());
- MyCGroup.ContextFillArea.Front.Emission =
- float ((CTX->FrontMaterial ()).Emissive ());
-
- // Reflection mode
- MyCGroup.ContextFillArea.Front.IsAmbient =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
- MyCGroup.ContextFillArea.Front.IsDiffuse =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
- MyCGroup.ContextFillArea.Front.IsSpecular =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
- MyCGroup.ContextFillArea.Front.IsEmission =
- ( (CTX->FrontMaterial ()).ReflectionMode
- (Graphic3d_TOR_EMISSION) ? 1 : 0 );
-
- //Material type
- //JR/Hp
- const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
- Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
- MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
-
- // Specular color
- MyCGroup.ContextFillArea.Front.ColorSpec.r =
- float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorSpec.g =
- float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorSpec.b =
- float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
-
- // Ambient color
- MyCGroup.ContextFillArea.Front.ColorAmb.r =
- float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorAmb.g =
- float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorAmb.b =
- float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
-
- // Diffuse color
- MyCGroup.ContextFillArea.Front.ColorDif.r =
- float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorDif.g =
- float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorDif.b =
- float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
-
- // Emissive color
- MyCGroup.ContextFillArea.Front.ColorEms.r =
- float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
- MyCGroup.ContextFillArea.Front.ColorEms.g =
- float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
- MyCGroup.ContextFillArea.Front.ColorEms.b =
- float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
-
- MyCGroup.ContextFillArea.Front.EnvReflexion =
- float ((CTX->FrontMaterial ()).EnvReflexion());
-
- MyCGroup.ContextFillArea.IsDef = 1; // Material definition ok
-
- MyCGroup.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
- MyCGroup.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
-
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
- Standard_Integer aPolyMode;
- Standard_ShortReal aPolyFactor, aPolyUnits;
- CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
- MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
- MyCGroup.ContextFillArea.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
- MyCGroup.ContextFillArea.PolygonOffsetUnits = (Standard_ShortReal)aPolyUnits;
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
-
- MyCGroup.ContextFillArea.ShaderProgram = CTX->ShaderProgram();
-
- int noinsert = 0;
- MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextFillArea.IsSet = 1;
-
- Update ();
-}
-
-void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& thCtx)
-{
- if (IsDeleted()) return;
-
- Standard_Real aRed, aGreen, aBlue;
- Standard_Real aScale;
- Quantity_Color aColor;
- Aspect_TypeOfMarker aMarkerType;
-
- thCtx->Values (aColor, aMarkerType, aScale);
- aColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
-
- MyCGroup.ContextMarker.IsDef = 1;
- MyCGroup.ContextMarker.Color.r = Standard_ShortReal (aRed);
- MyCGroup.ContextMarker.Color.g = Standard_ShortReal (aGreen);
- MyCGroup.ContextMarker.Color.b = Standard_ShortReal (aBlue);
- MyCGroup.ContextMarker.MarkerType = aMarkerType;
- MyCGroup.ContextMarker.Scale = Standard_ShortReal (aScale);
- MyCGroup.ContextMarker.MarkerImage = thCtx->GetMarkerImage();
-
- MyCGroup.ContextMarker.ShaderProgram = thCtx->ShaderProgram();
-
- int noinsert = 0;
- MyGraphicDriver->MarkerContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- Update();
-}
-
-void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
-
- if (IsDeleted ()) return;
-
- Standard_CString AFont;
- Standard_Real R, G, B;
- Standard_Real Rs, Gs, Bs;
- Standard_Real ASpace;
- Standard_Real AnExpansion;
- Quantity_Color AColor;
- Aspect_TypeOfStyleText AStyle;
- Aspect_TypeOfDisplayText ADisplayType;
- Quantity_Color AColorSubTitle;
- Standard_Boolean ATextZoomable;
- Standard_Real ATextAngle;
- Font_FontAspect ATextFontAspect;
-
- CTX->Values (AColor, AFont, AnExpansion, ASpace, AStyle, ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
- AColor.Values (R, G, B, Quantity_TOC_RGB);
- AColorSubTitle.Values (Rs, Gs, Bs, Quantity_TOC_RGB);
-
- MyCGroup.ContextText.Color.r = float (R);
- MyCGroup.ContextText.Color.g = float (G);
- MyCGroup.ContextText.Color.b = float (B);
- MyCGroup.ContextText.Font = (char*)AFont;
- MyCGroup.ContextText.Expan = float (AnExpansion);
- MyCGroup.ContextText.Space = float (ASpace);
- MyCGroup.ContextText.Style = int (AStyle);
- MyCGroup.ContextText.DisplayType= int (ADisplayType);
- MyCGroup.ContextText.ColorSubTitle.r = float (Rs);
- MyCGroup.ContextText.ColorSubTitle.g = float (Gs);
- MyCGroup.ContextText.ColorSubTitle.b = float (Bs);
- MyCGroup.ContextText.TextZoomable = ATextZoomable;
- MyCGroup.ContextText.TextAngle = float (ATextAngle);
- MyCGroup.ContextText.TextFontAspect = (int)ATextFontAspect;
- MyCGroup.ContextText.IsDef = 1;
-
- MyCGroup.ContextText.ShaderProgram = CTX->ShaderProgram();
-
- int noinsert = 0;
- MyGraphicDriver->TextContextGroup (MyCGroup, noinsert);
-
- MyCGroup.ContextText.IsSet = 1;
-
- Update();
-}
-
-Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const {
- switch (theAspect) {
- case Graphic3d_ASPECT_LINE: return MyCGroup.ContextLine.IsSet;
- case Graphic3d_ASPECT_TEXT: return MyCGroup.ContextText.IsSet;
- case Graphic3d_ASPECT_MARKER: return MyCGroup.ContextMarker.IsSet;
- case Graphic3d_ASPECT_FILL_AREA: return MyCGroup.ContextFillArea.IsSet;
- default: return Standard_False;
- }
-}
-
-
-void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const {
-
- Standard_Real R, G, B;
- Standard_Real Rs, Gs, Bs;
- Quantity_Color AColor;
-
- Standard_Real AWidth;
- Aspect_TypeOfLine ALType;
-
- Standard_CString AFont;
- Standard_Real ASpace;
- Standard_Real AnExpansion;
-
- Standard_Real AScale;
- Aspect_TypeOfMarker AMType;
-
- Quantity_Color AnIntColor;
- Quantity_Color AnEdgeColor;
- Aspect_InteriorStyle AStyle;
- Standard_Boolean EdgeOn = Standard_False;
- Graphic3d_MaterialAspect Front;
- Graphic3d_MaterialAspect Back;
- Aspect_TypeOfStyleText AStyleT;
- Aspect_TypeOfDisplayText ADisplayType;
- Quantity_Color AColorSubTitle;
-
- if (MyCGroup.ContextLine.IsSet)
- {
- R = Standard_Real (MyCGroup.ContextLine.Color.r);
- G = Standard_Real (MyCGroup.ContextLine.Color.g);
- B = Standard_Real (MyCGroup.ContextLine.Color.b);
- ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType);
- AWidth = Standard_Real (MyCGroup.ContextLine.Width);
- CTXL->SetShaderProgram (MyCGroup.ContextLine.ShaderProgram);
- }
- else
- {
- R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r);
- G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g);
- B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b);
- ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType);
- AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width);
- CTXL->SetShaderProgram (MyCGroup.Struct->ContextLine.ShaderProgram);
- }
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- CTXL->SetColor (AColor);
- CTXL->SetType (ALType);
- CTXL->SetWidth (AWidth);
-
- if (MyCGroup.ContextText.IsSet)
- {
- R = Standard_Real (MyCGroup.ContextText.Color.r);
- G = Standard_Real (MyCGroup.ContextText.Color.g);
- B = Standard_Real (MyCGroup.ContextText.Color.b);
- Rs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.r);
- Gs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.g);
- Bs = Standard_Real (MyCGroup.ContextText.ColorSubTitle.b);
- AFont = Standard_CString (MyCGroup.ContextText.Font);
- AnExpansion = Standard_Real (MyCGroup.ContextText.Expan);
- ASpace = Standard_Real (MyCGroup.ContextText.Space);
- AStyleT = Aspect_TypeOfStyleText (MyCGroup.ContextText.Style);
- ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.ContextText.DisplayType);
- CTXT->SetShaderProgram (MyCGroup.ContextText.ShaderProgram);
- }
- else
- {
- R = Standard_Real (MyCGroup.Struct->ContextText.Color.r);
- G = Standard_Real (MyCGroup.Struct->ContextText.Color.g);
- B = Standard_Real (MyCGroup.Struct->ContextText.Color.b);
- Rs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.r);
- Gs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.g);
- Bs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.b);
- AFont = Standard_CString (MyCGroup.Struct->ContextText.Font);
- AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan);
- ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space);
- AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style);
- ADisplayType = Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType);
- CTXT->SetShaderProgram (MyCGroup.Struct->ContextText.ShaderProgram);
- }
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- AColorSubTitle.SetValues (Rs, Gs, Bs, Quantity_TOC_RGB);
- CTXT->SetColor (AColor);
- CTXT->SetFont (AFont);
- CTXT->SetExpansionFactor (AnExpansion);
- CTXT->SetSpace (ASpace);
- CTXT->SetStyle (AStyleT);
- CTXT->SetDisplayType (ADisplayType);
- CTXT->SetColorSubTitle (AColorSubTitle);
-
- if (MyCGroup.ContextMarker.IsSet)
- {
- R = Standard_Real (MyCGroup.ContextMarker.Color.r);
- G = Standard_Real (MyCGroup.ContextMarker.Color.g);
- B = Standard_Real (MyCGroup.ContextMarker.Color.b);
- AMType = MyCGroup.ContextMarker.MarkerType;
- AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
- CTXT->SetShaderProgram (MyCGroup.ContextMarker.ShaderProgram);
-
- if (AMType == Aspect_TOM_USERDEFINED)
- {
- CTXM->SetBitMap (MyMarkWidth, MyMarkHeight, MyMarkArray);
- }
- }
- else
- {
- R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
- G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
- B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
- AMType = MyCGroup.Struct->ContextMarker.MarkerType;
- AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
- CTXT->SetShaderProgram (MyCGroup.Struct->ContextMarker.ShaderProgram);
- }
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- CTXM->SetColor (AColor);
- CTXM->SetType (AMType);
- CTXM->SetScale (AScale);
-
- if (MyCGroup.ContextFillArea.IsSet)
- {
- // Interior
- AStyle = Aspect_InteriorStyle (MyCGroup.ContextFillArea.Style);
- R = Standard_Real (MyCGroup.ContextFillArea.IntColor.r);
- G = Standard_Real (MyCGroup.ContextFillArea.IntColor.g);
- B = Standard_Real (MyCGroup.ContextFillArea.IntColor.b);
- AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
- // Edges
- if (MyCGroup.ContextFillArea.Edge == 1) EdgeOn = Standard_True;
- R = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.r);
- G = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.g);
- B = Standard_Real (MyCGroup.ContextFillArea.EdgeColor.b);
- AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
- ALType = Aspect_TypeOfLine (MyCGroup.ContextFillArea.LineType);
- AWidth = Standard_Real (MyCGroup.ContextFillArea.Width);
- // Back Material
- Back.SetShininess (
- Standard_Real (MyCGroup.ContextFillArea.Back.Shininess));
- Back.SetAmbient (
- Standard_Real (MyCGroup.ContextFillArea.Back.Ambient));
- Back.SetDiffuse (
- Standard_Real (MyCGroup.ContextFillArea.Back.Diffuse));
- Back.SetSpecular (
- Standard_Real (MyCGroup.ContextFillArea.Back.Specular));
- Back.SetTransparency (
- Standard_Real (MyCGroup.ContextFillArea.Back.Transparency));
- Back.SetEmissive (
- Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
- if (MyCGroup.ContextFillArea.Back.IsAmbient == 1)
- Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
- else
- Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
- if (MyCGroup.ContextFillArea.Back.IsDiffuse == 1)
- Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
- else
- Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
- if (MyCGroup.ContextFillArea.Back.IsSpecular == 1)
- Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
- else
- Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorSpec.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetSpecularColor (AColor);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorAmb.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetAmbientColor (AColor);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorDif.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetDiffuseColor (AColor);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Back.ColorEms.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetEmissiveColor (AColor);
-
- Back.SetEnvReflexion (MyCGroup.ContextFillArea.Back.EnvReflexion);
- // Front Material
- Front.SetShininess (
- Standard_Real (MyCGroup.ContextFillArea.Front.Shininess));
- Front.SetAmbient (
- Standard_Real (MyCGroup.ContextFillArea.Front.Ambient));
- Front.SetDiffuse (
- Standard_Real (MyCGroup.ContextFillArea.Front.Diffuse));
- Front.SetSpecular (
- Standard_Real (MyCGroup.ContextFillArea.Front.Specular));
- Front.SetTransparency (
- Standard_Real (MyCGroup.ContextFillArea.Front.Transparency));
- Front.SetEmissive (
- Standard_Real (MyCGroup.ContextFillArea.Back.Emission));
- if (MyCGroup.ContextFillArea.Front.IsAmbient == 1)
- Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
- else
- Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
- if (MyCGroup.ContextFillArea.Front.IsDiffuse == 1)
- Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
- else
- Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
- if (MyCGroup.ContextFillArea.Front.IsSpecular == 1)
- Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
- else
- Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorSpec.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetSpecularColor (AColor);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorAmb.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetAmbientColor (AColor);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorDif.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetDiffuseColor (AColor);
-
- R = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.r);
- G = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.g);
- B = Standard_Real (MyCGroup.ContextFillArea.Front.ColorEms.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetEmissiveColor (AColor);
-
- Front.SetEnvReflexion (MyCGroup.ContextFillArea.Front.EnvReflexion);
-
- // Edges
- if (EdgeOn)
- CTXF->SetEdgeOn ();
- else
- CTXF->SetEdgeOff ();
- // Hatch
- CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.ContextFillArea.Hatch));
- // Materials
- // Front and Back face
- if (MyCGroup.ContextFillArea.Distinguish == 1)
- CTXF->SetDistinguishOn ();
- else
- CTXF->SetDistinguishOff ();
- if (MyCGroup.ContextFillArea.BackFace == 1)
- CTXF->SuppressBackFace ();
- else
- CTXF->AllowBackFace ();
- // Texture
- CTXF->SetTextureMap (MyCGroup.ContextFillArea.Texture.TextureMap);
- if (MyCGroup.ContextFillArea.Texture.doTextureMap == 1)
- {
- CTXF->SetTextureMapOn();
- }
- else
- {
- CTXF->SetTextureMapOff();
- }
- CTXF->SetShaderProgram (MyCGroup.ContextFillArea.ShaderProgram);
-
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
- CTXF->SetPolygonOffsets(MyCGroup.ContextFillArea.PolygonOffsetMode,
- MyCGroup.ContextFillArea.PolygonOffsetFactor,
- MyCGroup.ContextFillArea.PolygonOffsetUnits);
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
- }
- else
- {
- // Interior
- AStyle = Aspect_InteriorStyle (MyCGroup.Struct->ContextFillArea.Style);
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.b);
- AnIntColor.SetValues (R, G, B, Quantity_TOC_RGB);
- // Edges
- if (MyCGroup.Struct->ContextFillArea.Edge == 1) EdgeOn = Standard_True;
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.EdgeColor.b);
- AnEdgeColor.SetValues (R, G, B, Quantity_TOC_RGB);
- ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextFillArea.LineType);
- AWidth = Standard_Real (MyCGroup.Struct->ContextFillArea.Width);
- // Back Material
- Back.SetShininess (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Shininess));
- Back.SetAmbient (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Ambient));
- Back.SetDiffuse (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Diffuse));
- Back.SetSpecular (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Specular));
- Back.SetTransparency (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Transparency));
- Back.SetEmissive (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Back.Emission));
- if (MyCGroup.Struct->ContextFillArea.Back.IsAmbient == 1)
- Back.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
- else
- Back.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
- if (MyCGroup.Struct->ContextFillArea.Back.IsDiffuse == 1)
- Back.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
- else
- Back.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
- if (MyCGroup.Struct->ContextFillArea.Back.IsSpecular == 1)
- Back.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
- else
- Back.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorSpec.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetSpecularColor (AColor);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorAmb.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetAmbientColor (AColor);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorDif.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetDiffuseColor (AColor);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Back.ColorEms.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Back.SetEmissiveColor (AColor);
-
- Back.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Back.EnvReflexion);
- // Front Material
- Front.SetShininess (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Shininess));
- Front.SetAmbient (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Ambient));
- Front.SetDiffuse (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Diffuse));
- Front.SetSpecular (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Specular));
- Front.SetTransparency (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Transparency));
- Front.SetEmissive (
- Standard_Real (MyCGroup.Struct->ContextFillArea.Front.Emission));
- if (MyCGroup.Struct->ContextFillArea.Front.IsAmbient == 1)
- Front.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
- else
- Front.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
- if (MyCGroup.Struct->ContextFillArea.Front.IsDiffuse == 1)
- Front.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
- else
- Front.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
- if (MyCGroup.Struct->ContextFillArea.Front.IsSpecular == 1)
- Front.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
- else
- Front.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorSpec.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetSpecularColor (AColor);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorAmb.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetAmbientColor (AColor);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorDif.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetDiffuseColor (AColor);
-
- R = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.r);
- G = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.g);
- B = Standard_Real (MyCGroup.Struct->ContextFillArea.Front.ColorEms.b);
- AColor.SetValues (R, G, B, Quantity_TOC_RGB);
- Front.SetEmissiveColor (AColor);
-
- Front.SetEnvReflexion (MyCGroup.Struct->ContextFillArea.Front.EnvReflexion);
-
- // Edges
- if (EdgeOn)
- CTXF->SetEdgeOn ();
- else
- CTXF->SetEdgeOff ();
- // Hatch
- CTXF->SetHatchStyle(Aspect_HatchStyle (MyCGroup.Struct->ContextFillArea.Hatch));
- // Materials
- // Front and Back face
- if (MyCGroup.Struct->ContextFillArea.Distinguish == 1)
- CTXF->SetDistinguishOn ();
- else
- CTXF->SetDistinguishOff ();
- if (MyCGroup.Struct->ContextFillArea.BackFace == 1)
- CTXF->SuppressBackFace ();
- else
- CTXF->AllowBackFace ();
- // Texture
- CTXF->SetTextureMap (MyCGroup.Struct->ContextFillArea.Texture.TextureMap);
- if (MyCGroup.Struct->ContextFillArea.Texture.doTextureMap == 1)
- {
- CTXF->SetTextureMapOn();
- }
- else
- {
- CTXF->SetTextureMapOff();
- }
- CTXF->SetShaderProgram (MyCGroup.Struct->ContextFillArea.ShaderProgram);
-
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
- CTXF->SetPolygonOffsets(MyCGroup.Struct->ContextFillArea.PolygonOffsetMode,
- MyCGroup.Struct->ContextFillArea.PolygonOffsetFactor,
- MyCGroup.Struct->ContextFillArea.PolygonOffsetUnits);
- // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
- }
- CTXF->SetInteriorStyle (AStyle);
- CTXF->SetInteriorColor (AnIntColor);
- CTXF->SetEdgeColor (AnEdgeColor);
- CTXF->SetEdgeLineType (ALType);
- CTXF->SetEdgeWidth (AWidth);
- CTXF->SetBackMaterial (Back);
- CTXF->SetFrontMaterial (Front);
-}
-
-void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const
-{
- GroupPrimitivesAspect (CTXL, CTXT, CTXM, CTXF);
-}
--- /dev/null
+// 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.
+//
+// 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_SequenceOfGroup_HeaderFile
+#define _Graphic3d_SequenceOfGroup_HeaderFile
+
+#include <Graphic3d_Group.hxx>
+#include <NCollection_Sequence.hxx>
+
+typedef NCollection_Sequence<Handle(Graphic3d_Group)> Graphic3d_SequenceOfGroup;
+
+#endif // _Graphic3d_SequenceOfGroup_HeaderFile
GraphicDriver from Graphic3d,
Group from Graphic3d,
SequenceOfGroup from Graphic3d,
- HSequenceOfGroup from Graphic3d,
SequenceOfStructure from Graphic3d,
HSequenceOfStructure from Graphic3d,
MapOfStructure from Graphic3d,
-- 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;
-- 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;
-- 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;
---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
--
-- 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;
-- 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;
{
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();
// 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;
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;
}
// - 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;
}
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;
}
//=============================================================================
void Graphic3d_Structure::GraphicClear (const Standard_Boolean theWithDestruction)
{
- // clean and empty each group
- const Standard_Integer aLength = myGroups.Length();
- for (Standard_Integer aGrId = 1; aGrId <= aLength; ++aGrId)
+ if (myCStructure.IsNull())
{
- myGroups.ChangeValue (aGrId)->Clear();
+ return;
}
- if (theWithDestruction)
+ // clean and empty each group
+ for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myCStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
{
- while (!myGroups.IsEmpty())
- {
- Handle(Graphic3d_Group) aGroup = myGroups.First();
- aGroup->Remove();
- }
+ aGroupIter.ChangeValue()->Clear();
+ }
+ if (!theWithDestruction)
+ {
+ return;
+ }
- myCStructure->Clear();
+ while (!myCStructure->Groups().IsEmpty())
+ {
+ Handle(Graphic3d_Group) aGroup = myCStructure->Groups().First();
+ aGroup->Remove();
}
+ myCStructure->Clear();
}
//=============================================================================
//=============================================================================
const Graphic3d_SequenceOfGroup& Graphic3d_Structure::Groups() const
{
- return myGroups;
+ return myCStructure->Groups();
}
//=============================================================================
//=============================================================================
Standard_Integer Graphic3d_Structure::NumberOfGroups() const
{
- return myGroups.Length();
+ return myCStructure->Groups().Length();
}
//=============================================================================
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 :
}
}
+//=============================================================================
+//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;
}
//=============================================================================
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;
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;
}
}
myCStructure->UpdateNamedStatus();
break;
case Aspect_TOHM_BOUNDBOX:
- myCStructure->HighlightWithBndBox (Standard_False);
+ myCStructure->HighlightWithBndBox (this, Standard_False);
myCStructure->UpdateNamedStatus();
break;
}
&& myCStructure->HLRValidation != 0;
}
-//=======================================================================
-//function : CStructure
-//purpose :
-//=======================================================================
-const Handle(Graphic3d_CStructure)& Graphic3d_Structure::CStructure() const
-{
- return myCStructure;
-}
-
//=======================================================================
//function : SetZLayer
//purpose :
--- /dev/null
+// 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;
+}
// /2 pour eviter les problemes d'overflow
#define Structure_IDMAX INT_MAX/2
-#include <Graphic3d_Group.pxx>
-
#endif
#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 {
} 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 {
} 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 {
} 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 {
} 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
{
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
#include <OpenGl_Texture.hxx>
#include <OpenGl_Workspace.hxx>
-#include <Graphic3d_CGroup.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Graphic3d_TypeOfReflection.hxx>
#include <OpenGl_Element.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Graphic3d_CAspectFillArea.hxx>
#include <Graphic3d_ShaderProgram_Handle.hxx>
#include <Graphic3d_TextureMap.hxx>
#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;
#include <InterfaceGraphic_Graphic3d.hxx>
#include <Aspect_TypeOfLine.hxx>
+#include <Graphic3d_CAspectLine.hxx>
#include <Handle_OpenGl_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <Aspect_TypeOfMarker.hxx>
-#include <Graphic3d_CGroup.hxx>
+#include <Graphic3d_CAspectMarker.hxx>
#include <TCollection_AsciiString.hxx>
#include <OpenGl_Element.hxx>
#include <Font_FontAspect.hxx>
#include <Aspect_TypeOfStyleText.hxx>
#include <Aspect_TypeOfDisplayText.hxx>
+#include <Graphic3d_CAspectText.hxx>
#include <TCollection_AsciiString.hxx>
#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)
// 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();
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);
}
#include <OpenGl_RenderFilter.hxx>
#include <OpenGl_Group.hxx>
+#include <Graphic3d_SequenceOfGroup.hxx>
+
// Forward declaration
class Handle(OpenGl_Workspace);
class Handle(Graphic3d_ClipPlane);
//! 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.
}
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),
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 :
{
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);
-}
#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>
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,
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);
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
+++ /dev/null
-// 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);
-}
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);
- }
- }
-}
#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!");
+ }
}
// =======================================================================
}
// =======================================================================
-// 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 :
myModificationState++;
myIsRaytracable = Standard_True;
- if (myAncestorStructure != NULL)
+ OpenGl_Structure* aStruct = GlStruct();
+ if (aStruct != NULL)
{
- myAncestorStructure->UpdateStateWithAncestorStructures();
- myAncestorStructure->SetRaytracableWithAncestorStructures();
+ aStruct->UpdateStateWithAncestorStructures();
+ aStruct->SetRaytracableWithAncestorStructures();
}
}
#endif
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 :
#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;
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);
+
+ Standard_EXPORT virtual void Clear (const Standard_Boolean theToUpdateStructureMgr);
+
+ //! Update line aspect
+ Standard_EXPORT virtual void UpdateAspectLine (const Standard_Boolean theIsGlobal);
+
+ //! 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);
- 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);
+ //! Add primitive array element
+ Standard_EXPORT virtual void AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim,
+ const Standard_Boolean theToEvalMinMax);
- void AddElement (OpenGl_Element* theElem);
+ //! 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);
- virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
- virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
+ //! 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; }
//! 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:
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
// 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());
myAspectFace(NULL),
myAspectMarker(NULL),
myAspectText(NULL),
- myHighlightBox(NULL),
myHighlightColor(NULL),
myNamedStatus(0),
myZLayer(0)
}
// =======================================================================
-// 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();
}
}
{
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();
}
// =======================================================================
-// 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;
}
}
// =======================================================================
-// 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;
}
}
#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();
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;
}
// 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
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
// =======================================================================
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)
{
{
myAspectText->Release (theGlCtx);
}
- if (myHighlightBox != NULL)
+ if (!myHighlightBox.IsNull())
{
myHighlightBox->Release (theGlCtx);
}
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:
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:
+
+ //! Auxiliary wrapper to iterate OpenGl_Group sequence.
+ class GroupIterator
+ {
+
+ 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->()); }
+
+ private:
+ Graphic3d_SequenceOfGroup::Iterator myIter;
+
+ };
+
public:
//! Create empty structure
- OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
+ Standard_EXPORT OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager);
//! Setup structure graphic state
- virtual void UpdateNamedStatus();
+ Standard_EXPORT virtual void UpdateNamedStatus();
//! Clear graphic data
- virtual void Clear();
+ Standard_EXPORT virtual void Clear();
//! Connect other structure to this one
- virtual void Connect (Graphic3d_CStructure& theStructure);
+ Standard_EXPORT virtual void Connect (Graphic3d_CStructure& theStructure);
//! Disconnect other structure to this one
- virtual void Disconnect (Graphic3d_CStructure& theStructure);
+ Standard_EXPORT virtual void Disconnect (Graphic3d_CStructure& theStructure);
//! Synchronize structure aspects
- virtual void UpdateAspects();
+ Standard_EXPORT virtual void UpdateAspects();
//! Synchronize structure transformation
- virtual void UpdateTransformation();
+ Standard_EXPORT virtual void UpdateTransformation();
//! Highlight entire structure with color
- virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
- const Standard_Boolean theToCreate);
+ Standard_EXPORT virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
+ const Standard_Boolean theToCreate);
//! Highlight structure using boundary box
- virtual void HighlightWithBndBox (const Standard_Boolean theToCreate);
+ Standard_EXPORT virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
+ const Standard_Boolean theToCreate);
//! Create shadow link to this structure
- virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const;
+ 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
{
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);
//!
//! 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; }
protected:
- virtual ~OpenGl_Structure();
+ Standard_EXPORT virtual ~OpenGl_Structure();
#ifdef HAVE_OPENCL
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;
// 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)
{
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,
: 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);
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);
}
}
// 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)
---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);
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);
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;
+ CurrentGroup(me) returns mutable Group from Graphic3d is static private;
friends
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 :
//=======================================================================
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;
-}
-
-
-//=======================================================================
-//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();
+ return Groups().Last();
}
-
//=======================================================================
//function : Compute
//purpose :
void PrsMgr_Presentation3d::Erase ()
{
+ if (myStructure.IsNull())
+ {
+ return;
+ }
+
// Erase structure from structure manager
myStructure->Erase();
myStructure->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();
}
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);
if (myareagroup.IsNull())
{
- myareagroup = new Graphic3d_Group (mystruct);
+ myareagroup = mystruct->NewGroup();
}
SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive anIt (myentities);
if (mysensgroup.IsNull())
{
- mysensgroup = new Graphic3d_Group (mystruct);
+ mysensgroup = mystruct->NewGroup();
}
Quantity_Color aColor (Quantity_NOC_INDIANRED3);
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);
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)
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));
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)
{
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();
}
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);
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();
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();
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)
{
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();
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));
if (myGridEchoStructure.IsNull())
{
myGridEchoStructure = new Graphic3d_Structure (Viewer());
- myGridEchoGroup = new Graphic3d_Group (myGridEchoStructure);
+ myGridEchoGroup = myGridEchoStructure->NewGroup();
}
myGridEchoAspect = theMarker;
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);