Skip to content

Commit

Permalink
Move document parsing into Layout and clean-up compile time warnings.
Browse files Browse the repository at this point in the history
This commit updates the naming convention standard going forward. All
public functions will use CamelCase(). Many small adjustments as well to
reduce the amount of code inside of Application.
  • Loading branch information
NSkelsey committed Jul 16, 2020
1 parent 316732d commit 86a2c1f
Show file tree
Hide file tree
Showing 13 changed files with 440 additions and 425 deletions.
19 changes: 9 additions & 10 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
TODO
=====
### Webopticon

- [ ] Necessary MVP tweaks
- [N] use vlan tags for layout groups
- [ ] Move right-click to space
- [ ] Model Cyberlab Network
- [ ] decide how VPN access to nginx frontend will work.
- [ ] deploy broker + sbackend + nginx frontend
- [ ] Integrate scenario data into scene


### Backlog
========================================
Expand Down Expand Up @@ -152,6 +142,15 @@ Do Thing:
DONE
====
### Webopticon
- [x] Necessary MVP tweaks
- [N] use vlan tags for layout groups
- [y] Move right-click to space
- [x] Model Cyberlab Network
- [x] decide how VPN access to nginx frontend will work.
- [x] deploy broker + sbackend + nginx frontend
- [x] Integrate scenario data into scene
### ### ###
- [x] Fix object coloring and buffer bindings using latest updates to magnum
- [x] Build communication tunnel
- [x] Decide on Websockets or something else
Expand Down
21 changes: 14 additions & 7 deletions resources.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ filename=src/shaders/worldlink.vs
[file]
filename=src/assets/DejaVuSans.ttf

[file]
filename=src/assets/cyberlab.xml

[file]
filename=src/assets/alb-cyberlab.xml
# You can use drawio to layout a network that is then annotated with the samples
# provided below. The drawio graphic must be annotated with the following classes
# added to objects via 'edit data'.
#
# Classes:
# center - where the scene should be centered
# bcast - the broadcast pool center for a vlan
# device - an ellipse positioned on the switch
# switch - a <g> that contains a switch rect and devices
# device - an ellipse positioned on the switch
# switch-rect - the geometry of the switch
# device - a simple device

[file]
filename=src/assets/home-wifi.xml
filename=src/assets/sample-layout-drawio.xml

[file]
filename=src/assets/home-wifi-devs.xml
filename=src/assets/sample-devs.xml
81 changes: 0 additions & 81 deletions src/assets/cyberlab.xml

This file was deleted.

31 changes: 31 additions & 0 deletions src/assets/sample-devs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<author>n.skelsey</author>
<wifi_router>
<network>
<bridge>router</bridge>
<tag>1</tag>
<ip>192.168.1.1</ip>
<mac>be:ef:be:ef:be:ef</mac>
</network>
</wifi_router>
<winzoz_pc>
<network>
<bridge>vmbr</bridge>
<tag>1</tag>
<ip>192.168.1.101</ip>
<mac>be:ef:ca:fe:ca:fe</mac>
</network>
<started>true</started>
<vm_id>104</vm_id>
</winzoz_pc>
<iphone_30>
<network>
<bridge>vmbr</bridge>
<tag>2</tag>
<ip>192.168.1.42</ip>
<mac>ca:fe:ca:fe:ca:fe</mac>
</network>
<vm_id>106</vm_id>
</iphone_30>
</root>
41 changes: 41 additions & 0 deletions src/assets/sample-layout-drawio.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2020-07-12T17:19:06.336Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36" etag="01VAlMM4bLZX3p2JBdlc" compressed="true" version="13.4.2" type="device">
<diagram id="jqfGGf_7ZzLIy3FHOFG0" name="Page-1">
<mxGraphModel dx="871" dy="465" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<object label="(0,0)" class="center" id="HuDwKePgMMkB4XPKHNRV-101">
<mxCell style="whiteSpace=wrap;html=1;aspect=fixed;dashed=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="434" y="319.5" width="1" height="1" as="geometry" />
</mxCell>
</object>
<object label="" class="switch" id="coFcF6SQwalx10ZarlYS-23">
<mxCell style="group" parent="1" vertex="1" connectable="0">
<mxGeometry x="260" y="250" width="100" height="130" as="geometry" />
</mxCell>
</object>
<object label="wifi_router" class="switch-rect" id="HuDwKePgMMkB4XPKHNRV-7">
<mxCell style="rounded=0;whiteSpace=wrap;html=1;" parent="coFcF6SQwalx10ZarlYS-23" vertex="1">
<mxGeometry x="10" y="10" width="80" height="120" as="geometry" />
</mxCell>
</object>
<object label="1" class="device" id="R_lO7g0ntE3RoQr6fGAW-17">
<mxCell style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="coFcF6SQwalx10ZarlYS-23" vertex="1">
<mxGeometry x="80" y="60" width="20" height="20" as="geometry" />
</mxCell>
</object>
<object label="winzoz_pc" class="device" id="YTh0AKUFCmQrXkss0Y7l-4">
<mxCell style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="1" vertex="1">
<mxGeometry x="425" y="310" width="20" height="20" as="geometry" />
</mxCell>
</object>
<object label="iphone_30" class="device" id="YTh0AKUFCmQrXkss0Y7l-18">
<mxCell style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="1" vertex="1">
<mxGeometry x="510" y="310" width="20" height="20" as="geometry" />
</mxCell>
</object>
</root>
</mxGraphModel>
</diagram>
</mxfile>
15 changes: 7 additions & 8 deletions src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ void Graphic::prepare3DFont()

Device::Stats *Graphic::createSphere(Store *sCtx, const std::string mac)
{
int num_objs = sCtx->_device_map.size();
Vector2 v = sCtx->nextVlanPos(1);
Vector2 v = sCtx->NextVlanPos();
Vector3 w = Vector3{v.x(), 0.0f, v.y()};

return createSphere(sCtx, mac, &_scene, w);
Expand All @@ -103,7 +102,7 @@ Device::Stats *Graphic::createSphere(Store *sCtx, const std::string mac, Object3
o->translate(relPos);
sphere_obj->transform(Matrix4::scaling(Vector3{0.25f}));

UnsignedByte id = sCtx->newObjectId();
UnsignedByte id = sCtx->NewObjectId();

Color3 c = 0xa5c9ea_rgbf;
Figure::DeviceDrawable *dev = new Figure::DeviceDrawable{
Expand Down Expand Up @@ -141,7 +140,7 @@ Monopticon::Level3::Address *Graphic::createIPv4Address(Context::Store *sCtx, co

Color3 c = 0xffffff_rgbf;

UnsignedByte id = sCtx->newObjectId();
UnsignedByte id = sCtx->NewObjectId();

Level3::Address *address_obj = new Level3::Address{
id,
Expand Down Expand Up @@ -238,7 +237,7 @@ Layout::Router* Graphic::createRouter(Store *sCtx, Layout::RouterParam* param)
Object3D *root = new Object3D{&_scene};
root->translate(param->pos - center);

Layout::Router* router = new Layout::Router(0, param->vlan_iface_map.size(), root);
Layout::Router* router = new Layout::Router(root);
//auto grid = Util::createLayoutRing(*root, _permanent_drawables, 2.0f, Vector3{});

// TODO store min and max x and y and generate connecting rectangle of that size.
Expand Down Expand Up @@ -395,12 +394,12 @@ Store::Store()
{
}

UnsignedByte Store::newObjectId()
UnsignedByte Store::NewObjectId()
{
return static_cast<UnsignedByte>(_selectable_objects.size());
}

Vector2 Store::nextVlanPos(const int vlan)
Vector2 Store::NextVlanPos()
{
int row_size = 4;

Expand All @@ -413,7 +412,7 @@ Vector2 Store::nextVlanPos(const int vlan)
}


void Store::frameUpdate() {
void Store::FrameUpdate() {
// Remove packet_lines that have expired from the queue
std::set<Figure::PacketLineDrawable *>::iterator it;
for (it = _packet_line_queue.begin(); it != _packet_line_queue.end(); ) {
Expand Down
9 changes: 4 additions & 5 deletions src/eth_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,12 @@ int Stats::rightClickActions() {
if (ImGui::MenuItem("Watch", NULL, false)) {
std::cout << "Want to watch" << std::endl;
return 1;
}
if (ImGui::MenuItem("Set Orbit", NULL, false)) {
//watchSelectedDevice();
std::cout << "Want to orbit" << std::endl;
} else if (ImGui::MenuItem("no-op", NULL, false)) {
std::cout << "picked no-op" << std::endl;
return 3;
} else {
return 0;
}
return 0;
}


Expand Down
Loading

0 comments on commit 86a2c1f

Please sign in to comment.