1 #define DWG_TYPE DWG_TYPE_POLYLINE_2D
2 #include "common.c"
3 
4 void
api_process(dwg_object * obj)5 api_process (dwg_object *obj)
6 {
7   int error;
8   double start_width, end_width, elevation, thickness;
9   BITCODE_BL num_owned, numpoints;
10   BITCODE_BS flag, curve_type;
11   dwg_point_2d *points;
12   dwg_point_3d extrusion;
13   BITCODE_H first_vertex, last_vertex, *vertex, seqend;
14   Dwg_Version_Type version = obj->parent->header.version;
15 
16   dwg_ent_polyline_2d *polyline_2d = dwg_object_to_POLYLINE_2D (obj);
17 
18   CHK_ENTITY_TYPE_W_OLD (polyline_2d, POLYLINE_2D, flag, BS);
19   CHK_ENTITY_TYPE_W_OLD (polyline_2d, POLYLINE_2D, curve_type, BS);
20   CHK_ENTITY_TYPE_W_OLD (polyline_2d, POLYLINE_2D, start_width, BD);
21   CHK_ENTITY_TYPE_W_OLD (polyline_2d, POLYLINE_2D, end_width, BD);
22   CHK_ENTITY_TYPE (polyline_2d, POLYLINE_2D, num_owned, BL);
23   numpoints = dwg_object_polyline_2d_get_numpoints (obj, &error);
24   if (error)
25     fail ("polyline_2d_get_numpoints");
26   if (numpoints != num_owned)
27     ok ("TODO polyline_2d_get_numpoints: %d != num_owned: %d", numpoints,
28         num_owned);
29 
30   CHK_ENTITY_TYPE_W_OLD (polyline_2d, POLYLINE_2D, thickness, BD);
31   CHK_ENTITY_TYPE_W_OLD (polyline_2d, POLYLINE_2D, elevation, BD);
32   CHK_ENTITY_3RD_W_OLD (polyline_2d, POLYLINE_2D, extrusion);
33 
34   points = dwg_object_polyline_2d_get_points (obj, &error);
35   if (!error)
36     for (BITCODE_BL i = 0; i < numpoints; i++)
37       ok ("POLYLINE_2D.points[%d]: (%f, %f)", (int)i, points[i].x,
38           points[i].y);
39   else
40     fail ("POLYLINE_2D.points");
41   free (points);
42 
43   if (version >= R_2004)
44     {
45       CHK_ENTITY_HV (polyline_2d, POLYLINE_2D, vertex, num_owned);
46     }
47   if (version >= R_13 && version <= R_2000)
48     {
49       CHK_ENTITY_H (polyline_2d, POLYLINE_2D, first_vertex);
50       CHK_ENTITY_H (polyline_2d, POLYLINE_2D, last_vertex);
51     }
52   CHK_ENTITY_H (polyline_2d, POLYLINE_2D, seqend);
53 }
54