当前位置: 首页>>代码示例>>C++>>正文


C++ Pose::setJoint方法代码示例

本文整理汇总了C++中Pose::setJoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Pose::setJoint方法的具体用法?C++ Pose::setJoint怎么用?C++ Pose::setJoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pose的用法示例。


在下文中一共展示了Pose::setJoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: importDat

void Persistance::importDat(){

	QString title = "Import from OpenRDK SPQR ...";
	QString filesType = "OpenRDK SPQR Poses File (*.dat)";\
	QString folder = QSettings().value(SETTING_NAME_ID_DAT_PATH).toString();
	QString path = QFileDialog::getOpenFileName(this,
												title,
												folder,
												filesType);
	if(path.isEmpty()){
		qDebug() << "choosed no file to import";
		return;
	}
	//caching the last path
	QSettings * settings = new QSettings();
	settings->setValue(SETTING_NAME_ID_DAT_PATH, path);
	settings->sync();
	delete settings;

	/////// READ FILE
	QFile file(path);
	if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
		qDebug() << "ERROR: file not imported.";
		showMessage("Error: Could not access the file. The document has not been imported.");
		return;
	}
	QTextStream in(&file);

	model->getPoses()->clear();
	std::vector<Pose *> poses;

	int numPoses = in.readLine().trimmed().toInt();
	int numLine = 0;
	in.readLine();
	while ((numLine < (numPoses)) && !in.atEnd()){ //fill times
		Pose * pose = new Pose(model);
		pose->setTime(in.readLine().trimmed().toDouble());
		poses.push_back(pose);
		numLine++;
	}
	numLine = 0;
	while ((numLine < (numPoses)) && !in.atEnd()){ //fill joints
		in.readLine();
		this->tempMapReset();
		for(int j = 0; (j<22) && !in.atEnd(); j++){

			QStringList joint = in.readLine().trimmed().split(" ");

			QString value = joint.at(1);
			qDebug() << "RAD-str:" << value;

#ifdef DAT_CONVERTION_RAD_TO_DEG_ENABLED

			double rad = joint.at(1).toDouble();
			qDebug() << "RAD-double:" << rad;
			double deg = rad*180/3.14159265;
			qDebug() << "DEG-double:" << deg;
			value = QString::number(deg,'f', 2);
			qDebug() << "DEG-str:" << value;
#endif

			datJointsTemp[joint.at(0)] = value;

		}

		Pose * pose = poses.at(numLine);
		DatJoints::iterator it = datJointsTemp.begin();
		//for each datJointsOrder
		for(unsigned int i = 0; i < datJointsOrder.size(); i++){

			//line.append(" ").append((*it).second);
			pose->setJoint((*it).first.toLower(),(*it).second.toDouble());

			it++;
		}

		numLine++;
	}
	//read joints
	//TODO remove the getPoses call. call a direct method
	model->getPoses()->clear();
	for(unsigned int i = 0; i< poses.size(); i++){
		model->addPose(poses.at(i));
	}
	//TODO: put guard on parsing failed
	file.close();
	/////// END READ FILE

	qDebug() << "IMPORTED: " << path;
	getController()->showStatusMessage(QString("Imported from ").append(path));
}
开发者ID:SPQRTeam,项目名称:Erenci,代码行数:91,代码来源:Persistance.cpp


注:本文中的Pose::setJoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。