b311480e |
1 | // Created by: NW,JPB,CAL |
2 | // Copyright (c) 1991-1999 Matra Datavision |
3 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
9 | // |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | // |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
7fd59977 |
21 | |
7fd59977 |
22 | |
23 | //-Version |
24 | |
25 | //-Design Declaration des variables specifiques aux groupes |
26 | // de primitives |
27 | |
28 | //-Warning Un groupe est defini dans une structure |
29 | // Il s'agit de la plus petite entite editable |
30 | |
31 | //-References |
32 | |
33 | //-Language C++ 2.0 |
34 | |
35 | //-Declarations |
36 | |
37 | // for the class |
38 | #include <Graphic3d_Group.jxx> |
39 | #include <Graphic3d_Group.pxx> |
40 | |
41 | //-Methods, in order |
42 | |
43 | void Graphic3d_Group::Marker (const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax) { |
44 | |
45 | if (IsDeleted ()) return; |
46 | |
47 | MyIsEmpty = Standard_False; |
48 | |
49 | // Min-Max Update |
50 | if (EvalMinMax) { |
51 | Standard_Real X, Y, Z; |
52 | APoint.Coord (X, Y, Z); |
53 | if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); |
54 | if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); |
55 | if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); |
56 | if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); |
57 | if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); |
58 | if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); |
59 | } |
60 | |
61 | MyGraphicDriver->Marker (MyCGroup, APoint, EvalMinMax); |
62 | |
63 | Update (); |
64 | |
65 | } |
66 | |
67 | void Graphic3d_Group::MarkerSet (const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax) { |
68 | |
69 | if (IsDeleted ()) return; |
70 | |
71 | MyIsEmpty = Standard_False; |
72 | |
73 | Standard_Integer i, j; |
74 | |
75 | i = ListVertex.Length (); |
76 | |
77 | // Min-Max Update |
78 | if (EvalMinMax) { |
79 | Standard_Real X, Y, Z; |
80 | Standard_Integer Lower = ListVertex.Lower (); |
81 | Standard_Integer Upper = ListVertex.Upper (); |
82 | // Parcours des sommets |
83 | for (j=0, i=Lower; i<=Upper; i++, j++) { |
84 | ListVertex (i).Coord (X, Y, Z); |
85 | if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); |
86 | if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); |
87 | if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); |
88 | if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); |
89 | if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); |
90 | if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); |
91 | } |
92 | } |
93 | |
94 | MyGraphicDriver->MarkerSet (MyCGroup, ListVertex, EvalMinMax); |
95 | |
96 | Update (); |
97 | |
98 | } |