Class: KML::Model
- Defined in:
- lib/kml/model.rb
Instance Attribute Summary
Attributes inherited from Container
Attributes inherited from Feature
#address, #address_details, #description, #look_at, #metadata, #name, #phone_number, #region, #snippet, #style_selector, #style_url, #time_primitive
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(params = {}) ⇒ Model
constructor
A new instance of Model.
- #render(xm = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object
Methods inherited from Geometry
#altitude_mode, #altitude_mode=, #altitude_mode_set?, #extrude, #extrude=, #extrude?, parse, #parse, #tessellate, #tessellate=, #tessellate?
Methods inherited from Container
Methods inherited from Feature
#open, #open=, #open?, #parse, #visibility, #visibility=, #visibility?
Methods inherited from Object
Constructor Details
#initialize(params = {}) ⇒ Model
Returns a new instance of Model.
4 5 6 7 8 9 10 |
# File 'lib/kml/model.rb', line 4 def initialize(params={}) @lng, @lat, @alt = *params[:location] @heading, @tilt, @roll = *params[:orientation] || [0, 0, 0] @x, @y, @z = *params[:scale] || [1, 1, 1] @link = params[:link] @id = params[:id] if params[:id] end |
Instance Method Details
#id ⇒ Object
12 13 14 |
# File 'lib/kml/model.rb', line 12 def id @id || "model_#{@link.href}_#{@x}_#{@y}" end |
#render(xm = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kml/model.rb', line 16 def render(xm = Builder::XmlMarkup.new(:indent => 2)) xm.Model :id => id do xm.altitudeMode(altitude_mode) if altitude_mode_set? xm.Location do xm.longitude @lng xm.latitude @lat xm.altitude @alt end xm.Orientation do xm.heading @heading xm.tilt @tilt xm.roll @roll end xm.Scale do xm.x @x xm.y @y xm.z @z end @link.render(xm) # ResourceMap needs to be implemented still end end |