Logo ROOT   6.16/01
Reference Guide
TPolyLine3D.h
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Nenad Buncic 17/08/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TPolyLine3D
13#define ROOT_TPolyLine3D
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TPolyLine3D //
19// //
20// A 3-D polyline. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TObject.h"
25#include "TList.h"
26#include "TString.h"
27#include "TAttLine.h"
28#include "TAtt3D.h"
29
30
31class TPolyLine3D : public TObject, public TAttLine, public TAtt3D
32{
33protected:
34 Int_t fN; ///< Number of points
35 Float_t *fP; ///< [3*fN] Array of 3-D coordinates (x,y,z)
36 TString fOption; ///< options
37 Int_t fLastPoint; ///< The index of the last filled point
38
39public:
41 TPolyLine3D(Int_t n, Option_t *option="");
42 TPolyLine3D(Int_t n, Float_t *p, Option_t *option="");
43 TPolyLine3D(Int_t n, Double_t *p, Option_t *option="");
44 TPolyLine3D(Int_t n, Float_t *x, Float_t *y, Float_t *z, Option_t *option="");
45 TPolyLine3D(Int_t n, Double_t *x, Double_t *y, Double_t *z, Option_t *option="");
46 TPolyLine3D(const TPolyLine3D &polylin);
47 TPolyLine3D& operator=(const TPolyLine3D &polylin);
48 virtual ~TPolyLine3D();
49
50 virtual void Copy(TObject &polyline) const;
51 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
52 virtual void Draw(Option_t *option="");
53 virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="");
54 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
55 Int_t GetLastPoint() const {return fLastPoint;}
56 Int_t GetN() const {return fN;}
57 Float_t *GetP() const {return fP;}
58 Option_t *GetOption() const {return fOption.Data();}
59 virtual void ls(Option_t *option="") const;
60 virtual Int_t Merge(TCollection *list);
61 virtual void Paint(Option_t *option="");
62 virtual void Print(Option_t *option="") const;
63 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
64 virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z); // *MENU*
65 virtual void SetOption(Option_t *option="") {fOption = option;}
66 virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z); // *MENU*
67 virtual void SetPolyLine(Int_t n, Option_t *option="");
68 virtual void SetPolyLine(Int_t n, Float_t *p, Option_t *option="");
69 virtual void SetPolyLine(Int_t n, Double_t *p, Option_t *option="");
70 virtual Int_t Size() const { return fLastPoint+1;}
71
72 static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax);
73
74 ClassDef(TPolyLine3D,1) //A 3-D polyline
75};
76
77#endif
int Int_t
Definition: RtypesCore.h:41
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:19
Line Attributes class.
Definition: TAttLine.h:18
Collection abstract base class.
Definition: TCollection.h:63
A doubly linked list.
Definition: TList.h:44
Mother of all ROOT objects.
Definition: TObject.h:37
A 3-dimensional polyline.
Definition: TPolyLine3D.h:32
TPolyLine3D & operator=(const TPolyLine3D &polylin)
assignment operator
TPolyLine3D()
3-D polyline default constructor.
Definition: TPolyLine3D.cxx:99
static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax)
Draw cube outline with 3d polylines.
virtual void Print(Option_t *option="") const
Dump this 3-D polyline with its attributes on stdout.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream.
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
Set point following LastPoint to x, y, z.
virtual ~TPolyLine3D()
3-D polyline destructor.
virtual Int_t Merge(TCollection *list)
Merge polylines in the collection in this polyline.
virtual void ls(Option_t *option="") const
List this 3-D polyline.
Int_t GetLastPoint() const
Definition: TPolyLine3D.h:55
Int_t fLastPoint
The index of the last filled point.
Definition: TPolyLine3D.h:37
Int_t fN
Number of points.
Definition: TPolyLine3D.h:34
virtual void Draw(Option_t *option="")
Draw this 3-D polyline with its current attributes.
virtual void Paint(Option_t *option="")
Paint a TPolyLine3D.
Float_t * GetP() const
Definition: TPolyLine3D.h:57
Int_t GetN() const
Definition: TPolyLine3D.h:56
virtual void Copy(TObject &polyline) const
Copy polyline to polyline obj.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual Int_t Size() const
Definition: TPolyLine3D.h:70
TString fOption
options
Definition: TPolyLine3D.h:36
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a 3-D polyline.
virtual void SetOption(Option_t *option="")
Definition: TPolyLine3D.h:65
virtual void SetPolyLine(Int_t n, Option_t *option="")
Re-initialize polyline with n points (0,0,0).
virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="")
Draw 3-D polyline with new coordinates.
Option_t * GetOption() const
Definition: TPolyLine3D.h:58
Float_t * fP
[3*fN] Array of 3-D coordinates (x,y,z)
Definition: TPolyLine3D.h:35
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16