50VertexLine2DDrawAction::VertexLine2DDrawAction()
53bool VertexLine2DDrawAction::refreshPropertyPtrs(
54 HyperGraphElementAction::Parameters* params_) {
56 if (_previousParams) {
58 _typeName +
"::POINT_SIZE", 1.);
65HyperGraphElementAction* VertexLine2DDrawAction::operator()(
66 HyperGraph::HyperGraphElement* element,
67 HyperGraphElementAction::Parameters* params_) {
68 if (
typeid(*element).name() != _typeName)
return nullptr;
70 refreshPropertyPtrs(params_);
71 if (!_previousParams)
return this;
73 if (_show && !_show->value())
return this;
75 VertexLine2D* that =
static_cast<VertexLine2D*
>(element);
76 glPushAttrib(GL_CURRENT_BIT | GL_BLEND);
78 glPointSize(_pointSize->value());
80 Vector2 n(std::cos(that->theta()), std::sin(that->theta()));
81 Vector2 pmiddle = n * that->rho();
84 VertexPointXY *vp1 = 0, *vp2 = 0;
85 vp1 =
dynamic_cast<VertexPointXY*
>(that->graph()->vertex(that->p1Id));
86 vp2 =
dynamic_cast<VertexPointXY*
>(that->graph()->vertex(that->p2Id));
88 glColor4f(0.8f, 0.5f, 0.3f, 0.3f);
90 glColor4f(0.8f, 0.5f, 0.3f, 0.7f);
91 }
else if (vp1 || vp2) {
92 glColor4f(0.8f, 0.5f, 0.3f, 0.5f);
96 glColor4f(0.8f, 0.5f, 0.3f, 0.7f);
97 l1 = t.dot(vp1->estimate() - pmiddle);
100 glColor4f(0.8f, 0.5f, 0.3f, 0.7f);
101 l2 = t.dot(vp2->estimate() - pmiddle);
106 glVertex3f((
float)p1.x(), p1.y(), 0.f);
107 glVertex3f((
float)p2.x(), p2.y(), 0.f);
const EstimateType & estimate() const
return the current estimate of the vertex
virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters *params_)
virtual bool write(std::ostream &os) const
write the vertex to a stream
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
Property< float > FloatProperty