Class: MapFrame

Inherits:
Wx::Frame
  • Object
show all
Defined in:
lib/map_frame.rb

Constant Summary collapse

DEFAULT_CONFIG =
{'width' => 512, 'height' => 512, 'left' => 0, 'top' => 0,
    'map' => {'left_col' => 288, 'top_row' => 155, 'offset_x' => 0, 'offset_y' => 0, 
'zoom' => 9, 'show_cov' => true, 'cov_zoom' => 10} }

Instance Method Summary collapse

Constructor Details

#initializeMapFrame

Returns a new instance of MapFrame.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/map_frame.rb', line 9

def initialize
  config = load_config
  super(nil, :title => "mapcache",
        :pos => [config['left'], config['top']],
        :size => [config['width'], config['height']] )

  @status = Wx::StatusBar.new(self)
  @status.fields_count = 3
  @status.set_status_text("press F1 for help", 2)
  self.status_bar = @status

  box = Wx::HBoxSizer.new
  @panel = MapPanel.new(self, config['map'])
  box.add(@panel, 1, Wx::EXPAND)
  self.sizer = box

  evt_close do |event| 
    save_config
    destroy
  end

  show
end

Instance Method Details

#set_coverage_zoom(value) ⇒ Object



37
38
39
40
# File 'lib/map_frame.rb', line 37

def set_coverage_zoom(value)
  text = value ? "coverage: #{value}" : ""
  @status.set_status_text(text, 1)
end

#set_zoom(value) ⇒ Object



33
34
35
# File 'lib/map_frame.rb', line 33

def set_zoom(value)
  @status.set_status_text("zoom: #{value}", 0)
end