コード例 #1
0
    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);
              }
            }
          }
        }
      }
    }
コード例 #2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void GenerateGeometryConnectivity::execute()
{
  int32_t err = 0;
  setErrorCondition(err);
  dataCheck();
  if(getErrorCondition() < 0) { return; }

  DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceDataContainerName());
  IGeometry::Pointer geom = sm->getGeometry();

  if (m_GenerateVertexTriangleLists == true || m_GenerateTriangleNeighbors == true)
  {
    notifyStatusMessage(getHumanLabel(), "Generating Vertex Element List");
    err = geom->findElementsContainingVert();
    if (err < 0)
    {
      setErrorCondition(-400);
      QString ss = QObject::tr("Error generating vertex element list for Geometry type %1").arg(geom->getGeometryTypeAsString());
      notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    }
  }
  if (m_GenerateTriangleNeighbors == true)
  {
    notifyStatusMessage(getHumanLabel(), "Generating Element Neighbors List");
    err = geom->findElementNeighbors();
    if (err < 0)
    {
      setErrorCondition(-401);
      QString ss = QObject::tr("Error generating element neighbor list for Geometry type %1").arg(geom->getGeometryTypeAsString());
      notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    }
  }

  /* Let the GUI know we are done with this filter */
  notifyStatusMessage(getHumanLabel(), "Complete");
}