Module: Geos
- Includes:
- GeomTypes, VersionConstants
- Defined in:
- lib/ffi-geos.rb,
lib/ffi-geos/point.rb,
lib/ffi-geos/tools.rb,
lib/ffi-geos/utils.rb,
lib/ffi-geos/polygon.rb,
lib/ffi-geos/strtree.rb,
lib/ffi-geos/version.rb,
lib/ffi-geos/geometry.rb,
lib/ffi-geos/interrupt.rb,
lib/ffi-geos/wkb_reader.rb,
lib/ffi-geos/wkb_writer.rb,
lib/ffi-geos/wkt_reader.rb,
lib/ffi-geos/wkt_writer.rb,
lib/ffi-geos/line_string.rb,
lib/ffi-geos/linear_ring.rb,
lib/ffi-geos/multi_point.rb,
lib/ffi-geos/buffer_params.rb,
lib/ffi-geos/multi_polygon.rb,
lib/ffi-geos/multi_line_string.rb,
lib/ffi-geos/prepared_geometry.rb,
lib/ffi-geos/coordinate_sequence.rb,
lib/ffi-geos/geometry_collection.rb
Defined Under Namespace
Modules: Constants, FFIGeos, GeomTypes, Interrupt, Tools, Utils, VersionConstants
Classes: BufferParams, CoordinateSequence, Geometry, GeometryCollection, Handle, LineString, LinearRing, MixedSRIDsError, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, PreparedGeometry, STRtree, WkbReader, WkbWriter, WktReader, WktWriter
Constant Summary
collapse
- GEOS_BASE =
File.join(File.dirname(__FILE__), 'ffi-geos')
- DimensionTypes =
enum(:dimension_type, [
:dontcare, -3,
:non_empty, -2,
:empty, -1,
:point, 0,
:curve, 1,
:surface, 2
])
- ByteOrders =
enum(:byte_order, [
:xdr, 0, :ndr, 1 ])
- BufferCapStyles =
enum(:buffer_cap_style, [
:round, 1,
:flat, 2,
:square, 3
])
- BufferJoinStyles =
enum(:buffer_join_style, [
:round, 1,
:mitre, 2,
:bevel, 3
])
- ValidFlags =
enum(:valid_flag, [
:allow_selftouching_ring_forming_hole, 1
])
- RelateBoundaryNodeRules =
enum(:relate_boundary_node_rule, [
:mod2, 1,
:ogc, 1,
:endpoint, 2,
:multivalent_endpoint, 3,
:monovalent_endpoint, 4
])
- GeometryTypes =
enum(:geometry_type, [
:point, 0,
:line_string, 1,
:linear_ring, 2,
:polygon, 3,
:multi_point, 4,
:multi_line_string, 5,
:multi_polygon, 6,
:geometry_collection, 7
])
- VERSION =
"0.3.0"
VersionConstants::GEOS_CAPI_FIRST_INTERFACE, VersionConstants::GEOS_CAPI_LAST_INTERFACE, VersionConstants::GEOS_JTS_PORT
Constants included
from GeomTypes
GeomTypes::GEOS_GEOMETRYCOLLECTION, GeomTypes::GEOS_LINEARRING, GeomTypes::GEOS_LINESTRING, GeomTypes::GEOS_MULTILINESTRING, GeomTypes::GEOS_MULTIPOINT, GeomTypes::GEOS_MULTIPOLYGON, GeomTypes::GEOS_POINT, GeomTypes::GEOS_POLYGON
Class Method Summary
collapse
Class Method Details
.current_handle ⇒ Object
1039
1040
1041
1042
|
# File 'lib/ffi-geos.rb', line 1039
def current_handle
Thread.current[:ffi_geos_handle] ||= Geos::Handle.new
Thread.current[:ffi_geos_handle].ptr
end
|
.jts_port ⇒ Object
1035
1036
1037
|
# File 'lib/ffi-geos.rb', line 1035
def jts_port
@jts_port ||= FFIGeos.GEOSjtsport
end
|
.srid_copy_policy ⇒ Object
1044
1045
1046
|
# File 'lib/ffi-geos.rb', line 1044
def srid_copy_policy
Thread.current[:ffi_geos_srid_copy_policy] ||= srid_copy_policy_default
end
|
.srid_copy_policy=(policy) ⇒ Object
Sets the SRID copying behaviour. This value can be one of the values found in Geos::Constants::SRID_COPY_POLICIES and are local to the current thread. A special value of :default
can also be used, which will use a global default that can be set with srid_copy_policy_default=. Setting this value will cause all future threads to use this global default rather than the true default value which is set to :zero
for the sake of backwards compatibility with
The available values for policy
are:
-
:default
- use the value set with srid_copy_policy_default=, which itself is :zero
.
-
:zero
- set all SRIDs to 0. The only exception to this is when cloning a Geometry, in which the SRID is always copied as per the previous behaviour.
-
:lenient
- when copying SRIDs, use the SRID of the object that the operation is being performed on, even if operation involves multiple Geometry objects that may have different SRIDs.
-
:strict
- when copying SRIDs, raise a Geos::MixedSRIDsError exception if an operation is performed on mixed SRIDs. This setting
1068
1069
1070
1071
1072
1073
1074
1075
1076
|
# File 'lib/ffi-geos.rb', line 1068
def srid_copy_policy=(policy)
if policy == :default
Thread.current[:ffi_geos_srid_copy_policy] = srid_copy_policy_default
elsif Geos::Constants::SRID_COPY_POLICIES.include?(policy)
Thread.current[:ffi_geos_srid_copy_policy] = policy
else
raise ArgumentError.new("Invalid SRID policy #{policy} (must be one of #{Geos::Constants::SRID_COPY_POLICIES})")
end
end
|
.srid_copy_policy_default ⇒ Object
1078
1079
1080
|
# File 'lib/ffi-geos.rb', line 1078
def srid_copy_policy_default
@srid_copy_policy_default ||= :zero
end
|
.srid_copy_policy_default=(policy) ⇒ Object
1082
1083
1084
1085
1086
1087
1088
1089
1090
|
# File 'lib/ffi-geos.rb', line 1082
def srid_copy_policy_default=(policy)
if policy == :default
@srid_copy_policy_default = :zero
elsif Geos::Constants::SRID_COPY_POLICIES.include?(policy)
@srid_copy_policy_default = policy
else
raise ArgumentError.new("Invalid SRID policy #{policy} (must be one of #{Geos::Constants::SRID_COPY_POLICIES})")
end
end
|
.version ⇒ Object
1031
1032
1033
|
# File 'lib/ffi-geos.rb', line 1031
def version
@version ||= FFIGeos.GEOSversion
end
|