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 CHANGED
@@ -2,3 +2,7 @@
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
5
+ == 0.0.2 2008-08-19
6
+
7
+ * 1 major enhancement:
8
+ * Import example
data/Manifest.txt CHANGED
@@ -7,6 +7,7 @@ Rakefile
7
7
  bin/sogoumap2pdf
8
8
  config/hoe.rb
9
9
  config/requirements.rb
10
+ example/gz.pdf
10
11
  lib/sogoumap2pdf.rb
11
12
  lib/sogoumap2pdf/version.rb
12
13
  lib/sogoumap2pdf/image_to_pdf.rb
data/README.txt CHANGED
@@ -13,7 +13,13 @@
13
13
 
14
14
  == SYNOPSIS:
15
15
 
16
- sogoumap2pdf link map_width map_height row column save_file_name mode
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
- g=SogouMapImage.new(ARGV[0], ARGV[6])
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(ARGV[1].to_i,ARGV[2].to_i,ARGV[3].to_i,ARGV[4].to_i)
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(nh256,nw256,r,c)
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
- #@pdf.save_as("map4eeepc.pdf")
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
@@ -126,9 +126,6 @@ module Sogoumap2pdf
126
126
  @npy=npy=ry/@patch_size_y+1
127
127
  @spacex=spacex=npx*@patch_size_x-rx
128
128
  @spacey=spacey=npy*@patch_size_y-ry
129
- p "npx,npy"
130
- p @npx
131
- p @npy
132
129
  # starting patch
133
130
  @spx=spx=-(npx/2)
134
131
  @spy=spy=-(npy/2)
@@ -2,7 +2,7 @@ module Sogoumap2pdf
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.1
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