From 51a7f67efb3b4164cf0c8fa9ca74e6cb84c21fc8 Mon Sep 17 00:00:00 2001 From: nkwn <148709510+phthtgvi@users.noreply.github.com> Date: Mon, 11 Dec 2023 00:25:19 +0700 Subject: [PATCH] Update documentation --- Doxyfile | 2 +- docs/html/Circle_8cpp_source.html | 18 +- docs/html/Circle_8hpp_source.html | 28 +- docs/html/Color_8cpp_source.html | 180 ++ docs/html/Color_8hpp_source.html | 354 ++-- docs/html/Ellipse_8cpp_source.html | 66 +- docs/html/Ellipse_8hpp_source.html | 58 +- docs/html/Graphics_8hpp_source.html | 18 +- docs/html/Group_8cpp_source.html | 172 ++ docs/html/Group_8hpp_source.html | 174 ++ docs/html/Line_8cpp_source.html | 83 +- docs/html/Line_8hpp_source.html | 64 +- docs/html/Parser_8cpp_source.html | 808 ++++++--- docs/html/Parser_8hpp_source.html | 148 +- docs/html/Path_8cpp_source.html | 176 ++ docs/html/Path_8hpp_source.html | 181 ++ docs/html/PolyShape_8cpp_source.html | 167 ++ docs/html/PolyShape_8hpp_source.html | 167 ++ docs/html/Polygon_8cpp_source.html | 46 +- docs/html/Polygon_8hpp_source.html | 59 +- docs/html/Polyline_8cpp_source.html | 268 +-- docs/html/Polyline_8hpp_source.html | 66 +- docs/html/Rect_8cpp_source.html | 90 +- docs/html/Rect_8hpp_source.html | 60 +- docs/html/Renderer_8cpp_source.html | 561 ++++++ docs/html/Renderer_8hpp_source.html | 203 +++ docs/html/SVGElement_8cpp_source.html | 218 +++ docs/html/SVGElement_8hpp_source.html | 216 +++ docs/html/Text_8cpp_source.html | 87 +- docs/html/Text_8hpp_source.html | 86 +- docs/html/Vector2D_8hpp_source.html | 283 ++++ docs/html/Viewer_8cpp_source.html | 244 ++- docs/html/Viewer_8hpp_source.html | 111 +- docs/html/annotated.html | 27 +- docs/html/annotated_dup.js | 15 +- docs/html/classCircle-members.html | 70 +- docs/html/classCircle.html | 213 ++- docs/html/classCircle.js | 3 +- docs/html/classCircle__coll__graph.map | 8 +- docs/html/classCircle__coll__graph.md5 | 2 +- docs/html/classCircle__coll__graph.svg | 92 +- docs/html/classCircle__inherit__graph.map | 6 +- docs/html/classCircle__inherit__graph.md5 | 2 +- docs/html/classCircle__inherit__graph.svg | 28 +- docs/html/classEll-members.html | 163 ++ docs/html/classEll.html | 447 +++++ docs/html/classEll.js | 9 + docs/html/classEll__coll__graph.map | 6 + docs/html/classEll__coll__graph.md5 | 1 + docs/html/classEll__coll__graph.svg | 98 ++ docs/html/classEll__inherit__graph.map | 5 + docs/html/classEll__inherit__graph.md5 | 1 + docs/html/classEll__inherit__graph.svg | 51 + docs/html/classGroup-members.html | 166 ++ docs/html/classGroup.html | 415 +++++ docs/html/classGroup.js | 13 + docs/html/classGroup__coll__graph.map | 6 + docs/html/classGroup__coll__graph.md5 | 1 + docs/html/classGroup__coll__graph.svg | 91 + docs/html/classGroup__inherit__graph.map | 4 + docs/html/classGroup__inherit__graph.md5 | 1 + docs/html/classGroup__inherit__graph.svg | 36 + docs/html/classLine-members.html | 69 +- docs/html/classLine.html | 317 ++-- docs/html/classLine.js | 11 +- docs/html/classLine__coll__graph.map | 6 +- docs/html/classLine__coll__graph.md5 | 2 +- docs/html/classLine__coll__graph.svg | 82 +- docs/html/classLine__inherit__graph.map | 4 +- docs/html/classLine__inherit__graph.md5 | 2 +- docs/html/classLine__inherit__graph.svg | 18 +- docs/html/classParser-members.html | 36 +- docs/html/classParser.html | 1505 +++++++++++++---- docs/html/classParser.js | 26 +- docs/html/classParser__coll__graph.map | 5 +- docs/html/classParser__coll__graph.md5 | 2 +- docs/html/classParser__coll__graph.svg | 91 +- docs/html/classPath-members.html | 166 ++ docs/html/classPath.html | 501 ++++++ docs/html/classPath.js | 12 + docs/html/classPath__coll__graph.map | 6 + docs/html/classPath__coll__graph.md5 | 1 + docs/html/classPath__coll__graph.svg | 91 + docs/html/classPath__inherit__graph.map | 4 + docs/html/classPath__inherit__graph.md5 | 1 + docs/html/classPath__inherit__graph.svg | 36 + docs/html/classPlygon-members.html | 167 ++ docs/html/classPlygon.html | 400 +++++ docs/html/classPlygon.js | 8 + docs/html/classPlygon__coll__graph.map | 7 + docs/html/classPlygon__coll__graph.md5 | 1 + docs/html/classPlygon__coll__graph.svg | 106 ++ docs/html/classPlygon__inherit__graph.map | 5 + docs/html/classPlygon__inherit__graph.md5 | 1 + docs/html/classPlygon__inherit__graph.svg | 51 + docs/html/classPlyline-members.html | 167 ++ docs/html/classPlyline.html | 402 +++++ docs/html/classPlyline.js | 8 + docs/html/classPlyline__coll__graph.map | 7 + docs/html/classPlyline__coll__graph.md5 | 1 + docs/html/classPlyline__coll__graph.svg | 106 ++ docs/html/classPlyline__inherit__graph.map | 5 + docs/html/classPlyline__inherit__graph.md5 | 1 + docs/html/classPlyline__inherit__graph.svg | 51 + docs/html/classPolyShape-members.html | 163 ++ docs/html/classPolyShape.html | 450 +++++ docs/html/classPolyShape.js | 9 + docs/html/classPolyShape__coll__graph.map | 6 + docs/html/classPolyShape__coll__graph.md5 | 1 + docs/html/classPolyShape__coll__graph.svg | 91 + docs/html/classPolyShape__inherit__graph.map | 7 + docs/html/classPolyShape__inherit__graph.md5 | 1 + docs/html/classPolyShape__inherit__graph.svg | 81 + docs/html/classRect-members.html | 83 +- docs/html/classRect.html | 458 +++-- docs/html/classRect.js | 14 +- docs/html/classRect__coll__graph.map | 8 +- docs/html/classRect__coll__graph.md5 | 2 +- docs/html/classRect__coll__graph.svg | 92 +- docs/html/classRect__inherit__graph.map | 6 +- docs/html/classRect__inherit__graph.md5 | 2 +- docs/html/classRect__inherit__graph.svg | 28 +- docs/html/classRenderer-members.html | 150 ++ docs/html/classRenderer.html | 1086 ++++++++++++ docs/html/classRenderer.js | 18 + docs/html/classRenderer__coll__graph.map | 3 + docs/html/classRenderer__coll__graph.md5 | 1 + docs/html/classRenderer__coll__graph.svg | 28 + docs/html/classSVGElement-members.html | 159 ++ docs/html/classSVGElement.html | 815 +++++++++ docs/html/classSVGElement.js | 27 + docs/html/classSVGElement__coll__graph.map | 5 + docs/html/classSVGElement__coll__graph.md5 | 1 + docs/html/classSVGElement__coll__graph.svg | 76 + docs/html/classSVGElement__inherit__graph.map | 13 + docs/html/classSVGElement__inherit__graph.md5 | 1 + docs/html/classSVGElement__inherit__graph.svg | 171 ++ docs/html/classText-members.html | 77 +- docs/html/classText.html | 489 ++++-- docs/html/classText.js | 21 +- docs/html/classText__coll__graph.map | 6 +- docs/html/classText__coll__graph.md5 | 2 +- docs/html/classText__coll__graph.svg | 75 +- docs/html/classText__inherit__graph.map | 4 +- docs/html/classText__inherit__graph.md5 | 2 +- docs/html/classText__inherit__graph.svg | 18 +- docs/html/classVector2D-members.html | 140 ++ docs/html/classVector2D.html | 297 ++++ docs/html/classVector2D.js | 8 + docs/html/classViewer-members.html | 38 +- docs/html/classViewer.html | 513 +++--- docs/html/classViewer.js | 30 +- docs/html/classViewer__coll__graph.map | 2 +- docs/html/classViewer__coll__graph.md5 | 2 +- docs/html/classViewer__coll__graph.svg | 2 +- docs/html/classes.html | 20 +- docs/html/classmColor-members.html | 152 ++ docs/html/classmColor.html | 414 +++++ docs/html/classmColor.js | 20 + docs/html/classmColor__coll__graph.map | 3 + docs/html/classmColor__coll__graph.md5 | 1 + docs/html/classmColor__coll__graph.svg | 36 + .../dir_560415a5d2bc4999842279f4fc1debef.html | 2 +- .../dir_560415a5d2bc4999842279f4fc1debef.js | 14 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.js | 2 + docs/html/files.html | 46 +- docs/html/functions.html | 516 ++++-- docs/html/functions_func.html | 348 ++-- docs/html/functions_rela.html | 133 ++ docs/html/functions_vars.html | 193 ++- docs/html/graph_legend.html | 2 +- docs/html/hierarchy.html | 30 +- docs/html/hierarchy.js | 16 +- docs/html/index.html | 2 +- docs/html/inherit_graph_0.map | 2 +- docs/html/inherit_graph_0.md5 | 2 +- docs/html/inherit_graph_0.svg | 10 +- docs/html/inherit_graph_1.map | 9 +- docs/html/inherit_graph_1.md5 | 2 +- docs/html/inherit_graph_1.svg | 117 +- docs/html/inherit_graph_2.map | 2 +- docs/html/inherit_graph_2.md5 | 2 +- docs/html/inherit_graph_2.svg | 10 +- docs/html/inherit_graph_3.map | 3 + docs/html/inherit_graph_3.md5 | 1 + docs/html/inherit_graph_3.svg | 21 + docs/html/inherit_graph_4.map | 13 + docs/html/inherit_graph_4.md5 | 1 + docs/html/inherit_graph_4.svg | 171 ++ docs/html/inherit_graph_5.map | 3 + docs/html/inherit_graph_5.md5 | 1 + docs/html/inherit_graph_5.svg | 21 + docs/html/inherit_graph_6.map | 3 + docs/html/inherit_graph_6.md5 | 1 + docs/html/inherit_graph_6.svg | 21 + docs/html/inherit_graph_7.map | 3 + docs/html/inherit_graph_7.md5 | 1 + docs/html/inherit_graph_7.svg | 21 + docs/html/inherits.html | 14 +- docs/html/main_8cpp_source.html | 176 +- docs/html/menudata.js | 18 +- docs/html/navtreedata.js | 3 +- docs/html/navtreeindex0.js | 356 ++-- docs/html/search/all_0.js | 7 +- docs/html/search/all_1.js | 4 +- docs/html/search/all_10.js | 7 +- docs/html/search/all_11.js | 6 +- docs/html/search/all_12.js | 4 +- docs/html/search/all_13.js | 2 +- docs/html/search/all_14.js | 4 +- docs/html/search/all_15.js | 2 +- docs/html/search/all_16.js | 5 +- docs/html/search/all_2.js | 4 +- docs/html/search/all_3.js | 12 +- docs/html/search/all_4.js | 2 +- docs/html/search/all_5.js | 5 +- docs/html/search/all_6.js | 38 +- docs/html/search/all_7.js | 11 +- docs/html/search/all_8.js | 7 +- docs/html/search/all_9.js | 4 +- docs/html/search/all_a.js | 3 +- docs/html/search/all_b.js | 6 +- docs/html/search/all_c.js | 14 +- docs/html/search/all_d.js | 30 +- docs/html/search/all_e.js | 19 +- docs/html/search/all_f.js | 26 +- docs/html/search/classes_0.js | 2 +- docs/html/search/classes_1.js | 2 +- docs/html/search/classes_2.js | 2 +- docs/html/search/classes_3.js | 4 +- docs/html/search/classes_4.js | 2 +- docs/html/search/classes_5.js | 7 +- docs/html/search/classes_6.js | 3 +- docs/html/search/classes_7.js | 2 +- docs/html/search/classes_8.html | 37 + docs/html/search/classes_8.js | 4 + docs/html/search/classes_9.html | 37 + docs/html/search/classes_9.js | 6 + docs/html/search/functions_0.js | 4 +- docs/html/search/functions_1.js | 2 +- docs/html/search/functions_2.js | 10 +- docs/html/search/functions_3.js | 2 +- docs/html/search/functions_4.js | 35 +- docs/html/search/functions_5.js | 9 +- docs/html/search/functions_6.js | 2 +- docs/html/search/functions_7.js | 2 +- docs/html/search/functions_8.js | 2 +- docs/html/search/functions_9.js | 28 +- docs/html/search/functions_a.js | 5 +- docs/html/search/functions_b.js | 24 +- docs/html/search/functions_c.js | 2 +- docs/html/search/functions_d.js | 6 +- docs/html/search/functions_e.js | 4 +- docs/html/search/related_0.html | 37 + docs/html/search/related_0.js | 4 + docs/html/search/searchdata.js | 15 +- docs/html/search/variables_0.js | 4 +- docs/html/search/variables_1.js | 4 +- docs/html/search/variables_10.html | 37 + docs/html/search/variables_10.js | 5 + docs/html/search/variables_11.html | 37 + docs/html/search/variables_11.js | 4 + docs/html/search/variables_12.html | 37 + docs/html/search/variables_12.js | 5 + docs/html/search/variables_13.html | 37 + docs/html/search/variables_13.js | 4 + docs/html/search/variables_2.js | 4 +- docs/html/search/variables_3.js | 2 +- docs/html/search/variables_4.js | 8 +- docs/html/search/variables_5.js | 3 +- docs/html/search/variables_6.js | 5 +- docs/html/search/variables_7.js | 4 +- docs/html/search/variables_8.js | 4 +- docs/html/search/variables_9.js | 5 +- docs/html/search/variables_a.js | 6 +- docs/html/search/variables_b.js | 4 +- docs/html/search/variables_c.js | 5 +- docs/html/search/variables_d.js | 6 +- docs/html/search/variables_e.js | 5 +- docs/html/search/variables_f.html | 37 + docs/html/search/variables_f.js | 5 + docs/html/structPathPoint-members.html | 137 ++ docs/html/structPathPoint.html | 162 ++ docs/html/structPathPoint.js | 5 + docs/html/structPathPoint__coll__graph.map | 4 + docs/html/structPathPoint__coll__graph.md5 | 1 + docs/html/structPathPoint__coll__graph.svg | 37 + docs/latex/code_documentation.pdf | Bin 337819 -> 596536 bytes src/Parser.hpp | 147 +- src/graphics/Circle.hpp | 2 +- src/graphics/Ellipse.hpp | 5 + src/graphics/Group.hpp | 41 +- src/graphics/Path.hpp | 62 +- src/graphics/PolyShape.hpp | 5 + src/graphics/Rect.hpp | 2 + src/graphics/SVGElement.hpp | 38 + src/graphics/Vector2D.hpp | 2 +- 298 files changed, 18525 insertions(+), 3597 deletions(-) create mode 100644 docs/html/Color_8cpp_source.html create mode 100644 docs/html/Group_8cpp_source.html create mode 100644 docs/html/Group_8hpp_source.html create mode 100644 docs/html/Path_8cpp_source.html create mode 100644 docs/html/Path_8hpp_source.html create mode 100644 docs/html/PolyShape_8cpp_source.html create mode 100644 docs/html/PolyShape_8hpp_source.html create mode 100644 docs/html/Renderer_8cpp_source.html create mode 100644 docs/html/Renderer_8hpp_source.html create mode 100644 docs/html/SVGElement_8cpp_source.html create mode 100644 docs/html/SVGElement_8hpp_source.html create mode 100644 docs/html/Vector2D_8hpp_source.html create mode 100644 docs/html/classEll-members.html create mode 100644 docs/html/classEll.html create mode 100644 docs/html/classEll.js create mode 100644 docs/html/classEll__coll__graph.map create mode 100644 docs/html/classEll__coll__graph.md5 create mode 100644 docs/html/classEll__coll__graph.svg create mode 100644 docs/html/classEll__inherit__graph.map create mode 100644 docs/html/classEll__inherit__graph.md5 create mode 100644 docs/html/classEll__inherit__graph.svg create mode 100644 docs/html/classGroup-members.html create mode 100644 docs/html/classGroup.html create mode 100644 docs/html/classGroup.js create mode 100644 docs/html/classGroup__coll__graph.map create mode 100644 docs/html/classGroup__coll__graph.md5 create mode 100644 docs/html/classGroup__coll__graph.svg create mode 100644 docs/html/classGroup__inherit__graph.map create mode 100644 docs/html/classGroup__inherit__graph.md5 create mode 100644 docs/html/classGroup__inherit__graph.svg create mode 100644 docs/html/classPath-members.html create mode 100644 docs/html/classPath.html create mode 100644 docs/html/classPath.js create mode 100644 docs/html/classPath__coll__graph.map create mode 100644 docs/html/classPath__coll__graph.md5 create mode 100644 docs/html/classPath__coll__graph.svg create mode 100644 docs/html/classPath__inherit__graph.map create mode 100644 docs/html/classPath__inherit__graph.md5 create mode 100644 docs/html/classPath__inherit__graph.svg create mode 100644 docs/html/classPlygon-members.html create mode 100644 docs/html/classPlygon.html create mode 100644 docs/html/classPlygon.js create mode 100644 docs/html/classPlygon__coll__graph.map create mode 100644 docs/html/classPlygon__coll__graph.md5 create mode 100644 docs/html/classPlygon__coll__graph.svg create mode 100644 docs/html/classPlygon__inherit__graph.map create mode 100644 docs/html/classPlygon__inherit__graph.md5 create mode 100644 docs/html/classPlygon__inherit__graph.svg create mode 100644 docs/html/classPlyline-members.html create mode 100644 docs/html/classPlyline.html create mode 100644 docs/html/classPlyline.js create mode 100644 docs/html/classPlyline__coll__graph.map create mode 100644 docs/html/classPlyline__coll__graph.md5 create mode 100644 docs/html/classPlyline__coll__graph.svg create mode 100644 docs/html/classPlyline__inherit__graph.map create mode 100644 docs/html/classPlyline__inherit__graph.md5 create mode 100644 docs/html/classPlyline__inherit__graph.svg create mode 100644 docs/html/classPolyShape-members.html create mode 100644 docs/html/classPolyShape.html create mode 100644 docs/html/classPolyShape.js create mode 100644 docs/html/classPolyShape__coll__graph.map create mode 100644 docs/html/classPolyShape__coll__graph.md5 create mode 100644 docs/html/classPolyShape__coll__graph.svg create mode 100644 docs/html/classPolyShape__inherit__graph.map create mode 100644 docs/html/classPolyShape__inherit__graph.md5 create mode 100644 docs/html/classPolyShape__inherit__graph.svg create mode 100644 docs/html/classRenderer-members.html create mode 100644 docs/html/classRenderer.html create mode 100644 docs/html/classRenderer.js create mode 100644 docs/html/classRenderer__coll__graph.map create mode 100644 docs/html/classRenderer__coll__graph.md5 create mode 100644 docs/html/classRenderer__coll__graph.svg create mode 100644 docs/html/classSVGElement-members.html create mode 100644 docs/html/classSVGElement.html create mode 100644 docs/html/classSVGElement.js create mode 100644 docs/html/classSVGElement__coll__graph.map create mode 100644 docs/html/classSVGElement__coll__graph.md5 create mode 100644 docs/html/classSVGElement__coll__graph.svg create mode 100644 docs/html/classSVGElement__inherit__graph.map create mode 100644 docs/html/classSVGElement__inherit__graph.md5 create mode 100644 docs/html/classSVGElement__inherit__graph.svg create mode 100644 docs/html/classVector2D-members.html create mode 100644 docs/html/classVector2D.html create mode 100644 docs/html/classVector2D.js create mode 100644 docs/html/classmColor-members.html create mode 100644 docs/html/classmColor.html create mode 100644 docs/html/classmColor.js create mode 100644 docs/html/classmColor__coll__graph.map create mode 100644 docs/html/classmColor__coll__graph.md5 create mode 100644 docs/html/classmColor__coll__graph.svg create mode 100644 docs/html/functions_rela.html create mode 100644 docs/html/inherit_graph_3.map create mode 100644 docs/html/inherit_graph_3.md5 create mode 100644 docs/html/inherit_graph_3.svg create mode 100644 docs/html/inherit_graph_4.map create mode 100644 docs/html/inherit_graph_4.md5 create mode 100644 docs/html/inherit_graph_4.svg create mode 100644 docs/html/inherit_graph_5.map create mode 100644 docs/html/inherit_graph_5.md5 create mode 100644 docs/html/inherit_graph_5.svg create mode 100644 docs/html/inherit_graph_6.map create mode 100644 docs/html/inherit_graph_6.md5 create mode 100644 docs/html/inherit_graph_6.svg create mode 100644 docs/html/inherit_graph_7.map create mode 100644 docs/html/inherit_graph_7.md5 create mode 100644 docs/html/inherit_graph_7.svg create mode 100644 docs/html/search/classes_8.html create mode 100644 docs/html/search/classes_8.js create mode 100644 docs/html/search/classes_9.html create mode 100644 docs/html/search/classes_9.js create mode 100644 docs/html/search/related_0.html create mode 100644 docs/html/search/related_0.js create mode 100644 docs/html/search/variables_10.html create mode 100644 docs/html/search/variables_10.js create mode 100644 docs/html/search/variables_11.html create mode 100644 docs/html/search/variables_11.js create mode 100644 docs/html/search/variables_12.html create mode 100644 docs/html/search/variables_12.js create mode 100644 docs/html/search/variables_13.html create mode 100644 docs/html/search/variables_13.js create mode 100644 docs/html/search/variables_f.html create mode 100644 docs/html/search/variables_f.js create mode 100644 docs/html/structPathPoint-members.html create mode 100644 docs/html/structPathPoint.html create mode 100644 docs/html/structPathPoint.js create mode 100644 docs/html/structPathPoint__coll__graph.map create mode 100644 docs/html/structPathPoint__coll__graph.md5 create mode 100644 docs/html/structPathPoint__coll__graph.svg diff --git a/Doxyfile b/Doxyfile index d9596045..29fde6a6 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "svg-reader" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.1 +PROJECT_NUMBER = 0.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/docs/html/Circle_8cpp_source.html b/docs/html/Circle_8cpp_source.html index 1dc364fd..152af7c8 100644 --- a/docs/html/Circle_8cpp_source.html +++ b/docs/html/Circle_8cpp_source.html @@ -60,7 +60,7 @@
svg-reader -  0.1 +  0.2
Parse and render SVG files, handle user interactions.
@@ -123,12 +123,16 @@
1 #include "Circle.hpp"
2 
-
3 Circle::Circle(float radius, const sf::Vector2f &center, sf::Color fill,
-
4  sf::Color stroke, float stroke_thickness)
-
5  : Ellipse(sf::Vector2f(radius, radius), center, fill, stroke,
-
6  stroke_thickness) {}
-
Circle(float radius, const sf::Vector2f &center, sf::Color fill, sf::Color stroke, float stroke_thickness)
Constructs a Circle object.
Definition: Circle.cpp:3
-
Represents an ellipse in 2D space.
Definition: Ellipse.hpp:12
+
3 Circle::Circle(float radius, const Vector2Df &center, mColor fill,
+
4  mColor stroke, float stroke_width)
+
5  : Ell(Vector2Df(radius, radius), center, fill, stroke, stroke_width) {}
+
6 
+
7 std::string Circle::getClass() const { return "Circle"; }
+
std::string getClass() const override
Gets the type of the shape.
Definition: Circle.cpp:7
+
Circle(float radius, const Vector2Df &center, mColor fill, mColor stroke, float stroke_width)
Constructs a Circle object.
Definition: Circle.cpp:3
+
Represents an ellipse in 2D space.
Definition: Ellipse.hpp:12
+ +
Utility class for manipulating RGBA mColors.
Definition: Color.hpp:11
-
1 #ifndef COLOR_HPP_
-
2 #define COLOR_HPP_
+
1 #ifndef mColor_HPP_
+
2 #define mColor_HPP_
3 
-
4 #include <SFML/Graphics.hpp>
+
4 #include <iostream>
5 #include <map>
-
6 
-
12 static const std::map< std::string, sf::Color > color_map = {
-
13  {"aliceblue", sf::Color(240, 248, 255)},
-
14  {"antiquewhite", sf::Color(250, 235, 215)},
-
15  {"aqua", sf::Color(0, 255, 255)},
-
16  {"aquamarine", sf::Color(127, 255, 212)},
-
17  {"azure", sf::Color(240, 255, 255)},
-
18  {"beige", sf::Color(245, 245, 220)},
-
19  {"bisque", sf::Color(255, 228, 196)},
-
20  {"black", sf::Color(0, 0, 0)},
-
21  {"blanchedalmond", sf::Color(255, 235, 205)},
-
22  {"blue", sf::Color(0, 0, 255)},
-
23  {"blueviolet", sf::Color(138, 43, 226)},
-
24  {"brown", sf::Color(165, 42, 42)},
-
25  {"burlywood", sf::Color(222, 184, 135)},
-
26  {"cadetblue", sf::Color(95, 158, 160)},
-
27  {"chartreuse", sf::Color(127, 255, 0)},
-
28  {"chocolate", sf::Color(210, 105, 30)},
-
29  {"coral", sf::Color(255, 127, 80)},
-
30  {"cornflowerblue", sf::Color(100, 149, 237)},
-
31  {"cornsilk", sf::Color(255, 248, 220)},
-
32  {"crimson", sf::Color(220, 20, 60)},
-
33  {"cyan", sf::Color(0, 255, 255)},
-
34  {"darkblue", sf::Color(0, 0, 139)},
-
35  {"darkcyan", sf::Color(0, 139, 139)},
-
36  {"darkgoldenrod", sf::Color(184, 134, 11)},
-
37  {"darkgray", sf::Color(169, 169, 169)},
-
38  {"darkgreen", sf::Color(0, 100, 0)},
-
39  {"darkgrey", sf::Color(169, 169, 169)},
-
40  {"darkkhaki", sf::Color(189, 183, 107)},
-
41  {"darkmagenta", sf::Color(139, 0, 139)},
-
42  {"darkolivegreen", sf::Color(85, 107, 47)},
-
43  {"darkorange", sf::Color(255, 140, 0)},
-
44  {"darkorchid", sf::Color(153, 50, 204)},
-
45  {"darkred", sf::Color(139, 0, 0)},
-
46  {"darksalmon", sf::Color(233, 150, 122)},
-
47  {"darkseagreen", sf::Color(143, 188, 143)},
-
48  {"darkslateblue", sf::Color(72, 61, 139)},
-
49  {"darkslategray", sf::Color(47, 79, 79)},
-
50  {"darkslategrey", sf::Color(47, 79, 79)},
-
51  {"darkturquoise", sf::Color(0, 206, 209)},
-
52  {"darkviolet", sf::Color(148, 0, 211)},
-
53  {"deeppink", sf::Color(255, 20, 147)},
-
54  {"deepskyblue", sf::Color(0, 191, 255)},
-
55  {"dimgray", sf::Color(105, 105, 105)},
-
56  {"dimgrey", sf::Color(105, 105, 105)},
-
57  {"dodgerblue", sf::Color(30, 144, 255)},
-
58  {"firebrick", sf::Color(178, 34, 34)},
-
59  {"floralwhite", sf::Color(255, 250, 240)},
-
60  {"forestgreen", sf::Color(34, 139, 34)},
-
61  {"fuchsia", sf::Color(255, 0, 255)},
-
62  {"gainsboro", sf::Color(220, 220, 220)},
-
63  {"ghostwhite", sf::Color(248, 248, 255)},
-
64  {"gold", sf::Color(255, 215, 0)},
-
65  {"goldenrod", sf::Color(218, 165, 32)},
-
66  {"gray", sf::Color(128, 128, 128)},
-
67  {"green", sf::Color(0, 128, 0)},
-
68  {"greenyellow", sf::Color(173, 255, 47)},
-
69  {"grey", sf::Color(128, 128, 128)},
-
70  {"honeydew", sf::Color(240, 255, 240)},
-
71  {"hotpink", sf::Color(255, 105, 180)},
-
72  {"indianred", sf::Color(205, 92, 92)},
-
73  {"indigo", sf::Color(75, 0, 130)},
-
74  {"ivory", sf::Color(255, 255, 240)},
-
75  {"khaki", sf::Color(240, 230, 140)},
-
76  {"lavender", sf::Color(230, 230, 250)},
-
77  {"lavenderblush", sf::Color(255, 240, 245)},
-
78  {"lawngreen", sf::Color(124, 252, 0)},
-
79  {"lemonchiffon", sf::Color(255, 250, 205)},
-
80  {"lightblue", sf::Color(173, 216, 230)},
-
81  {"lightcoral", sf::Color(240, 128, 128)},
-
82  {"lightcyan", sf::Color(224, 255, 255)},
-
83  {"lightgoldenrodyellow", sf::Color(250, 250, 210)},
-
84  {"lightgray", sf::Color(211, 211, 211)},
-
85  {"lightgreen", sf::Color(144, 238, 144)},
-
86  {"lightgrey", sf::Color(211, 211, 211)},
-
87  {"lightpink", sf::Color(255, 182, 193)},
-
88  {"lightsalmon", sf::Color(255, 160, 122)},
-
89  {"lightseagreen", sf::Color(32, 178, 170)},
-
90  {"lightskyblue", sf::Color(135, 206, 250)},
-
91  {"lightslategray", sf::Color(119, 136, 153)},
-
92  {"lightslategrey", sf::Color(119, 136, 153)},
-
93  {"lightsteelblue", sf::Color(176, 196, 222)},
-
94  {"lightyellow", sf::Color(255, 255, 224)},
-
95  {"lime", sf::Color(0, 255, 0)},
-
96  {"limegreen", sf::Color(50, 205, 50)},
-
97  {"linen", sf::Color(250, 240, 230)},
-
98  {"magenta", sf::Color(255, 0, 255)},
-
99  {"maroon", sf::Color(128, 0, 0)},
-
100  {"mediumaquamarine", sf::Color(102, 205, 170)},
-
101  {"mediumblue", sf::Color(0, 0, 205)},
-
102  {"mediumorchid", sf::Color(186, 85, 211)},
-
103  {"mediumpurple", sf::Color(147, 112, 219)},
-
104  {"mediumseagreen", sf::Color(60, 179, 113)},
-
105  {"mediumslateblue", sf::Color(123, 104, 238)},
-
106  {"mediumspringgreen", sf::Color(0, 250, 154)},
-
107  {"mediumturquoise", sf::Color(72, 209, 204)},
-
108  {"mediumvioletred", sf::Color(199, 21, 133)},
-
109  {"midnightblue", sf::Color(25, 25, 112)},
-
110  {"mintcream", sf::Color(245, 255, 250)},
-
111  {"mistyrose", sf::Color(255, 228, 225)},
-
112  {"moccasin", sf::Color(255, 228, 181)},
-
113  {"navajowhite", sf::Color(255, 222, 173)},
-
114  {"navy", sf::Color(0, 0, 128)},
-
115  {"oldlace", sf::Color(253, 245, 230)},
-
116  {"olive", sf::Color(128, 128, 0)},
-
117  {"olivedrab", sf::Color(107, 142, 35)},
-
118  {"orange", sf::Color(255, 165, 0)},
-
119  {"orangered", sf::Color(255, 69, 0)},
-
120  {"orchid", sf::Color(218, 112, 214)},
-
121  {"palegoldenrod", sf::Color(238, 232, 170)},
-
122  {"palegreen", sf::Color(152, 251, 152)},
-
123  {"paleturquoise", sf::Color(175, 238, 238)},
-
124  {"palevioletred", sf::Color(219, 112, 147)},
-
125  {"papayawhip", sf::Color(255, 239, 213)},
-
126  {"peachpuff", sf::Color(255, 218, 185)},
-
127  {"peru", sf::Color(205, 133, 63)},
-
128  {"pink", sf::Color(255, 192, 203)},
-
129  {"plum", sf::Color(221, 160, 221)},
-
130  {"powderblue", sf::Color(176, 224, 230)},
-
131  {"purple", sf::Color(128, 0, 128)},
-
132  {"red", sf::Color(255, 0, 0)},
-
133  {"rosybrown", sf::Color(188, 143, 143)},
-
134  {"royalblue", sf::Color(65, 105, 225)},
-
135  {"saddlebrown", sf::Color(139, 69, 19)},
-
136  {"salmon", sf::Color(250, 128, 114)},
-
137  {"sandybrown", sf::Color(244, 164, 96)},
-
138  {"seagreen", sf::Color(46, 139, 87)},
-
139  {"seashell", sf::Color(255, 245, 238)},
-
140  {"sienna", sf::Color(160, 82, 45)},
-
141  {"silver", sf::Color(192, 192, 192)},
-
142  {"skyblue", sf::Color(135, 206, 235)},
-
143  {"slateblue", sf::Color(106, 90, 205)},
-
144  {"slategray", sf::Color(112, 128, 144)},
-
145  {"slategrey", sf::Color(112, 128, 144)},
-
146  {"snow", sf::Color(255, 250, 250)},
-
147  {"springgreen", sf::Color(0, 255, 127)},
-
148  {"steelblue", sf::Color(70, 130, 180)},
-
149  {"tan", sf::Color(210, 180, 140)},
-
150  {"teal", sf::Color(0, 128, 128)},
-
151  {"thistle", sf::Color(216, 191, 216)},
-
152  {"tomato", sf::Color(255, 99, 71)},
-
153  {"turquoise", sf::Color(64, 224, 208)},
-
154  {"violet", sf::Color(238, 130, 238)},
-
155  {"wheat", sf::Color(245, 222, 179)},
-
156  {"white", sf::Color(255, 255, 255)},
-
157  {"whitesmoke", sf::Color(245, 245, 245)},
-
158  {"yellow", sf::Color(255, 255, 0)},
-
159  {"yellowgreen", sf::Color(154, 205, 50)}};
-
160 
-
161 #endif
+
6 #include <string>
+
7 
+
11 class mColor {
+
12 public:
+
19  mColor();
+
20 
+
29  mColor(int red, int green, int blue, int alpha = 255);
+
30 
+
36  explicit mColor(int color);
+
37 
+
48  friend std::ostream& operator<<(std::ostream& os, const mColor& color);
+
49 
+
50  static const mColor Black;
+
51  static const mColor White;
+
52  static const mColor Red;
+
53  static const mColor Green;
+
54  static const mColor Blue;
+
55  static const mColor Yellow;
+
56  static const mColor Magenta;
+
57  static const mColor Cyan;
+
58  static const mColor Transparent;
+
59 
+
60  int r;
+
61  int g;
+
62  int b;
+
63  int a;
+
64 };
+
65 
+
72 static const std::map< std::string, mColor > color_map = {
+
73  {"aliceblue", mColor(240, 248, 255)},
+
74  {"antiquewhite", mColor(250, 235, 215)},
+
75  {"aqua", mColor(0, 255, 255)},
+
76  {"aquamarine", mColor(127, 255, 212)},
+
77  {"azure", mColor(240, 255, 255)},
+
78  {"beige", mColor(245, 245, 220)},
+
79  {"bisque", mColor(255, 228, 196)},
+
80  {"black", mColor(0, 0, 0)},
+
81  {"blanchedalmond", mColor(255, 235, 205)},
+
82  {"blue", mColor(0, 0, 255)},
+
83  {"blueviolet", mColor(138, 43, 226)},
+
84  {"brown", mColor(165, 42, 42)},
+
85  {"burlywood", mColor(222, 184, 135)},
+
86  {"cadetblue", mColor(95, 158, 160)},
+
87  {"chartreuse", mColor(127, 255, 0)},
+
88  {"chocolate", mColor(210, 105, 30)},
+
89  {"coral", mColor(255, 127, 80)},
+
90  {"cornflowerblue", mColor(100, 149, 237)},
+
91  {"cornsilk", mColor(255, 248, 220)},
+
92  {"crimson", mColor(220, 20, 60)},
+
93  {"cyan", mColor(0, 255, 255)},
+
94  {"darkblue", mColor(0, 0, 139)},
+
95  {"darkcyan", mColor(0, 139, 139)},
+
96  {"darkgoldenrod", mColor(184, 134, 11)},
+
97  {"darkgray", mColor(169, 169, 169)},
+
98  {"darkgreen", mColor(0, 100, 0)},
+
99  {"darkgrey", mColor(169, 169, 169)},
+
100  {"darkkhaki", mColor(189, 183, 107)},
+
101  {"darkmagenta", mColor(139, 0, 139)},
+
102  {"darkolivegreen", mColor(85, 107, 47)},
+
103  {"darkorange", mColor(255, 140, 0)},
+
104  {"darkorchid", mColor(153, 50, 204)},
+
105  {"darkred", mColor(139, 0, 0)},
+
106  {"darksalmon", mColor(233, 150, 122)},
+
107  {"darkseagreen", mColor(143, 188, 143)},
+
108  {"darkslateblue", mColor(72, 61, 139)},
+
109  {"darkslategray", mColor(47, 79, 79)},
+
110  {"darkslategrey", mColor(47, 79, 79)},
+
111  {"darkturquoise", mColor(0, 206, 209)},
+
112  {"darkviolet", mColor(148, 0, 211)},
+
113  {"deeppink", mColor(255, 20, 147)},
+
114  {"deepskyblue", mColor(0, 191, 255)},
+
115  {"dimgray", mColor(105, 105, 105)},
+
116  {"dimgrey", mColor(105, 105, 105)},
+
117  {"dodgerblue", mColor(30, 144, 255)},
+
118  {"firebrick", mColor(178, 34, 34)},
+
119  {"floralwhite", mColor(255, 250, 240)},
+
120  {"forestgreen", mColor(34, 139, 34)},
+
121  {"fuchsia", mColor(255, 0, 255)},
+
122  {"gainsboro", mColor(220, 220, 220)},
+
123  {"ghostwhite", mColor(248, 248, 255)},
+
124  {"gold", mColor(255, 215, 0)},
+
125  {"goldenrod", mColor(218, 165, 32)},
+
126  {"gray", mColor(128, 128, 128)},
+
127  {"green", mColor(0, 128, 0)},
+
128  {"greenyellow", mColor(173, 255, 47)},
+
129  {"grey", mColor(128, 128, 128)},
+
130  {"honeydew", mColor(240, 255, 240)},
+
131  {"hotpink", mColor(255, 105, 180)},
+
132  {"indianred", mColor(205, 92, 92)},
+
133  {"indigo", mColor(75, 0, 130)},
+
134  {"ivory", mColor(255, 255, 240)},
+
135  {"khaki", mColor(240, 230, 140)},
+
136  {"lavender", mColor(230, 230, 250)},
+
137  {"lavenderblush", mColor(255, 240, 245)},
+
138  {"lawngreen", mColor(124, 252, 0)},
+
139  {"lemonchiffon", mColor(255, 250, 205)},
+
140  {"lightblue", mColor(173, 216, 230)},
+
141  {"lightcoral", mColor(240, 128, 128)},
+
142  {"lightcyan", mColor(224, 255, 255)},
+
143  {"lightgoldenrodyellow", mColor(250, 250, 210)},
+
144  {"lightgray", mColor(211, 211, 211)},
+
145  {"lightgreen", mColor(144, 238, 144)},
+
146  {"lightgrey", mColor(211, 211, 211)},
+
147  {"lightpink", mColor(255, 182, 193)},
+
148  {"lightsalmon", mColor(255, 160, 122)},
+
149  {"lightseagreen", mColor(32, 178, 170)},
+
150  {"lightskyblue", mColor(135, 206, 250)},
+
151  {"lightslategray", mColor(119, 136, 153)},
+
152  {"lightslategrey", mColor(119, 136, 153)},
+
153  {"lightsteelblue", mColor(176, 196, 222)},
+
154  {"lightyellow", mColor(255, 255, 224)},
+
155  {"lime", mColor(0, 255, 0)},
+
156  {"limegreen", mColor(50, 205, 50)},
+
157  {"linen", mColor(250, 240, 230)},
+
158  {"magenta", mColor(255, 0, 255)},
+
159  {"maroon", mColor(128, 0, 0)},
+
160  {"mediumaquamarine", mColor(102, 205, 170)},
+
161  {"mediumblue", mColor(0, 0, 205)},
+
162  {"mediumorchid", mColor(186, 85, 211)},
+
163  {"mediumpurple", mColor(147, 112, 219)},
+
164  {"mediumseagreen", mColor(60, 179, 113)},
+
165  {"mediumslateblue", mColor(123, 104, 238)},
+
166  {"mediumspringgreen", mColor(0, 250, 154)},
+
167  {"mediumturquoise", mColor(72, 209, 204)},
+
168  {"mediumvioletred", mColor(199, 21, 133)},
+
169  {"midnightblue", mColor(25, 25, 112)},
+
170  {"mintcream", mColor(245, 255, 250)},
+
171  {"mistyrose", mColor(255, 228, 225)},
+
172  {"moccasin", mColor(255, 228, 181)},
+
173  {"navajowhite", mColor(255, 222, 173)},
+
174  {"navy", mColor(0, 0, 128)},
+
175  {"oldlace", mColor(253, 245, 230)},
+
176  {"olive", mColor(128, 128, 0)},
+
177  {"olivedrab", mColor(107, 142, 35)},
+
178  {"orange", mColor(255, 165, 0)},
+
179  {"orangered", mColor(255, 69, 0)},
+
180  {"orchid", mColor(218, 112, 214)},
+
181  {"palegoldenrod", mColor(238, 232, 170)},
+
182  {"palegreen", mColor(152, 251, 152)},
+
183  {"paleturquoise", mColor(175, 238, 238)},
+
184  {"palevioletred", mColor(219, 112, 147)},
+
185  {"papayawhip", mColor(255, 239, 213)},
+
186  {"peachpuff", mColor(255, 218, 185)},
+
187  {"peru", mColor(205, 133, 63)},
+
188  {"pink", mColor(255, 192, 203)},
+
189  {"plum", mColor(221, 160, 221)},
+
190  {"powderblue", mColor(176, 224, 230)},
+
191  {"purple", mColor(128, 0, 128)},
+
192  {"red", mColor(255, 0, 0)},
+
193  {"rosybrown", mColor(188, 143, 143)},
+
194  {"royalblue", mColor(65, 105, 225)},
+
195  {"saddlebrown", mColor(139, 69, 19)},
+
196  {"salmon", mColor(250, 128, 114)},
+
197  {"sandybrown", mColor(244, 164, 96)},
+
198  {"seagreen", mColor(46, 139, 87)},
+
199  {"seashell", mColor(255, 245, 238)},
+
200  {"sienna", mColor(160, 82, 45)},
+
201  {"silver", mColor(192, 192, 192)},
+
202  {"skyblue", mColor(135, 206, 235)},
+
203  {"slateblue", mColor(106, 90, 205)},
+
204  {"slategray", mColor(112, 128, 144)},
+
205  {"slategrey", mColor(112, 128, 144)},
+
206  {"snow", mColor(255, 250, 250)},
+
207  {"springgreen", mColor(0, 255, 127)},
+
208  {"steelblue", mColor(70, 130, 180)},
+
209  {"tan", mColor(210, 180, 140)},
+
210  {"teal", mColor(0, 128, 128)},
+
211  {"thistle", mColor(216, 191, 216)},
+
212  {"tomato", mColor(255, 99, 71)},
+
213  {"transparent", mColor(0, 0, 0, 0)},
+
214  {"turquoise", mColor(64, 224, 208)},
+
215  {"violet", mColor(238, 130, 238)},
+
216  {"wheat", mColor(245, 222, 179)},
+
217  {"white", mColor(255, 255, 255)},
+
218  {"whitesmoke", mColor(245, 245, 245)},
+
219  {"yellow", mColor(255, 255, 0)},
+
220  {"yellowgreen", mColor(154, 205, 50)}};
+
221 
+
222 #endif
+
Utility class for manipulating RGBA mColors.
Definition: Color.hpp:11
+
static const mColor Cyan
Cyan predefined color.
Definition: Color.hpp:57
+
int g
Green component.
Definition: Color.hpp:61
+
friend std::ostream & operator<<(std::ostream &os, const mColor &color)
Prints the color.
Definition: Color.cpp:29
+
int r
Red component.
Definition: Color.hpp:60
+
static const mColor Blue
Blue predefined color.
Definition: Color.hpp:54
+
static const mColor Yellow
Yellow predefined color.
Definition: Color.hpp:55
+
static const mColor White
White predefined color.
Definition: Color.hpp:51
+
static const mColor Magenta
Magenta predefined color.
Definition: Color.hpp:56
+
mColor()
Default constructor.
Definition: Color.cpp:14
+
static const mColor Red
Red predefined color.
Definition: Color.hpp:52
+
static const mColor Black
Black predefined color.
Definition: Color.hpp:50
+
static const mColor Green
Green predefined color.
Definition: Color.hpp:53
+
int a
Alpha (opacity) component.
Definition: Color.hpp:63
+
static const mColor Transparent
Transparent (black) predefined color.
Definition: Color.hpp:58
+
int b
Blue component.
Definition: Color.hpp:62
1 #include "Viewer.hpp"
-
2 
-
3 Viewer* Viewer::instance = nullptr;
-
4 
-
5 Viewer* Viewer::getInstance(sf::RenderWindow& Window, sf::View& View) {
-
6  if (instance == nullptr) {
-
7  instance = new Viewer(Window, View);
-
8  }
-
9  return instance;
-
10 }
-
11 
-
12 Viewer::Viewer(sf::RenderWindow& Window, sf::View& View)
-
13  : window(Window), view(View) {}
-
14 
-
15 void Viewer::handleEvents(sf::Event event) {
-
16  if (event.type == sf::Event::Closed) {
-
17  window.close();
-
18  }
-
19 
-
20  // Zoom in by + (including '=' key)
-
21  if ((event.type == sf::Event::KeyPressed &&
-
22  event.key.code == sf::Keyboard::Add) ||
-
23  (event.type == sf::Event::KeyPressed &&
-
24  event.key.code == sf::Keyboard::Equal)) {
-
25  zoom(0.9f);
-
26  }
-
27 
-
28  // Zoom out by - (including '-' key)
-
29  if ((event.type == sf::Event::KeyPressed &&
-
30  event.key.code == sf::Keyboard::Subtract) ||
-
31  (event.type == sf::Event::KeyPressed &&
-
32  event.key.code == sf::Keyboard::Hyphen)) {
-
33  zoom(1.1f);
-
34  }
-
35 
-
36  // Rotate clockwise by 'R' key
-
37  if (event.type == sf::Event::KeyPressed &&
-
38  event.key.code == sf::Keyboard::R) {
-
39  rotate(90.0f);
-
40  }
-
41 
-
42  // Rotate anti-clockwise by 'E' key
-
43  if (event.type == sf::Event::KeyPressed &&
-
44  event.key.code == sf::Keyboard::E) {
-
45  rotate(-90.0f);
-
46  }
-
47 
-
48  // Zoom in/out with mouse scroll
-
49  if (event.type == sf::Event::MouseWheelScrolled) {
-
50  if (event.mouseWheelScroll.wheel == sf::Mouse::VerticalWheel) {
-
51  if (event.mouseWheelScroll.delta > 0) {
-
52  zoom(0.9f);
-
53  } else {
-
54  zoom(1.1f);
-
55  }
-
56  }
-
57  }
+
2 Viewer* Viewer::instance = nullptr;
+
3 
+ +
5  if (!instance) {
+
6  instance = new Viewer();
+
7  }
+
8  return instance;
+
9 }
+
10 
+ +
12  is_dragging = false;
+
13  zoom_factor = 1.0f;
+
14  rotate_angle = 0.0f;
+
15  offset_x = 0.0f;
+
16  offset_y = 0.0f;
+
17 }
+
18 
+ +
20  if (instance) {
+
21  delete instance;
+
22  instance = nullptr;
+
23  }
+
24 }
+
25 
+
26 void Viewer::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) {
+
27  switch (message) {
+
28  case WM_MOUSEWHEEL:
+
29  handleMouseWheel(wParam);
+
30  break;
+
31 
+
32  case WM_MOUSEMOVE:
+
33  if (wParam & MK_LBUTTON) {
+
34  handleMouseMove(lParam);
+
35  }
+
36 
+
37  case WM_LBUTTONDOWN:
+
38  handleLeftButtonDown(lParam);
+
39  break;
+
40 
+
41  case WM_LBUTTONUP:
+ +
43  break;
+
44  }
+
45 }
+
46 
+
47 void Viewer::handleKeyEvent(WPARAM wParam) { handleKeyDown(wParam); }
+
48 
+
49 void Viewer::handleMouseWheel(WPARAM wParam) {
+
50  if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) {
+
51  zoom_factor *= 1.1f;
+
52  needs_repaint = true;
+
53  } else {
+
54  zoom_factor /= 1.1f;
+
55  needs_repaint = true;
+
56  }
+
57 }
58 
-
59  // Zoom in/out with touchpad (control pad)
-
60  if (event.type == sf::Event::TouchMoved) {
-
61  // Assuming that touchpad input scales the zoom based on movement
-
62  float delta = event.touch.y;
-
63  if (delta > 0) {
-
64  zoom(0.9f);
-
65  } else {
-
66  zoom(1.1f);
-
67  }
-
68  }
-
69 
-
70  // Start dragging the left mouse button
-
71  if (event.type == sf::Event::MouseButtonPressed &&
-
72  event.mouseButton.button == sf::Mouse::Left) {
-
73  startDragging();
-
74  }
-
75 
-
76  // Finish dragging the left mouse button
-
77  if (event.type == sf::Event::MouseButtonReleased &&
-
78  event.mouseButton.button == sf::Mouse::Left) {
-
79  stopDragging();
-
80  }
-
81 }
-
82 
- -
84  if (is_mouse_dragging) {
-
85  sf::Vector2i currentMousePosition = sf::Mouse::getPosition(window);
-
86  sf::Vector2f offset =
-
87  sf::Vector2f(currentMousePosition - last_mouse_position);
-
88  moveView(offset);
-
89  last_mouse_position = currentMousePosition;
-
90  }
-
91 }
-
92 
-
93 void Viewer::zoom(float factor) {
-
94  view.zoom(factor);
-
95  window.setView(view);
-
96 }
-
97 
-
98 void Viewer::rotate(float angle) {
-
99  view.rotate(angle);
-
100  window.setView(view);
+
59 void Viewer::handleMouseMove(LPARAM lParam) {
+
60  if (is_dragging) {
+
61  int x = static_cast< int >(LOWORD(lParam));
+
62  int y = static_cast< int >(HIWORD(lParam));
+
63 
+
64  if (x != last_mouse_pos.x || y != last_mouse_pos.y) {
+
65  offset_x += (x - last_mouse_pos.x) * zoom_factor;
+
66  offset_y += (y - last_mouse_pos.y) * zoom_factor;
+
67  last_mouse_pos.x = x;
+
68  last_mouse_pos.y = y;
+
69  needs_repaint = true;
+
70  }
+
71  }
+
72 }
+
73 
+
74 void Viewer::handleLeftButtonDown(LPARAM lParam) {
+
75  is_dragging = true;
+
76  last_mouse_pos.x = static_cast< int >(LOWORD(lParam));
+
77  last_mouse_pos.y = static_cast< int >(HIWORD(lParam));
+
78  SetCapture(GetActiveWindow());
+
79 }
+
80 
+ +
82  is_dragging = false;
+
83  ReleaseCapture();
+
84 
+
85  if (needs_repaint) {
+
86  needs_repaint = false;
+
87  }
+
88 }
+
89 
+
90 void Viewer::handleKeyDown(WPARAM wParam) {
+
91  char key = static_cast< char >(wParam);
+
92  switch (tolower(key)) {
+
93  case 'q':
+
94  rotate_angle -= 1.0f;
+
95  break;
+
96 
+
97  case 'e':
+
98  rotate_angle += 1.0f;
+
99  break;
+
100  }
101 }
-
102 
- -
104  is_mouse_dragging = true;
-
105  last_mouse_position = sf::Mouse::getPosition(window);
-
106 }
-
107 
- -
109 
-
110 void Viewer::moveView(const sf::Vector2f& offset) {
-
111  view.move(-offset);
-
112  window.setView(view);
-
113 }
-
Represents a viewer for handling events and interactions with an SFML window.
Definition: Viewer.hpp:13
-
bool is_mouse_dragging
Flag indicating whether mouse dragging is active.
Definition: Viewer.hpp:60
-
void moveView(const sf::Vector2f &offset)
Moves the view by the specified offset.
Definition: Viewer.cpp:110
-
sf::RenderWindow & window
Reference to the SFML window.
Definition: Viewer.hpp:57
-
static Viewer * instance
Singleton instance of Viewer.
Definition: Viewer.hpp:56
-
void zoom(float factor)
Zooms the view by the specified factor.
Definition: Viewer.cpp:93
-
static Viewer * getInstance(sf::RenderWindow &Window, sf::View &View)
Gets the singleton instance of Viewer.
Definition: Viewer.cpp:5
-
sf::Vector2i last_mouse_position
Last recorded mouse position.
Definition: Viewer.hpp:59
-
sf::View & view
Reference to the SFML view.
Definition: Viewer.hpp:58
-
void startDragging()
Starts dragging the view.
Definition: Viewer.cpp:103
-
Viewer(const Viewer &)=delete
Deleted copy constructor to prevent copying of Viewer instances.
-
void handleDragging()
Handles dragging interaction.
Definition: Viewer.cpp:83
-
void rotate(float angle)
Rotates the view by the specified angle.
Definition: Viewer.cpp:98
-
void stopDragging()
Stops dragging the view.
Definition: Viewer.cpp:108
-
void handleEvents(sf::Event event)
Handles SFML events.
Definition: Viewer.cpp:15
+
Represents a viewer for rendering and interacting with a scene.
Definition: Viewer.hpp:16
+
void handleLeftButtonDown(LPARAM lParam)
Handles the left button down event for initiating dragging.
Definition: Viewer.cpp:74
+
float offset_y
Y-coordinate offset of the viewer.
Definition: Viewer.hpp:19
+
~Viewer()
Destructor for the Viewer class.
Definition: Viewer.cpp:19
+
float offset_x
X-coordinate offset of the viewer.
Definition: Viewer.hpp:18
+
bool is_dragging
Flag indicating whether the mouse is being dragged.
Definition: Viewer.hpp:74
+
float zoom_factor
Zoom factor for scaling the view.
Definition: Viewer.hpp:20
+
static Viewer * instance
Singleton instance of the Viewer class.
Definition: Viewer.hpp:55
+
bool needs_repaint
Definition: Viewer.hpp:22
+
void handleKeyEvent(WPARAM wParam)
Handles keyboard events.
Definition: Viewer.cpp:47
+
POINT last_mouse_pos
Last recorded mouse position.
Definition: Viewer.hpp:75
+
void handleMouseMove(LPARAM lParam)
Handles the mouse move event for panning.
Definition: Viewer.cpp:59
+
static Viewer * getInstance()
Gets the singleton instance of the Viewer class.
Definition: Viewer.cpp:4
+
float rotate_angle
Rotation angle of the view.
Definition: Viewer.hpp:21
+
void handleKeyDown(WPARAM wParam)
Handles the key down event for rotating.
Definition: Viewer.cpp:90
+
void handleMouseWheel(WPARAM wParam)
Handles the mouse wheel event for zooming.
Definition: Viewer.cpp:49
+
Viewer()
Private constructor for the Viewer class.
Definition: Viewer.cpp:11
+
void handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)
Handles mouse events, such as wheel, move, left button down, and left button up.
Definition: Viewer.cpp:26
+
void handleLeftButtonUp()
Handles the left button up event for ending dragging.
Definition: Viewer.cpp:81
diff --git a/docs/html/annotated_dup.js b/docs/html/annotated_dup.js index f0bf6aec..cc3828f3 100644 --- a/docs/html/annotated_dup.js +++ b/docs/html/annotated_dup.js @@ -1,13 +1,20 @@ var annotated_dup = [ [ "Circle", "classCircle.html", "classCircle" ], - [ "Ellipse", "classEllipse.html", "classEllipse" ], + [ "Ell", "classEll.html", "classEll" ], + [ "Group", "classGroup.html", "classGroup" ], [ "Line", "classLine.html", "classLine" ], + [ "mColor", "classmColor.html", "classmColor" ], [ "Parser", "classParser.html", "classParser" ], - [ "Polygon", "classPolygon.html", "classPolygon" ], - [ "Polyline", "classPolyline.html", "classPolyline" ], + [ "Path", "classPath.html", "classPath" ], + [ "PathPoint", "structPathPoint.html", "structPathPoint" ], + [ "Plygon", "classPlygon.html", "classPlygon" ], + [ "Plyline", "classPlyline.html", "classPlyline" ], + [ "PolyShape", "classPolyShape.html", "classPolyShape" ], [ "Rect", "classRect.html", "classRect" ], - [ "Shape", "classShape.html", "classShape" ], + [ "Renderer", "classRenderer.html", "classRenderer" ], + [ "SVGElement", "classSVGElement.html", "classSVGElement" ], [ "Text", "classText.html", "classText" ], + [ "Vector2D", "classVector2D.html", "classVector2D" ], [ "Viewer", "classViewer.html", "classViewer" ] ]; \ No newline at end of file diff --git a/docs/html/classCircle-members.html b/docs/html/classCircle-members.html index be7418a9..5342e359 100644 --- a/docs/html/classCircle-members.html +++ b/docs/html/classCircle-members.html @@ -60,7 +60,7 @@
svg-reader -  0.1 +  0.2
Parse and render SVG files, handle user interactions.
@@ -124,45 +124,35 @@

This is the complete list of members for Circle, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
boundsShapeprivate
Circle(float radius, const sf::Vector2f &center, sf::Color fill, sf::Color stroke, float stroke_thickness)Circle
draw(sf::RenderWindow &target, sf::RenderStates states=sf::RenderStates::Default) constShapevirtual
Ellipse(const sf::Vector2f &radius, const sf::Vector2f &center, sf::Color fill, sf::Color stroke, float stroke_thickness)Ellipse
fill_colorShapeprivate
getFillColor() constShape
getInverseTransform() constShape
getOutlineColor() constShape
getOutlineThickness() constShape
getPoint(std::size_t index) const overrideEllipsevirtual
getPointCount() constEllipsevirtual
getTransform() constShape
inside_boundsShapeprivate
inverse_transformShapemutableprivate
inverse_transform_need_updateShapemutableprivate
originShapeprivate
outline_colorShapeprivate
outline_thicknessShapeprivate
outline_verticesShapeprivate
positionShapeprivate
radiusEllipseprotected
rotationShapeprivate
scaleShapeprivate
SCALEEllipseprotected
setFillColor(const sf::Color &color)Shape
setOutlineColor(const sf::Color &color)Shape
setOutlineThickness(float thickness)Shape
setPosition(float x, float y)Shape
setPosition(const sf::Vector2f &position)Shape
Shape()Shapeprotected
textureShapeprivate
transformShapemutableprivate
transform_need_updateShapemutableprivate
update()Shapeprotected
updateFillColors()Shapeprivate
updateOutline()Shapeprivate
updateOutlineColors()Shapeprivate
verticesShapeprivate
~Shape()=defaultShapevirtual
addElement(SVGElement *element)SVGElementvirtual
Circle(float radius, const Vector2Df &center, mColor fill, mColor stroke, float stroke_width)Circle
Ell(const Vector2Df &radius, const Vector2Df &center, mColor fill, mColor stroke, float stroke_width)Ell
fillSVGElementprivate
getClass() const overrideCirclevirtual
getFillColor() constSVGElement
getOutlineColor() constSVGElement
getOutlineThickness() constSVGElement
getParent() constSVGElement
getPosition() constSVGElement
getRadius() constEll
getTransforms() constSVGElement
parentSVGElementprotected
positionSVGElementprivate
printData() const overrideEllvirtual
radiusEllprivate
setFillColor(const mColor &color)SVGElement
setOutlineColor(const mColor &color)SVGElement
setOutlineThickness(float thickness)SVGElement
setParent(SVGElement *parent)SVGElement
setPosition(float x, float y)SVGElement
setPosition(const Vector2Df &position)SVGElement
setRadius(const Vector2Df &radius)Ell
setTransforms(const std::vector< std::string > &transforms)SVGElement
strokeSVGElementprivate
stroke_widthSVGElementprivate
SVGElement()SVGElementprotected
transformsSVGElementprivate
~SVGElement()=defaultSVGElementvirtual