00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "marker.h"
00011 #include "gl.h"
00012
00013
00014 using namespace std;
00015
00016
00017 Marker::Marker(const Selection& s) :
00018 obj(s),
00019 size(10.0f),
00020 color(Color::White),
00021 priority(0),
00022 symbol(Diamond)
00023 {
00024 }
00025
00026 Marker::~Marker()
00027 {
00028 }
00029
00030
00031 UniversalCoord Marker::getPosition(double jd) const
00032 {
00033 return obj.getPosition(jd);
00034 }
00035
00036
00037 Selection Marker::getObject() const
00038 {
00039 return obj;
00040 }
00041
00042
00043 Color Marker::getColor() const
00044 {
00045 return color;
00046 }
00047
00048
00049 void Marker::setColor(Color _color)
00050 {
00051 color = _color;
00052 }
00053
00054
00055 float Marker::getSize() const
00056 {
00057 return size;
00058 }
00059
00060
00061 void Marker::setSize(float _size)
00062 {
00063 size = _size;
00064 }
00065
00066
00067 int Marker::getPriority() const
00068 {
00069 return priority;
00070 }
00071
00072
00073 void Marker::setPriority(int _priority)
00074 {
00075 priority = _priority;
00076 }
00077
00078
00079 Marker::Symbol Marker::getSymbol() const
00080 {
00081 return symbol;
00082 }
00083
00084 void Marker::setSymbol(Marker::Symbol _symbol)
00085 {
00086 symbol = _symbol;
00087 }
00088
00089
00090 void Marker::render() const
00091 {
00092 float s = getSize() / 2.0f;
00093
00094 switch (symbol)
00095 {
00096 case Diamond:
00097 glBegin(GL_LINE_LOOP);
00098 glVertex3f(0.0f, s, 0.0f);
00099 glVertex3f( s, 0.0f, 0.0f);
00100 glVertex3f(0.0f, -s, 0.0f);
00101 glVertex3f( -s, 0.0f, 0.0f);
00102 glEnd();
00103 break;
00104
00105 case Plus:
00106 glBegin(GL_LINES);
00107 glVertex3f(0.0f, s, 0.0f);
00108 glVertex3f(0.0f, -s, 0.0f);
00109 glVertex3f( s, 0.0f, 0.0f);
00110 glVertex3f(-s, 0.0f, 0.0f);
00111 glEnd();
00112 break;
00113
00114 case X:
00115 glBegin(GL_LINES);
00116 glVertex3f(-s, -s, 0.0f);
00117 glVertex3f( s, s, 0.0f);
00118 glVertex3f( s, -s, 0.0f);
00119 glVertex3f(-s, s, 0.0f);
00120 glEnd();
00121 break;
00122
00123 case Square:
00124 glBegin(GL_LINE_LOOP);
00125 glVertex3f(-s, -s, 0.0f);
00126 glVertex3f( s, -s, 0.0f);
00127 glVertex3f( s, s, 0.0f);
00128 glVertex3f(-s, s, 0.0f);
00129 glEnd();
00130 break;
00131
00132 case Triangle:
00133 glBegin(GL_LINE_LOOP);
00134 glVertex3f(0.0f, s, 0.0f);
00135 glVertex3f( s, -s, 0.0f);
00136 glVertex3f( -s, -s, 0.0f);
00137 glEnd();
00138 break;
00139 }
00140 }