-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeometryplayground.cpp
More file actions
101 lines (81 loc) · 3.17 KB
/
geometryplayground.cpp
File metadata and controls
101 lines (81 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "geometryplayground.h"
#include "thickline.h"
#include "thicklinemesh.h"
#include "thicklinegeometry.h"
#include "vhapi/2dentities/pointentity.hpp"
#include "vhapi/2dentities/lineentity.hpp"
#include "vhapi/2dentities/markerentity.hpp"
#include "vhapi/2dentities/polylineentity.h"
#include "vhapi/2dentities/arcentity.h"
#include <QDebug>
GeometryPlayground::GeometryPlayground(QObject *parent) : QObject(parent)
{
}
void GeometryPlayground::setTargetThickLine(ThickLine *line)
{
ThickLineMesh *mesh = line->findChild<ThickLineMesh *>("");
if (mesh) {
qDebug() << "found mesh" << mesh;
m_geometry = mesh->geometry();
}
}
void GeometryPlayground::onDrawSmthClicked()
{
qDebug() << "Drawing smth";
m_geometry->clear();
m_geometry->addPoint(-0.5, 0, 0, 0xcc, 0xcc, 0xcc, 2);
m_geometry->addPoint(0.5, 0.0, 0, 0xcc, 0xcc, 0xcc, 2);
m_geometry->breakStrip();
m_geometry->addPoint(0, -0.5, 0, 0xcc, 0xcc, 0xcc, 2);
m_geometry->addPoint(0, 0.5, 0, 0xcc, 0xcc, 0xcc, 2);
m_geometry->breakStrip();
m_geometry->flush();
}
void GeometryPlayground::onDrawPlusClicked()
{
// QVariantHash meta;
// meta["source"] = "playground";
// QVariant entity;
// entity.setValue<MarkerEntity>(MarkerEntity(meta));
// emit rxport->substreamItemReceived(entity);
// LineEntity l = LineEntity(PointEntity(0, 0, 0, 255, 0, 0), PointEntity(300, 0.0, 0.0), 3);
// entity.setValue<LineEntity>(l);
// emit rxport->substreamItemReceived(entity);
//// PolylineEntity pl;
//// pl.m_points.append( { PointEntity(0, 0, 0, 255, 0, 0), 3 } );
//// pl.m_points.append( { PointEntity(0.1, 0, 0, 255, 0, 0), 3 } );
//// pl.m_points.append( { PointEntity(0.101, 0, 0, 255, 0, 0), 10 } );
//// pl.m_points.append( { PointEntity(0.11, 0, 0, 255, 0, 0), 1 } );
//// emit rxport->substreamItemReceived(pl);
// l = LineEntity(PointEntity(0, 0, 0, 0, 255, 0), PointEntity(0.0, 300, 0), 3);
// entity.setValue<LineEntity>(l);
// emit rxport->substreamItemReceived(entity);
// l = LineEntity(PointEntity(0, 0, 0, 0, 0, 255), PointEntity(0.0, 0.0, 300), 3);
// entity.setValue<LineEntity>(l);
// emit rxport->substreamItemReceived(entity);
ArcEntity arc(PointEntity(0, 0, 0), PointEntity(100, -50, 0), PointEntity(200, 0, 0));
qDebug() << arc;
//return;
MarkerEntity marker;
marker.m_metadata["source"] = "geom_playground";
QVariant v;
v.setValue<MarkerEntity>(marker);
emit rxport->substreamItemReceived(v);
LineEntity l = LineEntity(PointEntity(0, 0, 0, 255, 0, 0), PointEntity(300, 0.0, 0.0), 3);
v.setValue<LineEntity>(l);
emit rxport->substreamItemReceived(v);
// PolylineEntity poly;
// poly.setColor(255, 0, 0);
// poly.setThickness(1);
// for (float y = 0.0f; y < 2000.0f; y += 15.0f) {
// for (float x = 0.0f; x < 2000.0f; x += 0.1f) {
// poly.addPoint(PointEntity(x, y, 0.0));
// poly.addPoint(PointEntity(x, y + 10.0, 0.0));
// }
// }
v.setValue<ArcEntity>(arc);
emit rxport->substreamItemReceived(v);
marker.m_metadata.insert("end", QVariant());
v.setValue<MarkerEntity>(marker);
emit rxport->substreamItemReceived(v);
}