1 #define DWG_TYPE DWG_TYPE_MLINE
2 #include "common.c"
3
4 void
5 api_process (dwg_object *obj)
6 {
7 int error;
8 double scale;
9 BITCODE_RC justification;
10 BITCODE_RC num_lines;
11 BITCODE_BS i, num_verts, flags;
12 dwg_point_3d base_point, extrusion;
13 dwg_mline_vertex *verts, *v1;
14 BITCODE_H mlinestyle;
15
16 dwg_ent_mline *mline = dwg_object_to_MLINE (obj);
17
18 CHK_ENTITY_TYPE_W_OLD (mline, MLINE, scale, BD);
19 CHK_ENTITY_TYPE_W_OLD (mline, MLINE, justification, RC);
20 CHK_ENTITY_3RD_W_OLD (mline, MLINE, base_point);
21 CHK_ENTITY_3RD_W_OLD (mline, MLINE, extrusion);
22 CHK_ENTITY_TYPE_W_OLD (mline, MLINE, flags, BS);
23 CHK_ENTITY_TYPE_W_OLD (mline, MLINE, num_lines, RCd);
24 CHK_ENTITY_TYPE_W_OLD (mline, MLINE, num_verts, BS);
25
26 if (!dwg_dynapi_entity_value (mline, "MLINE", "verts", &v1, NULL))
27 fail ("MLINE.verts");
28 #ifdef USE_DEPRECATED_API
29 verts = dwg_ent_mline_get_verts (mline, &error);
30 #else
31 verts = (dwg_mline_vertex *)mline->verts;
32 error = 0;
33 #endif
34 if (error)
35 fail ("MLINE.verts");
36 else
37 {
38 for (i = 0; i < num_verts; i++)
39 {
40 #ifdef USE_DEPRECATED_API
41 dwg_mline_line *lines
42 = dwg_mline_vertex_get_lines (&verts[i], &error);
43 #else
44 dwg_mline_line *lines = (dwg_mline_line *)verts[i].lines;
45 #endif
46 if (error)
47 fail ("MLINE.verts[%d].lines", i);
48 else
49 {
50 for (int j = 0; j < num_lines; j++)
51 {
52 for (int k = 0; k < lines[j].num_segparms; k++)
53 {
54 ok ("MLINE.verts[%d].lines[%d].segparms[%d]: %f", i, j,
55 k, lines[j].segparms[k]);
56 }
57 for (int k = 0; k < lines[j].num_areafillparms; k++)
58 {
59 ok ("MLINE.verts[%d].lines[%d].areafillparms[%d]: %f", i,
60 j, k, lines[j].areafillparms[k]);
61 }
62 }
63 }
64 #ifdef USE_DEPRECATED_API
65 free (lines);
66 #endif
67
68 ok ("MLINE.verts[%d]: (%f, %f, %f)", i, verts[i].vertex.x,
69 verts[i].vertex.y, verts[i].vertex.z);
70 if (memcmp (&v1[i].vertex, &verts[i].vertex,
71 sizeof (verts[i].vertex)))
72 fail ("MLINE.verts[%d]", i);
73 }
74 }
75 #ifdef USE_DEPRECATED_API
76 free (verts);
77 #endif
78
79 CHK_ENTITY_H (mline, MLINE, mlinestyle);
80 }