diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-01-09 22:55:18 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-01-09 22:55:18 +0000 |
commit | e395b5d52a5d54de62ad9bf8cef2535307a00df1 (patch) | |
tree | 10f43875d6e72ff6df7c5d50661499b21fa9b6ac | |
parent | 903e0be357aacd86d7f27b73cd343e8fc8828b88 (diff) | |
download | sequelpro-e395b5d52a5d54de62ad9bf8cef2535307a00df1.tar.gz sequelpro-e395b5d52a5d54de62ad9bf8cef2535307a00df1.tar.bz2 sequelpro-e395b5d52a5d54de62ad9bf8cef2535307a00df1.zip |
• fixed SP's internal spatial wkt calculation for large amount of data points
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m index aafdba0e..7c2bce60 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m @@ -103,11 +103,11 @@ - (NSString*)wktString { char byteOrder; - UInt32 geoType, srid, numberOfItems, numberOfSubItems, numberOfSubSubItems, numberOfCollectionItems; + uint32_t geoType, srid, numberOfItems, numberOfSubItems, numberOfSubSubItems, numberOfCollectionItems; st_point_2d aPoint; - NSUInteger i, j, k, n; // Loop counter for numberOf...Items - NSUInteger ptr = BUFFER_START; // pointer to geoBuffer while parsing + uint32_t i, j, k, n; // Loop counter for numberOf...Items + uint32_t ptr = BUFFER_START; // pointer to geoBuffer while parsing NSMutableString *wkt = [NSMutableString string]; @@ -135,7 +135,7 @@ case wkb_linestring: [wkt setString:@"LINESTRING("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -148,10 +148,10 @@ case wkb_polygon: [wkt setString:@"POLYGON("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(j=0; j < numberOfSubItems; j++) { @@ -167,7 +167,7 @@ case wkb_multipoint: [wkt setString:@"MULTIPOINT("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -180,10 +180,10 @@ case wkb_multilinestring: [wkt setString:@"MULTILINESTRING("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(j=0; j < numberOfSubItems; j++) { @@ -200,14 +200,14 @@ case wkb_multipolygon: [wkt setString:@"MULTIPOLYGON("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(j=0; j < numberOfSubItems; j++) { - numberOfSubSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(k=0; k < numberOfSubSubItems; k++) { @@ -250,7 +250,7 @@ case wkb_linestring: [wkt appendString:@"LINESTRING("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -262,10 +262,10 @@ case wkb_polygon: [wkt appendString:@"POLYGON("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(j=0; j < numberOfSubItems; j++) { @@ -280,7 +280,7 @@ case wkb_multipoint: [wkt appendString:@"MULTIPOINT("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -293,10 +293,10 @@ case wkb_multilinestring: [wkt appendString:@"MULTILINESTRING("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(j=0; j < numberOfSubItems; j++) { @@ -313,14 +313,14 @@ case wkb_multipolygon: [wkt appendString:@"MULTIPOLYGON("]; - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(j=0; j < numberOfSubItems; j++) { - numberOfSubSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; [wkt appendString:@"("]; for(k=0; k < numberOfSubSubItems; k++) { @@ -368,10 +368,10 @@ NSUInteger i, j, k, n; // Loop counter for numberOf...Items NSUInteger ptr = BUFFER_START; // pointer to geoBuffer while parsing - double x_min = 1e999; - double x_max = -1e999; - double y_min = 1e999; - double y_max = -1e999; + double x_min = 1e998; + double x_max = -1e998; + double y_min = 1e998; + double y_max = -1e998; NSMutableArray *coordinates = [NSMutableArray array]; NSMutableArray *subcoordinates = [NSMutableArray array]; @@ -419,7 +419,7 @@ break; case wkb_linestring: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -443,10 +443,10 @@ break; case wkb_polygon: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(j=0; j < numberOfSubItems; j++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -474,7 +474,7 @@ break; case wkb_multipoint: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -499,10 +499,10 @@ break; case wkb_multilinestring: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(j=0; j < numberOfSubItems; j++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -531,13 +531,13 @@ break; case wkb_multipolygon: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(j=0; j < numberOfSubItems; j++) { - numberOfSubSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(k=0; k < numberOfSubSubItems; k++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -594,7 +594,7 @@ break; case wkb_linestring: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -610,10 +610,10 @@ break; case wkb_polygon: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(j=0; j < numberOfSubItems; j++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -630,7 +630,7 @@ break; case wkb_multipoint: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -645,10 +645,10 @@ break; case wkb_multilinestring: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(j=0; j < numberOfSubItems; j++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); @@ -667,13 +667,13 @@ break; case wkb_multipolygon: - numberOfItems = geoBuffer[ptr]; + memcpy(&numberOfItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32+WKB_HEADER_SIZE; for(i=0; i < numberOfItems; i++) { - numberOfSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(j=0; j < numberOfSubItems; j++) { - numberOfSubSubItems = geoBuffer[ptr]; + memcpy(&numberOfSubSubItems, &geoBuffer[ptr], SIZEOF_STORED_UINT32); ptr += SIZEOF_STORED_UINT32; for(k=0; k < numberOfSubSubItems; k++) { memcpy(&aPoint, &geoBuffer[ptr], POINT_DATA_SIZE); |