7#include "GeoGraphicsItem.h"
8#include "GeoGraphicsItem_p.h"
10#include "GeoDataPlacemark.h"
13#include "MarbleDebug.h"
20 : d( new GeoGraphicsItemPrivate( feature ) )
22 setFlag( ItemIsVisible,
true );
25GeoGraphicsItem::~GeoGraphicsItem()
30bool GeoGraphicsItem::visible()
const
32 return d->m_flags & ItemIsVisible;
35void GeoGraphicsItem::setVisible(
bool visible )
37 setFlag( ItemIsVisible, visible );
45void GeoGraphicsItem::setFlag( GeoGraphicsItemFlag flag,
bool enabled )
48 d->m_flags = d->m_flags | flag;
50 d->m_flags = d->m_flags & ~flag;
54void GeoGraphicsItem::setFlags( GeoGraphicsItemFlags flags )
70 d->m_highlightStyle = highlightStyle;
79 if ( d->m_highlighted && d->m_highlightStyle ) {
80 return d->m_highlightStyle;
84 if (
const GeoDataPlacemark *placemark = geodata_cast<GeoDataPlacemark>(d->m_feature)) {
85 auto styling = StyleParameters(placemark, d->m_renderContext.tileLevel());
86 for (
auto relation: d->m_relations) {
87 if (relation->isVisible()) {
88 styling.relation = relation;
92 d->m_style = d->m_styleBuilder->createStyle(styling);
94 d->m_style = d->m_feature->style();
101void GeoGraphicsItem::setStyleBuilder(
const StyleBuilder *styleBuilder)
103 d->m_styleBuilder = styleBuilder;
106void GeoGraphicsItem::resetStyle()
109 handleRelationUpdate(d->m_relations);
112qreal GeoGraphicsItem::zValue()
const
117void GeoGraphicsItem::setZValue( qreal z )
122void GeoGraphicsItem::setHighlighted(
bool highlight )
124 d->m_highlighted = highlight;
127bool GeoGraphicsItem::isHighlighted()
const
129 return d->m_highlighted;
134 return d->m_paintLayers;
137void GeoGraphicsItem::setPaintLayers(
const QStringList &paintLayers)
139 d->m_paintLayers = paintLayers;
142void GeoGraphicsItem::setRenderContext(
const RenderContext &renderContext)
144 if (renderContext != d->m_renderContext) {
145 d->m_renderContext = renderContext;
157 d->m_relations.clear();
158 std::copy(relations.
begin(), relations.
end(), std::back_inserter(d->m_relations));
159 std::sort(d->m_relations.begin(), d->m_relations.end(),
160 [](
const GeoDataRelation * a,
const GeoDataRelation * b) {
165 handleRelationUpdate(d->m_relations);
173int GeoGraphicsItem::minZoomLevel()
const
175 return d->m_minZoomLevel;
178void GeoGraphicsItem::setMinZoomLevel(
int zoomLevel)
180 d->m_minZoomLevel = zoomLevel;
183bool GeoGraphicsItem::zValueLessThan(GeoGraphicsItem *one, GeoGraphicsItem *two)
185 return one->d->m_zValue < two->d->m_zValue;
188bool GeoGraphicsItem::styleLessThan(GeoGraphicsItem *one, GeoGraphicsItem *two)
190 return reinterpret_cast<quint64
>(one->d->m_style.data()) <
reinterpret_cast<quint64
>(two->d->m_style.data());
193bool GeoGraphicsItem::zValueAndStyleLessThan(GeoGraphicsItem *one, GeoGraphicsItem *two)
195 if (one->d->m_zValue == two->d->m_zValue) {
196 return reinterpret_cast<quint64
>(one->d->m_style.data()) <
reinterpret_cast<quint64
>(two->d->m_style.data());
199 return one->d->m_zValue < two->d->m_zValue;
203bool RenderContext::operator==(
const RenderContext &other)
const
205 return m_tileLevel == other.m_tileLevel;
208bool RenderContext::operator!=(
const RenderContext &other)
const
210 return !operator==(other);
213int RenderContext::tileLevel()
const
218RenderContext::RenderContext(
int tileLevel) :
219 m_tileLevel(tileLevel)
A base class for all geodata features.
a class representing a point of interest on the map
A public class that controls what is visible in the viewport of a Marble map.
Binds a QML item to a specific geodetic location in screen coordinates.