コード例 #1
0
ファイル: ExportFunctions.cpp プロジェクト: MeisterYeti/MinSG
void SceneManagement::saveMinSGStream(SceneManager & sm, std::ostream & out, const std::deque<Node *> & nodes) {
	if(!out.good())
		throw std::runtime_error("Cannot save MinSG nodes to the given stream.");

	ExporterContext ctxt(sm);
	std::unique_ptr<DescriptionMap> description(ExporterTools::createDescriptionForScene(ctxt, nodes));
	if(!WriterMinSG::save(out, *(description.get())))
		throw std::runtime_error("Could not serialize MinSG nodes.");
}
コード例 #2
0
ファイル: PlanarPortal.cpp プロジェクト: alecjacobson/scisim
void PlanarPortal::serialize( std::ostream& output_stream ) const
{
  assert( output_stream.good() );
  m_plane_a.serialize( output_stream );
  m_plane_b.serialize( output_stream );
  Utilities::serialize( m_v, output_stream );
  Utilities::serialize( m_bounds, output_stream );
  Utilities::serialize( m_dx, output_stream );
}
コード例 #3
0
 bool EdgeSE3PointXYZ::write(std::ostream& os) const {
   os << offsetParam->id() << " ";
   for (int i=0; i<3; i++) os  << measurement()[i] << " ";
   for (int i=0; i<information().rows(); i++)
     for (int j=i; j<information().cols(); j++) {
       os <<  information()(i,j) << " ";
     }
   return os.good();
 }
コード例 #4
0
ファイル: edge_se2.cpp プロジェクト: pangfumin/g2o
 bool EdgeSE2::write(std::ostream& os) const
 {
   Vector3 p = measurement().toVector();
   os << p.x() << " " << p.y() << " " << p.z();
   for (int i = 0; i < 3; ++i)
     for (int j = i; j < 3; ++j)
       os << " " << information()(i, j);
   return os.good();
 }
コード例 #5
0
ファイル: edge_pointxy.cpp プロジェクト: mikejmills/g2o
 bool EdgePointXY::write(std::ostream& os) const
 {
   Vector2d p = measurement();
   os << p.x() << " " << p.y();
   for (int i = 0; i < 2; ++i)
     for (int j = i; j < 2; ++j)
       os << " " << information()(i, j);
   return os.good();
 }
コード例 #6
0
ファイル: json_encode.cpp プロジェクト: DaveInga/mFAST
 bool encode(std::ostream&                  os,
             const ::mfast::aggregate_cref& msg,
             unsigned                       json_object_tag_mask,
             unsigned                       ignore_tag_mask)
 {
   encode_detail::json_visitor_with_ignore_tag visitor(os, json_object_tag_mask, ignore_tag_mask);
   visitor.visit(msg, 0);
   return os.good();
 }
コード例 #7
0
ファイル: edge_se3.cpp プロジェクト: rmihalyi/g2o
bool EdgeSE3::write(std::ostream& os) const {
    Vector7d meas=toVectorQT(_measurement);
    for (int i=0; i<7; i++) os  << meas[i] << " ";
    for (int i=0; i<information().rows(); i++)
        for (int j=i; j<information().cols(); j++) {
            os <<  information()(i,j) << " ";
        }
    return os.good();
}
コード例 #8
0
ファイル: edge_line2d.cpp プロジェクト: 2maz/g2o
 bool EdgeLine2D::write(std::ostream& os) const
 {
   for (int i = 0; i < 2; ++i)
     os << _measurement[i] << " ";
   for (int i = 0; i < 2; ++i)
     for (int j = i; j < 2; ++j)
       os << " " << information()(i, j);
   return os.good();
 }
コード例 #9
0
// ================================================
bool EdgeSE3Switchable::write(std::ostream& os) const
{
    g2o::Vector7d meas = g2o::internal::toVectorQT(measurement());
    for (int i=0; i<7; i++) os  << meas[i] << " ";
    for (int i = 0; i < 6; ++i)
      for (int j = i; j < 6; ++j)
        os << " " << information()(i, j);
    return os.good();
}
コード例 #10
0
ファイル: edge_se2_segment2d_line.cpp プロジェクト: 2maz/g2o
 bool EdgeSE2Segment2DLine::write(std::ostream& os) const
 {
   for (size_t i = 0; i < 2 ; i++)
     os << _measurement[i] << " ";
   for (size_t i = 0; i < 2 ; i++)
     for (size_t j = i; j < 2 ; j++) {
       os << _information (i,j) << " ";
     }
   return os.good();
 }
コード例 #11
0
void GeometricImpactFrictionMap::serialize( std::ostream& output_stream ) const
{
  assert( output_stream.good() );
  MathUtilities::serialize( m_f, output_stream );
  Utilities::serialize( m_abs_tol, output_stream );
  Utilities::serialize( m_max_iters, output_stream );
  Utilities::serialize( m_impulses_to_cache, output_stream );
  assert( m_write_constraint_forces == false );
  assert( m_constraint_force_stream == nullptr );
}
コード例 #12
0
ファイル: edge_plane.cpp プロジェクト: mikejmills/g2o
bool EdgePlane::write(std::ostream& os) const
{
    int size=4;
    for (int i = 0; i < size; ++i)
        os << _measurement[i] << " ";
    for (int i = 0; i < size; ++i)
        for (int j = i; j < size; ++j)
            os << " " << information()(i, j);
    return os.good();
}
コード例 #13
0
ファイル: Utilities.cpp プロジェクト: alecjacobson/scisim
void Utilities::serialize<bool>( const std::vector<bool>& vector, std::ostream& output_stream )
{
  assert( output_stream.good() );
  serialize( vector.size(), output_stream );
  for( std::vector<bool>::size_type idx = 0; idx < vector.size(); ++idx )
  {
    const bool local_val = vector[idx];
    serialize( local_val, output_stream );
  }
}
コード例 #14
0
ファイル: edge_se3_plane_calib.cpp プロジェクト: 2maz/g2o
 bool EdgeSE3PlaneSensorCalib::write(std::ostream& os) const
 {
   Vector4D v = _measurement.toVector();
   os << v(0) << " " << v(1) << " " << v(2) << " " << v(3) << " ";
   os << color(0) << " " << color(1) << " " << color(2) << " ";
   for (int i = 0; i < information().rows(); ++i)
     for (int j = i; j < information().cols(); ++j)
       os << " " << information()(i, j);
   return os.good();
 }
コード例 #15
0
ファイル: memory.cpp プロジェクト: dcthe1/mars
void Memory::save( std::ostream& stream, const unsigned int& startPos, const unsigned int& length ) throw ( std::invalid_argument )
{
	if ( startPos >= m_size ) throw std::invalid_argument("Memory::save(): startPos >= m_size");
	unsigned int stopPos = std::min(m_size-1, startPos+length);
	for ( unsigned int i = startPos; i <= stopPos; i++ ) {
		if (!stream.good())
			break;
		stream.put(data[i]);
	}
}
コード例 #16
0
ファイル: parameter_camera.cpp プロジェクト: Florenc/g2o
 bool ParameterCamera::write(std::ostream& os) const {
   Vector7d off = offset().toVector();
   for (int i=0; i<7; i++)
     os << off[i] << " ";
   os << _Kcam(0,0) << " ";
   os << _Kcam(1,1) << " ";
   os << _Kcam(0,2) << " ";
   os << _Kcam(1,2) << " ";
   return os.good();
 }
コード例 #17
0
ファイル: edge_se3_offset.cpp プロジェクト: Aerobota/c2tam
 bool EdgeSE3Offset::write(std::ostream& os) const {
   os << _offsetFrom->id() << " " << _offsetTo->id() << " ";
   Vector7d meas=internal::toVectorQT(_measurement);
   for (int i=0; i<7; i++) os  << meas[i] << " ";
   for (int i=0; i<information().rows(); i++)
     for (int j=i; j<information().cols(); j++) {
       os <<  information()(i,j) << " ";
     }
   return os.good();
 }
コード例 #18
0
bool EdgeSE3Expmap::write(std::ostream& os) const {
    SE3Quat cam2world(measurement().inverse());
    for (int i=0; i<7; i++)
        os << cam2world[i] << " ";
    for (int i=0; i<6; i++)
        for (int j=i; j<6; j++) {
            os << " " <<  information()(i,j);
        }
    return os.good();
}
コード例 #19
0
ファイル: edge_point_plane.cpp プロジェクト: netbot-tamu/MFG
bool EdgePointPlane3d::write(std::ostream &os) const
{
    os  << measurement() << " ";

    for (int i = 0; i < information().rows(); i++)
        for (int j = i; j < information().cols(); j++)
            os <<  information()(i, j) << " ";

    return os.good();
}
コード例 #20
0
ファイル: bitmap.cpp プロジェクト: Sethis/ufo
bool c8bppBitmap::saveTo(std::ostream &file)
{
    if (!m_PixelData)
        return false;

    if (file.good())
        file.write((char*)m_PixelData, m_Width * m_Height);

    return !file.bad();
}
コード例 #21
0
ファイル: CsoundFile.cpp プロジェクト: BlakeJarvis/csound
int CsoundFile::exportArrangement(std::ostream &stream) const
{
  for(std::vector<std::string>::const_iterator it = arrangement.begin();
      it != arrangement.end();
      ++it)
    {
      stream << (*it).c_str() << std::endl;
    }
  return stream.good();
}
コード例 #22
0
/*-------------------------------------
    Saving a functor to an output stream
-------------------------------------*/
bool Functor::save(std::ostream& ostr) const {
    if (pNextFunc == nullptr) {
        ostr << 0 << ' ' << 0;
    }
    else {
        ostr << pNextFunc->get_script_subtype() << ' ' << (void*)pNextFunc;
    }
    
    return ostr.good();
}
コード例 #23
0
bool exportToGraphvizFormat_Image(
  const GraphT & g,
  const NodeMap & nodeMap,
  const EdgeMap & edgeMap,
  std::ostream & os, bool bWeightedEdge = false)
{
  os << "graph 1 {" << std::endl;
  os << "node [shape=none]" << std::endl;
  //Export node label
  for(typename GraphT::NodeIt n(g); n!=lemon::INVALID; ++n)
  {
    os << "  n" << g.id(n)
      << "[ label ="
      << "< "<< std::endl
      << "<table>" << std::endl
      << "<tr><td>" << "\"" << nodeMap[n] << "\"" << "</td></tr>" << std::endl
      << "<tr><td><img src=\"" << nodeMap[n] << "\"/></td></tr>" << std::endl
      << "</table>" << std::endl
      << ">, cluster=1];" << std::endl;

    //os << "  n" << g.id(n)
    //  << " [ "
    //  << " image=\"" << nodeMap[n] << "\" cluster=1]; " << endl;
  }

  //Export arc value
  std::map< std::pair<IndexT, IndexT>, IndexT > map_arcs;
  for(typename GraphT::ArcIt e(g); e!=lemon::INVALID; ++e) {
    if( map_arcs.end() == map_arcs.find(std::make_pair(IndexT(g.id(g.source(e))), IndexT(g.id(g.target(e)))))
      &&
      map_arcs.end() == map_arcs.find(std::make_pair(IndexT(g.id(g.target(e))), IndexT(g.id(g.source(e))))))
    {
      map_arcs[std::make_pair(IndexT(g.id(g.source(e))),
        IndexT(g.id(g.target(e)))) ] = edgeMap[e];
    }
  }

  os << "edge [style=bold]" << std::endl;
  for ( std::map< std::pair<IndexT,IndexT>, IndexT>::const_iterator iter = map_arcs.begin();
    iter != map_arcs.end();
    ++iter)
  {
    if (bWeightedEdge)
    {
      os << "  n" << iter->first.first << " -- " << " n" << iter->first.second
        << " [label=\"" << iter->second << "\"]" << std::endl;
    }
    else
    {
      os << "  n" << iter->first.first << " -- " << " n" << iter->first.second << std::endl;
    }
  }
  os << "}" << std::endl;
  return os.good();
}
コード例 #24
0
bool EdgeProjectXYZ2UVU::write(std::ostream& os) const {
    for (int i=0; i<3; i++) {
        os  << measurement()[i] << " ";
    }

    for (int i=0; i<3; i++)
        for (int j=i; j<3; j++) {
            os << " " << information()(i,j);
        }
    return os.good();
}
コード例 #25
0
bool EdgeInverseSim3ProjectXYZ::write(std::ostream &os) const {
  for (int i = 0; i < 2; i++) {
    os << _measurement[i] << " ";
  }

  for (int i = 0; i < 2; i++)
    for (int j = i; j < 2; j++) {
      os << " " << information()(i, j);
    }
  return os.good();
}
コード例 #26
0
// TODO: This constructor should use the utility functions to serialize
void StabilizedImpactFrictionMap::serialize( std::ostream& output_stream ) const
{
  assert( output_stream.good() );

  MathUtilities::serialize( m_f, output_stream );
  output_stream.write( (char*) &m_abs_tol, sizeof(scalar) );
  output_stream.write( (char*) &m_max_iters, sizeof(unsigned) );

  output_stream.write( (char*) &m_write_constraint_forces, sizeof(bool) );
  assert( m_constraint_force_stream == nullptr );
}
コード例 #27
0
 bool ParameterStereoCamera::write(std::ostream& os) const {
   Vector7 off = internal::toVectorQT(_offset);
   for (int i=0; i<7; i++)
     os << off[i] << " ";
   os << _Kcam(0,0) << " ";
   os << _Kcam(1,1) << " ";
   os << _Kcam(0,2) << " ";
   os << _Kcam(1,2) << " ";
   os << baseline() << " ";
   return os.good();
 }
コード例 #28
0
  bool EdgePointXYZCovPointXYZCov::write(std::ostream& os) const
  {
    /** the measurement should always be 0,0,0 and the information matrix is computed in computeError() */
//     for (int i=0; i<3; i++)
//       os << measurement()[i] << " ";
//     for (int i=0; i<3; i++)
//       for (int j=i; j<3; j++){
//         os << " " <<  information()(i,j);
//       }
    return os.good();
  }
コード例 #29
0
//TODO: implement, but first remove camera parameters from vertex state
bool G2oVertexSE3
::write(std::ostream& os) const
{
  std::cout << "write G2oVertexSE3 called" << "\n";
  const Sophus::SE3 & se3 = _estimate;
  const Vector3d & vec = se3.translation();
  for(int i=0; i<3; i++) os << vec[i] << " ";
  const Quaterniond & q = se3.unit_quaternion();
  os << q.x() << " " << q.y() << " " << q.z() << " " << q.w();
  return os.good();
}
コード例 #30
0
bool EdgeProjectPSI2UV::write(std::ostream& os) const  {
    os << _cam->id() << " ";
    for (int i=0; i<2; i++) {
        os << measurement()[i] << " ";
    }

    for (int i=0; i<2; i++)
        for (int j=i; j<2; j++) {
            os << " " <<  information()(i,j);
        }
    return os.good();
}