Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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 "TString.h"
26#include "TAttLine.h"
27#include "TAtt3D.h"
28
29class TList;
30
31
32class TPolyLine3D : public TObject, public TAttLine, public TAtt3D
33{
34protected:
35 Int_t fN{0}; ///< Number of points
36 Float_t *fP{nullptr}; ///< [3*fN] Array of 3-D coordinates (x,y,z)
37 TString fOption; ///< options
38 Int_t fLastPoint{-1}; ///< The index of the last filled point
39
40public:
43 TPolyLine3D(Int_t n, Float_t const* p, Option_t *option="");
44 TPolyLine3D(Int_t n, Double_t const* p, Option_t *option="");
45 TPolyLine3D(Int_t n, Float_t const* x, Float_t const* y, Float_t const* z, Option_t *option="");
46 TPolyLine3D(Int_t n, Double_t const* x, Double_t const* y, Double_t const* z, Option_t *option="");
47 TPolyLine3D(const TPolyLine3D &polylin);
49 ~TPolyLine3D() override;
50
51 void Copy(TObject &polyline) const override;
53 void Draw(Option_t *option="") override;
54 virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="");
55 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
56 Int_t GetLastPoint() const {return fLastPoint;}
57 Int_t GetN() const {return fN;}
58 Float_t *GetP() const {return fP;}
59 Option_t *GetOption() const override { return fOption.Data(); }
60 void ls(Option_t *option="") const override;
61 virtual Int_t Merge(TCollection *list);
62 void Paint(Option_t *option="") override;
63 void Print(Option_t *option="") const override;
64 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
65 virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z); // *MENU*
66 virtual void SetOption(Option_t *option="") {fOption = option;}
67 virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z); // *MENU*
68 virtual void SetPolyLine(Int_t n, Option_t *option="");
69 virtual void SetPolyLine(Int_t n, Float_t *p, Option_t *option="");
70 virtual void SetPolyLine(Int_t n, Double_t *p, Option_t *option="");
71 virtual Int_t Size() const { return fLastPoint+1;}
72
73 static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax);
74
75 ClassDefOverride(TPolyLine3D,1) //A 3-D polyline
76};
77
78#endif
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
TAtt3D()
Definition TAtt3D.h:22
Collection abstract base class.
Definition TCollection.h:65
A doubly linked list.
Definition TList.h:38
TObject()
TObject constructor.
Definition TObject.h:259
TPolyLine3D(Int_t n, Float_t const *x, Float_t const *y, Float_t const *z, Option_t *option="")
virtual Int_t Merge(TCollection *list)
TPolyLine3D & operator=(const TPolyLine3D &polylin)
Option_t * GetOption() const override
Definition TPolyLine3D.h:59
TPolyLine3D(const TPolyLine3D &polylin)
void Paint(Option_t *option="") override
This method must be overridden if a class wants to paint itself.
TPolyLine3D(Int_t n, Double_t const *p, Option_t *option="")
Int_t GetLastPoint() const
Definition TPolyLine3D.h:56
Int_t fLastPoint
The index of the last filled point.
Definition TPolyLine3D.h:38
Int_t fN
Number of points.
Definition TPolyLine3D.h:35
virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="")
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
~TPolyLine3D() override
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Float_t * GetP() const
Definition TPolyLine3D.h:58
Int_t GetN() const
Definition TPolyLine3D.h:57
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
virtual Int_t Size() const
Definition TPolyLine3D.h:71
TString fOption
options
Definition TPolyLine3D.h:37
void ls(Option_t *option="") const override
The ls function lists the contents of a class on stdout.
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual void SetOption(Option_t *option="")
Definition TPolyLine3D.h:66
void Copy(TObject &polyline) const override
Copy this to obj.
TPolyLine3D(Int_t n, Option_t *option="")
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax)
virtual void SetPolyLine(Int_t n, Option_t *option="")
virtual void SetPolyLine(Int_t n, Float_t *p, Option_t *option="")
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
TPolyLine3D(Int_t n, Float_t const *p, Option_t *option="")
Float_t * fP
[3*fN] Array of 3-D coordinates (x,y,z)
Definition TPolyLine3D.h:36
TPolyLine3D(Int_t n, Double_t const *x, Double_t const *y, Double_t const *z, Option_t *option="")
virtual void SetPolyLine(Int_t n, Double_t *p, Option_t *option="")
Basic string class.
Definition TString.h:138
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16