FEDRA emulsion software from the OPERA Collaboration
Edb3DView Class Reference

Event Display. More...

#include <EdbDisplayBase.h>

Inheritance diagram for Edb3DView:
Collaboration diagram for Edb3DView:

Public Member Functions

 Edb3DView ()
 
virtual void ExecuteRotateView (Int_t event, Int_t px, Int_t py)
 
virtual const char * GetName () const
 
virtual char * GetObjectInfo (int px, int py) const
 
virtual const char * GetTitle () const
 
virtual void SetRotateMode (bool Mode=true)
 
 ~Edb3DView ()
 

Protected Attributes

bool fRotateMode
 

Detailed Description

Event Display.

Constructor & Destructor Documentation

◆ Edb3DView()

Edb3DView::Edb3DView ( )
inline
55: TView3D() { fRotateMode = false; }
bool fRotateMode
Definition: EdbDisplayBase.h:51

◆ ~Edb3DView()

Edb3DView::~Edb3DView ( )
inline
61{};

Member Function Documentation

◆ ExecuteRotateView()

void Edb3DView::ExecuteRotateView ( Int_t  event,
Int_t  px,
Int_t  py 
)
virtual

-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*-*-* -* ========================================= * -* This member function is called when a object is clicked with the locator * -* * -* If Left button clicked in the object area, while the button is kept down * -* the cube representing the surrounding frame for the corresponding * -* new latitude and longitude position is drawn. * -* * -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

1241{
1253 static Int_t system, framewasdrawn;
1254 static Double_t xrange, yrange, xmin, ymin, longitude1, latitude1, longitude2, latitude2;
1255 static Double_t newlatitude, newlongitude, oldlatitude, oldlongitude;
1256 Double_t dlatitude, dlongitude, x, y;
1257 Int_t irep = 0;
1258 Double_t psideg;
1259
1260 // all coordinate transformation are from absolute to relative
1261
1262 if (!fRotateMode)
1263 {
1264 gPad->SetCursor(kPointer);
1265 return;
1266 }
1267 if (!gPad->IsEditable()) return;
1268 gPad->AbsCoordinates(kTRUE);
1269
1270 switch (event) {
1271
1272 case kKeyPress :
1273 fChanged = kTRUE;
1274 MoveViewCommand(Char_t(px), py);
1275 break;
1276 case kMouseMotion:
1277 gPad->SetCursor(kRotate);
1278 break;
1279
1280 case kButton1Down:
1281
1282 // remember position of the cube
1283 xmin = gPad->GetX1();
1284 ymin = gPad->GetY1();
1285 xrange = gPad->GetX2() - xmin;
1286 yrange = gPad->GetY2() - ymin;
1287 x = gPad->PixeltoX(px);
1288 y = gPad->PixeltoY(py);
1289 system = GetSystem();
1290 framewasdrawn = 0;
1291 if (system == kCARTESIAN || system == kPOLAR || IsPerspective()) {
1292 longitude1 = 180*(x-xmin)/xrange;
1293 latitude1 = 90*(y-ymin)/yrange;
1294 } else {
1295 latitude1 = 90*(x-xmin)/xrange;
1296 longitude1 = 180*(y-ymin)/yrange;
1297 }
1298 newlongitude = oldlongitude = -90 - gPad->GetPhi();
1299 newlatitude = oldlatitude = 90 - gPad->GetTheta();
1300 psideg = GetPsi();
1301
1302 // if outline isn't set, make it look like a cube
1303 if(!fOutline)
1304 SetOutlineToCube();
1305 break;
1306
1307 case kButton1Motion:
1308 {
1309 // draw the surrounding frame for the current mouse position
1310 // first: Erase old frame
1311 fChanged = kTRUE;
1312 if (framewasdrawn) fOutline->Paint();
1313 framewasdrawn = 1;
1314 x = gPad->PixeltoX(px);
1315 y = gPad->PixeltoY(py);
1316 if (system == kCARTESIAN || system == kPOLAR || IsPerspective()) {
1317 longitude2 = 180*(x-xmin)/xrange;
1318 latitude2 = 90*(y-ymin)/yrange;
1319 } else {
1320 latitude2 = 90*(x-xmin)/xrange;
1321 longitude2 = 180*(y-ymin)/yrange;
1322 }
1323 dlongitude = longitude2 - longitude1;
1324 dlatitude = latitude2 - latitude1;
1325 newlatitude = oldlatitude + dlatitude;
1326 newlongitude = oldlongitude - dlongitude;
1327 psideg = GetPsi();
1328 ResetView(newlongitude, newlatitude, psideg, irep);
1329 fOutline->Paint();
1330
1331 break;
1332 }
1333 case kButton1Up:
1334
1335 // Temporary fix for 2D drawing problems on pad. fOutline contains
1336 // a TPolyLine3D object for the rotation box. This will be painted
1337 // through a newly created TViewer3DPad instance, which is left
1338 // behind on pad. This remaining creates 2D drawing problems.
1339 //
1340 // This is a TEMPORARY fix - will be removed when proper multiple viewers
1341 // on pad problems are resolved.
1342//Doesn't work in old versions of ROOT
1343// if (gPad) {
1344// TVirtualViewer3D *viewer = gPad->GetViewer3D();
1345// if (viewer && !strcmp(viewer->IsA()->GetName(),"TViewer3DPad")) {
1346// gPad->ReleaseViewer3D();
1347// delete viewer;
1348// }
1349// }
1350 // End fix
1351
1352 // Recompute new view matrix and redraw
1353 psideg = GetPsi();
1354 SetView(newlongitude, newlatitude, psideg, irep);
1355 gPad->SetPhi(-90-newlongitude);
1356 gPad->SetTheta(90-newlatitude);
1357 gPad->Modified(kTRUE);
1358
1359 // Set line color, style and width
1360 gVirtualX->SetLineColor(-1);
1361 gVirtualX->SetLineStyle(-1);
1362 gVirtualX->SetLineWidth(-1);
1363 break;
1364 }
1365
1366 // set back to default transformation mode
1367 gPad->AbsCoordinates(kFALSE);
1368}
const Int_t kCARTESIAN
Definition: EdbDisplayBase.cxx:23
const Int_t kPOLAR
Definition: EdbDisplayBase.cxx:24
int event
Definition: shower_tr.C:25

◆ GetName()

const char * Edb3DView::GetName ( ) const
virtual
1211{
1212 static char name[] = "3-D View";
1213 return name;
1214}
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24

◆ GetObjectInfo()

char * Edb3DView::GetObjectInfo ( int  px,
int  py 
) const
virtual
1217{
1218 static char rcoordinates[]="Rotated coordinates";
1219 static char coordinates[80];
1220 if (!gPad) return rcoordinates;
1221 float nxyz[3] = {gPad->AbsPixeltoX(px), gPad->AbsPixeltoY(py), 0.}, wxyz[3] = {0., 0., 0.};
1222 ((TView *)this)->NDCtoWC(nxyz, wxyz);
1223 if (((TView *)this)->GetLatitude() == 90.)
1224 {
1225 if (((TView *)this)->GetLongitude() == 180.)
1226 sprintf(coordinates, "Y = %.1f, Z = %.1f", wxyz[1], wxyz[2]);
1227 else if (((TView *)this)->GetLongitude() == 90.)
1228 sprintf(coordinates, "X = %.1f, Z = %.1f", wxyz[0], wxyz[2]);
1229 else
1230 return rcoordinates;
1231 }
1232 else if (((TView *)this)->GetLatitude() == 0.)
1233 sprintf(coordinates, "X = %.1f, Y = %.1f", wxyz[0], wxyz[1]);
1234 else
1235 return rcoordinates;
1236 return coordinates;
1237}

◆ GetTitle()

const char * Edb3DView::GetTitle ( ) const
virtual
1203{
1204 static char title[80];
1205 sprintf(title, "%s", "FEDRA Event Display");
1206 return title;
1207}

◆ SetRotateMode()

void Edb3DView::SetRotateMode ( bool  Mode = true)
virtual

Set or unset 3-D View Rotate Mode

1371{
1375 fRotateMode = mode;
1376}

Member Data Documentation

◆ fRotateMode

bool Edb3DView::fRotateMode
protected

The documentation for this class was generated from the following files: