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
22#include <cassert>
23
24namespace ROOT {
25namespace Experimental {
26
27////////////////////////////////////////////////////////////////////////////////
28// REvePointSet
29// Set of 3D points with same marker attributes;
30// optionally each point can be assigned an
31// external TRef or a number of integer indices.
32////////////////////////////////////////////////////////////////////////////////
33
35 friend class REvePointSetArray;
36
37private:
39
40protected:
41 std::vector<REveVector> fPoints;
42 int fCapacity{0};
43 int fSize{0};
44 int fTexX{0}, fTexY{0};
45
46public:
47 REvePointSet(const std::string& name="", const std::string& title="", Int_t n_points = 0);
49 ~REvePointSet() override;
50
51 REvePointSet *CloneElement() const override { return new REvePointSet(*this); }
52
53 virtual void ClonePoints(const REvePointSet &e);
54
55 void Reset(Int_t n_points = 0);
56 Int_t GrowFor(Int_t n_points);
57
58 int SetNextPoint(float x, float y, float z);
59 int SetPoint(int n, float x, float y, float z);
60
61 int GetCapacity() const { return fCapacity; }
62 int GetSize() const { return fSize; }
63
64 REveVector& RefPoint(int n) { assert (n < fSize); return fPoints[n]; }
65 const REveVector& RefPoint(int n) const { assert (n < fSize); return fPoints[n]; }
66
67 void SetMarkerColor(Color_t col) override { SetMainColor(col); }
68 void SetMarkerStyle(Style_t mstyle = 1) override;
69 void SetMarkerSize(Size_t msize = 1) override;
70
71 void CopyVizParams(const REveElement *el) override;
72 void WriteVizParams(std::ostream &out, const TString &var) override;
73
74 TClass* ProjectedClass(const REveProjection *p) const override;
75
76 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
77 void BuildRenderData()override;
78
79 void ComputeBBox() override;
80
81 void PointSelected(Int_t id); // *SIGNAL*
82};
83
84/******************************************************************************/
85// REvePointSetArray
86// Array of REvePointSet's filled via a common point-source; range of displayed REvePointSet's can be
87// controlled, based on a separating quantity provided on fill-time by a user.
88/******************************************************************************/
89
91 public REveProjectable,
92 public TAttMarker
93{
96
97protected:
98 REvePointSet **fBins{nullptr}; // Pointers to subjugated REvePointSet's.
99 Int_t fDefPointSetCapacity; // Default capacity of subjugated REvePointSet's.
100 Int_t fNBins; // Number of subjugated REvePointSet's.
101 Int_t fLastBin; ///<! Index of the last filled REvePointSet.
102 Double_t fMin, fCurMin; // Overall and current minimum value of the separating quantity.
103 Double_t fMax, fCurMax; // Overall and current maximum value of the separating quantity.
104 Double_t fBinWidth; // Separating quantity bin-width.
105 std::string fQuantName; // Name of the separating quantity.
106
107public:
108 REvePointSetArray(const std::string &name = "REvePointSetArray", const std::string &title = "");
109 ~REvePointSetArray() override;
110
111 void RemoveElementLocal(REveElement *el) override;
112 void RemoveElementsLocal() override;
113
114 void SetMarkerColor(Color_t tcolor = 1) override;
115 void SetMarkerStyle(Style_t mstyle = 1) override;
116 void SetMarkerSize(Size_t msize = 1) override;
117
118 Int_t Size(Bool_t under = kFALSE, Bool_t over = kFALSE) const;
119
120 void InitBins(const std::string& quant_name, Int_t nbins, Double_t min, Double_t max);
122 void CloseBins();
123
126
127 Int_t GetNBins() const { return fNBins; }
128 REvePointSet *GetBin(Int_t bin) const { return fBins[bin]; }
129
130 Double_t GetMin() const { return fMin; }
131 Double_t GetCurMin() const { return fCurMin; }
132 Double_t GetMax() const { return fMax; }
133 Double_t GetCurMax() const { return fCurMax; }
134
135 void SetRange(Double_t min, Double_t max);
136};
137
138/******************************************************************************/
139// REvePointSetProjected
140// Projected copy of a REvePointSet.
141/******************************************************************************/
142
144 public REveProjected
145{
146private:
149
150protected:
151 void SetDepthLocal(Float_t d) override;
152
153public:
156
157 void SetProjection(REveProjectionManager *proj, REveProjectable *model) override;
158 void UpdateProjection() override;
159 REveElement *GetProjectedAsElement() override { return this; }
160
161 void PointSelected(Int_t id);
162};
163
164} // namespace Experimental
165} // namespace ROOT
166
167#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
Style number (short)
Definition RtypesCore.h:97
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Size_t
Attribute size (float)
Definition RtypesCore.h:104
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetMarkerStyle
char name[80]
Definition TGX11.cxx:142
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.
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
Int_t fLastBin
! Index of the last filled REvePointSet.
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
REvePointSet(const std::string &name="", const std::string &title="", Int_t n_points=0)
Constructor.
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.
Marker Attributes class.
Definition TAttMarker.h:22
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
Basic string class.
Definition TString.h:137
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16