Skip to content

Commit

Permalink
Merge branch 'initMethods'
Browse files Browse the repository at this point in the history
  • Loading branch information
mweisman committed Sep 1, 2010
2 parents faf2056 + 5fae0ea commit 8844143
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 82 deletions.
2 changes: 2 additions & 0 deletions Demo App/ShapeKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ShapeKit_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = "$(HOME)/$(SDK_DIR)/include";
INFOPLIST_FILE = "ShapeKit-Info.plist";
LIBRARY_SEARCH_PATHS = "$(HOME)/$(SDK_DIR)/lib";
Expand All @@ -246,6 +247,7 @@
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ShapeKit_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = "$(HOME)/$(SDK_DIR)/include";
INFOPLIST_FILE = "ShapeKit-Info.plist";
LIBRARY_SEARCH_PATHS = "$(HOME)/$(SDK_DIR)/lib";
Expand Down
18 changes: 9 additions & 9 deletions ShapeKit/ShapeKitGeometry+Predicates.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,48 @@
@implementation ShapeKitGeometry (predicates)

-(BOOL)isDisjointFromGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL disjoint = GEOSDisjoint(geosGeom, compareGeometry.geosGeom);
BOOL disjoint = GEOSDisjoint_r(handle, geosGeom, compareGeometry.geosGeom);
return disjoint;
}

-(BOOL)touchesGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL touches = GEOSTouches(geosGeom, compareGeometry.geosGeom);
BOOL touches = GEOSTouches_r(handle, geosGeom, compareGeometry.geosGeom);
return touches;
}

-(BOOL)intersectsGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL intersects = GEOSIntersects(geosGeom, compareGeometry.geosGeom);
BOOL intersects = GEOSIntersects_r(handle, geosGeom, compareGeometry.geosGeom);
return intersects;
}

-(BOOL)crossesGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL crosses = GEOSCrosses(geosGeom, compareGeometry.geosGeom);
BOOL crosses = GEOSCrosses_r(handle, geosGeom, compareGeometry.geosGeom);
return crosses;
}

-(BOOL)isWithinGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL within = GEOSWithin(geosGeom, compareGeometry.geosGeom);
BOOL within = GEOSWithin_r(handle, geosGeom, compareGeometry.geosGeom);
return within;
}

-(BOOL)containsGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL contains = GEOSContains(geosGeom, compareGeometry.geosGeom);
BOOL contains = GEOSContains_r(handle, geosGeom, compareGeometry.geosGeom);
return contains;
}

-(BOOL)overlapsGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL overlaps = GEOSOverlaps(geosGeom, compareGeometry.geosGeom);
BOOL overlaps = GEOSOverlaps_r(handle, geosGeom, compareGeometry.geosGeom);
return overlaps;
}

-(BOOL)isEqualToGeometry:(ShapeKitGeometry *)compareGeometry {
BOOL equals = GEOSEquals(geosGeom, compareGeometry.geosGeom);
BOOL equals = GEOSEquals_r(handle, geosGeom, compareGeometry.geosGeom);
return equals;
}


-(BOOL)isRelatedToGeometry:(ShapeKitGeometry *)compareGeometry WithRelatePattern:(NSString *)pattern {
BOOL patt_success = GEOSRelatePattern(geosGeom, compareGeometry.geosGeom, [pattern UTF8String]);
BOOL patt_success = GEOSRelatePattern_r(handle, geosGeom, compareGeometry.geosGeom, [pattern UTF8String]);
return patt_success;
}

Expand Down
14 changes: 7 additions & 7 deletions ShapeKit/ShapeKitGeometry+Topology.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
//
#import "ShapeKitGeometry+Topology.h"


@implementation ShapeKitGeometry (Topology)

-(ShapeKitPolygon *)envelope {
return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSEnvelope(geosGeom)] autorelease];
// return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSEnvelope_r(handle, geosGeom) GEOSContextHandle:ghandle] autorelease];
return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSEnvelope_r(handle, geosGeom)] autorelease];
}

-(ShapeKitPolygon *)bufferWithWidth:(double)width {
return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSBuffer(geosGeom, width, 0)] autorelease];
return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSBuffer_r(handle, geosGeom, width, 0)] autorelease];
}

-(ShapeKitPolygon *)convexHull {
return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSConvexHull(geosGeom)] autorelease];
return [[[ShapeKitPolygon alloc] initWithGeosGeometry:GEOSConvexHull_r(handle, geosGeom)] autorelease];
}

-(NSString *)relationshipWithGeometry:(ShapeKitGeometry *)geometry {
return [NSString stringWithUTF8String:GEOSRelate(geosGeom, geometry.geosGeom)];
return [NSString stringWithUTF8String:GEOSRelate_r(handle, geosGeom, geometry.geosGeom)];
}

-(ShapeKitPoint *)centroid {
return [[[ShapeKitPoint alloc] initWithGeosGeometry:GEOSGetCentroid(geosGeom)] autorelease];
return [[[ShapeKitPoint alloc] initWithGeosGeometry:GEOSGetCentroid_r(handle, geosGeom)] autorelease];
}

-(ShapeKitPoint *)pointOnSurface {
return [[[ShapeKitPoint alloc] initWithGeosGeometry:GEOSPointOnSurface(geosGeom)] autorelease];
return [[[ShapeKitPoint alloc] initWithGeosGeometry:GEOSPointOnSurface_r(handle, geosGeom)] autorelease];
}

@end
1 change: 1 addition & 0 deletions ShapeKit/ShapeKitGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
NSString *wktGeom;
NSString *geomType;
GEOSGeometry *geosGeom;
GEOSContextHandle_t handle;
}

@property (nonatomic,retain) NSString *wktGeom;
Expand Down
Loading

0 comments on commit 8844143

Please sign in to comment.