aboutsummaryrefslogtreecommitdiff
path: root/geometry.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-26 18:15:50 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-26 18:15:50 +0100
commit41e1b2bfb8e2ba3d0e74180200e7cc109171213e (patch)
tree27c7dbaa8fcdcc7efb300c0ea0a44b28d2ac76c0 /geometry.cpp
parent7f0f945c35bc8c12d55efbce7545995fc76892c1 (diff)
Scatterplot & BarChart: initial brushing mechanism.
* Both components now support brushing (support in Scatterplot for activating a brush is still incomplete, though it can be brushed on by other components) * Added a handler for linking the brushing between components * Added crosshair geometry handler to geometry lib * Fixed issue #15
Diffstat (limited to 'geometry.cpp')
-rw-r--r--geometry.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/geometry.cpp b/geometry.cpp
index 4ed01ee..a8be3f4 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -37,3 +37,28 @@ void updateRectGeometry(QSGGeometry *geometry, float x, float y, float w, float
vertexData[2].set(x + w, y + h);
vertexData[3].set(x, y + h);
}
+
+void updateCrossHairGeometry(QSGGeometry *geometry,
+ float x,
+ float y,
+ float thickness,
+ float length)
+{
+ QSGGeometry::Point2D *vertexData = geometry->vertexDataAsPoint2D();
+ if (geometry->vertexCount() != 12) {
+ return;
+ }
+
+ vertexData[ 0].set(x + thickness, y - thickness);
+ vertexData[ 1].set(x + length, y - thickness);
+ vertexData[ 2].set(x + length, y + thickness);
+ vertexData[ 3].set(x + thickness, y + thickness);
+ vertexData[ 4].set(x + thickness, y + length);
+ vertexData[ 5].set(x - thickness, y + length);
+ vertexData[ 6].set(x - thickness, y + thickness);
+ vertexData[ 7].set(x - length, y + thickness);
+ vertexData[ 8].set(x - length, y - thickness);
+ vertexData[ 9].set(x - thickness, y - thickness);
+ vertexData[10].set(x - thickness, y - length);
+ vertexData[11].set(x + thickness, y - length);
+}