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


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

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


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

示例1: ON_SetBinaryArchiveOpenNURBSVersion

void ON_SetBinaryArchiveOpenNURBSVersion(ON_BinaryArchive& file, unsigned int value)
{
  if ( ON_VersionNumberIsValid(value) )
  {
    // can be yyyymmddn or a number from ON_VersionNumberConstruct().
    file.m_3dm_opennurbs_version = value;
  }
  else if ( ON_VersionNumberIsYearMonthDateFormat(file.Archive3dmVersion(),value) )
  {
    // can be yyyymmddn or a number from ON_VersionNumberConstruct().
    if ( 9 == (value%10) && value <= 201712319 )
    {
      // 9 marked debug versions.
      unsigned int n = file.Archive3dmVersion();
      if ( n >= 50 && 0 == (n%10) )
        n /= 10;
      if ( n > 0 && n < 9 )
        value = ((value/10)*10) + n;
    }
    file.m_3dm_opennurbs_version = value;
  }
  else
  {
    ON_ERROR("ON_SetBinaryArchiveOpenNURBSVersion - invalid opennurbs version");
    file.m_3dm_opennurbs_version = 0;
  }
}
开发者ID:jiapei100,项目名称:opennurbs,代码行数:27,代码来源:opennurbs_3dm_properties.cpp

示例2: Read

BOOL ON_BrepEdge::Read( ON_BinaryArchive& file )
{
  int bReversed = false;
  ON_Interval proxy_domain;
  BOOL rc = file.ReadInt( &m_edge_index );
  if (rc) rc = file.ReadInt( &m_c3i );
  if (rc) rc = file.ReadInt( &bReversed );
  if (rc) rc = file.ReadInterval( proxy_domain );
  if (rc) rc = file.ReadInt( 2, m_vi );
  if (rc) rc = file.ReadArray( m_ti );
  if (rc) rc = file.ReadDouble( &m_tolerance );
  ON_Interval domain = proxy_domain;
  if (    file.Archive3dmVersion() >= 3
       && file.ArchiveOpenNURBSVersion() >= 200206180 )
  {
    if (rc)
    {
      rc = file.ReadInterval(domain);
      if ( !rc)
        domain = proxy_domain;
    }
  }
  SetProxyCurve( NULL, proxy_domain );
  if ( bReversed )
    ON_CurveProxy::Reverse();
  SetDomain(domain);

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

示例3: Write

BOOL ON_BrepTrim::Write( ON_BinaryArchive& file ) const
{
  ON_3dPoint P(0.0,0.0,0.0);
  BOOL rc = file.WriteInt( m_trim_index );
  int i;
  if ( rc )
    rc = file.WriteInt( m_c2i );
  if ( rc )
    rc = file.WriteInterval( ProxyCurveDomain() );
  if ( rc )
    rc = file.WriteInt( m_ei );
  if ( rc )
    rc = file.WriteInt( 2, m_vi );
  if ( rc )
    rc = file.WriteInt( m_bRev3d );
  i = m_type;
  if ( rc )
    rc = file.WriteInt( i );
  i = m_iso;
  if ( rc )
    rc = file.WriteInt( i );
  if ( rc )
    rc = file.WriteInt( m_li );
  if ( rc )
    rc = file.WriteDouble( 2, m_tolerance );
  if ( file.Archive3dmVersion() < 3 )
  {
    if ( rc )
      rc = file.WritePoint( P ); // m_P[0] );
    if ( rc )
      rc = file.WritePoint( P ); // m_P[1] );
  }
  else
  {
    // trim proxy curve information added in version 200206180
    if (rc )
      rc = file.WriteInterval( Domain() );
    unsigned char b[24];
    memset(b,0,sizeof(b));
    b[0] = ProxyCurveIsReversed() ? 1 : 0;
    if (rc)
      rc = file.WriteChar(8,b);
    b[0] = 0;
    if (rc)
      rc = file.WriteChar(24,b);
  }
  if ( rc )
    rc = file.WriteDouble( m__legacy_2d_tol );
  if ( rc )
    rc = file.WriteDouble( m__legacy_3d_tol );
  return rc;
}
开发者ID:cciechad,项目名称:brlcad,代码行数:52,代码来源:opennurbs_brep_io.cpp

示例4: Write

bool ON_CheckSum::Write(ON_BinaryArchive& archive) const
{
  bool rc = false;
  if ( archive.Archive3dmVersion() < 4 )
  {
    // V3 files had other information
    // 48 bytes of zeros will work ok
    unsigned char b[48];
    memset(b,0,sizeof(b));
    rc = archive.WriteByte(48,b);
  }
  else
  {
    rc = archive.WriteBigSize(m_size);
    if (rc)
      rc = archive.WriteBigTime(m_time);
    if (rc)
      rc = archive.WriteInt(8,&m_crc[0]);
  }
  return rc;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:21,代码来源:opennurbs_string.cpp

示例5: Read

bool ON_CheckSum::Read(ON_BinaryArchive& archive)
{
  bool rc;

  Zero();

  rc  = archive.ReadBigSize(&m_size);
  if (rc)
    rc = archive.ReadBigTime(&m_time);
  if (rc)
    rc = archive.ReadInt(8,&m_crc[0]);

  if (    archive.ArchiveOpenNURBSVersion() < 200603100 
       || archive.Archive3dmVersion() < 4 
       )
  {
    // ON_CheckSums in V3 archives and V4 archives with
    // version < 200603100 have the same size but an 
    // incompatible format.  These were not used.
    Zero();
  }

  return rc;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:24,代码来源:opennurbs_string.cpp

示例6: switch

ON_BOOL32 ON_3dmObjectAttributes::Write( ON_BinaryArchive& file ) const
{
  if ( file.Archive3dmVersion() >= 5 )
  {
    // added at opennurbs version 200712190
    return WriteV5Helper(file);
  }

  bool rc = file.Write3dmChunkVersion(1,7);
  // version 1.0 fields
  if (rc) rc = file.WriteUuid(m_uuid);
  if (rc) rc = file.WriteInt(m_layer_index);
  if (rc) rc = file.WriteInt(m_material_index);
  if (rc) rc = file.WriteColor(m_color);

  if (rc)
  {
    // OBSOLETE if (rc) rc = file.WriteLineStyle(m_line_style); // 23 March 2005 Dale Lear
    short s;
    s = (short)m_object_decoration;
    if (rc) rc = file.WriteShort(s);
    s = 0;
    if (rc) rc = file.WriteShort(s);
    if (rc) rc = file.WriteDouble(0.0);
    if (rc) rc = file.WriteDouble(1.0);
  }

  if (rc) rc = file.WriteInt(m_wire_density);
  if (rc) rc = file.WriteChar(m_mode);
  if (rc) rc = file.WriteChar(m_color_source);
  if (rc) rc = file.WriteChar(m_linetype_source);
  if (rc) rc = file.WriteChar(m_material_source);
  if (rc) rc = file.WriteString(m_name);
  if (rc) rc = file.WriteString(m_url);

  // version 1.1 fields
  if (rc) rc = file.WriteArray(m_group);

  // version 1.2 fields
  if (rc) rc = file.WriteBool(m_bVisible);

  // version 1.3 fields
  if (rc) rc = file.WriteArray(m_dmref);

  // version 1.4 fields - 23 March 2005 Dale Lear
  if (rc) rc = file.WriteInt(m_object_decoration);
  if (rc) rc = file.WriteChar(m_plot_color_source);
  if (rc) rc = file.WriteColor(m_plot_color);
  if (rc) rc = file.WriteChar(m_plot_weight_source);
  if (rc) rc = file.WriteDouble(m_plot_weight_mm);

  // version 1.5 fields 11 April 2005
  if (rc) rc = file.WriteInt(m_linetype_index);

  // version 1.6 fields 2 September 2005
  if (rc)
  {
    unsigned char uc = 0;
    switch(m_space)
    {
    case ON::no_space:    uc = 0; break;
    case ON::model_space: uc = 0; break;
    case ON::page_space:  uc = 1; break;
    }
    rc = file.WriteChar(uc);
  }
  if (rc)
  {
    // 22 Sep 2006 - the way ON_3dmObjectAttiributes indicates
    // that an object is put on a particular page view changed
    // from being saved in the m_dmref[] list to using the
    // m_space and m_viewport_id settings.  But the file format
    // cannot change at this point.  So, the bAddPagespaceDMR
    // is here to save the page info in the old dmr format.
    int count = m_dmref.Count();
    if ( count < 0 )
      count = 0;
    bool bAddPagespaceDMR = ( ON::page_space == m_space && !ON_UuidIsNil(m_viewport_id) );
    rc = file.WriteInt( bAddPagespaceDMR ? (count+1) : count );
    if ( rc && bAddPagespaceDMR )
    {
      rc = file.WriteUuid(m_viewport_id);
      if (rc) rc = file.WriteUuid(ON_ObsoletePageSpaceObjectId);
    }
    int i;
    for ( i = 0; i < count && rc; i++ )
    {
      const ON_DisplayMaterialRef& dmr = m_dmref[i];
      rc = file.WriteUuid(dmr.m_viewport_id);
      if (rc) rc = file.WriteUuid(dmr.m_display_material_id);
    }
  }

  // version 1.7 fields 6 June 2006
  if (rc) rc = m_rendering_attributes.Write(file);

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

示例7: Default

ON_BOOL32 ON_3dmObjectAttributes::Read( ON_BinaryArchive& file )
{
  Default();
  if (    file.Archive3dmVersion() >= 5 
       && file.ArchiveOpenNURBSVersion() >= 200712190 )
  {
    return ReadV5Helper(file);
  }
  int i;
  int major_version = 0;
  int minor_version = 0;
  bool rc = file.Read3dmChunkVersion(&major_version,&minor_version);
  if ( rc && major_version == 1 ) 
  {
    if (rc) rc = file.ReadUuid(m_uuid);
    if (rc) rc = file.ReadInt(&m_layer_index);
    if (rc) rc = file.ReadInt(&m_material_index);
    if (rc) rc = file.ReadColor(m_color);
    
    while(rc)
    {
      // OBSOLETE if (rc) rc = file.ReadLineStyle(m_line_style); // 23 March 2005 Dale Lear
      // replaced with
      short s = 0;
      double x;
      rc = file.ReadShort(&s); 
      if (!rc) break;
      if ( file.Archive3dmVersion() < 4 || file.ArchiveOpenNURBSVersion() < 200503170 )
      {
        // ignore unused linestyle info in old files
        // This bit keeps the curve arrowheads from V3 showing up
        // in V4.
        m_object_decoration = ON::ObjectDecoration( (s & ON::both_arrowhead) );
      }
      rc = file.ReadShort(&s);
      if (!rc) break;
      rc = file.ReadDouble(&x);
      if (!rc) break;
      rc = file.ReadDouble(&x);
      break;
    }

    if (rc) rc = file.ReadInt(&m_wire_density);
    if (rc) rc = file.ReadChar(&m_mode);

    if (rc) rc = file.ReadChar(&m_color_source);
    if (rc) m_color_source = (unsigned char)ON::ObjectColorSource(m_color_source);

    if (rc) rc = file.ReadChar(&m_linetype_source);
    if (rc) m_linetype_source = (unsigned char)ON::ObjectLinetypeSource(m_linetype_source);

    if (rc) rc = file.ReadChar(&m_material_source);
    if (rc) m_material_source = (unsigned char)ON::ObjectMaterialSource(m_material_source);

    if (rc) rc = file.ReadString(m_name);
    if (rc) rc = file.ReadString(m_url);

    m_bVisible = (Mode() != ON::hidden_object);
    if ( rc && minor_version >= 1 ) 
    {
      rc = file.ReadArray( m_group );
      if ( rc && minor_version >= 2 )
      {
        rc = file.ReadBool(&m_bVisible);

        if ( rc && minor_version >= 3 )
        {
          rc = file.ReadArray(m_dmref);     

          if (rc && minor_version >= 4 )
          {
            // 23 March 2005 Dale Lear
            //    Added m_plot_color_source and m_plot_color
            i = 0;
            if (rc) rc = file.ReadInt(&i);
            if (rc) m_object_decoration = ON::ObjectDecoration(i);
            if (rc) rc = file.ReadChar(&m_plot_color_source);
            if (rc) m_plot_color_source = (unsigned char)ON::PlotColorSource(m_plot_color_source);
            if (rc) rc = file.ReadColor( m_plot_color );
            if (rc) rc = file.ReadChar(&m_plot_weight_source);
            if (rc) m_plot_weight_source = (unsigned char)ON::PlotWeightSource(m_plot_weight_source);
            if (rc) rc = file.ReadDouble(&m_plot_weight_mm);


            if (rc && minor_version >= 5 )
            {
              // version 1.5 fields 11 April 2005
              if (rc) rc = file.ReadInt(&m_linetype_index);

              // version 1.6 fields 2 September 2005
              if (rc && minor_version >= 6 )
              {
                unsigned char uc = 0;
                rc = file.ReadChar(&uc);
                if (rc)
                {
                  m_space = (1 == uc) ? ON::page_space : ON::model_space;
                  m_dmref.Empty();
                  int i, count=0;
                  rc = file.ReadInt(&count);
//.........这里部分代码省略.........
开发者ID:Bastl34,项目名称:PCL,代码行数:101,代码来源:opennurbs_3dm_attributes.cpp

示例8:

bool ON_3dmProperties::Write(ON_BinaryArchive& file) const
{
  bool rc = true;

  // This short chunk identifies the version of OpenNURBS that was used to write this file.
  const unsigned int version_number_to_write = ON_BinaryArchive::ArchiveOpenNURBSVersionToWrite(file.Archive3dmVersion(), ON::Version());
  rc = file.BeginWrite3dmChunk(TCODE_PROPERTIES_OPENNURBS_VERSION, version_number_to_write);
  if (rc)
    rc = file.EndWrite3dmChunk();
  if (!rc)
    return false;

  // This chunk added November 5, 2015
  const ON_wString archive_full_path
    = file.ArchiveFullPath().IsEmpty()
    ? m_3dmArchiveFullPathName
    : file.ArchiveFullPath();
  if (archive_full_path.IsNotEmpty())
  {
    if (!file.BeginWrite3dmChunk(TCODE_PROPERTIES_AS_FILE_NAME, 0))
      return false;
    rc = file.WriteString(file.ArchiveFullPath());
    if (!file.EndWrite3dmChunk())
      rc = false;
    if (!rc)
      return false;
  }


  // optional TCODE_PROPERTIES_REVISIONHISTORY chunk - file creation/revision information
  if ( rc && m_RevisionHistory.IsValid() ) {
    rc = file.BeginWrite3dmChunk(TCODE_PROPERTIES_REVISIONHISTORY,0);
    if ( rc ) {
      rc = m_RevisionHistory.Write(file);
      if ( !file.EndWrite3dmChunk() )
        rc = false;
    }
  }

  // optional TCODE_PROPERTIES_NOTES chunk - file notes
  if ( rc && m_Notes.IsValid() ) {
    rc = file.BeginWrite3dmChunk(TCODE_PROPERTIES_NOTES,0);
    if ( rc ) {
      rc = m_Notes.Write(file);
      if ( !file.EndWrite3dmChunk() )
        rc = false;
    }
  }

  //// When merging Mac code please note that the
  //// TCODE_PROPERTIES_PREVIEWIMAGE chunk is OBSOLETE.
  //// DO NOT WRITE THEM IN V6 FILES.  If performance is an
  //// issue, we will address it some other way.

  // optional TCODE_PROPERTIES_COMPRESSED_PREVIEWIMAGE chunk - bitmap preview
  if ( rc && m_PreviewImage.IsValid() && file.Save3dmPreviewImage()) 
  {
    rc = file.BeginWrite3dmChunk(TCODE_PROPERTIES_COMPRESSED_PREVIEWIMAGE,0);
    if ( rc ) 
    {
      rc = m_PreviewImage.WriteCompressed(file);
      if ( !file.EndWrite3dmChunk() )
        rc = false;
    }
  }

  // optional TCODE_PROPERTIES_APPLICATION chunk - application information
  if ( rc && m_Application.IsValid() ) 
  {
    rc = file.BeginWrite3dmChunk(TCODE_PROPERTIES_APPLICATION,0);
    if ( rc ) 
    {
      rc = m_Application.Write(file);
      if ( !file.EndWrite3dmChunk() )
        rc = false;
    }
  }

  // required TCODE_ENDOFTABLE chunk - marks end of properties table
  if ( rc ) {
    rc = file.BeginWrite3dmChunk( TCODE_ENDOFTABLE, 0 );
    if ( rc ) {
      if ( !file.EndWrite3dmChunk() )
        rc = false;
    }
  }

  return rc;
}
开发者ID:jiapei100,项目名称:opennurbs,代码行数:89,代码来源:opennurbs_3dm_properties.cpp

示例9: switch

bool ON_3dmProperties::Read(ON_BinaryArchive& file )
{
  *this = ON_3dmProperties::Empty;

  bool rc = true;

  unsigned int tcode;
  ON__INT64 value;

  for(;;) 
  {

    rc = file.BeginRead3dmBigChunk( &tcode, &value );
    if ( !rc )
      break;

    switch(tcode) 
    {

    case TCODE_PROPERTIES_OPENNURBS_VERSION:
      { 
        unsigned int opennurbs_version = 0;
        if ( value > 0 && value <= 0xFFFFFFFFll)
        {
          opennurbs_version = (unsigned int)((ON__UINT64)value);
        }

        if (    !ON_VersionNumberIsValid(opennurbs_version)
             && !ON_VersionNumberIsYearMonthDateFormat(file.Archive3dmVersion(),opennurbs_version)
           )
        {
          ON_ERROR("ON_3dmProperties::Read - TCODE_PROPERTIES_OPENNURBS_VERSION corrupt value");
          rc = false;
        }

        ON_SetBinaryArchiveOpenNURBSVersion(file,opennurbs_version);
      }
      break;

    case TCODE_PROPERTIES_AS_FILE_NAME:
      rc = file.ReadString(m_3dmArchiveFullPathName);
      break;
      
    case TCODE_PROPERTIES_REVISIONHISTORY: // file creation/revision information
      rc = m_RevisionHistory.Read(file);
      break;
      
    case TCODE_PROPERTIES_NOTES: // file notes
      rc = m_Notes.Read(file);
      break;
      
    case TCODE_PROPERTIES_PREVIEWIMAGE: // uncompressed preview image
      rc = m_PreviewImage.ReadUncompressed(file);
      break;
      
    case TCODE_PROPERTIES_COMPRESSED_PREVIEWIMAGE: // compressed preview image
      rc = m_PreviewImage.ReadCompressed(file);
      break;
      
    case TCODE_PROPERTIES_APPLICATION: // application that created 3dm file
      rc = m_Application.Read(file);
      break;
      
    default:
      // information added in future will be skipped by file.EndRead3dmChunk()
      break;
    }

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

    if (!rc)
      break;

    if ( TCODE_ENDOFTABLE == tcode )
      break;
  }

  return rc;
}
开发者ID:jiapei100,项目名称:opennurbs,代码行数:80,代码来源:opennurbs_3dm_properties.cpp

示例10: Write

ON_BOOL32 ON_InstanceDefinition::Write(
       ON_BinaryArchive& binary_archive
     ) const
{
  bool rc = binary_archive.Write3dmChunkVersion(1,5);

  // version 1.0 fields
  if ( rc )
    rc = binary_archive.WriteUuid( m_uuid );
  if ( rc )
  {
    if (    binary_archive.Archive3dmVersion() >= 4
         && ON_InstanceDefinition::linked_def == m_idef_update_type )
    {
      // linked instance definition geometry is never in the file
      ON_SimpleArray<ON_UUID> empty_uuid_list;
      rc = binary_archive.WriteArray( empty_uuid_list );
    }
    else
    {
      rc = binary_archive.WriteArray( m_object_uuid );
    }
  }
  if ( rc )
    rc = binary_archive.WriteString( m_name );
  if ( rc )
    rc = binary_archive.WriteString( m_description );
  if ( rc )
    rc = binary_archive.WriteString( m_url );
  if ( rc )
    rc = binary_archive.WriteString( m_url_tag );
  if ( rc )
    rc = binary_archive.WriteBoundingBox( m_bbox );
  // m_idef_update_type was an unsigned int and got changed to an enum.  Read and write
  // as an unsigned int to support backwards compatibility
  if ( rc )
    rc = binary_archive.WriteInt( (unsigned int)m_idef_update_type );
  if ( rc )
    rc = binary_archive.WriteString( m_source_archive );
  
  // version 1.1 fields
  if (rc)
    rc = m_source_archive_checksum.Write( binary_archive );
  
  // version 1.2 fields
  if (rc)
    rc = binary_archive.WriteInt( m_us.m_unit_system );

  // version 1.3 fields - added 6 March 2006
  if (rc)
    rc = binary_archive.WriteDouble( m_us.m_custom_unit_scale );

  if ( rc )
    rc = binary_archive.WriteBool( m_source_bRelativePath );

  // version 1.4 fields
  if (rc)
    rc = m_us.Write(binary_archive);

  // version 1.5 fields
  if (rc)
    rc = binary_archive.WriteInt(m_idef_update_depth);

  return rc;
}
开发者ID:jl2,项目名称:ONView,代码行数:65,代码来源:opennurbs_instance.cpp

示例11: Read

BOOL ON_UnknownUserData::Read( ON_BinaryArchive& file )
{
  m_buffer = onrealloc( m_buffer, m_sizeof_buffer );
  m_3dm_version = file.Archive3dmVersion();
  return file.ReadByte(m_sizeof_buffer,m_buffer);
}
开发者ID:cciechad,项目名称:brlcad,代码行数:6,代码来源:opennurbs_userdata.cpp

示例12: Read


//.........这里部分代码省略.........
    // as an unsigned int to support backwards compatibility
    unsigned int source = m_idef_update_type;
    if ( rc )
      rc = binary_archive.ReadInt( &source );
    if( rc)
      m_idef_update_type = ON_InstanceDefinition::IdefUpdateType(source);
    if ( rc )
      rc = binary_archive.ReadString( m_source_archive );

    // version 1.1 fields
    if ( minor_version >= 1 )
    {
      if ( rc )
        rc = m_source_archive_checksum.Read( binary_archive );
    }

    // version 1.2 fields
    if ( minor_version >= 2 )
    {
      int us = ON::no_unit_system;
      if ( rc )
        rc = binary_archive.ReadInt( &us );
      m_us.m_unit_system = ON::UnitSystem(us);
      if ( ON::custom_unit_system != m_us.m_unit_system && ON::no_unit_system != m_us.m_unit_system )
      {
        m_us.m_custom_unit_scale = ON::UnitScale( m_us.m_unit_system, ON::meters );
      }
      else
      {
        m_us.m_custom_unit_scale = 0.0;
      }

      if ( minor_version >= 3 )
      {
        // version 1.3 fields - added 6 March 2006
        //int us = ON::no_unit_system;
        if ( rc )
          rc = binary_archive.ReadDouble( &m_us.m_custom_unit_scale );
        if ( rc )
          rc = binary_archive.ReadBool( &m_source_bRelativePath );
        if ( rc && minor_version >= 4 )
        {
          rc = m_us.Read(binary_archive);
          if (rc && minor_version >= 5 )
          {
            rc = binary_archive.ReadInt(&m_idef_update_depth);

            if ( rc && minor_version >= 6 )
            {
              unsigned int i = 0;
              rc = binary_archive.ReadInt(&i);
              if ( i && i > 0 && i < 256 )
                m_idef_layer_style = (unsigned char)i;
            }
          }
        }
      }
    }

    if ( ON_InstanceDefinition::embedded_def == m_idef_update_type )
    {
      // 7 February 2012
      //   "embedded_def" is obsolete.
      if (m_source_archive.Length() > 0 )
        m_idef_update_type = ON_InstanceDefinition::linked_and_embedded_def;
      else
        DestroySourceArchive(); // convert to static
    }

    if ( ON_InstanceDefinition::linked_def == m_idef_update_type )
    {
      if ( m_idef_layer_style < 1 || m_idef_layer_style > 2 )
      {
        // The goal of the next if/else clause is for Rhino users
        // to see what they saw when they created the file.
        if ( binary_archive.Archive3dmVersion() < 50 )
        {
          // V4 linked blocks and early V5 linked blocks treated
          // layers and materials the way newer "active" idefs work,
          // so when I read an archive with version < 50, the
          // default will be 1 for "active".  
          m_idef_layer_style = 1;
        }
        else
        {
          // The more recent V5 linked blocks treated layers and materials
          // the way "reference" style idefs work, so when I read an
          // archive with version >= 50 (meaning recent V5), the default
          // will be 2 for "reference".
          m_idef_layer_style = 2;
        }
      }
    }
    else
    {
      m_idef_layer_style= 0;
    }
  }
  return rc;
}
开发者ID:2php,项目名称:pcl,代码行数:101,代码来源:opennurbs_instance.cpp

示例13: Write

ON_BOOL32 ON_InstanceDefinition::Write(
       ON_BinaryArchive& binary_archive
     ) const
{
  bool rc = binary_archive.Write3dmChunkVersion(1,6);

  // version 1.0 fields
  if ( rc )
    rc = binary_archive.WriteUuid( m_uuid );
  if ( rc )
  {
    if (    binary_archive.Archive3dmVersion() >= 4
         && ON_InstanceDefinition::linked_def == m_idef_update_type )
    {
      // linked instance definition geometry is never in the file
      ON_SimpleArray<ON_UUID> empty_uuid_list;
      rc = binary_archive.WriteArray( empty_uuid_list );
    }
    else
    {
      rc = binary_archive.WriteArray( m_object_uuid );
    }
  }
  if ( rc )
    rc = binary_archive.WriteString( m_name );
  if ( rc )
    rc = binary_archive.WriteString( m_description );
  if ( rc )
    rc = binary_archive.WriteString( m_url );
  if ( rc )
    rc = binary_archive.WriteString( m_url_tag );
  if ( rc )
    rc = binary_archive.WriteBoundingBox( m_bbox );

  // m_idef_update_type was an unsigned int and got changed to an enum.  Read and write
  // as an unsigned int to support backwards compatibility
  const unsigned int idef_update_type = (unsigned int)this->IdefUpdateType();
  if ( rc )
    rc = binary_archive.WriteInt( idef_update_type );
  if ( rc )
  {
    // 7 February 2012
    //   Purge source archive information from static_defs
    if ( ON_InstanceDefinition::static_def == idef_update_type )
    {
      ON_wString empty_string;
      rc = binary_archive.WriteString( empty_string );
    }
    else
      rc = binary_archive.WriteString( m_source_archive );
  }
  
  // version 1.1 fields
  if (rc)
  {
    // 7 February 2012
    //   Purge source archive information from static_defs
    if ( ON_InstanceDefinition::static_def == idef_update_type )
      ON_CheckSum::UnsetCheckSum.Write(binary_archive);
    else
      rc = m_source_archive_checksum.Write( binary_archive );
  }
  
  // version 1.2 fields
  if (rc)
    rc = binary_archive.WriteInt( m_us.m_unit_system );

  // version 1.3 fields - added 6 March 2006
  if (rc)
    rc = binary_archive.WriteDouble( m_us.m_custom_unit_scale );

  if ( rc )
  {
    bool b = (ON_InstanceDefinition::static_def == idef_update_type)
           ? false
           : m_source_bRelativePath;
    rc = binary_archive.WriteBool( b );
  }

  // version 1.4 fields
  if (rc)
    rc = m_us.Write(binary_archive);

  // version 1.5 fields
  if (rc)
    rc = binary_archive.WriteInt(m_idef_update_depth);

  // version 1.6 fields ( added 14 February 2012 )
  if (rc)
    rc = binary_archive.WriteInt(  m_idef_layer_style );

  return rc;
}
开发者ID:2php,项目名称:pcl,代码行数:93,代码来源:opennurbs_instance.cpp


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