/*************************************************************************** aon_track.cpp - Class to hold track information for visualization ------------------- begin : Tue Jun 08 2004 copyright : (C) 2004 by Andrew O'Neill,HiRes Grad Student email : oneill@phys.columbia.edu ************************************************************************/ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "aon_track.h" using namespace std; bool VisualsInitialized = false; double ZoomFactor = 1e-7; aonPoint::aonPoint(const double& x, const double& y, const double& z, const double& t) : itsX(x), itsY(y), itsZ(z), itsT(t) { } aonPoint::~aonPoint() { } void aonPoint::Draw() { if(VisualsInitialized == false) { dout(ERR) << "Trying to use Draw() when Visuals are not initialized" << endl; return; } #ifdef VISUALS glVertex3f(itsX*ZoomFactor, itsY*ZoomFactor, itsZ*ZoomFactor); #endif return; } void aonPoint::Erase() { dout(WARN) << "aonPoint::Erase() not implemented yet" << endl; return; } aonTrack::aonTrack() { } aonTrack::~aonTrack() { } void aonTrack::AddPoint(const double& x, const double& y, const double& z, const double& t) { // FIXME check that time is later than previous, aonPoint *Point = new aonPoint(x, y, z, t); Points.push_back(*Point); return; } void aonTrack::Draw() { list::iterator Iter; #ifdef VISUALS glPushMatrix(); // Go through all points and draw them glBegin(GL_LINE_STRIP); for(Iter = Points.begin(); Iter != Points.end(); Iter++) { Iter->Draw(); } glEnd(); glPopMatrix(); glutSwapBuffers(); #endif return; } void aonTrack::DrawLast() { #ifdef VISUALS glPushMatrix(); glBegin(GL_POINTS); aonPoint Point = Points.back(); Point.Draw(); glEnd(); glPopMatrix(); glFlush(); // glutSwapBuffers(); #endif }