Module: RGeo::Geos::ZMGeometryMethods

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#_copy_state_from(obj_) ⇒ Object

:nodoc:



159
160
161
162
163
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 159

def _copy_state_from(obj_) # :nodoc:
  @factory = obj_.factory
  @zgeometry = obj_.z_geometry
  @mgeometry = obj_.m_geometry
end

#as_binaryObject



62
63
64
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 62

def as_binary
  @factory.instance_variable_get(:@wkb_generator).generate(self)
end

#as_textObject



58
59
60
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 58

def as_text
  @factory.instance_variable_get(:@wkt_generator).generate(self)
end

#boundaryObject



74
75
76
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 74

def boundary
  @factory._create_feature(nil, @zgeometry.boundary, @mgeometry.boundary)
end

#buffer(distance_) ⇒ Object



119
120
121
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 119

def buffer(distance_)
  @factory._create_feature(nil, @zgeometry.buffer(distance_), @mgeometry.buffer(distance_))
end

#contains?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 102

def contains?(rhs_)
  @zgeometry.contains?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#convex_hullObject



123
124
125
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 123

def convex_hull
  @factory._create_feature(nil, @zgeometry.convex_hull, @mgeometry.convex_hull)
end

#crosses?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 94

def crosses?(rhs_)
  @zgeometry.crosses?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#difference(rhs_) ⇒ Object Also known as: -



137
138
139
140
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 137

def difference(rhs_)
  rhs_ = ::RGeo::Feature.cast(rhs_, self)
  @factory._create_feature(nil, @zgeometry.difference(rhs_.z_geometry), @mgeometry.difference(rhs_.m_geometry))
end

#dimensionObject



42
43
44
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 42

def dimension
  @zgeometry.dimension
end

#disjoint?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 82

def disjoint?(rhs_)
  @zgeometry.disjoint?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#distance(rhs_) ⇒ Object



115
116
117
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 115

def distance(rhs_)
  @zgeometry.distance(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#encode_with(coder_) ⇒ Object

:nodoc:



173
174
175
176
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 173

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

#envelopeObject



54
55
56
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 54

def envelope
  @factory._create_feature(nil, @zgeometry.envelope, @mgeometry.envelope)
end

#equals?(rhs_) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


78
79
80
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 78

def equals?(rhs_)
  @zgeometry.equals?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#factoryObject



30
31
32
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 30

def factory
  @factory
end

#geometry_typeObject



46
47
48
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 46

def geometry_type
  @zgeometry.geometry_type
end

#hashObject



26
27
28
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 26

def hash
  @factory.hash ^ @zgeometry.hash ^ @mgeometry.hash
end

#init_with(coder_) ⇒ Object

:nodoc:



178
179
180
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 178

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

#initialize(factory_, zgeometry_, mgeometry_) ⇒ Object



12
13
14
15
16
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 12

def initialize(factory_, zgeometry_, mgeometry_)
  @factory = factory_
  @zgeometry = zgeometry_
  @mgeometry = mgeometry_
end

#inspectObject

:nodoc:



18
19
20
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 18

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

#intersection(rhs_) ⇒ Object Also known as: *



127
128
129
130
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 127

def intersection(rhs_)
  rhs_ = ::RGeo::Feature.cast(rhs_, self)
  @factory._create_feature(nil, @zgeometry.intersection(rhs_.z_geometry), @mgeometry.intersection(rhs_.m_geometry))
end

#intersects?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 86

def intersects?(rhs_)
  @zgeometry.intersects?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#is_empty?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 66

def is_empty?
  @zgeometry.is_empty?
end

#is_simple?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 70

def is_simple?
  @zgeometry.is_simple?
end

#m_geometryObject



38
39
40
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 38

def m_geometry
  @mgeometry
end

#marshal_dumpObject

:nodoc:



165
166
167
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 165

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

#marshal_load(data_) ⇒ Object

:nodoc:



169
170
171
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 169

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

#overlaps?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 106

def overlaps?(rhs_)
  @zgeometry.overlaps?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#relate?(rhs_, pattern_) ⇒ Boolean Also known as: relate

Returns:

  • (Boolean)


110
111
112
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 110

def relate?(rhs_, pattern_)
  @zgeometry.relate?(::RGeo::Feature.cast(rhs_, self).z_geometry, pattern_)
end

#rep_equals?(rhs_) ⇒ Boolean Also known as: eql?

Returns:

  • (Boolean)


147
148
149
150
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 147

def rep_equals?(rhs_)
  rhs_ = ::RGeo::Feature.cast(rhs_, self)
  rhs_.is_a?(self.class) && @factory.eql?(rhs_.factory) && @zgeometry.rep_equals?(rhs_.z_geometry) && @mgeometry.rep_equals?(rhs_.m_geometry)
end

#sridObject



50
51
52
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 50

def srid
  @factory.srid
end

#sym_difference(rhs_) ⇒ Object



142
143
144
145
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 142

def sym_difference(rhs_)
  rhs_ = ::RGeo::Feature.cast(rhs_, self)
  @factory._create_feature(nil, @zgeometry.sym_difference(rhs_.z_geometry), @mgeometry.sym_difference(rhs_.m_geometry))
end

#to_sObject

:nodoc:



22
23
24
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 22

def to_s # :nodoc:
  as_text
end

#touches?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 90

def touches?(rhs_)
  @zgeometry.touches?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#union(rhs_) ⇒ Object Also known as: +



132
133
134
135
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 132

def union(rhs_)
  rhs_ = ::RGeo::Feature.cast(rhs_, self)
  @factory._create_feature(nil, @zgeometry.union(rhs_.z_geometry), @mgeometry.union(rhs_.m_geometry))
end

#within?(rhs_) ⇒ Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 98

def within?(rhs_)
  @zgeometry.within?(::RGeo::Feature.cast(rhs_, self).z_geometry)
end

#z_geometryObject



34
35
36
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 34

def z_geometry
  @zgeometry
end