Permalink
Browse files

Use options hash when creating a new page

  • Loading branch information...
1 parent 0aa8503 commit c4cbd5d964288513b5535df62d59ec19ce3e3cb3 @systemed committed Apr 2, 2012
Showing with 4 additions and 2 deletions.
  1. +3 −1 lib/pdf_renderer/map_spec.rb
  2. +1 −1 pdf_test.rb
@@ -31,11 +31,13 @@ def init_projection
QuadVector.new(@boxoriginx+@boxwidth, @boxoriginy))
end
- def set_pagesize(size,margin)
+ def set_pagesize(size,options={})
+ margin=options[:margin] ? options[:margin] : 0
@boxheight =size['height']-margin*2
@boxwidth =size['width' ]-margin*2
@boxoriginx=margin
@boxoriginy=margin
+ if (options[:landscape]) then @boxheight,@boxwidth=@boxwidth,@boxheight end
end
def draw(pdf,ruleset,db)
View
@@ -28,7 +28,7 @@
# ----- Create a MapSpec
spec=PDFRenderer::MapSpec.new
- spec.set_pagesize(PDFRenderer::MapSpec::A4, 10)
+ spec.set_pagesize(PDFRenderer::MapSpec::A4, :margin=>10)
spec.minlon=-1.50; spec.minlat=51.86
spec.maxlon=-1.47; spec.maxlat=51.89
spec.minscale=12; spec.maxscale=18; spec.scale=15

0 comments on commit c4cbd5d

Please sign in to comment.