Module: RGeo::Geos::ZMGeometryMethods

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#as_binaryObject



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

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

#as_textObject



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

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

#boundaryObject



92
93
94
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 92

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

#buffer(distance_) ⇒ Object



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

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

#contains?(rhs) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#convex_hullObject



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

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

#coordinate_dimensionObject



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

def coordinate_dimension
  4
end

#crosses?(rhs) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 112

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

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



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

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)


100
101
102
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 100

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

#distance(rhs) ⇒ Object



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

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  @zgeometry.empty?
end

#encode_with(coder) ⇒ Object

:nodoc:



191
192
193
194
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 191

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

#envelopeObject



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

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

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

Returns:

  • (Boolean)


96
97
98
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 96

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



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

def geometry_type
  @zgeometry.geometry_type
end

#hashObject



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

def hash
  [@factory, @zgeometry, @mgeometry].hash
end

#init_with(coder) ⇒ Object

:nodoc:



196
197
198
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 196

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: *



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

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)


104
105
106
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 104

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

#is_3d?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 84

def is_3d?
  true
end

#m_geometryObject



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

def m_geometry
  @mgeometry
end

#marshal_dumpObject

:nodoc:



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

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

#marshal_load(data) ⇒ Object

:nodoc:



187
188
189
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 187

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

#measured?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 88

def measured?
  true
end

#overlaps?(rhs) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#relate?(rhs, pattern) ⇒ Boolean

Returns:

  • (Boolean)


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

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)


168
169
170
171
172
173
174
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 168

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)


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

def simple?
  @zgeometry.simple?
end

#spatial_dimensionObject



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

def spatial_dimension
  3
end

#sridObject



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

def srid
  @factory.srid
end

#sym_difference(rhs) ⇒ Object



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

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)


108
109
110
# File 'lib/rgeo/geos/zm_feature_methods.rb', line 108

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

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



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

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)


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

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