当前位置: 首页>>代码示例>>C++>>正文


C++ ON_BinaryArchive::ReadObject方法代码示例

本文整理汇总了C++中ON_BinaryArchive::ReadObject方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_BinaryArchive::ReadObject方法的具体用法?C++ ON_BinaryArchive::ReadObject怎么用?C++ ON_BinaryArchive::ReadObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ON_BinaryArchive的用法示例。


在下文中一共展示了ON_BinaryArchive::ReadObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

ON_BOOL32 
ON_CurveOnSurface::Read(
       ON_BinaryArchive& file // open binary file
     )
{
  delete m_c2; 
  delete m_c3; 
  m_c2 = 0;
  m_c3 = 0;
  delete m_s;
  m_s = 0;

  ON_Object *o=0;
  ON_BOOL32 rc = file.ReadObject(&o);
  if (rc && o) {
    m_c2 = ON_Curve::Cast(o);
    if ( !m_c2 ) {
      delete o;
    } rc = false;
  }

  o = 0;

  ON_BOOL32 bHasC3 = 0;
  rc = file.ReadInt( &bHasC3 );
  if ( rc && bHasC3 ) {
    if (rc)
      rc = file.ReadObject(&o);
    if ( rc && o ) {
      m_c2 = ON_Curve::Cast(o);
      if ( !m_c2 ) {
        delete o;
      } rc = false;
    }
  }

  o = 0;

  if (rc)
    rc = file.ReadObject(&o);
  if (rc&&o) {
    m_s = ON_Surface::Cast(o);
    if ( !m_s ) {
      delete o;
      rc = false;
    }
  }

  return rc;
}
开发者ID:ckvk,项目名称:opennurbs,代码行数:50,代码来源:opennurbs_curveonsurface.cpp

示例2: Read

// virtual ON_Object override
ON_BOOL32 ON__IDefLayerSettingsUserData::Read(ON_BinaryArchive& binary_archive)
{
  DestroyHelper();

  int major_version = 0;
  int minor_version = 0;
  bool rc = binary_archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&major_version,&minor_version);
  if ( !rc )
    return false;

  rc = false;
  while ( 1 == major_version )
  {
    if ( !binary_archive.ReadArray(m_layers) )
      break;

    if ( minor_version <= 0 )
    {
      rc = true;
      break;
    }

    // added in version 1.1 chunks
    bool bHaveParentLayer = false;
    if ( !binary_archive.ReadBool(&bHaveParentLayer) )
      break;

    if ( bHaveParentLayer )
    {
      ON_Object* p = 0;
      if ( !binary_archive.ReadObject(&p) || 0 == p )
      {
        if (p)
        {
          delete p;
          break;
        }
      }

      m_idef_layer_table_parent_layer = ON_Layer::Cast(p);
      if ( 0 == m_idef_layer_table_parent_layer )
      {
        delete p;
        break;
      }
    }

    rc = true;
    break;
  }

  if ( !binary_archive.EndRead3dmChunk() )
    rc = false;

  return rc;
}
开发者ID:Bastl34,项目名称:PCL,代码行数:57,代码来源:opennurbs_instance.cpp

示例3: Read

ON_BOOL32 ON_SurfaceArray::Read( ON_BinaryArchive& file )
{
  int major_version = 0;
  int minor_version = 0;
  ON__UINT32 tcode = 0;
  ON__INT64 big_value = 0;
  int flag;
  Destroy();
  ON_BOOL32 rc = file.BeginRead3dmBigChunk( &tcode, &big_value );
  if (rc) 
  {
    rc = ( tcode == TCODE_ANONYMOUS_CHUNK );
    if (rc) rc = file.Read3dmChunkVersion(&major_version,&minor_version);
    if (rc && major_version == 1) {
      ON_Object* p;
      int count;
      ON_BOOL32 rc = file.ReadInt( &count );
      if (rc) {
        SetCapacity(count);
        SetCount(count);
        Zero();
        int i;
        for ( i = 0; rc && i < count && rc; i++ ) {
          flag = 0;
          rc = file.ReadInt(&flag);
          if (rc && flag==1) {
            p = 0;
            rc = file.ReadObject( &p ); // polymorphic surfaces
            m_a[i] = ON_Surface::Cast(p);
            if ( !m_a[i] )
              delete p;
          }
        }
      }
    }
    else {
      rc = false;
    }
    if ( !file.EndRead3dmChunk() )
      rc = false;
  }
  return rc;
}
开发者ID:Bastl34,项目名称:PCL,代码行数:43,代码来源:opennurbs_surface.cpp

示例4: Read

BOOL ON_HatchLoop::Read( ON_BinaryArchive& ar)
{
  m_type = ltOuter;
  delete m_p2dCurve;
  m_p2dCurve = NULL;
  int major_version = 0;
  int minor_version = 0;
  BOOL rc = ar.Read3dmChunkVersion( &major_version, &minor_version);
  if ( major_version == 1 )
  {
    int type;
    if( rc) rc = ar.ReadInt( &type);
    if( rc)
    {
      switch( type)
      {
      case ltOuter:  m_type = ltOuter; break;
      case ltInner:  m_type = ltInner; break;
      default: rc = false; break;
      }
    }
    if( rc)
    {
      ON_Object* pObj = NULL;
      rc = ar.ReadObject( &pObj);
      if( pObj)
      {
        m_p2dCurve = ON_Curve::Cast( pObj);
        if( !m_p2dCurve) // read something, but it wasn't right
        {
          rc = false;
          delete pObj;
        }
      }
    }
  }
  return rc;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:38,代码来源:opennurbs_hatch.cpp

示例5: if


//.........这里部分代码省略.........
      if ( twin_index >= 0 && twin_index < m_T.Count() )
        continue;
      ON_BrepTrim& trim1 = m_T[trim_index];
      ON_BrepTrim& trim2 = m_T[twin_index];
      if ( trim1.m_ei >= 0 && trim1.m_ei < c2_count && trim2.m_ei < 0 )
        trim2.m_ei = trim1.m_ei;
      else if ( trim2.m_ei >= 0 && trim2.m_ei < c2_count && trim1.m_ei < 0 )
        trim1.m_ei = trim2.m_ei;
    }
    for ( i = 0; i < m_T.Count(); i++ ) {
      ON_BrepTrim& trim = m_T[i];
      ON_Curve* tcurve = m_C2[trim.m_c2i];
      trim.SetProxyCurve( tcurve );
      if ( trim.m_ei >= 0 && trim.m_ei < c3_count )
        m_E[trim.m_ei].m_ti.Append(trim.m_trim_index);
    }


    // finish setting flags
    SetTrimIsoFlags();
    SetTrimTypeFlags();

    // create 3d vertex information
    SetVertices();

    // set tols from values in file
    SetTolsFromLegacyValues();

  }
  else {
    Destroy();
  }

  if (rc) {
    // 3d render mesh geometry
    ON_Object* obj;
    for ( i = 0; rc && i < face_count; i++ ) {
      ON_BrepFace& f = m_F[i];
      file.ReadChar(&b);
      if (b) {
        obj = 0;
        rc = (file.ReadObject(&obj)==1)?true:false;
        f.m_render_mesh = ON_Mesh::Cast(obj);
        if ( !f.m_render_mesh )
          delete obj;
      }
    }
    if ( !rc ) {
      // delete render mesh geometry
      for ( i = 0; i < face_count; i++ ) {
        ON_BrepFace& f = m_F[i];
        if ( f.m_render_mesh ) {
          delete f.m_render_mesh;
          f.m_render_mesh = 0;
        }
      }
    }

    if (rc && minor_version >= 1) {
      // 3d analysis mesh geometry
      for ( i = 0; rc && i < face_count; i++ ) {
        ON_BrepFace& f = m_F[i];
        file.ReadChar(&b);
        if (b) {
          obj = 0;
          rc = file.ReadObject(&obj)?true:false;
          f.m_analysis_mesh = ON_Mesh::Cast(obj);
          if ( !f.m_analysis_mesh )
            delete obj;
        }
      }
      if ( !rc ) {
        // delete analysis mesh geometry
        for ( i = 0; i < face_count; i++ ) {
          ON_BrepFace& f = m_F[i];
          if ( f.m_analysis_mesh ) {
            delete f.m_analysis_mesh;
            f.m_analysis_mesh = 0;
          }
        }
      }
    }

    // fill in missing information
    ReadFillInMissingBoxes(*this);

    if (!rc ) {
      ON_ERROR("ON_Brep::ReadOld201() - trouble reading render/analysis meshes");
      rc = true;
    }
  }

  // 22 April 2003:
  //   Use outer_flag to set m_is_solid for closed solids
  //   with outward pointing normals.
  if ( 1 == outer_flag && IsSolid() )
    m_is_solid = 1;

  return rc;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:101,代码来源:opennurbs_brep_io.cpp

示例6: Read


//.........这里部分代码省略.........
    // faces
    if (rc)
    {
      rc = m_F.Read(file);
      if (rc) {
        for ( i = 0; i < m_F.Count(); i++ ) {
          ON_BrepFace& f = m_F[i];
          f.m_brep = this;
          if ( f.m_si >= 0 && f.m_si < S_count )
            f.SetProxySurface(m_S[f.m_si]);
        }
      }
    }

    // bounding box
    if (rc)
      rc = file.ReadPoint( m_bbox.m_min );
    if (rc)
      rc = file.ReadPoint( m_bbox.m_max );

    // fill in missing information
    ReadFillInMissingBoxes(*this);

    // end of chunk version 3.0

    if (rc && minor_version >= 1 )
    {
      // added for chunk version 3.1

      ON_Object* obj;
      unsigned int tcode;
      int value, fi;
      unsigned char b;

      const int face_count = m_F.Count();

      // read render meshes
      rc = file.BeginRead3dmChunk( &tcode, &value );
      if ( rc )
      {
        if ( tcode != TCODE_ANONYMOUS_CHUNK )
          rc = false;
        else
        {
          for ( fi = 0; rc && fi < face_count; fi++ )
          {
            rc = file.ReadChar(&b);
            if (rc && b)
            {
              rc = file.ReadObject(&obj);
              m_F[fi].m_render_mesh = ON_Mesh::Cast(obj);
              if ( !m_F[fi].m_render_mesh )
                delete obj;
            }
          }
        }
        if ( !file.EndRead3dmChunk() )
          rc = false;
      }

      // read analysis meshes
      rc = file.BeginRead3dmChunk( &tcode, &value );
      if ( rc )
      {
        if ( tcode != TCODE_ANONYMOUS_CHUNK )
          rc = false;
        else
        {
          for ( fi = 0; rc && fi < face_count; fi++ )
          {
            rc = file.ReadChar(&b);
            if (rc && b)
            {
              rc = file.ReadObject(&obj);
              m_F[fi].m_analysis_mesh = ON_Mesh::Cast(obj);
              if ( !m_F[fi].m_analysis_mesh )
                delete obj;
            }
          }
        }
        if ( !file.EndRead3dmChunk() )
          rc = false;
      }
    }

    if ( rc && minor_version >= 2 )
    {
      rc =  file.ReadInt( &m_is_solid );
      if ( m_is_solid < 0 || m_is_solid >= 3 )
        m_is_solid = 0;
    }
  }

  if ( file.ArchiveOpenNURBSVersion() < 20021002 )
  {
    m_is_solid = 0;
  }

  return rc;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:101,代码来源:opennurbs_brep_io.cpp

示例7: ReadFillInMissingBoxes

bool ON_Brep::ReadOld101( ON_BinaryArchive& file )
{
  ON_Object*  pO = NULL;
  ON_Curve*   pC = NULL;
  ON_Surface* pS = NULL;
  int i, count;

  // 2d curves
  file.ReadInt( &count );
  m_C2.Reserve(count);
  for ( i = 0; i < count; i++ )
  {
    pO = NULL;
    file.ReadObject( &pO );
    pC = ON_Curve::Cast(pO);
    if ( !pC )
      delete pO; // ERROR!
    m_C2.Append( pC );
    pC = NULL;
    pO = NULL;
  }

  // 3d curves
  file.ReadInt( &count );
  m_C3.Reserve(count);
  for ( i = 0; i < count; i++ )
  {
    pO = NULL;
    file.ReadObject( &pO );
    pC = ON_Curve::Cast(pO);
    if ( !pC )
      delete pO; // ERROR!
    m_C3.Append( pC );
    pC = NULL;
    pO = NULL;
  }

  // untrimmed surfaces
  file.ReadInt( &count );
  m_S.Reserve(count);
  for ( i = 0; i < count; i++ )
  {
    pO = NULL;
    file.ReadObject( &pO );
    pS = ON_Surface::Cast(pO);
    if ( !pS )
      delete pO; // ERROR!
    m_S.Append( pS );
    pS = NULL;
    pO = NULL;
  }

  // vertices
  file.ReadInt( &count );
  m_V.Reserve(count);
  m_V.SetCount(count);
  for ( i = 0; i < count; i++ )
  {
    m_V[i].Read(file);
  }

  // edges
  file.ReadInt( &count );
  m_E.Reserve(count);
  m_E.SetCount(count);
  for ( i = 0; i < count; i++ )
  {
    ON_BrepEdge& edge = m_E[i];
    edge.Read(file);
    edge.SetProxyCurve( edge.m_c3i >= 0 ? m_C3[edge.m_c3i] : 0 );
    edge.m_brep = this;
  }

  // trims
  file.ReadInt( &count );
  m_T.Reserve(count);
  m_T.SetCount(count);
  for ( i = 0; i < count; i++ )
  {
    m_T[i].Read(file);
    ON_BrepTrim& trim = m_T[i];
    trim.SetProxyCurve( trim.m_c2i >= 0 ? m_C2[trim.m_c2i] : 0 );
    trim.m_brep = this;
  }

  // loops
  file.ReadInt( &count );
  m_L.Reserve(count);
  m_L.SetCount(count);
  for ( i = 0; i < count; i++ )
  {
    m_L[i].Read(file);
    m_L[i].m_brep = this;
  }

  // faces
  file.ReadInt( &count );
  m_F.Reserve(count);
  m_F.SetCount(count);
  for ( i = 0; i < count; i++ )
//.........这里部分代码省略.........
开发者ID:cciechad,项目名称:brlcad,代码行数:101,代码来源:opennurbs_brep_io.cpp


注:本文中的ON_BinaryArchive::ReadObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。