Exemplo n.º 1
0
void RootManager::uninitializeRootObject()
{
    SLM_TRACE_FUNC();
    SLM_WARN_IF("(Hack) Sorry, the OSR must be initialized to uninitialize it. ToDo => transform in assert", ! getDefault()->m_isRootInitialized );
    if ( getDefault()->m_isRootInitialized )
    {
        // Setting initialization to false
        getDefault()->m_isRootInitialized = false ;

        assert( getDefault()->m_rootObjectConfigurationName.first ) ;
        // Stop services reported in m_rootObjectConfiguration before stopping everything

        //::fwServices::stopAndUnregister(getDefault()->m_rootObjectConfiguration) ;
        getDefault()->m_ctm->stopAndDestroy();

        OSLM_WARN_IF("Sorry, few services still exist before erasing root object ( cf debug following message )"
                << std::endl << ::fwServices::OSR::getRegistryInformation(),
                ! ::fwServices::OSR::getKSContainer().empty());

        //::fwServices::GlobalEventManager::getDefault()->clearMessages();

        SLM_TRACE("uninitializeRootObject : Reset the last shared_ptr on root object.");

        // Reset the root object: involve complete m_container clearing
        //getDefault()->m_rootObject.reset();
        //assert( getDefault()->m_rootObject.use_count() == 0 );

//        ::fwRuntime::profile::Profile::sptr profile = ::fwRuntime::profile::getCurrentProfile();
//        SLM_TRACE("Stopping Profile");
//        profile->stop();
//        SLM_TRACE("Profile Stopped");
    }
}
Exemplo n.º 2
0
void CurvedHistogram::configuring() throw( ::fwTools::Failed)
{
    SLM_TRACE_FUNC();

    SLM_ASSERT("\"config\" tag is missing", m_configuration->getName() == "config");

    this->IAdaptor::configuring();  // Looks for 'xAxis', 'yAxis', 'opacity' and 'zValue'

    m_innerColor = QPen( Qt::transparent );
    m_borderColor = QPen( Qt::transparent );
    m_brush = QBrush( Qt::NoBrush );

    if (!m_configuration->getAttributeValue("borderColor").empty())
    {
        ::scene2D::data::InitQtPen::setPenColor(
                m_borderColor, m_configuration->getAttributeValue("borderColor"), m_opacity );
    }

    if (!m_configuration->getAttributeValue("innerColor").empty())
    {
        ::scene2D::data::InitQtPen::setPenColor(
                m_innerColor, m_configuration->getAttributeValue("innerColor"), m_opacity );
    }

    if (!m_configuration->getAttributeValue("borderWidth").empty())
    {
        m_borderWidth = ::boost::lexical_cast< float >( m_configuration->getAttributeValue("borderWidth") );
    }

    m_histogramPointUID = m_configuration->getAttributeValue("histogramPointUID");

    OSLM_WARN_IF("If an histogram cursor is used with this histogram, m_histogramPointUID must be set in order to "
            << "inform about the position that the cursor should use.", m_histogramPointUID.empty());
}
ConfigurationElement::sptr BundleDescriptorReader::processConfigurationElement(xmlNodePtr node, const ::boost::shared_ptr<Bundle> bundle) throw(RuntimeException)
{
    //xmlKeepBlanksDefault(0);
    // Creates the configuration element.
    std::string name((const char*) node->name);
    ConfigurationElement::sptr configurationElement(new ConfigurationElement(bundle, name));

    // Processes all attributes.
    xmlAttrPtr curAttr;
    for(curAttr = node->properties; curAttr != 0; curAttr = curAttr->next)
    {
        std::string name((const char*) curAttr->name);
        std::string value((const char*) curAttr->children->content);

        configurationElement->setAttributeValue(name, value);
    }

    // Process child nodes.
    xmlNodePtr curChild = node->children;
    for(curChild = node->children; curChild != 0; curChild = curChild->next)
    {
        if(curChild->type == XML_TEXT_NODE && !xmlIsBlankNode(curChild))
        {
            std::string value((const char*) curChild->content);
            // Even whitespace (non XML_TEXT_NODE) are considered as valid XML_TEXT_NODE
            OSLM_WARN_IF("Bundle : " << ( bundle ? bundle->getIdentifier() : "<None>" ) << ", node: " << name << ", blanks in xml nodes can result in unexpected behaviour. Consider using <![CDATA[ ... ]]>.",
                    (value.find("\n")!=std::string::npos || value.find("\t")!=std::string::npos));

            configurationElement->setValue( configurationElement->getValue() + value );
            continue;
        }
        else if(curChild->type == XML_CDATA_SECTION_NODE )
        {
            std::string value((const char*) curChild->content);
            configurationElement->setValue( configurationElement->getValue() + value );
            continue;
        }

        else if(curChild->type == XML_ELEMENT_NODE)
        {
            ConfigurationElement::sptr element(processConfigurationElement(curChild, bundle));
            configurationElement->addConfigurationElement(element);
            continue;
        }
    }

    // Job's done.
    return configurationElement;
}