Esempio n. 1
0
ON_BOOL32 ON_InstanceRef::Write(
       ON_BinaryArchive& binary_archive
     ) const
{
  bool rc = binary_archive.Write3dmChunkVersion(1,0);
  if ( rc )
    rc = binary_archive.WriteUuid( m_instance_definition_uuid );
  if ( rc )
    rc = binary_archive.WriteXform( m_xform );
  if ( rc )
    rc = binary_archive.WriteBoundingBox( m_bbox );
  return rc;
}
Esempio n. 2
0
ON_BOOL32 ON_PointCloud::Write( ON_BinaryArchive& file ) const
{
  bool rc = file.Write3dmChunkVersion(1,1);

  if (rc) rc = file.WriteArray( m_P );
  if (rc) rc = file.WritePlane( m_plane );
  if (rc) rc = file.WriteBoundingBox( m_bbox );
  if (rc) rc = file.WriteInt( m_flags);

  // added for 1.1  (7 December 2005)
  if (rc) rc = file.WriteArray(m_N);
  if (rc) rc = file.WriteArray(m_C);

  return rc;
}
ON_BOOL32 ON_BrepRegion::Write(ON_BinaryArchive& file) const
{
    bool rc = file.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,0);
    if ( !rc )
        return false;
    for(;;)
    {
        rc = file.WriteInt( m_region_index );
        if (!rc) break;
        rc = file.WriteInt( m_type );
        if (!rc) break;
        rc = file.WriteArray( m_fsi );
        if (!rc) break;
        rc = file.WriteBoundingBox( m_bbox );
        if (!rc) break;

        break;
    }
    if (!file.EndWrite3dmChunk())
        rc = false;
    return rc;
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
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;
}