コード例 #1
0
void SLabeledPointList::configuring()
{
    this->configureParams();

    const ConfigType config = this->getConfigTree().get_child("config.<xmlattr>");

    const std::string hexaColor = config.get< std::string >("color", "");
    m_ptColor = ::fwData::Color::New();
    if (!hexaColor.empty())
    {
        m_ptColor->setRGBA(hexaColor);
    }

    const std::string radius = config.get< std::string >("radius", "");
    if(!radius.empty())
    {
        m_radius = std::stod(radius);
    }

    const std::string interaction = config.get< std::string >("interaction", "");
    if(!interaction.empty())
    {
        SLM_FATAL_IF("value for 'interaction' must be 'on' or 'off', actual: " + interaction,
                     interaction != "on" && interaction != "off");
        m_interaction = (interaction == "on");
    }
}
コード例 #2
0
void IFrameLayoutManager::initialize( ConfigurationType configuration)
{
    OSLM_ASSERT("Bad configuration name "<<configuration->getName()<< ", must be frame",
            configuration->getName() == "frame");

    std::vector < ConfigurationType > name    = configuration->find("name");
    std::vector < ConfigurationType > icon    = configuration->find("icon");
    std::vector < ConfigurationType > minSize = configuration->find("minSize");
    std::vector < ConfigurationType > styles = configuration->find("style");

    if(!name.empty())
    {
        m_frameInfo.m_name = name.at(0)->getValue();
    }

    if(!icon.empty())
    {
        m_frameInfo.m_iconPath = ::boost::filesystem::path( icon.at(0)->getValue() ) ;
        OSLM_ASSERT("Sorry, icon "<< m_frameInfo.m_iconPath << " doesn't exist", ::boost::filesystem::exists(m_frameInfo.m_iconPath));
    }

    if(!minSize.empty())
    {
        if(minSize.at(0)->hasAttribute("width"))
        {
            m_frameInfo.m_minSize.first = ::boost::lexical_cast<int >(minSize.at(0)->getExistingAttributeValue("width")) ;
        }
        if(minSize.at(0)->hasAttribute("height"))
        {
            m_frameInfo.m_minSize.second = ::boost::lexical_cast<int >(minSize.at(0)->getExistingAttributeValue("height")) ;
        }
    }

    if(!styles.empty())
    {
        ::fwRuntime::ConfigurationElement::sptr stylesCfgElt = styles.at(0);
        SLM_FATAL_IF("<style> node must contain mode attribute", !stylesCfgElt->hasAttribute("mode") );
        const std::string style = stylesCfgElt->getExistingAttributeValue("mode");

        if (style == "DEFAULT")
        {
            m_frameInfo.m_style = DEFAULT;
        }
        else if (style == "STAY_ON_TOP")
        {
            m_frameInfo.m_style = STAY_ON_TOP;
        }
        else if (style == "MODAL")
        {
            m_frameInfo.m_style = MODAL;
        }
        else
        {
            OSLM_FATAL("Sorry, style "<<style<< " is unknown.");
        }
    }
    this->readConfig();
}
コード例 #3
0
void PSAFromPDBSelectorUpdaterSrv::configuring()  throw ( ::fwTools::Failed )
{
    SLM_TRACE_FUNC();

    ::fwRuntime::ConfigurationElementContainer handleEvents = m_configuration->findAllConfigurationElement("update");

    SLM_ASSERT("Problem with configuration for PSAFromPDBSelectorUpdaterSrv type, missing element \"update\"", handleEvents.size() != 0 );
    OSLM_DEBUG( "handleEvents.size() = " << handleEvents.size() );
    m_psaManagedEvents.clear();
    for(    ::fwRuntime::ConfigurationElementContainer::Iterator item = handleEvents.begin();
            item != handleEvents.end();
            ++item )
    {
        SLM_FATAL_IF( "Sorry, attribute \"patientKey\" is missing", !(*item)->hasAttribute("patientKey") );
        std::string patientKey =  (*item)->getExistingAttributeValue("patientKey");

        SLM_FATAL_IF( "Sorry, attribute \"studyKey\" is missing", !(*item)->hasAttribute("studyKey") );
        std::string studyKey =  (*item)->getExistingAttributeValue("studyKey");

        SLM_FATAL_IF( "Sorry, attribute \"acquisitionKey\" is missing", !(*item)->hasAttribute("acquisitionKey") );
        std::string acquisitionKey =  (*item)->getExistingAttributeValue("acquisitionKey");

        SLM_FATAL_IF( "Sorry, attribute \"patientNameKey\" is missing", !(*item)->hasAttribute("patientNameKey") );
        std::string patientNameKey =  (*item)->getExistingAttributeValue("patientNameKey");

        SLM_FATAL_IF( "Sorry, attribute \"patientInfoKey\" is missing", !(*item)->hasAttribute("patientInfoKey") );
        std::string patientInfoKey =  (*item)->getExistingAttributeValue("patientInfoKey");

        SLM_FATAL_IF( "Sorry, attribute \"onEvent\" is missing", !(*item)->hasAttribute("onEvent") );
        std::string onEvent =  (*item)->getExistingAttributeValue("onEvent");

        SLM_FATAL_IF( "Sorry, attribute \"fromUID\" is missing", !(*item)->hasAttribute("fromUID") );
        std::string fromUID =  (*item)->getExistingAttributeValue("fromUID");

        SLM_FATAL_IF( "Sorry, attribute \"actionType\" is missing", !(*item)->hasAttribute("actionType") );
        std::string actionType =  (*item)->getExistingAttributeValue("actionType");

        ActionType action;
        if ( actionType == "ADD" )                    { action = ADD; }
        else if ( actionType == "SWAP" )              { action = SWAP; }
        else if ( actionType == "REMOVE" )            { action = REMOVE; }
        else if ( actionType == "ADD_OR_SWAP" )       { action = ADD_OR_SWAP; }
        else if ( actionType == "REMOVE_IF_PRESENT" ) { action = REMOVE_IF_PRESENT; }
        else if ( actionType == "DO_NOTHING" )        { action = DO_NOTHING; }
        else
        {
            SLM_FATAL("Sorry this type of \"actionType\" is not managed by PSAFromPDBSelectorUpdaterSrv type");
        }

        OSLM_INFO( "Manage event "<< onEvent <<" from this object "<< fromUID <<" and "<< actionType << " "<< patientKey << "  " << studyKey << "  " << acquisitionKey << "  " << patientNameKey << " in my composite.");
        PSAManagedEvent managedEvent (onEvent, fromUID, patientKey, studyKey, acquisitionKey, patientNameKey, patientInfoKey, action);
        m_psaManagedEvents.push_back( managedEvent );
        addNewHandledEvent( onEvent );
    }
}
コード例 #4
0
ファイル: Plugin.cpp プロジェクト: corentindesfarges/fw4spl
void Plugin::start() throw( ::fwRuntime::RuntimeException )
{
    SLM_FATAL_IF("Bundle appXml, missing param config in profile", !this->getBundle()->hasParameter("config"));
    m_configurationName =  this->getBundle()->getParameterValue("config") ;
    if( this->getBundle()->hasParameter("parameters") )
    {
        m_parametersName =  this->getBundle()->getParameterValue("parameters") ;
    }
}
コード例 #5
0
void MedicalImageManagerSrv::configuring()  throw ( ::fwTools::Failed )
{
    ::fwRuntime::ConfigurationElementContainer updaters = m_configuration->findAllConfigurationElement("update");

    SLM_ASSERT("Problem with configuration for MedicalImageManagerSrv type, missing element \"update\"", updaters.size() != 0 );
    OSLM_DEBUG( "updaters.size() = " << updaters.size() );
    m_imageCompositeKeys.clear();
    for(    ::fwRuntime::ConfigurationElementContainer::Iterator item = updaters.begin();
            item != updaters.end();
            ++item )
    {
        SLM_FATAL_IF( "Sorry, attribute \"imageCompositeKey\" is missing", !(*item)->hasAttribute("imageCompositeKey") );
        std::string imageCompositeKey =  (*item)->getExistingAttributeValue("imageCompositeKey");
        m_imageCompositeKeys.push_back(imageCompositeKey);
    }
}