@@ -43,10 +43,11 @@ <h1 class="page-title">Source: annotations/markups/_MarkupManager.js</h1>
4343import defaultStyles from '../styles'
4444
4545class _MarkupManager {
46- constructor ({ map, pyramid, formatters, onClick, onStyle } = {}) {
46+ constructor ({ map, pyramid, drawingSource, formatters, onClick, onStyle } = {}) {
4747 this._map = map
4848 this._pyramid = pyramid
4949 this._formatters = formatters
50+ this._drawingSource = drawingSource;
5051
5152 this.onClick = onClick
5253 this.onStyle = onStyle
@@ -138,6 +139,34 @@ <h1 class="page-title">Source: annotations/markups/_MarkupManager.js</h1>
138139 return id
139140 }
140141
142+ /**
143+ * Set markup visibility.
144+ *
145+ * @param {string} id The markup id
146+ * @param {boolean} isVisible The markup visibility
147+ */
148+ setVisibility (id, isVisible) {
149+ const markup = this.get(id)
150+ if (!markup) {
151+ return;
152+ }
153+
154+ const links = this._links.getArray()
155+ const link = links.find((feature) => feature.getId() === id)
156+
157+ const feature = this._drawingSource.getFeatureById(id);
158+
159+ if (!isVisible) {
160+ this._map.removeOverlay(markup.overlay)
161+ this._links.remove(link)
162+ } else {
163+ this._map.addOverlay(markup.overlay)
164+ this._drawLink(feature)
165+ }
166+
167+ return isVisible
168+ }
169+
141170 /**
142171 * Creates a new markup
143172 *
@@ -464,7 +493,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="api.ht
464493< br class ="clear ">
465494
466495< footer >
467- Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.5</ a > on Wed Oct 06 2021 05:27:33 GMT-0400 (Eastern Daylight Time)
496+ Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.5</ a > on Fri Oct 15 2021 08:06:40 GMT-0400 (Eastern Daylight Time)
468497</ footer >
469498
470499< script > prettyPrint ( ) ; </ script >
0 commit comments