bool MultiAffine3Seq::doWriteSeq(YAMLWriter& writer) { if(BaseSeqType::doWriteSeq(writer)){ writer.putKeyValue("format", "XYZRPY"); writer.putKey("frames"); writer.startListing(); const int m = numParts(); const int n = numFrames(); for(int i=0; i < n; ++i){ Frame f = frame(i); writer.startFlowStyleListing(); for(int j=0; j < m; ++j){ writeAffine3(writer, f[j]); } writer.endListing(); } writer.endListing(); return true; } return false; }
bool AbstractMultiSeq::doWriteSeq(YAMLWriter& writer, std::function<void()> additionalPartCallback) { return AbstractSeq::doWriteSeq( writer, [&](){ writer.putKeyValue("numParts", getNumParts()); if(additionalPartCallback) additionalPartCallback(); }); }
bool AbstractSeq::doWriteSeq(YAMLWriter& writer, std::function<void()> additionalPartCallback) { if(seqType_.empty()){ if(contentName_.empty()){ writer.putMessage(_("The type of the sequence to write is unknown.\n")); } else { writer.putMessage(format(_("The type of the {} sequence to write is unknown.\n"), contentName_)); } return false; } const double frameRate = getFrameRate(); if(frameRate <= 0.0){ writer.putMessage( format(_("Frame rate {0} of {1} is invalid.\n"), frameRate, (contentName_.empty() ? seqType_ : contentName_))); return false; } writer.startMapping(); writer.putKeyValue("type", seqType_); if(!contentName_.empty()){ writer.putKeyValue("content", contentName_); } double version = writer.info("formatVersion", 0.0); if(version == 0.0 || !writer.info("isComponent", false)){ writer.putKeyValue("formatVersion", version == 0.0 ? 2.0 : version); } writer.putKeyValue("frameRate", frameRate); writer.putKeyValue("numFrames", getNumFrames()); if(additionalPartCallback) additionalPartCallback(); writer.endMapping(); return true; }
bool AbstractSeq::writeSeq(YAMLWriter& writer) { bool result = false; if(seqType().empty()){ addSeqMessage("setType() is empty."); } else { writer.startMapping(); writer.putKeyValue("type", seqType()); writer.putKeyValue("content", seqContentName()); writer.putKeyValue("frameRate", getFrameRate()); writer.putKeyValue("numFrames", getNumFrames()); result = doWriteSeq(writer); writer.endMapping(); } return result; }
void CollisionSeq::writeCollsionData(YAMLWriter& writer, std::shared_ptr<const CollisionLinkPairList> ptr) { writer.startMapping(); writer.putKey("LinkPairs"); writer.startListing(); for(auto it = ptr->begin(); it != ptr->end(); ++it){ CollisionLinkPairPtr linkPair = *it; writer.startMapping(); writer.putKeyValue("body0",linkPair->body[0]->name()); writer.putKeyValue("link0",linkPair->link[0]->name()); writer.putKeyValue("body1",linkPair->body[1]->name()); writer.putKeyValue("link1",linkPair->link[1]->name()); int numCollisions = linkPair->collisions.size(); writer.putKey("Collisions"); writer.startListing(); for(int j=0; j<numCollisions; j++){ Collision& collision = linkPair->collisions[j]; writer.startFlowStyleListing(); const Vector3& point = collision.point; writer.putScalar(point.x()); writer.putScalar(point.y()); writer.putScalar(point.z()); const Vector3& normal = collision.normal; writer.putScalar(normal.x()); writer.putScalar(normal.y()); writer.putScalar(normal.z()); writer.putScalar(collision.depth); writer.endListing(); } writer.endListing(); writer.endMapping(); } writer.endListing(); writer.endMapping(); }
bool CollisionSeq::doWriteSeq(YAMLWriter& writer, std::function<void()> additionalPartCallback) { return BaseSeqType::doWriteSeq( writer, [&](){ writer.putKeyValue("format", "PxPyPzNxNyNzD"); if(additionalPartCallback) additionalPartCallback(); writer.putKey("frames"); writer.startListing(); const int n = numFrames(); for(int i=0; i < n; ++i){ Frame f = frame(i); writeCollsionData(writer, f[0]); } writer.endListing(); }); }
bool AbstractMultiSeq::doWriteSeq(YAMLWriter& writer) { writer.putKeyValue("numParts", getNumParts()); return true; }