0023634: Eliminate Polyline and Polygon usage in drawers
[occt.git] / src / Graphic3d / Graphic3d_Group_3.cxx
CommitLineData
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
b8ddfc2f 43void Graphic3d_Group::Marker (const Graphic3d_Vertex &APoint, const Standard_Boolean EvalMinMax)
44{
7fd59977 45 if (IsDeleted ()) return;
46
47 MyIsEmpty = Standard_False;
48
49 // Min-Max Update
50 if (EvalMinMax) {
b8ddfc2f 51 Standard_ShortReal X, Y, Z;
7fd59977 52 APoint.Coord (X, Y, Z);
b8ddfc2f 53 if (X < MyBounds.XMin) MyBounds.XMin = X;
54 if (Y < MyBounds.YMin) MyBounds.YMin = Y;
55 if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
56 if (X > MyBounds.XMax) MyBounds.XMax = X;
57 if (Y > MyBounds.YMax) MyBounds.YMax = Y;
58 if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
7fd59977 59 }
60
b8ddfc2f 61 MyGraphicDriver->Marker (MyCGroup, APoint);
7fd59977 62
63 Update ();
7fd59977 64}
65
b8ddfc2f 66void Graphic3d_Group::MarkerSet (const Graphic3d_Array1OfVertex &ListVertex, const Standard_Boolean EvalMinMax)
67{
7fd59977 68 if (IsDeleted ()) return;
69
70 MyIsEmpty = Standard_False;
71
7fd59977 72 // Min-Max Update
73 if (EvalMinMax) {
b8ddfc2f 74 Standard_ShortReal X, Y, Z;
75 Standard_Integer i = ListVertex.Lower ();
76 const Standard_Integer Upper = ListVertex.Upper ();
7fd59977 77 // Parcours des sommets
b8ddfc2f 78 for (; i<=Upper; i++) {
7fd59977 79 ListVertex (i).Coord (X, Y, Z);
b8ddfc2f 80 if (X < MyBounds.XMin) MyBounds.XMin = X;
81 if (Y < MyBounds.YMin) MyBounds.YMin = Y;
82 if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
83 if (X > MyBounds.XMax) MyBounds.XMax = X;
84 if (Y > MyBounds.YMax) MyBounds.YMax = Y;
85 if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
7fd59977 86 }
87 }
88
b8ddfc2f 89 MyGraphicDriver->MarkerSet (MyCGroup, ListVertex);
7fd59977 90
91 Update ();
7fd59977 92}