use of cbit.image.GifParsingException in project vcell by virtualcell.
the class GeomDbDriver method insertBrowseImageDataSQL.
/**
* This method was created in VisualAge.
* @param vcimage cbit.image.VCImage
* @param userid java.lang.String
* @exception java.rmi.RemoteException The exception description.
*/
private void insertBrowseImageDataSQL(Connection con, KeyValue key, KeyValue imageKey, VCImage image) throws SQLException, DataAccessException, ImageException, GifParsingException {
String sql;
sql = "INSERT INTO " + browseImageDataTable.getTableName() + " " + browseImageDataTable.getSQLColumnList() + " VALUES " + browseImageDataTable.getSQLValueList(key, imageKey, dbSyntax);
// System.out.println(sql);
byte[] gifEncodedImage = null;
try {
if (image != null) {
if (image.getNumZ() > 1) {
byte[] sliceBytes = new byte[image.getNumX() * image.getNumY()];
System.arraycopy(image.getPixels(), 0, sliceBytes, 0, sliceBytes.length);
gifEncodedImage = BrowseImage.makeBrowseGIFImage(new VCImageUncompressed(null, sliceBytes, new Extent(1, 1, 1), image.getNumX(), image.getNumY(), 1)).getGifEncodedData();
} else {
gifEncodedImage = BrowseImage.makeBrowseGIFImage(image).getGifEncodedData();
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (gifEncodedImage == null) {
gifEncodedImage = BrowseImage.makeBrowseGIFImage(new VCImageUncompressed(null, new byte[BrowseImage.BROWSE_XSIZE * BrowseImage.BROWSE_YSIZE], new Extent(1, 1, 1), BrowseImage.BROWSE_XSIZE, BrowseImage.BROWSE_YSIZE, 1)).getGifEncodedData();
}
switch(dbSyntax) {
case ORACLE:
{
updateCleanSQL(con, sql);
updateCleanLOB(con, browseImageDataTable.id.toString(), key, browseImageDataTable.tableName, browseImageDataTable.data, gifEncodedImage, dbSyntax);
break;
}
case POSTGRES:
{
updatePreparedCleanSQL(con, sql, gifEncodedImage);
break;
}
default:
{
throw new RuntimeException("unexpected DatabaseSyntax " + dbSyntax);
}
}
}
use of cbit.image.GifParsingException in project vcell by virtualcell.
the class ImageTable method getInfo.
/**
* This method was created in VisualAge.
* @return VCImage
* @param rset ResultSet
* @param log SessionLog
*/
public VersionInfo getInfo(ResultSet rset, Connection con, DatabaseSyntax dbSyntax) throws SQLException, DataAccessException {
GIFImage gifImage = null;
try {
// gifImage = new GIFImage(rset.getBytes(BrowseImageDataTable.table.data.toString()));
byte[] gifData = (byte[]) DbDriver.getLOB(rset, BrowseImageDataTable.table.data, dbSyntax);
gifImage = new GIFImage(gifData);
//
} catch (GifParsingException e) {
throw new DataAccessException("Error Parsing browseImage");
}
java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
int x = rset.getInt(ImageTable.table.numX.toString());
int y = rset.getInt(ImageTable.table.numY.toString());
int z = rset.getInt(ImageTable.table.numZ.toString());
org.vcell.util.ISize size = new org.vcell.util.ISize(x, y, z);
double extentX = rset.getBigDecimal(ExtentTable.table.extentX.toString()).doubleValue();
double extentY = rset.getBigDecimal(ExtentTable.table.extentY.toString()).doubleValue();
double extentZ = rset.getBigDecimal(ExtentTable.table.extentZ.toString()).doubleValue();
org.vcell.util.Extent extent = new org.vcell.util.Extent(extentX, extentY, extentZ);
String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
return new VCImageInfo(version, size, extent, gifImage, VCellSoftwareVersion.fromString(softwareVersion));
}
Aggregations