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() {return shape_type_;}
52  virtual void section_handler(SectionHandler*);
56  virtual void transform3d(Rubberband* rb = NULL);
58  virtual void name(const char*);
59  virtual void save_phase2(std::ostream&);
60  virtual void help();
61  void force();
62  bool view_all() { return view_all_;}
63  void rotate(); // identity
64  void rotate(Coord xorg, Coord yorg, Coord zorg,
65  float xrad, float yrad, float zrad); //relative
66 private:
67  bool view_all_;
70  ColorValue* color_value_;
76  ShapeChangeObserver* shape_changed_;
77 };
78 
79 class FastShape : public Glyph {
80 public:
81  FastShape();
82  virtual ~FastShape();
83  virtual void fast_draw(Canvas*, Coord x, Coord y, bool)const = 0;
84 };
85 
86 class FastGraphItem : public GraphItem {
87 public:
88  FastGraphItem(FastShape* g, bool save = true, bool pick = true);
89  virtual bool is_fast() {return true;}
90 };
91 
92 class ShapeSection : public FastShape { //single section
93 public:
95  virtual ~ShapeSection();
96  virtual void request(Requisition&) const;
97  virtual void allocate(Canvas*, const Allocation&, Extension&);
98  virtual void draw(Canvas*, const Allocation&) const;
99  virtual void fast_draw(Canvas*, Coord x, Coord y, bool) const;
100  virtual void pick(Canvas*, const Allocation&, int depth, Hit&);
101  virtual void setColor(const Color*, ShapeScene*);
102  virtual void setColorseg(const Color*, double, ShapeScene*);
103  const Color* color(){return color_;}
104  virtual void set_range_variable(Symbol*);
105  virtual void clear_variable();
106  virtual void selectMenu();
107  virtual bool near_section(Coord, Coord, Coord mineps) const;
108  float how_near(Coord, Coord)const;
109  float arc_position(Coord, Coord)const;
110  int get_coord(double arc, Coord&, Coord&)const;
111  Section* section() const;
112  bool good() const;
113  virtual void damage(ShapeScene*);
114 // virtual void update(Observable*);
115  virtual void draw_seg(Canvas*, const Color*, int iseg) const;
116  virtual void draw_points(Canvas*, const Color*, int, int) const;
117  virtual void transform3d(Rotation3d*);
118  virtual void size(Coord& l, Coord& b, Coord& r, Coord& t) const;
119  void scale(Coord x) { len_scale_ = x; }
120  Coord scale() { return len_scale_; }
121  void update_ptrs();
122 private:
123  void trapezoid(Canvas*, const Color*, int i) const;
124  void trapezoid(Canvas*, const Color*, float, float, float, float,float, float) const;
125  void loc(double, Coord&, Coord&);
126  void bevel_join(Canvas*, const Color*, int, float) const;
127 #define FASTIDIOUS 1
128 #if FASTIDIOUS
129  void fastidious_draw(Canvas*, const Color*, int, float, float) const;
130 #endif
131 private:
132  double** pvar_;
135  const Color* color_;
136  const Color** old_;
137  const Color** colorseg_;
138  int colorseg_size_; // so know when to unref colorseg_ items.
139  Coord xmin_, xmax_, ymin_, ymax_;
140  Coord *x_, *y_;
141  int n_;
142 };
143 
144 #if 1
145 class ShapeView : public View {
146 public:
149  virtual ~ShapeView();
150 };
151 #endif
152 
153 
154 class SectionHandler : public Handler {
155 public:
156  SectionHandler();
157  virtual ~SectionHandler();
158  virtual bool event(Event&);
161 private:
163 };
164 
165 #endif
int shape_type()
Definition: shape.h:51
int n_
Definition: shape.h:141
ShapeSection * ss_
Definition: shape.h:162
void rotate()
Coord x_sel_
Definition: shape.h:69
#define g
Definition: passive0.cpp:23
virtual void allocate(Canvas *, const Allocation &, Extension &)
#define Glyph
Definition: _defines.h:132
#define Coord
Definition: _defines.h:19
#define Brush
Definition: _defines.h:59
#define Color
Definition: _defines.h:74
Coord len_scale_
Definition: shape.h:134
virtual Coord x2() const
Definition: scenevie.h:318
virtual void flush()
virtual SectionHandler * section_handler()
#define Handler
Definition: _defines.h:146
virtual void transform3d(Rubberband *rb=NULL)
Coord * y_
Definition: shape.h:140
#define PolyGlyph
Definition: _defines.h:207
virtual void draw(Canvas *, const Allocation &) const
#define loc(x, y, z)
virtual float nearest(Coord, Coord)
Definition: graph.h:48
virtual void view(Coord)
bool view_all_
Definition: shape.h:67
Coord ymin_
Definition: shape.h:139
double ** pvar_
Definition: shape.h:132
ColorValue * color_value_
Definition: shape.h:70
virtual void help()
virtual void wholeplot(Coord &x1, Coord &y1, Coord &x2, Coord &y2) const
PolyGlyph * sg_
Definition: shape.h:73
virtual void damage(GlyphIndex)
ShapeSection * selected_
Definition: shape.h:68
virtual bool is_fast()
Definition: shape.h:89
virtual Coord x1() const
Definition: scenevie.h:317
const Color ** colorseg_
Definition: shape.h:137
bool view_all()
Definition: shape.h:62
virtual ShapeSection * selected()
#define xorg
Definition: axis.cpp:156
void update_ptrs()
virtual void save_phase2(std::ostream &)
void colorseg(Section *, double, const Color *)
virtual float arc_selected()
const Color ** old_
Definition: shape.h:136
int colorseg_size_
Definition: shape.h:138
CopyString * var_name_
Definition: shape.h:75
#define Canvas
Definition: _defines.h:65
ShapeScene(SectionList *=NULL)
ShapeChangeObserver * shape_changed_
Definition: shape.h:76
void scale(Coord x)
Definition: shape.h:119
Definition: model.h:57
SectionHandler * section_handler_
Definition: shape.h:72
const Color * color()
Definition: shape.h:103
#define Event
Definition: _defines.h:107
void force()
virtual void erase_all()
#define fil
Definition: coord.h:42
ColorValue * color_value()
static ShapeScene * current_draw_scene()
const Color * color_
Definition: graph.h:142
DataVec * x_
Definition: graph.h:135
virtual void name(const char *)
virtual Coord y2() const
Definition: scenevie.h:320
Rotate3Band * r3b_
Definition: shape.h:74
virtual ~ShapeScene()
static ShapeScene * current_pick_scene()
PolyGlyph * shape_section_list()
static double save(void *v)
Definition: ocbox.cpp:340
const Color * color_
Definition: shape.h:135
Definition: scenevie.h:185
#define i
Definition: md1redef.h:12
#define yorg
Definition: axis.cpp:157
Coord scale()
Definition: shape.h:120
sec
Definition: solve.cpp:885
virtual void pick(Canvas *, const Allocation &, int depth, Hit &)
Section * sec_
Definition: shape.h:133
virtual Coord y1() const
Definition: scenevie.h:319
int shape_type_
Definition: shape.h:71
double t
Definition: init.cpp:123
Coord y_sel_
Definition: shape.h:69
const Color * color() const
Definition: graph.h:89
virtual ShapeSection * shape_section(Section *)
return NULL
Definition: cabcode.cpp:461
virtual void request(Requisition &) const
#define Hit
Definition: _defines.h:147
virtual void observe(SectionList *=NULL)