schleyfox-ruby_kml 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/kml/overlay.rb CHANGED
@@ -17,4 +17,5 @@ module KML
17
17
  end
18
18
  end
19
19
 
20
- require 'kml/ground_overlay'
20
+ require 'kml/ground_overlay'
21
+ require 'kml/screen_overlay'
@@ -0,0 +1,61 @@
1
+ # This file implements the ScreenOverlay type
2
+ # <ScreenOverlay id="ID">
3
+ # <!-- inherited from Feature element -->
4
+ # <!-- inherited from Overlay element -->
5
+ #
6
+ # <!-- specific to ScreenOverlay -->
7
+ # <overlayXY x="double" y="double" xunits="fraction" yunits="fraction"/>
8
+ # <!-- vec2 -->
9
+ # <!-- xunits and yunits can be one of: fraction, pixels, or insetPixels -->
10
+ # <screenXY x="double" y="double" xunits="fraction" yunits="fraction"/>
11
+ # <!-- vec2 -->
12
+ # <rotationXY x="double" y="double" xunits="fraction" yunits"fraction"/>
13
+ # <!-- vec2 -->
14
+ # <size x="double" y="double" xunits="fraction" yunits="fraction"/>
15
+ # <!-- vec2 -->
16
+ # <rotation>0</rotation> <!-- float -->
17
+ # </ScreenOverlay>
18
+
19
+ module KML
20
+
21
+ class ScreenOverlay < Overlay
22
+
23
+ # A hash of options in the form of {:x, :y, :xunits, :yunits} that
24
+ # specify the point on the overlay image that is mapped to the screen
25
+ def overlay_xy
26
+ @overlay_xy
27
+ end
28
+
29
+ # Set the overlay_xy coordinates
30
+ #
31
+ # xunits and yunits are :pixels or :fraction
32
+ def overlay_xy= coords
33
+ @overlay_xy = {:xunits => :fraction, :yunits => :fraction}.merge(coords)
34
+ end
35
+
36
+ # A hash of options in the form of {:x, :y, :xunits, :yunits} that
37
+ # specify the position on the screen where the image is mapped
38
+ def screen_xy
39
+ @screen_xy
40
+ end
41
+
42
+ #Set the screen_xy coordinates
43
+ #
44
+ # xunits and yunits are :pixels or :fraction
45
+ def screen_xy= coords
46
+ @screen_xy = {:xunits => :fraction, :yunits => :fraction}.merge(coords)
47
+ end
48
+
49
+ attr_accessor :size, :rotation
50
+
51
+ def render(xm=Builder::XmlMarkup.new(:indent => 2))
52
+ xm.ScreenOverlay {
53
+ super
54
+ xm.overlayXY(@overlay_xy) if @overlay_xy
55
+ xm.screenXY(@screen_xy) if @screen_xy
56
+ xm.size{ @size } if @size
57
+ xm.rotation{ @rotation } if @rotation
58
+ }
59
+ end
60
+ end
61
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schleyfox-ruby_kml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - aeden, schleyfox, xaviershay
@@ -36,6 +36,7 @@ files:
36
36
  - lib/kml/model.rb
37
37
  - lib/kml/poly_style.rb
38
38
  - lib/kml/line_string.rb
39
+ - lib/kml/screen_overlay.rb
39
40
  - lib/kml/geometry.rb
40
41
  - lib/kml/snippet.rb
41
42
  - lib/kml/color_style.rb
@@ -83,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
84
  requirements: []
84
85
 
85
86
  rubyforge_project:
86
- rubygems_version: 1.0.1
87
+ rubygems_version: 1.2.0
87
88
  signing_key:
88
89
  specification_version: 2
89
90
  summary: Generate KML files with ruby