Class: Graster::GmaskFile

Inherits:
File
  • Object
show all
Defined in:
lib/graster/gmask_file.rb

Instance Method Summary collapse

Instance Method Details

#begin_row(forward) ⇒ Object



7
8
9
# File 'lib/graster/gmask_file.rb', line 7

def begin_row forward
  @begin_row = true
end

#preambleObject



3
4
5
# File 'lib/graster/gmask_file.rb', line 3

def preamble
  self << "1 0 0 0\n"
end

#span(forward, x1, x2) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/graster/gmask_file.rb', line 11

def span forward, x1, x2
  if forward
    self << "0 0 0 %0.3f\n" % x1 if @begin_row
    self << "0 0 1 %0.3f\n" % x1
    self << "0 1 1 %0.3f\n" % x2
  else
    self << "0 0 1 %0.3f\n" % x1 if @begin_row
    self << "0 0 0 %0.3f\n" % x1
    self << "0 1 0 %0.3f\n" % x2
  end
  @begin_row = false
end