# Copyright 2012 United States Government, as represented by the Secretary of Defense, Under # Secretary of Defense (Personnel & Readiness). # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express # or implied. See the License for the specific language governing permissions and limitations under # the License. ## The component representation of a cesium client ## ## @name client.vwf ## @namespace --- extends: http://vwf.example.com/client.vwf properties: longitude: latitude: location: set: | this.updateMarkers && this.updateMarkers( value ); this.location = value; color: methods: createMarkers: updateMarkers: scripts: - | this.initialize = function() { console.info( "=============== cesium.client.initialize ===============" ); this.billboard = undefined; this.label = undefined; } this.createMarkers = function( requestLocation ) { var self = this; var bbDef = { "extends": "http://vwf.example.com/cesium/billboard.vwf", }; var lblDef = { "extends": "http://vwf.example.com/cesium/label.vwf", }; var scene = self.parent; while( scene.parent.parent ) { scene = scene.parent; } // this node, nor it's parent are represented in the cesium driver, // so the scene must be used to add this child scene.children.create( self.displayName + "-bb", bbDef, function( child ) { self.billboard = child; child.position = self.location; console.info(child.position); child.color = self.color; } ); scene.children.create( self.displayName + "-label", lblDef, function( child ) { self.label = child; child.position = self.location; child.fillColor = self.color; child.verticalOrigin = 'top'; child.horizontalOrigin = 'center'; child.pixelOffset = [ 0, 10, 0 ]; child.font = '18px Helvetica'; child.text = self.displayName; } ); } this.updateMarkers = function( pos ) { if ( this.billboard ) { this.billboard.position = pos; } if ( this.label ) { this.label.position = pos; } } //@ sourceURL = cesium.client.vwf