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

Brief description of class still missing. More...

#include <Mode.h>

Inheritance diagram for QGpCoreWave::Mode:
QGpCoreTools::XMLClass

List of all members.

Public Types

enum  Polarisation {
  Vertical = 1, Radial = 2, Rayleigh = 3, Transverse = 4,
  Love = 5
}
enum  Slowness { Phase = 0, Group = 1 }

Public Member Functions

int index () const
QString indexString () const
 Mode ()
 Mode (Slowness s, Polarisation p, int index)
 Mode (Polarisation p, int ringIndex, int index)
 Mode (const Mode &o)
bool operator== (const Mode &o) const
Polarisation polarisation () const
QString polarisationString () const
int ringIndex () const
void setIndex (int i)
void setPolarisation (Polarisation p)
void setPolarisation (QString p)
void setRingIndex (int i)
void setSlowness (Slowness s)
void setSlowness (QString s)
Slowness slowness () const
QString slownessString () const
QString toString () const
virtual const QString & xml_tagName () const

Static Public Attributes

static const QString xmlModeTag = "Mode"

Protected Member Functions

XMLMember xml_member (XML_MEMBER_ARGS)
bool xml_setProperty (XML_SETPROPERTY_ARGS)
void xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Enumeration Documentation

Enumerator:
Vertical 
Radial 
Rayleigh 
Transverse 
Love 
Enumerator:
Phase 
Group 
{Phase=0, Group=1};

Constructor & Destructor Documentation

References Phase, Rayleigh, and TRACE.

{
  TRACE;
  _polarisation=Rayleigh;
  _slowness=Phase;
  _ringIndex=0;
  _index=0;
}
QGpCoreWave::Mode::Mode ( Slowness  s,
Polarisation  p,
int  index 
) [inline]

References index(), and TRACE.

{
  TRACE;
  _polarisation=p;
  _slowness=s;
  _ringIndex=0;
  _index=index;
}
QGpCoreWave::Mode::Mode ( Polarisation  p,
int  ringIndex,
int  index 
) [inline]

References index(), Phase, ringIndex(), and TRACE.

{
  TRACE;
  _polarisation=p;
  _slowness=Phase;
  _ringIndex=ringIndex;
  _index=index;
}
QGpCoreWave::Mode::Mode ( const Mode o) [inline]

References TRACE.

                               : XMLClass()
{
  TRACE;
  _polarisation=o._polarisation;
  _slowness=o._slowness;
  _ringIndex=o._ringIndex;
  _index=o._index;
}

Member Function Documentation

int QGpCoreWave::Mode::index ( ) const [inline]
QString QGpCoreWave::Mode::indexString ( ) const

Return a user-friendly string describing this mode index

References QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  switch (_index) {
  case 0:
    return tr("fundamental mode");
  case 1:
    return tr("1st higher mode");
  case 2:
    return tr("2nd higher mode");
  case 3:
    return tr("3rd higher mode");
  default:
    return tr("higher mode %1").arg(_index);
  }
}
bool QGpCoreWave::Mode::operator== ( const Mode o) const [inline]

References TRACE.

{
  TRACE;
  return _polarisation==o._polarisation &&
         _slowness==o._slowness &&
         _ringIndex==o._ringIndex &&
         _index==o._index;
}

Return a user-friendly string for polarisation

References Radial, QGpCoreTools::tr(), TRACE, Transverse, and Vertical.

Referenced by QGpGuiWave::ModeItem::data(), DinverDCGui::DispersionViewer::setMode(), and DinverDCGui::AutocorrViewer::setMode().

{
  TRACE;
  switch (_polarisation) {
  case Vertical:
    return tr("Vertical");
  case Radial:
    return tr("Radial");
  case Rayleigh:
    return tr("Rayleigh");
  case Transverse:
    return tr("Transverse");
  case Love:
    return tr("Love");
  }
  return QString::null;
}
int QGpCoreWave::Mode::ringIndex ( ) const [inline]
void QGpCoreWave::Mode::setIndex ( int  i) [inline]

Set polarisatio from a user-friendly string

References Love, Radial, Rayleigh, QGpCoreTools::tr(), TRACE, Transverse, and Vertical.

{
  TRACE;
  if(p==tr("Vertical")) {
    _polarisation=Vertical;
  } else if(p==tr("Radial")) {
    _polarisation=Radial;
  } else if(p==tr("Transverse")) {
    _polarisation=Transverse;
  } else if(p==tr("Love")) {
    _polarisation=Love;
  } else {
    _polarisation=Rayleigh;
  }
}
void QGpCoreWave::Mode::setRingIndex ( int  i) [inline]
void QGpCoreWave::Mode::setSlowness ( QString  s)

Set slowness from a user-friendly string

References Group, Phase, QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  if(s==tr("Group")) {
    _slowness=Group;
  } else {
    _slowness=Phase;
  }
}

Return a user-friendly string for slowness

References QGpCoreTools::tr(), and TRACE.

Referenced by QGpGuiWave::ModeItem::data(), and DinverDCGui::DispersionViewer::setMode().

{
  TRACE;
  switch (_slowness) {
  case Group:
    return tr("Group");
    break;
  default:
    return tr("Phase");
    break;
  }
  return QString::null;
}
QString QGpCoreWave::Mode::toString ( ) const

Return a user-friendly string completely describing this mode

References Phase, Radial, str, QGpCoreTools::tr(), TRACE, Transverse, and Vertical.

{
  TRACE;
  QString str;
  switch (_polarisation) {
  case Vertical:
  case Radial:
  case Transverse:
    str+=QString("Ring %1").arg(_ringIndex);
    break;
  case Love:
  case Rayleigh:
    switch (_slowness) {
    case Group:
      str+=tr("Group");
      break;
    case Phase:
      str+=tr("Phase");
      break;
    }
  }
  str+=" ";
  switch (_polarisation) {
  case Vertical:
    str+=tr("Vertical");
    break;
  case Radial:
    str+=tr("Radial");
    break;
  case Rayleigh:
    str+=tr("Rayleigh");
    break;
  case Transverse:
    str+=tr("Transverse");
    break;
  case Love:
    str+=tr("Love");
    break;
  }
  str+=" ";
  switch (_index) {
  case 0:
    str+=tr("fundamental");
    break;
  case 1:
    str+=tr("1st higher");
    break;
  case 2:
    str+=tr("2nd higher");
    break;
  case 3:
    str+=tr("3rd higher");
    break;
  default:
    str+=tr("higher %1").arg(_index);
    break;
  }
  return str;
}

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 QGpCoreTools::XMLClass.

References TRACE.

{
  TRACE;
  Q_UNUSED(attributes)
  Q_UNUSED(context);
  if(tag=="slowness") return XMLMember(0);
  else if(tag=="polarisation") return XMLMember(1);
  else if(tag=="ringIndex") return XMLMember(2);
  else if(tag=="index") return XMLMember(3);
  else return XMLMember(XMLMember::Unknown);
}

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 QGpCoreTools::XMLClass.

References Group, Love, Phase, Radial, Rayleigh, TRACE, Transverse, and Vertical.

{
  TRACE;
  Q_UNUSED(tag);
  Q_UNUSED(attributes)
  Q_UNUSED(context);
  switch (memberID) {
  case 0: if(content=="Group") _slowness=Group; else _slowness=Phase; return true;
  case 1:
    if(content=="Rayleigh") _polarisation=Rayleigh;
    else if(content=="Love") _polarisation=Love;
    else if(content=="Vertical") _polarisation=Vertical;
    else if(content=="Radial") _polarisation=Radial;
    else if(content=="Transverse") _polarisation=Transverse;
    else return false;
    return true;
  case 2: _ringIndex=content.toInt(); return true;
  case 3: _index=content.toInt(); return true;
  default: return false;
  }
}
virtual const QString& QGpCoreWave::Mode::xml_tagName ( ) const [inline, virtual]

Implements QGpCoreTools::XMLClass.

{return xmlModeTag;}

Reimplemented from QGpCoreTools::XMLClass.

References Phase, Radial, TRACE, Transverse, Vertical, and QGpCoreTools::XMLClass::writeProperty().

{
  TRACE;
  Q_UNUSED(context);
  switch (_slowness) {
  case Group:
    writeProperty(s,"slowness", "Group");
    break;
  case Phase:
    writeProperty(s,"slowness", "Phase");
    break;
  }
  switch (_polarisation) {
  case Vertical:
    writeProperty(s,"polarisation","Vertical");
    break;
  case Radial:
    writeProperty(s,"polarisation","Radial");
    break;
  case Rayleigh:
    writeProperty(s,"polarisation","Rayleigh");
    break;
  case Transverse:
    writeProperty(s,"polarisation","Transverse");
    break;
  case Love:
    writeProperty(s,"polarisation","Love");
    break;
  }
  writeProperty(s,"ringIndex",_ringIndex);
  writeProperty(s,"index",_index);
}

Member Data Documentation

const QString QGpCoreWave::Mode::xmlModeTag = "Mode" [static]

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