예제 #1
0
// -----------------------------------------------------------------------------
//  Static Method
// -----------------------------------------------------------------------------
void FilterWidgetManager::RegisterFilterWidgetFactory(const std::string &name, IFilterWidgetFactory::Pointer factory)
{
    if (NULL != factory.get() )
    {
        // Instantiate the Instance Manager for IFilterWidgetFactory
        FilterWidgetManager::Pointer idManager = FilterWidgetManager::Instance();
        idManager->addFilterWidgetFactory( name, factory );
    }
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QWidget* FilterWidgetManager::createWidget(FilterParameter* parameter, AbstractFilter* filter)
{
  IFilterWidgetFactory::Pointer factory = m_Factories.value(parameter->getWidgetType());
  if(NULL != factory.get())
  {
    return factory->createWidget(parameter, filter, NULL);
  }
  UnknownWidget* unknownWidget = new UnknownWidget(parameter, filter, NULL);
  return unknownWidget;
}
예제 #3
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
FilterWidgetManager::Collection FilterWidgetManager::getFactories(const std::string &groupName)
{
    FilterWidgetManager::Collection groupFactories;


    for (FilterWidgetManager::Collection::iterator factory = m_Factories.begin(); factory != m_Factories.end(); ++factory)
    {
        IFilterWidgetFactory::Pointer filterFactory = (*factory).second;
        if ( NULL != filterFactory.get() && (*factory).second->getFilterGroup().compare(groupName) == 0)
        {
            groupFactories[(*factory).first] = (*factory).second;
        }
    }
    return groupFactories;
}
예제 #4
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
IFilterWidgetFactory::Pointer FilterWidgetManager::getFactoryForFilterHumanName(const std::string &humanName)
{
    IFilterWidgetFactory::Pointer widgetFactory;

    for (FilterWidgetManager::Collection::iterator factory = m_Factories.begin(); factory != m_Factories.end(); ++factory)
    {
        IFilterWidgetFactory::Pointer filterFactory = (*factory).second;
        if ( NULL != filterFactory.get() && filterFactory->getFilterHumanLabel().compare(humanName) == 0)
        {
            widgetFactory = filterFactory;
            break;
        }
    }
    return widgetFactory;
}
예제 #5
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
std::set<std::string> FilterWidgetManager::getSubGroupNames(const std::string &groupName)
{
// std::cout << "FilterWidgetManager::getGroupNames" << std::endl;
    // Get all the Widget Factories and loop over each one we know about and instantiate a new one
    FilterWidgetManager::Pointer fm = FilterWidgetManager::Instance();
    FilterWidgetManager::Collection factories = fm->getFactories();
    std::set<std::string> subGroupNames;
    for (FilterWidgetManager::Collection::iterator factory = factories.begin(); factory != factories.end(); ++factory)
    {
        IFilterWidgetFactory::Pointer filterFactory = (*factory).second;
        if ( NULL != filterFactory.get() && (*factory).second->getFilterGroup().compare(groupName) == 0)
        {
            subGroupNames.insert((*factory).second->getFilterSubGroup());
        }
    }
    return subGroupNames;
}