#include "BlochSphereNode.h" #include "CircleNode.h" #include "LineNode.h" BlochSphereNode::BlochSphereNode(const Point& location) : AbstractVisualNode(location, "BlochSphereNode") { } void BlochSphereNode::setContent(BlochSphere* content) { mContent = content; mContentDirty = true; } void BlochSphereNode::setSize(double size) { if (size != mSize) { mSize = size; mContentDirty = true; } } void BlochSphereNode::update(SceneInfo* sceneInfo) { if (!mContentDirty) { return; } mChildren.clear(); auto loc = Point(mSize / 2.0, mSize / 2.0); mInnerCircle = std::make_unique(loc, mSize / 2.0); mInnerCircle->setMinorRadius(mSize / 4.0); mInnerCircle->setStrokeThickness(0.5); mOuterCircle = std::make_unique(loc, mSize/2.0); const auto end_point_x = Point(loc.getX() + 1.2 * mSize / 2.0, loc.getY()); const std::vector points{end_point_x }; mXAxis = std::make_unique(loc, points); mCentreCircle = std::make_unique(loc, mSize / 50.0); mCentreCircle->setFillColor(Color(0, 0, 0)); mCentreCircle->setHasStrokeColor(false); addChild(mInnerCircle.get()); addChild(mOuterCircle.get()); addChild(mXAxis.get()); addChild(mCentreCircle.get()); }