From 4daf775cdb89a98525729411e777d8aa0b5e97cb Mon Sep 17 00:00:00 2001 From: Ethereal Date: Fri, 25 Feb 2011 22:45:09 -0700 Subject: [PATCH] Began implementing Artisan::GViewport. This namespace is a vector-graphics Viewport class; very similar to what the previous iterations of Aesalon used. --- TODO | 3 +++ include/artisan/gviewport/CoordinateMapper.h | 31 +++++++++++++++++++++++ include/artisan/gviewport/LineObject.h | 26 +++++++++++++++++++ include/artisan/gviewport/Object.h | 38 ++++++++++++++++++++++++++++ include/artisan/gviewport/RectObject.h | 26 +++++++++++++++++++ include/artisan/gviewport/TreeType.h | 27 ++++++++++++++++++++ include/artisan/gviewport/Viewport.h | 33 ++++++++++++++++++++++++ newsource.py | 10 +++++--- src/artisan/SConscript | 7 +++++ src/artisan/gviewport/CoordinateMapper.cpp | 28 ++++++++++++++++++++ src/artisan/gviewport/LineObject.cpp | 19 ++++++++++++++ src/artisan/gviewport/Object.cpp | 19 ++++++++++++++ src/artisan/gviewport/RectObject.cpp | 19 ++++++++++++++ src/artisan/gviewport/Viewport.cpp | 28 ++++++++++++++++++++ src/visualizer/SConscript | 2 +- 15 files changed, 311 insertions(+), 5 deletions(-) create mode 100644 include/artisan/gviewport/CoordinateMapper.h create mode 100644 include/artisan/gviewport/LineObject.h create mode 100644 include/artisan/gviewport/Object.h create mode 100644 include/artisan/gviewport/RectObject.h create mode 100644 include/artisan/gviewport/TreeType.h create mode 100644 include/artisan/gviewport/Viewport.h create mode 100644 src/artisan/SConscript create mode 100644 src/artisan/gviewport/CoordinateMapper.cpp create mode 100644 src/artisan/gviewport/LineObject.cpp create mode 100644 src/artisan/gviewport/Object.cpp create mode 100644 src/artisan/gviewport/RectObject.cpp create mode 100644 src/artisan/gviewport/Viewport.cpp diff --git a/TODO b/TODO index 34f6003..c4615aa 100644 --- a/TODO +++ b/TODO @@ -7,3 +7,6 @@ - Allow access to the marshaller list for inter-module communication via "setup" function, to save function pointers etc. (?) ==== Collector ==== + +==== Storage ==== +- Fix RTree deletion algorithm diff --git a/include/artisan/gviewport/CoordinateMapper.h b/include/artisan/gviewport/CoordinateMapper.h new file mode 100644 index 0000000..1f691b7 --- /dev/null +++ b/include/artisan/gviewport/CoordinateMapper.h @@ -0,0 +1,31 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file include/artisan/gviewport/CoordinateMapper.h +*/ + +#ifndef AesalonArtisan_GViewport_CoordinateMapper_H +#define AesalonArtisan_GViewport_CoordinateMapper_H + +#include "TreeType.h" + +namespace Artisan { +namespace GViewport { + +class CoordinateMapper { +private: + double m_x, m_y, m_w, m_h; +public: + CoordinateMapper(double x, double y, double w, double h); + ~CoordinateMapper(); + + void map(uint64_t *fromx, uint64_t *fromy, double *tox, double *toy); +}; + +} // namespace GViewport +} // namespace Artisan + +#endif diff --git a/include/artisan/gviewport/LineObject.h b/include/artisan/gviewport/LineObject.h new file mode 100644 index 0000000..d9696a9 --- /dev/null +++ b/include/artisan/gviewport/LineObject.h @@ -0,0 +1,26 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file include/artisan/gviewport/LineObject.h +*/ + +#ifndef AesalonArtisan_GViewport_LineObject_H +#define AesalonArtisan_GViewport_LineObject_H + + +namespace Artisan { +namespace GViewport { + +class LineObject { +public: + LineObject(); + ~LineObject(); +}; + +} // namespace GViewport +} // namespace Artisan + +#endif diff --git a/include/artisan/gviewport/Object.h b/include/artisan/gviewport/Object.h new file mode 100644 index 0000000..01f4208 --- /dev/null +++ b/include/artisan/gviewport/Object.h @@ -0,0 +1,38 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file include/artisan/gviewport/Object.h +*/ + +#ifndef AesalonArtisan_GViewport_Object_H +#define AesalonArtisan_GViewport_Object_H + +#include + +#include "TreeType.h" +#include "CoordinateMapper.h" + +namespace Artisan { +namespace GViewport { + +class Object { +protected: + TreeType::Bound m_bound; +public: + virtual ~Object() {} + + const TreeType::Bound &bound() const { return m_bound; } + TreeType::Range &layerRange() { return m_bound.range(0); } + TreeType::Range &xRange() { return m_bound.range(1); } + TreeType::Range &yRange() { return m_bound.range(2); } + + virtual void render(CoordinateMapper &mapper, QPainter &painter) = 0; +}; + +} // namespace GViewport +} // namespace Artisan + +#endif diff --git a/include/artisan/gviewport/RectObject.h b/include/artisan/gviewport/RectObject.h new file mode 100644 index 0000000..8540f00 --- /dev/null +++ b/include/artisan/gviewport/RectObject.h @@ -0,0 +1,26 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file include/artisan/gviewport/RectObject.h +*/ + +#ifndef AesalonArtisan_GViewport_RectObject_H +#define AesalonArtisan_GViewport_RectObject_H + + +namespace Artisan { +namespace GViewport { + +class RectObject { +public: + RectObject(); + ~RectObject(); +}; + +} // namespace GViewport +} // namespace Artisan + +#endif diff --git a/include/artisan/gviewport/TreeType.h b/include/artisan/gviewport/TreeType.h new file mode 100644 index 0000000..e13ba4e --- /dev/null +++ b/include/artisan/gviewport/TreeType.h @@ -0,0 +1,27 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file include/artisan/gviewport/TreeType.h +*/ + +#ifndef AesalonArtisan_GViewport_TreeType_H +#define AesalonArtisan_GViewport_TreeType_H + +#include + +#include "storage/RTree.h" + +namespace Artisan { +namespace GViewport { + +class Object; + +typedef Storage::RTree TreeType; + +} // namespace GViewport +} // namespace Artisan + +#endif diff --git a/include/artisan/gviewport/Viewport.h b/include/artisan/gviewport/Viewport.h new file mode 100644 index 0000000..c7ce6e7 --- /dev/null +++ b/include/artisan/gviewport/Viewport.h @@ -0,0 +1,33 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file include/artisan/gviewport/Viewport.h +*/ + +#ifndef AesalonArtisan_GViewport_Viewport_H +#define AesalonArtisan_GViewport_Viewport_H + +#include "artisan/Viewport.h" +#include "TreeType.h" +#include "Object.h" + +namespace Artisan { +namespace GViewport { + +class Viewport : public Artisan::Viewport { +private: + TreeType m_tree; +public: + Viewport(); + virtual ~Viewport(); + + void addObject(Object *object); +}; + +} // namespace GViewport +} // namespace Artisan + +#endif diff --git a/newsource.py b/newsource.py index 0008d75..66b8096 100755 --- a/newsource.py +++ b/newsource.py @@ -49,11 +49,11 @@ config = { """, "openNamespace": """ -namespace %(namespace)s { -""", +namespace %(namespace)s {""", "cppClassDef": """ + class %(className)s { public: %(className)s(); @@ -62,10 +62,10 @@ public: """, "closeNamespace": """ -} // namespace %(namespace)s -""", +} // namespace %(namespace)s""", "cppHeaderEnd": """ + #endif """ } @@ -133,6 +133,8 @@ class CSource(Generator): if incPath != "": fp.write(fileConfig["cSource"] % fileConfig) + fp.write("\n") + fp.close() class CGenerator(Generator): diff --git a/src/artisan/SConscript b/src/artisan/SConscript new file mode 100644 index 0000000..87edc97 --- /dev/null +++ b/src/artisan/SConscript @@ -0,0 +1,7 @@ +Import("qtEnv") + +artisanEnv = qtEnv.Clone() + +artisanEnv.EnableQt4Modules(["QtCore", "QtGui"]) + +artisanEnv.StaticLibrary(target = "aesalon-artisan", source = Glob("*.cpp") + Glob("*/*.cpp")) diff --git a/src/artisan/gviewport/CoordinateMapper.cpp b/src/artisan/gviewport/CoordinateMapper.cpp new file mode 100644 index 0000000..604557d --- /dev/null +++ b/src/artisan/gviewport/CoordinateMapper.cpp @@ -0,0 +1,28 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file src/artisan/gviewport/CoordinateMapper.cpp +*/ + +#include "artisan/gviewport/CoordinateMapper.h" + +namespace Artisan { +namespace GViewport { + +CoordinateMapper::CoordinateMapper(double x, double y, double w, double h) : m_x(x), m_y(y), m_w(w), m_h(h) { + +} + +void CoordinateMapper::map(uint64_t *fromx, uint64_t *fromy, double *tox, double *toy) { + *tox = *fromx - m_x; + *toy = *fromy - m_y; + + *tox /= m_w; + *toy /= m_h; +} + +} // namespace GViewport +} // namespace Artisan diff --git a/src/artisan/gviewport/LineObject.cpp b/src/artisan/gviewport/LineObject.cpp new file mode 100644 index 0000000..01d4215 --- /dev/null +++ b/src/artisan/gviewport/LineObject.cpp @@ -0,0 +1,19 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file src/artisan/gviewport/LineObject.cpp +*/ + +#include "artisan/gviewport/LineObject.h" + + + +namespace Artisan { +namespace GViewport { + + +} // namespace GViewport +} // namespace Artisan \ No newline at end of file diff --git a/src/artisan/gviewport/Object.cpp b/src/artisan/gviewport/Object.cpp new file mode 100644 index 0000000..2f1737b --- /dev/null +++ b/src/artisan/gviewport/Object.cpp @@ -0,0 +1,19 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file src/artisan/gviewport/Object.cpp +*/ + +#include "artisan/gviewport/Object.h" + + + +namespace Artisan { +namespace GViewport { + + +} // namespace GViewport +} // namespace Artisan \ No newline at end of file diff --git a/src/artisan/gviewport/RectObject.cpp b/src/artisan/gviewport/RectObject.cpp new file mode 100644 index 0000000..40c7958 --- /dev/null +++ b/src/artisan/gviewport/RectObject.cpp @@ -0,0 +1,19 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file src/artisan/gviewport/RectObject.cpp +*/ + +#include "artisan/gviewport/RectObject.h" + + + +namespace Artisan { +namespace GViewport { + + +} // namespace GViewport +} // namespace Artisan \ No newline at end of file diff --git a/src/artisan/gviewport/Viewport.cpp b/src/artisan/gviewport/Viewport.cpp new file mode 100644 index 0000000..dc4c5b7 --- /dev/null +++ b/src/artisan/gviewport/Viewport.cpp @@ -0,0 +1,28 @@ +/** Aesalon, a tool to visualize program behaviour in real time. + Copyright (C) 2009-2011, Aesalon development team. + + Aesalon is distributed under the terms of the GNU GPLv3. See + the included file LICENSE for more information. + + @file src/artisan/gviewport/Viewport.cpp +*/ + +#include "artisan/gviewport/Viewport.h" + +namespace Artisan { +namespace GViewport { + +Viewport::Viewport() { + +} + +Viewport::~Viewport() { + +} + +void Viewport::addObject(Object *object) { + m_tree.insert(object->bound(), object); +} + +} // namespace GViewport +} // namespace Artisan diff --git a/src/visualizer/SConscript b/src/visualizer/SConscript index 7e97533..0c193f7 100644 --- a/src/visualizer/SConscript +++ b/src/visualizer/SConscript @@ -25,7 +25,7 @@ env.EnableQt4Modules(["QtCore", "QtGui", "QtNetwork"]) env.Append(CPPPATH = ["#include/"]) env.Append(CCFLAGS = ["-W", "-Wall", "-g", "-DAesalonVisualizer"]) -env.Append(LIBS = ["aesalon-config", "aesalon-util", "aesalon-storage"]) +env.Append(LIBS = ["aesalon-config", "aesalon-util", "aesalon-storage", "aesalon-artisan"]) env.Append(LINKFLAGS = ["-rdynamic"]) sourceFiles = Glob("*.cpp", strings=True) + Glob("*/*.cpp", strings=True) + Glob("*.qrc", strings=True) -- 2.11.4.GIT