Logo ROOT   6.21/01
Reference Guide
REveStraightLineSet.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2019, 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_REveStraightLineSet
13 #define ROOT_REveStraightLineSet
14 
15 #include "TNamed.h"
16 #include "TAttMarker.h"
17 #include "TAttLine.h"
18 #include "TAttBBox.h"
19 
20 #include "ROOT/REveElement.hxx"
23 #include "ROOT/REveTrans.hxx"
24 
25 class TRandom;
26 
27 namespace ROOT {
28 namespace Experimental {
29 
30 ///////////////////////////////////////////////////////////////////////////////
31 /// REveStraightLineSet
32 /// Set of straight lines with optional markers along the lines.
33 ///////////////////////////////////////////////////////////////////////////////
34 
36  public REveProjectable,
37  public TAttLine,
38  public TAttMarker,
39  public TAttBBox
40 {
41 private:
44 
45 public:
46  struct Line_t
47  {
51 
53  Float_t x2, Float_t y2, Float_t z2) : fId(-1)
54  {
55  fV1[0] = x1; fV1[1] = y1; fV1[2] = z1;
56  fV2[0] = x2; fV2[1] = y2; fV2[2] = z2;
57  }
58  };
59 
60  struct Marker_t
61  {
62  Float_t fV[3];
64 
65  Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id) : fLineId(line_id)
66  {
67  fV[0] = x; fV[1] = y; fV[2] = z;
68  }
69  };
70 
71 protected:
74 
75  Bool_t fOwnLinesIds; // Flag specifying if id-objects are owned by the line-set
76  Bool_t fOwnMarkersIds; // Flag specifying if id-objects are owned by the line-set
77 
80 
82 
83  Line_t *fLastLine{nullptr}; ///<!
84 
85 public:
86  REveStraightLineSet(const std::string &n="StraightLineSet", const std::string &t="");
87  virtual ~REveStraightLineSet() {}
88 
89  void SetLineColor(Color_t col) override { SetMainColor(col); }
90 
91  Line_t *AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
92  Line_t *AddLine(const REveVector& p1, const REveVector& p2);
93  Marker_t *AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1);
94  Marker_t *AddMarker(const REveVector& p, Int_t line_id=-1);
95  Marker_t *AddMarker(Int_t line_id, Float_t pos);
96 
97  void SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
98  void SetLine(int idx, const REveVector& p1, const REveVector& p2);
99 
102 
103  virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
104  virtual Bool_t GetRnrLines() { return fRnrLines; }
105  virtual Bool_t GetDepthTest() { return fDepthTest; }
106 
107  virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
108  virtual void SetRnrLines(Bool_t x) { fRnrLines = x; }
109  virtual void SetDepthTest(Bool_t x) { fDepthTest = x; }
110 
111  void CopyVizParams(const REveElement* el) override;
112  void WriteVizParams(std::ostream& out, const TString& var) override;
113 
114  TClass* ProjectedClass(const REveProjection* p) const override;
115 
116  Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
117  void BuildRenderData() override;
118 
119  void ComputeBBox() override;
120 };
121 
122 
123 ///////////////////////////////////////////////////////////////////////////////
124 /// REveStraightLineSetProjected
125 /// Projected copy of a REveStraightLineSet.
126 ///////////////////////////////////////////////////////////////////////////////
127 
129  public REveProjected
130 {
131 private:
134 
135 protected:
136  void SetDepthLocal(Float_t d) override;
137 
138 public:
141 
142  void SetProjection(REveProjectionManager* mng, REveProjectable* model) override;
143  void UpdateProjection() override;
144  REveElement* GetProjectedAsElement() override { return this; }
145 };
146 
147 } // namespace Experimental
148 } // namespace ROOT
149 
150 #endif
TClass * ProjectedClass(const REveProjection *p) const override
Return class of projected object.
void ComputeBBox() override
Compute bounding-box.
Returns the available number of logical cores.
Definition: StringConv.hxx:21
float Float_t
Definition: RtypesCore.h:53
void SetProjection(REveProjectionManager *mng, REveProjectable *model) override
Set projection manager and model object.
Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id)
void BuildRenderData() override
Crates 3D point array for rendering.
Basic string class.
Definition: TString.h:131
REveStraightLineSetProjected & operator=(const REveStraightLineSetProjected &)=delete
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
REveStraightLineSetProjected Projected copy of a REveStraightLineSet.
Marker Attributes class.
Definition: TAttMarker.h:19
static const double x2[5]
Double_t x[n]
Definition: legend1.C:17
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
void SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2)
Set line vertices with given index.
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
short Marker_t
Definition: RtypesCore.h:77
REveProjection Base for specific classes that implement non-linear projections.
short Color_t
Definition: RtypesCore.h:79
Marker_t * AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1)
Add a marker with given position.
REveStraightLineSet(const REveStraightLineSet &)=delete
virtual void SetMainColor(Color_t color)
Set main color of the element.
REveProjectionManager Manager class for steering of projections and managing projected objects...
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
Line_t(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2)
REveStraightLineSet & operator=(const REveStraightLineSet &)=delete
REveStraightLineSet Set of straight lines with optional markers along the lines.
#define d(i)
Definition: RSha256.hxx:102
static const double x1[5]
Double_t y[n]
Definition: legend1.C:17
void SetLineColor(Color_t col) override
Set the line color.
void UpdateProjection() override
Callback that actually performs the projection.
Line_t * AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2)
Add a line.
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
Helper for management of bounding-box information.
Definition: TAttBBox.h:17
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
const Int_t n
Definition: legend1.C:16
Line Attributes class.
Definition: TAttLine.h:18