#include #include #include namespace mbgl { namespace style { CustomLayer::~CustomLayer() { printf("~CustomLayer destructor %p\n", this); // Need to set rawLayer to nil in the obj-c layer. if (onDestruction) onDestruction(); } CustomLayer::CustomLayer(const std::string& layerID, std::unique_ptr context): Layer(makeMutable(layerID, std::move(context))) { printf("CustomLayer::CustomLayer %p\n", this); } const CustomLayer::Impl& CustomLayer::impl() const { return static_cast(*baseImpl); } Mutable CustomLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr CustomLayer::cloneRef(const std::string&) const { assert(false); return nullptr; } void CustomLayer::setObserver(LayerObserver* observer) { Layer::setObserver(observer); impl().didSetObserver(observer != NULL); } // Visibility void CustomLayer::setVisibility(VisibilityType value) { if (value == getVisibility()) return; auto impl_ = mutableImpl(); impl_->visibility = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } // Zoom range void CustomLayer::setMinZoom(float minZoom) { auto impl_ = mutableImpl(); impl_->minZoom = minZoom; baseImpl = std::move(impl_); } void CustomLayer::setMaxZoom(float maxZoom) { auto impl_ = mutableImpl(); impl_->maxZoom = maxZoom; baseImpl = std::move(impl_); } template <> bool Layer::is() const { return getType() == LayerType::Custom; } } // namespace style } // namespace mbgl