2019-06-14 07:40:01 -06:00
|
|
|
// marker.cpp
|
2003-01-31 21:41:30 -07:00
|
|
|
//
|
2019-06-14 07:40:01 -06:00
|
|
|
// Copyright (C) 2019, Celestia Development Team
|
2003-01-31 21:41:30 -07:00
|
|
|
// Copyright (C) 2003, Chris Laurel <claurel@shatters.net>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
#include "marker.h"
|
2019-06-14 07:40:01 -06:00
|
|
|
#include "render.h"
|
2003-01-31 21:41:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
UniversalCoord Marker::position(double jd) const
|
2003-01-31 21:41:30 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
return m_object.getPosition(jd);
|
2003-01-31 21:41:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
Selection Marker::object() const
|
2003-01-31 21:41:30 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
return m_object;
|
2003-01-31 21:41:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
int Marker::priority() const
|
2003-01-31 21:41:30 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
return m_priority;
|
2003-01-31 21:41:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
void Marker::setPriority(int priority)
|
2003-01-31 21:41:30 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
m_priority = priority;
|
2003-01-31 21:41:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
void Marker::setRepresentation(const MarkerRepresentation& rep)
|
2003-01-31 21:41:30 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
m_representation = rep;
|
2003-01-31 21:41:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
bool Marker::occludable() const
|
2003-01-31 21:41:30 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
return m_occludable;
|
2003-01-31 21:41:30 -07:00
|
|
|
}
|
2003-02-04 03:40:29 -07:00
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
void Marker::setOccludable(bool occludable)
|
2003-02-04 03:40:29 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
m_occludable = occludable;
|
2003-02-04 03:40:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-22 15:03:43 -06:00
|
|
|
MarkerSizing Marker::sizing() const
|
2003-02-04 03:40:29 -07:00
|
|
|
{
|
2008-09-22 15:03:43 -06:00
|
|
|
return m_sizing;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Marker::setSizing(MarkerSizing sizing)
|
|
|
|
{
|
|
|
|
m_sizing = sizing;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-12 09:51:25 -06:00
|
|
|
void Marker::render(Renderer& r, float size, const Matrices &m) const
|
2008-09-22 15:03:43 -06:00
|
|
|
{
|
2020-05-12 09:51:25 -06:00
|
|
|
m_representation.render(r, m_sizing == DistanceBasedSize ? size : m_representation.size(), m);
|
2003-02-25 01:03:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
MarkerRepresentation::MarkerRepresentation(const MarkerRepresentation& rep) :
|
|
|
|
m_symbol(rep.m_symbol),
|
|
|
|
m_size(rep.m_size),
|
|
|
|
m_color(rep.m_color),
|
|
|
|
m_label(rep.m_label)
|
2008-01-02 16:52:31 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
MarkerRepresentation&
|
|
|
|
MarkerRepresentation::operator=(const MarkerRepresentation& rep)
|
2008-01-02 16:52:31 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
m_symbol = rep.m_symbol;
|
|
|
|
m_size = rep.m_size;
|
|
|
|
m_color = rep.m_color;
|
|
|
|
m_label = rep.m_label;
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
return *this;
|
|
|
|
}
|
2018-03-11 07:12:58 -06:00
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
void MarkerRepresentation::setColor(Color color)
|
|
|
|
{
|
|
|
|
m_color = color;
|
2008-01-02 16:52:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
void MarkerRepresentation::setSize(float size)
|
2008-02-13 14:49:53 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
m_size = size;
|
2008-02-13 14:49:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
void MarkerRepresentation::setLabel(const std::string& label)
|
2008-02-13 14:49:53 -07:00
|
|
|
{
|
2008-05-22 14:30:45 -06:00
|
|
|
m_label = label;
|
2008-02-13 14:49:53 -07:00
|
|
|
}
|
|
|
|
|
2008-05-22 14:30:45 -06:00
|
|
|
|
2008-09-22 15:03:43 -06:00
|
|
|
/*! Render the marker symbol at the specified size. The size is
|
|
|
|
* the diameter of the marker in pixels.
|
|
|
|
*/
|
2020-05-12 09:51:25 -06:00
|
|
|
void MarkerRepresentation::render(Renderer &r, float size, const Matrices &m) const
|
2003-02-25 01:03:27 -07:00
|
|
|
{
|
2020-05-12 09:51:25 -06:00
|
|
|
r.renderMarker(m_symbol, size, m_color, m);
|
2003-02-25 01:03:27 -07:00
|
|
|
}
|