Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
Use options hash when creating a new page
Browse files Browse the repository at this point in the history
  • Loading branch information
systemed committed Apr 2, 2012
1 parent 0aa8503 commit c4cbd5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/pdf_renderer/map_spec.rb
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pdf_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit c4cbd5d

Please sign in to comment.