Public Member Functions
PtMotionResults Class Reference

#include <PtMotionResults.h>

Inheritance diagram for PtMotionResults:
SciFigs::GraphicSheetMenu

List of all members.

Public Member Functions

void createObjects (SubSignalPool *subPool)
 PtMotionResults (QWidget *parent=0)
void setLimits ()
void updateSignals (SubSignalPool *subPool, TimeRangeParameters &tlParam, bool doFilter, const FilterParameters &fparam, bool verticalPlane, double direction)
 ~PtMotionResults ()

Constructor & Destructor Documentation

PtMotionResults::PtMotionResults ( QWidget *  parent = 0)

References TRACE.

                                                :
    GraphicSheetMenu(parent)
{
  TRACE;
  Settings::getSize(this, "PtMotionResults" );
}

References TRACE.

{
  TRACE;
  Settings::setSize(this, "PtMotionResults" );
}

Member Function Documentation

References SciFigs::GraphicSheetMenu::addGraph(), GeopsyCore::SubSignalPool::begin(), GeopsyCore::SubSignalPool::count(), geopsyGui, SciFigs::GraphicSheetMenu::setGraphGeometry(), SciFigs::GraphicSheet::setStatusBar(), SciFigs::GraphicSheetMenu::sheet(), TRACE, and w.

{
  TRACE;
  ASSERT(subPool->count() % 3==0);
  sheet()->setStatusBar(geopsyGui->statusBar());
  int n=subPool->count()/3;
  _curveLayers.resize(n);
  SubSignalPool::iterator it=subPool->begin();
  double x=0.5, y=0.5;
  Signal *sigZ, *sigN, *sigE;
  for(int ig=0;ig < n;ig++, ++it) {
    sigZ=*it;
    sigN=*( ++it);
    sigE=*( ++it);
    AxisWindow * w=addGraph();
    setGraphGeometry(w, x, 7, y, 7, Axis::AxisSize);
    x += 9;
    if(x==18.5) {x=0.5;y += 9;}
    _curveLayers[ig]=new XUniqueYColorLines(w);
    _curveLayers[ig]->setLineWeight(0.01);
  }
}

References SciFigs::AxisWindow::deepUpdate(), QGpCoreTools::Rect::enlarge(), QGpCoreTools::LinearScale, SciFigs::Axis::setRange(), QGpCoreTools::Rect::square(), TRACE, w, QGpCoreTools::Rect::x1(), QGpCoreTools::Rect::x2(), SciFigs::AxisWindow::xAxis(), QGpCoreTools::Rect::y1(), QGpCoreTools::Rect::y2(), and SciFigs::AxisWindow::yAxis().

{
  TRACE;
  Rect r;
  int n=_curveLayers.count();
  for(int ig=0;ig < n;ig++ ) {
    AxisWindow * w=_curveLayers[ ig ]->graph();
   // Adjust axis limits
    r=_curveLayers[ig]->boundingRect();
    r.enlarge(0.05, LinearScale, LinearScale);
    r.square();
    w->xAxis()->setRange(r.x1(), r.x2());
    w->yAxis()->setRange(r.y1(), r.y2());
    w->deepUpdate();
  }
}
void PtMotionResults::updateSignals ( SubSignalPool subPool,
TimeRangeParameters tlParam,
bool  doFilter,
const FilterParameters fparam,
bool  verticalPlane,
double  direction 
)

References GeopsyCore::TimeRangeParameters::absoluteRange(), GeopsyCore::SubSignalPool::begin(), SciFigs::XUniqueYColorLines::clear(), CONST_LOCK_SAMPLES, QGpCoreTools::Angle::cos(), GeopsyCore::SubSignalPool::count(), SciFigs::AxisWindow::deepUpdate(), QGpCoreTools::Angle::degrees(), GeopsyCore::DoubleSignal::deltaT(), GeopsyCore::TimeRange::end(), geopsyGui, SciFigs::GraphContentLayer::graph(), GeopsyCore::Signal::name(), QGpCoreTools::Angle::normalize(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::DoubleSignal::restoreType(), GeopsyCore::DoubleSignal::saveType(), QGpCoreTools::Angle::setDegrees(), SciFigs::XUniqueYColorLines::setPointCount(), SciFigs::Axis::setTitle(), SciFigs::Axis::setTitleInversedScale(), QGpCoreTools::Angle::sin(), GeopsyCore::TimeRange::start(), GeopsyCore::Signal::t0(), SciFigs::Axis::title, QGpCoreTools::tr(), TRACE, UNLOCK_SAMPLES, w, SciFigs::XUniqueYColorLines::x(), SciFigs::AxisWindow::xAxis(), SciFigs::XUniqueYColorLines::y(), and SciFigs::AxisWindow::yAxis().

{
  TRACE;
  ASSERT(subPool->count()>=_curveLayers.count());
  SubSignalPool::iterator it=subPool->begin();
  Angle proj;
  proj.setDegrees(direction);
  QString xSuffix, ySuffix;
  if(verticalPlane) {
    proj.normalize();
    xSuffix=tr(" - dir %1" ).arg(proj.degrees(), 0, 'f', 1);
    ySuffix=tr(" - Vertical");
    setWindowTitle(tr("Vertical particle motion%1").arg(xSuffix));
  } else {
    xSuffix=tr(" - East");
    ySuffix=tr(" - North");
    setWindowTitle(tr("Horizontal particle motion"));
  }
  geopsyGui->updateWindowTitle(this);
  const Signal *sigZ, *sigN, *sigE;
  const DoubleSignal *sigZp, *sigNp, *sigEp;
  Rect r;
  int n=_curveLayers.count();
  for(int ig=0; ig<n; ig++, ++it) {
    sigZ=*it;
    sigN=*(++it);
    sigE=*(++it);
    if(doFilter) {
      sigZp=filtered(sigZ, fparam);
      sigNp=filtered(sigN, fparam);
      sigEp=filtered(sigE, fparam);
    } else {
      sigZp=sigZ->saveType(DoubleSignal::Waveform);
      sigNp=sigN->saveType(DoubleSignal::Waveform);
      sigEp=sigE->saveType(DoubleSignal::Waveform);
    }
    TimeRange tw=tlParam.absoluteRange(sigZ);
    XUniqueYColorLines * plot=_curveLayers[ig];
    AxisWindow * w=plot->graph();
    w->xAxis()->setTitle(sigZ->name()+xSuffix);
    w->xAxis()->setTitleInversedScale(w->xAxis()->title());
    w->yAxis()->setTitle(sigZ->name()+ySuffix);
    w->yAxis()->setTitleInversedScale(w->yAxis()->title());
    double invdt=1.0/sigZ->deltaT();
    int startIndex=(int)round((tw.start()-sigZ->t0())*invdt);
    if(startIndex<0) startIndex=0;
    if(startIndex>sigZ->nSamples()) startIndex=sigZ->nSamples();
    int endIndex=(int) floor((tw.end()-sigZ->t0())*invdt+0.5);
    if(endIndex<0) endIndex=0;
    if(endIndex>sigZ->nSamples()) endIndex=sigZ->nSamples();
    plot->clear();
    plot->setPointCount(1, endIndex-startIndex);
    CONST_LOCK_SAMPLES(double, sampZ, sigZp)
      CONST_LOCK_SAMPLES(double, sampN, sigNp)
        CONST_LOCK_SAMPLES(double, sampE, sigEp)
          double * x=plot->x();
          double * y=plot->y();
          LayerLocker ll(plot);
          if(verticalPlane) {
            for(int i=startIndex; i<endIndex; i++) {
              int ip=i-startIndex;
              x[ip]=sampE[i]*proj.cos()+sampN[i]*proj.sin();
              y[ip]=sampZ[i];
            }
          } else {
            for(int i=startIndex; i<endIndex; i++) {
              int ip=i-startIndex;
              x[ip]=sampE[i];
              y[ip]=sampN[i];
            }
          }
        UNLOCK_SAMPLES(sigEp)
      UNLOCK_SAMPLES(sigNp)
    UNLOCK_SAMPLES(sigZp)
    if(doFilter) {
      delete sigZp;
      delete sigNp;
      delete sigEp;
    } else {
      sigZ->restoreType(sigZp);
      sigN->restoreType(sigNp);
      sigE->restoreType(sigEp);
    }
    w->deepUpdate();
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines