0022971: TKOpenGl clean up obsolete functionality
[occt.git] / src / Graphic3d / Graphic3d_Group_7.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// 11/97 ; CAL : ajout polyline par 2 points
22
7fd59977 23
24//-Version
25
26//-Design Declaration des variables specifiques aux groupes
27// de primitives
28
29//-Warning Un groupe est defini dans une structure
30// Il s'agit de la plus petite entite editable
31
32//-References
33
34//-Language C++ 2.0
35
36//-Declarations
37
38// for the class
39#include <Graphic3d_Group.jxx>
40#include <Graphic3d_Group.pxx>
41
2bd4c032 42#include <Graphic3d_ArrayOfPolylines.hxx>
7fd59977 43#include <Graphic3d_VertexC.hxx>
2bd4c032 44#include <gp_Pnt.hxx>
45
46void Graphic3d_Group::Polyline (const Graphic3d_Array1OfVertex& theListVertex,
47 const Standard_Boolean theToEvalMinMax)
48{
49 if (IsDeleted())
50 {
51 return;
52 }
53
54 Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines (theListVertex.Length());
55
56 Standard_Real aX, aY, aZ;
57 Standard_Integer aVertLower = theListVertex.Lower();
58 Standard_Integer aVertUpper = theListVertex.Upper();
59 for (Standard_Integer aVertIter = aVertLower; aVertIter <= aVertUpper; ++aVertIter)
60 {
61 const Graphic3d_Vertex& aVert = theListVertex (aVertIter);
62 aVert.Coord (aX, aY, aZ);
63 aPrims->AddVertex (aX, aY, aZ);
64 }
65
66 AddPrimitiveArray (aPrims, theToEvalMinMax);
7fd59977 67}
68
2bd4c032 69void Graphic3d_Group::Polyline (const Graphic3d_Array1OfVertexC& theListVertex,
70 const Standard_Boolean theToEvalMinMax)
71{
72 if (IsDeleted())
73 {
74 return;
75 }
76
77 Handle(Graphic3d_ArrayOfPrimitives) aPrims
78 = new Graphic3d_ArrayOfPolylines (theListVertex.Length(), 0, 0, Standard_True); // color per vertex
79
80 Standard_Real aX, aY, aZ;
81 Standard_Integer aVertLower = theListVertex.Lower();
82 Standard_Integer aVertUpper = theListVertex.Upper();
83 for (Standard_Integer aVertIter = aVertLower; aVertIter <= aVertUpper; ++aVertIter)
84 {
85 const Graphic3d_VertexC& aVert = theListVertex (aVertIter);
86 aVert.Coord (aX, aY, aZ);
87 aPrims->AddVertex (gp_Pnt (aX, aY, aZ), aVert.Color());
88 }
89
90 AddPrimitiveArray (aPrims, theToEvalMinMax);
7fd59977 91}
92
2bd4c032 93void Graphic3d_Group::Polyline (const Graphic3d_Vertex& thePnt1,
94 const Graphic3d_Vertex& thePnt2,
95 const Standard_Boolean theToEvalMinMax)
96{
97 if (IsDeleted())
98 {
99 return;
100 }
7fd59977 101
2bd4c032 102 Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines (2);
7fd59977 103
2bd4c032 104 Standard_Real aX, aY, aZ;
105 thePnt1.Coord (aX, aY, aZ);
106 aPrims->AddVertex (aX, aY, aZ);
7fd59977 107
2bd4c032 108 thePnt2.Coord (aX, aY, aZ);
109 aPrims->AddVertex (aX, aY, aZ);
7fd59977 110
2bd4c032 111 AddPrimitiveArray (aPrims, theToEvalMinMax);
7fd59977 112}