~ubuntu-branches/ubuntu/oneiric/ctioga2/oneiric

« back to all changes in this revision

Viewing changes to lib/ctioga2/graphics/styles/legend.rb

  • Committer: Bazaar Package Importer
  • Author(s): Vincent Fourmond
  • Date: 2011-01-24 21:36:06 UTC
  • Revision ID: james.westby@ubuntu.com-20110124213606-9ettx0ugl83z0bzp
Tags: upstream-0.1
ImportĀ upstreamĀ versionĀ 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# legend.rb: style of legends
 
2
# copyright (c) 2009 by Vincent Fourmond
 
3
  
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2 of the License, or
 
7
# (at your option) any later version.
 
8
  
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details (in the COPYING file).
 
13
 
 
14
require 'ctioga2/utils'
 
15
require 'ctioga2/log'
 
16
 
 
17
# This module contains all the classes used by ctioga
 
18
module CTioga2
 
19
 
 
20
  Version::register_svn_info('$Revision: 55 $', '$Date: 2009-05-27 00:01:34 +0200 (Wed, 27 May 2009) $')
 
21
 
 
22
  module Graphics
 
23
 
 
24
    module Styles
 
25
 
 
26
      # Style of a given Legends::LegendStorage object.
 
27
      class LegendStorageStyle < BasicStyle
 
28
 
 
29
        # The distance between two lines, a Types::Dimension object.
 
30
        attr_accessor :dy
 
31
 
 
32
        # The width of the legend pictogram, a Types::Dimension object.
 
33
        attr_accessor :picto_width
 
34
 
 
35
        # The height of the legend pictogram, a Types::Dimension object.
 
36
        attr_accessor :picto_height
 
37
 
 
38
        # The distance between the legend pictogram and the text
 
39
        attr_accessor :picto_to_text
 
40
 
 
41
        # The scale of the legend
 
42
        attr_accessor :scale
 
43
 
 
44
        # The scale of the legend text -- relative to the overall
 
45
        # scale.
 
46
        attr_accessor :text_scale
 
47
 
 
48
        def initialize
 
49
          @dy = Types::Dimension.new(:dy, 1.6, :y)
 
50
 
 
51
          @picto_width = Types::Dimension.new(:dy, 1.6, :x)
 
52
          @picto_height = Types::Dimension.new(:dy, 0.6, :y)
 
53
 
 
54
          @picto_to_text = Types::Dimension.new(:dy, 0.3, :x)
 
55
 
 
56
          @scale = 0.8
 
57
          @text_scale = 0.82
 
58
        end
 
59
      end
 
60
    end
 
61
  end
 
62
end
 
63