Permalink
Browse files

ok

  • Loading branch information...
1 parent 0e4f0e1 commit dda6bca0d4dc5d78f88bc5d7c23db6ae5ec82059 @hideyukisaito hideyukisaito committed Mar 15, 2013
@@ -46,8 +46,8 @@
AB27023616EECF4C000AC44E /* ofxEasingSine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27022316EECF4C000AC44E /* ofxEasingSine.cpp */; };
AB27023716EECF4C000AC44E /* ofxTween.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27022516EECF4C000AC44E /* ofxTween.cpp */; };
AB27024316EF62F6000AC44E /* ofxTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB27024116EF62F6000AC44E /* ofxTimer.cpp */; };
- AB47ADA016D73C9C00C50356 /* ArsUIButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB47AD9E16D73C9C00C50356 /* ArsUIButton.cpp */; };
- AB47ADFD16DB355500C50356 /* ArsUIRoboCam.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB47ADFB16DB355500C50356 /* ArsUIRoboCam.cpp */; };
+ AB47ADA016D73C9C00C50356 /* ArsUICamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB47AD9E16D73C9C00C50356 /* ArsUICamera.cpp */; };
+ AB47ADFD16DB355500C50356 /* ArsUIOperableCamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB47ADFB16DB355500C50356 /* ArsUIOperableCamera.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 */; };
@@ -248,10 +248,10 @@
AB27022616EECF4C000AC44E /* ofxTween.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxTween.h; sourceTree = "<group>"; };
AB27024116EF62F6000AC44E /* ofxTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxTimer.cpp; sourceTree = "<group>"; };
AB27024216EF62F6000AC44E /* ofxTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxTimer.h; sourceTree = "<group>"; };
- AB47AD9E16D73C9C00C50356 /* ArsUIButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArsUIButton.cpp; sourceTree = "<group>"; };
- AB47AD9F16D73C9C00C50356 /* ArsUIButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArsUIButton.h; sourceTree = "<group>"; };
- AB47ADFB16DB355500C50356 /* ArsUIRoboCam.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArsUIRoboCam.cpp; sourceTree = "<group>"; };
- AB47ADFC16DB355500C50356 /* ArsUIRoboCam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArsUIRoboCam.h; sourceTree = "<group>"; };
+ AB47AD9E16D73C9C00C50356 /* ArsUICamera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArsUICamera.cpp; sourceTree = "<group>"; };
+ AB47AD9F16D73C9C00C50356 /* ArsUICamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArsUICamera.h; sourceTree = "<group>"; };
+ AB47ADFB16DB355500C50356 /* ArsUIOperableCamera.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArsUIOperableCamera.cpp; sourceTree = "<group>"; };
+ AB47ADFC16DB355500C50356 /* ArsUIOperableCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArsUIOperableCamera.h; sourceTree = "<group>"; };
AB47AE0016DCEF2300C50356 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; 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; };
@@ -787,10 +787,10 @@
E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */,
40DDEEFA16D5F5A5000C1E58 /* ArsUITappedPoint.h */,
40DDEEF916D5F5A5000C1E58 /* ArsUITappedPoint.cpp */,
- AB47AD9F16D73C9C00C50356 /* ArsUIButton.h */,
- AB47AD9E16D73C9C00C50356 /* ArsUIButton.cpp */,
- AB47ADFC16DB355500C50356 /* ArsUIRoboCam.h */,
- AB47ADFB16DB355500C50356 /* ArsUIRoboCam.cpp */,
+ AB47AD9F16D73C9C00C50356 /* ArsUICamera.h */,
+ AB47AD9E16D73C9C00C50356 /* ArsUICamera.cpp */,
+ AB47ADFC16DB355500C50356 /* ArsUIOperableCamera.h */,
+ AB47ADFB16DB355500C50356 /* ArsUIOperableCamera.cpp */,
AB2701DE16EECBE0000AC44E /* ArsUITitleState.h */,
AB2701DF16EECBFA000AC44E /* ArsUITitleState.cpp */,
AB2701EE16EECC49000AC44E /* ArsUISharedData.h */,
@@ -911,8 +911,8 @@
40FA61F816D35BBD00493C03 /* ofxOscSender.cpp in Sources */,
40DDEEFB16D5F5A5000C1E58 /* ArsUITappedPoint.cpp in Sources */,
40DDEF0616D604D3000C1E58 /* ofxEasingFunc.cpp in Sources */,
- AB47ADA016D73C9C00C50356 /* ArsUIButton.cpp in Sources */,
- AB47ADFD16DB355500C50356 /* ArsUIRoboCam.cpp in Sources */,
+ AB47ADA016D73C9C00C50356 /* ArsUICamera.cpp in Sources */,
+ AB47ADFD16DB355500C50356 /* ArsUIOperableCamera.cpp in Sources */,
AB2701E016EECBFA000AC44E /* ArsUITitleState.cpp in Sources */,
AB2701EA16EECC26000AC44E /* tinyxml.cpp in Sources */,
AB2701EB16EECC26000AC44E /* tinyxmlerror.cpp in Sources */,
@@ -1,37 +1,45 @@
-#include "ArsUIButton.h"
+#include "ArsUICamera.h"
#include "ofxEasingFunc.h"
+#include "ArsUIUtil.h"
//--------------------------------------------------------------
-ArsUIButton::ArsUIButton(float _x, float _y, int _bid, ofPoint _fuji, float _angle, string _udid){
+ArsUICamera::ArsUICamera(float _x, float _y, int _bid, ofPoint _fuji, float _angle, string _udid){
x = _x;
y = _y;
udid = _udid;
+ angle = _angle;
+ compass = getCompass();
bid = _bid;
+
status = 0;
speed = 3600;
bcnt = (int)ofRandom(speed);
mark.loadImage("mark.png");
markShadow.loadImage("markshadow.png");
+
fuji = _fuji;
+
ofPoint current;
current.set(_x, _y);
+
directionToFuji = calcDirection(&current, &fuji);
currentDirection = directionToFuji;
- angle = _angle;
- compass = getCompass();
+
+ operable = false;
}
//--------------------------------------------------------------
-ArsUIButton::ArsUIButton(double _lat, double _lon, string _udid, int _angle, int _compass, int _bid, ofPoint _fuji)
+ArsUICamera::ArsUICamera(double _lat, double _lon, string _udid, int _angle, int _compass, int _bid, ofPoint _fuji)
{
+ fuji = _fuji;
+
ofPoint p = GPStoXY(_lat, _lon);
x = p.x;
y = p.y;
udid = _udid;
angle = _angle;
compass = _compass;
bid = _bid;
- fuji = _fuji;
status = 0;
speed = 3600;
@@ -42,22 +50,24 @@ ArsUIButton::ArsUIButton(double _lat, double _lon, string _udid, int _angle, int
ofPoint current;
current.set(x, y);
+ directionToFuji = calcDirection(&current, &fuji);
currentDirection = compass * PI / 180;
+ currentDirection = directionToFuji;
compass = getCompass();
}
//--------------------------------------------------------------
-void ArsUIButton::update(){
+void ArsUICamera::update(){
- float v = sinf((float)bcnt/speed * 2 * PI);
- radius = 30 + v*4;
+ float v = sinf((float)bcnt / speed * 2 * PI);
+ radius = 30 + v * 4;
bcnt++;
- if(bcnt == speed) bcnt =0;
+ if(bcnt == speed) bcnt = 0;
}
//--------------------------------------------------------------
-void ArsUIButton::draw(){
+void ArsUICamera::draw(){
//status: 0:default 1:select
ofColor c;
@@ -103,7 +113,7 @@ void ArsUIButton::draw(){
//--------------------------------------------------------------
-int ArsUIButton::hitTestPoint(ofPoint p)
+int ArsUICamera::hitTestPoint(ofPoint p)
{
double distance = abs(sqrt((double)((p.x - x) * (p.x - x) + (p.y - y) * (p.y - y))));
@@ -114,27 +124,27 @@ int ArsUIButton::hitTestPoint(ofPoint p)
}
//--------------------------------------------------------------
-void ArsUIButton::setPosition(ofPoint pos)
+void ArsUICamera::setPosition(ofPoint pos)
{
x = pos.x;
y = pos.y;
}
//--------------------------------------------------------------
-ofPoint ArsUIButton::getPosition()
+ofPoint ArsUICamera::getPosition()
{
return ofPoint(x, y);
}
//--------------------------------------------------------------
-void ArsUIButton::setFujiPosition(ofPoint p)
+void ArsUICamera::setFujiPosition(ofPoint p)
{
fuji = p;
}
//--------------------------------------------------------------
//return radian
-double ArsUIButton::calcDirection(ofPoint *_p1, ofPoint *_p2)
+double ArsUICamera::calcDirection(ofPoint *_p1, ofPoint *_p2)
{
double v1[] = {100.0, 0};
double v2[] = { _p2->x - _p1->x, _p2->y - _p1->y };
@@ -149,7 +159,7 @@ double ArsUIButton::calcDirection(ofPoint *_p1, ofPoint *_p2)
}
//--------------------------------------------------------------
-int ArsUIButton::calcCompass(ofPoint *p)
+int ArsUICamera::calcCompass(ofPoint *p)
{
float dx = x - p->x;
float dy = y - p->y;
@@ -158,37 +168,43 @@ int ArsUIButton::calcCompass(ofPoint *p)
}
//--------------------------------------------------------------
-void ArsUIButton::setAngle(float _angle)
+string ArsUICamera::getUDID()
+{
+ return udid;
+}
+
+//--------------------------------------------------------------
+void ArsUICamera::setAngle(float _angle)
{
angle = _angle;
}
//--------------------------------------------------------------
-int ArsUIButton::getAngle()
+int ArsUICamera::getAngle()
{
return angle;
}
//--------------------------------------------------------------
-double ArsUIButton::getDirectionAsRadians()
+double ArsUICamera::getDirectionAsRadians()
{
return currentDirection;
}
//--------------------------------------------------------------
-double ArsUIButton::getDirectionAsDegrees()
+double ArsUICamera::getDirectionAsDegrees()
{
return currentDirection * 180 / PI;
}
//--------------------------------------------------------------
-void ArsUIButton::setCompass(int degrees)
+void ArsUICamera::setCompass(int degrees)
{
currentDirection = degrees * PI / 180;
}
//--------------------------------------------------------------
-int ArsUIButton::getCompass()
+int ArsUICamera::getCompass()
{
int deg = (int)getDirectionAsDegrees() - 90;
if (0 > deg) {
@@ -198,22 +214,28 @@ int ArsUIButton::getCompass()
}
//--------------------------------------------------------------
-void ArsUIButton::setStatus(int _status){
+void ArsUICamera::setStatus(int _status){
status = _status;
}
//--------------------------------------------------------------
-int ArsUIButton::getStatus(){
+int ArsUICamera::getStatus(){
return bid;
}
//--------------------------------------------------------------
-int ArsUIButton::getId(){
+int ArsUICamera::getButtonId(){
return bid;
}
//--------------------------------------------------------------
-void ArsUIButton::setCameraStatus(double _lat, double _lon, int compass, int angle){
+bool ArsUICamera::getOperable()
+{
+ return operable;
+}
+
+//--------------------------------------------------------------
+void ArsUICamera::setCameraStatus(double _lat, double _lon, int compass, int angle){
latitude = _lat;
longitude = _lon;
ofPoint place = GPStoXY(_lat, _lon);
@@ -223,7 +245,7 @@ void ArsUIButton::setCameraStatus(double _lat, double _lon, int compass, int ang
}
//--------------------------------------------------------------
-void ArsUIButton::setCameraStatus(ofxJSONElement json)
+void ArsUICamera::setCameraStatus(ofxJSONElement json)
{
latitude = json["latitude"].asDouble();
longitude = json["longitude"].asDouble();
@@ -236,7 +258,7 @@ void ArsUIButton::setCameraStatus(ofxJSONElement json)
}
//--------------------------------------------------------------
-ofPoint ArsUIButton::GPStoXY(double _lat,double _lon){
+ofPoint ArsUICamera::GPStoXY(double _lat,double _lon){
//calibration set
//fuji benchmark (富士 中心)
double fujiLat = 35.362841;
@@ -254,3 +276,12 @@ ofPoint ArsUIButton::GPStoXY(double _lat,double _lon){
return newPoint;
}
+//--------------------------------------------------------------
+double ArsUICamera::degreesAgainstFuji()
+{
+ double deg = atan2(y - fuji.y, x - fuji.x) * 180 / PI;
+// if (0 > deg) {
+// deg = ofMap(deg, -179, -1, 181, 359);
+// }
+ return deg;
+}
@@ -2,14 +2,15 @@
#include "ofxJSONElement.h"
-class ArsUIButton
+class ArsUICamera
{
protected:
string udid;
double latitude, longitude;
int compass;
int angle;
-
+ bool operable;
+
int status, bcnt, speed, tcnt; //status 0: not selected, 1:selected, 2: broken
ofImage mark, markShadow;
float x, y, radius;
@@ -23,27 +24,40 @@ class ArsUIButton
int calcCompass(ofPoint *p);
public:
- ArsUIButton(float _x, float _y, int _bid, ofPoint _fuji, float _angle, string _udid);
- ArsUIButton(double _lat, double _lon, string _udid, int _angle, int _compass, int _bid, ofPoint _fuji = ofPoint(964, 600));
+ ArsUICamera(float _x, float _y, int _bid, ofPoint _fuji, float _angle, string _udid);
+ ArsUICamera(double _lat, double _lon, string _udid, int _angle, int _compass, int _bid, ofPoint _fuji = ofPoint(964, 600));
virtual void draw();
virtual void update();
- virtual int hitTestPoint(ofPoint p);
+ virtual int hitTestPoint(ofPoint p);
+
void setPosition(ofPoint pos);
ofPoint getPosition();
-
+
void setFujiPosition(ofPoint p);
+ string getUDID();
+
void setAngle(float _angle);
int getAngle();
+
double getDirectionAsRadians();
double getDirectionAsDegrees();
+
void setCompass(int degrees);
int getCompass();
+
void setStatus(int _status);
int getStatus();
- int getId();
- void setCameraStatus(double _lat, double _lon, int compass, int angle);
- void setCameraStatus(ofxJSONElement json);
+
+ int getButtonId();
+
+ bool getOperable();
+
+ virtual void setCameraStatus(double _lat, double _lon, int compass, int angle);
+ virtual void setCameraStatus(ofxJSONElement json);
+
ofPoint GPStoXY(double _lat, double _lon);
+
+ double degreesAgainstFuji();
};
Oops, something went wrong.

0 comments on commit dda6bca

Please sign in to comment.