mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-01-18 20:12:10 +01:00
Added support for layout visibility style option
This commit is contained in:
parent
e3c940dd07
commit
9772c2f67f
@ -348,6 +348,10 @@ Style::Layer::Layout::Layout(const QJsonObject &json)
|
|||||||
|
|
||||||
// symbol
|
// symbol
|
||||||
_symbolPlacement = FunctionS(json["symbol-placement"]);
|
_symbolPlacement = FunctionS(json["symbol-placement"]);
|
||||||
|
|
||||||
|
// visibility
|
||||||
|
if (json.contains("visibility") && json["visibility"].isString())
|
||||||
|
_visible = !(json["visibility"].toString() == "none");
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont Style::Layer::Layout::font(int zoom) const
|
QFont Style::Layer::Layout::font(int zoom) const
|
||||||
@ -637,6 +641,9 @@ void Style::drawLayer(const PBF::Layer &pbfLayer, const Layer &styleLayer,
|
|||||||
if (pbfLayer.data()->version() > 2)
|
if (pbfLayer.data()->version() > 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!styleLayer.isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
QSizeF factor(tile.size().width() / tile.scale().x() /
|
QSizeF factor(tile.size().width() / tile.scale().x() /
|
||||||
(qreal)pbfLayer.data()->extent(), tile.size().height() / tile.scale().y()
|
(qreal)pbfLayer.data()->extent(), tile.size().height() / tile.scale().y()
|
||||||
/ (qreal)pbfLayer.data()->extent());
|
/ (qreal)pbfLayer.data()->extent());
|
||||||
|
@ -42,6 +42,7 @@ private:
|
|||||||
bool isPath() const {return (_type == Line || _type == Fill);}
|
bool isPath() const {return (_type == Line || _type == Fill);}
|
||||||
bool isBackground() const {return (_type == Background);}
|
bool isBackground() const {return (_type == Background);}
|
||||||
bool isSymbol() const {return (_type == Symbol);}
|
bool isSymbol() const {return (_type == Symbol);}
|
||||||
|
bool isVisible() const {return (_layout.visible());}
|
||||||
|
|
||||||
bool match(int zoom, const PBF::Feature &feature) const;
|
bool match(int zoom, const PBF::Feature &feature) const;
|
||||||
void setPathPainter(Tile &tile, const Sprites &sprites) const;
|
void setPathPainter(Tile &tile, const Sprites &sprites) const;
|
||||||
@ -92,7 +93,7 @@ private:
|
|||||||
class Layout {
|
class Layout {
|
||||||
public:
|
public:
|
||||||
Layout() : _textSize(16), _textMaxWidth(10), _textMaxAngle(45),
|
Layout() : _textSize(16), _textMaxWidth(10), _textMaxAngle(45),
|
||||||
_font("Open Sans") {}
|
_font("Open Sans"), _visible(true) {}
|
||||||
Layout(const QJsonObject &json);
|
Layout(const QJsonObject &json);
|
||||||
|
|
||||||
qreal maxTextWidth(int zoom) const
|
qreal maxTextWidth(int zoom) const
|
||||||
@ -109,6 +110,7 @@ private:
|
|||||||
Text::Anchor textAnchor(int zoom) const;
|
Text::Anchor textAnchor(int zoom) const;
|
||||||
Text::SymbolPlacement symbolPlacement(int zoom) const;
|
Text::SymbolPlacement symbolPlacement(int zoom) const;
|
||||||
Text::RotationAlignment textRotationAlignment(int zoom) const;
|
Text::RotationAlignment textRotationAlignment(int zoom) const;
|
||||||
|
bool visible() const {return _visible;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFont::Capitalization textTransform(int zoom) const;
|
QFont::Capitalization textTransform(int zoom) const;
|
||||||
@ -125,6 +127,7 @@ private:
|
|||||||
FunctionS _symbolPlacement;
|
FunctionS _symbolPlacement;
|
||||||
FunctionS _textRotationAlignment;
|
FunctionS _textRotationAlignment;
|
||||||
QFont _font;
|
QFont _font;
|
||||||
|
bool _visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Paint {
|
class Paint {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user