Class: GMT

Inherits:
Object
  • Object
show all
Defined in:
lib/gmt.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'ext/gmt/gmt.c', line 84

static VALUE gmt_init(VALUE self)
{
  gmt_t *gmt;

  Data_Get_Struct(self, gmt_t, gmt);

  gmt->session =
    GMT_Create_Session("Session name", 2, 0, NULL);

  if (gmt->session == NULL)
    rb_raise(rb_eNoMemError, "failed to create GMT session");

  return self;
}

Class Method Details

.psopt(file, position, options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gmt.rb', line 3

def self.psopt(file, position, options)
  file_options =
    case position
    when :first
      { :K => nil, :> => file }
    when :middle
      { :O => nil, :K => nil, :>> => file }
    when :last
      { :O => nil, :>> => file }
    else
      raise ArguemntError, 'position should be :first, :miidle or :last'
    end
  options.merge(file_options)
end

Instance Method Details

#freeObject



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'ext/gmt/gmt.c', line 99

static VALUE gmt_release(VALUE self)
{
  gmt_t *gmt;

  Data_Get_Struct(self, gmt_t, gmt);

  if (gmt->session)
    {
      GMT_Destroy_Session(gmt->session);
      gmt->session = NULL;
    }

  return self;
}

#makecpt(*args) ⇒ Object



47
48
49
50
# File 'ext/gmt/gmt.c', line 47

static VALUE gmt_makecpt(int argc, VALUE *argv, VALUE self)
{
  return gmt_simple("makecpt", argc, argv, self);
}

#pstext(*args) ⇒ Object



52
53
54
55
# File 'ext/gmt/gmt.c', line 52

static VALUE gmt_pstext(int argc, VALUE *argv, VALUE self)
{
  return gmt_simple("pstext", argc, argv, self);
}

#psxy(*args) ⇒ Object



57
58
59
60
# File 'ext/gmt/gmt.c', line 57

static VALUE gmt_psxy(int argc, VALUE *argv, VALUE self)
{
  return gmt_simple("psxy", argc, argv, self);
}