New graph in place
Also: - Data from Spacebrew publishers now utilised in bar graph - Added raage slider to adjust graph width - it now starts just before the HUD graphic hole and ends about 80% of screen length. - Graph height now adjustable - these are the values
This commit is contained in:
parent
e2523e0b72
commit
6d50b2efae
@ -111,6 +111,7 @@
|
|||||||
<ClCompile Include="..\..\..\addons\ofxSpacebrew\src\ofxSpacebrew.cpp" />
|
<ClCompile Include="..\..\..\addons\ofxSpacebrew\src\ofxSpacebrew.cpp" />
|
||||||
<ClCompile Include="src\visual\graph\AbstractGraph.cpp" />
|
<ClCompile Include="src\visual\graph\AbstractGraph.cpp" />
|
||||||
<ClCompile Include="src\visual\graph\BarGraph.cpp" />
|
<ClCompile Include="src\visual\graph\BarGraph.cpp" />
|
||||||
|
<ClCompile Include="src\visual\graph\BodyGraph.cpp" />
|
||||||
<ClCompile Include="src\visual\Scene.cpp" />
|
<ClCompile Include="src\visual\Scene.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -188,6 +189,7 @@
|
|||||||
<ClInclude Include="..\..\..\addons\ofxSpacebrew\src\ofxSpacebrew.h" />
|
<ClInclude Include="..\..\..\addons\ofxSpacebrew\src\ofxSpacebrew.h" />
|
||||||
<ClInclude Include="src\visual\graph\AbstractGraph.h" />
|
<ClInclude Include="src\visual\graph\AbstractGraph.h" />
|
||||||
<ClInclude Include="src\visual\graph\BarGraph.h" />
|
<ClInclude Include="src\visual\graph\BarGraph.h" />
|
||||||
|
<ClInclude Include="src\visual\graph\BodyGraph.h" />
|
||||||
<ClInclude Include="src\visual\Scene.h" />
|
<ClInclude Include="src\visual\Scene.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -73,6 +73,9 @@
|
|||||||
<ClCompile Include="..\..\..\addons\ofxFTGL\src\ofxFTGLFont.cpp">
|
<ClCompile Include="..\..\..\addons\ofxFTGL\src\ofxFTGLFont.cpp">
|
||||||
<Filter>addons\ofxFTGL\src</Filter>
|
<Filter>addons\ofxFTGL\src</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\visual\graph\BodyGraph.cpp">
|
||||||
|
<Filter>src\visual\graph</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="src">
|
<Filter Include="src">
|
||||||
@ -368,6 +371,9 @@
|
|||||||
<ClInclude Include="..\..\..\addons\ofxFTGL\libs\FTGL\include\FTGL\FTBuffer.h">
|
<ClInclude Include="..\..\..\addons\ofxFTGL\libs\FTGL\include\FTGL\FTBuffer.h">
|
||||||
<Filter>addons\ofxFTGL\libs\FTGL\include\FTGL</Filter>
|
<Filter>addons\ofxFTGL\libs\FTGL\include\FTGL</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\visual\graph\BodyGraph.h">
|
||||||
|
<Filter>src\visual\graph</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="icon.rc">
|
<ResourceCompile Include="icon.rc">
|
||||||
|
|||||||
Binary file not shown.
@ -8,6 +8,11 @@
|
|||||||
<Name>BarWidth</Name>
|
<Name>BarWidth</Name>
|
||||||
<Value>17.000000000</Value>
|
<Value>17.000000000</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Graph Height Max</Name>
|
||||||
|
<Value>407.894744873</Value>
|
||||||
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Data0 red</Name>
|
<Name>Data0 red</Name>
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Graph Item X Gap</Name>
|
||||||
|
<Value>7.220395088</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Line width</Name>
|
||||||
|
<Value>25.661184311</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data0 red</Name>
|
||||||
|
<Value>89.753288269</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data0 green</Name>
|
||||||
|
<Value>208.865127563</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data0 blue</Name>
|
||||||
|
<Value>84.720397949</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data0 alpha</Name>
|
||||||
|
<Value>230.674346924</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data1 red</Name>
|
||||||
|
<Value>164.407897949</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data1 green</Name>
|
||||||
|
<Value>83.042762756</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data1 blue</Name>
|
||||||
|
<Value>208.865127563</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Data1 alpha</Name>
|
||||||
|
<Value>185.378295898</Value>
|
||||||
|
</Widget>
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<Widget>
|
||||||
|
<Kind>2</Kind>
|
||||||
|
<Name>Bar graph</Name>
|
||||||
|
<Value>1</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>2</Kind>
|
||||||
|
<Name>Solid Body graph</Name>
|
||||||
|
<Value>0</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>2</Kind>
|
||||||
|
<Name>Line fade graph</Name>
|
||||||
|
<Value>0</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>6</Kind>
|
||||||
|
<Name>Graph X begin/end (percent)</Name>
|
||||||
|
<HighValue>0.838815808</HighValue>
|
||||||
|
<LowValue>0.069078945</LowValue>
|
||||||
|
</Widget>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<Widget>
|
||||||
|
<Kind>2</Kind>
|
||||||
|
<Name>Bar graph</Name>
|
||||||
|
<Value>0</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>2</Kind>
|
||||||
|
<Name>Solid Body graph</Name>
|
||||||
|
<Value>1</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>2</Kind>
|
||||||
|
<Name>Line fade graph</Name>
|
||||||
|
<Value>0</Value>
|
||||||
|
</Widget>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Text Size</Name>
|
<Name>Text Size</Name>
|
||||||
<Value>27.763158798</Value>
|
<Value>21.842105865</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
@ -46,5 +46,5 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Alpha</Name>
|
<Name>Alpha</Name>
|
||||||
<Value>222.286193848</Value>
|
<Value>255.000000000</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|||||||
@ -11,10 +11,10 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Perlin X Scale (data size)</Name>
|
<Name>Perlin X Scale (data size)</Name>
|
||||||
<Value>0.148730263</Value>
|
<Value>0.163503304</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Perlin Y Scale (time f)</Name>
|
<Name>Perlin Y Scale (time f)</Name>
|
||||||
<Value>0.147088811</Value>
|
<Value>0.217671067</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|||||||
@ -16,5 +16,5 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>ALPHA</Name>
|
<Name>ALPHA</Name>
|
||||||
<Value>139.243423462</Value>
|
<Value>218.930923462</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 MiB |
BIN
of/Active Tripod/bin/data/fonts/Roboto-Black.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Black.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-BlackItalic.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-BlackItalic.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-Bold.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Bold.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-BoldItalic.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-Italic.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Italic.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-Light.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Light.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-LightItalic.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-LightItalic.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-Medium.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Medium.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-MediumItalic.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-Regular.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Regular.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-Thin.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-Thin.ttf
Normal file
Binary file not shown.
BIN
of/Active Tripod/bin/data/fonts/Roboto-ThinItalic.ttf
Normal file
BIN
of/Active Tripod/bin/data/fonts/Roboto-ThinItalic.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -31,11 +31,11 @@ void DataManager::setup()
|
|||||||
void DataManager::setupSpacebrew()
|
void DataManager::setupSpacebrew()
|
||||||
{
|
{
|
||||||
string host = "54.200.6.109"; // Spacebrew::SPACEBREW_CLOUD; // "localhost";
|
string host = "54.200.6.109"; // Spacebrew::SPACEBREW_CLOUD; // "localhost";
|
||||||
string name = "CRITTICAL INFRASTRUCTURE";
|
string name = "CRITICAL INFRASTRUCTURE";
|
||||||
string description = "Description goes here. Not sure why.";
|
string description = "Description goes here. Not sure why. Let me know if you see this and tell me if you need it";
|
||||||
|
|
||||||
spacebrew.addSubscribe(publisher0Name, Spacebrew::TYPE_RANGE);
|
spacebrew.addSubscribe(publisher0Name, Spacebrew::TYPE_STRING);
|
||||||
spacebrew.addSubscribe(publisher1Name, Spacebrew::TYPE_RANGE);
|
spacebrew.addSubscribe(publisher1Name, Spacebrew::TYPE_STRING);
|
||||||
spacebrew.connect( host, name, description );
|
spacebrew.connect( host, name, description );
|
||||||
|
|
||||||
// listen to spacebrew events
|
// listen to spacebrew events
|
||||||
@ -45,24 +45,39 @@ void DataManager::setupSpacebrew()
|
|||||||
|
|
||||||
void DataManager::update()
|
void DataManager::update()
|
||||||
{
|
{
|
||||||
if (isPublisher0DataReceived && isPublisher1DataReceived)
|
|
||||||
{
|
|
||||||
isPublisher0DataReceived = false;
|
|
||||||
isPublisher1DataReceived = false;
|
|
||||||
|
|
||||||
// send a DataReceived event
|
|
||||||
app->scene.barGraph.addNewData(newData);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (isDataSimulated)
|
if (isDataSimulated)
|
||||||
{
|
{
|
||||||
if (ofGetFrameNum() % (int)simulationSpeed == 0)
|
if (ofGetFrameNum() % (int)simulationSpeed == 0)
|
||||||
{
|
{
|
||||||
//newData[0] = (int)(ofNoise(newData.size() * 0.04, ofGetFrameNum() * 0.03, ofGetElapsedTimef() * 0.1) * 1000);
|
DataObject dataObject0;
|
||||||
newData[0] = (int)(ofNoise(newData.size() * perlinXScale, ofGetElapsedTimef() * perlinYScale) * 1000);
|
dataObject0.info = "Some text to describe the data\nSome more text\nOne more line";
|
||||||
newData[1] = (int)(ofNoise((newData.size() + 500) * perlinXScale, (ofGetElapsedTimef() + 1000) * perlinYScale) * 1000);
|
dataObject0.value = ofNoise(newData.size() * perlinXScale, ofGetElapsedTimef() * perlinYScale);
|
||||||
app->scene.barGraph.addNewData(newData);
|
dataObject0.min = 0;
|
||||||
|
dataObject0.max = 1;
|
||||||
|
|
||||||
|
//printf("dataObject0.value = %f \n", dataObject0.value);
|
||||||
|
|
||||||
|
newData[0] = dataObject0;
|
||||||
|
|
||||||
|
DataObject dataObject1;
|
||||||
|
dataObject1.info = "Some descriptive text\nSome more\nLittle bit more\nLast one";
|
||||||
|
dataObject1.value = ofNoise((newData.size() + 500) * perlinXScale, (ofGetElapsedTimef() + 1000) * perlinYScale);
|
||||||
|
dataObject1.min = 0;
|
||||||
|
dataObject1.max = 1;
|
||||||
|
|
||||||
|
newData[1] = dataObject1;
|
||||||
|
|
||||||
|
app->scene.activeGraph->addNewData(newData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (isPublisher0DataReceived && isPublisher1DataReceived)
|
||||||
|
{
|
||||||
|
isPublisher0DataReceived = false;
|
||||||
|
isPublisher1DataReceived = false;
|
||||||
|
app->scene.activeGraph->addNewData(newData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,16 +96,81 @@ void DataManager::draw()
|
|||||||
|
|
||||||
void DataManager::onMessage( Spacebrew::Message & m )
|
void DataManager::onMessage( Spacebrew::Message & m )
|
||||||
{
|
{
|
||||||
|
printf("new message - %s\n", m.valueString().c_str());
|
||||||
|
// split the formatted string into a list of different data types
|
||||||
|
vector<string> data = explode(",", m.valueString());
|
||||||
|
//for(int i = 0; i < data.size(); i++)
|
||||||
|
// cout <<i << " ["<< data[i] <<"] " <<endl;
|
||||||
|
|
||||||
|
|
||||||
|
// make a new data object and add the different data sources to it
|
||||||
|
DataObject dataObject;
|
||||||
|
for (int i = 0; i < data.size(); i++)
|
||||||
|
{
|
||||||
|
if (data[i].substr(0, 5) == "info:")
|
||||||
|
{
|
||||||
|
printf("- - info = %s\n", data[i].substr(5, -1).c_str());
|
||||||
|
dataObject.info = data[i].substr(5, -1).c_str();
|
||||||
|
}
|
||||||
|
if (data[i].substr(0, 6) == "value:")
|
||||||
|
{
|
||||||
|
printf("- - value = %s\n", data[i].substr(6, -1).c_str());
|
||||||
|
dataObject.value = ofToFloat(data[i].substr(6, -1).c_str());
|
||||||
|
}
|
||||||
|
if (data[i].substr(0, 4) == "min:")
|
||||||
|
{
|
||||||
|
printf("- - min = %s\n", data[i].substr(4, -1).c_str());
|
||||||
|
dataObject.min = ofToFloat(data[i].substr(4, -1).c_str());
|
||||||
|
}
|
||||||
|
if (data[i].substr(0, 5) == " max:")
|
||||||
|
{
|
||||||
|
printf("- - max = %s\n", data[i].substr(5, -1).c_str());
|
||||||
|
dataObject.max = ofToFloat(data[i].substr(5, -1).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m.name == publisher0Name)
|
if (m.name == publisher0Name)
|
||||||
{
|
{
|
||||||
isPublisher0DataReceived = true;
|
isPublisher0DataReceived = true;
|
||||||
//printf("frameNum: %i, publisher0Name: %i \n", ofGetFrameNum(), m.valueRange());
|
newData[0] = dataObject;
|
||||||
newData[0] = m.valueRange();
|
|
||||||
}
|
}
|
||||||
else if (m.name == publisher1Name)
|
else if (m.name == publisher1Name)
|
||||||
{
|
{
|
||||||
isPublisher1DataReceived = true;
|
isPublisher1DataReceived = true;
|
||||||
//printf("frameNum: %i, publisher1Name: %i \n", ofGetFrameNum(), m.valueRange());
|
newData[1] = dataObject;
|
||||||
newData[1] = m.valueRange();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vector<string> DataManager::explode(const string &delimiter, const string &str)
|
||||||
|
{
|
||||||
|
vector<string> arr;
|
||||||
|
|
||||||
|
int strleng = str.length();
|
||||||
|
int delleng = delimiter.length();
|
||||||
|
if (delleng==0)
|
||||||
|
return arr;//no change
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
int k=0;
|
||||||
|
while( i<strleng )
|
||||||
|
{
|
||||||
|
int j=0;
|
||||||
|
while (i+j<strleng && j<delleng && str[i+j]==delimiter[j])
|
||||||
|
j++;
|
||||||
|
if (j==delleng)//found delimiter
|
||||||
|
{
|
||||||
|
arr.push_back( str.substr(k, i-k) );
|
||||||
|
i+=delleng;
|
||||||
|
k=i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arr.push_back( str.substr(k, i-k) );
|
||||||
|
return arr;
|
||||||
}
|
}
|
||||||
@ -9,6 +9,14 @@
|
|||||||
|
|
||||||
class testApp;
|
class testApp;
|
||||||
|
|
||||||
|
struct DataObject
|
||||||
|
{
|
||||||
|
string info;
|
||||||
|
float value;
|
||||||
|
float min;
|
||||||
|
float max;
|
||||||
|
};
|
||||||
|
|
||||||
class DataManager
|
class DataManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -17,6 +25,7 @@ class DataManager
|
|||||||
void setupSpacebrew();
|
void setupSpacebrew();
|
||||||
void update();
|
void update();
|
||||||
void draw();
|
void draw();
|
||||||
|
vector<string> explode( const string &delimiter, const string &str);
|
||||||
|
|
||||||
testApp* app;
|
testApp* app;
|
||||||
|
|
||||||
@ -28,7 +37,7 @@ class DataManager
|
|||||||
string publisher0Name;
|
string publisher0Name;
|
||||||
string publisher1Name;
|
string publisher1Name;
|
||||||
|
|
||||||
vector<int> newData;
|
vector<DataObject> newData;
|
||||||
|
|
||||||
bool isPublisher0DataReceived;
|
bool isPublisher0DataReceived;
|
||||||
bool isPublisher1DataReceived;
|
bool isPublisher1DataReceived;
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "GUI.h"
|
#include "GUI.h"
|
||||||
#include "testApp.h"
|
#include "testApp.h"
|
||||||
|
#include "AbstractGraph.h"
|
||||||
|
|
||||||
void GUI::setup()
|
void GUI::setup()
|
||||||
{
|
{
|
||||||
@ -17,8 +18,9 @@ void GUI::setup()
|
|||||||
dim = 8;
|
dim = 8;
|
||||||
|
|
||||||
addKeyboardShortcutsGUI();
|
addKeyboardShortcutsGUI();
|
||||||
//addGraphAnimationGUI();
|
addGraphGlobalGUI();
|
||||||
addBarGraphDesignGUI();
|
addBarGraphDesignGUI();
|
||||||
|
addBodyGraphDesignGUI();
|
||||||
addGraphSimulationGUI();
|
addGraphSimulationGUI();
|
||||||
addBackgroundGUI();
|
addBackgroundGUI();
|
||||||
addHUDTextGUI();
|
addHUDTextGUI();
|
||||||
@ -49,15 +51,27 @@ void GUI::addKeyboardShortcutsGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GUI::addGraphAnimationGUI()
|
void GUI::addGraphGlobalGUI()
|
||||||
{
|
{
|
||||||
string title = "GRAPH ANIMATION";
|
string title = "GRAPH GLOBAL";
|
||||||
ofxUICanvas* gui = getNewGUI(title);
|
ofxUICanvas* gui = getNewGUI(title);
|
||||||
|
|
||||||
|
vector<string> graphNames;
|
||||||
|
graphNames.push_back("Bar graph");
|
||||||
|
graphNames.push_back("Solid Body graph");
|
||||||
|
graphNames.push_back("Line fade graph");
|
||||||
|
|
||||||
|
gui->addRadio("Graph Selection", graphNames, OFX_UI_ORIENTATION_VERTICAL, dim*2, dim*2);
|
||||||
|
gui->addSpacer(length, 1);
|
||||||
|
gui->addRangeSlider("Graph X begin/end (percent)", 0, 1, &AbstractGraph::minGraphPercent, &AbstractGraph::maxGraphPercent, length, dim);
|
||||||
|
|
||||||
|
|
||||||
|
ofAddListener(gui->newGUIEvent, this, &GUI::graphGlobalGUIEvent);
|
||||||
finaliseCanvas(gui, true);
|
finaliseCanvas(gui, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GUI::addBarGraphDesignGUI()
|
void GUI::addBarGraphDesignGUI()
|
||||||
{
|
{
|
||||||
string title = "BAR GRAPH DESIGN";
|
string title = "BAR GRAPH DESIGN";
|
||||||
@ -65,6 +79,8 @@ void GUI::addBarGraphDesignGUI()
|
|||||||
|
|
||||||
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.barGraph.graphItemXGap, length, dim);
|
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.barGraph.graphItemXGap, length, dim);
|
||||||
gui->addSlider("BarWidth", 2, 50, &app->scene.barGraph.barWidth, length, dim);
|
gui->addSlider("BarWidth", 2, 50, &app->scene.barGraph.barWidth, length, dim);
|
||||||
|
gui->addSlider("Graph Height Max", 100, 1000, &app->scene.barGraph.graphHeightMax, length, dim);
|
||||||
|
|
||||||
|
|
||||||
gui->addSlider("Data0 red", 0, 255, &app->scene.barGraph.col0[0], length, dim);
|
gui->addSlider("Data0 red", 0, 255, &app->scene.barGraph.col0[0], length, dim);
|
||||||
gui->addSlider("Data0 green", 0, 255, &app->scene.barGraph.col0[1], length, dim);
|
gui->addSlider("Data0 green", 0, 255, &app->scene.barGraph.col0[1], length, dim);
|
||||||
@ -79,6 +95,27 @@ void GUI::addBarGraphDesignGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GUI::addBodyGraphDesignGUI()
|
||||||
|
{
|
||||||
|
string title = "BODY GRAPH DESIGN";
|
||||||
|
ofxUICanvas* gui = getNewGUI(title);
|
||||||
|
|
||||||
|
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.bodyGraph.graphItemXGap, length, dim);
|
||||||
|
gui->addSlider("Line width", 1, 50, &app->scene.bodyGraph.lineWidth, length, dim);
|
||||||
|
|
||||||
|
gui->addSlider("Data0 red", 0, 255, &app->scene.bodyGraph.col0[0], length, dim);
|
||||||
|
gui->addSlider("Data0 green", 0, 255, &app->scene.bodyGraph.col0[1], length, dim);
|
||||||
|
gui->addSlider("Data0 blue", 0, 255, &app->scene.bodyGraph.col0[2], length, dim);
|
||||||
|
gui->addSlider("Data0 alpha", 0, 255, &app->scene.bodyGraph.col0[3], length, dim);
|
||||||
|
gui->addSlider("Data1 red", 0, 255, &app->scene.bodyGraph.col1[0], length, dim);
|
||||||
|
gui->addSlider("Data1 green", 0, 255, &app->scene.bodyGraph.col1[1], length, dim);
|
||||||
|
gui->addSlider("Data1 blue", 0, 255, &app->scene.bodyGraph.col1[2], length, dim);
|
||||||
|
gui->addSlider("Data1 alpha", 0, 255, &app->scene.bodyGraph.col1[3], length, dim);
|
||||||
|
|
||||||
|
finaliseCanvas(gui, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GUI::addGraphSimulationGUI()
|
void GUI::addGraphSimulationGUI()
|
||||||
{
|
{
|
||||||
string title = "SIMULATION";
|
string title = "SIMULATION";
|
||||||
@ -177,6 +214,31 @@ void GUI::draw()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GUI::graphGlobalGUIEvent(ofxUIEventArgs &e)
|
||||||
|
{
|
||||||
|
string name = e.widget->getName();
|
||||||
|
ofxUIToggle *toggle = (ofxUIToggle *) e.widget;
|
||||||
|
|
||||||
|
if (name == "Bar graph")
|
||||||
|
{
|
||||||
|
//ofxUIToggle *toggle = (ofxUIToggle *) e.widget;
|
||||||
|
if (toggle->getValue()) app->scene.activeGraph = &app->scene.barGraph;
|
||||||
|
}
|
||||||
|
else if (name == "Solid Body graph")
|
||||||
|
{
|
||||||
|
printf("------------------- Solid Body graph\n");
|
||||||
|
if (toggle->getValue()) app->scene.activeGraph = &app->scene.bodyGraph;
|
||||||
|
}
|
||||||
|
else if (name == "Line fade graph")
|
||||||
|
{
|
||||||
|
printf("------------------- Line fade graph\n");
|
||||||
|
//app->scene.activeGraph = &app->scene.lineGraph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GUI::variousGUIEvent(ofxUIEventArgs &e)
|
void GUI::variousGUIEvent(ofxUIEventArgs &e)
|
||||||
{
|
{
|
||||||
string name = e.widget->getName();
|
string name = e.widget->getName();
|
||||||
|
|||||||
@ -20,13 +20,15 @@ public:
|
|||||||
virtual bool getVisible();
|
virtual bool getVisible();
|
||||||
|
|
||||||
void addKeyboardShortcutsGUI();
|
void addKeyboardShortcutsGUI();
|
||||||
void addGraphAnimationGUI();
|
void addGraphGlobalGUI();
|
||||||
void addBarGraphDesignGUI();
|
void addBarGraphDesignGUI();
|
||||||
|
void addBodyGraphDesignGUI();
|
||||||
void addGraphSimulationGUI();
|
void addGraphSimulationGUI();
|
||||||
void addBackgroundGUI();
|
void addBackgroundGUI();
|
||||||
void addHUDTextGUI();
|
void addHUDTextGUI();
|
||||||
void addVariousGUI();
|
void addVariousGUI();
|
||||||
|
|
||||||
|
void graphGlobalGUIEvent(ofxUIEventArgs &e);
|
||||||
void variousGUIEvent(ofxUIEventArgs &e);
|
void variousGUIEvent(ofxUIEventArgs &e);
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|||||||
@ -2,24 +2,27 @@
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// ====
|
// ====
|
||||||
// - Make graph system with 3 simple (for now) but different graphs that can be interchanged
|
|
||||||
// - Add image to background and create a mask
|
|
||||||
// - Use a shader to adjust image brightness/contrast and colour
|
|
||||||
// -
|
|
||||||
// - Add to config
|
|
||||||
// - - IP address
|
|
||||||
// - - Host name
|
|
||||||
// - - App name
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
//
|
||||||
|
// - Map graph min/max
|
||||||
|
// - Stop graph going beyond 80% of the screen
|
||||||
|
// - Add separate colour sliders for body graph
|
||||||
|
// - In body graph use one long line instead of loads of lines
|
||||||
|
// - Make 2nd graph - body
|
||||||
|
// - Make 3rd graph - separate fade
|
||||||
|
// - Add colour boxes to text - DON'T use graph colours - add sliders
|
||||||
|
// - Crosshairs in HUD
|
||||||
|
// - Add video camera feed
|
||||||
|
// - Create text parsing system
|
||||||
|
// - Tidy up the first graph
|
||||||
|
// - Create animation system
|
||||||
|
// - Make system to slow down data - The screen should show 15-20 minutes worth of data
|
||||||
|
// - Create a single config file to be loaded from online location. It will contain IP address and host name
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// NOTES
|
// NOTES
|
||||||
// =====
|
// =====
|
||||||
// - Each publisher should have a unique number. There should be a config file kept in c:/ containing a unique ID
|
|
||||||
// - Check that the local data sources always have the same amount of data.
|
// - Check that the local data sources always have the same amount of data.
|
||||||
|
|
||||||
|
|
||||||
@ -33,6 +36,7 @@ void testApp::setup()
|
|||||||
ofEnableSmoothing();
|
ofEnableSmoothing();
|
||||||
ofSeedRandom(ofRandom(23243));
|
ofSeedRandom(ofRandom(23243));
|
||||||
ofSetFullscreen(true);
|
ofSetFullscreen(true);
|
||||||
|
ofSetVerticalSync(true);
|
||||||
|
|
||||||
dataManager.setup();
|
dataManager.setup();
|
||||||
scene.setup();
|
scene.setup();
|
||||||
|
|||||||
@ -14,21 +14,18 @@ void Scene::setup()
|
|||||||
bgImg.loadImage("images/tanks.jpg");
|
bgImg.loadImage("images/tanks.jpg");
|
||||||
rgbShader.load("shaders/RGBShader");
|
rgbShader.load("shaders/RGBShader");
|
||||||
barGraph.setup();
|
barGraph.setup();
|
||||||
|
bodyGraph.setup();
|
||||||
|
|
||||||
|
//activeGraph = &barGraph;
|
||||||
|
|
||||||
text.loadFont("fonts/mplus-1c-regular.ttf", 8);
|
//text.loadFont("fonts/Roboto-Regular.ttf", 8);
|
||||||
//text.setLineLength(ofGetWidth() - margin * 2);
|
text.loadFont("fonts/Roboto-Light.ttf", 8);
|
||||||
|
|
||||||
|
|
||||||
xMargin = 500;
|
|
||||||
yMargin = 400;
|
|
||||||
lineLength = 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Scene::update()
|
void Scene::update()
|
||||||
{
|
{
|
||||||
barGraph.update();
|
activeGraph->update();
|
||||||
|
|
||||||
text.setLineLength(lineLength);
|
text.setLineLength(lineLength);
|
||||||
text.setLineSpacing(lineSpacing);
|
text.setLineSpacing(lineSpacing);
|
||||||
@ -40,7 +37,7 @@ void Scene::update()
|
|||||||
void Scene::draw()
|
void Scene::draw()
|
||||||
{
|
{
|
||||||
drawVideo();
|
drawVideo();
|
||||||
barGraph.draw();
|
activeGraph->draw();
|
||||||
drawHUDBG();
|
drawHUDBG();
|
||||||
drawHUDCopy();
|
drawHUDCopy();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
#include "BarGraph.h"
|
#include "BarGraph.h"
|
||||||
|
#include "BodyGraph.h"
|
||||||
#include "ofxFTGL.h"
|
#include "ofxFTGL.h"
|
||||||
|
|
||||||
class testApp;
|
class testApp;
|
||||||
@ -25,12 +26,15 @@ public:
|
|||||||
void drawHUDCopy();
|
void drawHUDCopy();
|
||||||
void drawTextBox(string copy, string align);
|
void drawTextBox(string copy, string align);
|
||||||
void keyPressed(int key);
|
void keyPressed(int key);
|
||||||
|
|
||||||
BarGraph barGraph;
|
BarGraph barGraph;
|
||||||
|
BodyGraph bodyGraph;
|
||||||
ofShader rgbShader;
|
ofShader rgbShader;
|
||||||
ofImage bgImg;
|
ofImage bgImg;
|
||||||
ofxFTGLSimpleLayout text;
|
ofxFTGLSimpleLayout text;
|
||||||
|
|
||||||
|
AbstractGraph* activeGraph;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// video image vars
|
// video image vars
|
||||||
|
|||||||
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "AbstractGraph.h"
|
#include "AbstractGraph.h"
|
||||||
|
|
||||||
|
float AbstractGraph::minGraphPercent;
|
||||||
|
float AbstractGraph::maxGraphPercent;
|
||||||
|
|
||||||
void AbstractGraph::setup()
|
void AbstractGraph::setup()
|
||||||
{
|
{
|
||||||
@ -27,14 +29,14 @@ void AbstractGraph::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AbstractGraph::addNewData(vector<int> newData)
|
void AbstractGraph::addNewData(vector<DataObject> newData)
|
||||||
{
|
{
|
||||||
publisher0Data.push_back(newData[0]);
|
publisher0Data.push_back(newData[0]);
|
||||||
publisher1Data.push_back(newData[1]);
|
publisher1Data.push_back(newData[1]);
|
||||||
|
|
||||||
maxData = ofGetWidth() / graphItemXGap;
|
maxData = (ofGetWidth() / graphItemXGap) * (AbstractGraph::maxGraphPercent - AbstractGraph::minGraphPercent);
|
||||||
|
|
||||||
if (publisher0Data.size() > maxData && publisher0Data.size() > maxData)
|
while (publisher0Data.size() > maxData && publisher0Data.size() > maxData)
|
||||||
{
|
{
|
||||||
publisher0Data.erase(publisher0Data.begin());
|
publisher0Data.erase(publisher0Data.begin());
|
||||||
publisher1Data.erase(publisher1Data.begin());
|
publisher1Data.erase(publisher1Data.begin());
|
||||||
|
|||||||
@ -9,22 +9,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
#include "DataManager.h"
|
||||||
|
|
||||||
class AbstractGraph
|
class AbstractGraph
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void setup();
|
void setup();
|
||||||
void update();
|
virtual void update();
|
||||||
void draw();
|
virtual void draw();
|
||||||
virtual void addNewData(vector<int> newData);
|
virtual void addNewData(vector<DataObject> newData);
|
||||||
|
|
||||||
vector<int> publisher0Data;
|
vector<DataObject> publisher0Data;
|
||||||
vector<int> publisher1Data;
|
vector<DataObject> publisher1Data;
|
||||||
int maxData; // calculated from graphWidth and graphItemXGap
|
int maxData; // calculated from graphWidth and graphItemXGap
|
||||||
|
|
||||||
|
static float minGraphPercent;
|
||||||
|
static float maxGraphPercent;
|
||||||
|
|
||||||
float graphItemXGap;
|
float graphItemXGap;
|
||||||
ofPoint startPnt;
|
|
||||||
int graphWidth;
|
float graphHeightMax;
|
||||||
int graphHeight;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -1,14 +1,5 @@
|
|||||||
//
|
|
||||||
// gui->cpp
|
|
||||||
// emptyExample
|
|
||||||
//
|
|
||||||
// Created by James Alliban on 25/06/2013.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "BarGraph.h"
|
#include "BarGraph.h"
|
||||||
|
|
||||||
|
|
||||||
void BarGraph::setup()
|
void BarGraph::setup()
|
||||||
{
|
{
|
||||||
AbstractGraph::setup();
|
AbstractGraph::setup();
|
||||||
@ -26,18 +17,20 @@ void BarGraph::update()
|
|||||||
|
|
||||||
void BarGraph::draw()
|
void BarGraph::draw()
|
||||||
{
|
{
|
||||||
|
//printf("BarGraph::draw() - graphItemXGap = %f \n", graphItemXGap);
|
||||||
|
|
||||||
if (publisher0Data.size() > 1)
|
if (publisher0Data.size() > 1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
{
|
{
|
||||||
if (i < publisher0Data.size() - 2)
|
if (i < publisher0Data.size() - 2)
|
||||||
{
|
{
|
||||||
ofPushStyle();
|
//ofPushStyle();
|
||||||
ofSetColor(0, 0, 0);
|
//ofSetColor(0, 0, 0);
|
||||||
ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]);
|
//ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]);
|
||||||
ofSetColor(0, 0, 0);
|
//ofSetColor(0, 0, 0);
|
||||||
ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]);
|
//ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]);
|
||||||
ofPopStyle();
|
//ofPopStyle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,16 +43,37 @@ void BarGraph::draw()
|
|||||||
//ofCircle(i * graphItemXGap, publisher1Data[i], 5);
|
//ofCircle(i * graphItemXGap, publisher1Data[i], 5);
|
||||||
//ofPopStyle();
|
//ofPopStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
|
||||||
|
float outputMin = (ofGetHeight() * 0.5) - graphHeightMax;
|
||||||
|
float outputMax = (ofGetHeight() * 0.5) + graphHeightMax;
|
||||||
|
|
||||||
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
{
|
{
|
||||||
ofPushStyle();
|
ofPushStyle();
|
||||||
|
|
||||||
|
|
||||||
ofMesh bar;
|
ofMesh bar;
|
||||||
bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5), publisher0Data[i], 0));
|
float rectTLX = i * graphItemXGap - (barWidth * 0.5) + xOffset;
|
||||||
bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5) + barWidth, publisher0Data[i], 0));
|
float rectTLY = ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax);
|
||||||
bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5), publisher1Data[i], 0));
|
|
||||||
bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5) + barWidth, publisher1Data[i], 0));
|
float rectTRX = i * graphItemXGap - (barWidth * 0.5) + barWidth + xOffset;
|
||||||
|
float rectTRY = ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax);
|
||||||
|
|
||||||
|
float rectBLX = i * graphItemXGap - (barWidth * 0.5) + xOffset;
|
||||||
|
float rectBLY = ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax);
|
||||||
|
|
||||||
|
float rectBRX = i * graphItemXGap - (barWidth * 0.5) + barWidth + xOffset;
|
||||||
|
float rectBRY = ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax);
|
||||||
|
|
||||||
|
|
||||||
|
//printf("val:%f, min:%f, max:%f - new val:%f \n", publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, rectTLY);
|
||||||
|
//printf("val:%f, min:%f, max:%f - new val:%f \n", publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, rectBLY);
|
||||||
|
|
||||||
|
bar.addVertex(ofVec3f(rectTLX, rectTLY, 0));
|
||||||
|
bar.addVertex(ofVec3f(rectTRX, rectTRY, 0));
|
||||||
|
bar.addVertex(ofVec3f(rectBLX, rectBLY, 0));
|
||||||
|
bar.addVertex(ofVec3f(rectBRX, rectBRY, 0));
|
||||||
bar.addIndex(0);
|
bar.addIndex(0);
|
||||||
bar.addIndex(1);
|
bar.addIndex(1);
|
||||||
bar.addIndex(3);
|
bar.addIndex(3);
|
||||||
@ -84,7 +98,7 @@ void BarGraph::draw()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BarGraph::addNewData(vector<int> newData)
|
void BarGraph::addNewData(vector<DataObject> newData)
|
||||||
{
|
{
|
||||||
AbstractGraph::addNewData(newData);
|
AbstractGraph::addNewData(newData);
|
||||||
}
|
}
|
||||||
@ -1,11 +1,3 @@
|
|||||||
//
|
|
||||||
// BarGraph.h
|
|
||||||
// emptyExample
|
|
||||||
//
|
|
||||||
// Created by James Alliban on 25/06/2013.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
@ -15,13 +7,14 @@ class BarGraph : public AbstractGraph
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void setup();
|
void setup();
|
||||||
void update();
|
virtual void update();
|
||||||
void draw();
|
virtual void draw();
|
||||||
virtual void addNewData(vector<int> newData);
|
virtual void addNewData(vector<DataObject> newData);
|
||||||
|
|
||||||
float barWidth;
|
float barWidth;
|
||||||
|
|
||||||
float col0[4];
|
float col0[4];
|
||||||
float col1[4];
|
float col1[4];
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
73
of/Active Tripod/src/visual/graph/BodyGraph.cpp
Normal file
73
of/Active Tripod/src/visual/graph/BodyGraph.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// Created by James Alliban on 08/01/2014.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "BodyGraph.h"
|
||||||
|
|
||||||
|
|
||||||
|
void BodyGraph::setup()
|
||||||
|
{
|
||||||
|
AbstractGraph::setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BodyGraph::update()
|
||||||
|
{
|
||||||
|
// if (ofGetFrameNum() % 30 == 0)
|
||||||
|
// printf("publisher0Data.size():%i \n", publisher0Data.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BodyGraph::draw()
|
||||||
|
{
|
||||||
|
if (publisher0Data.size() > 1)
|
||||||
|
{
|
||||||
|
//for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
|
//{
|
||||||
|
// ofPushStyle();
|
||||||
|
// ofSetColor(255, 0, 0);
|
||||||
|
// ofCircle(i * graphItemXGap, publisher0Data[i], 5);
|
||||||
|
// ofSetColor(0, 255, 0);
|
||||||
|
// ofCircle(i * graphItemXGap, publisher1Data[i], 5);
|
||||||
|
// ofPopStyle();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
ofMesh body;
|
||||||
|
body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
|
||||||
|
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
|
{
|
||||||
|
//body.addVertex(ofVec3f(i * graphItemXGap, publisher0Data[i], 0));
|
||||||
|
//body.addVertex(ofVec3f(i * graphItemXGap, publisher1Data[i], 0));
|
||||||
|
|
||||||
|
body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3]));
|
||||||
|
body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3]));
|
||||||
|
}
|
||||||
|
|
||||||
|
body.drawFaces();
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
|
{
|
||||||
|
if (i < publisher0Data.size() - 2)
|
||||||
|
{
|
||||||
|
//ofPushStyle();
|
||||||
|
//ofSetLineWidth(lineWidth);
|
||||||
|
//ofSetColor(col0[0],col0[1],col0[2], 255);
|
||||||
|
//ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]);
|
||||||
|
//ofSetColor(col1[0],col1[1],col1[2], 255);
|
||||||
|
//ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]);
|
||||||
|
//ofPopStyle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void BodyGraph::addNewData(vector<DataObject> newData)
|
||||||
|
{
|
||||||
|
AbstractGraph::addNewData(newData);
|
||||||
|
}
|
||||||
20
of/Active Tripod/src/visual/graph/BodyGraph.h
Normal file
20
of/Active Tripod/src/visual/graph/BodyGraph.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ofMain.h"
|
||||||
|
#include "AbstractGraph.h"
|
||||||
|
|
||||||
|
class BodyGraph : public AbstractGraph
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void setup();
|
||||||
|
virtual void update();
|
||||||
|
virtual void draw();
|
||||||
|
virtual void addNewData(vector<DataObject> newData);
|
||||||
|
|
||||||
|
float barWidth;
|
||||||
|
float lineWidth;
|
||||||
|
|
||||||
|
float col0[4];
|
||||||
|
float col1[4];
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user