2
* Copyright 2006-2008 The FLWOR Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#include "geo_module.h"
18
#include "geo_functions.h"
20
namespace zorba { namespace geomodule {
22
ItemFactory* GeoModule::theFactory = 0;
25
# define DLL_EXPORT __declspec(dllexport)
27
# define DLL_EXPORT __attribute__ ((visibility("default")))
30
extern "C" DLL_EXPORT zorba::ExternalModule* createModule() {
31
return new zorba::geomodule::GeoModule();
34
GeoModule::~GeoModule()
36
for (FuncMap_t::const_iterator lIter = theFunctions.begin();
37
lIter != theFunctions.end(); ++lIter) {
44
GeoModule::getExternalFunction(const String& aLocalname)
46
ExternalFunction*& lFunc = theFunctions[aLocalname];
51
else if (aLocalname == "dimension") {
52
lFunc = new SFDimensionFunction(this);
54
else if (aLocalname == "coordinate-dimension") {
55
lFunc = new SFCoordinateDimensionFunction(this);
57
else if (aLocalname == "geometry-type") {
58
lFunc = new SFGeometryTypeFunction(this);
60
else if (aLocalname == "srid") {
61
lFunc = new SFSridFunction(this);
63
else if (aLocalname == "num-geometries") {
64
lFunc = new SFNumGeometriesFunction(this);
66
else if (aLocalname == "geometry-n") {
67
lFunc = new SFGeometryNFunction(this);
69
else if (aLocalname == "envelope") {
70
lFunc = new SFEnvelopeFunction(this);
72
else if (aLocalname == "as-text") {
73
lFunc = new SFAsTextFunction(this);
75
else if (aLocalname == "as-binary") {
76
lFunc = new SFAsBinaryFunction(this);
78
else if (aLocalname == "is-empty") {
79
lFunc = new SFIsEmptyFunction(this);
81
else if (aLocalname == "is-simple") {
82
lFunc = new SFIsSimpleFunction(this);
84
else if (aLocalname == "is-3d") {
85
lFunc = new SFIs3DFunction(this);
87
else if (aLocalname == "is-measured") {
88
lFunc = new SFIsMeasuredFunction(this);
90
else if (aLocalname == "boundary") {
91
lFunc = new SFBoundaryFunction(this);
93
else if (aLocalname == "equals") {
94
lFunc = new SFEqualsFunction(this);
96
else if (aLocalname == "covers") {
97
lFunc = new SFCoversFunction(this);
99
else if (aLocalname == "disjoint") {
100
lFunc = new SFDisjointFunction(this);
102
else if (aLocalname == "intersects") {
103
lFunc = new SFIntersectsFunction(this);
105
else if (aLocalname == "touches") {
106
lFunc = new SFTouchesFunction(this);
108
else if (aLocalname == "crosses") {
109
lFunc = new SFCrossesFunction(this);
111
else if (aLocalname == "within") {
112
lFunc = new SFWithinFunction(this);
114
else if (aLocalname == "contains") {
115
lFunc = new SFContainsFunction(this);
117
else if (aLocalname == "overlaps") {
118
lFunc = new SFOverlapsFunction(this);
120
else if (aLocalname == "relate") {
121
lFunc = new SFRelateFunction(this);
123
else if (aLocalname == "distance") {
124
lFunc = new SFDistanceFunction(this);
126
else if (aLocalname == "buffer") {
127
lFunc = new SFBufferFunction(this);
129
else if (aLocalname == "convex-hull") {
130
lFunc = new SFConvexHullFunction(this);
132
else if (aLocalname == "intersection") {
133
lFunc = new SFIntersectionFunction(this);
135
else if (aLocalname == "union") {
136
lFunc = new SFUnionFunction(this);
138
else if (aLocalname == "difference") {
139
lFunc = new SFDifferenceFunction(this);
141
else if (aLocalname == "sym-difference") {
142
lFunc = new SFSymDifferenceFunction(this);
144
else if (aLocalname == "area") {
145
lFunc = new SFAreaFunction(this);
147
else if (aLocalname == "length") {
148
lFunc = new SFLengthFunction(this);
150
else if (aLocalname == "is-within-distance") {
151
lFunc = new SFIsWithinDistanceFunction(this);
153
else if (aLocalname == "centroid") {
154
lFunc = new SFCentroidFunction(this);
156
else if (aLocalname == "point-on-surface") {
157
lFunc = new SFPointOnSurfaceFunction(this);
159
else if (aLocalname == "x") {
160
lFunc = new SFXFunction(this);
162
else if (aLocalname == "y") {
163
lFunc = new SFYFunction(this);
165
else if (aLocalname == "z") {
166
lFunc = new SFZFunction(this);
168
else if (aLocalname == "m") {
169
lFunc = new SFMFunction(this);
171
else if (aLocalname == "start-point") {
172
lFunc = new SFStartPointFunction(this);
174
else if (aLocalname == "end-point") {
175
lFunc = new SFEndPointFunction(this);
177
else if (aLocalname == "is-closed") {
178
lFunc = new SFIsClosedFunction(this);
180
else if (aLocalname == "is-ring") {
181
lFunc = new SFIsRingFunction(this);
183
else if (aLocalname == "num-points") {
184
lFunc = new SFNumPointsFunction(this);
186
else if (aLocalname == "point-n") {
187
lFunc = new SFPointNFunction(this);
189
else if (aLocalname == "exterior-ring") {
190
lFunc = new SFExteriorRingFunction(this);
192
else if (aLocalname == "num-interior-ring") {
193
lFunc = new SFNumInteriorRingFunction(this);
195
else if (aLocalname == "interior-ring-n") {
196
lFunc = new SFInteriorRingNFunction(this);
198
else if (aLocalname == "num-patches") {
199
lFunc = new SFNumPatchesFunction(this);
201
else if (aLocalname == "patch-n") {
202
lFunc = new SFPatchNFunction(this);
204
else if (aLocalname == "bounding-polygons") {
205
lFunc = new SFBoundingPolygonsFunction(this);
214
if (!dynamic_cast<GeoModule*>(this)) {
220
} /* namespace GeoModule */ } /* namespace zorba */