schleyfox-ruby_kml 0.1.3 → 0.1.6

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/README.textile CHANGED
@@ -3,7 +3,7 @@ Sweet if you want to place markers, overlays, and other awesome things over a go
3
3
 
4
4
  h2. Install
5
5
 
6
- <pre><code>gem install xaviershay-ruby_kml --source http://gems.github.com</code></pre>
6
+ <pre><code>gem install schleyfox-ruby_kml --source http://gems.github.com</code></pre>
7
7
 
8
8
  h2. Examples
9
9
 
data/Rakefile CHANGED
@@ -1,27 +1,18 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
- require 'rake/packagetask'
5
- require 'rake/gempackagetask'
6
- require 'rake/contrib/rubyforgepublisher'
4
+ require 'erb'
7
5
 
8
6
  require File.join(File.dirname(__FILE__), 'lib/kml', 'version')
9
7
 
10
- PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
11
- PKG_NAME = 'kmlr'
12
- PKG_VERSION = KML::VERSION::STRING + PKG_BUILD
13
- PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
14
- PKG_DESTINATION = ENV["PKG_DESTINATION"] || "../#{PKG_NAME}"
15
-
16
- RELEASE_NAME = "REL #{PKG_VERSION}"
17
-
18
- RUBY_FORGE_PROJECT = "kmlr"
19
- RUBY_FORGE_USER = "aeden"
20
-
21
- desc 'Default: run unit tests.'
22
- task :default => :test
8
+ desc "Generate GemSpec file"
9
+ task :gem_spec do
10
+ t = ERB.new(File.read("ruby_kml.gemspec.erb"))
11
+ File.open("ruby_kml.gemspec", "w") do |f|
12
+ f.write(t.result(binding))
13
+ end
14
+ end
23
15
 
24
- desc 'Test the library.'
25
16
  Rake::TestTask.new(:test) do |t|
26
17
  t.libs << 'lib'
27
18
  t.pattern = 'test/**/*_test.rb'
@@ -45,44 +36,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
45
36
  rdoc.rdoc_files.include('lib/**/*.rb')
46
37
  end
47
38
 
48
- PKG_FILES = FileList[
49
- 'CHANGELOG',
50
- 'README',
51
- 'TODO',
52
- 'Rakefile',
53
- 'bin/**/*',
54
- 'doc/**/*',
55
- 'lib/**/*',
56
- ] - [ 'test' ]
57
-
58
- spec = Gem::Specification.new do |s|
59
- s.name = 'kmlr'
60
- s.version = PKG_VERSION
61
- s.summary = "Library to product KML files."
62
- s.description = <<-EOF
63
- KMLr is a Ruby library which can be used to construct Keyhole Markup Language files.
64
- EOF
65
-
66
- s.add_dependency('rake', '>= 0.7.1')
67
-
68
- s.rdoc_options << '--exclude' << '.'
69
- s.has_rdoc = false
70
-
71
- s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
72
- s.require_path = 'lib'
73
-
74
- s.author = "Anthony Eden"
75
- s.email = "anthonyeden@gmail.com"
76
- s.homepage = "http://kmlr.rubyforge.org/"
77
- s.rubyforge_project = "kmlr"
78
- end
79
-
80
- Rake::GemPackageTask.new(spec) do |pkg|
81
- pkg.gem_spec = spec
82
- pkg.need_tar = true
83
- pkg.need_zip = true
84
- end
85
-
86
39
  desc "Generate code statistics"
87
40
  task :lines do
88
41
  lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
@@ -107,28 +60,3 @@ task :lines do
107
60
 
108
61
  puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
109
62
  end
110
-
111
- desc "Publish the release files to RubyForge."
112
- task :release => [ :package ] do
113
- `rubyforge login`
114
-
115
- for ext in %w( gem tgz zip )
116
- release_command = "rubyforge add_release kmlr #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
117
- puts release_command
118
- system(release_command)
119
- end
120
- end
121
-
122
- desc "Publish the API documentation"
123
- task :pdoc => [:rdoc] do
124
- Rake::SshDirPublisher.new("aeden@rubyforge.org", "/var/www/gforge-projects/kmlr/rdoc", "rdoc").upload
125
- end
126
-
127
- desc "Reinstall the gem from a local package copy"
128
- task :reinstall => [:package] do
129
- windows = RUBY_PLATFORM =~ /mswin/
130
- sudo = windows ? '' : 'sudo'
131
- gem = windows ? 'gem.bat' : 'gem'
132
- `#{sudo} #{gem} uninstall -x -i #{PKG_NAME}`
133
- `#{sudo} #{gem} install pkg/#{PKG_NAME}-#{PKG_VERSION}`
134
- end
data/lib/kml/container.rb CHANGED
@@ -4,13 +4,19 @@ module KML
4
4
 
5
5
  # Access the features in the container
6
6
  attr_accessor :features
7
+ attr_accessor :plain_children
7
8
 
8
9
  # Get the features in the container
9
10
  def features
10
11
  @features ||= []
11
12
  end
13
+
14
+ def plain_children
15
+ @plain_children ||= []
16
+ end
17
+
12
18
  end
13
19
  end
14
20
 
15
21
  require 'kml/folder'
16
- require 'kml/document'
22
+ require 'kml/document'
data/lib/kml/document.rb CHANGED
@@ -23,4 +23,4 @@ module KML #:nodoc:
23
23
  }
24
24
  end
25
25
  end
26
- end
26
+ end
data/lib/kml/geometry.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module KML
2
- class Geometry < KML::Object
2
+ class Geometry < KML::Container
3
3
  # Specifies whether to connect the point to the ground. Extrusion requires that the point's +altitude_mode+ be
4
4
  # either "relativeToGround" or "absolute" and that within the +coordinates+, the altitude component be greater
5
5
  # than 0 (that is, in the air). Default is false.
@@ -83,4 +83,4 @@ require 'kml/line_string'
83
83
  require 'kml/linear_ring'
84
84
  require 'kml/polygon'
85
85
  require 'kml/model'
86
- require 'kml/multi_geometry'
86
+ require 'kml/multi_geometry'
data/lib/kml/model.rb CHANGED
@@ -1,4 +1,40 @@
1
1
  module KML
2
2
  class Model < Geometry
3
+
4
+ def initialize(params={})
5
+ @lng, @lat, @alt = *params[:location]
6
+ @heading, @tilt, @roll = *params[:orientation] || [0, 0, 0]
7
+ @x, @y, @z = *params[:scale] || [1, 1, 1]
8
+ @link = params[:link]
9
+ @id = params[:id] if params[:id]
10
+ end
11
+
12
+ def id
13
+ @id || "model_#{@link.href}_#{@x}_#{@y}"
14
+ end
15
+
16
+ def render(xm = Builder::XmlMarkup.new(:indent => 2))
17
+ xm.Model :id => id do
18
+ xm.altitudeMode(altitude_mode) if altitude_mode_set?
19
+ xm.Location do
20
+ xm.longitude @lng
21
+ xm.latitude @lat
22
+ xm.altitude @alt
23
+ end
24
+ xm.Orientation do
25
+ xm.heading @heading
26
+ xm.tilt @tilt
27
+ xm.roll @roll
28
+ end
29
+ xm.Scale do
30
+ xm.x @x
31
+ xm.y @y
32
+ xm.z @z
33
+ end
34
+ @link.render(xm)
35
+ # ResourceMap needs to be implemented still
36
+ end
37
+ end
38
+
3
39
  end
4
- end
40
+ end
@@ -1,5 +1,7 @@
1
1
  module KML
2
- class MultiGeometry < Geometry
3
-
2
+ class MultiGeometry < Geometry
3
+ def render(xm=Builder::XmlMarkup.new(:indent => 2))
4
+ xm.MultiGeometry { features.each { |f| f.render(xm) } }
5
+ end
4
6
  end
5
- end
7
+ end
data/lib/kml/placemark.rb CHANGED
@@ -23,13 +23,14 @@
23
23
  # </Placemark>
24
24
 
25
25
  module KML
26
- class Placemark < Container
26
+ class Placemark < KML::Container
27
27
  attr_accessor :geometry
28
28
 
29
29
  def render(xm=Builder::XmlMarkup.new(:indent => 2))
30
30
  xm.Placemark {
31
31
  super
32
32
  features.each { |f| f.render(xm) }
33
+ plain_children.each { |c| xm << c }
33
34
  geometry.render(xm) unless geometry.nil?
34
35
  }
35
36
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schleyfox-ruby_kml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
- - aeden, schleyfox, xaviershay
7
+ - aeden, schleyfox, xaviershay, andykram
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -26,41 +26,41 @@ files:
26
26
  - LICENSE
27
27
  - Rakefile
28
28
  - README.textile
29
+ - lib/kml/look_at.rb
30
+ - lib/kml/ground_overlay.rb
31
+ - lib/kml/model.rb
32
+ - lib/kml/link.rb
29
33
  - lib/kml/style.rb
34
+ - lib/kml/style_map.rb
30
35
  - lib/kml/hot_spot.rb
31
- - lib/kml/line_style.rb
32
- - lib/kml/link.rb
33
- - lib/kml/point.rb
34
- - lib/kml/polygon.rb
35
- - lib/kml/placemark.rb
36
- - lib/kml/model.rb
37
- - lib/kml/poly_style.rb
38
- - lib/kml/line_string.rb
39
- - lib/kml/screen_overlay.rb
36
+ - lib/kml/version.rb
37
+ - lib/kml/feature.rb
40
38
  - lib/kml/geometry.rb
41
- - lib/kml/snippet.rb
42
- - lib/kml/color_style.rb
43
- - lib/kml/folder.rb
44
39
  - lib/kml/lat_lon_box.rb
45
- - lib/kml/linear_ring.rb
46
- - lib/kml/style_map.rb
47
- - lib/kml/object.rb
48
- - lib/kml/document.rb
49
- - lib/kml/icon.rb
50
40
  - lib/kml/icon_style.rb
41
+ - lib/kml/line_string.rb
42
+ - lib/kml/poly_style.rb
43
+ - lib/kml/folder.rb
44
+ - lib/kml/object.rb
45
+ - lib/kml/color_style.rb
51
46
  - lib/kml/container.rb
52
- - lib/kml/multi_geometry.rb
53
- - lib/kml/look_at.rb
54
47
  - lib/kml/overlay.rb
48
+ - lib/kml/multi_geometry.rb
49
+ - lib/kml/snippet.rb
50
+ - lib/kml/polygon.rb
51
+ - lib/kml/document.rb
52
+ - lib/kml/screen_overlay.rb
53
+ - lib/kml/line_style.rb
54
+ - lib/kml/linear_ring.rb
55
+ - lib/kml/point.rb
56
+ - lib/kml/placemark.rb
55
57
  - lib/kml/style_selector.rb
56
- - lib/kml/feature.rb
57
- - lib/kml/version.rb
58
- - lib/kml/ground_overlay.rb
59
- - lib/kml_file.rb
58
+ - lib/kml/icon.rb
60
59
  - lib/kml.rb
61
- - test/kml/point_test.rb
60
+ - lib/kml_file.rb
62
61
  - test/kml_file_test.rb
63
62
  - test/test_helper.rb
63
+ - test/kml/point_test.rb
64
64
  - examples/melbourne-stations.kml
65
65
  has_rdoc: false
66
66
  homepage: http://github.com/schleyfox/ruby_kml
@@ -88,7 +88,5 @@ rubygems_version: 1.2.0
88
88
  signing_key:
89
89
  specification_version: 2
90
90
  summary: Generate KML files with ruby
91
- test_files:
92
- - test/kml/point_test.rb
93
- - test/kml_file_test.rb
94
- - test/test_helper.rb
91
+ test_files: []
92
+