Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Restructured viz code.

  • Loading branch information...
commit a4c99fd15493ba12ea992b4cba2cbb78a2ca6a80 1 parent 9ed644d
Johan Bichel Lindegaard mrbichel authored
3  .gitignore
View
@@ -37,5 +37,4 @@ Release*/
xcuserdata
*.xcworkspace
-
-/DerivedData
+DerivedData
13 README.md
View
@@ -0,0 +1,13 @@
+Abstract data visualization of Copenhagens bike traffic for an installation at the 4S/EASST conferences 2012
+
+Run ´$ mongod´
+
+Import data from excel files to mongo db using the python import script. Do a geocode lookup on every entry.
+
+ $ python import.py
+ $ python geocode.py
+
+Run ´$ python chaosflow.py´ to start the server.
+
+
+
15 bin/data/GUI/guiSettings.xml
View
@@ -0,0 +1,15 @@
+<Widget>
+ <Kind>4</Kind>
+ <Name>BACKGROUND VALUE</Name>
+ <Value>13.4211</Value>
+</Widget>
+<Widget>
+ <Kind>2</Kind>
+ <Name>FULLSCREEN</Name>
+ <Value>1</Value>
+</Widget>
+<Widget>
+ <Kind>4</Kind>
+ <Name>Speed</Name>
+ <Value>97.3684</Value>
+</Widget>
6 src/gui.cpp
View
@@ -14,10 +14,14 @@ void Gui::setup(){
ofAddListener(ui->newGUIEvent, this, &Gui::guiEvent);
- ui->loadSettings("GUI/guiSettings.xml");
+
}
+void Gui::loadSettings(){
+ ui->loadSettings("GUI/guiSettings.xml");
+}
+
void Gui::update(){
}
2  src/gui.h
View
@@ -15,4 +15,6 @@ class Gui {
void exit();
void guiEvent(ofxUIEventArgs &e);
+ void loadSettings();
+
};
81 src/testApp.cpp
View
@@ -23,11 +23,9 @@ void testApp::setup(){
ofSetColor(255,255,255);
ofEnableAlphaBlending();
- maxLat = 55.7368;
- minLat = 55.6108;
- maxLng = 12.6293;
- minLng = 12.4519;
+
+ gui->loadSettings();
simulator->start();
}
@@ -45,78 +43,6 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){
- ofNoFill();
-
- for (int i=0; i<data->locations.size(); i++) {
-
- if(data->locations[i].lat != 0 && data->locations[i].lng != 0) {
-
- float sizeOne = 0;
- float sizeTwo = 0;
-
- // add up entries
-
- //int hour = (simulator->simElapsedTime / (1000*60*60)) + 7;
- //float fintohour = (simulator->simElapsedTime % (1000*60*60)) / 3600000.0;
-
- //cout<<ofToString(fintohour)<<endl;
-
- /*float hourOne;
- float hourTwo;
-
-
-
- for (int e=0; e<data->locations[i].dir_one.size(); e++) {
-
- if (data->locations[i].dir_one[e].hour == hour) {
- hourOne = data->locations[i].dir_one[e].amount;
- } else if (data->locations[i].dir_one[e].hour == hour+1) {
- hourTwo = data->locations[i].dir_one[e].amount;
- }
-
- }*/
-
- float elapsed = simulator->simElapsedTime / float(simulator->simDuration);
-
- //cout<<ofToString(elapsed)<<endl;
-
- sizeOne = data->locations[i].dir_one.sampleAt(elapsed);
- sizeTwo = data->locations[i].dir_two.sampleAt(elapsed);
-
- //sizeOne = (fintohour * hourTwo) + ((1.0-fintohour) * hourOne);
- // Create an interpolation function and move to simulator
-
- /*for (int e=0; e<data->locations[i].dir_two.size(); e++) {
-
- if (data->locations[i].dir_two[e].hour == hour) {
- hourOne = data->locations[i].dir_two[e].amount;
- } else if (data->locations[i].dir_two[e].hour == hour+1) {
- hourTwo = data->locations[i].dir_two[e].amount;
- }
-
- }*/
-
- //sizeTwo = (fintohour * hourTwo) + ((1.0-fintohour) * hourOne);
-
- /*if (size == 0) {
- cout<<locations[i].road<<" has no entries";
- }theese seem to be the motorways we should sort them out and add a database flag
- */
-
-
- ofSetColor(ofMap(sizeOne, 0, 2000, 80, 255), 100, ofMap(sizeTwo, 0, 2000, 0, 255));
- ofCircle(ofMap(data->locations[i].lat, minLat, maxLat, 20, 680), ofMap(data->locations[i].lng, minLng, maxLng, 20, 680), ofMap(sizeOne+sizeTwo, 0, 4000, 2, 36));
-
-
-
- /*
- // label
- ofDrawBitmapString(locations[i].road, ofMap(locations[i].lat, minLat, maxLat, 20, 680), ofMap(locations[i].lng, minLng, maxLng, 20, 680));
- */
- }
-
- }
-
data->debugDraw();
visualizer->debugDraw();
simulator->debugDraw();
@@ -125,6 +51,9 @@ void testApp::draw(){
gui->draw();
}
+void testApp::exit() {
+ gui->exit();
+}
void testApp::keyPressed(int key){
gui->keyPressed(key);
9 src/testApp.h
View
@@ -25,6 +25,8 @@ class testApp : public ofBaseApp {
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
+ void exit();
+
Data * data;
Gui * gui;
@@ -33,11 +35,4 @@ class testApp : public ofBaseApp {
Visualizer * visualizer;
- // calibration
- double minLat;
- double minLng;
- double maxLat;
- double maxLng;
-
-
};
23 src/visualizer.cpp
View
@@ -4,6 +4,11 @@ void Visualizer::setup(Data * dataRef, Gui * guiRef, Simulator * simRef){
data = dataRef;
gui = guiRef;
sim = simRef;
+
+ maxLat = 55.7368;
+ minLat = 55.6108;
+ maxLng = 12.6293;
+ minLng = 12.4519;
}
@@ -17,6 +22,24 @@ void Visualizer::debugDraw(){
void Visualizer::drawMap() {
+ ofNoFill();
+
+ for (int i=0; i<data->locations.size(); i++) {
+
+ if(data->locations[i].lat != 0 && data->locations[i].lng != 0) {
+
+ float elapsed = sim->simElapsedTime / float(sim->simDuration);
+
+ float aOne = data->locations[i].dir_one.sampleAt(elapsed);
+ float aTwo = data->locations[i].dir_two.sampleAt(elapsed);
+
+ ofSetColor(ofMap(aOne, 0, 2000, 80, 255), 100, ofMap(aTwo, 0, 2000, 0, 255));
+ ofCircle(ofMap(data->locations[i].lat, minLat, maxLat, 20, 680), ofMap(data->locations[i].lng, minLng, maxLng, 20, 680), ofMap(aOne+aTwo, 0, 4000, 2, 36));
+
+ }
+
+ }
+
}
void Visualizer::drawInterpolation(Location location) {
7 src/visualizer.h
View
@@ -19,4 +19,11 @@ class Visualizer {
Gui * gui;
Simulator * sim;
+ // calibration
+ double minLat;
+ double minLng;
+ double maxLat;
+ double maxLng;
+
+
};
Please sign in to comment.
Something went wrong with that request. Please try again.