{"id":1397,"date":"2015-09-23T22:37:22","date_gmt":"2015-09-23T22:37:22","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1397"},"modified":"2015-09-23T22:37:22","modified_gmt":"2015-09-23T22:37:22","slug":"cesiumjs-show-and-hide-multiple-entitylabels","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2015\/09\/cesiumjs-show-and-hide-multiple-entitylabels\/","title":{"rendered":"Cesiumjs &#8211; Show and hide multiple entity\/labels"},"content":{"rendered":"<p>How can i toggle multiple labels\/entities ?<\/p>\n<p><a href=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-show-hide.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1398\" src=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-show-hide.png\" alt=\"phpmind-cesiumjs-show-hide\" width=\"852\" height=\"502\" srcset=\"https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-show-hide.png 852w, https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-show-hide-300x177.png 300w, https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-show-hide-624x368.png 624w\" sizes=\"auto, (max-width: 852px) 100vw, 852px\" \/><\/a><\/p>\n<pre>var viewer = new Cesium.Viewer('cesiumContainer', { infoBox : false });\r\nvar entities = viewer.entities;\r\n\r\nvar labels = entities.add(new Cesium.Entity());\r\n\r\nvar longitude = - 106;\r\nfor (var i = 0; i &lt; 5; ++i) {\r\n    entities.add({\r\n        parent : labels,\r\n        position : Cesium.Cartesian3.fromDegrees(longitude, 45.0),\r\n        label : {\r\n            text : i.toString()\r\n        }\r\n    });\r\n    longitude++;\r\n}\r\n\r\nviewer.zoomTo(viewer.entities);\r\n\r\nSandcastle.addToolbarButton('Toggle Labels', function(){\r\n    labels.show = !labels.show;\r\n});\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How can i toggle multiple labels\/entities ? var viewer = new Cesium.Viewer(&#8216;cesiumContainer&#8217;, { infoBox : false }); var entities = viewer.entities; var labels = entities.add(new Cesium.Entity()); var longitude = &#8211; 106; for (var i = 0; i &lt; 5; ++i) { entities.add({ parent : labels, position : Cesium.Cartesian3.fromDegrees(longitude, 45.0), label : { text : i.toString() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[53,27],"tags":[],"class_list":["post-1397","post","type-post","status-publish","format-standard","hentry","category-cesiumjs","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1397"}],"version-history":[{"count":1,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1397\/revisions"}],"predecessor-version":[{"id":1399,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1397\/revisions\/1399"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}