Class: Kamelopard::PhotoOverlay

Inherits:
Overlay show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML’s PhotoOverlay class

Instance Attribute Summary collapse

Attributes inherited from Overlay

#color, #drawOrder, #icon

Attributes inherited from Feature

#abstractView, #addressDetails, #atom_author, #atom_link, #description, #extendedData, #metadata, #name, #open, #phoneNumber, #region, #snippet, #styleSelector, #styleUrl, #styles, #timeprimitive, #visibility

Attributes inherited from Object

#comment, #id

Instance Method Summary collapse

Methods inherited from Feature

add_author, #styles_to_kml, #timespan, #timespan=, #timestamp, #timestamp=

Constructor Details

#initialize(icon, point, rotation = 0, viewvolume = nil, imagepyramid = nil, shape = :rectangle) ⇒ PhotoOverlay

Returns a new instance of PhotoOverlay.



1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
# File 'lib/kamelopard/classes.rb', line 1503

def initialize(icon, point, rotation = 0, viewvolume = nil, imagepyramid = nil, shape = :rectangle)
    super(icon)
    if point.respond_to?('point')
        @point = point.point
    else
        @point = point
    end
    @rotation = rotation
    @viewVolume = viewvolume
    @imagePyramid = imagepyramid
    @shape = shape
end

Instance Attribute Details

#imagepyramidObject

Returns the value of attribute imagepyramid.



1501
1502
1503
# File 'lib/kamelopard/classes.rb', line 1501

def imagepyramid
  @imagepyramid
end

#pointObject

Returns the value of attribute point.



1501
1502
1503
# File 'lib/kamelopard/classes.rb', line 1501

def point
  @point
end

#rotationObject

Returns the value of attribute rotation.



1501
1502
1503
# File 'lib/kamelopard/classes.rb', line 1501

def rotation
  @rotation
end

#shapeObject

Returns the value of attribute shape.



1501
1502
1503
# File 'lib/kamelopard/classes.rb', line 1501

def shape
  @shape
end

#viewvolumeObject

Returns the value of attribute viewvolume.



1501
1502
1503
# File 'lib/kamelopard/classes.rb', line 1501

def viewvolume
  @viewvolume
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'lib/kamelopard/classes.rb', line 1516

def to_kml(elem = nil)
    p = REXML::Element.new 'PhotoOverlay'
    super p
    @viewVolume.to_kml p   unless @viewVolume.nil?
    @imagePyramid.to_kml p unless @imagePyramid.nil?
    p << @point.to_kml(true)
    {
        :rotation => @rotation,
        :shape => @shape
    }.each do |k, v|
        d = REXML::Element.new k.to_s
        d.text = v
        p << d
    end
    elem << p unless elem.nil?
    p
end