kamelopard 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,20 +1,26 @@
1
1
  # vim:ts=4:sw=4:et:smartindent:nowrap
2
2
  def fly_to(p, d = 0, r = 100, m = nil)
3
- m = Document.instance.flyto_mode if m.nil?
4
- FlyTo.new(p, r, d, m)
3
+ m = Kamelopard::Document.instance.flyto_mode if m.nil?
4
+ Kamelopard::FlyTo.new(p, r, d, m)
5
5
  end
6
6
 
7
7
  def set_flyto_mode_to(a)
8
- Document.instance.flyto_mode = a
8
+ Kamelopard::Document.instance.flyto_mode = a
9
9
  end
10
10
 
11
11
  def mod_popup_for(p, v)
12
- a = AnimatedUpdate.new
13
- if ! p.is_a? Placemark then
12
+ au = Kamelopard::AnimatedUpdate.new
13
+ if ! p.is_a? Kamelopard::Placemark then
14
14
  raise "Can't show popups for things that aren't placemarks"
15
15
  end
16
- a << "<Change><Placemark targetId=\"#{p.id}\"><visibility>#{v}</visibility></Placemark></Change>"
17
- a
16
+ a = XML::Node.new 'Change'
17
+ b = XML::Node.new 'Placemark'
18
+ b.attributes['targetId'] = p.obj_id
19
+ c = XML::Node.new 'visibility'
20
+ c << XML::Node.new_text(v.to_s)
21
+ b << c
22
+ a << b
23
+ au << a
18
24
  end
19
25
 
20
26
  def hide_popup_for(p)
@@ -26,12 +32,12 @@ def show_popup_for(p)
26
32
  end
27
33
 
28
34
  def point(lo, la, alt=0, mode=nil, extrude = false)
29
- KMLPoint.new(lo, la, alt, mode.nil? ? :clampToGround : mode, extrude)
35
+ Kamelopard::Point.new(lo, la, alt, mode.nil? ? :clampToGround : mode, extrude)
30
36
  end
31
37
 
32
- # Returns the KML that makes up the current Document, as a string.
38
+ # Returns the KML that makes up the current Kamelopard::Document, as a string.
33
39
  def get_kml
34
- Document.instance.get_kml_document
40
+ Kamelopard::Document.instance.get_kml_document
35
41
  end
36
42
 
37
43
  def get_kml_string
@@ -39,26 +45,26 @@ def get_kml_string
39
45
  end
40
46
 
41
47
  def pause(p)
42
- Wait.new p
48
+ Kamelopard::Wait.new p
43
49
  end
44
50
 
45
51
  def name_tour(a)
46
- Document.instance.tour.name = a
52
+ Kamelopard::Document.instance.tour.name = a
47
53
  end
48
54
 
49
55
  def new_folder(name)
50
- Folder.new(name)
56
+ Kamelopard::Folder.new(name)
51
57
  end
52
58
 
53
59
  def name_folder(a)
54
- Document.instance.folder.name = a
60
+ Kamelopard::Document.instance.folder.name = a
55
61
  end
56
62
 
57
63
  def zoom_out(dist = 1000, dur = 0, mode = nil)
58
- l = Document.instance.tour.last_abs_view
64
+ l = Kamelopard::Document.instance.tour.last_abs_view
59
65
  raise "No current position to zoom out from\n" if l.nil?
60
66
  l.range += dist
61
- FlyTo.new(l, nil, dur, mode)
67
+ Kamelopard::FlyTo.new(l, nil, dur, mode)
62
68
  end
63
69
 
64
70
  # Creates a list of FlyTo elements to orbit and look at a given point (center),
@@ -69,7 +75,7 @@ end
69
75
  # subtract 360 from the endHeading. The tilt argument matches the KML LookAt
70
76
  # tilt argument
71
77
  def orbit(center, range = 100, tilt = 0, startHeading = 0, endHeading = 360)
72
- fly_to LookAt.new(center, startHeading, tilt, range), 2, nil
78
+ fly_to Kamelopard::LookAt.new(center, startHeading, tilt, range), 2, nil
73
79
 
74
80
  # We want at least 5 points (arbitrarily chosen value), plus at least 5 for
75
81
  # each full revolution
@@ -86,15 +92,15 @@ def orbit(center, range = 100, tilt = 0, startHeading = 0, endHeading = 360)
86
92
  lastval = startHeading
87
93
  startHeading.step(endHeading, step) do |theta|
88
94
  lastval = theta
89
- fly_to LookAt.new(center, theta, tilt, range), 2, nil, 'smooth'
95
+ fly_to Kamelopard::LookAt.new(center, theta, tilt, range), 2, nil, 'smooth'
90
96
  end
91
97
  if lastval != endHeading then
92
- fly_to LookAt.new(center, endHeading, tilt, range), 2, nil, 'smooth'
98
+ fly_to Kamelopard::LookAt.new(center, endHeading, tilt, range), 2, nil, 'smooth'
93
99
  end
94
100
  end
95
101
 
96
102
  def sound_cue(href, ds = nil)
97
- SoundCue.new href, ds
103
+ Kamelopard::SoundCue.new href, ds
98
104
  end
99
105
 
100
106
  # XXX This implementation of orbit is trying to do things the hard way, but the code might be useful for other situations where the hard way is the only possible one
@@ -19,7 +19,7 @@ class NDPointList
19
19
 
20
20
  def <<(a)
21
21
  # Append points to our list
22
- if a.kind_of? KMLPoint then
22
+ if a.kind_of? Kamelopard::Point then
23
23
  if self.dim == 3 then
24
24
  @points << [a.longitude, a.latitude, a.altitude]
25
25
  else
metadata CHANGED
@@ -1,26 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamelopard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Tolley
14
+ - Szymon Guz
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-11-23 00:00:00 -07:00
19
+ date: 2012-01-17 00:00:00 -07:00
19
20
  default_executable:
20
21
  dependencies: []
21
22
 
22
23
  description: Various classes and functions used to ease development of KML files, in particular for development of Google Earth tours
23
- email: josh@endpoint.com
24
+ email:
25
+ - josh@endpoint.com
26
+ - szymon@endpoint.com
24
27
  executables: []
25
28
 
26
29
  extensions: []