void CCommandSampleDumpBlockTree::DumpInstanceDefinition( const CRhinoInstanceDefinition* idef, ON_TextLog& dump, bool bRoot )
{
  if( idef && ! idef->IsDeleted() )
  {
    ON_wString node;
    if( bRoot )
      node = L"\u2500";
    else
      node = L"\u2514";
    dump.Print(L"%s Instance definition %d = %s\n", node, idef->Index(), idef->Name() );

    const int idef_object_count = idef->ObjectCount();
    if( idef_object_count )
    {
      dump.PushIndent();
      for( int i = 0; i < idef->ObjectCount(); i++ )
      {
        const CRhinoObject* obj = idef->Object( i );
        if( obj )
        {
          const CRhinoInstanceObject* iref = CRhinoInstanceObject::Cast( obj );
          if( iref )
            DumpInstanceDefinition( iref->InstanceDefinition(), dump, false );
          else
            dump.Print(L"\u2514 Object %d = %s\n", i, obj->ShortDescription(false) );
        }
      }
      dump.PopIndent();
    }
  }
}
Esempio n. 2
0
void ON_Hatch::Dump( ON_TextLog& dump) const
{
  dump.Print( "Hatch: Solid fill");
  int count = m_loops.Count();
  dump.Print( "Loop count = %d\n", count);
  for( int i = 0; i < count; i++)
    m_loops[i]->Dump( dump);
}
Esempio n. 3
0
void ON_AnnotationArrow::Dump( ON_TextLog& log ) const
{
  log.Print("ON_AnnotationArrow: ");
  log.Print(m_tail);
  log.Print(" to ");
  log.Print(m_head);
  log.Print("\n");
}
Esempio n. 4
0
void ON_Group::Dump( ON_TextLog& dump ) const
{
  const wchar_t* name = GroupName();
  if ( !name )
    name = L"";
  dump.Print("group index = %d\n",m_group_index);
  dump.Print("group name = \"%ls\"\n",name);
}
Esempio n. 5
0
void ON_HatchLoop::Dump( ON_TextLog& dump) const
{
  if( m_type == ltOuter)
    dump.Print( "Loop type: Outer\n");
  if( m_type == ltInner)
    dump.Print( "Loop type: Inner\n");
  dump.Print( "2d curve: %p\n", m_p2dCurve);
}
Esempio n. 6
0
void ON_ArcCurve::Dump( ON_TextLog& dump ) const
{
  dump.Print( "ON_ArcCurve:  domain = [%g,%g]\n",m_t[0],m_t[1]);
  dump.PushIndent();
  dump.Print( "center = ");
  dump.Print( m_arc.plane.origin );
  dump.Print( "\nradius = %g\n",m_arc.radius);
  dump.Print( "length = %g\n",m_arc.Length());
  dump.PopIndent();
}
Esempio n. 7
0
void ON_UnknownUserData::Dump( ON_TextLog& dump ) const
{
  ON_UserData::Dump(dump);
  dump.PushIndent();
  dump.Print( "unknown class uuid: ");
  dump.Print( m_unknownclass_uuid );
  dump.Print( "\n");
  dump.Print( "Data size in 3dm archive: %d bytes\n",m_sizeof_buffer);
  dump.PopIndent();
}
Esempio n. 8
0
void ON_ClippingPlaneSurface::Dump( ON_TextLog& text_log ) const
{
  text_log.Print("Clipping plane surface\n");
  text_log.PushIndent();  
  text_log.Print("Enabled = %d",m_clipping_plane.m_bEnabled);
  text_log.Print("View IDs =\n");
  {
    text_log.PushIndent();
    ON_SimpleArray<ON_UUID> uuid_list;
    m_clipping_plane.m_viewport_ids.GetUuids(uuid_list);
    for( int i=0; i<uuid_list.Count(); i++ )
    {
      text_log.Print( uuid_list[i] );
      text_log.Print("\n");
    }
    text_log.PopIndent();
  }
  text_log.Print("Plane ID = ");
  text_log.Print(m_clipping_plane.m_plane_id);
  text_log.Print("\n");  

  text_log.Print("Plane surface\n");
  text_log.PushIndent();  
  ON_PlaneSurface::Dump(text_log);
  text_log.PopIndent();  
  text_log.PopIndent();  
}
void CExampleWriteUserData::Dump( ON_TextLog& text_log ) const
{
  ON_UserData::Dump(text_log);
  text_log.PushIndent();
  const wchar_t* s = m_str;
  if ( 0 == s ) 
    s = L"";
  text_log.Print("m_str: %ls\n",s);
  text_log.Print("m_sn: %d\n",m_sn);
  text_log.PopIndent();
}
Esempio n. 10
0
void ON_Font::Dump( ON_TextLog& dump ) const
{
  const wchar_t* name = FontName();
  if ( !name )
    name = L"";
  dump.Print("font index = %d\n",m_font_index);
  dump.Print("font name = \"%S\"\n",name);
  dump.Print("font face name = \"%S\"\n",m_facename);
  dump.Print("font weight = \"%d\"\n",m_font_weight);
  dump.Print("font is italic = \"%d\"\n",m_font_italic);
  dump.Print("font linefeed ratio = \"%g\"\n", m_linefeed_ratio);
}
Esempio n. 11
0
void ON_UserString::Dump(ON_TextLog& text_log) const
{
  const wchar_t* s = m_key;
  if ( !s )
    s = L"";
  text_log.Print("Key: %s\n");

  s = m_string_value;
  if ( !s )
    s = L"";
  text_log.Print(L"Value: %s\n",s);
}
void ON_3dmApplication::Dump( ON_TextLog& dump ) const
{
  const wchar_t* s = static_cast< const wchar_t* >(m_application_name);
  if ( s )
    dump.Print("Name: %ls\n",s);
  s = static_cast< const wchar_t* >(m_application_URL);
  if ( s )
    dump.Print("URL: %ls\n",s);
  s = static_cast< const wchar_t* >(m_application_details);
  if ( s )
    dump.Print("Details: %ls\n",s);
}
Esempio n. 13
0
void ON_LinetypeSegment::Dump( ON_TextLog& dump) const
{
  switch( m_seg_type)
  {
  case stLine:
    dump.Print( "Segment type = Line: %g\n", m_length);
    break;
  case stSpace:
    dump.Print( "Segment type = Space: %g\n", m_length);
    break;
  }
}
void ON_3dmApplication::Dump( ON_TextLog& dump ) const
{
    const wchar_t* s = m_application_name;
    if ( s )
        dump.Print("Name: %ls\n",s);
    s = m_application_URL;
    if ( s )
        dump.Print("URL: %ls\n",s);
    s = m_application_details;
    if ( s )
        dump.Print("Details: %ls\n",s);
}
Esempio n. 15
0
static const ONX_ErrorCounter Internal_TestFileRead(
  ON_TextLog& text_log,
  const ON_wString fullpath,
  const ON_wString text_log_path,
  bool bVerbose
  )
{
  FILE* fp = nullptr;

  fp = ON_FileStream::Open3dmToRead(fullpath);

  ONX_ErrorCounter error_counter;
  error_counter.ClearLibraryErrorsAndWarnings();

  const ON_wString path_to_print
    = (text_log_path.IsNotEmpty())
    ? text_log_path
    : fullpath;
  
  for (;;)
  {
    if (nullptr == fp)
    {
      text_log.Print(
        L"Skipped file: %ls\n",
        static_cast<const wchar_t*>(path_to_print)
      );
      error_counter.IncrementFailureCount();
      break;
    }

    text_log.Print(
      L"File name: %ls\n",
      static_cast<const wchar_t*>(path_to_print)
    );

    ON_BinaryFile source_archive(ON::archive_mode::read3dm, fp);
    source_archive.SetArchiveFullPath(fullpath);

    error_counter += Internal_TestModelRead(text_log, path_to_print, source_archive, bVerbose);
    break;
  }

  if ( nullptr != fp )
  {
    ON_FileStream::Close(fp);
    fp = nullptr;
  }

  return error_counter;
}
Esempio n. 16
0
void ON_Linetype::Dump( ON_TextLog& dump ) const
{
  const wchar_t* sName = LinetypeName();
  if ( !sName )
    sName = L"";
  dump.Print( "Segment count = %d\n", m_segments.Count());
  dump.Print( "Pattern length = %g\n", PatternLength());
  dump.Print( "Pattern = (" );
  for( int i = 0; i < m_segments.Count(); i++)
  {
    const ON_LinetypeSegment& seg = m_segments[i];
    if ( i )
      dump.Print(",");
    switch( seg.m_seg_type)
    {
    case ON_LinetypeSegment::stLine:
      dump.Print( "line");
      break;
    case ON_LinetypeSegment::stSpace:
      dump.Print( "space");
      break;
    default:
      dump.Print( "invalid");
      break;
    }
  }
  dump.Print(")\n");
}
Esempio n. 17
0
void ON_PointGrid::Dump( ON_TextLog& dump ) const
{
  dump.Print( "ON_PointGrid size = %d X %d\n",
               m_point_count[0], m_point_count[1] );
  if ( m_point.Count() < 1 ) {
    dump.Print("  NO point array\n");
  }
  else {
    dump.PrintPointGrid( 3, false, m_point_count[0], m_point_count[1], 
                         3*m_point_stride0, 3, 
                         &m_point[0].x,
                         "  point" 
                         );
  }
}
void ON_3dmNotes::Dump(ON_TextLog& dump) const
{
    const wchar_t* s = m_notes;
    if ( s )
        dump.PrintWrappedText(s);
    dump.Print("\n");
}
void ON_3dmNotes::Dump(ON_TextLog& dump) const
{
  const wchar_t* s = static_cast< const wchar_t* >(m_notes);
  if ( s )
    dump.PrintWrappedText(s);
  dump.Print("\n");
}
Esempio n. 20
0
void
ON_SurfaceProxy::Dump( ON_TextLog& dump ) const
{
  dump.Print("ON_SurfaceProxy uses %x\n",m_surface);
  if (m_surface ) 
    m_surface->Dump(dump);
}
void ON_3dmProperties::Dump( ON_TextLog& dump ) const
{
    dump.Print("Revision history:\n");
    dump.PushIndent();
    m_RevisionHistory.Dump(dump);
    dump.PopIndent();

    dump.Print("\n");
    dump.Print("Notes:\n");
    if ( m_Notes.m_notes.Length() > 0 ) {
        dump.PushIndent();
        m_Notes.Dump(dump);
        dump.PopIndent();
    }

    dump.Print("\n");
    dump.Print("Application information:\n");
    dump.PushIndent();
    m_Application.Dump(dump);
    dump.PopIndent();

    if ( m_PreviewImage.IsValid() ) {
        dump.Print("\n");
        dump.Print("Preview image:\n");
        dump.PushIndent();
        m_PreviewImage.Dump(dump);
        dump.PopIndent();
    }
}
Esempio n. 22
0
void ON_UserData::Dump( ON_TextLog& text_log ) const
{
  text_log.Print("User Data:\n");
  text_log.PushIndent();

  // print class name and class uuid
  ON_Object::Dump(text_log);

  // developer's user data description
  ON_wString description;
  const_cast<ON_UserData*>(this)->GetDescription(description);
  if ( description.IsEmpty() )
    description = L"none";
  const wchar_t* ws = description;
  text_log.Print("user data description: %S\n",ws);
  text_log.Print("user data uuid: ");
  text_log.Print(m_userdata_uuid);
  text_log.Print("\n");
  text_log.Print("user data copy count: %d\n",this->m_userdata_copycount);

  // archive setting
  text_log.Print("user data saved in 3dm archive: %s\n",Archive() ? "yes" : "no");

  text_log.PopIndent();
}
Esempio n. 23
0
static ONX_ErrorCounter Internal_Test( 
  unsigned int max_directory_tree_depth,
  ON_wString full_path,
  bool bVerbose,
  ON_TextLog& text_log,
  unsigned int& directory_counter,
  unsigned int& file_count,
  unsigned int& folder_count
)
{

  ONX_ErrorCounter err = ONX_ErrorCounter::Zero;

  if (ON_FileSystem::IsFile(full_path))
  {
    if (ON_FileStream::Is3dmFile(full_path, false))
    {
      text_log.Print(L"Testing 3dm file: %ls\n", static_cast<const wchar_t*>(full_path));
      err = Internal_TestFileRead(text_log, full_path, ON_wString::EmptyString, bVerbose);
      file_count++;
    }
  }
  else if ( max_directory_tree_depth > 0 )
  {
    if (full_path.Length() != 1 || false == ON_FileSystemPath::IsDirectorySeparator(full_path[0], true))
    {
      const wchar_t dir_seps[3] = { ON_FileSystemPath::DirectorySeparator,ON_FileSystemPath::AlternateDirectorySeparator,0 };
      full_path.TrimRight(dir_seps);
    }
    if (ON_FileSystem::IsDirectory(full_path))
    {
      text_log.Print(L"Testing 3dm files in folder: %ls\n", static_cast<const wchar_t*>(full_path));
      Internal_CTestContext test_context;
      directory_counter++;
      test_context.SetInitialDirecory(full_path,directory_counter);
      test_context.m_max_directory_tree_depth = max_directory_tree_depth;

      err = Internal_TestReadFolder(text_log, full_path, 1, bVerbose, test_context);
      file_count += test_context.m_file_count;
      folder_count += test_context.m_directory_count;
    }
  }

  return err;
}
Esempio n. 24
0
void ON_HatchLoop::Dump( ON_TextLog& dump) const
{
  if( m_type == ltOuter)
    dump.Print( "Outer hatch loop\n");
  if( m_type == ltInner)
    dump.Print( "Inner hatch loop\n");

  if ( 0 == m_p2dCurve )
  {
    dump.Print( "2d curve: null pointer\n");
  }
  else
  {
    dump.Print( "2d curve:\n");
    m_p2dCurve->Dump(dump);
  }

}
Esempio n. 25
0
void ON_Object::Dump( ON_TextLog& dump ) const
{
  const ON_ClassId* p = ClassId();
  if ( p ) 
  {
    const char* class_name = p->ClassName();
    if ( 0 == class_name ) 
      class_name = "unknown";
    dump.Print("class name: %s\n",class_name);
    dump.Print("class uuid: ");
    dump.Print(p->Uuid());
    dump.Print("\n");
  }
  else 
  {
    dump.Print("ON_Object::ClassId() FAILED\n");
  }
}
Esempio n. 26
0
static void DumpDistanceABHelper( ON_TextLog& text_log, ON_3dPoint A, ON_3dPoint B )
{
  const double tinyd = 1.0e-14;
  double d = A.DistanceTo(B);
  text_log.Print("distance A to B");
  if ( !ON_IsValid(d) || d >= 1.0e-14 || d <= 0.0 )
  {
    text_log.Print(" = ");
  }
  else
  {
    // This prevents diff from compaining about tiny changes.
    text_log.Print(" < ");
    d = tinyd;
  }
  text_log.Print(d);
  text_log.Print("\n");
}
Esempio n. 27
0
static
bool Read3dmUserDataHeader( const size_t offset, ON_BinaryArchive& file, ON_TextLog& dump )
{
  // TCODE_OPENNURBS_CLASS_USERDATA chunks have 2 uuids
  // the first identifies the type of ON_Object class
  // the second identifies that kind of user data
  ON_UUID userdata_classid = ON_nil_uuid;
  ON_UUID userdata_itemid = ON_nil_uuid;
  bool rc = file.ReadUuid( userdata_classid );
  if ( !rc )
  {
     ErrorReport(offset,"ReadUuid() failed to read the user data class id.",dump);
  }
  else
  {
    dump.Print("UserData class id = ");
    dump.Print( userdata_classid );
    const ON_ClassId* pUserDataClassId = ON_ClassId::ClassId(userdata_classid);
    if ( pUserDataClassId )
    {
      const char* sClassName = pUserDataClassId->ClassName();
      if ( sClassName )
      {
        dump.Print(" (%s)",sClassName);
      }
    }
    dump.Print("\n");

    rc = file.ReadUuid( userdata_itemid );
    if ( !rc )
    {
       ErrorReport(offset,"ReadUuid() failed to read the user data item id.",dump);
    }
    else
    {
      dump.Print("UserData item id = ");
      dump.Print( userdata_itemid );
      dump.Print("\n");

      int userdata_copycount = -1;
      rc = file.ReadInt( &userdata_copycount );
      if ( !rc )
      {
        ErrorReport(offset,"ReadInt() failed to read the user data copy count.",dump);
      }
      else
      {
        ON_Xform userdata_xform;
        rc = file.ReadXform( userdata_xform );
        if ( !rc )
        {
          ErrorReport(offset,"ReadXform() failed to read the user data xform.",dump);
        }
      }
    }
  }
  return rc;
}
Esempio n. 28
0
void ON_UserStringList::Dump( ON_TextLog& text_log ) const
{
  int i, count = m_e.Count();
  text_log.Print(L"%d entries\n",count);
  text_log.PushIndent();
  for ( i = 0; i < count; i++ )
  {
    m_e[i].Dump(text_log);
  }
  text_log.PopIndent();
}
Esempio n. 29
0
void ON_Layer::Dump( ON_TextLog& dump ) const
{
  const wchar_t* sName = LayerName();
  if ( !sName )
    sName = L"";
  dump.Print("index = %d\n",m_layer_index);
  dump.Print("name = \"%S\"\n",sName);
  dump.Print("display = %s\n",m_bVisible?"visible":"hidden");
  dump.Print("picking = %s\n",m_bLocked?"locked":"unlocked");
  dump.Print("display color rgb = "); dump.PrintRGB(m_color); dump.Print("\n");
  dump.Print("plot color rgb = "); dump.PrintRGB(m_plot_color); dump.Print("\n");
  dump.Print("default material index = %d\n",m_material_index);
}
Esempio n. 30
0
bool ON__ClassIdDumpNode::Dump( int depth, ON_TextLog& text_log )
{
  bool rc = true;
  if ( 0 == m_class_id || m_depth != 0 || depth < 1)
    rc = false;
  else
  {
    m_depth = depth;
    const char* class_name = m_class_id->ClassName();
    if ( 0 == class_name )
    {
      class_name = "!!ERROR!!";
      rc = false;
    }
    text_log.Print("%s::ClassId: ",m_class_id->ClassName());
    text_log.Print( "mark=%d ",m_class_id->Mark() );
    text_log.Print( m_class_id->Uuid() );
    text_log.Print("  (%08x)\n",m_class_id);
    int i, count = m_child_nodes.Count();
    if ( count > 0 )
    {
      // dump children names alphabetically
      m_child_nodes.HeapSort( ON__ClassIdDumpNode_CompareName );

      text_log.PushIndent();
      for ( i = 0; i < count; i++ )
      {
        ON__ClassIdDumpNode* child_node = m_child_nodes[i];
        if ( 0 == child_node )
          rc = false;
        else
        {
          if ( !child_node->Dump(depth+1,text_log) )
            rc = false;
        }
      }
      text_log.PopIndent();
    }
  }
  return rc;
}