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


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

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

#buffer(distance_) ⇒ Object


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

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

#contains?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

#convex_hullObject


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

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

#crosses?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

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


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

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)

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

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

#distance(rhs) ⇒ Object


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

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

#encode_with(coder) ⇒ Object

:nodoc:


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

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)

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

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:


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

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


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

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)

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

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

#is_empty?Boolean

Returns:

  • (Boolean)

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

def is_empty?
  @zgeometry.is_empty?
end

#is_simple?Boolean

Returns:

  • (Boolean)

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

def is_simple?
  @zgeometry.is_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:


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

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

#marshal_load(data) ⇒ Object

:nodoc:


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

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

#overlaps?(rhs) ⇒ Boolean

Returns:

  • (Boolean)

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

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

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

Returns:

  • (Boolean)

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

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)

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

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


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

def srid
  @factory.srid
end

#sym_difference(rhs) ⇒ Object


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

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)

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

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

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


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

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)

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

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