Search in sources :

Example 1 with GIFImage

use of cbit.image.GIFImage in project vcell by virtualcell.

the class ClientDocumentManager method saveAsNew.

/**
 * Insert the method's description here.
 * Creation date: (2/5/01 4:58:40 PM)
 */
public VCImage saveAsNew(VCImage vcImage, java.lang.String newName) throws DataAccessException {
    try {
        String vcImageXML = null;
        try {
            vcImageXML = XmlHelper.imageToXML(vcImage);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        String savedVCImageXML = sessionManager.getUserMetaDbServer().saveVCImageAs(new BigString(vcImageXML), newName).toString();
        VCImage savedVCImage = null;
        try {
            savedVCImage = XmlHelper.XMLToImage(savedVCImageXML);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        savedVCImage.refreshDependencies();
        KeyValue savedKey = savedVCImage.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedVCImageXML);
        }
        try {
            ISize size = new ISize(savedVCImage.getNumX(), savedVCImage.getNumY(), savedVCImage.getNumZ());
            GIFImage browseData = BrowseImage.makeBrowseGIFImage(savedVCImage);
            VCImageInfo savedVCImageInfo = new VCImageInfo(savedVCImage.getVersion(), size, savedVCImage.getExtent(), browseData, VCellSoftwareVersion.fromSystemProperty());
            imgInfoHash.put(savedKey, savedVCImageInfo);
            fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedVCImageInfo));
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
        return savedVCImage;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : GIFImage(cbit.image.GIFImage) KeyValue(org.vcell.util.document.KeyValue) ISize(org.vcell.util.ISize) VCImage(cbit.image.VCImage) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException) VCImageInfo(cbit.image.VCImageInfo) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 2 with GIFImage

use of cbit.image.GIFImage 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));
}
Also used : GifParsingException(cbit.image.GifParsingException) GIFImage(cbit.image.GIFImage) VCellSoftwareVersion(org.vcell.util.document.VCellSoftwareVersion) Version(org.vcell.util.document.Version) DataAccessException(org.vcell.util.DataAccessException) VCImageInfo(cbit.image.VCImageInfo)

Example 3 with GIFImage

use of cbit.image.GIFImage in project vcell by virtualcell.

the class ClientDocumentManager method save.

/**
 * Insert the method's description here.
 * Creation date: (2/5/01 4:58:40 PM)
 */
public VCImage save(VCImage vcImage) throws DataAccessException {
    try {
        String vcImageXML = null;
        try {
            vcImageXML = XmlHelper.imageToXML(vcImage);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        String savedVCImageXML = sessionManager.getUserMetaDbServer().saveVCImage(new BigString(vcImageXML)).toString();
        VCImage savedVCImage = null;
        try {
            savedVCImage = XmlHelper.XMLToImage(savedVCImageXML);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        savedVCImage.refreshDependencies();
        KeyValue savedKey = savedVCImage.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedVCImageXML);
        }
        try {
            ISize size = new ISize(savedVCImage.getNumX(), savedVCImage.getNumY(), savedVCImage.getNumZ());
            GIFImage browseData = BrowseImage.makeBrowseGIFImage(savedVCImage);
            VCImageInfo savedVCImageInfo = new VCImageInfo(savedVCImage.getVersion(), size, savedVCImage.getExtent(), browseData, VCellSoftwareVersion.fromSystemProperty());
            imgInfoHash.put(savedKey, savedVCImageInfo);
            fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedVCImageInfo));
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
        return savedVCImage;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : GIFImage(cbit.image.GIFImage) KeyValue(org.vcell.util.document.KeyValue) ISize(org.vcell.util.ISize) VCImage(cbit.image.VCImage) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException) VCImageInfo(cbit.image.VCImageInfo) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Aggregations

GIFImage (cbit.image.GIFImage)3 VCImageInfo (cbit.image.VCImageInfo)3 DataAccessException (org.vcell.util.DataAccessException)3 VCImage (cbit.image.VCImage)2 MathException (cbit.vcell.math.MathException)2 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 XmlParseException (cbit.vcell.xml.XmlParseException)2 BigString (org.vcell.util.BigString)2 ISize (org.vcell.util.ISize)2 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)2 PermissionException (org.vcell.util.PermissionException)2 KeyValue (org.vcell.util.document.KeyValue)2 GifParsingException (cbit.image.GifParsingException)1 VCellSoftwareVersion (org.vcell.util.document.VCellSoftwareVersion)1 Version (org.vcell.util.document.Version)1