Module: RGeo::Geos::ZMGeometryMethods

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#as_binaryObject


64
65
66
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 64

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

#as_textObject


60
61
62
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 60

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

#boundaryObject


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

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

#buffer(distance_) ⇒ Object


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

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

#contains?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

#convex_hullObject


135
136
137
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 135

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

#crosses?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

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


149
150
151
152
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 149

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


44
45
46
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 44

def dimension
  @zgeometry.dimension
end

#disjoint?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

#distance(rhs) ⇒ Object


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

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

#empty?Boolean

Returns:

  • (Boolean)

68
69
70
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 68

def empty?
  @zgeometry.empty?
end

#encode_with(coder) ⇒ Object

:nodoc:


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

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

#envelopeObject


56
57
58
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 56

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

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

Returns:

  • (Boolean)

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

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

#factoryObject


32
33
34
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 32

def factory
  @factory
end

#geometry_typeObject


48
49
50
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 48

def geometry_type
  @zgeometry.geometry_type
end

#hashObject


28
29
30
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 28

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

#init_with(coder) ⇒ Object

:nodoc:


184
185
186
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 184

def init_with(coder) # :nodoc:
  copy_state_from(coder["factory"].psych_wkt_parser.parse(coder["wkt"]))
end

#initialize(factory, zgeometry, mgeometry) ⇒ Object


14
15
16
17
18
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 14

def initialize(factory, zgeometry, mgeometry)
  @factory = factory
  @zgeometry = zgeometry
  @mgeometry = mgeometry
end

#inspectObject

:nodoc:


20
21
22
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 20

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

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


139
140
141
142
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 139

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)

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

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

#is_empty?Boolean

Returns:

  • (Boolean)

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

def is_empty?
  warn "The is_empty? method is deprecated, please use the empty? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
  empty?
end

#is_simple?Boolean

Returns:

  • (Boolean)

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

def is_simple?
  warn "The is_simple? method is deprecated, please use the simple? counterpart, will be removed in v3" unless ENV["RGEO_SILENCE_DEPRECATION"]
  simple?
end

#m_geometryObject


40
41
42
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 40

def m_geometry
  @mgeometry
end

#marshal_dumpObject

:nodoc:


171
172
173
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 171

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

#marshal_load(data) ⇒ Object

:nodoc:


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

def marshal_load(data)  # :nodoc:
  copy_state_from(data[0].marshal_wkb_parser.parse(data[1]))
end

#overlaps?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

#relate?(rhs, pattern) ⇒ Boolean Also known as: relate

Returns:

  • (Boolean)

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

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)

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

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

#simple?Boolean

Returns:

  • (Boolean)

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

def simple?
  @zgeometry.simple?
end

#sridObject


52
53
54
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 52

def srid
  @factory.srid
end

#sym_difference(rhs) ⇒ Object


154
155
156
157
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 154

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:


24
25
26
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 24

def to_s # :nodoc:
  as_text
end

#touches?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

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


144
145
146
147
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 144

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)

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

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

#z_geometryObject


36
37
38
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 36

def z_geometry
  @zgeometry
end