#include "viewerbase.hh"

ViewerBase::
ViewerBase(void):
  hitScale_(8000),
  trackScale_(80000)
{

  showTracks_=true;
  showHits_=true;

}

bool ViewerBase::
showTracks(void) const
{
  return showTracks_;
}
void ViewerBase::
setShowTracks(bool s)
{
  showTracks_=s;
  //re-paint
  //zOrderGL();
}
bool ViewerBase::
showHits(void) const
{
  return showHits_;
}
void ViewerBase::
setShowHits(bool s)
{
  showHits_=s;
  //re-paint
  //zOrderGL();
}

void ViewerBase::
addHit(const Hit& h)
{
  hits_.push_back(h);
}

//access hit list
HitIndex ViewerBase::
numHits(void) const
{
  return hits_.size();
}
const Hit& ViewerBase::
hit(HitIndex n) const
{
  return hits_.at(n);
}
//set hit selected
void ViewerBase::
highlightHit(HitIndex n, bool h)
{
  if (n<hits_.size())
    hits_.at(n).selected=h;
}
//hit scaling (mm/unit_value)
float ViewerBase::
hitScale(void) const
{
  return hitScale_;
}
void ViewerBase::
setHitScale(float s)
{
  hitScale_=s;
}
void ViewerBase::
clearHits(void)
{
  hits_.clear();
}

//add a track
void ViewerBase::
addTrack(const Track& t)
{
  tracks_.push_back(t);
}
//access track list
TrackIndex ViewerBase::
numTracks(void) const
{
  return tracks_.size();
}
const Track& ViewerBase::
track(TrackIndex n) const
{
  return tracks_.at(n);
}
  //forget
void ViewerBase::
clearTracks(void)
{
  tracks_.clear();
}
//set track selected
void ViewerBase::
highlightTrack(TrackIndex n, bool h)
{
  if (n<tracks_.size())
    tracks_.at(n).selected=h;
}
  //track scaling
float ViewerBase::
trackScale(void) const
{
  return trackScale_;
}
void ViewerBase::
setTrackScale(float s)
{
  trackScale_=s;
}
//set hit visibility
void ViewerBase::
setHitVis(HitIndex i, bool v)
{
  if (i<hits_.size())
    hits_.at(i).show=v;
}
//set track visibility
void ViewerBase::
setTrackVis(TrackIndex i, bool v)
{
  if (i<tracks_.size())
    tracks_.at(i).show=v;
}
