File indexing completed on 2025-01-30 10:22:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT7_REvePointSet
0013 #define ROOT7_REvePointSet
0014
0015 #include <ROOT/REveElement.hxx>
0016 #include <ROOT/REveProjectionBases.hxx>
0017 #include <ROOT/REveVector.hxx>
0018 #include <ROOT/REveSecondarySelectable.hxx>
0019
0020 #include <TAttMarker.h>
0021 #include <TAttBBox.h>
0022
0023 #include <cassert>
0024
0025 namespace ROOT {
0026 namespace Experimental {
0027
0028
0029
0030
0031
0032
0033
0034
0035 class REvePointSet : public REveElement,
0036 public REveProjectable,
0037 public TAttMarker,
0038 public TAttBBox,
0039 public REveSecondarySelectable
0040 {
0041 friend class REvePointSetArray;
0042
0043 private:
0044 REvePointSet &operator=(const REvePointSet &) = delete;
0045
0046 protected:
0047 std::vector<REveVector> fPoints;
0048 int fCapacity{0};
0049 int fSize{0};
0050 int fTexX{0}, fTexY{0};
0051
0052 public:
0053 REvePointSet(const std::string& name="", const std::string& title="", Int_t n_points = 0);
0054 REvePointSet(const REvePointSet &e);
0055 ~REvePointSet() override;
0056
0057 REvePointSet *CloneElement() const override { return new REvePointSet(*this); }
0058
0059 virtual void ClonePoints(const REvePointSet &e);
0060
0061 void Reset(Int_t n_points = 0);
0062 Int_t GrowFor(Int_t n_points);
0063
0064 int SetNextPoint(float x, float y, float z);
0065 int SetPoint(int n, float x, float y, float z);
0066
0067 int GetCapacity() const { return fCapacity; }
0068 int GetSize() const { return fSize; }
0069
0070 REveVector& RefPoint(int n) { assert (n < fSize); return fPoints[n]; }
0071 const REveVector& RefPoint(int n) const { assert (n < fSize); return fPoints[n]; }
0072
0073 void SetMarkerColor(Color_t col) override { SetMainColor(col); }
0074 void SetMarkerStyle(Style_t mstyle = 1) override;
0075 void SetMarkerSize(Size_t msize = 1) override;
0076
0077 void CopyVizParams(const REveElement *el) override;
0078 void WriteVizParams(std::ostream &out, const TString &var) override;
0079
0080 TClass* ProjectedClass(const REveProjection *p) const override;
0081
0082 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0083 void BuildRenderData()override;
0084
0085 void ComputeBBox() override;
0086
0087 void PointSelected(Int_t id);
0088 };
0089
0090
0091
0092
0093
0094
0095
0096 class REvePointSetArray : public REveElement,
0097 public REveProjectable,
0098 public TAttMarker
0099 {
0100 REvePointSetArray(const REvePointSetArray &) = delete;
0101 REvePointSetArray &operator=(const REvePointSetArray &) = delete;
0102
0103 protected:
0104 REvePointSet **fBins{nullptr};
0105 Int_t fDefPointSetCapacity;
0106 Int_t fNBins;
0107 Int_t fLastBin;
0108 Double_t fMin, fCurMin;
0109 Double_t fMax, fCurMax;
0110 Double_t fBinWidth;
0111 std::string fQuantName;
0112
0113 public:
0114 REvePointSetArray(const std::string &name = "REvePointSetArray", const std::string &title = "");
0115 ~REvePointSetArray() override;
0116
0117 void RemoveElementLocal(REveElement *el) override;
0118 void RemoveElementsLocal() override;
0119
0120 void SetMarkerColor(Color_t tcolor = 1) override;
0121 void SetMarkerStyle(Style_t mstyle = 1) override;
0122 void SetMarkerSize(Size_t msize = 1) override;
0123
0124 Int_t Size(Bool_t under = kFALSE, Bool_t over = kFALSE) const;
0125
0126 void InitBins(const std::string& quant_name, Int_t nbins, Double_t min, Double_t max);
0127 Bool_t Fill(Double_t x, Double_t y, Double_t z, Double_t quant);
0128 void CloseBins();
0129
0130 Int_t GetDefPointSetCapacity() const { return fDefPointSetCapacity; }
0131 void SetDefPointSetCapacity(Int_t c) { fDefPointSetCapacity = c; }
0132
0133 Int_t GetNBins() const { return fNBins; }
0134 REvePointSet *GetBin(Int_t bin) const { return fBins[bin]; }
0135
0136 Double_t GetMin() const { return fMin; }
0137 Double_t GetCurMin() const { return fCurMin; }
0138 Double_t GetMax() const { return fMax; }
0139 Double_t GetCurMax() const { return fCurMax; }
0140
0141 void SetRange(Double_t min, Double_t max);
0142 };
0143
0144
0145
0146
0147
0148
0149 class REvePointSetProjected : public REvePointSet,
0150 public REveProjected
0151 {
0152 private:
0153 REvePointSetProjected(const REvePointSetProjected &) = delete;
0154 REvePointSetProjected &operator=(const REvePointSetProjected &) = delete;
0155
0156 protected:
0157 void SetDepthLocal(Float_t d) override;
0158
0159 public:
0160 REvePointSetProjected();
0161 ~REvePointSetProjected() override {}
0162
0163 void SetProjection(REveProjectionManager *proj, REveProjectable *model) override;
0164 void UpdateProjection() override;
0165 REveElement *GetProjectedAsElement() override { return this; }
0166
0167 void PointSelected(Int_t id);
0168 };
0169
0170 }
0171 }
0172
0173 #endif