use of cbit.image.VCImageInfo in project vcell by virtualcell.
the class ClientRequestManager method createSelectLoadGeomTask.
private AsynchClientTask createSelectLoadGeomTask(final TopLevelWindowManager requester) {
AsynchClientTask selectLoadGeomTask = new AsynchClientTask("Select/Load geometry...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
VersionInfo vcVersionInfo = (VersionInfo) hashTable.get(VERSIONINFO_KEY);
Geometry geom = null;
if (vcVersionInfo instanceof VCDocumentInfo) {
geom = getGeometryFromDocumentSelection(requester.getComponent(), (VCDocumentInfo) vcVersionInfo, false);
} else if (vcVersionInfo instanceof VCImageInfo) {
VCImage img = getDocumentManager().getImage((VCImageInfo) vcVersionInfo);
geom = new Geometry("createSelectLoadGeomTask", img);
} else {
throw new Exception("Unexpected versioninfo type.");
}
// pregenerate sampled image, cpu intensive
geom.precomputeAll(new GeometryThumbnailImageFactoryAWT());
hashTable.put(GEOMETRY_KEY, geom);
}
};
return selectLoadGeomTask;
}
use of cbit.image.VCImageInfo in project vcell by virtualcell.
the class DbDriver method getVCInfoContainer.
/**
* Insert the method's description here.
* Creation date: (9/24/2003 12:54:32 PM)
* @return cbit.vcell.modeldb.VCInfoContainer
*/
public static VCInfoContainer getVCInfoContainer(User user, Connection con, DatabaseSyntax dbSyntax) throws SQLException, DataAccessException {
VCInfoContainer results = null;
//
VCImageInfo[] vcImageInfos = null;
GeometryInfo[] geometryInfos = null;
MathModelInfo[] mathModelInfos = null;
BioModelInfo[] bioModelInfos = null;
//
StringBuffer sql = null;
String special = null;
ResultSet rset = null;
boolean enableSpecial = true;
boolean enableDistinct = true;
Statement stmt = con.createStatement();
try {
//
// BioModelInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + BioModelTable.table.name.getQualifiedColName() + "," + BioModelTable.table.versionBranchID.getQualifiedColName() + "," + BioModelTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(BioModelTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT);
rset = stmt.executeQuery(sql.toString());
ArrayList<BioModelInfo> tempInfos = new ArrayList<BioModelInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
BioModelInfo versionInfo = (BioModelInfo) BioModelTable.table.getInfo(rset, con, dbSyntax);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
}
}
rset.close();
if (tempInfos.size() > 0) {
bioModelInfos = new BioModelInfo[tempInfos.size()];
tempInfos.toArray(bioModelInfos);
}
if (lg.isInfoEnabled()) {
lg.info("BioModelInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
//
// MathModelInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + MathModelTable.table.name.getQualifiedColName() + "," + MathModelTable.table.versionBranchID.getQualifiedColName() + "," + MathModelTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(MathModelTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT);
rset = stmt.executeQuery(sql.toString());
ArrayList<MathModelInfo> tempInfos = new ArrayList<MathModelInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
MathModelInfo versionInfo = (MathModelInfo) MathModelTable.table.getInfo(rset, con, dbSyntax);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
}
}
rset.close();
if (tempInfos.size() > 0) {
mathModelInfos = new MathModelInfo[tempInfos.size()];
tempInfos.toArray(mathModelInfos);
}
if (lg.isInfoEnabled()) {
lg.info("MathModelInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
//
// VCImageInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + ImageTable.table.name.getQualifiedColName() + "," + ImageTable.table.versionBranchID.getQualifiedColName() + "," + ImageTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(ImageTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), true, dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT);
rset = stmt.executeQuery(sql.toString());
ArrayList<VCImageInfo> tempInfos = new ArrayList<VCImageInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
VCImageInfo versionInfo = (VCImageInfo) ImageTable.table.getInfo(rset, con, dbSyntax);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
}
}
rset.close();
if (tempInfos.size() > 0) {
vcImageInfos = new VCImageInfo[tempInfos.size()];
tempInfos.toArray(vcImageInfos);
}
if (lg.isInfoEnabled()) {
lg.info("ImageInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
//
// GeometeryInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + GeometryTable.table.name.getQualifiedColName() + "," + GeometryTable.table.versionBranchID.getQualifiedColName() + "," + GeometryTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(GeometryTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), true, dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT + (enableDistinct ? "DISTINCT " : ""));
rset = stmt.executeQuery(sql.toString());
ArrayList<GeometryInfo> tempInfos = new ArrayList<GeometryInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
GeometryInfo versionInfo = (GeometryInfo) GeometryTable.table.getInfo(rset, con);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
}
}
rset.close();
if (tempInfos.size() > 0) {
geometryInfos = new GeometryInfo[tempInfos.size()];
tempInfos.toArray(geometryInfos);
}
if (lg.isInfoEnabled()) {
lg.info("GeometryInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
} finally {
if (stmt != null) {
stmt.close();
}
}
results = new VCInfoContainer(user, vcImageInfos, geometryInfos, mathModelInfos, bioModelInfos);
return results;
}
Aggregations