本文整理汇总了C++中ON_BinaryArchive类的典型用法代码示例。如果您正苦于以下问题:C++ ON_BinaryArchive类的具体用法?C++ ON_BinaryArchive怎么用?C++ ON_BinaryArchive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ON_BinaryArchive类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: Dump3dmChunk
unsigned int Dump3dmChunk( ON_BinaryArchive& file, ON_TextLog& dump, int recursion_depth )
{
BOOL bShortChunk = FALSE;
const size_t offset0 = file.CurrentPosition();
unsigned int typecode = 0;
int value;
BOOL rc = file.BeginRead3dmChunk( &typecode, &value );
if (!rc) {
ErrorReport(offset0,"BeginRead3dmChunk() failed.",dump);
}
else {
if ( !typecode ) {
ErrorReport(offset0,"BeginRead3dmChunk() returned typecode = 0.",dump);
file.EndRead3dmChunk();
return 0;
}
else {
if ( 0 == recursion_depth )
{
dump.Print("\n");
}
bShortChunk = (0 != (typecode & TCODE_SHORT));
if ( bShortChunk )
{
dump.Print("%6d: %08X %s: value = %d (%08X)\n", offset0, typecode, TypeCodeString(typecode), value, value );
}
else
{
// long chunk value = length of chunk data
if ( value < 0 )
{
ErrorReport(offset0,"BeginRead3dmChunk() returned length < 0.",dump);
file.EndRead3dmChunk();
return 0;
}
dump.Print("%6d: %08X %s: length = %d bytes\n", offset0, typecode, TypeCodeString(typecode), value );
}
int major_userdata_version = -1;
int minor_userdata_version = -1;
switch( typecode )
{
case TCODE_PROPERTIES_TABLE:
case TCODE_SETTINGS_TABLE:
case TCODE_BITMAP_TABLE:
case TCODE_MATERIAL_TABLE:
case TCODE_LAYER_TABLE:
case TCODE_GROUP_TABLE:
case TCODE_LIGHT_TABLE:
case TCODE_FONT_TABLE:
case TCODE_DIMSTYLE_TABLE:
case TCODE_HATCHPATTERN_TABLE:
case TCODE_LINETYPE_TABLE:
case TCODE_TEXTURE_MAPPING_TABLE:
case TCODE_HISTORYRECORD_TABLE:
case TCODE_USER_TABLE:
case TCODE_INSTANCE_DEFINITION_TABLE:
case TCODE_OBJECT_TABLE:
// start of a table
{
dump.PushIndent();
unsigned int record_typecode = 0;
for (;;) {
record_typecode = Dump3dmChunk( file, dump, recursion_depth+1 );
if ( !record_typecode ) {
break;
}
if ( TCODE_ENDOFTABLE == record_typecode ) {
break;
}
}
dump.PopIndent();
}
break;
case TCODE_BITMAP_RECORD:
{
dump.PushIndent();
unsigned int bitmap_chunk_typecode = Dump3dmChunk( file, dump, recursion_depth+1 );
if ( !typecode )
typecode = bitmap_chunk_typecode;
dump.PopIndent();
}
break;
case TCODE_MATERIAL_RECORD:
{
dump.PushIndent();
unsigned int material_chunk_typecode = Dump3dmChunk( file, dump, recursion_depth+1 );
if ( !typecode )
typecode = material_chunk_typecode;
dump.PopIndent();
}
break;
case TCODE_LAYER_RECORD:
{
dump.PushIndent();
//.........这里部分代码省略.........
示例3: 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;
}
示例4: Read
ON_BOOL32 ON_InstanceDefinition::Read(
ON_BinaryArchive& binary_archive
)
{
int major_version = 0;
int minor_version = 0;
m_us.m_custom_unit_scale = 0.0;
m_us.m_custom_unit_name.Destroy();
m_us.m_unit_system = ON::no_unit_system;
m_source_bRelativePath = false;
m_source_archive.Destroy();
bool rc = binary_archive.Read3dmChunkVersion(&major_version,&minor_version);
if ( rc )
{
if ( major_version != 1 )
rc = false;
// version 1.0 fields
if ( rc )
rc = binary_archive.ReadUuid( m_uuid );
if ( rc )
rc = binary_archive.ReadArray( m_object_uuid );
if ( rc )
rc = binary_archive.ReadString( m_name );
if ( rc )
rc = binary_archive.ReadString( m_description );
if ( rc )
rc = binary_archive.ReadString( m_url );
if ( rc )
rc = binary_archive.ReadString( m_url_tag );
if ( rc )
rc = binary_archive.ReadBoundingBox( 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
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);
}
}
}
}
}
return rc;
}
示例5: 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);
//.........这里部分代码省略.........
示例6: while
bool ON_3dmObjectAttributes::WriteV5Helper( ON_BinaryArchive& file ) const
{
unsigned char c;
// 29 Nov. 2009 S. Baer
// Chunk version updated to 2.1 in order to support m_display_order
bool rc = file.Write3dmChunkVersion(2,1);
while(rc)
{
if (!rc) break;
rc = file.WriteUuid(m_uuid);
if (!rc) break;
rc = file.WriteInt(m_layer_index);
if (!rc) break;
// write non-default settings - skip everything else
if ( !m_name.IsEmpty() )
{
c = 1;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteString(m_name);
if (!rc) break;
}
if ( !m_url.IsEmpty() )
{
c = 2;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteString(m_url);
if (!rc) break;
}
if ( -1 != m_linetype_index )
{
c = 3;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteInt(m_linetype_index);
if (!rc) break;
}
if ( -1 != m_material_index )
{
c = 4;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteInt(m_material_index);
if (!rc) break;
}
if ( m_rendering_attributes.m_mappings.Count() > 0
|| m_rendering_attributes.m_materials.Count() > 0
|| true != m_rendering_attributes.m_bCastsShadows
|| true != m_rendering_attributes.m_bReceivesShadows
)
{
c = 5;
rc = file.WriteChar(c);
if (!rc) break;
rc = m_rendering_attributes.Write(file);
if (!rc) break;
}
if ( 0 != m_color )
{
c = 6;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteColor(m_color);
if (!rc) break;
}
if ( 0 != m_plot_color )
{
c = 7;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteColor(m_plot_color);
if (!rc) break;
}
if ( 0.0 != m_plot_weight_mm )
{
c = 8;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteDouble(m_plot_weight_mm);
if (!rc) break;
}
if ( ON::no_object_decoration != m_object_decoration )
{
c = 9;
rc = file.WriteChar(c);
if (!rc) break;
c = (unsigned char)m_object_decoration;
rc = file.WriteChar(c);
if (!rc) break;
}
if ( 1 != m_wire_density )
{
c = 10;
rc = file.WriteChar(c);
if (!rc) break;
rc = file.WriteInt(m_wire_density);
if (!rc) break;
}
//.........这里部分代码省略.........
示例7: Read
ON_BOOL32 ON_InstanceDefinition::Read(
ON_BinaryArchive& binary_archive
)
{
int major_version = 0;
int minor_version = 0;
m_idef_layer_style = 0;
m_us.m_custom_unit_scale = 0.0;
m_us.m_custom_unit_name.Destroy();
m_us.m_unit_system = ON::no_unit_system;
m_source_bRelativePath = false;
m_source_archive.Destroy();
bool rc = binary_archive.Read3dmChunkVersion(&major_version,&minor_version);
if ( rc )
{
if ( major_version != 1 )
rc = false;
// version 1.0 fields
if ( rc )
rc = binary_archive.ReadUuid( m_uuid );
if ( rc )
rc = binary_archive.ReadArray( m_object_uuid );
if ( rc )
rc = binary_archive.ReadString( m_name );
if ( rc )
rc = binary_archive.ReadString( m_description );
if ( rc )
rc = binary_archive.ReadString( m_url );
if ( rc )
rc = binary_archive.ReadString( m_url_tag );
if ( rc )
rc = binary_archive.ReadBoundingBox( 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
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 )
//.........这里部分代码省略.........
示例8: 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;
}
示例9: Write
bool ON_Localizer::Write(ON_BinaryArchive& archive) const
{
bool rc = archive.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,0);
if (!rc)
return false;
for(;;)
{
rc = archive.WriteInt(m_type);
if ( !rc ) break;
rc = archive.WritePoint(m_P);
if ( !rc ) break;
rc = archive.WriteVector(m_V);
if ( !rc ) break;
rc = archive.WriteInterval(m_d);
if ( !rc ) break;
rc = archive.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,0);
if (!rc) break;
rc = archive.WriteBool( m_nurbs_curve ? true : false );
if ( rc && m_nurbs_curve )
rc = m_nurbs_curve->Write(archive)?true:false;
if ( !archive.EndWrite3dmChunk() )
rc = false;
if (!rc) break;
rc = archive.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,0);
if (!rc) break;
rc = archive.WriteBool( m_nurbs_surface ? true : false );
if ( rc && m_nurbs_surface )
rc = m_nurbs_surface->Write(archive)?true:false;
if ( !archive.EndWrite3dmChunk() )
rc = false;
if (!rc) break;
break;
}
if ( !archive.EndWrite3dmChunk() )
rc = false;
return rc;
}
示例10: Read
bool ON_Localizer::Read(ON_BinaryArchive& archive)
{
Destroy();
int major_version = 0;
int minor_version = 0;
bool rc = archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&major_version,&minor_version);
if (!rc)
return false;
for(;;)
{
rc = (1 == major_version);
if ( !rc ) break;
int i = no_type;
rc = archive.ReadInt(&i);
if ( !rc ) break;
switch(i)
{
case sphere_type: m_type = sphere_type; break;
case plane_type: m_type = plane_type; break;
case cylinder_type: m_type = cylinder_type; break;
case curve_type: m_type = curve_type; break;
case surface_type: m_type = surface_type; break;
case distance_type: m_type = distance_type; break;
}
rc = archive.ReadPoint(m_P);
if ( !rc ) break;
rc = archive.ReadVector(m_V);
if ( !rc ) break;
rc = archive.ReadInterval(m_d);
if ( !rc ) break;
int mjv = 0, mnv = 0;
rc = archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&mjv,&mnv);
if (!rc) break;
rc = (1 == mjv);
bool bReadCurve = false;
if (rc)
rc = archive.ReadBool( &bReadCurve );
if ( rc && bReadCurve)
{
m_nurbs_curve = new ON_NurbsCurve();
rc = m_nurbs_curve->Read(archive)?true:false;
}
if ( !archive.EndRead3dmChunk() )
rc = false;
if (!rc) break;
rc = archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&mjv,&mnv);
if (!rc) break;
rc = (1 == mjv);
bool bReadSurface = false;
rc = archive.ReadBool( &bReadSurface );
if ( rc && bReadSurface )
{
m_nurbs_surface = new ON_NurbsSurface();
rc = m_nurbs_surface->Read(archive)?true:false;
}
if ( !archive.EndRead3dmChunk() )
rc = false;
if (!rc) break;
break;
}
if ( !archive.EndRead3dmChunk() )
rc = false;
return rc;
}
示例11: Write
ON_BOOL32 ON_Point::Write( ON_BinaryArchive& file ) const
{
ON_BOOL32 rc = file.Write3dmChunkVersion(1,0);
if (rc) rc = file.WritePoint( point );
return rc;
}
示例12: Read
BOOL ON_Font::Read(
ON_BinaryArchive& file // restore definition from binary archive
)
{
Defaults();
m_font_index = -1;
int major_version = 0;
int minor_version = 0;
bool rc = file.Read3dmChunkVersion(&major_version,&minor_version);
if ( rc && major_version == 1 )
{
int i;
for(;;)
{
rc = file.ReadInt( &m_font_index );
if (!rc) break;
rc = file.ReadString( m_font_name );
if (!rc) break;
{
// 18 October 2002 Dale Lear:
// Lowell, wchar_t has different sizes on different OSs.
// When writing a wchar_t string, you should use one
// of the WriteString functions. This function must continue
// to use ReadShort(64,...) so old files will remain valid.
unsigned short sh[64];
rc = file.ReadShort(64, sh);
if (!rc) break;
wchar_t facename[65];
for ( i = 0; i < 64; i++ )
{
facename[i] = sh[i];
}
facename[64] = 0;
SetFontFaceName(facename);
}
if( minor_version >= 1 )
{
rc = file.ReadInt( &i );
if (!rc) break;
SetFontWeight(i);
rc = file.ReadInt( &i);
if (!rc) break;
SetIsItalic(i?true:false);
rc = file.ReadDouble( &m_linefeed_ratio );
if (!rc) break;
if ( minor_version >= 2 )
{
rc = file.ReadUuid( m_font_id );
if (!rc) break;
}
}
break;
}
}
else
{
ON_ERROR("ON_Font::Read - get newer version of opennurbs");
rc = false;
}
return rc;
}