tdiary-contrib 4.0.4 → 4.0.5.1

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -0
  3. data/Gemfile +2 -8
  4. data/Gemfile.lock +17 -21
  5. data/README.en.md +1 -1
  6. data/filter/commentsize.rb +1 -1
  7. data/filter/iplookup.rb +55 -55
  8. data/filter/plugin/commentsize.rb +1 -1
  9. data/filter/plugin/en/spambayes.rb +1 -1
  10. data/filter/plugin/iplookup.rb +39 -39
  11. data/filter/plugin/ja/antirefspam.rb +1 -1
  12. data/filter/plugin/ja/spambayes.rb +1 -1
  13. data/filter/plugin/spambayes.rb +1 -1
  14. data/filter/spambayes.rb +1 -1
  15. data/js/flickr.js +1 -1
  16. data/lib/bayes.rb +1 -1
  17. data/lib/bayes/convert.rb +1 -1
  18. data/lib/tdiary/contrib/version.rb +1 -1
  19. data/lib/wgs2tky.rb +93 -93
  20. data/plugin/appstore.rb +6 -6
  21. data/plugin/bigpresen.rb +3 -3
  22. data/plugin/bitly.rb +1 -1
  23. data/plugin/brow_si.rb +1 -1
  24. data/plugin/category_similar.rb +1 -1
  25. data/plugin/category_to_tagcloud.rb +2 -2
  26. data/plugin/coderay.rb +1 -1
  27. data/plugin/datepicker.rb +1 -1
  28. data/plugin/flickr.rb +2 -2
  29. data/plugin/git-register.rb +7 -7
  30. data/plugin/goo_gl.rb +7 -7
  31. data/plugin/google_map.rb +6 -6
  32. data/plugin/google_webmaster.rb +4 -4
  33. data/plugin/hb_footer.rb +5 -5
  34. data/plugin/hb_footer4sec.rb +5 -5
  35. data/plugin/hide_sidebar_iphone.rb +1 -1
  36. data/plugin/iddy.rb +1 -1
  37. data/plugin/image_ex.rb +17 -17
  38. data/plugin/image_gps.rb +3 -3
  39. data/plugin/inline_wiki.rb +6 -6
  40. data/plugin/instagr.rb +8 -8
  41. data/plugin/instagram.rb +1 -1
  42. data/plugin/ja/yo_update.rb +51 -0
  43. data/plugin/jquery_ui_theme.rb +8 -8
  44. data/plugin/jroku.rb +1 -1
  45. data/plugin/jyear.rb +2 -2
  46. data/plugin/makerss_category.rb +4 -4
  47. data/plugin/makerss_comment.rb +4 -4
  48. data/plugin/microsummary.rb +2 -2
  49. data/plugin/nhk_program_info.rb +2 -2
  50. data/plugin/picasa.rb +2 -2
  51. data/plugin/playstore.rb +3 -3
  52. data/plugin/rating.rb +10 -10
  53. data/plugin/recent_estraier.rb +7 -7
  54. data/plugin/search-bing.rb +1 -1
  55. data/plugin/search-google-custom.rb +1 -1
  56. data/plugin/search-yahoo-websearch.rb +8 -8
  57. data/plugin/search-yahoo.rb +1 -1
  58. data/plugin/section_footer2.rb +1 -1
  59. data/plugin/show_and_hide.rb +20 -20
  60. data/plugin/socialbutton.rb +2 -2
  61. data/plugin/tdiarytimes.rb +16 -16
  62. data/plugin/tdiarytimes2.rb +10 -10
  63. data/plugin/tdiarytimes_textstyle.rb +3 -3
  64. data/plugin/twitter_anywhere.rb +51 -51
  65. data/plugin/twitter_summary_card.rb +1 -1
  66. data/plugin/vote.rb +4 -4
  67. data/plugin/yahoo_kousei.rb +2 -2
  68. data/plugin/yo_update.rb +214 -0
  69. data/plugin/zenback.rb +2 -2
  70. data/spec/apple_webclip_spec.rb +6 -6
  71. data/util/estraier-search/estraier-register.rb +2 -2
  72. data/util/image-gallery/image-gallery.rb +8 -8
  73. data/util/image-gallery/misc/plugin/recent_image.rb +4 -4
  74. data/util/posttdiary/posttdiary-ex.rb +7 -7
  75. data/util/rast-search/rast-register.rb +1 -1
  76. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d0b4cf97185a2825255b425b8a0f5841f7601a2
4
- data.tar.gz: 9cc1611f61dca118aa7a16670b02825289b1a633
3
+ metadata.gz: 152afb1d5cad913952e857a30f345acf38bfd5ee
4
+ data.tar.gz: 0cf9cf19a1a702f1c8525590f758961f62f3b400
5
5
  SHA512:
6
- metadata.gz: dd6c9ff62f892b3ca29d085cc9e885626c3a860a4341aa84af0b04cce89dc08a0343d60e11424b01d832c4b2ee765edb11c4d3a2607e6b2b9d5060f9bbe0ff57
7
- data.tar.gz: d0fbea8bb274c4ebd6569462c2b87efe152ad432b47d77956f0a8c2ca09f1da6b74686fb62f42a1407d1f9ee158a2a35e433dbc78c728890205f50f7f32d1dcd
6
+ metadata.gz: 4f7694b823e7bab599e8589c7f09fcbe17003aef7c807876578cb78115fcda3e1944fc207b327a8783b6eeb5111f49487d9dc8fd7eb60c4e3a3d416f917f28f4
7
+ data.tar.gz: 61ae49ef6f1cb722271c4984e0baefaf61eeea0ea9086554560b5e59d490f79893130f11e0a9054a26d0eb17eb8bb1a257084f4827f79bb5dc0ea2339c55996b
@@ -1,6 +1,8 @@
1
1
  rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
+ - 2.1
5
+ - ruby-head
4
6
 
5
7
  cache: bundler
6
8
 
@@ -8,3 +10,7 @@ script: bundle exec rake spec
8
10
 
9
11
  notifications:
10
12
  irc: "irc.freenode.org#tdiary"
13
+
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -3,11 +3,5 @@ source 'https://rubygems.org'
3
3
  gem 'tdiary', '~> 4.0.2'
4
4
 
5
5
  gem 'rake'
6
- gem 'rspec', '~> 3.0.0.beta2'
7
-
8
- platforms :ruby_18 do
9
- gem 'json'
10
- gem 'rcov'
11
- end
12
-
13
- gem 'simplecov', :platforms => :ruby_19
6
+ gem 'rspec'
7
+ gem 'simplecov'
@@ -2,29 +2,27 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  diff-lcs (1.2.5)
5
- docile (1.1.3)
6
- json (1.8.1)
7
- multi_json (1.9.2)
8
- rake (10.2.2)
9
- rcov (1.0.0)
10
- rspec (3.0.0.beta2)
11
- rspec-core (= 3.0.0.beta2)
12
- rspec-expectations (= 3.0.0.beta2)
13
- rspec-mocks (= 3.0.0.beta2)
14
- rspec-core (3.0.0.beta2)
15
- rspec-support (= 3.0.0.beta2)
16
- rspec-expectations (3.0.0.beta2)
5
+ docile (1.1.5)
6
+ multi_json (1.10.1)
7
+ rake (10.3.2)
8
+ rspec (3.0.0)
9
+ rspec-core (~> 3.0.0)
10
+ rspec-expectations (~> 3.0.0)
11
+ rspec-mocks (~> 3.0.0)
12
+ rspec-core (3.0.3)
13
+ rspec-support (~> 3.0.0)
14
+ rspec-expectations (3.0.3)
17
15
  diff-lcs (>= 1.2.0, < 2.0)
18
- rspec-support (= 3.0.0.beta2)
19
- rspec-mocks (3.0.0.beta2)
20
- rspec-support (= 3.0.0.beta2)
21
- rspec-support (3.0.0.beta2)
22
- simplecov (0.8.2)
16
+ rspec-support (~> 3.0.0)
17
+ rspec-mocks (3.0.3)
18
+ rspec-support (~> 3.0.0)
19
+ rspec-support (3.0.3)
20
+ simplecov (0.9.0)
23
21
  docile (~> 1.1.0)
24
22
  multi_json
25
23
  simplecov-html (~> 0.8.0)
26
24
  simplecov-html (0.8.0)
27
- tdiary (4.0.3)
25
+ tdiary (4.0.4)
28
26
  bundler (~> 1.3)
29
27
  thor (~> 0.18)
30
28
  thor (0.19.1)
@@ -33,9 +31,7 @@ PLATFORMS
33
31
  ruby
34
32
 
35
33
  DEPENDENCIES
36
- json
37
34
  rake
38
- rcov
39
- rspec (~> 3.0.0.beta2)
35
+ rspec
40
36
  simplecov
41
37
  tdiary (~> 4.0.2)
@@ -5,7 +5,7 @@ See documents in each directories.
5
5
 
6
6
  See licenses and copyrights in each theme files. If no license
7
7
  or copyright, it can be distoributed by GPL2, and it has a
8
- copyright below:
8
+ copyright below:
9
9
 
10
10
  ```
11
11
  Copyright (c) 2005 TADA Tadashi <t@tdtds.jp>
@@ -9,7 +9,7 @@ module TDiary
9
9
  return false if comment.body.size > @conf['comment.size']
10
10
  true
11
11
  end
12
-
12
+
13
13
  def referer_filter( referer )
14
14
  true
15
15
  end
@@ -1,55 +1,55 @@
1
- #
2
- # iplookup.rb: included TDiary::Filter::IplookupFilter class
3
- #
4
- #
5
- # Copyright (c) 2008 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
6
- # Distributed under the GPL2
7
- #
8
-
9
- require 'resolv'
10
-
11
- module TDiary
12
- module Filter
13
- class IplookupFilter < Filter
14
- def iplookup_init
15
- if @conf.options.include?('iplookup.ip.list')
16
- @iplookup_ip_list = @conf.options['iplookup.ip.list']
17
- else
18
- @iplookup_ip_list = "bsb.spamlookup.net\nopm.blitzed.org\n" +
19
- "niku.2ch.net\ndnsbl.spam-champuru.livedoor.com"
20
- end
21
- end
22
-
23
- def black_ip?( address )
24
- chance = 2
25
- ip = address.gsub(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/, '\4.\3.\2.\1')
26
- @iplookup_ip_list.split(/\n+/).each do |dnsbl|
27
- begin
28
- address = Resolv.getaddress( "#{ip}.#{dnsbl}" )
29
- return true
30
- rescue Resolv::ResolvTimeout
31
- if chance > 0
32
- chance -= 1
33
- retry
34
- end
35
- rescue Resolv::ResolvError
36
- rescue Exception
37
- end
38
- end
39
- return false
40
- end
41
-
42
- def comment_filter( diary, comment )
43
- iplookup_init
44
- return false if black_ip?( @cgi.remote_addr )
45
- return true
46
- end
47
-
48
- def referer_filter( referer )
49
- iplookup_init
50
- return false if black_ip?( @cgi.remote_addr )
51
- return true
52
- end
53
- end
54
- end
55
- end
1
+ #
2
+ # iplookup.rb: included TDiary::Filter::IplookupFilter class
3
+ #
4
+ #
5
+ # Copyright (c) 2008 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
6
+ # Distributed under the GPL2
7
+ #
8
+
9
+ require 'resolv'
10
+
11
+ module TDiary
12
+ module Filter
13
+ class IplookupFilter < Filter
14
+ def iplookup_init
15
+ if @conf.options.include?('iplookup.ip.list')
16
+ @iplookup_ip_list = @conf.options['iplookup.ip.list']
17
+ else
18
+ @iplookup_ip_list = "bsb.spamlookup.net\nopm.blitzed.org\n" +
19
+ "niku.2ch.net\ndnsbl.spam-champuru.livedoor.com"
20
+ end
21
+ end
22
+
23
+ def black_ip?( address )
24
+ chance = 2
25
+ ip = address.gsub(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/, '\4.\3.\2.\1')
26
+ @iplookup_ip_list.split(/\n+/).each do |dnsbl|
27
+ begin
28
+ address = Resolv.getaddress( "#{ip}.#{dnsbl}" )
29
+ return true
30
+ rescue Resolv::ResolvTimeout
31
+ if chance > 0
32
+ chance -= 1
33
+ retry
34
+ end
35
+ rescue Resolv::ResolvError
36
+ rescue Exception
37
+ end
38
+ end
39
+ return false
40
+ end
41
+
42
+ def comment_filter( diary, comment )
43
+ iplookup_init
44
+ return false if black_ip?( @cgi.remote_addr )
45
+ return true
46
+ end
47
+
48
+ def referer_filter( referer )
49
+ iplookup_init
50
+ return false if black_ip?( @cgi.remote_addr )
51
+ return true
52
+ end
53
+ end
54
+ end
55
+ end
@@ -3,7 +3,7 @@ add_conf_proc( 'comment_size' , @comment_size_conf, 'security') do
3
3
  @conf['comment.size'] = @cgi.params['comment.size'][0]
4
4
  end
5
5
  @conf['comment.size'] = 0 unless @conf['comment.size']
6
-
6
+
7
7
  result = <<-HTML
8
8
  <h3>#{@comment_size}</h3>
9
9
  <p>#{@comment_size_desc}</p>
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2007, KURODA Hiraku <hiraku@hinet.mydns.jp>
2
- # You can redistribute it and/or modify it under GPL2.
2
+ # You can redistribute it and/or modify it under GPL2.
3
3
 
4
4
  class SpambayesConfig
5
5
  module Res
@@ -1,39 +1,39 @@
1
- # iplookup.rb
2
- #
3
- # Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
4
- # Distributed under the GPL
5
- #
6
- if TDIARY_VERSION >= '2.1.2.20050825' then
7
- add_conf_proc( 'iplookup', @iplookup_label, 'security' ) do
8
- iplookup_conf_proc
9
- end
10
- else
11
- add_conf_proc( 'iplookup', @iplookup_label ) do
12
- iplookup_conf_proc
13
- end
14
- end
15
- def iplookup_conf_proc
16
- if @mode == 'saveconf' then
17
- if @cgi.params['iplookup.ip.list'] && @cgi.params['iplookup.ip.list'][0]
18
- @conf['iplookup.ip.list'] = @cgi.params['iplookup.ip.list'][0]
19
- else
20
- @conf['iplookup.ip.list'] = nil
21
- end
22
-
23
- if @cgi.params['iplookup.safe_ip.list'] && @cgi.params['iplookup.safe_ip.list'][0]
24
- @conf['iplookup.safe_ip.list'] = @cgi.params['iplookup.safe_ip.list'][0]
25
- else
26
- @conf['iplookup.safe_ip.list'] = nil
27
- end
28
-
29
- end
30
-
31
- # initialize DNSBL list
32
- @conf['iplookup.ip.list'] = "bsb.spamlookup.net\nopm.blitzed.org\nniku.2ch.net" unless @conf['iplookup.ip.list']
33
-
34
- result = <<-HTML
35
- <h3>#{@iplookup_ip_label}</h3>
36
- <p>#{@iplookup_ip_label_desc}</p>
37
- <p><textarea name="iplookup.ip.list" cols="70" rows="5">#{CGI::escapeHTML( @conf['iplookup.ip.list'] )}</textarea></p>
38
- HTML
39
- end
1
+ # iplookup.rb
2
+ #
3
+ # Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
4
+ # Distributed under the GPL
5
+ #
6
+ if TDIARY_VERSION >= '2.1.2.20050825' then
7
+ add_conf_proc( 'iplookup', @iplookup_label, 'security' ) do
8
+ iplookup_conf_proc
9
+ end
10
+ else
11
+ add_conf_proc( 'iplookup', @iplookup_label ) do
12
+ iplookup_conf_proc
13
+ end
14
+ end
15
+ def iplookup_conf_proc
16
+ if @mode == 'saveconf' then
17
+ if @cgi.params['iplookup.ip.list'] && @cgi.params['iplookup.ip.list'][0]
18
+ @conf['iplookup.ip.list'] = @cgi.params['iplookup.ip.list'][0]
19
+ else
20
+ @conf['iplookup.ip.list'] = nil
21
+ end
22
+
23
+ if @cgi.params['iplookup.safe_ip.list'] && @cgi.params['iplookup.safe_ip.list'][0]
24
+ @conf['iplookup.safe_ip.list'] = @cgi.params['iplookup.safe_ip.list'][0]
25
+ else
26
+ @conf['iplookup.safe_ip.list'] = nil
27
+ end
28
+
29
+ end
30
+
31
+ # initialize DNSBL list
32
+ @conf['iplookup.ip.list'] = "bsb.spamlookup.net\nopm.blitzed.org\nniku.2ch.net" unless @conf['iplookup.ip.list']
33
+
34
+ result = <<-HTML
35
+ <h3>#{@iplookup_ip_label}</h3>
36
+ <p>#{@iplookup_ip_label_desc}</p>
37
+ <p><textarea name="iplookup.ip.list" cols="70" rows="5">#{CGI::escapeHTML( @conf['iplookup.ip.list'] )}</textarea></p>
38
+ HTML
39
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # antirefspam.rb
2
+ # antirefspam.rb
3
3
  #
4
4
  # Copyright (c) 2004-2005 T.Shimomura <redbug@netlife.gr.jp>
5
5
  # You can redistribute it and/or modify it under GPL2.
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2007, KURODA Hiraku <hiraku@hinet.mydns.jp>
2
- # You can redistribute it and/or modify it under GPL2.
2
+ # You can redistribute it and/or modify it under GPL2.
3
3
 
4
4
  class SpambayesConfig
5
5
  module Res
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2007, KURODA Hiraku <hiraku@hinet.mydns.jp>
2
- # You can redistribute it and/or modify it under GPL2.
2
+ # You can redistribute it and/or modify it under GPL2.
3
3
 
4
4
  require "bayes"
5
5
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2007, KURODA Hiraku <hiraku@hinet.mydns.jp>
2
- # You can redistribute it and/or modify it under GPL2.
2
+ # You can redistribute it and/or modify it under GPL2.
3
3
 
4
4
  require "bayes"
5
5
 
@@ -54,7 +54,7 @@ $(function() {
54
54
  * a Flickr API client for JavaScript
55
55
  */
56
56
  flickrClient = function(apiKey) {
57
- this.baseUrl = 'http://api.flickr.com/services/rest/?';
57
+ this.baseUrl = 'https://api.flickr.com/services/rest/?';
58
58
  this.apiKey = apiKey;
59
59
  }
60
60
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2007, KURODA Hiraku <hiraku@hinet.mydns.jp>
2
- # You can redistribute it and/or modify it under GPL2.
2
+ # You can redistribute it and/or modify it under GPL2.
3
3
 
4
4
  require "pstore"
5
5
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2008, KURODA Hiraku <hiraku@hinet.mydns.jp>
2
- # You can redistribute it and/or modify it under GPL2.
2
+ # You can redistribute it and/or modify it under GPL2.
3
3
 
4
4
  require "bayes"
5
5
  require "kconv"
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "4.0.4"
3
+ VERSION = "4.0.5.1"
4
4
  end
5
5
  end
@@ -1,93 +1,93 @@
1
- #
2
- # wgs2tky.rb
3
- # -- GPS data converter
4
- #
5
- # kp<kp@mmho.no-ip.org>
6
- # Destributed under the GPL
7
-
8
- class Wgs2Tky
9
-
10
- Pi = Math::PI
11
- Rd = Pi/180
12
-
13
- # WGS84
14
- A = 6378137.0 # 赤道半径
15
- F = 1/298.257223563 # 扁平率
16
- E2 = F*2 - F*F # 第一離心率
17
-
18
- # Tokyo
19
- A_ = 6378137.0 - 739.845 # 6377397.155
20
- F_ = 1/298.257223563 - 0.000010037483
21
- # 1 / 299.152813
22
- E2_ = F_*2 - F_*F_
23
-
24
- Dx = +128
25
- Dy = -481
26
- Dz = -664
27
-
28
- def Wgs2Tky.conv!(lat,lon,h = 0)
29
- b = lat[0].to_f + lat[1].to_f/60 + lat[2].to_f/3600
30
- l = lon[0].to_f + lon[1].to_f/60 + lon[2].to_f/3600
31
-
32
- (x,y,z) = Wgs2Tky._llh2xyz(b,l,h,A,E2)
33
-
34
- x+=Dx
35
- y+=Dy
36
- z+=Dz
37
-
38
- (b,l,h) = Wgs2Tky._xyz2llh(x,y,z,A_,E2_)
39
-
40
- lat[0..2]=Wgs2Tky._deg2gdms(b)
41
- lon[0..2]=Wgs2Tky._deg2gdms(l)
42
- end
43
-
44
- private
45
-
46
- include Math
47
- extend Math
48
-
49
- def Wgs2Tky._llh2xyz(b,l,h,a,e2)
50
-
51
- b *= Rd
52
- l *= Rd
53
-
54
- sb = sin(b)
55
- cb = cos(b)
56
-
57
- rn = a / Math.sqrt(1-e2*sb*sb)
58
-
59
- x = (rn+h)*cb*cos(l)
60
- y = (rn+h)*cb*sin(l)
61
- z = (rn*(1-e2)+h) * sb
62
-
63
- return x,y,z
64
- end
65
-
66
- def Wgs2Tky._xyz2llh(x,y,z,a,e2)
67
-
68
- bda = sqrt(1-e2)
69
-
70
- po = sqrt(x*x+y*y)
71
- t = atan2(z,po*bda)
72
- st = sin(t)
73
- ct = cos(t)
74
- b = atan2(z+e2*a/bda*st*st*st,po-e2*a*ct*ct*ct)
75
- l = atan2(y,x)
76
-
77
- sb = sin(b)
78
- rn = a / sqrt(1-e2*sb*sb)
79
- h = po / cos(b) - rn
80
-
81
- return b/Rd,l/Rd,h
82
- end
83
-
84
- def Wgs2Tky._deg2gdms(deg)
85
- sf = deg*3600
86
- s = sf.to_i%60
87
- m = (sf/60).to_i%60
88
- d = (sf/3600).to_i
89
- s += sf - sf.to_i
90
- return d,m,s
91
- end
92
- end
93
-
1
+ #
2
+ # wgs2tky.rb
3
+ # -- GPS data converter
4
+ #
5
+ # kp<kp@mmho.no-ip.org>
6
+ # Destributed under the GPL
7
+
8
+ class Wgs2Tky
9
+
10
+ Pi = Math::PI
11
+ Rd = Pi/180
12
+
13
+ # WGS84
14
+ A = 6378137.0 # 赤道半径
15
+ F = 1/298.257223563 # 扁平率
16
+ E2 = F*2 - F*F # 第一離心率
17
+
18
+ # Tokyo
19
+ A_ = 6378137.0 - 739.845 # 6377397.155
20
+ F_ = 1/298.257223563 - 0.000010037483
21
+ # 1 / 299.152813
22
+ E2_ = F_*2 - F_*F_
23
+
24
+ Dx = +128
25
+ Dy = -481
26
+ Dz = -664
27
+
28
+ def Wgs2Tky.conv!(lat,lon,h = 0)
29
+ b = lat[0].to_f + lat[1].to_f/60 + lat[2].to_f/3600
30
+ l = lon[0].to_f + lon[1].to_f/60 + lon[2].to_f/3600
31
+
32
+ (x,y,z) = Wgs2Tky._llh2xyz(b,l,h,A,E2)
33
+
34
+ x+=Dx
35
+ y+=Dy
36
+ z+=Dz
37
+
38
+ (b,l,h) = Wgs2Tky._xyz2llh(x,y,z,A_,E2_)
39
+
40
+ lat[0..2]=Wgs2Tky._deg2gdms(b)
41
+ lon[0..2]=Wgs2Tky._deg2gdms(l)
42
+ end
43
+
44
+ private
45
+
46
+ include Math
47
+ extend Math
48
+
49
+ def Wgs2Tky._llh2xyz(b,l,h,a,e2)
50
+
51
+ b *= Rd
52
+ l *= Rd
53
+
54
+ sb = sin(b)
55
+ cb = cos(b)
56
+
57
+ rn = a / Math.sqrt(1-e2*sb*sb)
58
+
59
+ x = (rn+h)*cb*cos(l)
60
+ y = (rn+h)*cb*sin(l)
61
+ z = (rn*(1-e2)+h) * sb
62
+
63
+ return x,y,z
64
+ end
65
+
66
+ def Wgs2Tky._xyz2llh(x,y,z,a,e2)
67
+
68
+ bda = sqrt(1-e2)
69
+
70
+ po = sqrt(x*x+y*y)
71
+ t = atan2(z,po*bda)
72
+ st = sin(t)
73
+ ct = cos(t)
74
+ b = atan2(z+e2*a/bda*st*st*st,po-e2*a*ct*ct*ct)
75
+ l = atan2(y,x)
76
+
77
+ sb = sin(b)
78
+ rn = a / sqrt(1-e2*sb*sb)
79
+ h = po / cos(b) - rn
80
+
81
+ return b/Rd,l/Rd,h
82
+ end
83
+
84
+ def Wgs2Tky._deg2gdms(deg)
85
+ sf = deg*3600
86
+ s = sf.to_i%60
87
+ m = (sf/60).to_i%60
88
+ d = (sf/3600).to_i
89
+ s += sf - sf.to_i
90
+ return d,m,s
91
+ end
92
+ end
93
+