static void PopulateDataContainerComboBox(AbstractFilter* filter, FilterParameter* filterParameter, QComboBox* dcCombo, DataContainerArrayProxy& dcaProxy) { FilterParameterType* fp = dynamic_cast<FilterParameterType*>(filterParameter); assert(fp != NULL); DataContainerArray::Pointer dca = filter->getDataContainerArray(); // Populate the DataContainerArray Combo Box with all the DataContainers QList<DataContainerProxy> dcList = dcaProxy.dataContainers.values(); QListIterator<DataContainerProxy> iter(dcList); dcCombo->clear(); QVector<unsigned int> defVec = fp->getDefaultGeometryTypes(); while(iter.hasNext() ) { DataContainerProxy dcProxy = iter.next(); DataContainer::Pointer dc = dca->getDataContainer(dcProxy.name); IGeometry::Pointer geom = IGeometry::NullPointer(); uint32_t geomType = 999; if (NULL != dc.get()) { geom = dc->getGeometry(); } if (NULL != geom.get()) { geomType = geom->getGeometryType(); } dcCombo->addItem(dcProxy.name); if (defVec.isEmpty() == false) { if (defVec.contains(geomType) == false) { QStandardItemModel* model = qobject_cast<QStandardItemModel*>(dcCombo->model()); if (NULL != model) { QStandardItem* item = model->item(dcCombo->findText(dcProxy.name)); if (NULL != item) { item->setFlags(item->flags() & ~Qt::ItemIsEnabled); } } } } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int DataContainerReader::readDataContainerBundles(hid_t fileId, DataContainerArray::Pointer dca) { herr_t err = 0; hid_t dcbGroupId = H5Gopen(fileId, DREAM3D::StringConstants::DataContainerBundleGroupName.toLatin1().constData(), H5P_DEFAULT); if (dcbGroupId < 0) { // NO Bundles are available to read so just return. // QString ss = QObject::tr("Error opening HDF5 Group '%1' ").arg(DREAM3D::StringConstants::DataContainerBundleGroupName); // setErrorCondition(-75); // notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return 0; } HDF5ScopedGroupSentinel sentinel(&dcbGroupId, false); QList<QString> groupNames; err = QH5Utilities::getGroupObjects(dcbGroupId, H5Utilities::H5Support_GROUP, groupNames); if (err < 0) { QString ss = QObject::tr("Error getting group objects from HDF5 group '%1' ").arg(DREAM3D::StringConstants::DataContainerBundleGroupName); setErrorCondition(-76); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return err; } char sep = 0x1E; QListIterator<QString> iter(groupNames); while (iter.hasNext() ) { QString bundleName = iter.next(); DataContainerBundle::Pointer bundle = DataContainerBundle::New(bundleName); hid_t bundleId = H5Gopen(dcbGroupId, bundleName.toLatin1().constData(), H5P_DEFAULT); sentinel.addGroupId(&bundleId); // Make sure this group gets closed // Read in the Data Container Names QString dcNames; err = QH5Lite::readStringDataset(bundleId, DREAM3D::StringConstants::DataContainerNames, dcNames); if (err < 0) { QString ss = QObject::tr("Error reading DataContainer group names from HDF5 group '%1' ").arg(bundleName); setErrorCondition(-75); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return err; } QStringList dcNameList = dcNames.split(QString(sep)); QStringListIterator nameIter(dcNameList); while(nameIter.hasNext() ) { QString dcName = nameIter.next(); DataContainer::Pointer dc = dca->getDataContainer(dcName); if (NULL == dc.get() ) { qDebug() << "Data Container '" << dcName << "' was NULL" << " " << __FILE__ << "(" << __LINE__ << ")"; } bundle->addDataContainer(dc); } QString metaArrays; err = QH5Lite::readStringDataset(bundleId, DREAM3D::StringConstants::MetaDataArrays, metaArrays); if (err < 0) { QString ss = QObject::tr("Error reading DataContainerBundle meta data arrays from HDF5 group '%1' ").arg(bundleName); setErrorCondition(-76); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return err; } QStringList metaNameList = metaArrays.split(QString(sep)); bundle->setMetaDataArrays(metaNameList); dca->addDataContainerBundle(bundle); } H5Gclose(dcbGroupId); dcbGroupId = -1; return err; }