#include "testApp.h" /* openBTS visualisation ALL units relative to screen size in H or W viewpoint dynamic? focus on 'interesting' events? FRAMING REPRESENTATION OF TIME LABELLING & INFO handset class represents a handset how to deal with time/ range being limited -exponential -choose VP carefully- perspective -just decide the longest time that it will be active scalability -amount of text on screen icons -worthwhile? call/sms -pointer from caller to callee position update function to interpolate position */ std::vector split(std::string l, char delim) { std::istringstream stm(l); std::vector tokens; for (;;) { std::string word; if (!getline(stm, word, delim)) break; tokens.push_back(word); } return tokens; } void testApp::setup(){ printf("setup: %ix%i on screen %ix%i\n",ofGetWidth(),ofGetHeight(),ofGetScreenWidth(),ofGetScreenHeight()); int windowMode = ofGetWindowMode(); if(windowMode == OF_FULLSCREEN){ this->windowWidth = ofGetScreenWidth(); this->windowHeight = ofGetScreenHeight(); } else if(windowMode == OF_WINDOW){ this->windowWidth = ofGetWidth(); this->windowHeight = ofGetHeight(); } //Q Why is it that if you put a camera at (0,0,-100) looking at (0,0,0) and an object at (0,0,0) the camera isn't pointing at the object? //A Because ortho is different /* camera.enableOrtho(); camera.setPosition(-windowWidth/2,-windowHeight*4.1f,windowWidth); //camera.lookAt(ofVec3f(-windowWidth/2,-windowHeight,0),ofVec3f(0, 1, 0)); camera.rotate(70,1,0,0); camera.cacheMatrices(); //stop error messages */ ofSetFrameRate(25); ofSetCircleResolution(windowWidth); ofEnableSmoothing(); camera.setPosition(0,windowHeight*10,windowHeight); camera.lookAt(ofVec3f(0,0,-windowHeight*.5),ofVec3f(0, 0, 1)); camera.setFov(6.5); camera.cacheMatrices(); numLines=100; lines = new ofPoint[numLines]; imeis = new string[numLines]; for (int i=0;i tokens=split(message,','); string imsi=tokens[0].substr(4); //long dev=atol(n.c_str()); something crazy going on. this always seems to read out 32 bits if (!tokens[0].substr(0,4).compare("IMSI")) { //not an event if (!devices.count(imsi)) { //create a new device at a random position float a=ofRandom(TWO_PI); float r=ofRandom(windowWidth/2); devices[imsi]=obtsDevice(imsi,icons,ofVec2f(a,r)); } printf("%s\n",imsi.c_str()); } else printf("%s\n",tokens[0].c_str()); } } //-------------------------------------------------------------- void testApp::draw(){ if (ofRandom(1.0)>0.99) start=min(99,start+1); if (ofRandom(1.0)>0.98) end=min(99,end+1); glDisable(GL_LIGHTING); bgimg.draw(0,0,windowWidth,windowHeight); camera.begin(); //ofSphere(0,0,0,10); glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); ofPushMatrix(); ofRotate(ofGetElapsedTimef(),0,0,1); ofNoFill(); float rt=((ofGetElapsedTimef()*.25f)-floor(ofGetElapsedTimef()*.25f)); for (float f=rt*(windowWidth/10);f::iterator i=devices.begin();i!=devices.end();i++){ (*i).second.draw(timeScale); } ofPopMatrix(); camera.end(); ofSetHexColor(0xffffff); char reportStr[1024]; sprintf(reportStr, "fps: %f", ofGetFrameRate()); ofDrawBitmapString(reportStr, 10, windowHeight-10); //ofSaveFrame(); } //-------------------------------------------------------------- void testApp::keyPressed(int key){ switch (key){ case ' ': ofSaveFrame(); printf("[%8.2f] saved an image\n",ofGetElapsedTimef()); break; } } //-------------------------------------------------------------- void testApp::keyReleased(int key){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void testApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void testApp::dragEvent(ofDragInfo dragInfo){ }