Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REvePointSet.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 ROOT7_REvePointSet
13#define ROOT7_REvePointSet
14
15#include <ROOT/REveElement.hxx>
17#include <ROOT/REveVector.hxx>
19
20#include <TAttMarker.h>
21#include <TAttBBox.h>
22
23#include <cassert>
24
25namespace ROOT {
26namespace Experimental {
27
28////////////////////////////////////////////////////////////////////////////////
29// REvePointSet
30// Set of 3D points with same marker attributes;
31// optionally each point can be assigned an
32// external TRef or a number of integer indices.
33////////////////////////////////////////////////////////////////////////////////
34
36 public REveProjectable,
37 public TAttMarker,
38 public TAttBBox,
40{
41 friend class REvePointSetArray;
42
43private:
45
46protected:
47 std::vector<REveVector> fPoints;
48 int fCapacity{0};
49 int fSize{0};
50 int fTexX{0}, fTexY{0};
51
52public:
53 REvePointSet(const std::string& name="", const std::string& title="", Int_t n_points = 0);
55 ~REvePointSet() override;
56
57 REvePointSet *CloneElement() const override { return new REvePointSet(*this); }
58
59 virtual void ClonePoints(const REvePointSet &e);
60
61 void Reset(Int_t n_points = 0);
62 Int_t GrowFor(Int_t n_points);
63
64 int SetNextPoint(float x, float y, float z);
65 int SetPoint(int n, float x, float y, float z);
66
67 int GetCapacity() const { return fCapacity; }
68 int GetSize() const { return fSize; }
69
70 REveVector& RefPoint(int n) { assert (n < fSize); return fPoints[n]; }
71 const REveVector& RefPoint(int n) const { assert (n < fSize); return fPoints[n]; }
72
73 void SetMarkerColor(Color_t col) override { SetMainColor(col); }
74 void SetMarkerStyle(Style_t mstyle = 1) override;
75 void SetMarkerSize(Size_t msize = 1) override;
76
77 void CopyVizParams(const REveElement *el) override;
78 void WriteVizParams(std::ostream &out, const TString &var) override;
79
80 TClass* ProjectedClass(const REveProjection *p) const override;
81
82 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
83 void BuildRenderData()override;
84
85 void ComputeBBox() override;
86
87 void PointSelected(Int_t id); // *SIGNAL*
88};
89
90/******************************************************************************/
91// REvePointSetArray
92// Array of REvePointSet's filled via a common point-source; range of displayed REvePointSet's can be
93// controlled, based on a separating quantity provided on fill-time by a user.
94/******************************************************************************/
95
97 public REveProjectable,
98 public TAttMarker
99{
102
103protected:
104 REvePointSet **fBins{nullptr}; // Pointers to subjugated REvePointSet's.
105 Int_t fDefPointSetCapacity; // Default capacity of subjugated REvePointSet's.
106 Int_t fNBins; // Number of subjugated REvePointSet's.
107 Int_t fLastBin; //! Index of the last filled REvePointSet.
108 Double_t fMin, fCurMin; // Overall and current minimum value of the separating quantity.
109 Double_t fMax, fCurMax; // Overall and current maximum value of the separating quantity.
110 Double_t fBinWidth; // Separating quantity bin-width.
111 std::string fQuantName; // Name of the separating quantity.
112
113public:
114 REvePointSetArray(const std::string &name = "REvePointSetArray", const std::string &title = "");
115 ~REvePointSetArray() override;
116
117 void RemoveElementLocal(REveElement *el) override;
118 void RemoveElementsLocal() override;
119
120 void SetMarkerColor(Color_t tcolor = 1) override;
121 void SetMarkerStyle(Style_t mstyle = 1) override;
122 void SetMarkerSize(Size_t msize = 1) override;
123
124 Int_t Size(Bool_t under = kFALSE, Bool_t over = kFALSE) const;
125
126 void InitBins(const std::string& quant_name, Int_t nbins, Double_t min, Double_t max);
128 void CloseBins();
129
132
133 Int_t GetNBins() const { return fNBins; }
134 REvePointSet *GetBin(Int_t bin) const { return fBins[bin]; }
135
136 Double_t GetMin() const { return fMin; }
137 Double_t GetCurMin() const { return fCurMin; }
138 Double_t GetMax() const { return fMax; }
139 Double_t GetCurMax() const { return fCurMax; }
140
141 void SetRange(Double_t min, Double_t max);
142};
143
144/******************************************************************************/
145// REvePointSetProjected
146// Projected copy of a REvePointSet.
147/******************************************************************************/
148
150 public REveProjected
151{
152private:
155
156protected:
157 void SetDepthLocal(Float_t d) override;
158
159public:
162
163 void SetProjection(REveProjectionManager *proj, REveProjectable *model) override;
164 void UpdateProjection() override;
165 REveElement *GetProjectedAsElement() override { return this; }
166
167 void PointSelected(Int_t id);
168};
169
170} // namespace Experimental
171} // namespace ROOT
172
173#endif
#define d(i)
Definition RSha256.hxx:102
#define c(i)
Definition RSha256.hxx:101
#define e(i)
Definition RSha256.hxx:103
short Style_t
Definition RtypesCore.h:82
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:85
float Size_t
Definition RtypesCore.h:89
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetMarkerStyle
char name[80]
Definition TGX11.cxx:110
REvePointSet is a render-element holding a collection of 3D points with optional per-point TRef and a...
virtual void SetMainColor(Color_t color)
Set main color of the element.
Double_t fMin
Index of the last filled REvePointSet.
void CloseBins()
Call this after all the points have been filled.
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to children.
REvePointSetArray(const REvePointSetArray &)=delete
void SetMarkerColor(Color_t tcolor=1) override
Set marker color, propagate to children.
void RemoveElementsLocal() override
Virtual from REveElement, provide bin management.
void InitBins(const std::string &quant_name, Int_t nbins, Double_t min, Double_t max)
Initialize internal point-sets with given binning parameters.
Bool_t Fill(Double_t x, Double_t y, Double_t z, Double_t quant)
Add a new point.
~REvePointSetArray() override
Destructor: deletes the fBins array.
REvePointSet * GetBin(Int_t bin) const
void SetRange(Double_t min, Double_t max)
Set active range of the separating quantity.
void RemoveElementLocal(REveElement *el) override
Virtual from REveElement, provide bin management.
Int_t Size(Bool_t under=kFALSE, Bool_t over=kFALSE) const
Get the total number of filled points.
REvePointSetArray & operator=(const REvePointSetArray &)=delete
void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
REvePointSetProjected & operator=(const REvePointSetProjected &)=delete
void SetProjection(REveProjectionManager *proj, REveProjectable *model) override
Set projection manager and projection model.
REvePointSetProjected(const REvePointSetProjected &)=delete
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
void UpdateProjection() override
Re-apply the projection.
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
void PointSelected(Int_t id)
Virtual method of base class TPointSet3D.
virtual void ClonePoints(const REvePointSet &e)
Clone points and all point-related information from point-set 'e'.
REvePointSet * CloneElement() const override
Clone the element via copy constructor.
void WriteVizParams(std::ostream &out, const TString &var) override
Write visualization parameters.
~REvePointSet() override
Destructor.
void SetMarkerColor(Color_t col) override
Set the marker color.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Write core json.
void ComputeBBox() override
Compute bounding box.
void SetMarkerSize(Size_t msize=1) override
Set marker size, propagate to projecteds.
void CopyVizParams(const REveElement *el) override
Copy visualization parameters from element el.
const REveVector & RefPoint(int n) const
std::vector< REveVector > fPoints
int SetPoint(int n, float x, float y, float z)
int SetNextPoint(float x, float y, float z)
void Reset(Int_t n_points=0)
Drop all data and set-up the data structures to recive new data.
REvePointSet & operator=(const REvePointSet &)=delete
void BuildRenderData() override
Crates 3D point array for rendering.
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REvePointSetProjected class.
Int_t GrowFor(Int_t n_points)
Resizes internal array to allow additional n_points to be stored.
REveProjectionManager Manager class for steering of projections and managing projected objects.
REveProjection Base for specific classes that implement non-linear projections.
Helper for management of bounding-box information.
Definition TAttBBox.h:18
Marker Attributes class.
Definition TAttMarker.h:19
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Basic string class.
Definition TString.h:139
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...