1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
19 #include <Graphic3d_ArrayOfPoints.hxx>
20 #include <Graphic3d_ArrayOfPrimitives.hxx>
21 #include <Graphic3d_AspectFillArea3d.hxx>
22 #include <Graphic3d_AspectLine3d.hxx>
23 #include <Graphic3d_AspectMarker3d.hxx>
24 #include <Graphic3d_AspectText3d.hxx>
25 #include <Graphic3d_CStructure.hxx>
26 #include <Graphic3d_Group.hxx>
27 #include <Graphic3d_GroupDefinitionError.hxx>
28 #include <Graphic3d_ShaderProgram.hxx>
29 #include <Graphic3d_Structure.hxx>
30 #include "Graphic3d_Structure.pxx"
31 #include <Graphic3d_StructureManager.hxx>
32 #include <Graphic3d_TextureMap.hxx>
33 #include <Graphic3d_TransModeFlags.hxx>
34 #include <Message.hxx>
35 #include <Message_Messenger.hxx>
36 #include <NCollection_String.hxx>
37 #include <Standard_OutOfRange.hxx>
38 #include <Standard_Type.hxx>
39 #include <TCollection_AsciiString.hxx>
40 #include <TCollection_ExtendedString.hxx>
42 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Group,MMgt_TShared)
44 #define MyContainsFacet myCBitFields.bool2
46 // =======================================================================
47 // function : Graphic3d_Group
49 // =======================================================================
50 Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct)
51 : myIsClosed (Standard_False)
53 // A small commentary on the usage of This!
55 // Graphic3d_Group is created in a structure. Graphic3d_Structure is a
56 // manager of Graphic3d_Group. In the constructor of Graphic3d_Group
57 // a method Add of Graphic3d_Structure is called. It allows adding
58 // the instance of Graphic3d_Group in its manager. So there are 2 references
59 // to <me> and everything works well.
61 // This () is the instance of the class, the current group
62 //Handle(Graphic3d_Group) me = Handle(Graphic3d_Group)::DownCast (This());
64 myStructure = theStruct.operator->();
66 MyContainsFacet = Standard_False,
68 ContextLine.IsDef = 0;
69 ContextText.IsDef = 0;
70 ContextMarker.IsDef = 0;
71 ContextFillArea.IsDef = 0;
73 ContextLine.IsSet = 0;
74 ContextText.IsSet = 0;
75 ContextMarker.IsSet = 0;
76 ContextFillArea.IsSet = 0;
79 // =======================================================================
82 // =======================================================================
83 void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
90 ContextLine.IsSet = 0,
91 ContextText.IsSet = 0,
92 ContextMarker.IsSet = 0,
93 ContextFillArea.IsSet = 0;
95 ContextLine.IsDef = 0,
96 ContextText.IsDef = 0,
97 ContextMarker.IsDef = 0,
98 ContextFillArea.IsDef = 0;
104 myStructure->GroupsWithFacet (-1);
105 MyContainsFacet = Standard_False;
108 // clear method could be used on Graphic3d_Structure destruction,
109 // and its structure manager could be already destroyed, in that
110 // case we don't need to update it;
111 if (theUpdateStructureMgr)
117 // =======================================================================
118 // function : Destroy
120 // =======================================================================
121 void Graphic3d_Group::Destroy()
123 // tell graphics driver to clear internal resources of the group
124 Clear (Standard_False);
127 // =======================================================================
130 // =======================================================================
131 void Graphic3d_Group::Remove()
140 myStructure->GroupsWithFacet (-1);
141 MyContainsFacet = Standard_False;
143 myStructure->Remove (this);
150 // =======================================================================
151 // function : IsDeleted
153 // =======================================================================
154 Standard_Boolean Graphic3d_Group::IsDeleted() const
156 return myStructure == NULL
157 || myStructure->IsDeleted();
160 // =======================================================================
161 // function : ContainsFacet
163 // =======================================================================
164 Standard_Boolean Graphic3d_Group::ContainsFacet() const
166 return MyContainsFacet;
169 // =======================================================================
170 // function : IsEmpty
172 // =======================================================================
173 Standard_Boolean Graphic3d_Group::IsEmpty() const
177 return Standard_True;
180 return !myStructure->IsInfinite()
181 && !myBounds.IsValid();
184 // =======================================================================
185 // function : SetMinMaxValues
187 // =======================================================================
188 void Graphic3d_Group::SetMinMaxValues (const Standard_Real theXMin, const Standard_Real theYMin, const Standard_Real theZMin,
189 const Standard_Real theXMax, const Standard_Real theYMax, const Standard_Real theZMax)
191 myBounds = Graphic3d_BndBox4f (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theXMin),
192 static_cast<Standard_ShortReal> (theYMin),
193 static_cast<Standard_ShortReal> (theZMin),
195 Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theXMax),
196 static_cast<Standard_ShortReal> (theYMax),
197 static_cast<Standard_ShortReal> (theZMax),
201 // =======================================================================
202 // function : MinMaxValues
204 // =======================================================================
205 void Graphic3d_Group::MinMaxValues (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
206 Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const
208 MinMaxCoord (theXMin, theYMin, theZMin,
209 theXMax, theYMax, theZMax);
212 // =======================================================================
213 // function : Structure
215 // =======================================================================
216 Handle(Graphic3d_Structure) Graphic3d_Group::Structure() const
221 // =======================================================================
222 // function : MinMaxCoord
224 // =======================================================================
225 void Graphic3d_Group::MinMaxCoord (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
226 Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const
231 theXMin = theYMin = theZMin = ShortRealFirst();
232 theXMax = theYMax = theZMax = ShortRealLast();
234 else if (myBounds.IsValid())
236 const Graphic3d_Vec4& aMinPt = myBounds.CornerMin();
237 const Graphic3d_Vec4& aMaxPt = myBounds.CornerMax();
238 theXMin = Standard_Real (aMinPt.x());
239 theYMin = Standard_Real (aMinPt.y());
240 theZMin = Standard_Real (aMinPt.z());
241 theXMax = Standard_Real (aMaxPt.x());
242 theYMax = Standard_Real (aMaxPt.y());
243 theZMax = Standard_Real (aMaxPt.z());
247 // for consistency with old API
248 theXMin = theYMin = theZMin = ShortRealLast();
249 theXMax = theYMax = theZMax = ShortRealFirst();
253 // =======================================================================
256 // =======================================================================
257 void Graphic3d_Group::Update() const
264 myStructure->StructureManager()->Update (myStructure->StructureManager()->UpdateMode());
267 // =======================================================================
268 // function : SetGroupPrimitivesAspect
270 // =======================================================================
271 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
278 Standard_Real aWidth;
279 Quantity_Color aColor;
280 Aspect_TypeOfLine aLType;
281 theAspLine->Values (aColor, aLType, aWidth);
283 ContextLine.IsDef = 1;
284 ContextLine.Color.r = float (aColor.Red());
285 ContextLine.Color.g = float (aColor.Green());
286 ContextLine.Color.b = float (aColor.Blue());
287 ContextLine.LineType = aLType;
288 ContextLine.Width = float (aWidth);
289 ContextLine.ShaderProgram = theAspLine->ShaderProgram();
291 UpdateAspectLine (Standard_True);
293 ContextLine.IsSet = 1;
298 // =======================================================================
299 // function : SetGroupPrimitivesAspect
301 // =======================================================================
302 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
309 Standard_Real anRGB[3];
310 Standard_Real aWidth;
311 Quantity_Color anIntColor;
312 Quantity_Color aBackIntColor;
313 Quantity_Color anEdgeColor;
314 Aspect_TypeOfLine aLType;
315 Aspect_InteriorStyle aStyle;
316 theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
318 anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
319 ContextFillArea.Style = aStyle;
320 ContextFillArea.IntColor.r = float (anRGB[0]);
321 ContextFillArea.IntColor.g = float (anRGB[1]);
322 ContextFillArea.IntColor.b = float (anRGB[2]);
324 if (theAspFill->Distinguish())
326 aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
328 ContextFillArea.BackIntColor.r = float (anRGB[0]);
329 ContextFillArea.BackIntColor.g = float (anRGB[1]);
330 ContextFillArea.BackIntColor.b = float (anRGB[2]);
333 ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
334 ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
335 ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
336 ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
337 ContextFillArea.LineType = aLType;
338 ContextFillArea.Width = float (aWidth);
339 ContextFillArea.Hatch = theAspFill->HatchStyle();
341 // Front and Back face
342 ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
343 ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
346 const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
348 // Material properties
349 ContextFillArea.Back.Shininess = float (aBack.Shininess());
350 ContextFillArea.Back.Ambient = float (aBack.Ambient());
351 ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
352 ContextFillArea.Back.Specular = float (aBack.Specular());
353 ContextFillArea.Back.Transparency = float (aBack.Transparency());
354 ContextFillArea.Back.Emission = float (aBack.Emissive());
355 ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
356 ContextFillArea.Back.BSDF = aBack.BSDF();
359 ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
360 ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
361 ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
362 ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
365 ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
368 ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
369 ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
370 ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
373 ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
374 ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
375 ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
378 ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
379 ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
380 ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
383 ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
384 ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
385 ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
387 ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
390 const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
392 // Material properties
393 ContextFillArea.Front.Shininess = float (aFront.Shininess());
394 ContextFillArea.Front.Ambient = float (aFront.Ambient());
395 ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
396 ContextFillArea.Front.Specular = float (aFront.Specular());
397 ContextFillArea.Front.Transparency = float (aFront.Transparency());
398 ContextFillArea.Front.Emission = float (aFront.Emissive());
399 ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
400 ContextFillArea.Front.BSDF = aFront.BSDF();
403 ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
404 ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
405 ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
406 ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
409 ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
412 ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
413 ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
414 ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
417 ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
418 ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
419 ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
422 ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
423 ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
424 ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
427 ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
428 ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
429 ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
431 ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
433 ContextFillArea.IsDef = 1; // Definition material ok
436 ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
437 ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
439 Standard_Integer aPolyMode;
440 Standard_ShortReal aPolyFactor, aPolyUnits;
441 theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
442 ContextFillArea.PolygonOffsetMode = aPolyMode;
443 ContextFillArea.PolygonOffsetFactor = aPolyFactor;
444 ContextFillArea.PolygonOffsetUnits = aPolyUnits;
446 ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
448 UpdateAspectFace (Standard_True);
450 ContextFillArea.IsSet = 1;
455 // =======================================================================
456 // function : SetGroupPrimitivesAspect
458 // =======================================================================
459 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
466 Standard_Real aScale;
467 Quantity_Color aColor;
468 Aspect_TypeOfMarker aMarkerType;
469 theAspMarker->Values (aColor, aMarkerType, aScale);
471 ContextMarker.IsDef = 1;
472 ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
473 ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
474 ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
475 ContextMarker.MarkerType = aMarkerType;
476 ContextMarker.Scale = Standard_ShortReal (aScale);
477 ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
478 ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
480 UpdateAspectMarker (Standard_True);
482 ContextMarker.IsSet = 1;
487 // =======================================================================
488 // function : SetGroupPrimitivesAspect
490 // =======================================================================
491 void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
498 Standard_Real anExpansion, aSpace, aTextAngle;
499 Quantity_Color aColor, aColorSubTitle;
500 Standard_CString aFont;
501 Aspect_TypeOfStyleText aStyle;
502 Aspect_TypeOfDisplayText aDisplayType;
503 Standard_Boolean isTextZoomable;
504 Font_FontAspect aTextFontAspect;
505 theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
506 aColorSubTitle, isTextZoomable, aTextAngle, aTextFontAspect);
508 ContextText.IsDef = 1;
509 ContextText.Color.r = float (aColor.Red());
510 ContextText.Color.g = float (aColor.Green());
511 ContextText.Color.b = float (aColor.Blue());
512 ContextText.Font = (char* )aFont;
513 ContextText.Expan = float (anExpansion);
514 ContextText.Space = float (aSpace);
515 ContextText.Style = aStyle;
516 ContextText.DisplayType = aDisplayType;
517 ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
518 ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
519 ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
520 ContextText.TextZoomable = isTextZoomable;
521 ContextText.TextAngle = float (aTextAngle);
522 ContextText.TextFontAspect = aTextFontAspect;
523 ContextText.ShaderProgram = theAspText->ShaderProgram();
525 UpdateAspectText (Standard_True);
527 ContextText.IsSet = 1;
532 // =======================================================================
533 // function : SetPrimitivesAspect
535 // =======================================================================
536 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
543 Standard_Real aWidth;
544 Quantity_Color aColor;
545 Aspect_TypeOfLine aLType;
546 theAspLine->Values (aColor, aLType, aWidth);
548 ContextLine.IsDef = 1;
549 ContextLine.Color.r = float (aColor.Red());
550 ContextLine.Color.g = float (aColor.Green());
551 ContextLine.Color.b = float (aColor.Blue());
552 ContextLine.LineType = aLType;
553 ContextLine.Width = float (aWidth);
554 ContextLine.ShaderProgram = theAspLine->ShaderProgram();
556 UpdateAspectLine (Standard_False);
558 ContextLine.IsSet = 1;
563 // =======================================================================
564 // function : SetPrimitivesAspect
566 // =======================================================================
567 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
574 Standard_Real anRGB[3];
575 Standard_Real aWidth;
576 Quantity_Color anIntColor;
577 Quantity_Color aBackIntColor;
578 Quantity_Color anEdgeColor;
579 Aspect_TypeOfLine aLType;
580 Aspect_InteriorStyle aStyle;
581 theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
583 anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
584 ContextFillArea.Style = aStyle;
585 ContextFillArea.IntColor.r = float (anRGB[0]);
586 ContextFillArea.IntColor.g = float (anRGB[1]);
587 ContextFillArea.IntColor.b = float (anRGB[2]);
589 if (theAspFill->Distinguish())
591 aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
593 ContextFillArea.BackIntColor.r = float(anRGB[0]);
594 ContextFillArea.BackIntColor.g = float(anRGB[1]);
595 ContextFillArea.BackIntColor.b = float(anRGB[2]);
598 ContextFillArea.Edge = theAspFill->Edge() ? 1 : 0;
599 ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
600 ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
601 ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
602 ContextFillArea.LineType = aLType;
603 ContextFillArea.Width = float (aWidth);
604 ContextFillArea.Hatch = theAspFill->HatchStyle();
606 // Front and Back face
607 ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
608 ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
611 const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
613 ContextFillArea.Back.Shininess = float (aBack.Shininess());
614 ContextFillArea.Back.Ambient = float (aBack.Ambient());
615 ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
616 ContextFillArea.Back.Specular = float (aBack.Specular());
617 ContextFillArea.Back.Transparency = float (aBack.Transparency());
618 ContextFillArea.Back.Emission = float (aBack.Emissive());
621 ContextFillArea.Back.IsAmbient = aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
622 ContextFillArea.Back.IsDiffuse = aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
623 ContextFillArea.Back.IsSpecular = aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
624 ContextFillArea.Back.IsEmission = aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
627 ContextFillArea.Back.IsPhysic = aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
630 ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
631 ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
632 ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
635 ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
636 ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
637 ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
640 ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
641 ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
642 ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
645 ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
646 ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
647 ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
649 ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
651 ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
652 ContextFillArea.Back.BSDF = aBack.BSDF();
655 const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
657 ContextFillArea.Front.Shininess = float (aFront.Shininess());
658 ContextFillArea.Front.Ambient = float (aFront.Ambient());
659 ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
660 ContextFillArea.Front.Specular = float (aFront.Specular());
661 ContextFillArea.Front.Transparency = float (aFront.Transparency());
662 ContextFillArea.Front.Emission = float (aFront.Emissive());
665 ContextFillArea.Front.IsAmbient = aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0;
666 ContextFillArea.Front.IsDiffuse = aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0;
667 ContextFillArea.Front.IsSpecular = aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0;
668 ContextFillArea.Front.IsEmission = aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0;
671 ContextFillArea.Front.IsPhysic = aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0;
674 ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
675 ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
676 ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
679 ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
680 ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
681 ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
684 ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
685 ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
686 ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
689 ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
690 ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
691 ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
693 ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
695 ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
696 ContextFillArea.Front.BSDF = aFront.BSDF();
698 ContextFillArea.IsDef = 1; // Material definition ok
700 ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
701 ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
703 Standard_Integer aPolyMode;
704 Standard_ShortReal aPolyFactor, aPolyUnits;
705 theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
706 ContextFillArea.PolygonOffsetMode = aPolyMode;
707 ContextFillArea.PolygonOffsetFactor = aPolyFactor;
708 ContextFillArea.PolygonOffsetUnits = aPolyUnits;
710 ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
712 UpdateAspectFace (Standard_False);
714 ContextFillArea.IsSet = 1;
719 // =======================================================================
720 // function : SetPrimitivesAspect
722 // =======================================================================
723 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
730 Standard_Real aScale;
731 Quantity_Color aColor;
732 Aspect_TypeOfMarker aMarkerType;
733 theAspMarker->Values (aColor, aMarkerType, aScale);
735 ContextMarker.IsDef = 1;
736 ContextMarker.Color.r = Standard_ShortReal (aColor.Red());
737 ContextMarker.Color.g = Standard_ShortReal (aColor.Green());
738 ContextMarker.Color.b = Standard_ShortReal (aColor.Blue());
739 ContextMarker.MarkerType = aMarkerType;
740 ContextMarker.Scale = Standard_ShortReal (aScale);
741 ContextMarker.MarkerImage = theAspMarker->GetMarkerImage();
743 ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
745 UpdateAspectMarker (Standard_False);
747 ContextMarker.IsSet = 1;
752 // =======================================================================
753 // function : SetPrimitivesAspect
755 // =======================================================================
756 void Graphic3d_Group::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
763 Standard_CString aFont;
764 Standard_Real aSpace, anExpansion, aTextAngle;
765 Quantity_Color aColor, aColorSubTitle;
766 Aspect_TypeOfStyleText aStyle;
767 Aspect_TypeOfDisplayText aDisplayType;
768 Standard_Boolean aTextZoomable;
769 Font_FontAspect aTextFontAspect;
770 theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDisplayType,
771 aColorSubTitle, aTextZoomable, aTextAngle, aTextFontAspect);
773 ContextText.IsDef = 1;
774 ContextText.Color.r = float (aColor.Red());
775 ContextText.Color.g = float (aColor.Green());
776 ContextText.Color.b = float (aColor.Blue());
777 ContextText.Font = (char* )aFont;
778 ContextText.Expan = float (anExpansion);
779 ContextText.Space = float (aSpace);
780 ContextText.Style = aStyle;
781 ContextText.DisplayType = aDisplayType;
782 ContextText.ColorSubTitle.r = float (aColorSubTitle.Red());
783 ContextText.ColorSubTitle.g = float (aColorSubTitle.Green());
784 ContextText.ColorSubTitle.b = float (aColorSubTitle.Blue());
785 ContextText.TextZoomable = aTextZoomable;
786 ContextText.TextAngle = float (aTextAngle);
787 ContextText.TextFontAspect = aTextFontAspect;
788 ContextText.ShaderProgram = theAspText->ShaderProgram();
790 UpdateAspectText (Standard_False);
792 ContextText.IsSet = 1;
797 // =======================================================================
798 // function : IsGroupPrimitivesAspectSet
800 // =======================================================================
801 Standard_Boolean Graphic3d_Group::IsGroupPrimitivesAspectSet (const Graphic3d_GroupAspect theAspect) const
805 case Graphic3d_ASPECT_LINE: return ContextLine.IsSet;
806 case Graphic3d_ASPECT_TEXT: return ContextText.IsSet;
807 case Graphic3d_ASPECT_MARKER: return ContextMarker.IsSet;
808 case Graphic3d_ASPECT_FILL_AREA: return ContextFillArea.IsSet;
809 default: return Standard_False;
813 // =======================================================================
814 // function : GroupPrimitivesAspect
816 // =======================================================================
817 void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
818 const Handle(Graphic3d_AspectText3d)& theAspText,
819 const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
820 const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
822 Quantity_Color aColor;
823 Graphic3d_MaterialAspect aFront, aBack;
825 const CALL_DEF_CONTEXTLINE& anAspLine = ContextLine;
826 aColor.SetValues (Standard_Real (anAspLine.Color.r),
827 Standard_Real (anAspLine.Color.g),
828 Standard_Real (anAspLine.Color.b), Quantity_TOC_RGB);
829 theAspLine->SetColor (aColor);
830 theAspLine->SetType (Aspect_TypeOfLine (anAspLine.LineType));
831 theAspLine->SetWidth (Standard_Real (anAspLine.Width));
832 theAspLine->SetShaderProgram (anAspLine.ShaderProgram);
834 const CALL_DEF_CONTEXTTEXT& anAspText = ContextText;
835 aColor.SetValues (Standard_Real (anAspText.Color.r),
836 Standard_Real (anAspText.Color.g),
837 Standard_Real (anAspText.Color.b), Quantity_TOC_RGB);
838 theAspText->SetColor (aColor);
839 aColor.SetValues (Standard_Real (anAspText.ColorSubTitle.r),
840 Standard_Real (anAspText.ColorSubTitle.g),
841 Standard_Real (anAspText.ColorSubTitle.b), Quantity_TOC_RGB);
842 theAspText->SetColorSubTitle (aColor);
843 theAspText->SetFont (anAspText.Font);
844 theAspText->SetSpace (Standard_Real (anAspText.Space));
845 theAspText->SetExpansionFactor (Standard_Real (anAspText.Expan));
846 theAspText->SetStyle (Aspect_TypeOfStyleText (anAspText.Style));
847 theAspText->SetDisplayType (Aspect_TypeOfDisplayText (anAspText.DisplayType));
848 theAspText->SetShaderProgram (anAspText.ShaderProgram);
850 const CALL_DEF_CONTEXTMARKER& anAspMarker = ContextMarker;
851 aColor.SetValues (Standard_Real (anAspMarker.Color.r),
852 Standard_Real (anAspMarker.Color.g),
853 Standard_Real (anAspMarker.Color.b), Quantity_TOC_RGB);
854 theAspMarker->SetColor (aColor);
855 theAspMarker->SetType (anAspMarker.MarkerType);
856 theAspMarker->SetScale (Standard_Real (anAspMarker.Scale));
857 theAspMarker->SetShaderProgram (anAspMarker.ShaderProgram);
858 if (anAspMarker.MarkerType == Aspect_TOM_USERDEFINED)
860 theAspMarker->SetMarkerImage (ContextMarker.MarkerImage);
863 const CALL_DEF_CONTEXTFILLAREA& anAspFill = ContextFillArea;
865 theAspFill->SetInteriorStyle (Aspect_InteriorStyle (anAspFill.Style));
866 aColor.SetValues (Standard_Real (anAspFill.IntColor.r),
867 Standard_Real (anAspFill.IntColor.g),
868 Standard_Real (anAspFill.IntColor.b), Quantity_TOC_RGB);
869 theAspFill->SetInteriorColor (aColor);
872 aColor.SetValues (Standard_Real (anAspFill.EdgeColor.r),
873 Standard_Real (anAspFill.EdgeColor.g),
874 Standard_Real (anAspFill.EdgeColor.b), Quantity_TOC_RGB);
875 theAspFill->SetEdgeColor (aColor);
876 theAspFill->SetEdgeLineType (Aspect_TypeOfLine (anAspFill.LineType));
877 theAspFill->SetEdgeWidth (Standard_Real (anAspFill.Width));
880 aBack.SetShininess (Standard_Real (anAspFill.Back.Shininess));
881 aBack.SetAmbient (Standard_Real (anAspFill.Back.Ambient));
882 aBack.SetDiffuse (Standard_Real (anAspFill.Back.Diffuse));
883 aBack.SetSpecular (Standard_Real (anAspFill.Back.Specular));
884 aBack.SetTransparency (Standard_Real (anAspFill.Back.Transparency));
885 aBack.SetEmissive (Standard_Real (anAspFill.Back.Emission));
886 anAspFill.Back.IsAmbient == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aBack.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
887 anAspFill.Back.IsDiffuse == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aBack.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
888 anAspFill.Back.IsSpecular == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aBack.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
889 anAspFill.Back.IsEmission == 1 ? aBack.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aBack.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
891 aColor.SetValues (Standard_Real (anAspFill.Back.ColorSpec.r),
892 Standard_Real (anAspFill.Back.ColorSpec.g),
893 Standard_Real (anAspFill.Back.ColorSpec.b), Quantity_TOC_RGB);
894 aBack.SetSpecularColor (aColor);
896 aColor.SetValues (Standard_Real (anAspFill.Back.ColorAmb.r),
897 Standard_Real (anAspFill.Back.ColorAmb.g),
898 Standard_Real (anAspFill.Back.ColorAmb.b), Quantity_TOC_RGB);
899 aBack.SetAmbientColor (aColor);
901 aColor.SetValues (Standard_Real (anAspFill.Back.ColorDif.r),
902 Standard_Real (anAspFill.Back.ColorDif.g),
903 Standard_Real (anAspFill.Back.ColorDif.b), Quantity_TOC_RGB);
904 aBack.SetDiffuseColor (aColor);
906 aColor.SetValues (Standard_Real (anAspFill.Back.ColorEms.r),
907 Standard_Real (anAspFill.Back.ColorEms.g),
908 Standard_Real (anAspFill.Back.ColorEms.b), Quantity_TOC_RGB);
909 aBack.SetEmissiveColor (aColor);
911 aBack.SetEnvReflexion (anAspFill.Back.EnvReflexion);
913 aBack.SetRefractionIndex (Standard_Real (anAspFill.Back.RefractionIndex));
914 aBack.SetBSDF (anAspFill.Back.BSDF);
917 aFront.SetShininess (Standard_Real (anAspFill.Front.Shininess));
918 aFront.SetAmbient (Standard_Real (anAspFill.Front.Ambient));
919 aFront.SetDiffuse (Standard_Real (anAspFill.Front.Diffuse));
920 aFront.SetSpecular (Standard_Real (anAspFill.Front.Specular));
921 aFront.SetTransparency (Standard_Real (anAspFill.Front.Transparency));
922 aFront.SetEmissive (Standard_Real (anAspFill.Back.Emission));
923 anAspFill.Front.IsAmbient == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_AMBIENT) : aFront.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
924 anAspFill.Front.IsDiffuse == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE) : aFront.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
925 anAspFill.Front.IsSpecular == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_SPECULAR) : aFront.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
926 anAspFill.Front.IsEmission == 1 ? aFront.SetReflectionModeOn (Graphic3d_TOR_EMISSION) : aFront.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
928 aColor.SetValues (Standard_Real (anAspFill.Front.ColorSpec.r),
929 Standard_Real (anAspFill.Front.ColorSpec.g),
930 Standard_Real (anAspFill.Front.ColorSpec.b), Quantity_TOC_RGB);
931 aFront.SetSpecularColor (aColor);
933 aColor.SetValues (Standard_Real (anAspFill.Front.ColorAmb.r),
934 Standard_Real (anAspFill.Front.ColorAmb.g),
935 Standard_Real (anAspFill.Front.ColorAmb.b), Quantity_TOC_RGB);
936 aFront.SetAmbientColor (aColor);
938 aColor.SetValues (Standard_Real (anAspFill.Front.ColorDif.r),
939 Standard_Real (anAspFill.Front.ColorDif.g),
940 Standard_Real (anAspFill.Front.ColorDif.b), Quantity_TOC_RGB);
941 aFront.SetDiffuseColor (aColor);
943 aColor.SetValues (Standard_Real (anAspFill.Front.ColorEms.r),
944 Standard_Real (anAspFill.Front.ColorEms.g),
945 Standard_Real (anAspFill.Front.ColorEms.b), Quantity_TOC_RGB);
946 aFront.SetEmissiveColor (aColor);
948 aFront.SetEnvReflexion (anAspFill.Front.EnvReflexion);
950 aFront.SetRefractionIndex (Standard_Real (anAspFill.Front.RefractionIndex));
951 aFront.SetBSDF (anAspFill.Front.BSDF);
954 anAspFill.Edge == 1 ? theAspFill->SetEdgeOn() : theAspFill->SetEdgeOff();
956 theAspFill->SetHatchStyle (Aspect_HatchStyle (anAspFill.Hatch));
958 // Front and Back face
959 anAspFill.Distinguish == 1 ? theAspFill->SetDistinguishOn() : theAspFill->SetDistinguishOff();
960 anAspFill.BackFace == 1 ? theAspFill->SuppressBackFace() : theAspFill->AllowBackFace();
962 theAspFill->SetTextureMap (anAspFill.Texture.TextureMap);
963 anAspFill.Texture.doTextureMap == 1 ? theAspFill->SetTextureMapOn() : theAspFill->SetTextureMapOff();
964 theAspFill->SetShaderProgram (anAspFill.ShaderProgram);
965 theAspFill->SetPolygonOffsets (anAspFill.PolygonOffsetMode,
966 anAspFill.PolygonOffsetFactor,
967 anAspFill.PolygonOffsetUnits);
968 theAspFill->SetBackMaterial (aBack);
969 theAspFill->SetFrontMaterial (aFront);
972 // =======================================================================
973 // function : PrimitivesAspect
975 // =======================================================================
976 void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine,
977 const Handle(Graphic3d_AspectText3d)& theAspText,
978 const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
979 const Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
981 GroupPrimitivesAspect (theAspLine, theAspText, theAspMarker, theAspFill);
984 // =======================================================================
985 // function : AddPrimitiveArray
987 // =======================================================================
988 void Graphic3d_Group::AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim,
989 const Standard_Boolean theToEvalMinMax)
992 || !thePrim->IsValid())
997 AddPrimitiveArray (thePrim->Type(), thePrim->Indices(), thePrim->Attributes(), thePrim->Bounds(), theToEvalMinMax);
1000 // =======================================================================
1001 // function : AddPrimitiveArray
1003 // =======================================================================
1004 void Graphic3d_Group::AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
1005 const Handle(Graphic3d_IndexBuffer)& ,
1006 const Handle(Graphic3d_Buffer)& theAttribs,
1007 const Handle(Graphic3d_BoundBuffer)& ,
1008 const Standard_Boolean theToEvalMinMax)
1011 || theAttribs.IsNull())
1016 if (!MyContainsFacet
1017 && theType != Graphic3d_TOPA_POLYLINES
1018 && theType != Graphic3d_TOPA_SEGMENTS
1019 && theType != Graphic3d_TOPA_POINTS)
1021 myStructure->GroupsWithFacet (1);
1022 MyContainsFacet = Standard_True;
1025 if (theToEvalMinMax)
1027 const Standard_Integer aNbVerts = theAttribs->NbElements;
1028 for (Standard_Integer anAttribIter = 0; anAttribIter < theAttribs->NbAttributes; ++anAttribIter)
1030 const Graphic3d_Attribute& anAttrib = theAttribs->Attribute (anAttribIter);
1031 if (anAttrib.Id != Graphic3d_TOA_POS)
1036 const size_t anOffset = theAttribs->AttributeOffset (anAttribIter);
1037 switch (anAttrib.DataType)
1039 case Graphic3d_TOD_VEC2:
1041 for (Standard_Integer aVertIter = 0; aVertIter < aNbVerts; ++aVertIter)
1043 const Graphic3d_Vec2& aVert = *reinterpret_cast<const Graphic3d_Vec2* >(theAttribs->value (aVertIter) + anOffset);
1044 myBounds.Add (Graphic3d_Vec4 (aVert.x(), aVert.y(), 0.0f, 1.0f));
1048 case Graphic3d_TOD_VEC3:
1049 case Graphic3d_TOD_VEC4:
1051 for (Standard_Integer aVertIter = 0; aVertIter < aNbVerts; ++aVertIter)
1053 const Graphic3d_Vec3& aVert = *reinterpret_cast<const Graphic3d_Vec3* >(theAttribs->value (aVertIter) + anOffset);
1054 myBounds.Add (Graphic3d_Vec4 (aVert.x(), aVert.y(), aVert.z(), 1.0f));
1067 // =======================================================================
1068 // function : Marker
1070 // =======================================================================
1071 void Graphic3d_Group::Marker (const Graphic3d_Vertex& thePoint,
1072 const Standard_Boolean theToEvalMinMax)
1074 Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (1);
1075 aPoints->AddVertex (thePoint.X(), thePoint.Y(), thePoint.Z());
1076 AddPrimitiveArray (aPoints, theToEvalMinMax);
1079 // =======================================================================
1082 // =======================================================================
1083 void Graphic3d_Group::Text (const Standard_CString /*theText*/,
1084 const Graphic3d_Vertex& thePoint,
1085 const Standard_Real /*theHeight*/,
1086 const Quantity_PlaneAngle /*theAngle*/,
1087 const Graphic3d_TextPath /*theTp*/,
1088 const Graphic3d_HorizontalTextAlignment /*theHta*/,
1089 const Graphic3d_VerticalTextAlignment /*theVta*/,
1090 const Standard_Boolean theToEvalMinMax)
1097 if (theToEvalMinMax)
1099 Standard_ShortReal x, y, z;
1100 thePoint.Coord (x, y, z);
1101 myStructure->CStructure()->Is2dText = Standard_True;
1102 myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (x),
1103 static_cast<Standard_ShortReal> (y),
1104 static_cast<Standard_ShortReal> (z),
1110 // =======================================================================
1113 // =======================================================================
1114 void Graphic3d_Group::Text (const Standard_CString theText,
1115 const Graphic3d_Vertex& thePoint,
1116 const Standard_Real theHeight,
1117 const Standard_Boolean theToEvalMinMax)
1119 Text (theText, thePoint, theHeight, 0.0,
1120 Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
1123 // =======================================================================
1126 // =======================================================================
1127 void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
1128 const Graphic3d_Vertex& thePoint,
1129 const Standard_Real theHeight,
1130 const Quantity_PlaneAngle theAngle,
1131 const Graphic3d_TextPath theTp,
1132 const Graphic3d_HorizontalTextAlignment theHta,
1133 const Graphic3d_VerticalTextAlignment theVta,
1134 const Standard_Boolean theToEvalMinMax)
1136 const NCollection_String aText ((Standard_Utf16Char* )theText.ToExtString());
1137 Text (aText.ToCString(), thePoint, theHeight, theAngle,
1138 theTp, theHta, theVta, theToEvalMinMax);
1141 // =======================================================================
1144 // =======================================================================
1145 void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
1146 const gp_Ax2& theOrientation,
1147 const Standard_Real theHeight,
1148 const Quantity_PlaneAngle theAngle,
1149 const Graphic3d_TextPath theTP,
1150 const Graphic3d_HorizontalTextAlignment theHTA,
1151 const Graphic3d_VerticalTextAlignment theVTA,
1152 const Standard_Boolean theToEvalMinMax,
1153 const Standard_Boolean theHasOwnAnchor)
1155 const NCollection_String aText ((Standard_Utf16Char*)(theText.ToExtString()));
1156 Text (aText.ToCString(),
1167 // =======================================================================
1170 // =======================================================================
1171 void Graphic3d_Group::Text (const Standard_CString /*theText*/,
1172 const gp_Ax2& theOrientation,
1173 const Standard_Real /*theHeight*/,
1174 const Quantity_PlaneAngle /*theAngle*/,
1175 const Graphic3d_TextPath /*theTp*/,
1176 const Graphic3d_HorizontalTextAlignment /*theHta*/,
1177 const Graphic3d_VerticalTextAlignment /*theVta*/,
1178 const Standard_Boolean theToEvalMinMax,
1179 const Standard_Boolean /*theHasOwnAnchor*/)
1186 if (theToEvalMinMax)
1188 myStructure->CStructure()->Is2dText = Standard_False;
1189 myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theOrientation.Location().X()),
1190 static_cast<Standard_ShortReal> (theOrientation.Location().Y()),
1191 static_cast<Standard_ShortReal> (theOrientation.Location().Z()),
1197 // =======================================================================
1200 // =======================================================================
1201 void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
1202 const Graphic3d_Vertex& thePoint,
1203 const Standard_Real theHeight,
1204 const Standard_Boolean theToEvalMinMax)
1206 const NCollection_String aText ((Standard_Utf16Char* )theText.ToExtString());
1207 Text (aText.ToCString(), thePoint, theHeight, 0.0,
1208 Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
1211 // =======================================================================
1212 // function : SetClosed
1214 // =======================================================================
1215 void Graphic3d_Group::SetClosed (const Standard_Boolean theIsClosed)
1217 myIsClosed = theIsClosed;
1220 // =======================================================================
1221 // function : IsClosed
1223 // =======================================================================
1224 Standard_Boolean Graphic3d_Group::IsClosed() const
1229 //=======================================================================
1230 //function : BoundingBox
1232 //=======================================================================
1233 const Graphic3d_BndBox4f& Graphic3d_Group::BoundingBox() const
1238 //=======================================================================
1239 //function : ChangeBoundingBox
1241 //=======================================================================
1242 Graphic3d_BndBox4f& Graphic3d_Group::ChangeBoundingBox()