std::vector< Edge::sptr > Graph::getEdges( Node::csptr node, bool upStream, std::string nature , std::string portID) { OSLM_ASSERT("Node "<<node->getID() <<" not found in graph", m_nodes.find( Node::constCast(node) ) != m_nodes.end() ); OSLM_ASSERT("Port "<< portID <<" not found in graph", portID.empty() || node->findPort(portID,upStream) ); // portID if specified must be on node std::vector< Edge::sptr > result; result.reserve(4); for ( ConnectionContainer::const_iterator i=m_connections.begin() ; i != m_connections.end() ; ++i ) { Edge::sptr edge = i->first; Node::sptr nodeFrom = i->second.first; Node::sptr nodeTo = i->second.second; bool isConnectedEdge = ( upStream ? ( nodeTo == node ) : ( nodeFrom == node ) ); bool isCorrectNature = nature.empty() || ( edge->getNature() == nature ); bool isCorrectPort = portID.empty() || ( upStream ? ( edge->getToPortID()== portID ) : ( edge->getFromPortID()== portID ) ); if ( isConnectedEdge && isCorrectNature && isCorrectPort) { result.push_back( edge ); } } return result; }
void ToolBarRegistrar::manage(std::vector< ::fwGui::container::fwContainer::sptr > containers ) { ::fwGui::container::fwContainer::sptr container; for( SIDToolBarMapType::value_type sid : m_editorSids) { OSLM_ASSERT("Container index "<< sid.second.first <<" is bigger than subViews size!", sid.second.first < containers.size()); container = containers.at( sid.second.first ); ::fwGui::GuiRegistry::registerSIDContainer(sid.first, container); if(sid.second.second) //service is auto started? { OSLM_ASSERT("Service "<<sid.first <<" does not exist.", ::fwTools::fwID::exist(sid.first ) ); ::fwServices::IService::sptr service = ::fwServices::get( sid.first ); OSLM_ASSERT("Service "<<sid.first <<" must be stopped.", service->isStopped() ); service->start(); } } for( WIDToolBarMapType::value_type wid : m_editorWids) { OSLM_ASSERT("Container index "<< wid.second <<" is bigger than subViews size!", wid.second < containers.size()); container = containers.at( wid.second ); ::fwGui::GuiRegistry::registerWIDContainer(wid.first, container); } }
void ToolBarRegistrar::manage(std::vector< ::fwGui::container::fwMenuItem::sptr > menuItems ) { ::fwGui::container::fwMenuItem::sptr menuItem; for( SIDToolBarMapType::value_type sid : m_actionSids) { OSLM_ASSERT("Container index "<< sid.second.first <<" is bigger than subViews size!", sid.second.first < menuItems.size()); menuItem = menuItems.at( sid.second.first ); ::fwGui::GuiRegistry::registerActionSIDToParentSID(sid.first, m_sid); if(sid.second.second) //service is auto started? { OSLM_ASSERT("Service "<<sid.first <<" does not exist.", ::fwTools::fwID::exist(sid.first ) ); ::fwServices::IService::sptr service = ::fwServices::get( sid.first ); OSLM_ASSERT("Service "<<sid.first <<" must be stopped.", service->isStopped() ); service->start(); } else { bool service_exists = ::fwTools::fwID::exist(sid.first ); if (!service_exists || ::fwServices::get( sid.first )->isStopped()) { ::fwGui::GuiRegistry::actionServiceStopping(sid.first); } else { ::fwGui::GuiRegistry::actionServiceStarting(sid.first); } } } }
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(); }
void ToolboxLayoutManagerBase::initialize( ConfigurationType configuration) { OSLM_ASSERT("Bad configuration name "<<configuration->getName()<< ", must be layout", configuration->getName() == "layout"); m_views.clear(); for (ConfigurationType view : configuration->getElements()) { if( view->getName() == "view" ) { ViewInfo vi; if( view->hasAttribute("border") ) { std::string border = view->getExistingAttributeValue("border"); vi.m_border = ::boost::lexical_cast< int >(border); } if( view->hasAttribute("caption") ) { vi.m_caption = view->getExistingAttributeValue("caption"); } if( view->hasAttribute("minWidth") ) { std::string width = view->getExistingAttributeValue("minWidth"); vi.m_minSize.first = ::boost::lexical_cast< int >(width); } if( view->hasAttribute("minHeight") ) { std::string height = view->getExistingAttributeValue("minHeight"); vi.m_minSize.second = ::boost::lexical_cast< int >(height); } if( view->hasAttribute("visible") ) { std::string visible = view->getExistingAttributeValue("visible"); OSLM_ASSERT("Incorrect value for \"visible\" attribute "<<visible, (visible == "true") || (visible == "false") || (visible == "yes") || (visible == "no")); vi.m_visible = ((visible == "true") || (visible == "yes")); } if( view->hasAttribute("expanded") ) { std::string expanded = view->getExistingAttributeValue("expanded"); OSLM_ASSERT("Incorrect value for \"expanded\" attribute "<<expanded, (expanded == "true") || (expanded == "false") || (expanded == "yes") || (expanded == "no")); vi.m_expanded = ((expanded == "true") || (expanded == "yes")); } if( view->hasAttribute("useScrollBar") ) { std::string useScrollBar = view->getExistingAttributeValue("useScrollBar"); OSLM_ASSERT("Incorrect value for \"useScrollBar\" attribute "<<useScrollBar, (useScrollBar == "yes") || (useScrollBar == "no")); vi.m_useScrollBar = (useScrollBar=="yes"); } m_views.push_back(vi); } } }
void IFrameSrv::initializeToolBarBuilder(ConfigurationType toolBarConfig) { OSLM_ASSERT("Bad configuration name "<<toolBarConfig->getName()<< ", must be toolBar", toolBarConfig->getName() == "toolBar"); m_toolBarBuilder = ::fwTools::ClassFactoryRegistry::create< ::fwGui::builder::IToolBarBuilder >( ::fwGui::builder::IToolBarBuilder::REGISTRY_KEY ); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::builder::IToolBarBuilder::REGISTRY_KEY, m_toolBarBuilder); m_toolBarBuilder->initialize(toolBarConfig); }
void IFrameSrv::initializeLayoutManager(ConfigurationType frameConfig) { OSLM_ASSERT("Bad configuration name "<<frameConfig->getName()<< ", must be frame", frameConfig->getName() == "frame"); m_frameLayoutManager = ::fwTools::ClassFactoryRegistry::create< ::fwGui::layoutManager::IFrameLayoutManager >( ::fwGui::layoutManager::IFrameLayoutManager::REGISTRY_KEY ); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::layoutManager::IFrameLayoutManager::REGISTRY_KEY, m_frameLayoutManager); m_frameLayoutManager->initialize(frameConfig); }
void IToolBarSrv::initializeLayoutManager(ConfigurationType layoutConfig) { OSLM_ASSERT("Bad configuration name "<<layoutConfig->getName()<< ", must be layout", layoutConfig->getName() == "layout"); m_layoutManager = ::fwTools::ClassFactoryRegistry::create< ::fwGui::layoutManager::IToolBarLayoutManager >( ::fwGui::layoutManager::IToolBarLayoutManager::REGISTRY_KEY ); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::layoutManager::IToolBarLayoutManager::REGISTRY_KEY, m_layoutManager); m_layoutManager->initialize(layoutConfig); }
void IGuiContainerSrv::initializeToolBarBuilder(ConfigurationType toolBarConfig) { OSLM_ASSERT("Bad configuration name "<<toolBarConfig->getName()<< ", must be toolBar", toolBarConfig->getName() == "toolBar"); ::fwGui::GuiBaseObject::sptr guiObj = ::fwGui::factory::New(::fwGui::builder::IToolBarBuilder::REGISTRY_KEY); m_toolBarBuilder = ::fwGui::builder::IToolBarBuilder::dynamicCast(guiObj); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::builder::IToolBarBuilder::REGISTRY_KEY, m_toolBarBuilder); m_toolBarBuilder->initialize(toolBarConfig); }
void IFrameSrv::initializeLayoutManager(ConfigurationType frameConfig) { OSLM_ASSERT("Bad configuration name "<<frameConfig->getName()<< ", must be frame", frameConfig->getName() == "frame"); ::fwGui::GuiBaseObject::sptr guiObj = ::fwGui::factory::New( ::fwGui::layoutManager::IFrameLayoutManager::REGISTRY_KEY); m_frameLayoutManager = ::fwGui::layoutManager::IFrameLayoutManager::dynamicCast(guiObj); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::layoutManager::IFrameLayoutManager::REGISTRY_KEY, m_frameLayoutManager); m_frameLayoutManager->initialize(frameConfig); }
void IFrameSrv::initializeMenuBarBuilder(ConfigurationType menuBarConfig) { OSLM_ASSERT("Bad configuration name "<<menuBarConfig->getName()<< ", must be menuBar", menuBarConfig->getName() == "menuBar"); ::fwGui::GuiBaseObject::sptr guiObj = ::fwGui::factory::New(::fwGui::builder::IMenuBarBuilder::REGISTRY_KEY); m_menuBarBuilder = ::fwGui::builder::IMenuBarBuilder::dynamicCast(guiObj); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::builder::IMenuBarBuilder::REGISTRY_KEY, m_menuBarBuilder); m_menuBarBuilder->initialize(menuBarConfig); }
void ISemanticPatch::apply(const ::fwAtoms::Object::sptr& previous, const ::fwAtoms::Object::sptr& current, ::fwAtomsPatch::IPatch::NewVersionsType& newVersions) { OSLM_ASSERT("The type of the previous object (" << ::fwAtomsPatch::helper::getClassname(previous) << "does not match" "the required type (" << m_originClassname << ").", ::fwAtomsPatch::helper::getClassname(previous) == m_originClassname); OSLM_ASSERT("The version of the previous object (" << ::fwAtomsPatch::helper::getVersion(previous) << "does not match the required version (" << m_originVersion << ").", ::fwAtomsPatch::helper::getVersion(previous) == m_originVersion); }
void IGuiContainerSrv::initializeLayoutManager(ConfigurationType layoutConfig) { OSLM_ASSERT("Bad configuration name "<<layoutConfig->getName()<< ", must be layout", layoutConfig->getName() == "layout"); SLM_ASSERT("<layout> tag must have type attribute", layoutConfig->hasAttribute("type")); const std::string layoutManagerClassName = layoutConfig->getAttributeValue("type"); ::fwGui::GuiBaseObject::sptr guiObj = ::fwGui::factory::New(layoutManagerClassName); m_viewLayoutManager = ::fwGui::layoutManager::IViewLayoutManager::dynamicCast(guiObj); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< layoutManagerClassName, m_viewLayoutManager); m_viewLayoutManager->initialize(layoutConfig); }
std::string ObjectTracker::xmlID2RuntimeID( const std::string &xmlID ) { OSLM_ASSERT(xmlID<<" not found in map oldNewUUIDTranslation", m_oldNewUUIDTranslation.find(xmlID) != m_oldNewUUIDTranslation.end() ); return m_oldNewUUIDTranslation[xmlID]; }
void IGuiContainerSrv::create() { SLM_ASSERT("ViewRegistrar must be initialized.", m_viewRegistrar); ::fwGui::container::fwContainer::sptr parent = m_viewRegistrar->getParent(); SLM_ASSERT("Parent container is unknown.", parent); ::fwGui::GuiBaseObject::sptr guiObj = ::fwGui::factory::New(::fwGui::builder::IContainerBuilder::REGISTRY_KEY); m_containerBuilder = ::fwGui::builder::IContainerBuilder::dynamicCast(guiObj); OSLM_ASSERT("ClassFactoryRegistry failed for class "<< ::fwGui::builder::IContainerBuilder::REGISTRY_KEY, m_containerBuilder); m_containerBuilder->createContainer(parent); ::fwGui::container::fwContainer::sptr container = m_containerBuilder->getContainer(); if ( m_viewLayoutManagerIsCreated ) { if (m_hasToolBar) { m_toolBarBuilder->createToolBar(parent); m_viewRegistrar->manageToolBar(m_toolBarBuilder->getToolBar()); } m_viewLayoutManager->createLayout(container); m_viewRegistrar->manage(m_viewLayoutManager->getSubViews()); } }
void SliceIndexPositionEditor::sliceTypeNotification( int _type ) { Orientation type = static_cast< Orientation >( _type ); OSLM_ASSERT("Bad slice type "<<type, type == X_AXIS || type == Y_AXIS || type == Z_AXIS ); // Change data info ::fwData::Composite::NewSptr info; ::fwData::Integer::NewSptr fromSliceType; ::fwData::Integer::NewSptr toSliceType; fromSliceType->value() = static_cast< int > ( m_orientation ) ; toSliceType->value() = static_cast< int > ( type ) ; info->getContainer()["fromSliceType"] = fromSliceType; info->getContainer()["toSliceType"] = toSliceType; // Change slice type m_orientation = type; // Fire the message ::fwComEd::ImageMsg::NewSptr msg; msg->addEvent( ::fwComEd::ImageMsg::CHANGE_SLICE_TYPE, info ) ; ::fwData::Image::sptr image = this->getObject< ::fwData::Image >(); ::fwServices::IEditionService::notify(this->getSptr(), image, msg); this->updateSliceIndex(); }
void STimestampSlotCaller::configuring() { this->initialize(); ConfigurationType cfg = m_configuration->findConfigurationElement("slots"); ::fwRuntime::ConfigurationElementContainer slotCfgs = cfg->findAllConfigurationElement("slot"); ::boost::regex re("(.*)/(.*)"); ::boost::smatch match; std::string src, uid, key; for(ConfigurationType elem : slotCfgs.getElements()) { src = elem->getValue(); if( ::boost::regex_match(src, match, re) ) { OSLM_ASSERT("Wrong value for attribute src: "<<src, match.size() >= 3); uid.assign(match[1].first, match[1].second); key.assign(match[2].first, match[2].second); SLM_ASSERT("Missing hasSlotsId attribute", !uid.empty()); SLM_ASSERT("Missing slotKey attribute", !key.empty()); m_slotInfos.push_back( std::make_pair(uid, key) ); } } }
void ConnectPoints::disconnectPointToService(const ::fwCom::HasSignals::sptr& hasSignals) { ConnectionContainerType::iterator it = m_connections.find(hasSignals); OSLM_ASSERT("Failed to retrieve signal holder in connections container", it != m_connections.end()); it->second.disconnect(); m_connections.erase(m_connections.find (hasSignals)); }
void ToolBarRegistrar::manage(std::vector< ::fwGui::container::fwMenu::sptr > menus ) { ::fwGui::container::fwMenu::sptr menu; for( SIDToolBarMapType::value_type sid : m_menuSids) { OSLM_ASSERT("Container index "<< sid.second.first <<" is bigger than subViews size!", sid.second.first < menus.size()); menu = menus.at( sid.second.first ); ::fwGui::GuiRegistry::registerSIDMenu(sid.first, menu); if(sid.second.second) //service is auto started? { OSLM_ASSERT("Service "<<sid.first <<" does not exist.", ::fwTools::fwID::exist(sid.first ) ); ::fwServices::IService::sptr service = ::fwServices::get( sid.first ); OSLM_ASSERT("Service "<<sid.first <<" must be stopped.", service->isStopped() ); service->start(); } } }
void Object::removeField( const FieldNameType& name ) { FieldMapType::const_iterator iter = m_fields.find(name); OSLM_ASSERT("Field "<<name<<" not found.", iter != m_fields.end()); if(iter != m_fields.end()) { m_fields.erase(iter); } }
Signals::~Signals() { #ifdef DEBUG for( SignalMapType::value_type elem : m_signals ) { OSLM_ASSERT( "Signal '"<< elem.first <<"' has connected slots", elem.second->getNumberOfConnections() == 0 ); } #endif }
void SWriter::configuring() throw(::fwTools::Failed) { ::io::IWriter::configuring(); typedef SPTR(::fwRuntime::ConfigurationElement) ConfigurationElement; typedef std::vector < ConfigurationElement > ConfigurationElementContainer; m_customExts.clear(); m_allowedExtLabels.clear(); ConfigurationElementContainer customExtsList = m_configuration->find("archive"); BOOST_FOREACH(ConfigurationElement archive, customExtsList) { const std::string& backend = archive->getAttributeValue("backend"); SLM_ASSERT("No backend attribute given in archive tag", backend != ""); SLM_ASSERT("Unsupported backend '" + backend + "'", SReader::s_EXTENSIONS.find("." + backend) != SReader::s_EXTENSIONS.end()); ConfigurationElementContainer exts = archive->find("extension"); BOOST_FOREACH(ConfigurationElement ext, exts) { const std::string& extension = ext->getValue(); SLM_ASSERT("No extension given for backend '" + backend + "'", !extension.empty()); SLM_ASSERT("Extension must begin with '.'", extension[0] == '.'); m_customExts[extension] = backend; m_allowedExtLabels[extension] = ext->getAttributeValue("label"); } } ConfigurationElementContainer extensionsList = m_configuration->find("extensions"); SLM_ASSERT("The <extensions> element can be set at most once.", extensionsList.size() <= 1); if(extensionsList.size() == 1) { m_allowedExts.clear(); ConfigurationElementContainer extensions = extensionsList.at(0)->find("extension"); BOOST_FOREACH(ConfigurationElement extension, extensions) { const std::string& ext = extension->getValue(); // The extension must be found either in custom extensions list or in known extensions FileExtension2NameType::const_iterator itKnown = SReader::s_EXTENSIONS.find(ext); FileExtension2NameType::const_iterator itCustom = m_customExts.find(ext); const bool extIsKnown = (itKnown != SReader::s_EXTENSIONS.end() || itCustom != m_customExts.end()); OSLM_ASSERT("Extension '" << ext << "' is not allowed in configuration", extIsKnown); if(extIsKnown) { m_allowedExts.insert(m_allowedExts.end(), ext); m_allowedExtLabels[ext] = extension->getAttributeValue("label"); } } }
void FrameLayoutManager::createFrame() { SLM_TRACE_FUNC(); FrameInfo frameInfo = this->getFrameInfo(); wxEventLoopBase* eventLoop = wxEventLoop::GetActive(); if (!eventLoop) { wxEventLoop::SetActive(new wxEventLoop() ); } // wxWidget initialization wxInitAllImageHandlers(); m_wxFrame = new wxFrame(wxTheApp->GetTopWindow(), wxNewId(), ::fwWX::std2wx(frameInfo.m_name), wxDefaultPosition, wxSize(frameInfo.m_minSize.first, frameInfo.m_minSize.second), FWSTYLE_TO_WXSTYLE.find(frameInfo.m_style)->second ); if(!wxTheApp->GetTopWindow()) { wxTheApp->SetTopWindow( m_wxFrame ) ; } m_wxFrame->SetMinSize(wxSize(frameInfo.m_minSize.first, frameInfo.m_minSize.second)); if(!frameInfo.m_iconPath.empty()) { wxIcon icon( ::fwWX::std2wx(frameInfo.m_iconPath.string()), wxBITMAP_TYPE_ICO ); OSLM_ASSERT("Sorry, unable to create an icon instance from " << frameInfo.m_iconPath.string(), icon.Ok()); m_wxFrame->SetIcon( icon ); } m_wxFrame->Move( wxPoint(frameInfo.m_position.first, frameInfo.m_position.second) ); m_wxFrame->SetSize( wxSize( frameInfo.m_size.first, frameInfo.m_size.second) ); this->setState(frameInfo.m_state); m_wxFrame->Bind( wxEVT_CLOSE_WINDOW, &FrameLayoutManager::onCloseFrame, this, m_wxFrame->GetId()); m_wxFrame->Show(); m_wxFrame->Refresh(); ::fwGuiWx::container::WxContainer::NewSptr frameContainer; frameContainer->setWxContainer(m_wxFrame); m_frame = frameContainer; wxPanel *panel = new wxPanel(m_wxFrame, wxNewId()); wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL ); m_wxFrame->SetSizer(boxSizer); boxSizer->Add(panel, 1, wxALL|wxEXPAND); m_wxFrame->Layout(); ::fwGuiWx::container::WxContainer::NewSptr container; container->setWxContainer(panel); m_container = container; }
void process(vtkRenderWindowInteractor *caller, unsigned long eventId) // from { SLM_ASSERT("bad vtk caller", caller); m_caller = caller; switch (eventId) { case vtkCommand::LeftButtonPressEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_LEFT_DOWN); break; case vtkCommand::LeftButtonReleaseEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_LEFT_UP); break; case vtkCommand::MiddleButtonPressEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_MIDDLE_DOWN); break; case vtkCommand::MiddleButtonReleaseEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_MIDDLE_UP); break; case vtkCommand::RightButtonPressEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_RIGHT_DOWN); break; case vtkCommand::RightButtonReleaseEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_RIGHT_UP); break; //case vtkCommand::EnterEvent : //this->notifyMsg(::fwComEd::InteractionMsg::); //break; //case vtkCommand::LeaveEvent : //this->notifyMsg(::fwComEd::InteractionMsg::); //break; //case vtkCommand::KeyPressEvent : //this->notifyMsg(::fwComEd::InteractionMsg::KEY_DOWN); //break; //case vtkCommand::KeyReleaseEvent : //this->notifyMsg(::fwComEd::InteractionMsg::KEY_UP); //break; case vtkCommand::MouseMoveEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_MOVE); break; case vtkCommand::MouseWheelForwardEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_WHEELFORWARD_DOWN); this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_WHEELFORWARD_UP); break; case vtkCommand::MouseWheelBackwardEvent : this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_WHEELBACKWARD_DOWN); this->notifyMsg(::fwComEd::InteractionMsg::MOUSE_WHEELBACKWARD_UP); break; default: OSLM_ASSERT("Unknown vtk event: " << vtkCommand::GetStringFromEventId(eventId) ,0); }; }
void WindowLevel::swapCurrentTFAndNotify( ::fwData::TransferFunction::sptr newTF ) { // Change TF std::string tfSelectionFwID = this->getTFSelectionFwID(); ::fwData::Composite::sptr pool = ::fwData::Composite::dynamicCast( ::fwTools::fwID::getObject( tfSelectionFwID ) ); OSLM_ASSERT( "Sorry, object with fwID " << tfSelectionFwID << " doesn't exist.", pool ); ::fwComEd::helper::Composite compositeHelper( pool ); compositeHelper.swap( this->getSelectedTFKey(), newTF ); // Notify change compositeHelper.notify( this->getSptr() ); }
static SPTR(DATATYPE) getAttribute( xmlNodePtr source, const std::string & name , bool isMandatory = true ) { SPTR(DATATYPE) castedData; xmlNodePtr fatherNode = XMLParser::findChildNamed( source, name ); if ( fatherNode ) { OSLM_ASSERT("Sorry, node '"<< name <<"' not instanced", fatherNode); xmlNodePtr node = ::fwXML::XMLParser::getChildrenXMLElement( fatherNode ); OSLM_ASSERT("Sorry, child node of '"<< name <<"' node not instanced", node); ::fwData::Object::sptr obj; obj = Serializer().ObjectsFromXml( node ); castedData = ::boost::dynamic_pointer_cast<DATATYPE>( obj ); OSLM_ASSERT("DynamicCast "<< ::fwCore::TypeDemangler<DATATYPE>().getFullClassname()<<" failed", castedData); } else if ( isMandatory ) { FW_RAISE("Sorry, attribute " << name << " is mandatory."); } return castedData; }
void Vector::add( ::fwData::Object::sptr _newObject ) { ::fwData::Vector::sptr vector = m_vector.lock(); OSLM_ASSERT( "The object " << _newObject->getID() << " must not exist in vector." , std::find(vector->begin(), vector->end(), _newObject) == vector->end()); // Modify vector vector->getContainer().push_back(_newObject ); // Modify message m_vectorMsg->appendAddedObject( _newObject ); }
void SliceIndexPositionEditor::sliceIndexNotification( unsigned int index) { // Fire the message ::fwComEd::ImageMsg::NewSptr msg; msg->setSliceIndex( m_axialIndex, m_frontalIndex, m_sagittalIndex); ::fwData::Image::sptr image = this->getObject< ::fwData::Image >(); std::string fieldID = *SLICE_INDEX_FIELDID[m_orientation]; OSLM_ASSERT("Field "<<fieldID<<" is missing", image->getField( fieldID )); image->getField< ::fwData::Integer >( fieldID )->value() = index; ::fwServices::IEditionService::notify(this->getSptr(), image, msg); }
void SCameraConfigLauncher::onExtrinsicToggled(bool checked) { const size_t index = static_cast<size_t>(m_cameraComboBox->currentIndex()); OSLM_ASSERT("Bad index: " << index, index < m_cameraSeries->getNumberOfCameras()); if (checked) { this->startExtrinsicConfig(index); } else { this->startIntrinsicConfig(index); } }
void Vector::remove( ::fwData::Object::sptr _oldObject ) { ::fwData::Vector::sptr vector = m_vector.lock(); ::fwData::Vector::iterator iter = std::find(vector->begin(), vector->end(), _oldObject); OSLM_ASSERT( "The object " << _oldObject->getID() << " must exist in vector." , iter != vector->end()); // Modify vector vector->getContainer().erase( iter ); // Modify message m_vectorMsg->appendRemovedObject( _oldObject ); }