gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/plot.h
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2009年12月13日 17:41:07 +0000
committerFrancesco Abbate <francesco.bbt@gmail.com>2009年12月13日 17:41:07 +0000
commitd00328bd46965223c83f3880204943d8e5844034 (patch)
tree86436dedafa24ce7e628df7467ca063237fd7cc5 /agg-plot/plot.h
parent220963841157dd309b3e26c879ad3bb9ba626580 (diff)
downloadgsl-shell-d00328bd46965223c83f3880204943d8e5844034.tar.gz
Basic skeleton of the C++ class model done with a functional test. GSL shell build currently broken.
Diffstat (limited to 'agg-plot/plot.h')
-rw-r--r--agg-plot/plot.h 79
1 files changed, 79 insertions, 0 deletions
diff --git a/agg-plot/plot.h b/agg-plot/plot.h
new file mode 100644
index 00000000..645857f6
--- /dev/null
+++ b/agg-plot/plot.h
@@ -0,0 +1,79 @@
+#ifndef AGGPLOT_CPLOT_H
+#define AGGPLOT_CPLOT_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "vertex-source.h"
+
+#include "drawables.h"
+#include "canvas.h"
+#include "units.h"
+
+#include "agg_conv_transform.h"
+#include "agg_color_rgba.h"
+#include "agg_path_storage.h"
+#include "agg_ellipse.h"
+#include "agg_array.h"
+
+struct drawable {
+ vertex_source* vs;
+ agg::rgba8 color;
+
+ drawable(): vs(NULL), color() {};
+ drawable(vertex_source* vs, agg::rgba8 c): vs(vs), color(c) {};
+
+ ~drawable() {};
+
+ void bounding_box(double *x1, double *y1, double *x2, double *y2)
+ {
+ vertex_source& vsi = get_vertex_source();
+ vsi.bounding_box(x1, y1, x2, y2);
+ };
+
+ vertex_source& get_vertex_source() { return *vs; };
+
+/*
+ void draw(canvas& canvas, agg::trans_affine& t)
+ {
+ vs_type& vsi = get_vertex_source();
+ agg::conv_transform<vs_type> p(vsi, t);
+ canvas.draw(p, color);
+ };
+*/
+};
+
+class plot {
+public:
+ plot() : m_elements(), m_trans(), m_bbox_updated(true) { };
+ virtual ~plot() {};
+
+ void add(vertex_source* vs, agg::rgba8 color)
+ {
+ drawable d(vs, color);
+ m_elements.add(d);
+ m_bbox_updated = false;
+ };
+
+ virtual void draw(canvas &canvas)
+ {
+ trans_matrix_update();
+ draw_elements(canvas);
+ };
+
+protected:
+ void draw_elements(canvas &canvas);
+ void bounding_box(double *x1, double *y1, double *x2, double *y2);
+ virtual void trans_matrix_update();
+
+ static void viewport_scale(agg::trans_affine& trans);
+
+ agg::pod_bvector<drawable> m_elements;
+ agg::trans_affine m_trans;
+
+ // bounding box
+ bool m_bbox_updated;
+};
+
+#endif
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月17日 10:08:57 +0000

AltStyle によって変換されたページ (->オリジナル) /