tdiary-contrib 4.0.4 → 4.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Gemfile +2 -8
- data/Gemfile.lock +17 -21
- data/README.en.md +1 -1
- data/filter/commentsize.rb +1 -1
- data/filter/iplookup.rb +55 -55
- data/filter/plugin/commentsize.rb +1 -1
- data/filter/plugin/en/spambayes.rb +1 -1
- data/filter/plugin/iplookup.rb +39 -39
- data/filter/plugin/ja/antirefspam.rb +1 -1
- data/filter/plugin/ja/spambayes.rb +1 -1
- data/filter/plugin/spambayes.rb +1 -1
- data/filter/spambayes.rb +1 -1
- data/js/flickr.js +1 -1
- data/lib/bayes.rb +1 -1
- data/lib/bayes/convert.rb +1 -1
- data/lib/tdiary/contrib/version.rb +1 -1
- data/lib/wgs2tky.rb +93 -93
- data/plugin/appstore.rb +6 -6
- data/plugin/bigpresen.rb +3 -3
- data/plugin/bitly.rb +1 -1
- data/plugin/brow_si.rb +1 -1
- data/plugin/category_similar.rb +1 -1
- data/plugin/category_to_tagcloud.rb +2 -2
- data/plugin/coderay.rb +1 -1
- data/plugin/datepicker.rb +1 -1
- data/plugin/flickr.rb +2 -2
- data/plugin/git-register.rb +7 -7
- data/plugin/goo_gl.rb +7 -7
- data/plugin/google_map.rb +6 -6
- data/plugin/google_webmaster.rb +4 -4
- data/plugin/hb_footer.rb +5 -5
- data/plugin/hb_footer4sec.rb +5 -5
- data/plugin/hide_sidebar_iphone.rb +1 -1
- data/plugin/iddy.rb +1 -1
- data/plugin/image_ex.rb +17 -17
- data/plugin/image_gps.rb +3 -3
- data/plugin/inline_wiki.rb +6 -6
- data/plugin/instagr.rb +8 -8
- data/plugin/instagram.rb +1 -1
- data/plugin/ja/yo_update.rb +51 -0
- data/plugin/jquery_ui_theme.rb +8 -8
- data/plugin/jroku.rb +1 -1
- data/plugin/jyear.rb +2 -2
- data/plugin/makerss_category.rb +4 -4
- data/plugin/makerss_comment.rb +4 -4
- data/plugin/microsummary.rb +2 -2
- data/plugin/nhk_program_info.rb +2 -2
- data/plugin/picasa.rb +2 -2
- data/plugin/playstore.rb +3 -3
- data/plugin/rating.rb +10 -10
- data/plugin/recent_estraier.rb +7 -7
- data/plugin/search-bing.rb +1 -1
- data/plugin/search-google-custom.rb +1 -1
- data/plugin/search-yahoo-websearch.rb +8 -8
- data/plugin/search-yahoo.rb +1 -1
- data/plugin/section_footer2.rb +1 -1
- data/plugin/show_and_hide.rb +20 -20
- data/plugin/socialbutton.rb +2 -2
- data/plugin/tdiarytimes.rb +16 -16
- data/plugin/tdiarytimes2.rb +10 -10
- data/plugin/tdiarytimes_textstyle.rb +3 -3
- data/plugin/twitter_anywhere.rb +51 -51
- data/plugin/twitter_summary_card.rb +1 -1
- data/plugin/vote.rb +4 -4
- data/plugin/yahoo_kousei.rb +2 -2
- data/plugin/yo_update.rb +214 -0
- data/plugin/zenback.rb +2 -2
- data/spec/apple_webclip_spec.rb +6 -6
- data/util/estraier-search/estraier-register.rb +2 -2
- data/util/image-gallery/image-gallery.rb +8 -8
- data/util/image-gallery/misc/plugin/recent_image.rb +4 -4
- data/util/posttdiary/posttdiary-ex.rb +7 -7
- data/util/rast-search/rast-register.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 152afb1d5cad913952e857a30f345acf38bfd5ee
|
4
|
+
data.tar.gz: 0cf9cf19a1a702f1c8525590f758961f62f3b400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f7694b823e7bab599e8589c7f09fcbe17003aef7c807876578cb78115fcda3e1944fc207b327a8783b6eeb5111f49487d9dc8fd7eb60c4e3a3d416f917f28f4
|
7
|
+
data.tar.gz: 61ae49ef6f1cb722271c4984e0baefaf61eeea0ea9086554560b5e59d490f79893130f11e0a9054a26d0eb17eb8bb1a257084f4827f79bb5dc0ea2339c55996b
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -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.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
rspec-
|
12
|
-
|
13
|
-
rspec-
|
14
|
-
rspec-
|
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 (
|
19
|
-
rspec-mocks (3.0.
|
20
|
-
rspec-support (
|
21
|
-
rspec-support (3.0.
|
22
|
-
simplecov (0.
|
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.
|
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
|
-
|
39
|
-
rspec (~> 3.0.0.beta2)
|
35
|
+
rspec
|
40
36
|
simplecov
|
41
37
|
tdiary (~> 4.0.2)
|
data/README.en.md
CHANGED
data/filter/commentsize.rb
CHANGED
data/filter/iplookup.rb
CHANGED
@@ -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>
|
data/filter/plugin/iplookup.rb
CHANGED
@@ -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
|
data/filter/plugin/spambayes.rb
CHANGED
data/filter/spambayes.rb
CHANGED
data/js/flickr.js
CHANGED
data/lib/bayes.rb
CHANGED
data/lib/bayes/convert.rb
CHANGED
data/lib/wgs2tky.rb
CHANGED
@@ -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
|
+
|