13 #ifndef __SBNW_LAYOUT_ARROWHEAD_H_ 14 #define __SBNW_LAYOUT_ARROWHEAD_H_ 29 namespace LibsbmlDraw {
31 typedef int ArrowheadStyle;
36 virtual ~Arrowhead() {}
38 virtual unsigned long getNumVerts()
const = 0;
39 virtual Point getVert(
unsigned long n)
const = 0;
41 Point getTransformedVert(
unsigned long n)
const {
42 return tf_*getVert(n);
45 Affine2d getTransform()
const {
return tf_; }
47 void setTransform(
const Affine2d& tf,
bool recurse =
true) { tf_ = tf; }
49 Affine2d getInverseTransform()
const {
return itf_; }
51 void setInverseTransform(
const Affine2d& itf,
bool recurse =
true) { itf_ = itf; }
61 class PlainArrowhead :
public Arrowhead {
63 virtual unsigned long getNumVerts()
const {
67 virtual Point getVert(
unsigned long n)
const {
76 SBNW_THROW(InvalidParameterException,
"Index out of range",
"Arrowhead::getVert");
82 class SubstrateArrowhead :
public Arrowhead {
84 virtual unsigned long getNumVerts()
const;
86 virtual Point getVert(
unsigned long n)
const;
89 class ProductArrowhead :
public Arrowhead {
91 virtual unsigned long getNumVerts()
const;
93 virtual Point getVert(
unsigned long n)
const;
96 class ActivatorArrowhead :
public Arrowhead {
98 virtual unsigned long getNumVerts()
const;
100 virtual Point getVert(
unsigned long n)
const;
103 class InhibitorArrowhead :
public Arrowhead {
105 virtual unsigned long getNumVerts()
const;
107 virtual Point getVert(
unsigned long n)
const;
110 class ModifierArrowhead :
public Arrowhead {
112 virtual unsigned long getNumVerts()
const;
114 virtual Point getVert(
unsigned long n)
const;
117 class ArrowheadStyles {
119 static unsigned long count();
121 static bool isFilled(ArrowheadStyle style);
123 static unsigned long getNumVerts(ArrowheadStyle style);
125 static Point getVert(ArrowheadStyle style,
int n);
129 extern ArrowheadStyle sub_arrow_style_;
130 inline ArrowheadStyle ArrowheadStyleLookup(
const SubstrateArrowhead* ) {
131 return sub_arrow_style_;
134 extern ArrowheadStyle prod_arrow_style_;
135 inline ArrowheadStyle ArrowheadStyleLookup(
const ProductArrowhead* ) {
136 return prod_arrow_style_;
139 extern ArrowheadStyle act_arrow_style_;
140 inline ArrowheadStyle ArrowheadStyleLookup(
const ActivatorArrowhead* ) {
141 return act_arrow_style_;
144 extern ArrowheadStyle inh_arrow_style_;
145 inline ArrowheadStyle ArrowheadStyleLookup(
const InhibitorArrowhead* ) {
146 return inh_arrow_style_;
149 extern ArrowheadStyle mod_arrow_style_;
150 inline ArrowheadStyle ArrowheadStyleLookup(
const ModifierArrowhead* ) {
151 return mod_arrow_style_;
155 template<
typename ArrowheadT>
156 class ArrowheadStyleControl {
161 class ArrowheadStyleControl<SubstrateArrowhead> {
163 static void set(ArrowheadStyle val) {
165 sub_arrow_style_ = val;
168 static ArrowheadStyle get() {
169 return sub_arrow_style_;
174 class ArrowheadStyleControl<ProductArrowhead> {
176 static void set(ArrowheadStyle val) {
178 prod_arrow_style_ = val;
181 static ArrowheadStyle get() {
182 return prod_arrow_style_;
187 class ArrowheadStyleControl<ActivatorArrowhead> {
189 static void set(ArrowheadStyle val) {
191 act_arrow_style_ = val;
194 static ArrowheadStyle get() {
195 return act_arrow_style_;
200 class ArrowheadStyleControl<InhibitorArrowhead> {
202 static void set(ArrowheadStyle val) {
204 inh_arrow_style_ = val;
207 static ArrowheadStyle get() {
208 return inh_arrow_style_;
213 class ArrowheadStyleControl<ModifierArrowhead> {
215 static void set(ArrowheadStyle val) {
217 mod_arrow_style_ = val;
220 static ArrowheadStyle get() {
221 return mod_arrow_style_;