File indexing completed on 2025-12-15 10:29:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_TGeoPainter
0011 #define ROOT_TGeoPainter
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "TVirtualGeoPainter.h"
0023
0024 #include "TGeoManager.h"
0025
0026 class TString;
0027 class TGeoHMatrix;
0028 class TGeoNode;
0029 class TGeoVolume;
0030 class TGeoShape;
0031 class TVirtualGeoTrack;
0032 class TGeoPhysicalNode;
0033 class TGeoOverlap;
0034 class TGeoBatemanSol;
0035 class TGeoPolygon;
0036
0037 class TGeoPainter : public TVirtualGeoPainter {
0038 private:
0039 Double_t fBombX;
0040 Double_t fBombY;
0041 Double_t fBombZ;
0042 Double_t fBombR;
0043 Double_t fCheckedBox[6];
0044 Double_t fMat[9];
0045 Int_t fNsegments;
0046 Int_t fNVisNodes;
0047 Int_t fVisLevel;
0048 Int_t fVisOption;
0049 Int_t fExplodedView;
0050 Bool_t fVisLock;
0051 Bool_t fTopVisible;
0052 Bool_t fPaintingOverlaps;
0053 Bool_t fIsRaytracing;
0054 Bool_t fIsPaintingShape;
0055 TString fVisBranch;
0056 TString fVolInfo;
0057 TGeoNode *fCheckedNode;
0058 TGeoOverlap *fOverlap;
0059 TGeoHMatrix *fGlobal;
0060 TBuffer3D *fBuffer;
0061 TGeoManager *fGeoManager;
0062 TGeoShape *fClippingShape;
0063 TGeoVolume *fTopVolume;
0064 TGeoVolume *fLastVolume;
0065 TGeoIteratorPlugin *fPlugin;
0066 TObjArray *fVisVolumes;
0067 Bool_t fIsEditable;
0068
0069 void DefineColors() const;
0070 void LocalToMasterVect(const Double_t *local, Double_t *master) const;
0071
0072 protected:
0073 void ClearVisibleVolumes();
0074
0075 public:
0076 TGeoPainter(TGeoManager *manager);
0077 ~TGeoPainter() override;
0078
0079 void AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys) override;
0080 TVirtualGeoTrack *AddTrack(Int_t id, Int_t pdgcode, TObject *part) override;
0081 void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset = kFALSE) override;
0082 void BombTranslation(const Double_t *tr, Double_t *bombtr) override;
0083 void CheckEdit();
0084 Int_t CountNodes(TGeoVolume *vol, Int_t level) const;
0085 Int_t CountVisibleNodes() override;
0086 void DefaultAngles() override;
0087 void DefaultColors() override;
0088 Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py) override;
0089 void Draw(Option_t *option = "") override;
0090 void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option = "") override;
0091 void DrawOverlap(void *ovlp, Option_t *option = "") override;
0092 void DrawCurrentPoint(Int_t color) override;
0093 void DrawOnly(Option_t *option = "") override;
0094 void DrawPanel() override;
0095 void DrawPath(const char *path, Option_t *option = "") override;
0096 void DrawPolygon(const TGeoPolygon *poly) override;
0097 void DrawShape(TGeoShape *shape, Option_t *option = "") override;
0098 void DrawVolume(TGeoVolume *vol, Option_t *option = "") override;
0099 void EditGeometry(Option_t *option = "") override;
0100 void EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end) override;
0101 void ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py) override;
0102 void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py) override;
0103 void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py) override;
0104 const char *GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const override;
0105 void GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const override
0106 {
0107 bombx = fBombX;
0108 bomby = fBombY;
0109 bombz = fBombZ;
0110 bombr = fBombR;
0111 }
0112 Int_t GetBombMode() const override { return fExplodedView; }
0113 TGeoNode *GetCheckedNode() { return fCheckedNode; }
0114 Int_t GetColor(Int_t base, Float_t light) const override;
0115 const char *GetDrawPath() const override { return fVisBranch.Data(); }
0116 TGeoVolume *GetDrawnVolume() const override;
0117 TGeoVolume *GetTopVolume() const override { return fTopVolume; }
0118 Int_t GetVisLevel() const override { return fVisLevel; }
0119 Int_t GetVisOption() const override { return fVisOption; }
0120 Int_t GetNsegments() const override { return fNsegments; }
0121 void GrabFocus(Int_t nfr = 0, Double_t dlong = 0, Double_t dlat = 0, Double_t dpsi = 0) override;
0122 Double_t *GetViewBox() override { return &fCheckedBox[0]; }
0123 void GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi) override;
0124 Bool_t IsExplodedView() const override { return (fExplodedView == kGeoVisDefault) ? kFALSE : kTRUE; }
0125 Bool_t IsRaytracing() const override { return fIsRaytracing; }
0126 Bool_t IsPaintingShape() const override { return fIsPaintingShape; }
0127 void Lock(Bool_t flag = kTRUE) { fVisLock = flag; }
0128 void ModifiedPad(Bool_t update = kFALSE) const override;
0129 void Paint(Option_t *option = "") override;
0130 void PaintNode(TGeoNode *node, Option_t *option = "", TGeoMatrix *global = nullptr) override;
0131 Bool_t PaintShape(const TGeoShape &shape, Option_t *option) const;
0132 void PaintShape(TGeoShape *shape, Option_t *option = "") override;
0133 void PaintOverlap(void *ovlp, Option_t *option = "") override;
0134 void PaintVolume(TGeoVolume *vol, Option_t *option = "", TGeoMatrix *global = nullptr) override;
0135 void PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option = "");
0136 void Raytrace(Option_t *option = "") override;
0137 void SetBombFactors(Double_t bombx = 1.3, Double_t bomby = 1.3, Double_t bombz = 1.3, Double_t bombr = 1.3) override;
0138 void SetClippingShape(TGeoShape *shape) override { fClippingShape = shape; }
0139 void SetExplodedView(Int_t iopt = 0) override;
0140 void SetNsegments(Int_t nseg = 20) override;
0141 void SetGeoManager(TGeoManager *geom) override { fGeoManager = geom; }
0142 void SetIteratorPlugin(TGeoIteratorPlugin *plugin) override
0143 {
0144 fPlugin = plugin;
0145 ModifiedPad();
0146 }
0147 void SetRaytracing(Bool_t flag = kTRUE) override { fIsRaytracing = flag; }
0148 void SetTopVisible(Bool_t vis = kTRUE) override;
0149 void SetTopVolume(TGeoVolume *vol) override { fTopVolume = vol; }
0150 void SetVisLevel(Int_t level = 3) override;
0151 void SetVisOption(Int_t option = 0) override;
0152 Int_t ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const override;
0153 void UnbombTranslation(const Double_t *tr, Double_t *bombtr) override;
0154
0155 ClassDefOverride(TGeoPainter, 0)
0156 };
0157
0158 #endif