Search in sources :

Example 46 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class VCDatabaseScanner method scanGeometries.

/**
 * Insert the method's description here.
 * Creation date: (2/2/01 3:40:29 PM)
 * @throws DataAccessException
 * @throws XmlParseException
 */
public void scanGeometries(VCDatabaseVisitor databaseVisitor, PrintStream logFilePrintStream, User[] users, KeyValue singleGeometryKey, HashSet<KeyValue> includeHash, HashSet<KeyValue> excludeHash, boolean bAbortOnDataAccessException) throws DataAccessException, XmlParseException {
    if (users == null) {
        users = getAllUsers();
    }
    try {
        // start visiting models and writing log
        logFilePrintStream.println("Start scanning geometries......");
        logFilePrintStream.println("\n");
        for (int i = 0; i < users.length; i++) {
            User user = users[i];
            GeometryInfo[] geoInfos = dbServerImpl.getGeometryInfos(user, false);
            for (int j = 0; j < geoInfos.length; j++) {
                if (singleGeometryKey != null && !geoInfos[j].getVersion().getVersionKey().compareEqual(singleGeometryKey)) {
                    System.out.println("skipping geometry, not the single one that we wanted");
                    continue;
                }
                if (excludeHash != null && excludeHash.contains(geoInfos[j].getVersion().getVersionKey())) {
                    System.out.println("skipping geometry with key '" + geoInfos[j].getVersion().getVersionKey() + "'");
                    continue;
                }
                if (includeHash != null && !includeHash.contains(geoInfos[j].getVersion().getVersionKey())) {
                    System.out.println("not including geometry with key '" + geoInfos[j].getVersion().getVersionKey() + "'");
                    continue;
                }
                if (!databaseVisitor.filterGeometry(geoInfos[j])) {
                    continue;
                }
                try {
                    BigString geometryXML = dbServerImpl.getGeometryXML(user, geoInfos[j].getVersion().getVersionKey());
                    Geometry geometry = cbit.vcell.xml.XmlHelper.XMLToGeometry(new XMLSource(geometryXML.toString()));
                    geometry.refreshDependencies();
                    databaseVisitor.visitGeometry(geometry, logFilePrintStream);
                } catch (Exception e2) {
                    lg.error(e2.getMessage(), e2);
                    if (bAbortOnDataAccessException) {
                        throw e2;
                    }
                }
            }
        }
        logFilePrintStream.close();
    } catch (Exception e) {
        System.err.println("error writing to log file.");
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) User(org.vcell.util.document.User) GeometryInfo(cbit.vcell.geometry.GeometryInfo) BigString(org.vcell.util.BigString) XMLSource(cbit.vcell.xml.XMLSource) SQLException(java.sql.SQLException) XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException) RemoteException(java.rmi.RemoteException)

Example 47 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class GeometryTable method getInfo.

/**
 * This method was created in VisualAge.
 * @return cbit.vcell.geometry.GeometryInfo
 * @param rset java.sql.ResultSet
 * @param log cbit.vcell.server.SessionLog
 */
public VersionInfo getInfo(ResultSet rset, Connection con) throws SQLException, DataAccessException {
    java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
    Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
    int dim = rset.getInt(GeometryTable.table.dimension.toString());
    double oX = rset.getBigDecimal(GeometryTable.table.originX.toString()).doubleValue();
    double oY = rset.getBigDecimal(GeometryTable.table.originY.toString()).doubleValue();
    double oZ = rset.getBigDecimal(GeometryTable.table.originZ.toString()).doubleValue();
    org.vcell.util.Origin origin = new org.vcell.util.Origin(oX, oY, oZ);
    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);
    KeyValue imgRef = null;
    java.math.BigDecimal bigDecimal = rset.getBigDecimal(GeometryTable.table.imageRef.toString());
    if (!rset.wasNull()) {
        imgRef = new KeyValue(bigDecimal);
    }
    String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
    GeometryInfo geomInfo = new GeometryInfo(version, dim, extent, origin, imgRef, VCellSoftwareVersion.fromString(softwareVersion));
    return geomInfo;
/*GeometryInfo geomInfo = new GeometryInfo();

	geomInfo.dimension = rset.getInt(GeometryTable.dimension.toString());
	geomInfo.originX = rset.getDouble(GeometryTable.originX.toString());
	geomInfo.originY = rset.getDouble(GeometryTable.originY.toString());
	geomInfo.originZ = rset.getDouble(GeometryTable.originZ.toString());
	geomInfo.extentRef = new KeyValue(rset.getBigDecimal(GeometryTable.extentRef.toString(), 0));
	geomInfo.imageRef = new KeyValue(rset.getBigDecimal(GeometryTable.imageRef.toString(), 0));

	geomInfo.version = getVersion(rset,log);
	
	return geomInfo;
	*/
}
Also used : KeyValue(org.vcell.util.document.KeyValue) VCellSoftwareVersion(org.vcell.util.document.VCellSoftwareVersion) Version(org.vcell.util.document.Version) GeometryInfo(cbit.vcell.geometry.GeometryInfo)

Aggregations

GeometryInfo (cbit.vcell.geometry.GeometryInfo)47 BioModelInfo (org.vcell.util.document.BioModelInfo)27 MathModelInfo (org.vcell.util.document.MathModelInfo)27 DataAccessException (org.vcell.util.DataAccessException)19 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)11 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)8 Hashtable (java.util.Hashtable)8 Geometry (cbit.vcell.geometry.Geometry)7 VCImageInfo (cbit.image.VCImageInfo)6 BioModel (cbit.vcell.biomodel.BioModel)6 User (org.vcell.util.document.User)6 VersionInfo (org.vcell.util.document.VersionInfo)6 CSGObject (cbit.vcell.geometry.CSGObject)5 SimulationContext (cbit.vcell.mapping.SimulationContext)5 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)5 Vector (java.util.Vector)5 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)5 ImageException (cbit.image.ImageException)4 DocumentManager (cbit.vcell.clientdb.DocumentManager)4 GeometryException (cbit.vcell.geometry.GeometryException)4