36 #ifndef __SBNW_LAYOUT_CURVE_H_
37 #define __SBNW_LAYOUT_CURVE_H_
42 #include "graphfab/layout/point.h"
78 virtual ~RxnBezier() {
86 virtual RxnCurveType getRole()
const = 0;
88 void applyTransform(
const Affine2d& t) {
90 c1 = xformPoint(c1,t);
91 c2 = xformPoint(c2,t);
112 Point getTransformedS()
const {
return tf_*s; }
113 Point getTransformedE()
const {
return tf_*e; }
114 Point getTransformedC1()
const {
return tf_*c1; }
115 Point getTransformedC2()
const {
return tf_*c2; }
117 virtual Point getCentroidCP()
const = 0;
119 virtual bool isStartNodeSide()
const = 0;
121 Point getNodeSideCP()
const {
122 if (isStartNodeSide())
128 void setNodeSideCP(
const Point& p) {
129 if (isStartNodeSide())
135 Point getNodeSide()
const {
136 if (isStartNodeSide())
142 void setNodeSide(
const Point& p) {
143 if (isStartNodeSide())
149 Node* getNodeUsed()
const {
150 if (isStartNodeSide())
156 bool includes(
const Node* n) {
165 virtual bool hasArrowhead()
const {
return false; }
167 void transformArrowhead(Arrowhead& a) {
169 if ((e - c2).mag2() < 1e-2)
170 v = (e - s).normed() * 5.;
172 v = (e - c2).normed() * 5.;
173 Point u = v.dextro();
175 a.setTransform(tf_*Affine2d::fromBasis(u, v, e));
176 a.setInverseTransform(a.getTransform().inv());
189 virtual Arrowhead* getArrowhead() {
190 Arrowhead* result =
new PlainArrowhead();
191 transformArrowhead(*result);
195 Affine2d getTransform()
const {
return tf_; }
197 void setTransform(
const Affine2d& tf,
bool recurse =
true) { tf_ = tf; }
199 Affine2d getInverseTransform()
const {
return itf_; }
201 void setInverseTransform(
const Affine2d& itf,
bool recurse =
true) { itf_ = itf; }
203 virtual ArrowheadStyle getArrowheadStyle()
const = 0;
213 inline std::ostream& operator<< (std::ostream& os,
const RxnBezier& b) {
214 os << b.s <<
"-" << b.c1 <<
"-" << b.c2 <<
"-" << b.e;
Definition: SagittariusCommon.cpp:38