Ejemplo n.º 1
0
///////////////////////////////////////////////////////////////////////////////
// alle Dateien schließen und löschen
HRESULT CArcViewLayer::CloseAndDeleteFiles()
{
	RETURN_FAILED_HRESULT(Close());

os_path pathRoot (m_strRoot);

	pathRoot.extension (g_cbShp);
	RETURN_EXPR_FALSE(DeleteFile(os_string(pathRoot).c_str()), HRESULT_FROM_WIN32(GetLastError()));

	pathRoot.extension (g_cbShx);
	RETURN_EXPR_FALSE(DeleteFile(os_string(pathRoot).c_str()), HRESULT_FROM_WIN32(GetLastError()));

	pathRoot.extension (g_cbDbf);
	RETURN_EXPR_FALSE(DeleteFile(os_string(pathRoot).c_str()), HRESULT_FROM_WIN32(GetLastError()));

	return S_OK;
}
Ejemplo n.º 2
0
    void LocationModelManager::setModelPath(ModelId mid, LocationPathName const &name)
    {
        if(LocationModel::EMPTY_PATH == name)
        {
            Debug::error(STEEL_METH_INTRO, "path name cannot be the empty string").endl();
            return;
        }

        LocationModel *model = at(mid);

        if(nullptr == model)
            return;

        model->_setPath(name);

        // model is the default root of its path
        if(INVALID_ID == pathRoot(name))
        {
            setPathRoot(model->attachedAgent());
        }
    }
void TransferFunctionEditor::initTransferFunctions()
{
    // Get transfer function composite (pool TF)
    ::fwData::Composite::sptr poolTF = this->getObject< ::fwData::Composite >( );

    ::fwComEd::helper::Composite compositeHelper(poolTF);

    const std::string defaultTFName = ::fwData::TransferFunction::s_DEFAULT_TF_NAME;
    if(!this->hasTransferFunctionName(defaultTFName))
    {
        ::fwData::TransferFunction::sptr defaultTf = ::fwData::TransferFunction::createDefaultTF();
        defaultTf->setWindow( 50. );
        defaultTf->setLevel( 500. );
        compositeHelper.add(defaultTFName, defaultTf);
    }

    // Test if transfer function composite has few TF
    if( poolTF->size() <= 1 )
    {
        // Parse all TF contained in uiTF Bundle's resources
        std::vector< ::boost::filesystem::path > paths;
        ::boost::filesystem::path pathRoot ("Bundles/uiTF_" + std::string(UITF_VER) + "/tf");
        for(::boost::filesystem::directory_iterator it(pathRoot);
            it != ::boost::filesystem::directory_iterator();
            ++it )
        {
            if(! ::boost::filesystem::is_directory(*it) &&
                 ::boost::filesystem::extension(*it) == ".json")
            {
                paths.push_back(*it);
            }
        }

        ::fwData::TransferFunction::sptr tf = ::fwData::TransferFunction::New();
        ::fwServices::IService::sptr srv =
                ::fwServices::registry::ServiceFactory::getDefault()->create("::ioAtoms::SReader");
        ::fwServices::OSR::registerService(tf, srv);
        ::io::IReader::sptr reader = ::io::IReader::dynamicCast(srv);

        ::fwRuntime::EConfigurationElement::sptr srvCfg = ::fwRuntime::EConfigurationElement::New("service");
        ::fwRuntime::EConfigurationElement::sptr fileCfg = ::fwRuntime::EConfigurationElement::New("file");
        srvCfg->addConfigurationElement(fileCfg);

        BOOST_FOREACH( ::boost::filesystem::path file, paths )
        {
            fileCfg->setValue(file.string());
            reader->setConfiguration(srvCfg);
            reader->configure();
            reader->start();
            reader->update();
            reader->stop();

            if (!tf->getName().empty())
            {
                ::fwData::TransferFunction::sptr newTF = ::fwData::Object::copy< ::fwData::TransferFunction >(tf);
                if( this->hasTransferFunctionName( newTF->getName() ) )
                {
                    newTF->setName( this->createTransferFunctionName( newTF->getName() ) );
                }

                compositeHelper.add(newTF->getName(), newTF);
            }
            tf->initTF();
        }