12 rotor_map[
"0" ] =
"0 0";
19 QStringList filter(
"C*.xml" );
20 QStringList fnames = dir.entryList( filter, QDir::Files, QDir::Name );
22 for (
int ii = 0; ii < fnames.size(); ii++ )
24 QFile file( path +
"/" + fnames[ ii ] );
26 if ( ! file.open( QIODevice::ReadOnly | QIODevice::Text ) )
28 qDebug() <<
"*ERROR: Could not read rotor file\n" << fnames[ ii ];
32 QXmlStreamReader xml( &file );
34 while ( ! xml.atEnd() )
38 if ( xml.isStartElement() && xml.name() ==
"Calibration" )
40 QXmlStreamAttributes att = xml.attributes();
42 QString calID = att.value(
"id" ).toString();
43 QString coeffs = att.value(
"coeff1" ).toString() +
" "
44 + att.value(
"coeff2" ).toString();
46 rotor_map[ calID ] = coeffs;
58 QMap< QString, QString >& rotor_map )
66 rotor_map[
"0" ] =
"0 0";
73 query <<
"get_lab_names";
78 qDebug() <<
"*ERROR* Unable to get lab IDs";
84 labIDs << db->
value( 0 ).toString();
87 for (
int ii = 0; ii < labIDs.size(); ii++ )
89 QString labID = labIDs[ ii ];
92 query <<
"get_rotor_names" << labID;
97 qDebug() <<
"*WARNING* Unable to get rotors for lab ID" << labID;
103 rotorIDs << db->
value( 0 ).toString();
107 for (
int ii = 0; ii < rotorIDs.size(); ii++ )
109 QString rotorID = rotorIDs[ ii ];
112 query <<
"get_rotor_calibration_profiles" << rotorID;
117 qDebug() <<
"*WARNING* Unable to get calIDs for rotor ID" << rotorID;
123 calibIDs << db->
value( 0 ).toString();
127 for (
int ii = 0; ii < calibIDs.size(); ii++ )
129 QString calibID = calibIDs[ ii ];
132 query <<
"get_rotor_calibration_info" << calibID;
137 qDebug() <<
"*WARNING* Unable to get info for calib ID" << calibID;
143 QString coeffs = db->
value( 4 ).toString() +
" " +
144 db->
value( 5 ).toString();
146 rotor_map[ calibID ] = coeffs;
156 QMap< QString, QString >rotor_map,
double* rotcoeffs )
158 bool ok = rotor_map.contains( rCalID );
162 QString coeffs = rotor_map[ rCalID ];
163 rotcoeffs[ 0 ] = coeffs.section(
" ", 0, 0 ).toDouble();
164 rotcoeffs[ 1 ] = coeffs.section(
" ", 1, 1 ).toDouble();
186 QList< US_AbstractCenterpiece >& centerpieces )
188 centerpieces.clear();
197 query <<
"get_abstractCenterpiece_names";
202 qDebug() <<
"*ERROR* Unable to get centerpiece information from DB";
208 cpids << db->
value( 0 ).toString().toInt();
213 for (
int ii = 0; ii < cpids.size(); ii++ )
218 query <<
"get_abstractCenterpiece_info" << cpid;
226 QString bottoms = db->
value( 3 ).toString();
230 double pathlen = db->
value( 6 ).toString().toDouble();
231 cp.
angle = db->
value( 7 ).toString().toDouble();
232 cp.
width = db->
value( 8 ).toString().toDouble();
237 for (
int jj = 0; jj < cp.
channels; jj++ )
254 if ( ! cp_file.open( QIODevice::ReadOnly | QIODevice::Text ) )
257 QXmlStreamReader xml( &cp_file );
258 double xversion = 1.0;
260 while ( ! xml.atEnd() )
264 if ( xml.isStartElement() )
266 if ( xml.name() ==
"abstractCenterpieces" )
268 QXmlStreamAttributes a = xml.attributes();
269 xversion = a.value(
"version" ).toString().toDouble();
272 if ( xml.name() ==
"abstractCenterpiece" )
277 QXmlStreamAttributes a = xml.attributes();
278 cp.serial_number = a.value(
"id" ).toString().toInt();
279 cp.guid = a.value(
"guid" ).toString();
280 cp.name = a.value(
"name" ).toString();
281 cp.material = a.value(
"materialName" ).toString();
282 cp.channels = a.value(
"channels" ).toString().toInt();
283 cp.shape = a.value(
"shape" ).toString();
284 cp.angle = a.value(
"angle" ).toString().toDouble();
285 cp.width = a.value(
"width" ).toString().toDouble();
287 if ( xversion == 1.0 )
289 if ( ( cp.channels % 2 ) == 0 )
291 if ( cp.serial_number == 2 || cp.serial_number == 7 )
293 else if ( cp.serial_number == 4 )
300 cp.maxRPM = a.value(
"maxRPM" ).toString().toDouble();
304 if ( xml.name() ==
"row" )
306 QXmlStreamAttributes a = xml.attributes();
307 cp.
path_length << a.value(
"pathlen" ).toString().toDouble();
324 QList< US_AbstractCenterpiece >& centerpieces )