File indexing completed on 2025-01-18 10:10:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_REveStraightLineSet
0013 #define ROOT_REveStraightLineSet
0014
0015 #include "TNamed.h"
0016 #include "TAttMarker.h"
0017 #include "TAttLine.h"
0018 #include "TAttBBox.h"
0019
0020 #include "ROOT/REveElement.hxx"
0021 #include "ROOT/REveProjectionBases.hxx"
0022 #include "ROOT/REveChunkManager.hxx"
0023 #include "ROOT/REveTrans.hxx"
0024 #include "ROOT/REveSecondarySelectable.hxx"
0025
0026 class TRandom;
0027
0028 namespace ROOT {
0029 namespace Experimental {
0030
0031
0032
0033
0034
0035
0036 class REveStraightLineSet : public REveElement,
0037 public REveProjectable,
0038 public TAttLine,
0039 public TAttMarker,
0040 public TAttBBox,
0041 public REveSecondarySelectable
0042 {
0043 private:
0044 REveStraightLineSet(const REveStraightLineSet&) = delete;
0045 REveStraightLineSet& operator=(const REveStraightLineSet&) = delete;
0046
0047 public:
0048 struct Line_t
0049 {
0050 Int_t fId;
0051 Float_t fV1[3];
0052 Float_t fV2[3];
0053
0054 Line_t(Float_t x1, Float_t y1, Float_t z1,
0055 Float_t x2, Float_t y2, Float_t z2) : fId(-1)
0056 {
0057 fV1[0] = x1; fV1[1] = y1; fV1[2] = z1;
0058 fV2[0] = x2; fV2[1] = y2; fV2[2] = z2;
0059 }
0060 };
0061
0062 struct Marker_t
0063 {
0064 Float_t fV[3];
0065 Int_t fLineId;
0066
0067 Marker_t(Float_t x, Float_t y, Float_t z, Int_t line_id) : fLineId(line_id)
0068 {
0069 fV[0] = x; fV[1] = y; fV[2] = z;
0070 }
0071 };
0072
0073 protected:
0074 REveChunkManager fLinePlex;
0075 REveChunkManager fMarkerPlex;
0076
0077 Bool_t fOwnLinesIds;
0078 Bool_t fOwnMarkersIds;
0079
0080 Bool_t fRnrMarkers;
0081 Bool_t fRnrLines;
0082
0083 Bool_t fDepthTest;
0084
0085 Line_t *fLastLine{nullptr};
0086
0087 public:
0088 REveStraightLineSet(const std::string &n="StraightLineSet", const std::string &t="");
0089 ~REveStraightLineSet() override {}
0090
0091 void SetLineColor(Color_t col) override { SetMainColor(col); }
0092
0093 Line_t *AddLine(Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
0094 Line_t *AddLine(const REveVector& p1, const REveVector& p2);
0095 Marker_t *AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id=-1);
0096 Marker_t *AddMarker(const REveVector& p, Int_t line_id=-1);
0097 Marker_t *AddMarker(Int_t line_id, Float_t pos);
0098
0099 void SetLine(int idx, Float_t x1, Float_t y1, Float_t z1, Float_t x2, Float_t y2, Float_t z2);
0100 void SetLine(int idx, const REveVector& p1, const REveVector& p2);
0101
0102 REveChunkManager &GetLinePlex() { return fLinePlex; }
0103 REveChunkManager &GetMarkerPlex() { return fMarkerPlex; }
0104
0105 virtual Bool_t GetRnrMarkers() { return fRnrMarkers; }
0106 virtual Bool_t GetRnrLines() { return fRnrLines; }
0107 virtual Bool_t GetDepthTest() { return fDepthTest; }
0108
0109 virtual void SetRnrMarkers(Bool_t x) { fRnrMarkers = x; }
0110 virtual void SetRnrLines(Bool_t x) { fRnrLines = x; }
0111 virtual void SetDepthTest(Bool_t x) { fDepthTest = x; }
0112
0113 void CopyVizParams(const REveElement* el) override;
0114 void WriteVizParams(std::ostream& out, const TString& var) override;
0115
0116 TClass* ProjectedClass(const REveProjection* p) const override;
0117
0118 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0119 void BuildRenderData() override;
0120
0121 void ComputeBBox() override;
0122 };
0123
0124
0125
0126
0127
0128
0129
0130 class REveStraightLineSetProjected : public REveStraightLineSet,
0131 public REveProjected
0132 {
0133 private:
0134 REveStraightLineSetProjected(const REveStraightLineSetProjected&) = delete;
0135 REveStraightLineSetProjected& operator=(const REveStraightLineSetProjected&) = delete;
0136
0137 protected:
0138 void SetDepthLocal(Float_t d) override;
0139
0140 public:
0141 REveStraightLineSetProjected();
0142 ~REveStraightLineSetProjected() override {}
0143
0144 void SetProjection(REveProjectionManager* mng, REveProjectable* model) override;
0145 void UpdateProjection() override;
0146 REveElement* GetProjectedAsElement() override { return this; }
0147 };
0148
0149 }
0150 }
0151
0152 #endif