QXRD  0.11.16
Public Member Functions | Static Public Member Functions | List of all members
QxrdCalibrantDSpacings Class Reference

#include <qxrdcalibrantdspacings.h>

Inheritance diagram for QxrdCalibrantDSpacings:
Inheritance graph
[legend]
Collaboration diagram for QxrdCalibrantDSpacings:
Collaboration graph
[legend]

Public Member Functions

void setSettingsValue (QSettings *settings, QString name)
 
QString toString () const
 
void insertUnique (int index, int h, int k, int l, double d, double tth)
 
void merge (const QxrdCalibrantDSpacings &vec)
 
double calibrantDSpacing (int n)
 
double calibrantTTH (int n)
 

Static Public Member Functions

static void customSaver (const QVariant &val, QSettings *settings, QString name)
 
static void registerMetaTypes ()
 

Detailed Description

Definition at line 10 of file qxrdcalibrantdspacings.h.

Member Function Documentation

double QxrdCalibrantDSpacings::calibrantDSpacing ( int  n)

Definition at line 95 of file qxrdcalibrantdspacings.cpp.

96 {
97  double res = qQNaN();
98 
99  if (n >= 0 && n < count()) {
100  res = value(n).d();
101  }
102 
103  return res;
104 }
double QxrdCalibrantDSpacings::calibrantTTH ( int  n)

Definition at line 106 of file qxrdcalibrantdspacings.cpp.

107 {
108  double res = qQNaN();
109 
110  if (n >= 0 && n < count()) {
111  res = value(n).tth();
112  }
113 
114  return res;
115 }
void QxrdCalibrantDSpacings::customSaver ( const QVariant &  val,
QSettings *  settings,
QString  name 
)
static

Definition at line 21 of file qxrdcalibrantdspacings.cpp.

References setSettingsValue().

Referenced by registerMetaTypes().

22 {
24 
25  vec.setSettingsValue(settings, name);
26 }
void setSettingsValue(QSettings *settings, QString name)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdCalibrantDSpacings::insertUnique ( int  index,
int  h,
int  k,
int  l,
double  d,
double  tth 
)

Definition at line 54 of file qxrdcalibrantdspacings.cpp.

References QxrdCalibrantDSpacing::d(), and QxrdCalibrantDSpacing::n().

Referenced by QxrdCalibrant::dSpacingsHexagonal().

55 {
56  int n = count();
57 
58  for (int i=0; i<n; i++) {
59  QxrdCalibrantDSpacing s = value(i);
60 
61  if (d == s.d()) {
62  s.n() = s.n()+1;
63 
64  replace(i, s);
65 
66  return;
67  }
68  }
69 
70  append(QxrdCalibrantDSpacing(index,h,k,l,1,d,tth));
71 }

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdCalibrantDSpacings::merge ( const QxrdCalibrantDSpacings vec)

Definition at line 73 of file qxrdcalibrantdspacings.cpp.

74 {
75  QxrdCalibrantDSpacings a = *this;
76  QxrdCalibrantDSpacings b = vec;
77 
78  clear();
79 
80  while (a.count() > 0 || b.count() > 0) {
81  if (a.count() > 0 && b.count() > 0) {
82  if (a.first().d() > b.first().d()) {
83  append(a.takeFirst());
84  } else {
85  append(b.takeFirst());
86  }
87  } else if (a.count() > 0) {
88  append(a.takeFirst());
89  } else if (b.count() > 0) {
90  append(b.takeFirst());
91  }
92  }
93 }
void QxrdCalibrantDSpacings::registerMetaTypes ( )
static

Definition at line 45 of file qxrdcalibrantdspacings.cpp.

References customSaver(), and QcepProperty::registerCustomSaver().

Referenced by QxrdApplication::QxrdApplication().

46 {
47  qRegisterMetaType< QxrdCalibrantDSpacings >("QxrdCalibrantDSpacingVector");
48 
49  qRegisterMetaTypeStreamOperators< QxrdCalibrantDSpacings >("QxrdCalibrantDSpacingVector");
50 
52 }
static void registerCustomSaver(QString typeName, CustomSettingsSaver *saver)
static void customSaver(const QVariant &val, QSettings *settings, QString name)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdCalibrantDSpacings::setSettingsValue ( QSettings *  settings,
QString  name 
)

Definition at line 3 of file qxrdcalibrantdspacings.cpp.

References QxrdCalibrantDSpacing::d(), QxrdCalibrantDSpacing::h(), QxrdCalibrantDSpacing::index(), QxrdCalibrantDSpacing::k(), QxrdCalibrantDSpacing::l(), and QxrdCalibrantDSpacing::tth().

Referenced by customSaver().

4 {
5  settings->beginWriteArray(name, count());
6 
7  for (int i=0; i<count(); i++) {
8  settings->setArrayIndex(i);
9  const QxrdCalibrantDSpacing &pt = at(i);
10  settings->setValue("index", pt.index());
11  settings->setValue("h", pt.h());
12  settings->setValue("k", pt.k());
13  settings->setValue("l", pt.l());
14  settings->setValue("d", pt.d());
15  settings->setValue("tth", pt.tth());
16  }
17 
18  settings->endArray();
19 }

Here is the call graph for this function:

Here is the caller graph for this function:

QString QxrdCalibrantDSpacings::toString ( ) const

Definition at line 28 of file qxrdcalibrantdspacings.cpp.

29 {
30  QString res="[";
31 
32  for (int i=0; i<count(); i++) {
33  if (i != 0) {
34  res += ", \n";
35  }
36 
37  res += at(i).toString();
38  }
39 
40  res += "]";
41 
42  return res;
43 }

The documentation for this class was generated from the following files: