NEURON
shape.h
Go to the documentation of this file.
1 #ifndef shape_h
2 #define shape_h
3 
4 #include "scenevie.h"
5 #include "graph.h"
6 
7 #undef Rubberband
8 
9 struct Section; // neuron section structure
10 class ShapeSection;
11 class SectionHandler;
12 class StandardPicker;
13 class MyRect;
14 class Color;
15 class Brush;
16 class SectionList;
17 class Rubberband;
18 class ColorValue;
19 class PolyGlyph;
20 struct Symbol;
21 class Rotation3d;
22 class Rotate3Band;
23 class ShapeChangeObserver;
24 
25 class ShapeScene: public Graph { // entire neuron
26  public:
29  virtual ~ShapeScene();
30  virtual void erase_all();
31  virtual void observe(SectionList* = NULL);
32  virtual void flush();
33  virtual ShapeSection* selected();
34  virtual float arc_selected();
35  virtual void selected(ShapeSection*, Coord x = fil, Coord y = fil);
36  virtual float nearest(Coord, Coord); // and sets selected
37  virtual void wholeplot(Coord& x1, Coord& y1, Coord& x2, Coord& y2) const;
40  void color(Section* sec1, Section* sec2, const Color*);
41  void color(Section* sec, const Color*);
42  void colorseg(Section*, double, const Color*);
43  void color(const Color*);
44  void color(SectionList*, const Color*);
45  ColorValue* color_value();
46  virtual void view(Coord);
47  virtual void view(Coord*);
48  virtual void view(Rubberband*);
50  void shape_type(int);
51  int shape_type() {
52  return shape_type_;
53  }
58  virtual void transform3d(Rubberband* rb = NULL);
60  virtual void name(const char*);
61  virtual void save_phase2(std::ostream&);
62  virtual void help();
63  void force();
64  bool view_all() {
65  return view_all_;
66  }
67  void rotate(); // identity
69  Coord yorg,
70  Coord zorg,
71  float xrad,
72  float yrad,
73  float zrad); // relative
74  private:
75  bool view_all_;
78  ColorValue* color_value_;
84  ShapeChangeObserver* shape_changed_;
85 };
86 
87 class FastShape: public Glyph {
88  public:
90  virtual ~FastShape();
91  virtual void fast_draw(Canvas*, Coord x, Coord y, bool) const = 0;
92 };
93 
94 class FastGraphItem: public GraphItem {
95  public:
96  FastGraphItem(FastShape* g, bool save = true, bool pick = true);
97  virtual bool is_fast() {
98  return true;
99  }
100 };
101 
102 class ShapeSection: public FastShape { // single section
103  public:
105  virtual ~ShapeSection();
106  virtual void request(Requisition&) const;
107  virtual void allocate(Canvas*, const Allocation&, Extension&);
108  virtual void draw(Canvas*, const Allocation&) const;
109  virtual void fast_draw(Canvas*, Coord x, Coord y, bool) const;
110  virtual void pick(Canvas*, const Allocation&, int depth, Hit&);
111  virtual void setColor(const Color*, ShapeScene*);
112  virtual void setColorseg(const Color*, double, ShapeScene*);
113  const Color* color() {
114  return color_;
115  }
116  virtual void set_range_variable(Symbol*);
117  virtual void clear_variable();
118  virtual void selectMenu();
119  virtual bool near_section(Coord, Coord, Coord mineps) const;
120  float how_near(Coord, Coord) const;
121  float arc_position(Coord, Coord) const;
122  int get_coord(double arc, Coord&, Coord&) const;
123  Section* section() const;
124  bool good() const;
125  virtual void damage(ShapeScene*);
126  // virtual void update(Observable*);
127  virtual void draw_seg(Canvas*, const Color*, int iseg) const;
128  virtual void draw_points(Canvas*, const Color*, int, int) const;
129  virtual void transform3d(Rotation3d*);
130  virtual void size(Coord& l, Coord& b, Coord& r, Coord& t) const;
131  void scale(Coord x) {
132  len_scale_ = x;
133  }
135  return len_scale_;
136  }
137  void update_ptrs();
138 
139  private:
140  void trapezoid(Canvas*, const Color*, int i) const;
141  void trapezoid(Canvas*, const Color*, float, float, float, float, float, float) const;
142  void loc(double, Coord&, Coord&);
143  void bevel_join(Canvas*, const Color*, int, float) const;
144 #define FASTIDIOUS 1
145 #if FASTIDIOUS
146  void fastidious_draw(Canvas*, const Color*, int, float, float) const;
147 #endif
148  private:
149  double** pvar_;
152  const Color* color_;
153  const Color** old_;
154  const Color** colorseg_;
155  int colorseg_size_; // so know when to unref colorseg_ items.
157  Coord *x_, *y_;
158  int n_;
159 };
160 
161 #if 1
162 class ShapeView: public View {
163  public:
166  virtual ~ShapeView();
167 };
168 #endif
169 
170 
171 class SectionHandler: public Handler {
172  public:
174  virtual ~SectionHandler();
175  virtual bool event(Event&);
178 
179  private:
181 };
182 
183 #endif
#define Handler
Definition: _defines.h:146
#define Color
Definition: _defines.h:74
#define Canvas
Definition: _defines.h:65
#define Coord
Definition: _defines.h:19
#define Brush
Definition: _defines.h:59
#define Hit
Definition: _defines.h:147
#define Event
Definition: _defines.h:107
#define PolyGlyph
Definition: _defines.h:207
#define Glyph
Definition: _defines.h:132
FastGraphItem(FastShape *g, bool save=true, bool pick=true)
virtual bool is_fast()
Definition: shape.h:97
virtual void fast_draw(Canvas *, Coord x, Coord y, bool) const =0
virtual ~FastShape()
Definition: graph.h:57
@ EXTRAGRAPHTOOL
Definition: graph.h:59
virtual void pick(Canvas *, const Allocation &, int depth, Hit &)
bool save()
Definition: graph.h:37
virtual Coord y2() const
Definition: scenevie.h:366
virtual Coord y1() const
Definition: scenevie.h:363
virtual Coord x2() const
Definition: scenevie.h:360
virtual Coord x1() const
Definition: scenevie.h:357
ShapeSection * ss_
Definition: shape.h:180
virtual ~SectionHandler()
ShapeSection * shape_section()
virtual bool event(Event &)
void shape_section(ShapeSection *)
bool view_all()
Definition: shape.h:64
void rotate()
virtual void observe(SectionList *=NULL)
void color(Section *sec, const Color *)
void colorseg(Section *, double, const Color *)
virtual float arc_selected()
virtual void flush()
ColorValue * color_value_
Definition: shape.h:78
void force()
@ SECTION
Definition: shape.h:27
@ ROTATE
Definition: shape.h:27
@ EXTRASHAPETOOL
Definition: shape.h:27
virtual SectionHandler * section_handler()
virtual float nearest(Coord, Coord)
virtual void view(Rubberband *)
SectionHandler * section_handler_
Definition: shape.h:80
virtual ShapeSection * selected()
void color(const Color *)
ShapeSection * selected_
Definition: shape.h:76
Coord y_sel_
Definition: shape.h:77
virtual void name(const char *)
void color(Section *sec1, Section *sec2, const Color *)
virtual ShapeSection * shape_section(Section *)
virtual void wholeplot(Coord &x1, Coord &y1, Coord &x2, Coord &y2) const
virtual SectionHandler * section_handler(ShapeSection *)
static ShapeScene * current_pick_scene()
virtual void save_phase2(std::ostream &)
int shape_type_
Definition: shape.h:79
Rotate3Band * r3b_
Definition: shape.h:82
void shape_type(int)
virtual void view(Coord)
virtual ~ShapeScene()
virtual void transform3d(Rubberband *rb=NULL)
virtual void erase_all()
PolyGlyph * sg_
Definition: shape.h:81
Coord x_sel_
Definition: shape.h:77
int shape_type()
Definition: shape.h:51
void rotate(Coord xorg, Coord yorg, Coord zorg, float xrad, float yrad, float zrad)
ShapeChangeObserver * shape_changed_
Definition: shape.h:84
static ShapeScene * current_draw_scene()
virtual void section_handler(SectionHandler *)
ShapeScene(SectionList *=NULL)
CopyString * var_name_
Definition: shape.h:83
ColorValue * color_value()
@ show_diam
Definition: shape.h:49
@ show_schematic
Definition: shape.h:49
@ show_centroid
Definition: shape.h:49
bool view_all_
Definition: shape.h:75
virtual void selected(ShapeSection *, Coord x=fil, Coord y=fil)
virtual void view(Coord *)
PolyGlyph * shape_section_list()
virtual void help()
void color(SectionList *, const Color *)
virtual ~ShapeSection()
virtual void draw(Canvas *, const Allocation &) const
virtual void draw_seg(Canvas *, const Color *, int iseg) const
Coord len_scale_
Definition: shape.h:151
Coord * y_
Definition: shape.h:157
virtual void transform3d(Rotation3d *)
Coord xmin_
Definition: shape.h:156
virtual void pick(Canvas *, const Allocation &, int depth, Hit &)
int get_coord(double arc, Coord &, Coord &) const
Coord ymin_
Definition: shape.h:156
bool good() const
Coord * x_
Definition: shape.h:157
Coord ymax_
Definition: shape.h:156
ShapeSection(Section *)
virtual void size(Coord &l, Coord &b, Coord &r, Coord &t) const
Coord xmax_
Definition: shape.h:156
const Color ** old_
Definition: shape.h:153
void bevel_join(Canvas *, const Color *, int, float) const
float arc_position(Coord, Coord) const
const Color * color_
Definition: shape.h:152
virtual void request(Requisition &) const
void fastidious_draw(Canvas *, const Color *, int, float, float) const
Section * sec_
Definition: shape.h:150
const Color ** colorseg_
Definition: shape.h:154
float how_near(Coord, Coord) const
int colorseg_size_
Definition: shape.h:155
void scale(Coord x)
Definition: shape.h:131
int n_
Definition: shape.h:158
Coord scale()
Definition: shape.h:134
virtual void selectMenu()
virtual void clear_variable()
virtual void damage(ShapeScene *)
virtual bool near_section(Coord, Coord, Coord mineps) const
Section * section() const
virtual void allocate(Canvas *, const Allocation &, Extension &)
const Color * color()
Definition: shape.h:113
void update_ptrs()
virtual void fast_draw(Canvas *, Coord x, Coord y, bool) const
virtual void setColorseg(const Color *, double, ShapeScene *)
virtual void draw_points(Canvas *, const Color *, int, int) const
void loc(double, Coord &, Coord &)
double ** pvar_
Definition: shape.h:149
virtual void setColor(const Color *, ShapeScene *)
virtual void set_range_variable(Symbol *)
void trapezoid(Canvas *, const Color *, int i) const
void trapezoid(Canvas *, const Color *, float, float, float, float, float, float) const
ShapeView(ShapeScene *)
ShapeView(ShapeScene *, Coord *)
virtual ~ShapeView()
Definition: scenevie.h:203
#define fil
Definition: coord.h:42
double t
Definition: cvodeobj.cpp:59
#define sec
Definition: md1redef.h:13
#define i
Definition: md1redef.h:12
#define xorg
Definition: axis.cpp:156
#define yorg
Definition: axis.cpp:157
#define g
Definition: passive0.cpp:21
#define NULL
Definition: sptree.h:16
Definition: model.h:57