ext/geos_c_impl/factory.h in rgeo-0.3.3 vs ext/geos_c_impl/factory.h in rgeo-0.3.4
- old
+ new
@@ -1,27 +1,27 @@
/*
-----------------------------------------------------------------------------
-
+
Factory and utility functions for GEOS wrapper
-
+
-----------------------------------------------------------------------------
- Copyright 2010 Daniel Azuma
-
+ Copyright 2010-2012 Daniel Azuma
+
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder, nor the names of any other
contributors to this software, may be used to endorse or promote products
derived from this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
@@ -44,12 +44,13 @@
RGEO_BEGIN_C
/*
Per-interpreter globals.
- Most of these are cached references to commonly used classes and modules
- so we don't have to do a lot of constant lookups.
+ Most of these are cached references to commonly used classes, modules,
+ and symbols so we don't have to do a lot of constant lookups and calls
+ to rb_intern.
*/
typedef struct {
VALUE feature_module;
VALUE global_mixins;
VALUE feature_geometry;
@@ -71,10 +72,15 @@
VALUE geos_polygon;
VALUE geos_geometry_collection;
VALUE geos_multi_point;
VALUE geos_multi_line_string;
VALUE geos_multi_polygon;
+ ID id_cast;
+ ID id_eql;
+ ID id_generate;
+ VALUE sym_force_new;
+ VALUE sym_keep_subtype;
} RGeo_Globals;
/*
Wrapped structure for Factory objects.
@@ -107,19 +113,19 @@
/*
Wrapped structure for Geometry objects.
Includes a handle to the underlying GEOS geometry itself (which could
be null for an uninitialized geometry).
It also provides a handle to the factory that created this geometry.
-
+
The klasses object is used by geometry collections. Its value is
generally an array of the ruby classes for the colletion's elements,
so that we can reproduce the exact class for those elements in cases
where the class cannot be inferred directly from the GEOS type (as
in Line objects, which have no GEOS type). Any array element, or the
array itself, could be Qnil, indicating fall back to the default
inferred from the GEOS type.
-
+
The GEOS context handle is also included here. Ideally, it would be
available by following the factory reference and getting it from the
factory data. However, one use case is in the destroy_geometry_func
in factory.c, and Rubinius 1.1.1 seems to crash when you try to
evaluate a DATA_PTR from that function, so we copy the context handle
@@ -183,10 +189,10 @@
it is not already of it. You may also optionally cast it to a type,
specified by an appropriate feature module. Passing Qnil for the type
disables this auto-cast. The returned GEOS geometry is owned by the
caller-- that is, if the original ruby object is already of the desired
factory, the returned GEOS geometry is a clone of the original.
-
+
If the klasses parameter is not NULL, its referent is set to the
klasses saved in the original ruby Geometry object (if any), or else to
the class of the converted GEOS object. This is so that you can use the
result of this function to build a GEOS-backed clone of the original
geometry, or to include the given geometry in a collection while keeping