sogoumap2pdf 0.0.1 → 0.0.2
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/History.txt +4 -0
- data/Manifest.txt +1 -0
- data/README.txt +7 -1
- data/bin/sogoumap2pdf +10 -3
- data/example/gz.pdf +0 -0
- data/lib/sogoumap2pdf/image_to_pdf.rb +10 -14
- data/lib/sogoumap2pdf/sogou_map_image.rb +0 -3
- data/lib/sogoumap2pdf/version.rb +1 -1
- metadata +2 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -13,7 +13,13 @@
|
|
13
13
|
|
14
14
|
== SYNOPSIS:
|
15
15
|
|
16
|
-
sogoumap2pdf link
|
16
|
+
sogoumap2pdf link map_widthxmap_height rowxcolumn save_file_name mode
|
17
|
+
for example:
|
18
|
+
sogoumap2pdf http://hbpic1.go2map.com/seamless/0/180/711/252/52/50449_10516.JPG 1024x768 5x5 gz.pdf sp
|
19
|
+
mode description:
|
20
|
+
sp: both satellite and path
|
21
|
+
s: only satellite
|
22
|
+
m: only map
|
17
23
|
|
18
24
|
== REQUIREMENTS:
|
19
25
|
|
data/bin/sogoumap2pdf
CHANGED
@@ -43,10 +43,17 @@ end
|
|
43
43
|
path = OPTIONS[:path]
|
44
44
|
|
45
45
|
# do stuff
|
46
|
-
|
46
|
+
#
|
47
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0 0 30 30 guangzhou.pdf sp
|
48
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0x0 30x30 guangzhou.pdf sp
|
49
|
+
link=ARGV[0]
|
50
|
+
option=ARGV[4]
|
51
|
+
x,y=ARGV[1].split("x")
|
52
|
+
r,c=ARGV[2].split("x")
|
53
|
+
g=SogouMapImage.new(link, option)
|
47
54
|
gmpdf=ImageToPdf.new(".JPG")
|
48
|
-
xres, yres = gmpdf.perfect_fit(
|
55
|
+
xres, yres = gmpdf.perfect_fit(x.to_i,y.to_i,r.to_i,c.to_i)
|
49
56
|
g.fill_map(xres,yres)
|
50
57
|
gmpdf.front_page(g)
|
51
58
|
gmpdf.create_pages(g)
|
52
|
-
gmpdf.save
|
59
|
+
gmpdf.save(ARGV[3])
|
data/example/gz.pdf
ADDED
Binary file
|
@@ -30,10 +30,10 @@ module Sogoumap2pdf
|
|
30
30
|
nyn=(y+h)/256+1
|
31
31
|
delta_x=x-nx0*256
|
32
32
|
delta_y=y-ny0*256
|
33
|
-
p "x #{x}"
|
34
|
-
p "y #{y}"
|
35
|
-
p "delta_x #{delta_x}"
|
36
|
-
p "delta_y #{delta_y}"
|
33
|
+
# p "x #{x}"
|
34
|
+
# p "y #{y}"
|
35
|
+
# p "delta_x #{delta_x}"
|
36
|
+
# p "delta_y #{delta_y}"
|
37
37
|
ci=ImageList.new # image list to hold results
|
38
38
|
page=Rectangle.new( 0, 0, 0, 0)
|
39
39
|
|
@@ -71,18 +71,15 @@ module Sogoumap2pdf
|
|
71
71
|
return resimg.crop(SouthWestGravity,delta_x,delta_y,w,h,true)
|
72
72
|
end
|
73
73
|
|
74
|
-
def perfect_fit(
|
74
|
+
def perfect_fit(w,h,r,c)
|
75
|
+
@page_width=w
|
76
|
+
@page_height=h
|
75
77
|
@row=r
|
76
78
|
@column=c
|
77
79
|
@tumb_x=@page_width*256/(c*@page_width-(c-1)*@page_overlap)
|
78
80
|
@tumb_y=@page_height*256/(r*@page_height-(r-1)*@page_overlap)
|
79
81
|
@big_img_width,@big_img_height=c*@page_width-(c-1)*@page_overlap, r*@page_height-(r-1)*@page_overlap
|
80
|
-
|
81
|
-
if nh256==0 then
|
82
|
-
return c*@page_width-(c-1)*@page_overlap, r*@page_height-(r-1)*@page_overlap
|
83
|
-
else
|
84
|
-
return c*nw256*256, r*nh256*256
|
85
|
-
end
|
82
|
+
return c*@page_width-(c-1)*@page_overlap, r*@page_height-(r-1)*@page_overlap
|
86
83
|
end
|
87
84
|
def create_pages(g)
|
88
85
|
# get the size of the image
|
@@ -218,9 +215,8 @@ module Sogoumap2pdf
|
|
218
215
|
end
|
219
216
|
end
|
220
217
|
end
|
221
|
-
def save()
|
222
|
-
|
223
|
-
@pdf.save_as(ARGV[5])
|
218
|
+
def save(save_file)
|
219
|
+
@pdf.save_as(save_file)
|
224
220
|
end
|
225
221
|
end
|
226
222
|
end
|
data/lib/sogoumap2pdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sogoumap2pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Ruan
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- bin/sogoumap2pdf
|
47
47
|
- config/hoe.rb
|
48
48
|
- config/requirements.rb
|
49
|
+
- example/gz.pdf
|
49
50
|
- lib/sogoumap2pdf.rb
|
50
51
|
- lib/sogoumap2pdf/version.rb
|
51
52
|
- lib/sogoumap2pdf/image_to_pdf.rb
|