Skip to content
Browse files

Added data class and ofxCsv addon.

  • Loading branch information...
1 parent 26c24b2 commit 670e634ba1e82e58e117b732c3187cb5bb9794d0 @mrbichel committed Feb 22, 2014
Showing with 98 additions and 1 deletion.
  1. 0 { → bin/data}/urban_data_v2.csv
  2. +9 −0 src/data.cpp
  3. +41 −0 src/data.h
  4. +3 −0 src/testApp.cpp
  5. +8 −1 src/testApp.h
  6. +37 −0 urbanDataCanvas.xcodeproj/project.pbxproj
View
0 urban_data_v2.csv → bin/data/urban_data_v2.csv
File renamed without changes.
View
9 src/data.cpp
@@ -0,0 +1,9 @@
+//
+// data.cpp
+// urbanDataCanvas
+//
+// Created by Johan Bichel Lindegaard on 22/02/14.
+//
+//
+
+#include "data.h"
View
41 src/data.h
@@ -0,0 +1,41 @@
+//
+// data.h
+// urbanDataCanvas
+//
+// Created by Johan Bichel Lindegaard on 22/02/14.
+//
+//
+
+#pragma once
+
+#include "ofMain.h"
+#include "ofxCsv.h"
+
+using namespace wng;
+
+class MarketData {
+public:
+
+ ofxCsv csv;
+
+ void import() {
+
+ // Load a CSV File.
+ csv.loadFile(ofToDataPath("urban_data_v2.csv"));
+
+ cout << "Print out a specific CSV value" << endl;
+ cout << csv.data[0][1] << endl;
+ // also you can write...
+ //cout << csv.data[0].at(1) << endl;
+
+ cout << "Print out the first value" << endl;
+ cout << csv.data[0].front() << endl;
+
+ cout << "Maximum Size:";
+ cout << csv.data[0].max_size() << endl;
+
+ }
+
+
+
+};
View
3 src/testApp.cpp
@@ -2,6 +2,9 @@
//--------------------------------------------------------------
void testApp::setup(){
+
+ mdata.import();
+
}
//--------------------------------------------------------------
View
9 src/testApp.h
@@ -1,6 +1,8 @@
#pragma once
#include "ofMain.h"
+#include "data.h"
+
class testApp : public ofBaseApp{
public:
@@ -17,5 +19,10 @@ class testApp : public ofBaseApp{
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
-
+
+ MarketData mdata;
+
+
+
+
};
View
37 urbanDataCanvas.xcodeproj/project.pbxproj
@@ -71,6 +71,8 @@
0427211318B94651003CBC49 /* ofxEasingSine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042720FE18B94651003CBC49 /* ofxEasingSine.cpp */; };
0427211418B94651003CBC49 /* ofxTween.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0427210018B94651003CBC49 /* ofxTween.cpp */; };
0427215618B9488F003CBC49 /* ofxTimecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0427215218B9488F003CBC49 /* ofxTimecode.cpp */; };
+ 0427217C18B94B61003CBC49 /* data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0427217A18B94B61003CBC49 /* data.cpp */; };
+ 0427219518B94C50003CBC49 /* ofxCsv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0427219118B94C50003CBC49 /* ofxCsv.cpp */; };
BBAB23CB13894F3D00AA2426 /* GLUT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; };
E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4328148138ABC890047C5CB /* openFrameworksDebug.a */; };
E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9710E8CC7DD009D7055 /* AGL.framework */; };
@@ -268,6 +270,14 @@
0427215018B9488F003CBC49 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
0427215218B9488F003CBC49 /* ofxTimecode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxTimecode.cpp; sourceTree = "<group>"; };
0427215318B9488F003CBC49 /* ofxTimecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxTimecode.h; sourceTree = "<group>"; };
+ 0427217A18B94B61003CBC49 /* data.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = data.cpp; sourceTree = "<group>"; };
+ 0427217B18B94B61003CBC49 /* data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = data.h; sourceTree = "<group>"; };
+ 0427217E18B94C50003CBC49 /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
+ 0427217F18B94C50003CBC49 /* install.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = install.xml; sourceTree = "<group>"; };
+ 0427218018B94C50003CBC49 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
+ 0427218F18B94C50003CBC49 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
+ 0427219118B94C50003CBC49 /* ofxCsv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxCsv.cpp; sourceTree = "<group>"; };
+ 0427219218B94C50003CBC49 /* ofxCsv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxCsv.h; sourceTree = "<group>"; };
BBAB23BE13894E4700AA2426 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../libs/glut/lib/osx/GLUT.framework; sourceTree = "<group>"; };
E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; };
E45BE9710E8CC7DD009D7055 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
@@ -562,9 +572,32 @@
path = src;
sourceTree = "<group>";
};
+ 0427217D18B94C50003CBC49 /* ofxCsv */ = {
+ isa = PBXGroup;
+ children = (
+ 0427217E18B94C50003CBC49 /* .gitignore */,
+ 0427217F18B94C50003CBC49 /* install.xml */,
+ 0427218018B94C50003CBC49 /* LICENSE.txt */,
+ 0427218F18B94C50003CBC49 /* README.md */,
+ 0427219018B94C50003CBC49 /* src */,
+ );
+ name = ofxCsv;
+ path = ../../../addons/ofxCsv;
+ sourceTree = "<group>";
+ };
+ 0427219018B94C50003CBC49 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 0427219118B94C50003CBC49 /* ofxCsv.cpp */,
+ 0427219218B94C50003CBC49 /* ofxCsv.h */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
BB4B014C10F69532006C3DED /* addons */ = {
isa = PBXGroup;
children = (
+ 0427217D18B94C50003CBC49 /* ofxCsv */,
0427214318B9488F003CBC49 /* ofxTimecode */,
0427212118B946E7003CBC49 /* ofxRange */,
042720C318B94650003CBC49 /* ofxTween */,
@@ -640,6 +673,8 @@
E4B69E1D0A3A1BDC003C02F2 /* main.cpp */,
E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */,
E4B69E1F0A3A1BDC003C02F2 /* testApp.h */,
+ 0427217A18B94B61003CBC49 /* data.cpp */,
+ 0427217B18B94B61003CBC49 /* data.h */,
);
path = src;
sourceTree = SOURCE_ROOT;
@@ -748,6 +783,8 @@
04271E6218B93F7C003CBC49 /* ofxUIIntSlider.cpp in Sources */,
04271E5118B93F7C003CBC49 /* ofxUI2DPad.cpp in Sources */,
04271E6118B93F7C003CBC49 /* ofxUIImageToggle.cpp in Sources */,
+ 0427219518B94C50003CBC49 /* ofxCsv.cpp in Sources */,
+ 0427217C18B94B61003CBC49 /* data.cpp in Sources */,
0427210C18B94651003CBC49 /* ofxEasingCubic.cpp in Sources */,
0427210A18B94651003CBC49 /* ofxEasingBounce.cpp in Sources */,
04271E5D18B93F7C003CBC49 /* ofxUIImage.cpp in Sources */,

0 comments on commit 670e634

Please sign in to comment.
Something went wrong with that request. Please try again.