0024288: Provide flipping text for AIS_Dimensions
[occt.git] / src / Graphic3d / Graphic3d_Group_13.cxx
CommitLineData
b311480e 1// Created on: 2000-06-16
2// Copyright (c) 2000-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19
20#include <Graphic3d_Group.jxx>
21#include <Graphic3d_Group.pxx>
22#include <gp_Pnt.hxx>
23
938d4544 24// =======================================================================
25// function : AddPrimitiveArray
26// purpose :
27// =======================================================================
28
7fd59977 29void Graphic3d_Group :: AddPrimitiveArray ( const Handle(Graphic3d_ArrayOfPrimitives)& elem,const Standard_Boolean EvalMinMax )
30{
31 if (IsDeleted () ) return;
32
33 if( !elem->IsValid() ) return;
34
35 if( !MyContainsFacet &&
36 (elem->Type() != Graphic3d_TOPA_POLYLINES) &&
37 (elem->Type() != Graphic3d_TOPA_SEGMENTS) &&
38 (elem->Type() != Graphic3d_TOPA_POINTS) ) {
39 MyStructure->GroupsWithFacet (+1);
40 MyContainsFacet = Standard_True;
41 }
42
43 MyIsEmpty = Standard_False;
44
45 MyListOfPArray.Append(elem);
46
47 // Min-Max Update
48 if (EvalMinMax) {
49 Standard_Real x,y,z;
50
51 for (int k=1; k<=elem->VertexNumber() ; k++) {
52 elem->Vertice(k,x,y,z);
53
54 if (x < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal(x);
55 if (y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal(y);
56 if (z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal(z);
57 if (x > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal(x);
58 if (y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal(y);
59 if (z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal(z);
60 }
61 }
62
63 MyGraphicDriver->PrimitiveArray(MyCGroup, elem->Array());
64
65 Update ();
66}
67
938d4544 68// =======================================================================
69// function : UserDraw
70// purpose :
71// =======================================================================
72
7fd59977 73void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
74 const Standard_Boolean EvalMinMax,
75 const Standard_Boolean ContainsFacet )
76{
77 if (IsDeleted ()) return;
78
7fd59977 79 // Without this modification, the group assumes the primitive contains
80 // no polygons and does not require the Z-buffer for display.
81 if (!MyContainsFacet && ContainsFacet) {
82 MyStructure->GroupsWithFacet (+1);
83 MyContainsFacet = Standard_True;
84 }
7fd59977 85
86 MyIsEmpty = Standard_False;
87
88 Graphic3d_CUserDraw AUserDraw;
89 AUserDraw.Data = AnObject;
90 AUserDraw.Bounds = ( EvalMinMax? &MyBounds : NULL );
91 MyGraphicDriver->UserDraw (MyCGroup, AUserDraw);
92
93 Update ();
94}
a6eb515f 95
938d4544 96// =======================================================================
97// function : SetFlippingOptions
98// purpose :
99// =======================================================================
100
101void Graphic3d_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
102 const gp_Ax2& theRefPlane)
103{
104 MyGraphicDriver->SetFlippingOptions (MyCGroup, theIsEnabled, theRefPlane);
105}
106
107// =======================================================================
108// function : SetStencilTestOptions
109// purpose :
110// =======================================================================
a6eb515f 111void Graphic3d_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
112{
113 MyGraphicDriver->SetStencilTestOptions (MyCGroup, theIsEnabled);
114}