diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-01-28 10:29:05 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-01-28 10:29:05 +0000 |
commit | ac804c2e6a6a4d0734e59d6fcd58933526b1452d (patch) | |
tree | b6ee78ed09ddc50b7dbde06c690177624ae9180b | |
parent | 5b680d16c49428e768eb70c49bc41ec0cdd174b2 (diff) | |
download | sequelpro-ac804c2e6a6a4d0734e59d6fcd58933526b1452d.tar.gz sequelpro-ac804c2e6a6a4d0734e59d6fcd58933526b1452d.tar.bz2 sequelpro-ac804c2e6a6a4d0734e59d6fcd58933526b1452d.zip |
• fixed exception for printing Content table if it contains GEOMETRY data
-rw-r--r-- | Source/SPTableContent.m | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index b136d90a..5243f3ce 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2062,6 +2062,28 @@ [tempRow addObject:NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]; else if([o isKindOfClass:[NSString class]]) [tempRow addObject:[o description]]; + else if([o isKindOfClass:[MCPGeometryData class]]) { + SPGeometryDataView *v = [[SPGeometryDataView alloc] initWithCoordinates:[o coordinates]]; + NSImage *image = [v thumbnailImage]; + NSString *imageStr = @""; + if(image) { + NSString *maxSizeValue = @"WIDTH"; + NSInteger imageWidth = [image size].width; + NSInteger imageHeight = [image size].height; + if(imageHeight > imageWidth) { + maxSizeValue = @"HEIGHT"; + imageWidth = imageHeight; + } + if (imageWidth > 100) imageWidth = 100; + imageStr = [NSString stringWithFormat: + @"<BR><IMG %@='%ld' SRC=\"data:image/auto;base64,%@\">", + maxSizeValue, + (long)imageWidth, + [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01] base64EncodingWithLineLength:0]]; + } + [v release]; + [tempRow addObject:[NSString stringWithFormat:@"%@%@", [o wktString], imageStr]]; + } else { NSImage *image = [[NSImage alloc] initWithData:o]; if (image) { @@ -2476,8 +2498,7 @@ for (i = 0; i < [rowFieldsToSave count]; i++) { if (i) [queryString appendString:@", "]; [queryString appendFormat:@"%@ = %@", - [NSArrayObjectAtIndex(rowFieldsToSave, i) backtickQuotedString], - NSArrayObjectAtIndex(rowValuesToSave, i)]; + [NSArrayObjectAtIndex(rowFieldsToSave, i) backtickQuotedString], NSArrayObjectAtIndex(rowValuesToSave, i)]; } [queryString appendFormat:@" WHERE %@", [self argumentForRow:-2]]; } |