Module: RGeo::ImplHelper::BasicGeometryMethods

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#_copy_state_from(obj_) ⇒ Object

:nodoc:



39
40
41
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 39

def _copy_state_from(obj_)  # :nodoc:
  @factory = obj_.factory
end

#_set_factory(factory_) ⇒ Object

:nodoc:



23
24
25
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 23

def _set_factory(factory_)  # :nodoc:
  @factory = factory_
end

#_validate_geometryObject

:nodoc:



20
21
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 20

def _validate_geometry # :nodoc:
end

#as_binaryObject



35
36
37
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 35

def as_binary
  @factory._generate_wkb(self)
end

#as_textObject



31
32
33
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 31

def as_text
  @factory._generate_wkt(self)
end

#encode_with(coder_) ⇒ Object

:nodoc:



51
52
53
54
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 51

def encode_with(coder_)  # :nodoc:
  coder_["factory"] = @factory
  coder_["wkt"] = @factory._psych_wkt_generator.generate(self)
end

#factoryObject



27
28
29
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 27

def factory
  @factory
end

#init_with(coder_) ⇒ Object

:nodoc:



56
57
58
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 56

def init_with(coder_) # :nodoc:
  _copy_state_from(coder_["factory"]._psych_wkt_parser.parse(coder_["wkt"]))
end

#inspectObject

:nodoc:



12
13
14
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 12

def inspect # :nodoc:
  "#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
end

#marshal_dumpObject

:nodoc:



43
44
45
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 43

def marshal_dump # :nodoc:
  [@factory, @factory._marshal_wkb_generator.generate(self)]
end

#marshal_load(data_) ⇒ Object

:nodoc:



47
48
49
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 47

def marshal_load(data_)  # :nodoc:
  _copy_state_from(data_[0]._marshal_wkb_parser.parse(data_[1]))
end

#to_sObject

:nodoc:



16
17
18
# File 'lib/rgeo/impl_helper/basic_geometry_methods.rb', line 16

def to_s # :nodoc:
  as_text
end