Logo ROOT  
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"
25
26class TRandom;
27
28namespace ROOT {
29namespace Experimental {
30
31///////////////////////////////////////////////////////////////////////////////
32/// REveStraightLineSet
33/// Set of straight lines with optional markers along the lines.
34///////////////////////////////////////////////////////////////////////////////
35
37 public REveProjectable,
38 public TAttLine,
39 public TAttMarker,
40 public TAttBBox,
42{
43private:
46
47public:
48 struct Line_t
49 {
53
55 Float_t x2, Float_t y2, Float_t z2) : fId(-1)
56 {
57 fV1[0] = x1; fV1[1] = y1; fV1[2] = z1;
58 fV2[0] = x2; fV2[1] = y2; fV2[2] = z2;
59 }
60 };
61
62 struct Marker_t
63 {
66
67 Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id) : fLineId(line_id)
68 {
69 fV[0] = x; fV[1] = y; fV[2] = z;
70 }
71 };
72
73protected:
76
77 Bool_t fOwnLinesIds; // Flag specifying if id-objects are owned by the line-set
78 Bool_t fOwnMarkersIds; // Flag specifying if id-objects are owned by the line-set
79
82
84
85 Line_t *fLastLine{nullptr}; ///<!
86
87public:
88 REveStraightLineSet(const std::string &n="StraightLineSet", const std::string &t="");
90
91 void SetLineColor(Color_t col) override { SetMainColor(col); }
92
93 Line_t *AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
94 Line_t *AddLine(const REveVector& p1, const REveVector& p2);
95 Marker_t *AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1);
96 Marker_t *AddMarker(const REveVector& p, Int_t line_id=-1);
97 Marker_t *AddMarker(Int_t line_id, Float_t pos);
98
99 void SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
100 void SetLine(int idx, const REveVector& p1, const REveVector& p2);
101
104
105 virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
106 virtual Bool_t GetRnrLines() { return fRnrLines; }
107 virtual Bool_t GetDepthTest() { return fDepthTest; }
108
109 virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
110 virtual void SetRnrLines(Bool_t x) { fRnrLines = x; }
111 virtual void SetDepthTest(Bool_t x) { fDepthTest = x; }
112
113 void CopyVizParams(const REveElement* el) override;
114 void WriteVizParams(std::ostream& out, const TString& var) override;
115
116 TClass* ProjectedClass(const REveProjection* p) const override;
117
118 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
119 void BuildRenderData() override;
120
121 void ComputeBBox() override;
122};
123
124
125///////////////////////////////////////////////////////////////////////////////
126/// REveStraightLineSetProjected
127/// Projected copy of a REveStraightLineSet.
128///////////////////////////////////////////////////////////////////////////////
129
131 public REveProjected
132{
133private:
136
137protected:
138 void SetDepthLocal(Float_t d) override;
139
140public:
143
144 void SetProjection(REveProjectionManager* mng, REveProjectable* model) override;
145 void UpdateProjection() override;
146 REveElement* GetProjectedAsElement() override { return this; }
147};
148
149} // namespace Experimental
150} // namespace ROOT
151
152#endif
#define d(i)
Definition: RSha256.hxx:102
static const double x2[5]
static const double x1[5]
int Int_t
Definition: RtypesCore.h:43
short Marker_t
Definition: RtypesCore.h:79
short Color_t
Definition: RtypesCore.h:81
float Float_t
Definition: RtypesCore.h:55
virtual void SetMainColor(Color_t color)
Set main color of the element.
REveProjectionManager Manager class for steering of projections and managing projected objects.
REveProjection Base for specific classes that implement non-linear projections.
REveStraightLineSetProjected Projected copy of a REveStraightLineSet.
REveStraightLineSetProjected(const REveStraightLineSetProjected &)=delete
void UpdateProjection() override
Callback that actually performs the projection.
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
void SetProjection(REveProjectionManager *mng, REveProjectable *model) override
Set projection manager and model object.
REveStraightLineSetProjected & operator=(const REveStraightLineSetProjected &)=delete
REveStraightLineSet Set of straight lines with optional markers along the lines.
Line_t * AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2)
Add a line.
Marker_t * AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1)
Add a marker with given position.
TClass * ProjectedClass(const REveProjection *p) const override
Return class of projected object.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void BuildRenderData() override
Crates 3D point array for rendering.
void ComputeBBox() override
Compute bounding-box.
REveStraightLineSet(const REveStraightLineSet &)=delete
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.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
REveStraightLineSet & operator=(const REveStraightLineSet &)=delete
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
void SetLineColor(Color_t col) override
Set the line color.
Helper for management of bounding-box information.
Definition: TAttBBox.h:18
Line Attributes class.
Definition: TAttLine.h:18
Marker Attributes class.
Definition: TAttMarker.h:19
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
Basic string class.
Definition: TString.h:131
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21
basic_json<> json
default JSON class
Definition: REveElement.hxx:88
Line_t(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2)
Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id)