Commit 21f2efdc authored by fw4splbot's avatar fw4splbot
Browse files

merge(dev): release 16.0.0

parents 6ee4605b cfff1dce
......@@ -368,7 +368,7 @@ void SDynamicView::buildMainActivity()
SDynamicView::SDynamicViewInfo SDynamicView::createViewInfo(::fwMedData::ActivitySeries::sptr activitySeries)
{
ReplaceMapType replaceMap;
this->translateParameters(this->getObject(), m_parameters, replaceMap);
this->translateParameters(m_parameters, replaceMap);
::fwActivities::registry::ActivityInfo info;
info = ::fwActivities::registry::Activities::getDefault()->getInfo(activitySeries->getActivityConfigId());
......
......@@ -138,7 +138,7 @@ void SSignalButton::configuring()
::fwRuntime::ConfigurationElement::sptr iconCfg = config->findConfigurationElement("icon");
if (iconCfg)
{
m_icon = ::boost::filesystem::path(iconCfg->getValue());
m_icon = ::fwRuntime::getBundleResourceFilePath(iconCfg->getValue());
}
::fwRuntime::ConfigurationElement::sptr txt2Cfg = config->findConfigurationElement("text2");
......
......@@ -21,7 +21,54 @@ namespace editor
{
/**
* @brief Defines the service interface managing the editor service for object.
* @brief This service displays a list of available readers or writers and lets you select one to load or save a data.
*
* @section Signals Signals
* - \b jobCreated(::fwJobs::IJob::sptr) : emitted when a job is created.
*
* @section Slots Slots
* - \b forwardJob(::fwJobs::IJob::sptr ) : slot connected to the reader/writer to forward the signal 'jobCreated'
*
* @section XML XML Configuration
*
* Sample of configuration :
* @code{.xml}
<service uid="..." type="::uiIO::editor::SIOSelector">
<inout key="data" uid="${selection}" />
<type mode="writer" />
<selection mode="include" />
<addSelection service="::ioAtoms::SWriter" />
<config id="ioAtomsConfig" service="::ioAtoms::SWriter" />
</service>
* @endcode
*
* Readers can generate output data. In this case, you must define the type of the output data.
*
* @code{.xml}
<service uid="..." type="::uiIO::editor::SIOSelector">
<out key="data" uid="image" />
<type mode="reader" class="::fwData::Image" />
<selection mode="include" />
<addSelection service="::ioAtoms::SReader" />
</service>
* @endcode
*
* @subsection In-Out In-Out
* - \b data [::fwData::Object]: the read or saved object.
* @subsection Output Output
* - \b data [::fwData::Object]: the loaded object (not used if an inout data is defined).
* @subsection Configuration Configuration
* - \b type
* - \b mode (mandatory) : selector type must be "reader" (to open file) or "writer" (to write a new file).
* - \b data (mandatory if the object is set as an output): classname of the object to read
* - \b selection
* - \b mode (mandatory) : must be include (to add the selection to selector list ) or exclude (to exclude the
* selection of the selector list).
* - \b addSelection
* - \b service (mandatory) : Name of the service to include/exclude to the choice list of the selector.
* - \b config
* - \b id (mandatory) : the id of the configuration to use.
* - \b service (mandatory) : the name of the service.
*/
class UIIO_CLASS_API SIOSelector : public ::fwGui::editor::IDialogEditor
{
......@@ -70,29 +117,6 @@ protected:
*
* The method verifies if the configuration is well written and retrieves user parameter values.
* Thanks to this method, SIOSelector::m_selectedServices value is up to date (cleared before reconfiguring).
*
* Sample of configuration :
* @code{.xml}
<service uid="GENERIC_UID_writer" type="::fwGui::editor::IDialogEditor" impl="::uiIO::editor::SIOSelector"
* autoConnect="no">
<type mode="writer" />
<selection mode="include" />
<addSelection service="::ioAtoms::SWriter" />
<config id="ioAtomsConfig" service="::ioAtoms::SWriter" />
</service>
* @endcode
* With :
* None of these parameters are mandatory.
* - \b type
* - \b mode (mandatory) : selector type must be "reader" (to open file) or "writer" (to write a new file).
* - \b selection
* - \b mode (mandatory) : must be include (to add the selection to selector list ) or exclude (to exclude the
* selection of the selector list).
* - \b addSelection
* - \b service (mandatory) : Name of the service to include/exclude to the choice list of the selector.
* - \b config
* - \b id (mandatory) : the id of the configuration to use.
* - \b service (mandatory) : the name of the service.
**/
UIIO_API void configuring() override;
......@@ -123,7 +147,8 @@ private:
/// Map that specifies a configuration extension for a service
std::map< std::string, std::string > m_serviceToConfig;
std::string m_inject;
/// classname of the readed object (used if the data is set as output instead of inout)
std::string m_dataClassname;
SPTR(JobCreatedSignalType) m_sigJobCreated;
SPTR(ForwardJobSlotType) m_slotForwardJob;
......
......@@ -12,6 +12,8 @@
#include <fwGui/Cursor.hpp>
#include <fwIO/ioTypes.hpp>
#include <fwJobs/IJob.hpp>
#include <fwMedData/Series.hpp>
......@@ -89,9 +91,8 @@ void SExportWithSeriesDB::updating( )
// Init and execute the service
::fwServices::IService::sptr ioSelectorSrv;
ioSelectorSrv = ::fwServices::add(localSeriesDB,
"::fwGui::editor::IDialogEditor",
"::uiIO::editor::SIOSelector");
ioSelectorSrv = ::fwServices::add( "::uiIO::editor::SIOSelector");
ioSelectorSrv->registerInOut(localSeriesDB, ::fwIO::s_DATA_KEY);
ioSelectorSrv->setWorker(m_associatedWorker);
......
......@@ -12,6 +12,8 @@
#include <fwGui/Cursor.hpp>
#include <fwIO/ioTypes.hpp>
#include <fwJobs/IJob.hpp>
#include <fwMedData/Series.hpp>
......@@ -94,10 +96,8 @@ void SSeriesDBMerger::updating( )
// Init and execute the service
::fwServices::IService::sptr ioSelectorSrv;
ioSelectorSrv = ::fwServices::add(localSeriesDB,
"::fwGui::editor::IDialogEditor",
"::uiIO::editor::SIOSelector");
ioSelectorSrv = ::fwServices::add("::uiIO::editor::SIOSelector");
ioSelectorSrv->registerInOut(localSeriesDB, ::fwIO::s_DATA_KEY);
ioSelectorSrv->setWorker(m_associatedWorker);
auto jobCreatedSignal = ioSelectorSrv->signal("jobCreated");
......
......@@ -31,6 +31,8 @@
#include <fwServices/registry/ServiceConfig.hpp>
#include <fwServices/registry/ServiceFactory.hpp>
#include <boost/foreach.hpp>
#include <sstream>
#include <string>
......@@ -61,115 +63,111 @@ SIOSelector::SIOSelector() :
SIOSelector::~SIOSelector() noexcept
{
SLM_TRACE_FUNC();
}
//------------------------------------------------------------------------------
void SIOSelector::configuring()
{
SLM_TRACE_FUNC();
bool vectorIsAlreadyCleared = false;
const ConfigType srvConfig = this->getConfigTree();
// Config Elem
// <selection mode="include" />
// <addSelection service="::ioAtoms::SWriter" />
const std::string mode = srvConfig.get<std::string>("type.<xmlattr>.mode", "reader");
SLM_ASSERT("The xml attribute <mode> must be 'reader' (to open file) or 'writer' (to write a new file).",
mode == "writer" || mode == "reader" );
m_mode = ( mode == "writer" ) ? WRITER_MODE : READER_MODE;
SLM_DEBUG( "mode => " + mode );
::fwRuntime::ConfigurationElementContainer::Iterator iter = this->m_configuration->begin();
for(; iter != this->m_configuration->end(); ++iter )
{
OSLM_INFO( "SIOSelector " << (*iter)->getName());
m_dataClassname = srvConfig.get<std::string>("type.<xmlattr>.class", "");
if( (*iter)->getName() == "selection" )
{
SLM_ASSERT( "The xml element <selection> must have the attribute 'mode'.", (*iter)->hasAttribute("mode"));
std::string mode = (*iter)->getExistingAttributeValue("mode");
m_servicesAreExcluded = ( mode == "exclude" );
SLM_ASSERT( "The xml attribute <mode> must be 'include' (to add the selection to selector list ) or "
"'exclude' (to exclude the selection of the selector list).",
mode == "exclude" || mode == "include" );
OSLM_DEBUG( "mode => " << mode );
}
if( (*iter)->getName() == "addSelection" )
{
if( !vectorIsAlreadyCleared )
{
vectorIsAlreadyCleared = true;
m_selectedServices.clear();
}
SLM_ASSERT( "The xml elemenet <addSelection> must have the attribute 'service'.",
(*iter)->hasAttribute("service"));
m_selectedServices.push_back( (*iter)->getExistingAttributeValue("service") );
OSLM_DEBUG( "add selection => " << (*iter)->getExistingAttributeValue("service") );
}
const std::string selectionMode = srvConfig.get<std::string>("selection.<xmlattr>.mode", "exclude");
SLM_ASSERT( "The xml attribute <mode> must be 'include' (to add the selection to selector list ) or "
"'exclude' (to exclude the selection of the selector list).",
selectionMode == "exclude" || selectionMode == "include" );
m_servicesAreExcluded = ( selectionMode == "exclude" );
SLM_DEBUG( "selection mode => " + selectionMode );
if( (*iter)->getName() == "type" )
{
SLM_ASSERT( "The xml elemenet <type> must have the attribute 'mode'.", (*iter)->hasAttribute("mode"));
std::string mode = (*iter)->getExistingAttributeValue("mode");
SLM_ASSERT("The xml attribute <mode> must be 'reader' (to open file) or 'writer' (to write a new file).",
mode == "writer" || mode == "reader" );
m_mode = ( mode == "writer" ) ? WRITER_MODE : READER_MODE;
OSLM_DEBUG( "mode => " << mode );
}
const auto selectionCfg = srvConfig.equal_range("addSelection");
for (auto itSelection = selectionCfg.first; itSelection != selectionCfg.second; ++itSelection)
{
const std::string service = itSelection->second.get<std::string>("<xmlattr>.service");
m_selectedServices.push_back(service);
SLM_DEBUG( "add selection => " + service );
if( (*iter)->getName() == "config" )
const std::string configId = itSelection->second.get<std::string>("<xmlattr>.config", "");
if(!configId.empty())
{
SLM_ASSERT( "The xml element <config> must have the attribute 'id'.", (*iter)->hasAttribute("id"));
SLM_ASSERT( "The xml element <config> must have the attribute 'service'.",
(*iter)->hasAttribute("service"));
std::string configId = (*iter)->getExistingAttributeValue("id");
std::string configSrv = (*iter)->getExistingAttributeValue("service");
m_serviceToConfig[ configSrv ] = configId;
m_serviceToConfig[service] = configId;
SLM_DEBUG( "add config '" + configId + "' for service '" + service + "'");
}
}
typedef std::vector < SPTR(::fwRuntime::ConfigurationElement) > ConfigurationElementContainer;
ConfigurationElementContainer inject = m_configuration->find("inject");
if(!inject.empty())
const auto configCfg = srvConfig.equal_range("config");
for (auto itCfg = configCfg.first; itCfg != configCfg.second; ++itCfg)
{
m_inject = inject.at(0)->getValue();
}
const std::string service = itCfg->second.get<std::string>("<xmlattr>.service");
const std::string configId = itCfg->second.get<std::string>("<xmlattr>.id");
m_serviceToConfig[service] = configId;
SLM_DEBUG( "add config '" + configId + "' for service '" + service + "'");
}
}
//------------------------------------------------------------------------------
void SIOSelector::starting()
{
SLM_TRACE_FUNC();
}
//------------------------------------------------------------------------------
void SIOSelector::stopping()
{
SLM_TRACE_FUNC();
}
//------------------------------------------------------------------------------
void SIOSelector::updating()
{
SLM_TRACE_FUNC();
bool createOutput = false;
::fwData::Object::sptr obj = this->getInOut< ::fwData::Object>(::fwIO::s_DATA_KEY);
// Retrieve implementation of type ::fwIO::IReader for this object
std::vector< std::string > availableExtensionsId;
if ( m_mode == READER_MODE )
{
std::string classname = m_dataClassname;
// FIXME: support for old version using getObject(): all the 'in' or 'inout' keys were possible
if (!obj && classname.empty())
{
FW_DEPRECATED_MSG("The object to read is not set correctly, you must set '" + ::fwIO::s_DATA_KEY
+ "' as <inout> or define the 'class' of the output object");
obj = this->getObject();
}
if (obj)
{
SLM_WARN_IF("The 'class' attribute is defined, but the object is set as 'inout', only the object classname "
"is used", !classname.empty())
classname = obj->getClassname();
}
createOutput = (!obj && !m_dataClassname.empty());
availableExtensionsId =
::fwServices::registry::ServiceFactory::getDefault()->getImplementationIdFromObjectAndType(
this->getObject()->getClassname(), "::fwIO::IReader");
classname, "::fwIO::IReader");
}
else // m_mode == WRITER_MODE
{
// FIXME: support for old version using getObject(): all the 'in' or 'inout' keys were possible
if (!obj)
{
FW_DEPRECATED_MSG("The object to save is not set correctly, you must set '" + ::fwIO::s_DATA_KEY
+ "' as <inout>");
obj = this->getObject();
}
availableExtensionsId =
::fwServices::registry::ServiceFactory::getDefault()->getImplementationIdFromObjectAndType(
this->getObject()->getClassname(), "::fwIO::IWriter");
obj->getClassname(), "::fwIO::IWriter");
}
// Filter available extensions and replace id by service description
......@@ -275,33 +273,14 @@ void SIOSelector::updating()
// Configure and start service
if ( m_mode == READER_MODE )
{
::fwData::Object::sptr object;
if(m_inject.empty() || this->getObject()->getClassname().compare("::fwData::Composite") )
if(createOutput)
{
object = this->getObject< ::fwData::Object >();
}
else
{
::fwServices::registry::ServiceFactory::sptr services =
::fwServices::registry::ServiceFactory::getDefault();
std::string objType = services->getServiceObjects(extensionId)[0];
if(!objType.compare("::fwData::Object"))
{
object = this->getObject< ::fwData::Composite>();
}
else
{
object = ::fwData::factory::New(objType);
::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite>();
::fwDataTools::helper::Composite helper(composite);
helper.add(m_inject, object);
helper.notify();
}
obj = ::fwData::factory::New(m_dataClassname);
SLM_ASSERT("Cannot create object with classname='" + m_dataClassname + "'", obj);
}
::fwIO::IReader::sptr reader = ::fwServices::add< ::fwIO::IReader >( extensionId );
reader->registerInOut(this->getObject(), ::fwIO::s_DATA_KEY);
reader->registerInOut(obj, ::fwIO::s_DATA_KEY);
reader->setWorker(m_associatedWorker);
if ( hasConfigForService )
......@@ -328,6 +307,11 @@ void SIOSelector::updating()
reader->stop();
::fwServices::OSR::unregisterService(reader);
if (createOutput)
{
this->setOutput(::fwIO::s_DATA_KEY, obj);
}
}
catch (std::exception& e)
{
......@@ -344,7 +328,7 @@ void SIOSelector::updating()
auto factory = ::fwServices::registry::ServiceFactory::getDefault();
::fwIO::IWriter::sptr writer =
::fwIO::IWriter::dynamicCast(factory->create( "::fwIO::IWriter", extensionId));
::fwServices::OSR::registerService(this->getObject(), ::fwIO::s_DATA_KEY,
::fwServices::OSR::registerService(obj, ::fwIO::s_DATA_KEY,
::fwServices::IService::AccessType::INPUT, writer);
writer->setWorker(m_associatedWorker);
......
......@@ -17,6 +17,7 @@ set( DEPENDENCIES
fwServices
fwTools
fwDataTools
fwIO
)
set( REQUIREMENTS
uiImageQt
......
......@@ -21,6 +21,8 @@
#include <fwDataCamp/getObject.hpp>
#include <fwDataCamp/visitor/CompareObjects.hpp>
#include <fwIO/ioTypes.hpp>
#include <fwMedData/Patient.hpp>
#include <fwMedData/Series.hpp>
#include <fwMedData/SeriesDB.hpp>
......@@ -684,9 +686,8 @@ void ActivityDataView::importObject()
bool ActivityDataView::readObject(::fwData::Object::sptr obj)
{
::fwServices::IService::sptr ioSelectorSrv;
ioSelectorSrv = ::fwServices::add(obj,
"::fwGui::editor::IDialogEditor",
"::uiIO::editor::SIOSelector");
ioSelectorSrv = ::fwServices::add("::uiIO::editor::SIOSelector");
ioSelectorSrv->registerInOut(obj, ::fwIO::s_DATA_KEY);
::fwRuntime::ConfigurationElement::csptr ioCfg;
ioCfg = ::fwServices::registry::ServiceConfig::getDefault()->getServiceConfig(m_ioSelectorSrvConfig,
......
......@@ -7,6 +7,7 @@ set( DEPENDENCIES
fwRuntime
fwServices
fwCom
fwPreferences
)
set( REQUIREMENTS )
......@@ -15,6 +15,8 @@
#include <fwGui/dialog/LocationDialog.hpp>
#include <fwPreferences/helper.hpp>
#include <fwServices/macros.hpp>
#include <fwServices/registry/ObjectService.hpp>
......@@ -58,12 +60,9 @@ void SPreferencesConfiguration::starting()
this->actionServiceStarting();
// Check preferences
auto preferencesServicesList = ::fwServices::OSR::getServices("::fwPreferences::IPreferences");
if(!preferencesServicesList.empty())
::fwData::Composite::sptr prefs = ::fwPreferences::getPreferences();
if(prefs)
{
const ::fwServices::IService::sptr prefService = *preferencesServicesList.begin();
::fwData::Composite::sptr prefs = prefService->getObject< ::fwData::Composite >();
for(PreferenceElt& pref : m_preferences)
{
pref.m_dataPreference = ::fwData::String::New(pref.m_defaultValue);
......
fwLoadProperties()
find_package(Boost QUIET COMPONENTS regex REQUIRED)
fwForwardInclude(
${Boost_INCLUDE_DIRS}
)
fwForwardLink(
${Boost_REGEX_LIBRARY}
)
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2017.
* FW4SPL - Copyright (C) IRCAD, 2009-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#ifndef __VISUVTKADAPTOR_SSNAPSHOT_HPP__
#define __VISUVTKADAPTOR_SSNAPSHOT_HPP__
#pragma once
#include "visuVTKAdaptor/config.hpp"
#include <fwCom/Slot.hpp>
#include <fwCom/Slots.hpp>
#include <fwRenderVTK/IAdaptor.hpp>
namespace visuVTKAdaptor
......@@ -85,5 +81,3 @@ private:
};
} //namespace visuVTKAdaptor
#endif // __VISUVTKADAPTOR_SSNAPSHOT_HPP__
......@@ -33,7 +33,6 @@
#include <fwVtkIO/vtk.hpp>
#include <boost/foreach.hpp>
#include <boost/regex.h>
#include <vtkImageBlend.h>
#include <vtkImageCheckerboard.h>
......@@ -41,6 +40,8 @@
#include <vtkImageMapToColors.h>
#include <vtkLookupTable.h>
#include <regex>
fwServicesRegisterMacro( ::fwRenderVTK::IAdaptor, ::visuVTKAdaptor::SImagesBlend, ::fwData::Composite );
namespace visuVTKAdaptor
......@@ -159,10 +160,11 @@ void SImagesBlend::configuring()
void SImagesBlend::swapping(const KeyType& key)
{
const std::string regexStr = "([[:word:]]+)#([[:digit:]]+)";
::boost::regex re(regexStr);
::boost::smatch match;
if( ::boost::regex_match(key, match, re) )
const std::string regexStr = "([[:alnum:]]+)#([[:digit:]]+)";
const std::regex re(regexStr);
std::smatch match;
if( std::regex_match(key, match, re) )
{
const std::string group = match[1];
const unsigned long index = std::stoul(match[2]);
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2017.
* FW4SPL - Copyright (C) IRCAD, 2009-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#include "visuVTKAdaptor/SSnapshot.hpp"
#include <fwCom/Slot.hpp>
#include <fwCom/Slot.hxx>
#include <fwCom/Slots.hpp>
#include <fwCom/Slots.hxx>
#include <fwData/Composite.hpp>
......@@ -20,7 +17,7 @@
#include <fwVtkIO/vtk.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <vtkActor.h>
#include <vtkBMPWriter.h>
......
......@@ -311,9 +311,10 @@ function(add_precompiled_header _target _input)
# Hacky custom command to remove the custom defines that would prevent from sharing the pch
# and they should be useless anyway
# Also, we strip "/usr/include" as CMake does for regular C++ files (otherwise we may hide our bin pkgs headers)
add_custom_command(
OUTPUT "${_pch_flags_file}"
COMMAND sed 's/"/\\\\"/g' ${_pch_response_file}.in | sed '/_VER=\\\|_EXPORTS/d' > ${_pch_flags_file}
COMMAND sed 's/"/\\\\"/g' ${_pch_response_file}.in | sed '/_VER=\\\|_EXPORTS/d' | sed '/-isystem\\/usr\\/include$$/d' > ${_pch_flags_file}
DEPENDS "${_pch_flags_file}.in"
COMMENT "Fixing ${_pch_flags_file}")
......
# Doxyfile 1.8.7
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = fw4spl
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/Documentation/Docset
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO