3 #include "StraightLineSet.h"
6 #include <TBuffer3DTypes.h>
7 #include <TVirtualPad.h>
8 #include <TVirtualViewer3D.h>
11 #include <Reve/NLTProjector.h>
15 //______________________________________________________________________
19 ClassImp(StraightLineSet)
21 StraightLineSet::StraightLineSet(const Text_t* n, const Text_t* t):
25 fLinePlex (sizeof(Line), 4),
26 fMarkerPlex (sizeof(Marker), 8),
27 fOwnLinesIds (kFALSE),
28 fOwnMarkersIds (kFALSE),
35 fMainColorPtr = &fLineColor;
41 /**************************************************************************/
43 void StraightLineSet::AddLine(Float_t x1, Float_t y1, Float_t z1,
44 Float_t x2, Float_t y2, Float_t z2)
46 fLastLine = new (fLinePlex.NewAtom()) Line(x1, y1, z1, x2, y2, z2);
49 /**************************************************************************/
51 void StraightLineSet::AddMarker(Int_t line, Float_t pos)
53 /*Marker* marker = */new (fMarkerPlex.NewAtom()) Marker(line, pos);
56 /**************************************************************************/
58 void StraightLineSet::ComputeBBox()
60 static const Exc_t eH("StraightLineSet::ComputeBBox ");
61 if(fLinePlex.Size() == 0) {
68 VoidCPlex::iterator li(fLinePlex);
70 BBoxCheckPoint(((Line*)li())->fV1);
71 BBoxCheckPoint(((Line*)li())->fV2);
75 /**************************************************************************/
77 void StraightLineSet::Paint(Option_t* /*option*/)
79 static const Exc_t eH("StraightLineSet::Paint ");
81 TBuffer3D buff(TBuffer3DTypes::kGeneric);
85 buff.fColor = fLineColor;
86 buff.fTransparency = 0;
87 buff.fLocalFrame = kFALSE;
88 fHMTrans.SetBuffer3D(buff);
89 buff.SetSectionsValid(TBuffer3D::kCore);
91 Int_t reqSections = gPad->GetViewer3D()->AddObject(buff);
92 if (reqSections != TBuffer3D::kNone)
93 Error(eH, "only direct GL rendering supported.");
96 /**************************************************************************/
98 TClass* StraightLineSet::ProjectedClass() const
100 return NLTSLineSet::Class();
103 //______________________________________________________________________
107 ClassImp(NLTSLineSet)
109 NLTSLineSet::NLTSLineSet() : StraightLineSet(), NLTProjected ()
112 /**************************************************************************/
114 void NLTSLineSet::SetProjection(NLTProjector* proj, NLTProjectable* model)
116 NLTProjected::SetProjection(proj, model);
118 // copy line and marker attributes
119 * (TAttMarker*)this = * dynamic_cast<TAttMarker*>(fProjectable);
120 * (TAttLine*)this = * dynamic_cast<TAttLine*>(fProjectable);
122 /**************************************************************************/
124 void NLTSLineSet::UpdateProjection()
126 NLTProjection& proj = * fProjector->GetProjection();
127 StraightLineSet& orig = * dynamic_cast<StraightLineSet*>(fProjectable);
130 Int_t NL = orig.GetLinePlex().Size();
131 fLinePlex.Reset(sizeof(Line), NL);
135 VoidCPlex::iterator li(orig.GetLinePlex());
138 orig.RefHMTrans().GetScale(s1, s2, s3);
139 ZTrans mx; mx.Scale(s1, s2, s3);
141 orig.RefHMTrans().GetPos(x, y,z);
145 p1[0] = l->fV1[0]; p1[1] = l->fV1[1]; p1[2] = l->fV1[2];
146 p2[0] = l->fV2[0]; p2[1] = l->fV2[1]; p2[2] = l->fV2[2];
149 p1[0] += x; p1[1] += y; p1[2] += z;
150 p2[0] += x; p2[1] += y; p2[2] += z;
151 proj.ProjectPointFv(p1);
152 proj.ProjectPointFv(p2);
153 AddLine(p1[0], p1[1], p1[2], p2[0], p2[1], p2[2]);
157 Int_t NM = orig.GetMarkerPlex().Size();
158 fMarkerPlex.Reset(sizeof(Marker), NM);
160 VoidCPlex::iterator mi(orig.GetMarkerPlex());
164 AddMarker(m->fLineID, m->fPos);