All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Types | Signals | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | Friends
GeopsyGui::SignalLayer Class Reference

Brief description of class still missing. More...

#include <SignalLayer.h>

Inheritance diagram for GeopsyGui::SignalLayer:
SciFigs::GridPlot SciFigs::GraphContentLayer QGpGuiTools::PropertyItem QGpCoreTools::XMLClass SignalDisplay

List of all members.

Public Types

enum  Clip { NoClip, ClipOverlap, ClipValue, ClipPercentage }
enum  Normalize {
  NormalizeAll, NormalizeOne, NormalizeVisibleAll, NormalizeVisibleOne,
  NormalizeValue
}
enum  Offset { NoOffset, GlobalOffset, VisibleOffset }
enum  TimeRange { AvailableRange, AroundPickRange, CustomRange }
enum  YAxis { ViewerIndex, Receiver, SignalName, Overlayed }

Signals

void propertiesChanged ()

Public Member Functions

virtual void addProperties (PropertyProxy *pp)
double afterPickDelay () const
const QString & aroundPickName () const
double beforePickDelay () const
virtual Rect boundingRect () const
void clearSignalColors ()
Clip clip () const
double clipPerc () const
QString clipString () const
double clipValue () const
const TimeRangeParameterscustomTimeRange () const
bool grid () const
virtual bool hasProperties ()
void highlightSignal (const GraphContentOptions &gc, QPainter &p, int w, int iSig, int isigmin, int isigmax) const
void minMaxY (double &min, double &max) const
Normalize normalize () const
QString normalizeString () const
double normalizeValue () const
Offset offset () const
QString offsetString () const
double overlap () const
virtual void properties (PropertyWidget *w) const
virtual void removeProperties (PropertyProxy *pp)
void setAfterPickDelay (double d)
void setAroundPickName (const QString &pn)
void setBeforePickDelay (double d)
void setClip (Clip c)
void setClip (QString c)
void setClipPerc (double v)
void setClipValue (double v)
void setCustomTimeRange (const TimeRangeParameters &ctr)
void setGrid (bool b)
void setNormalize (Normalize n)
void setNormalize (QString n)
void setNormalizeValue (double v)
void setOffset (Offset o)
void setOffset (QString n)
void setOverlap (double v)
virtual void setProperty (uint wid, int pid, QVariant val)
void setReceiverYAxis (bool rc)
void setSignalColor (const Signal *sig, const QColor &c)
void setTimeRange (TimeRange tr)
void setTimeRange (QString tr)
void setVariableArea (bool b)
void setWiggleTrace (bool b)
void setYAxis (YAxis a)
void setYAxis (QString a)
int signalAt (int yPos, double &baseDistance) const
const QColor & signalColor (const Signal *sig) const
 SignalLayer (AxisWindow *parent=0)
void signalsUpdate ()
void sigYBoundaries (int index, double overlap, QRect &bound) const
const SubSignalPoolsubPool () const
void subPoolUpdate (SubSignalPool *subPool=0)
TimeRange timeRange () const
QString timeRangeString () const
bool variableArea () const
bool wiggleTrace () const
virtual const QString & xml_tagName () const
YAxis yAxis () const
QString yAxisString () const
 ~SignalLayer ()

Static Public Attributes

static const QString xmlSignalLayerTag = "SignalLayer"

Protected Member Functions

void drawGaps (const GraphContentOptions &gc, QPainter &p, const Signal *sig, int iSig) const
void drawingAmplitude (const Signal *sig, int itmin, int itmax, double &valClip, double &affMax) const
void drawSignal (const GraphContentOptions &gc, QPainter &p, const Signal *sig, int iSig, int itmin, int itmax, double x0, double dx, bool allSamplesVisible, double affMax, int pixelWidth, bool variableArea, bool wiggleTrace) const
virtual bool keyPressEvent (QKeyEvent *e)
double maxAmplitude (const GraphContentOptions &gc) const
virtual void paintData (const LayerPainterRequest &lp, QPainter &p, double dotpercm) const
void setIsigMinMax (const GraphContentOptions &gc, int &isigmin, int &isigmax) const
void updateGrid ()
bool visibleSamples (const GraphContentOptions &gc, const Signal *sig, int &itmin, int &itmax, double &x0, double &dx) const
void visibleSamples (const GraphContentOptions &gc, const Signal *sig, int &itmin, int &itmax) const
virtual bool wheelEvent (QWheelEvent *e)
virtual XMLMember xml_member (XML_MEMBER_ARGS)
virtual void xml_polish (XML_POLISH_ARGS)
virtual void xml_polishChild (XML_POLISHCHILD_ARGS)
virtual bool xml_setProperty (XML_SETPROPERTY_ARGS)
virtual void xml_writeChildren (XML_WRITECHILDREN_ARGS) const
virtual void xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const

Protected Attributes

double _afterPickDelay
QString _aroundPickName
double _beforePickDelay
Clip _clip
double _clipPerc
double _clipValue
TimeRangeParameters _customTimeRange
Grid2D< double > * _gridPlot
Normalize _normalize
double _normalizeValue
Offset _offset
double _overlap
QMap< const Signal *, QColor > _signalColors
QMap< const Signal *, double > _signalOverlaps
QVector< double > _signalY
SubSignalPool_subPool
bool _subPoolOwner
TimeRange _timeRange
bool _variableArea
bool _wiggleTrace
YAxis _yAxis

Static Protected Attributes

static uint _tab = PropertyProxy::uniqueId()

Properties

double afterPickDelay
QString aroundPickName
double beforePickDelay
QString clip
double clipPerc
double clipValue
bool grid
QString norm
QString normalize
double normalizeValue
double normValue
QString offset
double overlap
bool smoothGrid
QString timeRange
bool useReceiverCoord
bool variableArea
bool wiggleTrace
QString yAxis

Friends

class PickLayer
class TimeWindowLayer

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Enumeration Documentation

Enumerator:
NoClip 
ClipOverlap 
ClipValue 
ClipPercentage 
Enumerator:
NormalizeAll 
NormalizeOne 
NormalizeVisibleAll 
NormalizeVisibleOne 
NormalizeValue 
Enumerator:
NoOffset 
GlobalOffset 
VisibleOffset 
Enumerator:
AvailableRange 
AroundPickRange 
CustomRange 
Enumerator:
ViewerIndex 
Receiver 
SignalName 
Overlayed 

Constructor & Destructor Documentation

References _afterPickDelay, _beforePickDelay, _clip, _clipPerc, _clipValue, _gridPlot, _normalize, _normalizeValue, _offset, _overlap, _subPool, _subPoolOwner, _timeRange, _variableArea, _wiggleTrace, _yAxis, AvailableRange, GeopsyCore::geopsyCore, NoClip, NoOffset, NormalizeAll, SciFigs::GridPlot::setLinearPalette(), TRACE, and ViewerIndex.

                                             :
    GridPlot(parent)
{
  TRACE;
  // Required for viewing the layer in figue (through geopsyfigs plugin)
  if(!geopsyCore) {
    CoreApplication::addGlobalObject(new GeopsyGuiEngine);
  }
  _subPool=0;
  _subPoolOwner=false;
  // Trace display options
  _wiggleTrace=true;
  _variableArea=true;
  _offset=NoOffset;
  _normalize=NormalizeAll;
  _normalizeValue=1.0;
  _clip=NoClip;
  _clipPerc=50.0;
  _clipValue=1.0;
  _overlap=1.0;
  // Grid plotting options
  _gridPlot=0;
  // Y axis type options
  _yAxis=ViewerIndex;
  // Time range options
  _timeRange=AvailableRange;
  _beforePickDelay=0.02;
  _afterPickDelay=0.02;
  // Palette options
  setLinearPalette( -_overlap * 0.5, _overlap * 0.5);
}

References _gridPlot, _subPool, _subPoolOwner, and TRACE.

{
  TRACE;
  delete _gridPlot;
  if(_subPoolOwner) {
    delete _subPool;
  }
}

Member Function Documentation

Setup property editor

Reimplemented from SciFigs::GridPlot.

References _subPool, _tab, QGpGuiTools::PropertyProxy::addReference(), QGpGuiTools::PropertyProxy::addTab(), QGpGuiTools::PropertyProxy::currentTabWidget(), GeopsyGui::SignalsProperties::setCurrentSubPool(), QGpGuiTools::PropertyProxy::setCurrentTab(), QGpCoreTools::tr(), TRACE, and w.

{
  TRACE;
  if(pp->setCurrentTab(_tab)) {
    SignalsProperties * w=static_cast<SignalsProperties *>(pp->currentTabWidget());
    w->setCurrentSubPool(_subPool);
    pp->addReference(this);
  } else {
    SignalsProperties * w=new SignalsProperties;
    w->setCurrentSubPool(_subPool);
    pp->addTab(_tab, tr("Signals"), w, this);
  }
  GridPlot::addProperties(pp);
}
double GeopsyGui::SignalLayer::afterPickDelay ( ) const [inline]
{return _afterPickDelay;}
const QString& GeopsyGui::SignalLayer::aroundPickName ( ) const [inline]
{return _aroundPickName;}
double GeopsyGui::SignalLayer::beforePickDelay ( ) const [inline]
{return _beforePickDelay;}

References _signalColors, and TRACE.

Referenced by MagnifierSignal::setSignal().

{
  TRACE;
  LayerLocker ll(this);
  _signalColors.clear();
}
Clip GeopsyGui::SignalLayer::clip ( ) const [inline]

Referenced by clipString().

{return _clip;}
double GeopsyGui::SignalLayer::clipPerc ( ) const [inline]
{return _clipPerc;}

References clip(), ClipOverlap, ClipPercentage, ClipValue, and TRACE.

{
  TRACE;
  switch (clip()) {
  case ClipOverlap:
    return "ClipOverlap";
  case ClipPercentage:
    return "ClipPercentage";
  case ClipValue:
    return "ClipValue";
  default:
    return "NoClip";
  };
}
double GeopsyGui::SignalLayer::clipValue ( ) const [inline]
{return _clipValue;}
{return _customTimeRange;}
void GeopsyGui::SignalLayer::drawGaps ( const GraphContentOptions gc,
QPainter &  p,
const Signal sig,
int  iSig 
) const [protected]

References _signalY, GeopsyCore::SparseTimeRange::intersection(), GeopsyCore::SparseTimeRange::invert(), GeopsyCore::Signal::timeRange(), QGpCoreTools::tr(), SciFigs::GraphContentOptions::xr2s(), SciFigs::GraphContentOptions::xVisMax(), SciFigs::GraphContentOptions::xVisMin(), and SciFigs::GraphContentOptions::yr2s().

Referenced by paintData().

{
  const SparseTimeRange& signalRange=sig->timeRange();
  ::TimeRange gcLimits(gc.xVisMin(), gc.xVisMax());
  SparseTimeRange gaps=signalRange.invert(false);
  gaps.intersection(gcLimits);
  const QVector< ::TimeRange >& g=gaps.ranges();
  int n=g.count();
  if(n==0) return;
  p.save();
  int wtop=gc.yr2s(_signalY[ iSig ] - 0.375);
  int wheight=gc.yr2s(_signalY[ iSig ] + 0.375) - wtop;
  int * wleft=new int [ n ];
  int * wwidth=new int [ n ];
  p.setPen(QPen( Qt::NoPen) );
  p.setBrush(QBrush( QColor(254, 156, 158, 128) ));
  for(int i=0; i<n; i++) {
    const ::TimeRange& tr=g.at(i);
    wleft[ i ]=gc.xr2s(tr.start());
    wwidth[ i ]=gc.xr2s(tr.end()) - wleft[ i ];
    p.drawRect(wleft[ i ], wtop, wwidth[ i ], wheight);
  }
  p.setPen(QPen( QColor(255, 75, 78), 1, Qt::SolidLine) );
  p.setBrush(QBrush( Qt::NoBrush) );
  for(int i=0; i<n; i++) {
    p.drawRect(wleft[ i ], wtop, wwidth[ i ], wheight);
  }
  delete [] wleft;
  delete [] wwidth;
  p.restore();
}
void GeopsyGui::SignalLayer::drawingAmplitude ( const Signal sig,
int  itmin,
int  itmax,
double &  valClip,
double &  affMax 
) const [protected]

affMax is the conversion factor from amplitude units to display units. For instance, when various signals are ploted in the same graph, the display unit for each signal vary from -0.5 to 0.5 at an overlap of 1. affMax is computed outside this function for all normalizations including all signals.

References _clip, _clipPerc, _clipValue, _normalize, _normalizeValue, _overlap, _signalOverlaps, _subPool, ClipOverlap, ClipPercentage, ClipValue, GeopsyCore::SubSignalPool::count(), GeopsyCore::Signal::maximumAmplitude(), NoClip, NormalizeAll, NormalizeOne, NormalizeValue, NormalizeVisibleAll, NormalizeVisibleOne, Overlayed, SAFE_UNINITIALIZED, TRACE, GeopsyCore::DoubleSignal::type(), and yAxis().

Referenced by drawSignal(), and updateGrid().

{
  TRACE;
  double vmax;
  SAFE_UNINITIALIZED(vmax,0);
  if(_subPool->count() > 1 && yAxis()!=Overlayed) {
    switch (sig->type()) {
    case Signal::Waveform:
      switch (_normalize) {
      case NormalizeAll:
        vmax=sig->maximumAmplitude();
        break;
      case NormalizeVisibleAll:
        vmax=sig->maximumAmplitude(itmin, itmax);
        break;
      case NormalizeOne:
        vmax=sig->maximumAmplitude();
        if(vmax==0. ) vmax=1.;
        affMax=0.5/vmax;
        break;
      case NormalizeVisibleOne:
        vmax=sig->maximumAmplitude(itmin, itmax);
        if(vmax==0. ) vmax=1.;
        affMax=0.5/vmax;
        break;
      case NormalizeValue:
        vmax=sig->maximumAmplitude();
        affMax=0.5/_normalizeValue;
        break;
      }
      break;
    case Signal::CAmpWaveform:
    case Signal::RealSpectrum:
    case Signal::Spectrum:
      switch (_normalize) {
      case NormalizeAll:
        vmax=sig->maximumAmplitude();
        break;
      case NormalizeVisibleAll:
        vmax=sig->maximumAmplitude(itmin, itmax);
        break;
      case NormalizeOne:
        vmax=sig->maximumAmplitude();
        if(vmax==0. ) vmax=1.;
        affMax=1.0/vmax;
        break;
      case NormalizeVisibleOne:
        vmax=sig->maximumAmplitude(itmin, itmax);
        if(vmax==0. ) vmax=1.;
        affMax=1.0/vmax;
        break;
      case NormalizeValue:
        vmax=sig->maximumAmplitude();
        affMax=1.0/_normalizeValue;
        break;
      }
      break;
    case Signal::CPhaseWaveform:
    case Signal::Phase:
      affMax=0.5/M_PI * _overlap;
      valClip=M_PI;
      return;
    case Signal::ArrivalTime:
    case Signal::UndefinedSignalType:
      affMax=0.5 * _overlap;
      valClip=1.0;
      return;
    }
    affMax *= _overlap;
    QMap<const Signal *, double>::const_iterator it=_signalOverlaps.find(sig);
    if(it!=_signalOverlaps.end()) {
      affMax *= it.value();
    }
    switch (_clip) {
    case NoClip: valClip=vmax; break;
    case ClipOverlap: valClip=0.9/affMax; break;
    case ClipValue: valClip=_clipValue; break;
    case ClipPercentage: valClip=vmax * _clipPerc * 0.01;
    }
  } else {
    affMax=1.0;
    switch (_normalize) {
    case NormalizeAll:
    case NormalizeOne:
    case NormalizeValue:
      switch (sig->type()) {
      case Signal::Waveform:
      case Signal::ArrivalTime:
      case Signal::UndefinedSignalType:
      case Signal::RealSpectrum:
      case Signal::CAmpWaveform:
      case Signal::Spectrum:
        vmax=sig->maximumAmplitude();
        break;
       case Signal::CPhaseWaveform:
      case Signal::Phase:
        vmax=M_PI;
        break;
      }
      break;
    case NormalizeVisibleAll:
    case NormalizeVisibleOne: {
        double vmin;
        SAFE_UNINITIALIZED(vmin,0);
        vmax=sig->maximumAmplitude(itmin, itmax);
        switch (sig->type()) {
        case Signal::Waveform:
        case Signal::ArrivalTime:
        case Signal::UndefinedSignalType:
          vmin=-vmax;
          break;
        case Signal::RealSpectrum:
        case Signal::CAmpWaveform:
        case Signal::Spectrum:
          vmin=0;
          break;
        case Signal::CPhaseWaveform:
        case Signal::Phase:
          vmin=-M_PI;
          vmax=M_PI;
          break;
        }
      }
      break;
    }
    switch (_clip) {
    case NoClip:
    case ClipOverlap: valClip=vmax; break;
    case ClipValue: valClip=_clipValue; break;
    case ClipPercentage: valClip=vmax * _clipPerc * 0.01;
    }
  }
}
void GeopsyGui::SignalLayer::drawSignal ( const GraphContentOptions gc,
QPainter &  p,
const Signal sig,
int  iSig,
int  itmin,
int  itmax,
double  x0,
double  dx,
bool  allSamplesVisible,
double  affMax,
int  pixelWidth,
bool  variableArea,
bool  wiggleTrace 
) const [protected]

References _normalize, _offset, _signalY, _subPool, GeopsyCore::DoubleSignal::amplitude(), GeopsyCore::Signal::averageAmplitude(), SciFigs::GraphContentOptions::ay(), CONST_LOCK_SAMPLES, GeopsyCore::SubSignalPool::count(), drawingAmplitude(), GlobalOffset, GeopsyCore::DoubleSignal::isSpectrum(), GeopsyCore::Signal::maximumAmplitude(), NoOffset, NormalizeAll, GeopsyCore::DoubleSignal::phase(), SciFigs::GraphContentOptions::r2s(), SAFE_UNINITIALIZED, TRACE, GeopsyCore::DoubleSignal::type(), UNLOCK_SAMPLES, VisibleOffset, SciFigs::GraphContentOptions::xr2s(), SciFigs::GraphContentOptions::xs2r(), and SciFigs::GraphContentOptions::yr2s().

Referenced by highlightSignal(), and paintData().

{
  TRACE;
  if(itmin >= itmax) return;
  // Introduction : preparing display options
  // ----------------------------------------
  double valClip;
  if(( _normalize & NormalizeAll) &&
      (sig->type()==Signal::Spectrum ||
        sig->type()==Signal::RealSpectrum) ) affMax *= 2;
  drawingAmplitude(sig, itmin, itmax, valClip, affMax);
  if(_subPool->count() > 1) {
    // Even if y axis is reversed keep positive signal up
    if(gc.ay() > 0) affMax=-affMax;
  }

  // Core Routine: drawing
  // ---------------------
  double y0;
  SAFE_UNINITIALIZED(y0,0);
  // Do not remove offset for spectra
  if(sig->isSpectrum()) {
    y0=_signalY[ iSig ];
  } else {
    switch(_offset) {
    case NoOffset: y0=_signalY[ iSig ]; break;
    case GlobalOffset: y0=_signalY[ iSig ] - sig->averageAmplitude() * affMax;; break;
    case VisibleOffset: y0=_signalY[ iSig ] - sig->averageAmplitude(itmin, itmax) * affMax;; break;
    }
  }
  // For phase ploting max spectrum is required, not for other modes.
  // This is taken out of the general lock to avoid recursive locks of signal samples
  // Normalizeally ok but mix of write and read locks are not fully recursives (bug fixed in Qt 4.4.0)
  double globalMaxSpec;
  SAFE_UNINITIALIZED(globalMaxSpec,0);
  switch (sig->type()) {
  case Signal::CPhaseWaveform:
  case Signal::Phase:
    globalMaxSpec=sig->maximumAmplitude();
    break;
  default:
    break;
  }
  CONST_LOCK_SAMPLES(double, samples, sig)
    // Plot a line at each sample from min to max observed in a pixel interval
    // Variable area just extend interval to 0 if min and max have the same sign
    if( !allSamplesVisible && (wiggleTrace || variableArea) ) {
      double val, minVal, maxVal;
      double x=x0, x_step;
      int i=itmin;
      int ix=gc.xr2s(x0);
      int iy1, iy2, iy1n, iy2n;
      switch (sig->type()) {
      case Signal::Waveform:
      case Signal::RealSpectrum:
        maxVal=samples[ i ];
        if(maxVal > valClip) maxVal=valClip;
        else if(maxVal < -valClip) maxVal=-valClip;
        iy1=gc.yr2s(y0 + maxVal * affMax);
        iy2=iy1;
        for( ;ix < pixelWidth && i < itmax;ix++ ) {
          x_step=gc.xs2r(ix);
          minVal=samples[ i ];
          maxVal=minVal;
          while(x < x_step && i < itmax) {
            val=samples[ i ];
            if(val < minVal) minVal=val;
            else if(val > maxVal) maxVal=val;
            i++;
            x += dx;
          }
          if(maxVal > valClip) maxVal=valClip;
          else if(maxVal < -valClip) maxVal=-valClip;
          if(minVal > valClip) minVal=valClip;
          else if(minVal < -valClip) minVal=-valClip;
          if(variableArea && minVal > 0.0) minVal=0;
          iy1n=gc.yr2s(y0 + maxVal * affMax);
          iy2n=gc.yr2s(y0 + minVal * affMax);
          if(iy2<iy1n || iy1>iy2n) {
            p.drawLine(ix-1, iy2, ix, iy1n);
          }
          iy1=iy1n;
          iy2=iy2n;
          if(iy2==iy1) {
            p.drawPoint(ix, iy1);
          } else {
            p.drawLine(ix, iy2, ix, iy1);
          }
        }
        break;
      case Signal::CAmpWaveform:
      case Signal::Spectrum:
        maxVal=sig->amplitude(samples, i);
        if(maxVal > valClip) maxVal=valClip;
        iy1=gc.yr2s(y0 + maxVal * affMax);
        iy2=iy1;
        for( ;ix < pixelWidth && i < itmax;ix++ ) {
          x_step=gc.xs2r(ix);
          minVal=sig->amplitude(samples, i);
          maxVal=minVal;
          while(x < x_step && i < itmax) {
            val=sig->amplitude(samples, i);
            if(val < minVal) minVal=val;
            else if(val > maxVal) maxVal=val;
            i++;
            x += dx;
          }
          if(maxVal > valClip) {
            maxVal=valClip;
            if(minVal > valClip) minVal=valClip;
          }
          if(variableArea && minVal > 0.0) minVal=0;
          iy1n=gc.yr2s(y0 + maxVal * affMax);
          iy2n=gc.yr2s(y0 + minVal * affMax);
          if(iy2<iy1n || iy1>iy2n) {
            p.drawLine(ix-1, iy2, ix, iy1n);
          }
          iy1=iy1n;
          iy2=iy2n;
          if(iy2==iy1) {
            p.drawPoint(ix, iy1);
          } else {
            p.drawLine(ix, iy2, ix, iy1);
          }
        }
        break;
      case Signal::CPhaseWaveform:
      case Signal::Phase: {
          maxVal=sig->phase(samples, i);
          if(maxVal > valClip) maxVal=valClip;
          else if(maxVal < -valClip) maxVal=-valClip;
          iy1=gc.yr2s(y0 + maxVal * affMax);
          iy2=iy1;
          for( ;ix < pixelWidth && i < itmax;ix++ ) {
            x_step=gc.xs2r(ix);
            minVal=sig->phase(samples, i);
            maxVal=minVal;
            double maxSpec=0, valSpec;
            while(x < x_step && i < itmax) {
              val=sig->phase(samples, i);
              valSpec=sig->amplitude(samples, i);
              if(valSpec > maxSpec) maxSpec=valSpec;
              if(val < minVal) minVal=val;
              else if(val > maxVal) maxVal=val;
              i++;
              x += dx;
            }
            if(maxVal > valClip) maxVal=valClip;
            else if(maxVal < -valClip) maxVal=-valClip;
            if(minVal > valClip) minVal=valClip;
            else if(minVal < -valClip) minVal=-valClip;
            if(variableArea && minVal > 0) minVal=0;
            int specColor=(int) (255 * (1 - maxSpec/globalMaxSpec) );
            p.setPen(QColor( specColor, specColor, specColor) );
            iy1n=gc.yr2s(y0 + maxVal * affMax);
            iy2n=gc.yr2s(y0 + minVal * affMax);
            if(iy2<iy1n || iy1>iy2n) {
              p.drawLine(ix-1, iy2, ix, iy1n);
            }
            iy1=iy1n;
            iy2=iy2n;
          }
        }
      case Signal::ArrivalTime:
      case Signal::UndefinedSignalType:
        break;
      }
    } else {
      if(wiggleTrace) {
        switch (sig->type()) {
        case Signal::Waveform:
        case Signal::RealSpectrum: {
            double val=samples[ itmin ];
            if(val > valClip) val=valClip;
            else if(val < -valClip) val=-valClip;
            double x=x0;
            QPoint p1=gc.r2s(x, y0 + val * affMax);
            x += dx;
            for(int i=itmin + 1; i <= itmax; i++, x += dx) {
              val=samples[ i ];
              if(val > valClip) val=valClip;
              else if(val < -valClip) val=-valClip;
              QPoint p2=gc.r2s(x, y0 + val * affMax);
              p.drawLine(p1, p2);
              p1=p2;
            }
          }
          break;
        case Signal::CAmpWaveform:
        case Signal::Spectrum: {
            double val=sig->amplitude(samples, itmin);
            if(val > valClip) val=valClip;
            double x=x0;
            QPoint p1=gc.r2s(x, y0 + val * affMax);
            x += dx;
            for(int i=itmin + 1; i <= itmax; i++, x += dx) {
              val=sig->amplitude(samples, i);
              if(val > valClip) val=valClip;
              QPoint p2=gc.r2s(x, y0 + val * affMax);
              p.drawLine(p1, p2);
              p1=p2;
            }
          }
          break;
        case Signal::CPhaseWaveform:
        case Signal::Phase: {
            double val=sig->phase(samples, itmin);
            if(val > valClip) val=valClip;
            else if(val < -valClip) val=-valClip;
            double x=x0;
            QPoint p1=gc.r2s(x, y0 + val * affMax);
            x += dx;
            for(int i=itmin + 1; i <= itmax; i++, x += dx) {
              val=sig->phase(samples, i);
              if(val > valClip) val=valClip;
              else if(val < -valClip) val=-valClip;
              QPoint p2=gc.r2s(x, y0 + val * affMax);
              int specColor=(int) (255 * (1 - sig->amplitude(samples, i)/globalMaxSpec) );
              p.setPen(QColor( specColor, specColor, specColor) );
              p.drawLine(p1, p2);
              p1=p2;
            }
          }
        case Signal::ArrivalTime:
        case Signal::UndefinedSignalType:
          break;
        }
      }
      if(variableArea) {
        const int NPTS=500;
        QPoint pSeq[ NPTS + 5 ];
        int n;
        double val;
        switch (sig->type()) {
        case Signal::Waveform:
        case Signal::RealSpectrum: {
            n=0;
            double x=x0;
            for(int i=itmin; i <= itmax; i++, x += dx) {
              val=samples[ i ];
              if(val > valClip) val=valClip;
              else if(val < -valClip) val=-valClip;
              if(val >= 0. ) {
                if( !n) {
                  if(i==itmin) {
                    pSeq[ n ]=gc.r2s(x, y0);
                    n++;
                  } else {
                    double inter=samples[ i ]/(samples[ i ] - samples[ i - 1 ] );
                    pSeq[ n ]=gc.r2s(x - inter * dx, y0);
                    n++;
                  }
                }
                pSeq[ n ]=gc.r2s(x, y0 + val * affMax);
                n++;
                if(n >= NPTS) {
                  pSeq[ n ]=gc.r2s(x, y0);
                  n++;
                  p.drawPolygon(pSeq, n);
                  pSeq[ 0 ]=pSeq[ n - 1 ];
                  pSeq[ 1 ]=pSeq[ n - 2 ];
                  n=2;
                }
              } else {
                if(n) {
                  double inter=samples[ i ]/(samples[ i - 1 ] - samples[ i ] );
                  pSeq[ n ]=gc.r2s(x + inter * dx, y0);
                  n++;
                  p.drawPolygon(pSeq, n);
                  n=0;
                }
              }
            }
            if(n) {
              pSeq[ n ]=gc.r2s(x - dx, y0);
              n++;
              p.drawPolygon(pSeq, n);
              n=0;
            }
          }
          break;
        case Signal::CAmpWaveform:
        case Signal::Spectrum: {
            double x=x0;
            pSeq[ 0 ]=gc.r2s(x, y0);
            n=1;
            for(int i=itmin; i <= itmax; i++, x += dx) {
              val=sig->amplitude(samples, i);
              if(val > valClip) val=valClip;
              pSeq[ n ]=gc.r2s(x, y0 + val * affMax);
              n++;
              if(n >= NPTS || pSeq[ n - 1 ].y()==pSeq[ 0 ].y()) {
                pSeq[ n ]=gc.r2s(x, y0);
                n++;
                p.drawPolygon(pSeq, n);
                pSeq[ 0 ]=pSeq[ n - 1 ];
                pSeq[ 1 ]=pSeq[ n - 2 ];
                n=2;
              }
            }
            if(n) {
              pSeq[ n ]=gc.r2s(x - dx, y0);
              n++;
              p.drawPolygon(pSeq, n);
              n=0;
            }
          }
          break;
        case Signal::CPhaseWaveform:
        case Signal::Phase: {
            n=0;
            double x=x0;
            for(int i=itmin; i <= itmax; i++, x += dx) {
              int specColor=(int) (255 * (1 - sig->amplitude(samples, i)/globalMaxSpec) );
              p.setPen(QColor( specColor, specColor, specColor) );
              val=sig->phase(samples, i);
              if(val > valClip) val=valClip;
              else if(val < -valClip) val=-valClip;
              if(val >= 0. ) {
                if( !n) {
                  if(i==itmin) {
                    pSeq[ n ]=gc.r2s(x, y0);
                    n++;
                  } else {
                    val=sig->phase(samples, i); // unclipped only
                    double inter=val/(val - sig->phase(samples, i - 1) );
                    pSeq[ n ]=gc.r2s(x - inter * dx, y0);
                    n++;
                  }
                }
                pSeq[ n ]=gc.r2s(x, y0 + val * affMax);
                n++;
                if(n >= NPTS) {
                  pSeq[ n ]=gc.r2s(x, y0);
                  n++;
                  p.drawPolygon(pSeq, n);
                  pSeq[ 0 ]=pSeq[ n - 1 ];
                  pSeq[ 1 ]=pSeq[ n - 2 ];
                  n=2;
                }
              } else {
                if(n) {
                  val=sig->phase(samples, i); // unclipped only
                  double inter=val/(sig->phase(samples, i - 1) - val);
                  pSeq[ n ]=gc.r2s(x + inter * dx, y0);
                  n++;
                  p.drawPolygon(pSeq, n);
                  n=0;
                }
              }
            }
            if(n) {
              pSeq[ n ]=gc.r2s(x - dx, y0);
              n++;
              p.drawPolygon(pSeq, n);
              n=0;
            }
          }
        case Signal::ArrivalTime:
        case Signal::UndefinedSignalType:
          break;
        }
      }
    }
  UNLOCK_SAMPLES(sig);
}
bool GeopsyGui::SignalLayer::grid ( ) const [inline]
{return _gridPlot;}
virtual bool GeopsyGui::SignalLayer::hasProperties ( ) [inline, virtual]

Reimplemented from SciFigs::GridPlot.

{return true;}
void GeopsyGui::SignalLayer::highlightSignal ( const GraphContentOptions gc,
QPainter &  p,
int  w,
int  iSig,
int  isigmin,
int  isigmax 
) const

References _subPool, GeopsyCore::SubSignalPool::at(), drawSignal(), maxAmplitude(), TRACE, GeopsyCore::DoubleSignal::type(), and visibleSamples().

Referenced by GeopsyGui::PickLayer::paintData().

{
  TRACE;
  if(iSig < isigmin) return ;
  if(iSig >= isigmax) return ;
  Signal * sig=_subPool->at(iSig);
  p.setPen(QPen(Qt::red, 1));
  int itmin, itmax;
  double x0, dx;
  // Useful only for NormalizeAll and NormalizeVisibleAll
  double affMax=0.5/maxAmplitude(gc);
  if(sig->type()==Signal::Spectrum ||
        sig->type()==Signal::RealSpectrum) affMax *= 2;
  bool allSamplesVisible=visibleSamples(gc, sig, itmin, itmax, x0, dx);
  drawSignal(gc, p, sig, iSig, itmin, itmax, x0, dx, allSamplesVisible, affMax, w, false, true);
}
bool GeopsyGui::SignalLayer::keyPressEvent ( QKeyEvent *  e) [protected, virtual]

Reimplemented from SciFigs::GraphContentLayer.

{
  if(e->modifiers() & Qt::ShiftModifier) {
    e->accept();
    switch (e->key()) {
    case Qt::Key_Up:
      spinOverlap(1, false, 0);
      break;
    case Qt::Key_Down:
      spinOverlap( -1, false, 0);
      break;
    }
    return false;
  }
  return true;
}
double GeopsyGui::SignalLayer::maxAmplitude ( const GraphContentOptions gc) const [protected]

Find the maximum amplitude across all traces of current subpool. Returns 0 if normalize() is not NormalizeAll or NormalizeVisibleAll

References _normalize, _subPool, GeopsyCore::SubSignalPool::at(), GeopsyCore::SubSignalPool::count(), GeopsyCore::geopsyCore, GeopsyCore::Signal::maximumAmplitude(), NormalizeAll, NormalizeOne, NormalizeValue, NormalizeVisibleAll, NormalizeVisibleOne, GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), TRACE, and visibleSamples().

Referenced by highlightSignal(), paintData(), and updateGrid().

{
  TRACE;
  double vmax=0.0;
  int n=_subPool->count();
  geopsyCore->setProgressMaximum (n-1);
  switch(_normalize) {
  case NormalizeAll:
    for(int i=0;i < n;i++ ) {
      const Signal * sig=_subPool->at(i);
      double val=sig->maximumAmplitude();
      if(val > vmax) vmax=val;
      geopsyCore->setProgressValue (i);
    }
    break;
  case NormalizeVisibleAll:
    int iMin, iMax;
    for(int i=0;i < n;i++ ) {
      const Signal * sig=_subPool->at(i);
      visibleSamples(gc, sig, iMin, iMax);
      double val=sig->maximumAmplitude(iMin, iMax);
      if(val > vmax) vmax=val;
      geopsyCore->setProgressValue (i);
    }
    break;
  case NormalizeOne:
  case NormalizeValue:
  case NormalizeVisibleOne:
    break;
  }
  return vmax;
}
void GeopsyGui::SignalLayer::minMaxY ( double &  min,
double &  max 
) const

Gives the min and max for Y to show all signals

References _signalY, _subPool, _yAxis, GeopsyCore::SubSignalPool::at(), GeopsyCore::SubSignalPool::count(), GeopsyCore::SubSignalPool::first(), GeopsyCore::Signal::maximumAmplitude(), Overlayed, Receiver, SignalName, TRACE, GeopsyCore::DoubleSignal::type(), and ViewerIndex.

Referenced by boundingRect(), ManualPick::init(), GraphicWindow::setLimits(), SignalViewer::setSignals(), and GraphicWindow::signalsUpdate().

{
  TRACE;
  int n=_subPool->count();
  if(n<=0) return ;
  if(n==1) {
    Signal * sig=_subPool->first();
    max=sig->maximumAmplitude();
    switch (sig->type()) {
    case Signal::Waveform:
      min=-max; break;
    case Signal::RealSpectrum:
    case Signal::CAmpWaveform:
    case Signal::Spectrum:
      min=0; break;
    case Signal::CPhaseWaveform:
    case Signal::Phase:
      min=-M_PI;
      max=M_PI;
    case Signal::ArrivalTime:
    case Signal::UndefinedSignalType:
      break;
    }
    return ;
  }
  // find min and max of base line of signals
  switch(_yAxis) {
  case Receiver: {
      min=1e99;max=-1e99;
      for(int i=0;i < n;i++ ) {
        if(_signalY[ i ] < min) {
          min=_signalY[ i ];
        }
        if(_signalY[ i ] > max) {
          max=_signalY[ i ];
        }
      }
      double delta=0.5*(max - min)/n;
      min-= delta;
      max+= delta;
    }
    break;
  case SignalName:
    min=n; max=0;
    for(int i=0;i < n;i++ ) {
      if(_signalY[ i ] < min) {
        min=_signalY[ i ];
      }
      if(_signalY[ i ] > max) {
        max=_signalY[ i ];
      }
    }
    min -= 0.5;
    max += 0.5;
    break;
  case ViewerIndex:
    min=0.5;
    max=n + 0.5;
    break;
  case Overlayed: {
      min=1e99;max=-1e99;
      double mini, maxi;
      for(int i=0;i < n;i++ ) {
        Signal * sig=_subPool->at(i);
        maxi=sig->maximumAmplitude();
        switch (sig->type()) {
        case Signal::ArrivalTime:
        case Signal::UndefinedSignalType:
        case Signal::Waveform:
          mini=-maxi;
          break;
        case Signal::RealSpectrum:
        case Signal::CAmpWaveform:
        case Signal::Spectrum:
          mini=0;
          break;
        case Signal::CPhaseWaveform:
        case Signal::Phase:
          mini=-M_PI;
          maxi=M_PI;
          break;
        }
        if(mini<min) min=mini;
        if(maxi>max) max=maxi;
      }
    }
    break;
  }
}

Referenced by normalizeString().

{return _normalize;}

References normalize(), NormalizeOne, NormalizeValue, NormalizeVisibleAll, NormalizeVisibleOne, and TRACE.

{
  TRACE;
  switch (normalize()) {
  case NormalizeOne:
    return "NormalizeOne";
  case NormalizeVisibleAll:
    return "NormalizeVisisibleAll";
  case NormalizeVisibleOne:
    return "NormalizeVisisibleOne";
  case NormalizeValue:
    return "NormalizeValue";
  default:
    return "NormalizeAll";
  };
}
double GeopsyGui::SignalLayer::normalizeValue ( ) const [inline]
{return _normalizeValue;}

Referenced by offsetString().

{return _offset;}

References GlobalOffset, offset(), TRACE, and VisibleOffset.

{
  TRACE;
  switch (offset()) {
  case GlobalOffset:
    return "GlobalOffset";
  case VisibleOffset:
    return "VisibleOffset";
  default:
    return "NoOffset";
  };
}
double GeopsyGui::SignalLayer::overlap ( ) const [inline]

Referenced by sigYBoundaries().

{return _overlap;}
void GeopsyGui::SignalLayer::paintData ( const LayerPainterRequest lp,
QPainter &  p,
double  dotpercm 
) const [protected, virtual]

Implements SciFigs::GraphContentLayer.

References _gridPlot, _subPool, _variableArea, _wiggleTrace, QGpCoreTools::CacheProcess::add(), GeopsyCore::SubSignalPool::at(), drawGaps(), SciFigs::GridPlot::drawGrid2DBlock(), SciFigs::GridPlot::drawGrid2DYSmooth(), drawSignal(), SciFigs::LayerPainterRequest::graphContent(), maxAmplitude(), QGpCoreTools::CacheProcess::next(), SciFigs::LayerPainterRequest::options(), SciFigs::GridPlot::palette(), SAFE_UNINITIALIZED, setIsigMinMax(), SciFigs::GraphContent::setProgressMaximum(), SciFigs::GraphContent::setProgressValue(), signalColor(), SciFigs::LayerPainterRequest::size(), SciFigs::GridPlot::smooth(), SciFigs::LayerPainterRequest::terminated(), TRACE, visibleSamples(), and w.

{
        TRACE;
        if( !_subPool) return ;
        const GraphContentOptions& gc=lp.options();
        int w=lp.size().width();
        // Useful only for NormalizeAll and NormalizeVisibleAll
        double affMax=0.5/maxAmplitude(gc);
  int isigmin, isigmax;
  SAFE_UNINITIALIZED(isigmin, 0);
  SAFE_UNINITIALIZED(isigmax, 0);
  setIsigMinMax(gc, isigmin, isigmax);
  if(_gridPlot) {
    if(smooth())
      drawGrid2DYSmooth( *_gridPlot, palette(), lp, p);
    else
      drawGrid2DBlock( *_gridPlot, palette(), lp, p);
    return ;
  }
  lp.graphContent()->setProgressMaximum (isigmax - isigmin - 1);
  int itmin, itmax;
  double x0, dx;
  CacheProcess cp;
  for(int iSig=isigmin; iSig < isigmax; ++iSig) {
    const Signal * sig=_subPool->at(iSig);
    visibleSamples(gc, sig, itmin, itmax, x0, dx);
    cp.add(_subPool->at(iSig));
  }
  // Really draw signals
  for(int iSig=isigmin; iSig < isigmax; ++iSig) {
    if(lp.terminated()) {
      return;
    }
    const Signal * sig=_subPool->at(iSig);
    lp.graphContent()->setProgressValue(iSig - isigmin);
    bool allSamplesVisible=visibleSamples(gc, sig, itmin, itmax, x0, dx);
    const QColor& c=signalColor(sig);
    p.setPen(c);
    p.setBrush(c);
    drawSignal(gc, p, sig, iSig, itmin, itmax, x0, dx, allSamplesVisible, affMax, w, _variableArea, _wiggleTrace);
    // Paint gaps if any
    drawGaps(gc, p, sig, iSig);
    cp.next();
  }
}
void GeopsyGui::SignalLayer::properties ( PropertyWidget w) const [virtual]

Reimplemented from SciFigs::GridPlot.

References _afterPickDelay, _aroundPickName, _beforePickDelay, _clip, _clipPerc, _clipValue, _customTimeRange, _gridPlot, _normalize, _normalizeValue, _offset, _overlap, _subPool, _tab, _timeRange, _variableArea, _wiggleTrace, _yAxis, GeopsyGui::SignalsProperties::AfterPickDelay, GeopsyGui::SignalsProperties::AroundPickName, GeopsyGui::SignalsProperties::BeforePickDelay, GeopsyGui::SignalsProperties::clip2item(), GeopsyGui::SignalsProperties::ClipMode, ClipPercentage, GeopsyGui::SignalsProperties::ClipValue, GeopsyGui::SignalsProperties::Colors, GeopsyGui::SignalsProperties::CustomRange, GeopsyCore::SubSignalPool::first(), QGpGuiTools::PropertyWidget::id(), GeopsyCore::SubSignalPool::isEmpty(), GeopsyGui::SignalsProperties::IsSpectrum, GeopsyCore::DoubleSignal::isSpectrum(), GeopsyGui::SignalsProperties::Normalize, GeopsyGui::SignalsProperties::normalize2item(), GeopsyGui::SignalsProperties::NormalizeValue, GeopsyGui::SignalsProperties::Offset, GeopsyGui::SignalsProperties::offset2item(), GeopsyGui::SignalsProperties::Overlap, QGpGuiTools::PropertyWidget::setValue(), GeopsyGui::SignalsProperties::TimeRange, GeopsyGui::SignalsProperties::timeRange2item(), TRACE, GeopsyGui::SignalsProperties::VariableArea, GeopsyGui::SignalsProperties::Wiggle, GeopsyGui::SignalsProperties::YAxis, and GeopsyGui::SignalsProperties::yAxis2item().

Referenced by setProperty().

Clean property editor

Reimplemented from SciFigs::GridPlot.

References _tab, and QGpGuiTools::PropertyProxy::removeTab().

void GeopsyGui::SignalLayer::setAfterPickDelay ( double  d) [inline]
void GeopsyGui::SignalLayer::setAroundPickName ( const QString &  pn) [inline]
void GeopsyGui::SignalLayer::setBeforePickDelay ( double  d) [inline]
void GeopsyGui::SignalLayer::setClip ( Clip  c) [inline]
void GeopsyGui::SignalLayer::setClip ( QString  c)

References ClipOverlap, ClipPercentage, ClipValue, NoClip, setClip(), and TRACE.

{
  TRACE;
  if(c.count()<5) return;
  switch(c[4].unicode()) {
  case 'i':
    setClip(NoClip);
    break;
  case 'O':
    setClip(ClipOverlap);
    break;
  case 'V':
    setClip(ClipValue);
    break;
  case 'P':
    setClip(ClipPercentage);
    break;
  default:
    break;
  }
}
void GeopsyGui::SignalLayer::setClipPerc ( double  v) [inline]
{_clipPerc=v;}
void GeopsyGui::SignalLayer::setClipValue ( double  v) [inline]

References _gridPlot, and TRACE.

{
  TRACE;
  if(b) {
    if(!_gridPlot) _gridPlot=new Grid2D<double>(10, 10);
  } else {
    delete _gridPlot;
    _gridPlot=0;
  }
}
void GeopsyGui::SignalLayer::setIsigMinMax ( const GraphContentOptions gc,
int &  isigmin,
int &  isigmax 
) const [inline, protected]

Estimate the visible signals

References _subPool, _yAxis, GeopsyCore::SubSignalPool::count(), Overlayed, Receiver, SignalName, TRACE, ViewerIndex, SciFigs::GraphContentOptions::yVisMax(), and SciFigs::GraphContentOptions::yVisMin().

Referenced by GeopsyGui::PickLayer::paintData(), and paintData().

{
  TRACE;
  int n=_subPool->count();
  switch(_yAxis) {
  case ViewerIndex:
    if(n > 1) {
      if(gc.yVisMin() > 1)
        isigmin=(int) floor(gc.yVisMin()) - 1;
      else isigmin=0;
      isigmax=(int) ceil(gc.yVisMax()) - 1;
      if(isigmax > n) isigmax=n;
    } else {
      isigmin=0;
      isigmax=n;
    }
    break;
  case Receiver: // TODO something better
    isigmin=0;
    isigmax=n;
    break;
  case SignalName:         // TODO something better
    isigmin=0;
    isigmax=n;
    break;
  case Overlayed:
    isigmin=0;
    isigmax=n;
    break;
  }
}

References NormalizeAll, NormalizeOne, NormalizeValue, NormalizeVisibleAll, NormalizeVisibleOne, setNormalize(), and TRACE.

{
  TRACE;
  if(n.count()>=11) {
    switch (n[10].unicode()) {
    case 'n':
      if(n=="NormalizeOne" ) setNormalize(NormalizeOne);
      break;
    case 'l':
      if(n=="NormalizeAll" ) setNormalize(NormalizeAll);
      // Compatibility
      else if(n=="NormAutoAll" ) setNormalize(NormalizeAll);
      break;
    case 'i':
      if(n=="NormalizeVisibleAll" ) setNormalize(NormalizeVisibleAll);
      else if(n=="NormalizeVisibleOne" ) setNormalize(NormalizeVisibleOne);
      break;
    case 'a':
      if(n=="NormalizeValue" ) setNormalize(NormalizeValue);
      break;
    case 'e': // Compatibility
      if(n=="NormAutoOne" ) setNormalize(NormalizeOne);
      break;
    case 'o': // Compatibility
      if(n=="NormVisAutoAll" ) setNormalize(NormalizeVisibleOne);
      else if(n=="NormVisAutoOne" ) setNormalize(NormalizeVisibleAll);
      break;
    default:
      break;
    }
  // Compatibility
  } else if(n=="NormValue" ) setNormalize(NormalizeValue);
}
void GeopsyGui::SignalLayer::setNormalizeValue ( double  v) [inline]
void GeopsyGui::SignalLayer::setOffset ( QString  n)

References GlobalOffset, NoOffset, setOffset(), TRACE, and VisibleOffset.

{
  TRACE;
  if(o.count()<5) return;
  switch(o[0].unicode()) {
  case 'N':
    setOffset(NoOffset);
    break;
  case 'G':
    setOffset(GlobalOffset);
    break;
  case 'V':
    setOffset(VisibleOffset);
    break;
  default:
    break;
  }
}
void GeopsyGui::SignalLayer::setOverlap ( double  v) [inline]

Referenced by setProperty().

{_overlap=v; _signalOverlaps.clear();}
void GeopsyGui::SignalLayer::setProperty ( uint  wid,
int  pid,
QVariant  val 
) [virtual]

Reimplemented from SciFigs::GridPlot.

Reimplemented in SignalDisplay.

References _afterPickDelay, _aroundPickName, _beforePickDelay, _clip, _clipPerc, _clipValue, _customTimeRange, _gridPlot, _normalize, _normalizeValue, _offset, _tab, _timeRange, _variableArea, _wiggleTrace, _yAxis, GeopsyGui::SignalsProperties::AfterPickDelay, GeopsyGui::SignalsProperties::AroundPickName, GeopsyGui::SignalsProperties::BeforePickDelay, GeopsyGui::SignalsProperties::ClipMode, ClipPercentage, GeopsyGui::SignalsProperties::ClipValue, GeopsyGui::SignalsProperties::Colors, GeopsyGui::SignalsProperties::CustomRange, SciFigs::GraphContent::deepUpdate(), SciFigs::GraphContentLayer::graphContent(), GeopsyGui::SignalsProperties::item2clip(), GeopsyGui::SignalsProperties::item2normalize(), GeopsyGui::SignalsProperties::item2offset(), GeopsyGui::SignalsProperties::item2timeRange(), GeopsyGui::SignalsProperties::item2yAxis(), GeopsyGui::SignalsProperties::Normalize, GeopsyGui::SignalsProperties::NormalizeValue, GeopsyGui::SignalsProperties::Offset, GeopsyGui::SignalsProperties::Overlap, propertiesChanged(), setOverlap(), subPoolUpdate(), GeopsyGui::SignalsProperties::TimeRange, TRACE, updateGrid(), GeopsyGui::SignalsProperties::VariableArea, GeopsyGui::SignalsProperties::Wiggle, and GeopsyGui::SignalsProperties::YAxis.

{
  TRACE;
  LayerLocker ll(this);
  if(wid==_tab) {
    switch(pid) {
    case SignalsProperties::Colors:
      if(val.toBool()) {
        if( !_gridPlot) updateGrid();
      } else {
        delete _gridPlot;
        _gridPlot=0;
      }
      break;
    case SignalsProperties::Wiggle:
      _wiggleTrace=val.toBool();
      break;
    case SignalsProperties::VariableArea:
      _variableArea=val.toBool();
      break;
    case SignalsProperties::Normalize:
      _normalize=SignalsProperties::item2normalize(val.toInt());
      break;
    case SignalsProperties::NormalizeValue:
      _normalizeValue=val.toDouble();
      break;
    case SignalsProperties::ClipMode:
      _clip=SignalsProperties::item2clip(val.toInt());
      break;
    case SignalsProperties::ClipValue:
      if(_clip==ClipPercentage) {
        _clipPerc=val.toDouble();
      } else {
        _clipValue=val.toDouble();
      }
      break;
    case SignalsProperties::Overlap:
      setOverlap(val.toDouble());
      break;
    case SignalsProperties::Offset:
      _offset=SignalsProperties::item2offset(val.toInt());
      break;
    case SignalsProperties::YAxis:
      _yAxis=SignalsProperties::item2yAxis(val.toInt());
      subPoolUpdate();
      break;
    case SignalsProperties::TimeRange:
      _timeRange=SignalsProperties::item2timeRange(val.toInt());
      break;
    case SignalsProperties::AroundPickName:
      _aroundPickName=val.toString();
      break;
    case SignalsProperties::BeforePickDelay:
      _beforePickDelay=val.toDouble();
      break;
    case SignalsProperties::AfterPickDelay:
      _afterPickDelay=val.toDouble();
      break;
    case SignalsProperties::CustomRange:
      _customTimeRange=val.value<TimeRangeParameters>();
      break;
    default:
      break;
    }
  } else {
    GridPlot::setProperty(wid, pid, val);
  }
  emit propertiesChanged();
  graphContent()->deepUpdate();
}
void GeopsyGui::SignalLayer::setReceiverYAxis ( bool  rc) [inline]
void GeopsyGui::SignalLayer::setSignalColor ( const Signal sig,
const QColor &  c 
)

Set color for signal sig. The color of a signal is defined in a map. If c is black, then the entry for sig is removed from the map.

References _signalColors, and TRACE.

Referenced by ToolNR::highlightShot(), MagnifierSignal::setSignal(), and xml_setProperty().

{
  TRACE;
  LayerLocker ll(this);
  QMap<const Signal *, QColor>::iterator it=_signalColors.find(sig);
  if(c==Qt::black) {
    if(it!=_signalColors.end()) {
      _signalColors.remove(sig);
    }
  } else {
    if(it!=_signalColors.end()) {
      _signalColors[sig]=c;
    } else {
      _signalColors.insert(sig,c);
    }
  }
}

References QGpCoreTools::tr().

Referenced by setTimeRange().

References AroundPickRange, AvailableRange, CustomRange, setTimeRange(), and TRACE.

{
  TRACE;
  if(tr.count()<2) return;
  switch(tr[1].unicode()) {
  case 'v':
    setTimeRange(AvailableRange);
    break;
  case 'r':
    setTimeRange(AroundPickRange);
    break;
  case 'u':
    setTimeRange(CustomRange);
    break;
  default:
    break;
  }
}
void GeopsyGui::SignalLayer::setVariableArea ( bool  b) [inline]
void GeopsyGui::SignalLayer::setWiggleTrace ( bool  b) [inline]

Referenced by setYAxis().

{_yAxis=a;}
void GeopsyGui::SignalLayer::setYAxis ( QString  a)

References Overlayed, Receiver, setYAxis(), SignalName, TRACE, and ViewerIndex.

{
  TRACE;
  if(a.isEmpty()) return;
  switch(a[0].unicode()) {
  case 'O':
    setYAxis(Overlayed);
    break;
  case 'R':
    setYAxis(Receiver);
    break;
  case 'S':
    setYAxis(SignalName);
    break;
  case 'V':
    setYAxis(ViewerIndex);
    break;
  default:
    break;
  }
}
int GeopsyGui::SignalLayer::signalAt ( int  yPos,
double &  baseDistance 
) const

Return the index of signal at position Y yPos. Return -1 is subPool is empty. baseDistance is set to the ditance between yPos and the base line of returned signal.

References _signalY, _subPool, GeopsyCore::SubSignalPool::count(), SciFigs::GraphContentLayer::graphContent(), SciFigs::GraphContent::options(), TRACE, and SciFigs::GraphContentOptions::ys2r().

Referenced by GeopsyGui::PickLayer::mouseMoveEvent(), and GeopsyGui::PickLayer::mousePressEvent().

{
  TRACE;
  int n=_subPool->count();
  if(n < 1) return -1;
  double yd=graphContent()->options().ys2r(yPos);
  // Find which signal has the closest base line to yd
  int iSig=0;
  double d=fabs(_signalY[ 0 ] - yd);
  baseDistance=d;
  for(int i=1;i < n;i++ ) {
    d=fabs(_signalY[ i ] - yd);
    if(d < baseDistance) {
      baseDistance=d;
      iSig=i;
    }
  }
  return iSig;
}
const QColor & GeopsyGui::SignalLayer::signalColor ( const Signal sig) const

Return color for signal sig. The color of a signal is defined in a map.

References _signalColors.

Referenced by paintData().

{
  QMap<const Signal *, QColor>::const_iterator it=_signalColors.find(sig);
  if(it!=_signalColors.end()) {
    return it.value();
  } else {
    static const QColor black=Qt::black;
    return black;
  }
}
void GeopsyGui::SignalLayer::sigYBoundaries ( int  index,
double  overlap,
QRect &  bound 
) const

Set the Y limits of the rectangle to include signal with index

References _signalY, SciFigs::GraphContentLayer::graphContent(), overlap(), and TRACE.

Referenced by GeopsyGui::PickLayer::mousePressEvent().

{
  TRACE;
  double h=0.5 * overlap;
  bound.setTop(graphContent()->options().yr2s(_signalY[ index ] + h) );
  bound.setBottom(graphContent()->options().yr2s(_signalY[ index ] - h) );
}

References _gridPlot, _signalY, _subPool, _subPoolOwner, _yAxis, GeopsyCore::SubSignalPool::at(), GeopsyCore::SubSignalPool::begin(), GeopsyCore::SubSignalPool::count(), GeopsyCore::SubSignalPool::end(), GeopsyCore::Signal::nameComponent(), Overlayed, QGpCoreTools::Curve< pointType >::project(), Receiver, GeopsyCore::SubSignalPool::receivers(), SignalName, subPool(), TRACE, updateGrid(), and ViewerIndex.

Referenced by ManualPick::init(), SignalDisplay::setProperty(), setProperty(), SignalViewer::setSignals(), GraphicWindow::subPoolUpdate(), and xml_polish().

{
  TRACE;
  LayerLocker ll(this);
  if(subPool) {
    _subPool=subPool;
    _subPoolOwner=false;
  }
  if( !_subPool) {
    return;
  }
  // Y axis type options
  _signalY.resize(_subPool->count());
  if(_subPool->count()==1) {
    _signalY[ 0 ]=0.0;
  } else {
    switch(_yAxis) {
    case Receiver:
      _signalY=_subPool->receivers().project();
      break;
    case ViewerIndex:
      for(int i=0;i < _subPool->count();i++ ) {
        _signalY[ i ]=i + 1;
      }
      break;
    case SignalName: {
        QMap<QString,int> names;
        for(SubSignalPool::iterator it=_subPool->begin(); it!=_subPool->end(); it++ ) {
          names.insert((*it)->nameComponent(), 0);
        }
        int i=0;
        for(QMap<QString,int>::iterator it=names.begin();it!=names.end();it++) {
          it.value()=i++;
        }
        int n= _subPool->count();
        for(int i=0;i < n;i++ ) {
          _signalY[ i ]=names[ _subPool->at(i)->nameComponent() ]+1;
        }
      }
      break;
    case Overlayed:
      for(int i=0;i < _subPool->count();i++ ) {
        _signalY[ i ]=0.0;
      }
      break;
    }
  }
  if(_gridPlot) updateGrid();
}

Referenced by timeRangeString().

{return _timeRange;}

References AroundPickRange, AvailableRange, CustomRange, timeRange(), and TRACE.

{
  TRACE;
  switch (timeRange()) {
  case CustomRange:
    break;
  case AroundPickRange:
    return "AroundPickRange";
  case AvailableRange:
    return "AvailableRange";
  };
  return "CustomRange";
}
void GeopsyGui::SignalLayer::updateGrid ( ) [protected]

References _gridPlot, _normalize, _subPool, GeopsyCore::DoubleSignal::amplitude(), GeopsyCore::SubSignalPool::begin(), CONST_LOCK_SAMPLES, GeopsyCore::SubSignalPool::count(), GeopsyCore::DoubleSignal::deltaF(), GeopsyCore::DoubleSignal::deltaT(), drawingAmplitude(), GeopsyCore::SubSignalPool::end(), SciFigs::GraphContentLayer::graphContent(), GeopsyCore::SubSignalPool::isEmpty(), maxAmplitude(), MSG_ID, NormalizeAll, GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::DoubleSignal::phase(), SAFE_UNINITIALIZED, QGpCoreTools::Grid2D< ValueType >::setDeltaX(), QGpCoreTools::Grid2D< ValueType >::setOrigin(), GeopsyCore::Signal::t0(), TRACE, GeopsyCore::DoubleSignal::type(), UNLOCK_SAMPLES, QGpCoreTools::Grid2D< ValueType >::valuePointer(), and visibleSamples().

Referenced by setProperty(), signalsUpdate(), and subPoolUpdate().

{
  TRACE;
  if(!_subPool || _subPool->isEmpty()) return;
  // delete previously created grid
  delete _gridPlot;
  // Get time limits and sampling step
  double t0, deltaT;
  int n=-1, nSamples2;
  DoubleSignal::SignalType sType;
  SAFE_UNINITIALIZED(sType,DoubleSignal::UndefinedSignalType);
  SAFE_UNINITIALIZED(deltaT,0);
  SAFE_UNINITIALIZED(t0,0);
  SAFE_UNINITIALIZED(nSamples2,0);
  // Useful only for NormalizeAll and NormalizeVisibleAll
  double affMax0=0.5/maxAmplitude(graphContent()->options());
  SubSignalPool::iterator it;
  // Check if uniform t0 and dt
  for(it=_subPool->begin(); it!=_subPool->end(); ++it) {
    Signal * sig=*it;
    double it0, ideltaT;
    int in=sig->nSamples();
    DoubleSignal::SignalType isType=sig->type();
    switch (sig->type()) {
    case Signal::Waveform:
      ideltaT=sig->deltaT();
      it0=sig->t0();
      break;
    case Signal::RealSpectrum:
      ideltaT=sig->deltaF();
      it0=0;
      break;
    case Signal::Spectrum: {
        double fNyquist=0.5/sig->deltaT();
        ideltaT=2 * fNyquist/(double) in;
        it0=0;
      }
    default:
      Message::warning(MSG_ID, "Building signal grid",
                           "Only Waveform and spectra can be used to build a colored grid",
                           Message::cancel());
      _gridPlot=0;
      return;
    }
    if(n==-1) {
      sType=isType;
      t0=it0;
      n=in;
      deltaT=ideltaT;
      nSamples2=in/2;
    } else if(it0!=t0 || in!=n || ideltaT!=deltaT) {
      Message::warning(MSG_ID, "Building signal grid",
                           "To build a colored grid all the signals must have the same deltaT and T0",
                           Message::cancel());
      _gridPlot=0;
      return ;
    }
  }
  // Re-allocate a new grid
  switch (sType) {
  case Signal::Waveform:
  case Signal::RealSpectrum:
    _gridPlot=new Grid2D<double>(n, _subPool->count());
    break;
  case Signal::Spectrum:
    _gridPlot=new Grid2D<double>(nSamples2 + 1, _subPool->count());
    break;
  default:
    break;
  }
  _gridPlot->setOrigin(Point2D( t0, 1) );
  _gridPlot->setDeltaX(deltaT);
  // fill in the grid with signals
  double * cells=_gridPlot->valuePointer(0, 0);
  double valClip, affMax;
  int imin, imax;
  for(it=_subPool->begin(); it!=_subPool->end(); ++it) {
    const Signal * sig=*it;
    CONST_LOCK_SAMPLES(double, samples, sig)
      visibleSamples(graphContent()->options(), sig, imin, imax);
      switch (sig->type()) {
      case Signal::Waveform:
      case Signal::RealSpectrum: {
          if(_normalize & NormalizeAll) affMax=affMax0;
          drawingAmplitude(sig, imin, imax, valClip, affMax);
          for(int i=0; i < n; i++, cells++ ) {
            double val=samples[ i ];
            if(val > valClip) val=valClip;
            *cells=val * affMax;
          }
        }
        break;
      case Signal::CAmpWaveform:
      case Signal::Spectrum: {
          if(_normalize & NormalizeAll) affMax=2 * affMax0;
          drawingAmplitude(sig, imin, imax, valClip, affMax);
          for(int i=0; i <= nSamples2; i++, cells++ ) {
            double val=sig->amplitude(samples, i);
            if(val > valClip) val=valClip;
            *cells=val * affMax;
          }
        }
        break;
      case Signal::CPhaseWaveform:
      case Signal::Phase: {
          if(_normalize & NormalizeAll) affMax=affMax0;
          drawingAmplitude(sig, imin, imax, valClip, affMax);
          for(int i=0; i <= nSamples2; i++, cells++ ) {
            double val=sig->phase(samples, i);
            if(val > valClip) val=valClip;
            *cells=val * affMax;
          }
        }
      case Signal::ArrivalTime:
      case Signal::UndefinedSignalType:
        break;
      }
    }
  UNLOCK_SAMPLES(sig)
}
bool GeopsyGui::SignalLayer::variableArea ( ) const [inline]
{return _variableArea;}
bool GeopsyGui::SignalLayer::visibleSamples ( const GraphContentOptions gc,
const Signal sig,
int &  itmin,
int &  itmax,
double &  x0,
double &  dx 
) const [protected]

Set itmin and itmax (sample index) for visible range for signal sig Return true is all samples are visible (1 samples > 1 pixel) x0 is the time or the frequency of the first sample dx is the frequency step or the time step between samples

References _afterPickDelay, _aroundPickName, _beforePickDelay, _customTimeRange, _timeRange, GeopsyCore::TimeRangeParameters::absoluteRange(), AroundPickRange, AvailableRange, SciFigs::GraphContentOptions::ax(), CustomRange, GeopsyCore::DoubleSignal::deltaF(), GeopsyCore::DoubleSignal::deltaT(), GeopsyCore::DoubleSignal::duration(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::Signal::t0(), GeopsyCore::Signal::timePick(), TRACE, GeopsyCore::DoubleSignal::type(), SciFigs::GraphContentOptions::xVisMax(), and SciFigs::GraphContentOptions::xVisMin().

Referenced by highlightSignal(), maxAmplitude(), paintData(), updateGrid(), and visibleSamples().

{
  TRACE;
  switch (sig->type()) {
  case Signal::Waveform: {
      dx=sig->deltaT();
      ::TimeRange tw;
      switch(_timeRange) {
      case AvailableRange:
        tw.setStart(gc.xVisMin());
        tw.setEnd(gc.xVisMax());
        break;
      case AroundPickRange: {
          double t=sig->timePick(_aroundPickName);
          tw.setStart(t - _beforePickDelay);
          tw.setEnd(t + _afterPickDelay);
        }
        break;
      case CustomRange:
        tw=_customTimeRange.absoluteRange(sig);
        break;
      }
      itmin=(int) floor(( tw.start() - sig->t0())/dx) - 1;
      itmax=(int) ceil(( tw.end() - sig->t0())/dx) + 1;
      if(itmin < 0) itmin=0;
      if(itmax > sig->nSamples() - 1) itmax=sig->nSamples() - 1;
      x0=sig->t0() + itmin * dx;
      if(fabs( gc.ax() * dx) < 1.0) return false; else return true;
    }
  case Signal::RealSpectrum:
    dx=sig->deltaF();
    itmin=(int) floor(gc.xVisMin()/dx) - 1;
    if(itmin < 0) itmin=0;
    itmax=(int) ceil(gc.xVisMax()/dx) + 1;
    if(itmax > sig->nSamples() - 1) itmax=sig->nSamples() - 1;
    x0=itmin * dx;
    if(fabs( gc.ax() * dx) < 1.0) return false; else return true;
  case Signal::CAmpWaveform:
  case Signal::CPhaseWaveform:
  case Signal::Spectrum:
  case Signal::Phase: {
      int nSamples2=sig->nSamples()/2;
      dx=1.0/sig->duration();
      itmin=(int) floor(gc.xVisMin()/dx) - 1;
      if(itmin < 1) itmin=1; /* don't plot 0 Hz as we are supposed to plot it
                                     in log scale */
      itmax=(int) ceil(gc.xVisMax()/dx) + 1;
      if(itmax > nSamples2) itmax=nSamples2;
      x0=itmin * dx;
      if(fabs( gc.ax() * dx) < 1.0) return false; else return true;
    }
  case Signal::UndefinedSignalType:
  case Signal::ArrivalTime:
    return false;
  }
  return false;
}
void GeopsyGui::SignalLayer::visibleSamples ( const GraphContentOptions gc,
const Signal sig,
int &  itmin,
int &  itmax 
) const [inline, protected]

References TRACE, and visibleSamples().

{
  TRACE;
  double x0, dx;
  visibleSamples(gc, sig, itmin, itmax, x0, dx);
}
bool GeopsyGui::SignalLayer::wheelEvent ( QWheelEvent *  e) [protected, virtual]

Reimplemented from SciFigs::GraphContentLayer.

References TRACE.

{
  TRACE;
  if(e->modifiers() & Qt::ShiftModifier) {
    e->accept();
    spinOverlap(e->delta()/120, e->modifiers() & Qt::ControlModifier, e->y());
    return false; // do not process this event for other layers
  }
  return true; // Continue scanning other layers with this event
}
bool GeopsyGui::SignalLayer::wiggleTrace ( ) const [inline]
{return _wiggleTrace;}

Re-implement this function to offer XML restore (children and properties) support to your class.

From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:

  • An integer: id number of a property
  • A XMLClass * : a child of this object identified by tag
  • Default constructor: error, unknow child or property

Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):

    static const QString tmp("childrenName");
    XMLRestoreAttributeIterator it=map.find(tmp);
    if(it!=map.end()) {
      // found attribute "childrenName"
    }

If the map of attributes is not used:

    Q_UNUSED(attributes);
    if(tag=="x1") return XMLMember(0);
    else if(tag=="y1") return XMLMember(1);
    else if(tag=="x2") return XMLMember(2);
    else if(tag=="y2") return XMLMember(3);
    else return XMLMember(XMLMember::Unknown);

Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.

    if(tag=="anInteger") return XMLMember(0);
    else if(tag=="aString") return XMLMember(1);
    else if(tag=="aDouble") return XMLMember(2);
    return AbstractLine::xml_member(tag, attributes, context)+3;

For the arguments of this function use Macro XML_MEMBER_ARGS.

Reimplemented from SciFigs::GridPlot.

References SciFigs::XMLSciFigs::data(), SciFigs::XMLSciFigs::makeUp(), and TRACE.

{
  TRACE;
  XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context);
  if(scifigsContext->data()) {
    if(tag==XMLSubSignalPool::xmlSubSignalPoolTag) {
      return XMLMember(new XMLSubSignalPool, true);
    } else if(tag==XMLSignal::xmlSignalTag) { // For compatibility
      return XMLMember(new XMLSignal, true);
    }
  }
  if(scifigsContext->makeUp()) {
    if(tag==signalColorTag) {
      return XMLMember(0);
    } else if(tag==signalOverlapTag) {
      return XMLMember(1);
    } else if(tag==TimeRangeParameters::xmlTimeRangeParametersTag) {
      return XMLMember(2);
    }
  }
  return GridPlot::xml_member(tag, attributes, context)+3;
}
void GeopsyGui::SignalLayer::xml_polish ( XML_POLISH_ARGS  ) [protected, virtual]

Reimplemented from QGpCoreTools::XMLClass.

References subPoolUpdate(), and TRACE.

{
  TRACE;
  Q_UNUSED(context);
  subPoolUpdate();
}

Reimplemented from SciFigs::GridPlot.

References _subPool, _subPoolOwner, GeopsyCore::SubSignalPool::addSignal(), GeopsyCore::XMLSignal::signal(), GeopsyCore::XMLSubSignalPool::subPool(), subPool(), and TRACE.

{
  TRACE;
  Q_UNUSED(context);
  if(child->xml_tagName()==XMLSubSignalPool::xmlSubSignalPoolTag) {
    XMLSubSignalPool * subPool=static_cast<XMLSubSignalPool *>(child);
    if(_subPoolOwner) delete _subPool;
    _subPool=subPool->subPool();
    _subPoolOwner=true;
  } else if(child->xml_tagName()==XMLSignal::xmlSignalTag) { // For compatibility
    XMLSignal * sig=static_cast<XMLSignal *>(child);
    if(!_subPool) {
      _subPool=new SubSignalPool;
      _subPoolOwner=true;
    }
    _subPool->addSignal(sig->signal());
  }
}

Re-implement this function to offer XML restore properties support to your class.

From memberID set the corresponding property with value content. The map of attributes is given as a supplementary information (not useful in all cases).

For a general case:

  Q_UNUSED(attributes);
  double val=content.toDouble();
  switch (memberID) {
  case 0:
    _x1=val;
    return true;
  case 1:
    _y1=val;
    return true;
  case 2:
    _x2=val;
    return true;
  case 3:
    _y2=val;
    return true;
  default:
    return false;
  }

For classes inheriting other classes (see also xml_member())

  switch (memberID) {
  case 0:
    _anInteger=content.toString();
    return true;
  case 1:
    _aString=content.toInt();
    return true;
  case 2:
    _aDouble=content.toDouble();
    return true;
  default:
    return AbstractLine::xml_setProperty(memberID-3, map, content);

For the arguments of this function use Macro XML_SETPROPERTY_ARGS.

Reimplemented from SciFigs::GraphContentLayer.

References _customTimeRange, _signalOverlaps, _subPool, GeopsyCore::SubSignalPool::at(), QGpCoreTools::endl(), setSignalColor(), QGpCoreTools::tr(), TRACE, and GeopsyCore::TimeRangeParameters::xml_setAttributes().

{
  TRACE;
  switch (memberID) {
  case 0: {
      XMLRestoreAttributeIterator it=attributes.find(indexTag);
      if(it!=attributes.end()) {
        int index=it.value().toInt();
        if(index >= 0 && _subPool && index < _subPool->count()) {
          setSignalColor(_subPool->at(index), QColor(content.toString()) );
        } else {
          App::stream() << tr("Index '%1' out of range for 'signalColor' property.").arg(index) << endl;
        }
      } else {
        App::stream() << tr("No 'index' for 'signalColor' property.") << endl;
      }
    }
    return true;
  case 1: {
      XMLRestoreAttributeIterator it=attributes.find(indexTag);
      if(it!=attributes.end()) {
        int index=it.value().toInt();
        if(index >= 0 && _subPool && index < _subPool->count()) {
          Signal * sig=_subPool->at(index);
          _signalOverlaps.insert(sig, content.toDouble());
        } else {
          App::stream() << tr("Index '%1' out of range for 'signalOverlap' property.").arg(index) << endl;
        }
      } else {
        App::stream() << tr("No 'index' for 'signalOverlap' property.") << endl;
      }
    }
    return true;
  case 2:
    return _customTimeRange.xml_setAttributes(attributes, context);
  default:
    return GridPlot::xml_setProperty(memberID-3, tag, attributes, content, context);
  }
}
virtual const QString& GeopsyGui::SignalLayer::xml_tagName ( ) const [inline, virtual]

Reimplemented from SciFigs::GridPlot.

Reimplemented from SciFigs::GridPlot.

References _subPool, SciFigs::XMLSciFigs::data(), subPool(), TRACE, and QGpCoreTools::XMLClass::xml_save().

{
  TRACE;
  XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context);
  if(scifigsContext->data()) {
    XMLSubSignalPool subPool(*_subPool);
    subPool.xml_save(s, context);
  }
  GridPlot::xml_writeChildren(s, context);
}

Reimplemented from SciFigs::GraphContentLayer.

References _customTimeRange, _signalColors, _signalOverlaps, _subPool, QGpCoreTools::XMLSaveAttributes::add(), QGpCoreTools::XMLSaveAttributes::clear(), GeopsyCore::SubSignalPool::indexOf(), SciFigs::XMLSciFigs::makeUp(), TRACE, QGpCoreTools::XMLSaveAttributes::value(), QGpCoreTools::XMLClass::writeProperty(), and GeopsyCore::TimeRangeParameters::xml_attributes().

{
  TRACE;
  GridPlot::xml_writeProperties(s, context);
  XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context);
  if(scifigsContext->makeUp()) {
    XMLSaveAttributes att;
    QString& value=att.add(indexTag);
    for(QMap<const Signal *,QColor>::const_iterator it=_signalColors.begin(); it!=_signalColors.end(); it++ ) {
      value=QString::number(_subPool->indexOf(it.key()) );
      writeProperty(s, signalColorTag, att, it.value().name());
    }
    for(QMap<const Signal *,double>::const_iterator it=_signalOverlaps.begin(); it!=_signalOverlaps.end(); it++ ) {
      value=QString::number(_subPool->indexOf(it.key()) );
      writeProperty(s, signalOverlapTag, att, it.value());
    }
    att.clear();
    _customTimeRange.xml_attributes(att, context);
    writeProperty(s, TimeRangeParameters::xmlTimeRangeParametersTag, att);
  }
}

Referenced by drawingAmplitude(), and yAxisString().

{return _yAxis;}

References Overlayed, Receiver, SignalName, TRACE, ViewerIndex, and yAxis().

{
  TRACE;
  switch (yAxis()) {
  case ViewerIndex:
    break;
  case Receiver:
    return "ReceiverCoordinate";
  case SignalName:
    return "SignalName";
  case Overlayed:
    return "Overlayed";
  };
  return "ViewerIndex";
}

Friends And Related Function Documentation

friend class PickLayer [friend]
friend class TimeWindowLayer [friend]

Member Data Documentation

QMap<const Signal *, QColor> GeopsyGui::SignalLayer::_signalColors [protected]
QMap<const Signal *, double> GeopsyGui::SignalLayer::_signalOverlaps [protected]
uint GeopsyGui::SignalLayer::_tab = PropertyProxy::uniqueId() [static, protected]
const QString GeopsyGui::SignalLayer::xmlSignalLayerTag = "SignalLayer" [static]

Property Documentation

QString GeopsyGui::SignalLayer::clip [read, write]
double GeopsyGui::SignalLayer::clipPerc [read, write]
double GeopsyGui::SignalLayer::clipValue [read, write]
bool GeopsyGui::SignalLayer::grid [read, write]
QString GeopsyGui::SignalLayer::norm [read, write]
QString GeopsyGui::SignalLayer::normalize [read, write]
double GeopsyGui::SignalLayer::normValue [read, write]
QString GeopsyGui::SignalLayer::offset [read, write]
double GeopsyGui::SignalLayer::overlap [read, write]
QString GeopsyGui::SignalLayer::timeRange [read, write]
QString GeopsyGui::SignalLayer::yAxis [read, write]

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