(root)/
libredwg-0.13/
test/
unit-testing/
polyline_3d.c
       1  #define DWG_TYPE DWG_TYPE_POLYLINE_3D
       2  #include "common.c"
       3  
       4  void
       5  api_process (dwg_object *obj)
       6  {
       7    int error;
       8    BITCODE_BL num_owned, numpoints;
       9    BITCODE_RC flag, curve_type;
      10    dwg_point_3d *points;
      11    BITCODE_H first_vertex, last_vertex, *vertex, seqend;
      12    Dwg_Version_Type version = obj->parent->header.version;
      13  
      14    dwg_ent_polyline_3d *polyline_3d = dwg_object_to_POLYLINE_3D (obj);
      15  
      16    CHK_ENTITY_TYPE_W_OLD (polyline_3d, POLYLINE_3D, flag, RC);
      17    CHK_ENTITY_TYPE_W_OLD (polyline_3d, POLYLINE_3D, curve_type, RC);
      18    CHK_ENTITY_TYPE (polyline_3d, POLYLINE_3D, num_owned, BL);
      19    numpoints = dwg_object_polyline_3d_get_numpoints (obj, &error);
      20    if (error)
      21      fail ("polyline_3d_get_numpoints");
      22    if (numpoints != num_owned)
      23      ok ("TODO polyline_3d_get_numpoints: %d != num_owned: %d", numpoints,
      24          num_owned);
      25  
      26    points = dwg_object_polyline_3d_get_points (obj, &error);
      27    if (!error)
      28      for (BITCODE_BL i = 0; i < numpoints; i++)
      29        ok ("POLYLINE_3D.points[%d]: (%f, %f)", (int)i, points[i].x,
      30            points[i].y);
      31    else
      32      fail ("POLYLINE_3D.points");
      33    free (points);
      34  
      35    if (version >= R_13b1 && version <= R_2000)
      36      {
      37        CHK_ENTITY_H (polyline_3d, POLYLINE_3D, first_vertex);
      38        CHK_ENTITY_H (polyline_3d, POLYLINE_3D, last_vertex);
      39      }
      40    if (version >= R_2004)
      41      {
      42        CHK_ENTITY_HV (polyline_3d, POLYLINE_3D, vertex, num_owned);
      43      }
      44    CHK_ENTITY_H (polyline_3d, POLYLINE_3D, seqend);
      45  }