#include "TEveStraightLineSet.h"
#include "TRandom.h"
#include "TEveProjectionManager.h"
ClassImp(TEveStraightLineSet);
TEveStraightLineSet::TEveStraightLineSet(const char* n, const char* t):
TEveElement (),
TNamed (n, t),
fLinePlex (sizeof(Line_t), 4),
fMarkerPlex (sizeof(Marker_t), 8),
fOwnLinesIds (kFALSE),
fOwnMarkersIds (kFALSE),
fRnrMarkers (kTRUE),
fRnrLines (kTRUE),
fDepthTest (kTRUE),
fLastLine (0)
{
InitMainTrans();
fPickable = kTRUE;
fMainColorPtr = &fLineColor;
fLineColor = 4;
fMarkerColor = 2;
fMarkerStyle = 20;
}
TEveStraightLineSet::Line_t*
TEveStraightLineSet::AddLine(Float_t x1, Float_t y1, Float_t z1,
Float_t x2, Float_t y2, Float_t z2)
{
fLastLine = new (fLinePlex.NewAtom()) Line_t(x1, y1, z1, x2, y2, z2);
fLastLine->fId = fLinePlex.Size() - 1;
return fLastLine;
}
TEveStraightLineSet::Line_t*
TEveStraightLineSet::AddLine(const TEveVector& p1, const TEveVector& p2)
{
return AddLine(p1.fX, p1.fY, p1.fZ, p2.fX, p2.fY, p2.fZ);
}
void
TEveStraightLineSet::SetLine(int idx,
Float_t x1, Float_t y1, Float_t z1,
Float_t x2, Float_t y2, Float_t z2)
{
Line_t* l = (Line_t*) fLinePlex.Atom(idx);
l->fV1[0] = x1; l->fV1[1] = y1; l->fV1[2] = z1;
l->fV2[0] = x2; l->fV2[1] = y2; l->fV2[2] = z2;
}
void
TEveStraightLineSet::SetLine(int idx, const TEveVector& p1, const TEveVector& p2)
{
SetLine(idx, p1.fX, p1.fY, p1.fZ, p2.fX, p2.fY, p2.fZ);
}
TEveStraightLineSet::Marker_t*
TEveStraightLineSet::AddMarker(Float_t x, Float_t y, Float_t z, Int_t line_id)
{
Marker_t* marker = new (fMarkerPlex.NewAtom()) Marker_t(x, y, z, line_id);
return marker;
}
TEveStraightLineSet::Marker_t*
TEveStraightLineSet::AddMarker(const TEveVector& p, Int_t line_id)
{
return AddMarker(p.fX, p.fY, p.fZ, line_id);
}
TEveStraightLineSet::Marker_t*
TEveStraightLineSet::AddMarker(Int_t line_id, Float_t pos)
{
Line_t& l = * (Line_t*) fLinePlex.Atom(line_id);
return AddMarker(l.fV1[0] + (l.fV2[0] - l.fV1[0])*pos,
l.fV1[1] + (l.fV2[1] - l.fV1[1])*pos,
l.fV1[2] + (l.fV2[2] - l.fV1[2])*pos,
line_id);
}
void TEveStraightLineSet::CopyVizParams(const TEveElement* el)
{
const TEveStraightLineSet* m = dynamic_cast<const TEveStraightLineSet*>(el);
if (m)
{
TAttLine::operator=(*m);
TAttMarker::operator=(*m);
fRnrMarkers = m->fRnrMarkers;
fRnrLines = m->fRnrLines;
fDepthTest = m->fDepthTest;
}
TEveElement::CopyVizParams(el);
}
void TEveStraightLineSet::WriteVizParams(ostream& out, const TString& var)
{
TEveElement::WriteVizParams(out, var);
TString t = " " + var + "->";
TAttMarker::SaveMarkerAttributes(out, var);
TAttLine ::SaveLineAttributes (out, var);
out << t << "SetRnrMarkers(" << ToString(fRnrMarkers) << ");\n";
out << t << "SetRnrLines(" << ToString(fRnrLines) << ");\n";
out << t << "SetDepthTest(" << ToString(fDepthTest) << ");\n";
}
TClass* TEveStraightLineSet::ProjectedClass(const TEveProjection*) const
{
return TEveStraightLineSetProjected::Class();
}
void TEveStraightLineSet::ComputeBBox()
{
if(fLinePlex.Size() == 0) {
BBoxZero();
return;
}
BBoxInit();
TEveChunkManager::iterator li(fLinePlex);
while (li.next()) {
BBoxCheckPoint(((Line_t*)li())->fV1);
BBoxCheckPoint(((Line_t*)li())->fV2);
}
TEveChunkManager::iterator mi(fMarkerPlex);
while (mi.next())
{
BBoxCheckPoint(((Marker_t*)mi())->fV);
}
}
void TEveStraightLineSet::Paint(Option_t*)
{
PaintStandard(this);
}
ClassImp(TEveStraightLineSetProjected);
TEveStraightLineSetProjected::TEveStraightLineSetProjected() :
TEveStraightLineSet(), TEveProjected ()
{
}
void TEveStraightLineSetProjected::SetProjection(TEveProjectionManager* mng,
TEveProjectable* model)
{
TEveProjected::SetProjection(mng, model);
CopyVizParams(dynamic_cast<TEveElement*>(model));
}
void TEveStraightLineSetProjected::SetDepthLocal(Float_t d)
{
SetDepthCommon(d, this, fBBox);
TEveChunkManager::iterator li(fLinePlex);
while (li.next())
{
TEveStraightLineSet::Line_t& l = * (TEveStraightLineSet::Line_t*) li();
l.fV1[2] = fDepth;
l.fV2[2] = fDepth;
}
TEveChunkManager::iterator mi(fMarkerPlex);
while (mi.next())
{
Marker_t& m = * (Marker_t*) mi();
m.fV[2] = fDepth;
}
}
void TEveStraightLineSetProjected::UpdateProjection()
{
TEveProjection& proj = * fManager->GetProjection();
TEveStraightLineSet& orig = * dynamic_cast<TEveStraightLineSet*>(fProjectable);
TEveTrans *trans = orig.PtrMainTrans(kFALSE);
BBoxClear();
Int_t num_lines = orig.GetLinePlex().Size();
if (proj.HasSeveralSubSpaces())
num_lines += TMath::Max(1, num_lines/10);
fLinePlex.Reset(sizeof(Line_t), num_lines);
TEveVector p1, p2;
TEveChunkManager::iterator li(orig.GetLinePlex());
while (li.next())
{
Line_t *l = (Line_t*) li();
proj.ProjectPointfv(trans, l->fV1, p1, fDepth);
proj.ProjectPointfv(trans, l->fV2, p2, fDepth);
if (proj.AcceptSegment(p1, p2, 0.1f))
{
AddLine(p1, p2)->fId = l->fId;
}
else
{
TEveVector bp1(l->fV1), bp2(l->fV2);
if (trans) {
trans->MultiplyIP(bp1);
trans->MultiplyIP(bp2);
}
proj.BisectBreakPoint(bp1, bp2, kTRUE, fDepth);
AddLine(p1, bp1)->fId = l->fId;
AddLine(bp2, p2)->fId = l->fId;
}
}
if (proj.HasSeveralSubSpaces())
fLinePlex.Refit();
fMarkerPlex.Reset(sizeof(Marker_t), orig.GetMarkerPlex().Size());
TEveChunkManager::iterator mi(orig.GetMarkerPlex());
TEveVector pp;
while (mi.next())
{
Marker_t &m = * (Marker_t*) mi();
proj.ProjectPointfv(trans, m.fV, pp, fDepth);
AddMarker(pp, m.fLineId);
}
}
TEveStraightLineSet.cxx:1 TEveStraightLineSet.cxx:2 TEveStraightLineSet.cxx:3 TEveStraightLineSet.cxx:4 TEveStraightLineSet.cxx:5 TEveStraightLineSet.cxx:6 TEveStraightLineSet.cxx:7 TEveStraightLineSet.cxx:8 TEveStraightLineSet.cxx:9 TEveStraightLineSet.cxx:10 TEveStraightLineSet.cxx:11 TEveStraightLineSet.cxx:12 TEveStraightLineSet.cxx:13 TEveStraightLineSet.cxx:14 TEveStraightLineSet.cxx:15 TEveStraightLineSet.cxx:16 TEveStraightLineSet.cxx:17 TEveStraightLineSet.cxx:18 TEveStraightLineSet.cxx:19 TEveStraightLineSet.cxx:20 TEveStraightLineSet.cxx:21 TEveStraightLineSet.cxx:22 TEveStraightLineSet.cxx:23 TEveStraightLineSet.cxx:24 TEveStraightLineSet.cxx:25 TEveStraightLineSet.cxx:26 TEveStraightLineSet.cxx:27 TEveStraightLineSet.cxx:28 TEveStraightLineSet.cxx:29 TEveStraightLineSet.cxx:30 TEveStraightLineSet.cxx:31 TEveStraightLineSet.cxx:32 TEveStraightLineSet.cxx:33 TEveStraightLineSet.cxx:34 TEveStraightLineSet.cxx:35 TEveStraightLineSet.cxx:36 TEveStraightLineSet.cxx:37 TEveStraightLineSet.cxx:38 TEveStraightLineSet.cxx:39 TEveStraightLineSet.cxx:40 TEveStraightLineSet.cxx:41 TEveStraightLineSet.cxx:42 TEveStraightLineSet.cxx:43 TEveStraightLineSet.cxx:44 TEveStraightLineSet.cxx:45 TEveStraightLineSet.cxx:46 TEveStraightLineSet.cxx:47 TEveStraightLineSet.cxx:48 TEveStraightLineSet.cxx:49 TEveStraightLineSet.cxx:50 TEveStraightLineSet.cxx:51 TEveStraightLineSet.cxx:52 TEveStraightLineSet.cxx:53 TEveStraightLineSet.cxx:54 TEveStraightLineSet.cxx:55 TEveStraightLineSet.cxx:56 TEveStraightLineSet.cxx:57 TEveStraightLineSet.cxx:58 TEveStraightLineSet.cxx:59 TEveStraightLineSet.cxx:60 TEveStraightLineSet.cxx:61 TEveStraightLineSet.cxx:62 TEveStraightLineSet.cxx:63 TEveStraightLineSet.cxx:64 TEveStraightLineSet.cxx:65 TEveStraightLineSet.cxx:66 TEveStraightLineSet.cxx:67 TEveStraightLineSet.cxx:68 TEveStraightLineSet.cxx:69 TEveStraightLineSet.cxx:70 TEveStraightLineSet.cxx:71 TEveStraightLineSet.cxx:72 TEveStraightLineSet.cxx:73 TEveStraightLineSet.cxx:74 TEveStraightLineSet.cxx:75 TEveStraightLineSet.cxx:76 TEveStraightLineSet.cxx:77 TEveStraightLineSet.cxx:78 TEveStraightLineSet.cxx:79 TEveStraightLineSet.cxx:80 TEveStraightLineSet.cxx:81 TEveStraightLineSet.cxx:82 TEveStraightLineSet.cxx:83 TEveStraightLineSet.cxx:84 TEveStraightLineSet.cxx:85 TEveStraightLineSet.cxx:86 TEveStraightLineSet.cxx:87 TEveStraightLineSet.cxx:88 TEveStraightLineSet.cxx:89 TEveStraightLineSet.cxx:90 TEveStraightLineSet.cxx:91 TEveStraightLineSet.cxx:92 TEveStraightLineSet.cxx:93 TEveStraightLineSet.cxx:94 TEveStraightLineSet.cxx:95 TEveStraightLineSet.cxx:96 TEveStraightLineSet.cxx:97 TEveStraightLineSet.cxx:98 TEveStraightLineSet.cxx:99 TEveStraightLineSet.cxx:100 TEveStraightLineSet.cxx:101 TEveStraightLineSet.cxx:102 TEveStraightLineSet.cxx:103 TEveStraightLineSet.cxx:104 TEveStraightLineSet.cxx:105 TEveStraightLineSet.cxx:106 TEveStraightLineSet.cxx:107 TEveStraightLineSet.cxx:108 TEveStraightLineSet.cxx:109 TEveStraightLineSet.cxx:110 TEveStraightLineSet.cxx:111 TEveStraightLineSet.cxx:112 TEveStraightLineSet.cxx:113 TEveStraightLineSet.cxx:114 TEveStraightLineSet.cxx:115 TEveStraightLineSet.cxx:116 TEveStraightLineSet.cxx:117 TEveStraightLineSet.cxx:118 TEveStraightLineSet.cxx:119 TEveStraightLineSet.cxx:120 TEveStraightLineSet.cxx:121 TEveStraightLineSet.cxx:122 TEveStraightLineSet.cxx:123 TEveStraightLineSet.cxx:124 TEveStraightLineSet.cxx:125 TEveStraightLineSet.cxx:126 TEveStraightLineSet.cxx:127 TEveStraightLineSet.cxx:128 TEveStraightLineSet.cxx:129 TEveStraightLineSet.cxx:130 TEveStraightLineSet.cxx:131 TEveStraightLineSet.cxx:132 TEveStraightLineSet.cxx:133 TEveStraightLineSet.cxx:134 TEveStraightLineSet.cxx:135 TEveStraightLineSet.cxx:136 TEveStraightLineSet.cxx:137 TEveStraightLineSet.cxx:138 TEveStraightLineSet.cxx:139 TEveStraightLineSet.cxx:140 TEveStraightLineSet.cxx:141 TEveStraightLineSet.cxx:142 TEveStraightLineSet.cxx:143 TEveStraightLineSet.cxx:144 TEveStraightLineSet.cxx:145 TEveStraightLineSet.cxx:146 TEveStraightLineSet.cxx:147 TEveStraightLineSet.cxx:148 TEveStraightLineSet.cxx:149 TEveStraightLineSet.cxx:150 TEveStraightLineSet.cxx:151 TEveStraightLineSet.cxx:152 TEveStraightLineSet.cxx:153 TEveStraightLineSet.cxx:154 TEveStraightLineSet.cxx:155 TEveStraightLineSet.cxx:156 TEveStraightLineSet.cxx:157 TEveStraightLineSet.cxx:158 TEveStraightLineSet.cxx:159 TEveStraightLineSet.cxx:160 TEveStraightLineSet.cxx:161 TEveStraightLineSet.cxx:162 TEveStraightLineSet.cxx:163 TEveStraightLineSet.cxx:164 TEveStraightLineSet.cxx:165 TEveStraightLineSet.cxx:166 TEveStraightLineSet.cxx:167 TEveStraightLineSet.cxx:168 TEveStraightLineSet.cxx:169 TEveStraightLineSet.cxx:170 TEveStraightLineSet.cxx:171 TEveStraightLineSet.cxx:172 TEveStraightLineSet.cxx:173 TEveStraightLineSet.cxx:174 TEveStraightLineSet.cxx:175 TEveStraightLineSet.cxx:176 TEveStraightLineSet.cxx:177 TEveStraightLineSet.cxx:178 TEveStraightLineSet.cxx:179 TEveStraightLineSet.cxx:180 TEveStraightLineSet.cxx:181 TEveStraightLineSet.cxx:182 TEveStraightLineSet.cxx:183 TEveStraightLineSet.cxx:184 TEveStraightLineSet.cxx:185 TEveStraightLineSet.cxx:186 TEveStraightLineSet.cxx:187 TEveStraightLineSet.cxx:188 TEveStraightLineSet.cxx:189 TEveStraightLineSet.cxx:190 TEveStraightLineSet.cxx:191 TEveStraightLineSet.cxx:192 TEveStraightLineSet.cxx:193 TEveStraightLineSet.cxx:194 TEveStraightLineSet.cxx:195 TEveStraightLineSet.cxx:196 TEveStraightLineSet.cxx:197 TEveStraightLineSet.cxx:198 TEveStraightLineSet.cxx:199 TEveStraightLineSet.cxx:200 TEveStraightLineSet.cxx:201 TEveStraightLineSet.cxx:202 TEveStraightLineSet.cxx:203 TEveStraightLineSet.cxx:204 TEveStraightLineSet.cxx:205 TEveStraightLineSet.cxx:206 TEveStraightLineSet.cxx:207 TEveStraightLineSet.cxx:208 TEveStraightLineSet.cxx:209 TEveStraightLineSet.cxx:210 TEveStraightLineSet.cxx:211 TEveStraightLineSet.cxx:212 TEveStraightLineSet.cxx:213 TEveStraightLineSet.cxx:214 TEveStraightLineSet.cxx:215 TEveStraightLineSet.cxx:216 TEveStraightLineSet.cxx:217 TEveStraightLineSet.cxx:218 TEveStraightLineSet.cxx:219 TEveStraightLineSet.cxx:220 TEveStraightLineSet.cxx:221 TEveStraightLineSet.cxx:222 TEveStraightLineSet.cxx:223 TEveStraightLineSet.cxx:224 TEveStraightLineSet.cxx:225 TEveStraightLineSet.cxx:226 TEveStraightLineSet.cxx:227 TEveStraightLineSet.cxx:228 TEveStraightLineSet.cxx:229 TEveStraightLineSet.cxx:230 TEveStraightLineSet.cxx:231 TEveStraightLineSet.cxx:232 TEveStraightLineSet.cxx:233 TEveStraightLineSet.cxx:234 TEveStraightLineSet.cxx:235 TEveStraightLineSet.cxx:236 TEveStraightLineSet.cxx:237 TEveStraightLineSet.cxx:238 TEveStraightLineSet.cxx:239 TEveStraightLineSet.cxx:240 TEveStraightLineSet.cxx:241 TEveStraightLineSet.cxx:242 TEveStraightLineSet.cxx:243 TEveStraightLineSet.cxx:244 TEveStraightLineSet.cxx:245 TEveStraightLineSet.cxx:246 TEveStraightLineSet.cxx:247 TEveStraightLineSet.cxx:248 TEveStraightLineSet.cxx:249 TEveStraightLineSet.cxx:250 TEveStraightLineSet.cxx:251 TEveStraightLineSet.cxx:252 TEveStraightLineSet.cxx:253 TEveStraightLineSet.cxx:254 TEveStraightLineSet.cxx:255 TEveStraightLineSet.cxx:256 TEveStraightLineSet.cxx:257 TEveStraightLineSet.cxx:258 TEveStraightLineSet.cxx:259 TEveStraightLineSet.cxx:260 TEveStraightLineSet.cxx:261 TEveStraightLineSet.cxx:262 TEveStraightLineSet.cxx:263 TEveStraightLineSet.cxx:264 TEveStraightLineSet.cxx:265 TEveStraightLineSet.cxx:266 TEveStraightLineSet.cxx:267 TEveStraightLineSet.cxx:268 TEveStraightLineSet.cxx:269 TEveStraightLineSet.cxx:270 TEveStraightLineSet.cxx:271 TEveStraightLineSet.cxx:272 TEveStraightLineSet.cxx:273 TEveStraightLineSet.cxx:274 TEveStraightLineSet.cxx:275 TEveStraightLineSet.cxx:276 TEveStraightLineSet.cxx:277 TEveStraightLineSet.cxx:278 TEveStraightLineSet.cxx:279 TEveStraightLineSet.cxx:280 TEveStraightLineSet.cxx:281 TEveStraightLineSet.cxx:282 TEveStraightLineSet.cxx:283 TEveStraightLineSet.cxx:284 TEveStraightLineSet.cxx:285 TEveStraightLineSet.cxx:286 TEveStraightLineSet.cxx:287 TEveStraightLineSet.cxx:288 TEveStraightLineSet.cxx:289 TEveStraightLineSet.cxx:290 TEveStraightLineSet.cxx:291 TEveStraightLineSet.cxx:292 TEveStraightLineSet.cxx:293 TEveStraightLineSet.cxx:294 TEveStraightLineSet.cxx:295 TEveStraightLineSet.cxx:296 TEveStraightLineSet.cxx:297 TEveStraightLineSet.cxx:298 TEveStraightLineSet.cxx:299 TEveStraightLineSet.cxx:300 TEveStraightLineSet.cxx:301 TEveStraightLineSet.cxx:302 TEveStraightLineSet.cxx:303 TEveStraightLineSet.cxx:304 TEveStraightLineSet.cxx:305 TEveStraightLineSet.cxx:306 TEveStraightLineSet.cxx:307 TEveStraightLineSet.cxx:308 TEveStraightLineSet.cxx:309 TEveStraightLineSet.cxx:310 TEveStraightLineSet.cxx:311 TEveStraightLineSet.cxx:312 TEveStraightLineSet.cxx:313 TEveStraightLineSet.cxx:314 TEveStraightLineSet.cxx:315 TEveStraightLineSet.cxx:316 TEveStraightLineSet.cxx:317 TEveStraightLineSet.cxx:318 TEveStraightLineSet.cxx:319 TEveStraightLineSet.cxx:320 TEveStraightLineSet.cxx:321 TEveStraightLineSet.cxx:322 TEveStraightLineSet.cxx:323 TEveStraightLineSet.cxx:324 TEveStraightLineSet.cxx:325 TEveStraightLineSet.cxx:326 TEveStraightLineSet.cxx:327 TEveStraightLineSet.cxx:328 TEveStraightLineSet.cxx:329