{"id":1428,"date":"2015-09-29T23:49:15","date_gmt":"2015-09-29T23:49:15","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1428"},"modified":"2015-09-29T23:49:15","modified_gmt":"2015-09-29T23:49:15","slug":"cesiumjs-how-to-draw-a-polyline-from-one-height-to-the-next","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2015\/09\/cesiumjs-how-to-draw-a-polyline-from-one-height-to-the-next\/","title":{"rendered":"Cesiumjs &#8211; How to draw a polyline from one height to the next."},"content":{"rendered":"<p><a href=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-draw-poly-lines.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-draw-poly-lines.png\" alt=\"phpmind-cesiumjs-draw-poly-lines\" width=\"458\" height=\"472\" class=\"aligncenter size-full wp-image-1429\" srcset=\"https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-draw-poly-lines.png 458w, https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/09\/phpmind-cesiumjs-draw-poly-lines-291x300.png 291w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><\/p>\n<pre>\r\nCesium.Math.setRandomNumberSeed(1234);\r\n\r\n    var viewer = new Cesium.Viewer('cesiumContainer');\r\n    var entities = viewer.entities;\r\n    var boxes = entities.add(new Cesium.Entity());\r\n    var polylines = entities.add(new Cesium.Entity());\r\n\r\n    \/\/Create the entities and assign each entity's parent to the group to which it belongs.\r\n    var prevHeight = 0.0;\r\n    for (var i = 0; i < 5; ++i) {\r\n        var height = 100000.0 + (200000.0 * i);\r\n        entities.add({\r\n            parent : boxes,\r\n            position : Cesium.Cartesian3.fromDegrees(-106.0, 45.0, height),\r\n            box : {\r\n                dimensions : new Cesium.Cartesian3(90000.0, 90000.0, 90000.0),\r\n                material : Cesium.Color.fromRandom({alpha : 1.0})\r\n            }\r\n        });\r\n        entities.add({\r\n            parent : polylines,\r\n            position : Cesium.Cartesian3.fromDegrees(-86.0, 55.0, height),\r\n            polyline : {\r\n                positions: [\r\n                    Cesium.Cartesian3.fromDegrees(-86.0, 55.0, prevHeight),\r\n                    Cesium.Cartesian3.fromDegrees(-86.0, 55.0, height)\r\n                ],\r\n                width : new Cesium.ConstantProperty(2),\r\n                material : Cesium.Color.fromRandom({alpha : 1.0}),\r\n                followSurface : new Cesium.ConstantProperty(false)\r\n            }\r\n        });\r\n        \r\n        prevHeight = height;\r\n    }\r\n    viewer.zoomTo(viewer.entities);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Cesium.Math.setRandomNumberSeed(1234); var viewer = new Cesium.Viewer(&#8216;cesiumContainer&#8217;); var entities = viewer.entities; var boxes = entities.add(new Cesium.Entity()); var polylines = entities.add(new Cesium.Entity()); \/\/Create the entities and assign each entity&#8217;s parent to the group to which it belongs. var prevHeight = 0.0; for (var i = 0; i < 5; ++i) { var height = 100000.0 + (200000.0 [&hellip;]\n<\/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-1428","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\/1428","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=1428"}],"version-history":[{"count":1,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1428\/revisions"}],"predecessor-version":[{"id":1430,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1428\/revisions\/1430"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}