Sha256: 26afec32a11efc41a12cddcd4c9afd5e54ed14487a4c8ba0f4f8ead1f05aff8f

Contents?: true

Size: 1.43 KB

Versions: 5

Compression:

Stored size: 1.43 KB

Contents

#include "spatial_reference.hpp"

namespace filegdb {

VALUE spatial_reference::_klass = Qnil;

VALUE spatial_reference::klass() {
  return spatial_reference::_klass;
}

spatial_reference::~spatial_reference() {
  if (_spatialReference) {
    delete _spatialReference;
    _spatialReference = NULL;
  }
}

VALUE spatial_reference::get_spatial_reference_text(VALUE self) {
  filegdb::spatial_reference *srs = unwrap(self);

  std::wstring text;

  fgdbError hr = srs->value().GetSpatialReferenceText(text);

  if (FGDB_IS_FAILURE(hr)) {
    FGDB_RAISE_ERROR(hr);
    return Qnil;
  }

  return rb_str_new2(to_char_array(text));
}

VALUE spatial_reference::set_spatial_reference_text(VALUE self, VALUE srs) {
  CHECK_ARGUMENT_STRING(srs);

  filegdb::spatial_reference *reference = unwrap(self);

  fgdbError hr = reference->value().SetSpatialReferenceText(to_wstring(RSTRING_PTR(srs)));

  if (FGDB_IS_FAILURE(hr)) {
    FGDB_RAISE_ERROR(hr);
    return Qnil;
  }

  return Qnil;
}

void spatial_reference::define(VALUE module)
{
  spatial_reference::_klass = rb_define_class_under(module, "SpatialReference", rb_cObject);
  base::define(spatial_reference::_klass, true);
  rb_define_method(spatial_reference::_klass, "get_spatial_reference_text", FGDB_METHOD(spatial_reference::get_spatial_reference_text), 0);
  rb_define_method(spatial_reference::_klass, "set_spatial_reference_text", FGDB_METHOD(spatial_reference::set_spatial_reference_text), 1);
}

}




Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
filegdb-0.0.6 ext/filegdb/spatial_reference.cpp
filegdb-0.0.5 ext/filegdb/spatial_reference.cpp
filegdb-0.0.4 ext/filegdb/spatial_reference.cpp
filegdb-0.0.3 ext/filegdb/spatial_reference.cpp
filegdb-0.0.2 ext/filegdb/spatial_reference.cpp