diff options
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m')
-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); |