示例#1
0
void WriteMesh::write_mesh( const Mesh& mesh, const URI& file, const std::vector<URI>& fields)
{
  update_list_of_available_writers();

  /// @todo this should be improved to allow http(s) which would then upload the mesh
  ///       to a remote location after writing to a temporary file
  ///       uploading can be achieved using the curl library (which we already search for in the build system)

  URI filepath = file;

  if( filepath.scheme() != URI::Scheme::FILE )
    filepath.scheme( URI::Scheme::FILE );


  const std::string extension = filepath.extension();

  if ( m_extensions_to_writers.count(extension) == 0 )
    throw FileFormatError (FromHere(), "No meshwriter exists for files with extension " + extension);

  if (m_extensions_to_writers[extension].size()>1)
  {
     std::string msg;
     msg = filepath.string() + " has ambiguous extension " + extension + "\n"
       +  "Possible writers for this extension are: \n";
     boost_foreach(const Handle< MeshWriter > writer , m_extensions_to_writers[extension])
       msg += " - " + writer->name() + "\n";
     throw FileFormatError( FromHere(), msg);
   }
示例#2
0
  XmlNode Protocol::add_signal_frame ( XmlNode& node, const std::string & target,
                                       const URI & sender, const URI & receiver,
                                       bool user_trans )
  {
    cf3_assert(sender.scheme() == URI::Scheme::CPATH);
    cf3_assert(receiver.scheme() == URI::Scheme::CPATH);

    XmlNode signalnode = node.add_node( Tags::node_frame() );

    signalnode.set_attribute( "type", Tags::node_type_signal() );
    signalnode.set_attribute( "target", target );
    signalnode.set_attribute( "sender", sender.string() );
    signalnode.set_attribute( "receiver", receiver.string() );
    signalnode.set_attribute( "transaction", user_trans ? "user" : "auto" );
    signalnode.set_attribute( "frameid", common::UUCount().string() );

    return signalnode;
  }
示例#3
0
  XmlNode Protocol::add_signal_frame ( XmlNode& node, const std::string & target,
                                       const URI & sender, const URI & receiver,
                                       bool user_trans )
  {
    cf_assert(sender.scheme() == URI::Scheme::CPATH);
    cf_assert(receiver.scheme() == URI::Scheme::CPATH);

    std::string uuid = boost::lexical_cast<std::string>(boost::uuids::random_generator()());

    XmlNode signalnode = node.add_node( Tags::node_frame() );

    signalnode.set_attribute( "type", Tags::node_type_signal() );
    signalnode.set_attribute( "target", target );
    signalnode.set_attribute( "sender", sender.string() );
    signalnode.set_attribute( "receiver", receiver.string() );
    signalnode.set_attribute( "transaction", user_trans ? "user" : "auto" );
    signalnode.set_attribute( "frameid", uuid );

    return signalnode;
  }
示例#4
0
void GraphicalUriArray::btAddClicked()
{

  if(m_editAdd->text().isEmpty())
  {
    if(m_comboType->currentText() == "cpath")
    {
      SelectPathDialog spd;
      QString modified_path = m_editAdd->text();

      URI path = spd.show(modified_path.toStdString());

      if(!path.empty())
        m_editAdd->setText( path.string().c_str() );
    }
    else if(m_comboType->currentText() == "file")
    {
      NRemoteOpen::Ptr nro = NRemoteOpen::create();

      QStringList fileList = nro->showMultipleSelect("");
      QStringList::iterator file = fileList.begin();

      for( ; file != fileList.end() ; ++ file)
      {
        file->prepend( m_comboType->currentText() + ':' );
      }

      if(!fileList.isEmpty())
        m_model->setStringList( m_model->stringList() << fileList );
    }
  }

  if(!m_editAdd->text().isEmpty())
  {
    QString pathStr = m_editAdd->text();

    if( !pathStr.startsWith(m_comboType->currentText()) )
      pathStr.prepend(m_comboType->currentText() + ':');

    m_model->setStringList( m_model->stringList() << pathStr );
    m_editAdd->clear();
  }

  emit valueChanged();
}
 Common_API std::string to_str<URI> (const URI & v)
 {
   return v.string();
 }