libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00047 #include "insert.h" 00048 00049 00055 DxfInsert * 00056 dxf_insert_new () 00057 { 00058 #if DEBUG 00059 DXF_DEBUG_BEGIN 00060 #endif 00061 DxfInsert *insert = NULL; 00062 size_t size; 00063 00064 size = sizeof (DxfInsert); 00065 /* avoid malloc of 0 bytes */ 00066 if (size == 0) size = 1; 00067 if ((insert = malloc (size)) == NULL) 00068 { 00069 fprintf (stderr, 00070 (_("Error in %s () could not allocate memory for a DxfInsert struct.\n")), 00071 __FUNCTION__); 00072 insert = NULL; 00073 } 00074 else 00075 { 00076 memset (insert, 0, size); 00077 } 00078 #if DEBUG 00079 DXF_DEBUG_END 00080 #endif 00081 return (insert); 00082 } 00083 00084 00091 DxfInsert * 00092 dxf_insert_init 00093 ( 00094 DxfInsert *insert 00096 ) 00097 { 00098 #if DEBUG 00099 DXF_DEBUG_BEGIN 00100 #endif 00101 /* Do some basic checks. */ 00102 if (insert == NULL) 00103 { 00104 fprintf (stderr, 00105 (_("Warning in %s () a NULL pointer was passed.\n")), 00106 __FUNCTION__); 00107 insert = dxf_insert_new (); 00108 } 00109 if (insert == NULL) 00110 { 00111 fprintf (stderr, 00112 (_("Error in %s () could not allocate memory for a DxfInsert struct.\n")), 00113 __FUNCTION__); 00114 return (NULL); 00115 } 00116 dxf_insert_set_id_code (insert, 0); 00117 dxf_insert_set_linetype (insert, strdup (DXF_DEFAULT_LINETYPE)); 00118 dxf_insert_set_layer (insert, strdup (DXF_DEFAULT_LAYER)); 00119 dxf_insert_set_elevation (insert, 0.0); 00120 dxf_insert_set_thickness (insert, 0.0); 00121 dxf_insert_set_linetype_scale (insert, DXF_DEFAULT_LINETYPE_SCALE); 00122 dxf_insert_set_visibility (insert, DXF_DEFAULT_VISIBILITY); 00123 dxf_insert_set_color (insert, DXF_COLOR_BYLAYER); 00124 dxf_insert_set_paperspace (insert, DXF_MODELSPACE); 00125 dxf_insert_set_graphics_data_size (insert, 0); 00126 dxf_insert_set_shadow_mode (insert, 0); 00127 dxf_insert_set_binary_graphics_data (insert, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ()); 00128 dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_insert_get_binary_graphics_data (insert)); 00129 dxf_insert_set_dictionary_owner_soft (insert, strdup ("")); 00130 dxf_insert_set_material (insert, strdup ("")); 00131 dxf_insert_set_dictionary_owner_hard (insert, strdup ("")); 00132 dxf_insert_set_lineweight (insert, 0.0); 00133 dxf_insert_set_plot_style_name (insert, strdup ("")); 00134 dxf_insert_set_color_value (insert, 0); 00135 dxf_insert_set_color_name (insert, strdup ("")); 00136 dxf_insert_set_transparency (insert, 0); 00137 dxf_insert_set_block_name (insert, strdup ("")); 00138 dxf_insert_set_p0 (insert, dxf_point_new ()); 00139 dxf_point_init ((DxfPoint *) dxf_insert_get_p0 (insert)); 00140 dxf_insert_set_x0 (insert, 0.0); 00141 dxf_insert_set_y0 (insert, 0.0); 00142 dxf_insert_set_z0 (insert, 0.0); 00143 dxf_insert_set_rel_x_scale (insert, 1.0); 00144 dxf_insert_set_rel_y_scale (insert, 1.0); 00145 dxf_insert_set_rel_z_scale (insert, 1.0); 00146 dxf_insert_set_column_spacing (insert, 0.0); 00147 dxf_insert_set_row_spacing (insert, 0.0); 00148 dxf_insert_set_rot_angle (insert, 0.0); 00149 dxf_insert_set_attributes_follow (insert, 0); 00150 dxf_insert_set_columns (insert, 0); 00151 dxf_insert_set_rows (insert, 0); 00152 dxf_insert_set_extr_x0 (insert, 0.0); 00153 dxf_insert_set_extr_y0 (insert, 0.0); 00154 dxf_insert_set_extr_z0 (insert, 0.0); 00155 dxf_insert_set_next (insert, NULL); 00156 #if DEBUG 00157 DXF_DEBUG_END 00158 #endif 00159 return (insert); 00160 } 00161 00162 00174 DxfInsert * 00175 dxf_insert_read 00176 ( 00177 DxfFile *fp, 00179 DxfInsert *insert 00181 ) 00182 { 00183 #if DEBUG 00184 DXF_DEBUG_BEGIN 00185 #endif 00186 char *temp_string = NULL; 00187 00188 /* Do some basic checks. */ 00189 if (fp == NULL) 00190 { 00191 fprintf (stderr, 00192 (_("Error in %s () a NULL file pointer was passed.\n")), 00193 __FUNCTION__); 00194 /* Clean up. */ 00195 free (temp_string); 00196 return (NULL); 00197 } 00198 if (insert == NULL) 00199 { 00200 fprintf (stderr, 00201 (_("Warning in %s () a NULL pointer was passed.\n")), 00202 __FUNCTION__); 00203 insert = dxf_insert_new (); 00204 insert = dxf_insert_init (insert); 00205 } 00206 (fp->line_number)++; 00207 fscanf (fp->fp, "%[^\n]", temp_string); 00208 while (strcmp (temp_string, "0") != 0) 00209 { 00210 if (ferror (fp->fp)) 00211 { 00212 fprintf (stderr, 00213 (_("Error in %s () while reading from: %s in line: %d.\n")), 00214 __FUNCTION__, fp->filename, fp->line_number); 00215 fclose (fp->fp); 00216 /* Clean up. */ 00217 free (temp_string); 00218 return (NULL); 00219 } 00220 if (strcmp (temp_string, "2") == 0) 00221 { 00222 /* Now follows a string containing a block name 00223 * value. */ 00224 (fp->line_number)++; 00225 fscanf (fp->fp, "%s\n", insert->block_name); 00226 } 00227 else if (strcmp (temp_string, "5") == 0) 00228 { 00229 /* Now follows a string containing a sequential 00230 * id number. */ 00231 (fp->line_number)++; 00232 fscanf (fp->fp, "%x\n", &insert->id_code); 00233 } 00234 else if (strcmp (temp_string, "6") == 0) 00235 { 00236 /* Now follows a string containing a linetype 00237 * name. */ 00238 (fp->line_number)++; 00239 fscanf (fp->fp, "%s\n", insert->linetype); 00240 } 00241 else if (strcmp (temp_string, "8") == 0) 00242 { 00243 /* Now follows a string containing a layer name. */ 00244 (fp->line_number)++; 00245 fscanf (fp->fp, "%s\n", insert->layer); 00246 } 00247 else if (strcmp (temp_string, "10") == 0) 00248 { 00249 /* Now follows a string containing the 00250 * X-coordinate of the center point. */ 00251 (fp->line_number)++; 00252 fscanf (fp->fp, "%lf\n", &insert->p0->x0); 00253 } 00254 else if (strcmp (temp_string, "20") == 0) 00255 { 00256 /* Now follows a string containing the 00257 * Y-coordinate of the center point. */ 00258 (fp->line_number)++; 00259 fscanf (fp->fp, "%lf\n", &insert->p0->y0); 00260 } 00261 else if (strcmp (temp_string, "30") == 0) 00262 { 00263 /* Now follows a string containing the 00264 * Z-coordinate of the center point. */ 00265 (fp->line_number)++; 00266 fscanf (fp->fp, "%lf\n", &insert->p0->z0); 00267 } 00268 else if ((fp->acad_version_number <= AutoCAD_11) 00269 && (strcmp (temp_string, "38") == 0) 00270 && (insert->elevation != 0.0)) 00271 { 00272 /* Now follows a string containing the 00273 * elevation. */ 00274 (fp->line_number)++; 00275 fscanf (fp->fp, "%lf\n", &insert->elevation); 00276 } 00277 else if (strcmp (temp_string, "39") == 0) 00278 { 00279 /* Now follows a string containing the 00280 * thickness. */ 00281 (fp->line_number)++; 00282 fscanf (fp->fp, "%lf\n", &insert->thickness); 00283 } 00284 else if (strcmp (temp_string, "41") == 0) 00285 { 00286 /* Now follows a string containing the 00287 * relative X-scale. */ 00288 (fp->line_number)++; 00289 fscanf (fp->fp, "%lf\n", &insert->rel_x_scale); 00290 } 00291 else if (strcmp (temp_string, "42") == 0) 00292 { 00293 /* Now follows a string containing the 00294 * relative Y-scale. */ 00295 (fp->line_number)++; 00296 fscanf (fp->fp, "%lf\n", &insert->rel_y_scale); 00297 } 00298 else if (strcmp (temp_string, "43") == 0) 00299 { 00300 /* Now follows a string containing the 00301 * relative Z-scale. */ 00302 (fp->line_number)++; 00303 fscanf (fp->fp, "%lf\n", &insert->rel_z_scale); 00304 } 00305 else if (strcmp (temp_string, "44") == 0) 00306 { 00307 /* Now follows a string containing the 00308 * column spacing. */ 00309 (fp->line_number)++; 00310 fscanf (fp->fp, "%lf\n", &insert->column_spacing); 00311 } 00312 else if (strcmp (temp_string, "45") == 0) 00313 { 00314 /* Now follows a string containing the 00315 * row spacing. */ 00316 (fp->line_number)++; 00317 fscanf (fp->fp, "%lf\n", &insert->row_spacing); 00318 } 00319 else if (strcmp (temp_string, "48") == 0) 00320 { 00321 /* Now follows a string containing the linetype 00322 * scale. */ 00323 (fp->line_number)++; 00324 fscanf (fp->fp, "%lf\n", &insert->linetype_scale); 00325 } 00326 else if (strcmp (temp_string, "50") == 0) 00327 { 00328 /* Now follows a string containing the 00329 * rotation angle. */ 00330 (fp->line_number)++; 00331 fscanf (fp->fp, "%lf\n", &insert->rot_angle); 00332 } 00333 else if (strcmp (temp_string, "60") == 0) 00334 { 00335 /* Now follows a string containing the 00336 * visibility value. */ 00337 (fp->line_number)++; 00338 fscanf (fp->fp, "%hd\n", &insert->visibility); 00339 } 00340 else if (strcmp (temp_string, "62") == 0) 00341 { 00342 /* Now follows a string containing the 00343 * color value. */ 00344 (fp->line_number)++; 00345 fscanf (fp->fp, "%d\n", &insert->color); 00346 } 00347 else if (strcmp (temp_string, "66") == 0) 00348 { 00349 /* Now follows a string containing the 00350 * attributes follow flag. */ 00351 (fp->line_number)++; 00352 fscanf (fp->fp, "%d\n", &insert->attributes_follow); 00358 } 00359 else if (strcmp (temp_string, "67") == 0) 00360 { 00361 /* Now follows a string containing the 00362 * paperspace value. */ 00363 (fp->line_number)++; 00364 fscanf (fp->fp, "%d\n", &insert->paperspace); 00365 } 00366 else if (strcmp (temp_string, "70") == 0) 00367 { 00368 /* Now follows a string containing the 00369 * number of columns. */ 00370 (fp->line_number)++; 00371 fscanf (fp->fp, "%d\n", &insert->columns); 00372 } 00373 else if (strcmp (temp_string, "71") == 0) 00374 { 00375 /* Now follows a string containing the 00376 * number of rows. */ 00377 (fp->line_number)++; 00378 fscanf (fp->fp, "%d\n", &insert->rows); 00379 } 00380 else if ((fp->acad_version_number >= AutoCAD_13) 00381 && (strcmp (temp_string, "100") == 0)) 00382 { 00383 /* Now follows a string containing the 00384 * subclass marker value. */ 00385 (fp->line_number)++; 00386 fscanf (fp->fp, "%s\n", temp_string); 00387 if ((strcmp (temp_string, "AcDbEntity") != 0) 00388 && (strcmp (temp_string, "AcDbBlockReference") != 0)) 00389 { 00390 fprintf (stderr, 00391 (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")), 00392 __FUNCTION__, fp->filename, fp->line_number); 00393 } 00394 } 00395 else if (strcmp (temp_string, "210") == 0) 00396 { 00397 /* Now follows a string containing the 00398 * X-value of the extrusion vector. */ 00399 (fp->line_number)++; 00400 fscanf (fp->fp, "%lf\n", &insert->extr_x0); 00401 } 00402 else if (strcmp (temp_string, "220") == 0) 00403 { 00404 /* Now follows a string containing the 00405 * Y-value of the extrusion vector. */ 00406 (fp->line_number)++; 00407 fscanf (fp->fp, "%lf\n", &insert->extr_y0); 00408 } 00409 else if (strcmp (temp_string, "230") == 0) 00410 { 00411 /* Now follows a string containing the 00412 * Z-value of the extrusion vector. */ 00413 (fp->line_number)++; 00414 fscanf (fp->fp, "%lf\n", &insert->extr_z0); 00415 } 00416 else if (strcmp (temp_string, "330") == 0) 00417 { 00418 /* Now follows a string containing Soft-pointer 00419 * ID/handle to owner dictionary. */ 00420 (fp->line_number)++; 00421 fscanf (fp->fp, "%s\n", insert->dictionary_owner_soft); 00422 } 00423 else if (strcmp (temp_string, "360") == 0) 00424 { 00425 /* Now follows a string containing Hard owner 00426 * ID/handle to owner dictionary. */ 00427 (fp->line_number)++; 00428 fscanf (fp->fp, "%s\n", insert->dictionary_owner_hard); 00429 } 00430 else if (strcmp (temp_string, "999") == 0) 00431 { 00432 /* Now follows a string containing a comment. */ 00433 (fp->line_number)++; 00434 fscanf (fp->fp, "%s\n", temp_string); 00435 fprintf (stdout, "DXF comment: %s\n", temp_string); 00436 } 00437 else 00438 { 00439 fprintf (stderr, 00440 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00441 __FUNCTION__, fp->filename, fp->line_number); 00442 } 00443 } 00444 /* Handle omitted members and/or illegal values. */ 00445 if (strcmp (dxf_insert_get_linetype (insert), "") == 0) 00446 { 00447 dxf_insert_set_linetype (insert, strdup (DXF_DEFAULT_LINETYPE)); 00448 } 00449 if (strcmp (dxf_insert_get_layer (insert), "") == 0) 00450 { 00451 dxf_insert_set_layer (insert, strdup (DXF_DEFAULT_LAYER)); 00452 } 00453 /* Clean up. */ 00454 free (temp_string); 00455 #if DEBUG 00456 DXF_DEBUG_END 00457 #endif 00458 return (insert); 00459 } 00460 00461 00468 int 00469 dxf_insert_write 00470 ( 00471 DxfFile *fp, 00473 DxfInsert *insert 00475 ) 00476 { 00477 #if DEBUG 00478 DXF_DEBUG_BEGIN 00479 #endif 00480 char *dxf_entity_name = strdup ("INSERT"); 00481 00482 /* Do some basic checks. */ 00483 if (fp == NULL) 00484 { 00485 fprintf (stderr, 00486 (_("Error in %s () a NULL file pointer was passed.\n")), 00487 __FUNCTION__); 00488 /* Clean up. */ 00489 free (dxf_entity_name); 00490 return (EXIT_FAILURE); 00491 } 00492 if (insert == NULL) 00493 { 00494 fprintf (stderr, 00495 (_("Error in %s () a NULL pointer was passed.\n")), 00496 __FUNCTION__); 00497 /* Clean up. */ 00498 free (dxf_entity_name); 00499 return (EXIT_FAILURE); 00500 } 00501 if (strcmp (dxf_insert_get_linetype (insert), "") == 0) 00502 { 00503 fprintf (stderr, 00504 (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")), 00505 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00506 fprintf (stderr, 00507 (_("\t%s entity is reset to default linetype")), 00508 dxf_entity_name); 00509 dxf_insert_set_linetype (insert, strdup (DXF_DEFAULT_LINETYPE)); 00510 } 00511 if (strcmp (dxf_insert_get_layer (insert), "") == 0) 00512 { 00513 fprintf (stderr, 00514 (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")), 00515 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00516 fprintf (stderr, 00517 (_("\t%s entity is relocated to layer 0.\n")), 00518 dxf_entity_name); 00519 dxf_insert_set_layer (insert, strdup (DXF_DEFAULT_LAYER)); 00520 } 00521 if (dxf_insert_get_rel_x_scale (insert) == 0.0) 00522 { 00523 fprintf (stderr, 00524 (_("Warning in %s () relative X-scale factor has a value of 0.0 for the %s entity with id-code: %x\n")), 00525 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00526 fprintf (stderr, 00527 (_("\tdefault relative X-scale of 1.0 applied to %s entity.\n")), 00528 dxf_entity_name); 00529 dxf_insert_set_rel_x_scale (insert, 1.0); 00530 } 00531 if (dxf_insert_get_rel_y_scale (insert) == 0.0) 00532 { 00533 fprintf (stderr, 00534 (_("Warning in %s () relative Y-scale factor has a value of 0.0 for the %s entity with id-code: %x\n")), 00535 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00536 fprintf (stderr, 00537 (_("\tdefault relative Y-scale of 1.0 applied to %s entity.\n")), 00538 dxf_entity_name); 00539 dxf_insert_set_rel_y_scale (insert, 1.0); 00540 } 00541 if (dxf_insert_get_rel_z_scale (insert) == 0.0) 00542 { 00543 fprintf (stderr, 00544 (_("Warning in %s () relative Z-scale factor has a value of 0.0 for the %s entity with id-code: %x\n")), 00545 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00546 fprintf (stderr, 00547 (_("\tdefault relative Z-scale of 1.0 applied to %s entity.\n")), 00548 dxf_entity_name); 00549 dxf_insert_set_rel_z_scale (insert, 1.0); 00550 } 00551 if ((dxf_insert_get_columns (insert) > 1) 00552 && (dxf_insert_get_column_spacing (insert) == 0.0)) 00553 { 00554 fprintf (stderr, 00555 (_("Warning in %s () number of columns is greater than 1 and the column spacing has a value of 0.0 for the %s entity with id-code: %x\n")), 00556 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00557 fprintf (stderr, 00558 (_("\tdefault number of columns value of 1 applied to %s entity.\n")), 00559 dxf_entity_name); 00560 dxf_insert_set_columns (insert, 1); 00561 } 00562 if ((dxf_insert_get_rows (insert) > 1) 00563 && (dxf_insert_get_row_spacing (insert) == 0.0)) 00564 { 00565 fprintf (stderr, 00566 (_("Warning in %s () number of rows is greater than 1 and the row spacing has a value of 0.0 for the %s entity with id-code: %x\n")), 00567 __FUNCTION__, dxf_entity_name, dxf_insert_get_id_code (insert)); 00568 fprintf (stderr, 00569 (_("\tdefault number of rows value of 1 applied to %s entity.\n")), 00570 dxf_entity_name); 00571 dxf_insert_set_rows (insert, 1); 00572 } 00573 /* Start writing output. */ 00574 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00575 if (dxf_insert_get_id_code (insert) != -1) 00576 { 00577 fprintf (fp->fp, " 5\n%x\n", dxf_insert_get_id_code (insert)); 00578 } 00589 if ((strcmp (dxf_insert_get_dictionary_owner_soft (insert), "") != 0) 00590 && (fp->acad_version_number >= AutoCAD_14)) 00591 { 00592 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00593 fprintf (fp->fp, "330\n%s\n", dxf_insert_get_dictionary_owner_soft (insert)); 00594 fprintf (fp->fp, "102\n}\n"); 00595 } 00596 if ((strcmp (dxf_insert_get_dictionary_owner_hard (insert), "") != 0) 00597 && (fp->acad_version_number >= AutoCAD_14)) 00598 { 00599 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00600 fprintf (fp->fp, "360\n%s\n", dxf_insert_get_dictionary_owner_hard (insert)); 00601 fprintf (fp->fp, "102\n}\n"); 00602 } 00603 if (fp->acad_version_number >= AutoCAD_13) 00604 { 00605 fprintf (fp->fp, "100\nAcDbEntity\n"); 00606 } 00607 if (dxf_insert_get_paperspace (insert) == DXF_PAPERSPACE) 00608 { 00609 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00610 } 00611 fprintf (fp->fp, " 8\n%s\n", dxf_insert_get_layer (insert)); 00612 if (strcmp (dxf_insert_get_linetype (insert), DXF_DEFAULT_LINETYPE) != 0) 00613 { 00614 fprintf (fp->fp, " 6\n%s\n", dxf_insert_get_linetype (insert)); 00615 } 00616 if ((fp->acad_version_number <= AutoCAD_11) 00617 && DXF_FLATLAND 00618 && (dxf_insert_get_elevation (insert) != 0.0)) 00619 { 00620 fprintf (fp->fp, " 38\n%f\n", dxf_insert_get_elevation (insert)); 00621 } 00622 if (dxf_insert_get_thickness (insert) != 0.0) 00623 { 00624 fprintf (fp->fp, " 39\n%f\n", dxf_insert_get_thickness (insert)); 00625 } 00626 if (dxf_insert_get_color (insert)!= DXF_COLOR_BYLAYER) 00627 { 00628 fprintf (fp->fp, " 62\n%d\n", dxf_insert_get_color (insert)); 00629 } 00630 if (dxf_insert_get_linetype_scale (insert) != 1.0) 00631 { 00632 fprintf (fp->fp, " 48\n%f\n", dxf_insert_get_linetype_scale (insert)); 00633 } 00634 if (dxf_insert_get_visibility (insert) != 0) 00635 { 00636 fprintf (fp->fp, " 60\n%d\n", dxf_insert_get_visibility (insert)); 00637 } 00638 if (fp->acad_version_number >= AutoCAD_13) 00639 { 00640 fprintf (fp->fp, "100\nAcDbBlockReference\n"); 00641 } 00642 if (dxf_insert_get_attributes_follow (insert) != 0) 00643 { 00644 fprintf (fp->fp, " 66\n%d\n", dxf_insert_get_attributes_follow (insert)); 00650 } 00651 fprintf (fp->fp, " 2\n%s\n", dxf_insert_get_block_name (insert)); 00652 fprintf (fp->fp, " 10\n%f\n", dxf_insert_get_x0 (insert)); 00653 fprintf (fp->fp, " 20\n%f\n", dxf_insert_get_y0 (insert)); 00654 fprintf (fp->fp, " 30\n%f\n", dxf_insert_get_z0 (insert)); 00655 if (dxf_insert_get_rel_x_scale (insert) != 1.0) 00656 { 00657 fprintf (fp->fp, " 41\n%f\n", dxf_insert_get_rel_x_scale (insert)); 00658 } 00659 if (dxf_insert_get_rel_y_scale (insert) != 1.0) 00660 { 00661 fprintf (fp->fp, " 42\n%f\n", dxf_insert_get_rel_y_scale (insert)); 00662 } 00663 if (dxf_insert_get_rel_z_scale (insert) != 1.0) 00664 { 00665 fprintf (fp->fp, " 43\n%f\n", dxf_insert_get_rel_z_scale (insert)); 00666 } 00667 if (dxf_insert_get_rot_angle (insert) != 0.0) 00668 { 00669 fprintf (fp->fp, " 50\n%f\n", dxf_insert_get_rot_angle (insert)); 00670 } 00671 if (dxf_insert_get_columns (insert) > 1) 00672 { 00673 fprintf (fp->fp, " 70\n%d\n", dxf_insert_get_columns (insert)); 00674 } 00675 if (dxf_insert_get_rows (insert) > 1) 00676 { 00677 fprintf (fp->fp, " 71\n%d\n", dxf_insert_get_rows (insert)); 00678 } 00679 if ((dxf_insert_get_columns (insert) > 1) 00680 && (dxf_insert_get_column_spacing (insert) > 0.0)) 00681 { 00682 fprintf (fp->fp, " 44\n%f\n", dxf_insert_get_column_spacing (insert)); 00683 } 00684 if ((dxf_insert_get_rows (insert) > 1) 00685 && (dxf_insert_get_row_spacing (insert) > 0.0)) 00686 { 00687 fprintf (fp->fp, " 45\n%f\n", dxf_insert_get_row_spacing (insert)); 00688 } 00689 if (fp->acad_version_number >= AutoCAD_12) 00690 { 00691 fprintf (fp->fp, "210\n%f\n", dxf_insert_get_extr_x0 (insert)); 00692 fprintf (fp->fp, "220\n%f\n", dxf_insert_get_extr_y0 (insert)); 00693 fprintf (fp->fp, "230\n%f\n", dxf_insert_get_extr_z0 (insert)); 00694 } 00695 /* Clean up. */ 00696 free (dxf_entity_name); 00697 #if DEBUG 00698 DXF_DEBUG_END 00699 #endif 00700 return (EXIT_SUCCESS); 00701 } 00702 00703 00711 int 00712 dxf_insert_free 00713 ( 00714 DxfInsert *insert 00717 ) 00718 { 00719 #if DEBUG 00720 DXF_DEBUG_BEGIN 00721 #endif 00722 /* Do some basic checks. */ 00723 if (insert == NULL) 00724 { 00725 fprintf (stderr, 00726 (_("Error in %s () a NULL pointer was passed.\n")), 00727 __FUNCTION__); 00728 return (EXIT_FAILURE); 00729 } 00730 if (insert->next != NULL) 00731 { 00732 fprintf (stderr, 00733 (_("Error in %s () pointer to next was not NULL.\n")), 00734 __FUNCTION__); 00735 return (EXIT_FAILURE); 00736 } 00737 free (dxf_insert_get_linetype (insert)); 00738 free (dxf_insert_get_layer (insert)); 00739 dxf_binary_graphics_data_free_chain (dxf_insert_get_binary_graphics_data (insert)); 00740 free (dxf_insert_get_dictionary_owner_soft (insert)); 00741 free (dxf_insert_get_material (insert)); 00742 free (dxf_insert_get_dictionary_owner_hard (insert)); 00743 free (dxf_insert_get_plot_style_name (insert)); 00744 free (dxf_insert_get_color_name (insert)); 00745 free (dxf_insert_get_block_name (insert)); 00746 free (insert); 00747 insert = NULL; 00748 #if DEBUG 00749 DXF_DEBUG_END 00750 #endif 00751 return (EXIT_SUCCESS); 00752 } 00753 00754 00759 void 00760 dxf_insert_free_chain 00761 ( 00762 DxfInsert *inserts 00764 ) 00765 { 00766 #ifdef DEBUG 00767 DXF_DEBUG_BEGIN 00768 #endif 00769 if (inserts == NULL) 00770 { 00771 fprintf (stderr, 00772 (_("Warning in %s () a NULL pointer was passed.\n")), 00773 __FUNCTION__); 00774 } 00775 while (inserts != NULL) 00776 { 00777 struct DxfInsert *iter = inserts->next; 00778 dxf_insert_free (inserts); 00779 inserts = (DxfInsert *) iter; 00780 } 00781 #if DEBUG 00782 DXF_DEBUG_END 00783 #endif 00784 } 00785 00786 00792 int 00793 dxf_insert_get_id_code 00794 ( 00795 DxfInsert *insert 00797 ) 00798 { 00799 #if DEBUG 00800 DXF_DEBUG_BEGIN 00801 #endif 00802 /* Do some basic checks. */ 00803 if (insert == NULL) 00804 { 00805 fprintf (stderr, 00806 (_("Error in %s () a NULL pointer was passed.\n")), 00807 __FUNCTION__); 00808 return (EXIT_FAILURE); 00809 } 00810 if (insert->id_code < 0) 00811 { 00812 fprintf (stderr, 00813 (_("Error in %s () a negative value was found.\n")), 00814 __FUNCTION__); 00815 return (EXIT_FAILURE); 00816 } 00817 #if DEBUG 00818 DXF_DEBUG_END 00819 #endif 00820 return (insert->id_code); 00821 } 00822 00823 00827 DxfInsert * 00828 dxf_insert_set_id_code 00829 ( 00830 DxfInsert *insert, 00832 int id_code 00836 ) 00837 { 00838 #if DEBUG 00839 DXF_DEBUG_BEGIN 00840 #endif 00841 /* Do some basic checks. */ 00842 if (insert == NULL) 00843 { 00844 fprintf (stderr, 00845 (_("Error in %s () a NULL pointer was passed.\n")), 00846 __FUNCTION__); 00847 return (NULL); 00848 } 00849 if (id_code < 0) 00850 { 00851 fprintf (stderr, 00852 (_("Error in %s () a negative id-code value was passed.\n")), 00853 __FUNCTION__); 00854 return (NULL); 00855 } 00856 insert->id_code = id_code; 00857 #if DEBUG 00858 DXF_DEBUG_END 00859 #endif 00860 return (insert); 00861 } 00862 00863 00869 char * 00870 dxf_insert_get_linetype 00871 ( 00872 DxfInsert *insert 00874 ) 00875 { 00876 #if DEBUG 00877 DXF_DEBUG_BEGIN 00878 #endif 00879 /* Do some basic checks. */ 00880 if (insert == NULL) 00881 { 00882 fprintf (stderr, 00883 (_("Error in %s () a NULL pointer was passed.\n")), 00884 __FUNCTION__); 00885 return (NULL); 00886 } 00887 if (insert->linetype == NULL) 00888 { 00889 fprintf (stderr, 00890 (_("Error in %s () a NULL pointer was found.\n")), 00891 __FUNCTION__); 00892 return (NULL); 00893 } 00894 #if DEBUG 00895 DXF_DEBUG_END 00896 #endif 00897 return (strdup (insert->linetype)); 00898 } 00899 00900 00904 DxfInsert * 00905 dxf_insert_set_linetype 00906 ( 00907 DxfInsert *insert, 00909 char *linetype 00911 ) 00912 { 00913 #if DEBUG 00914 DXF_DEBUG_BEGIN 00915 #endif 00916 /* Do some basic checks. */ 00917 if (insert == NULL) 00918 { 00919 fprintf (stderr, 00920 (_("Error in %s () a NULL pointer was passed.\n")), 00921 __FUNCTION__); 00922 return (NULL); 00923 } 00924 if (linetype == NULL) 00925 { 00926 fprintf (stderr, 00927 (_("Error in %s () a NULL pointer was passed.\n")), 00928 __FUNCTION__); 00929 return (NULL); 00930 } 00931 insert->linetype = strdup (linetype); 00932 #if DEBUG 00933 DXF_DEBUG_END 00934 #endif 00935 return (insert); 00936 } 00937 00938 00944 char * 00945 dxf_insert_get_layer 00946 ( 00947 DxfInsert *insert 00949 ) 00950 { 00951 #if DEBUG 00952 DXF_DEBUG_BEGIN 00953 #endif 00954 /* Do some basic checks. */ 00955 if (insert == NULL) 00956 { 00957 fprintf (stderr, 00958 (_("Error in %s () a NULL pointer was passed.\n")), 00959 __FUNCTION__); 00960 return (NULL); 00961 } 00962 if (insert->layer == NULL) 00963 { 00964 fprintf (stderr, 00965 (_("Error in %s () a NULL pointer was found.\n")), 00966 __FUNCTION__); 00967 return (NULL); 00968 } 00969 #if DEBUG 00970 DXF_DEBUG_END 00971 #endif 00972 return (strdup (insert->layer)); 00973 } 00974 00975 00979 DxfInsert * 00980 dxf_insert_set_layer 00981 ( 00982 DxfInsert *insert, 00984 char *layer 00986 ) 00987 { 00988 #if DEBUG 00989 DXF_DEBUG_BEGIN 00990 #endif 00991 /* Do some basic checks. */ 00992 if (insert == NULL) 00993 { 00994 fprintf (stderr, 00995 (_("Error in %s () a NULL pointer was passed.\n")), 00996 __FUNCTION__); 00997 return (NULL); 00998 } 00999 if (layer == NULL) 01000 { 01001 fprintf (stderr, 01002 (_("Error in %s () a NULL pointer was passed.\n")), 01003 __FUNCTION__); 01004 return (NULL); 01005 } 01006 insert->layer = strdup (layer); 01007 #if DEBUG 01008 DXF_DEBUG_END 01009 #endif 01010 return (insert); 01011 } 01012 01013 01019 double 01020 dxf_insert_get_elevation 01021 ( 01022 DxfInsert *insert 01024 ) 01025 { 01026 #if DEBUG 01027 DXF_DEBUG_BEGIN 01028 #endif 01029 /* Do some basic checks. */ 01030 if (insert == NULL) 01031 { 01032 fprintf (stderr, 01033 (_("Error in %s () a NULL pointer was passed.\n")), 01034 __FUNCTION__); 01035 return (EXIT_FAILURE); 01036 } 01037 #if DEBUG 01038 DXF_DEBUG_END 01039 #endif 01040 return (insert->elevation); 01041 } 01042 01043 01047 DxfInsert * 01048 dxf_insert_set_elevation 01049 ( 01050 DxfInsert *insert, 01052 double elevation 01054 ) 01055 { 01056 #if DEBUG 01057 DXF_DEBUG_BEGIN 01058 #endif 01059 /* Do some basic checks. */ 01060 if (insert == NULL) 01061 { 01062 fprintf (stderr, 01063 (_("Error in %s () a NULL pointer was passed.\n")), 01064 __FUNCTION__); 01065 return (NULL); 01066 } 01067 insert->elevation = elevation; 01068 #if DEBUG 01069 DXF_DEBUG_END 01070 #endif 01071 return (insert); 01072 } 01073 01074 01080 double 01081 dxf_insert_get_thickness 01082 ( 01083 DxfInsert *insert 01085 ) 01086 { 01087 #if DEBUG 01088 DXF_DEBUG_BEGIN 01089 #endif 01090 /* Do some basic checks. */ 01091 if (insert == NULL) 01092 { 01093 fprintf (stderr, 01094 (_("Error in %s () a NULL pointer was passed.\n")), 01095 __FUNCTION__); 01096 return (EXIT_FAILURE); 01097 } 01098 if (insert->thickness < 0.0) 01099 { 01100 fprintf (stderr, 01101 (_("Error in %s () a negative value was found.\n")), 01102 __FUNCTION__); 01103 return (EXIT_FAILURE); 01104 } 01105 #if DEBUG 01106 DXF_DEBUG_END 01107 #endif 01108 return (insert->thickness); 01109 } 01110 01111 01115 DxfInsert * 01116 dxf_insert_set_thickness 01117 ( 01118 DxfInsert *insert, 01120 double thickness 01122 ) 01123 { 01124 #if DEBUG 01125 DXF_DEBUG_BEGIN 01126 #endif 01127 /* Do some basic checks. */ 01128 if (insert == NULL) 01129 { 01130 fprintf (stderr, 01131 (_("Error in %s () a NULL pointer was passed.\n")), 01132 __FUNCTION__); 01133 return (NULL); 01134 } 01135 if (thickness < 0.0) 01136 { 01137 fprintf (stderr, 01138 (_("Error in %s () a negative value was passed.\n")), 01139 __FUNCTION__); 01140 return (NULL); 01141 } 01142 insert->thickness = thickness; 01143 #if DEBUG 01144 DXF_DEBUG_END 01145 #endif 01146 return (insert); 01147 } 01148 01149 01155 double 01156 dxf_insert_get_linetype_scale 01157 ( 01158 DxfInsert *insert 01160 ) 01161 { 01162 #if DEBUG 01163 DXF_DEBUG_BEGIN 01164 #endif 01165 /* Do some basic checks. */ 01166 if (insert == NULL) 01167 { 01168 fprintf (stderr, 01169 (_("Error in %s () a NULL pointer was passed.\n")), 01170 __FUNCTION__); 01171 return (EXIT_FAILURE); 01172 } 01173 if (insert->linetype_scale < 0.0) 01174 { 01175 fprintf (stderr, 01176 (_("Error in %s () a negative value was found.\n")), 01177 __FUNCTION__); 01178 return (EXIT_FAILURE); 01179 } 01180 #if DEBUG 01181 DXF_DEBUG_END 01182 #endif 01183 return (insert->linetype_scale); 01184 } 01185 01186 01190 DxfInsert * 01191 dxf_insert_set_linetype_scale 01192 ( 01193 DxfInsert *insert, 01195 double linetype_scale 01197 ) 01198 { 01199 #if DEBUG 01200 DXF_DEBUG_BEGIN 01201 #endif 01202 /* Do some basic checks. */ 01203 if (insert == NULL) 01204 { 01205 fprintf (stderr, 01206 (_("Error in %s () a NULL pointer was passed.\n")), 01207 __FUNCTION__); 01208 return (NULL); 01209 } 01210 if (linetype_scale < 0.0) 01211 { 01212 fprintf (stderr, 01213 (_("Error in %s () a negative value was passed.\n")), 01214 __FUNCTION__); 01215 return (NULL); 01216 } 01217 insert->linetype_scale = linetype_scale; 01218 #if DEBUG 01219 DXF_DEBUG_END 01220 #endif 01221 return (insert); 01222 } 01223 01224 01230 int16_t 01231 dxf_insert_get_visibility 01232 ( 01233 DxfInsert *insert 01235 ) 01236 { 01237 #if DEBUG 01238 DXF_DEBUG_BEGIN 01239 #endif 01240 /* Do some basic checks. */ 01241 if (insert == NULL) 01242 { 01243 fprintf (stderr, 01244 (_("Error in %s () a NULL pointer was passed.\n")), 01245 __FUNCTION__); 01246 return (EXIT_FAILURE); 01247 } 01248 if (insert->visibility < 0) 01249 { 01250 fprintf (stderr, 01251 (_("Error in %s () a negative value was found.\n")), 01252 __FUNCTION__); 01253 return (EXIT_FAILURE); 01254 } 01255 if (insert->visibility > 1) 01256 { 01257 fprintf (stderr, 01258 (_("Error in %s () an out of range value was found.\n")), 01259 __FUNCTION__); 01260 return (EXIT_FAILURE); 01261 } 01262 #if DEBUG 01263 DXF_DEBUG_END 01264 #endif 01265 return (insert->visibility); 01266 } 01267 01268 01272 DxfInsert * 01273 dxf_insert_set_visibility 01274 ( 01275 DxfInsert *insert, 01277 int16_t visibility 01279 ) 01280 { 01281 #if DEBUG 01282 DXF_DEBUG_BEGIN 01283 #endif 01284 /* Do some basic checks. */ 01285 if (insert == NULL) 01286 { 01287 fprintf (stderr, 01288 (_("Error in %s () a NULL pointer was passed.\n")), 01289 __FUNCTION__); 01290 return (NULL); 01291 } 01292 if (visibility < 0) 01293 { 01294 fprintf (stderr, 01295 (_("Error in %s () a negative value was passed.\n")), 01296 __FUNCTION__); 01297 return (NULL); 01298 } 01299 if (visibility > 1) 01300 { 01301 fprintf (stderr, 01302 (_("Error in %s () an out of range value was passed.\n")), 01303 __FUNCTION__); 01304 return (NULL); 01305 } 01306 insert->visibility = visibility; 01307 #if DEBUG 01308 DXF_DEBUG_END 01309 #endif 01310 return (insert); 01311 } 01312 01313 01319 int 01320 dxf_insert_get_color 01321 ( 01322 DxfInsert *insert 01324 ) 01325 { 01326 #if DEBUG 01327 DXF_DEBUG_BEGIN 01328 #endif 01329 /* Do some basic checks. */ 01330 if (insert == NULL) 01331 { 01332 fprintf (stderr, 01333 (_("Error in %s () a NULL pointer was passed.\n")), 01334 __FUNCTION__); 01335 return (EXIT_FAILURE); 01336 } 01337 if (insert->color < 0) 01338 { 01339 fprintf (stderr, 01340 (_("Warning in %s () a negative value was found.\n")), 01341 __FUNCTION__); 01342 } 01343 #if DEBUG 01344 DXF_DEBUG_END 01345 #endif 01346 return (insert->color); 01347 } 01348 01349 01353 DxfInsert * 01354 dxf_insert_set_color 01355 ( 01356 DxfInsert *insert, 01358 int color 01360 ) 01361 { 01362 #if DEBUG 01363 DXF_DEBUG_BEGIN 01364 #endif 01365 /* Do some basic checks. */ 01366 if (insert == NULL) 01367 { 01368 fprintf (stderr, 01369 (_("Error in %s () a NULL pointer was passed.\n")), 01370 __FUNCTION__); 01371 return (NULL); 01372 } 01373 if (color < 0) 01374 { 01375 fprintf (stderr, 01376 (_("Warning in %s () a negative value was passed.\n")), 01377 __FUNCTION__); 01378 fprintf (stderr, 01379 (_("\teffectively turning this entity it's visibility off.\n"))); 01380 } 01381 insert->color = color; 01382 #if DEBUG 01383 DXF_DEBUG_END 01384 #endif 01385 return (insert); 01386 } 01387 01388 01394 int 01395 dxf_insert_get_paperspace 01396 ( 01397 DxfInsert *insert 01399 ) 01400 { 01401 #if DEBUG 01402 DXF_DEBUG_BEGIN 01403 #endif 01404 /* Do some basic checks. */ 01405 if (insert == NULL) 01406 { 01407 fprintf (stderr, 01408 (_("Error in %s () a NULL pointer was passed.\n")), 01409 __FUNCTION__); 01410 return (EXIT_FAILURE); 01411 } 01412 if (insert->paperspace < 0) 01413 { 01414 fprintf (stderr, 01415 (_("Warning in %s () a negative value was found.\n")), 01416 __FUNCTION__); 01417 } 01418 if (insert->paperspace > 1) 01419 { 01420 fprintf (stderr, 01421 (_("Warning in %s () an out of range value was found.\n")), 01422 __FUNCTION__); 01423 } 01424 #if DEBUG 01425 DXF_DEBUG_END 01426 #endif 01427 return (insert->paperspace); 01428 } 01429 01430 01434 DxfInsert * 01435 dxf_insert_set_paperspace 01436 ( 01437 DxfInsert *insert, 01439 int paperspace 01441 ) 01442 { 01443 #if DEBUG 01444 DXF_DEBUG_BEGIN 01445 #endif 01446 /* Do some basic checks. */ 01447 if (insert == NULL) 01448 { 01449 fprintf (stderr, 01450 (_("Error in %s () a NULL pointer was passed.\n")), 01451 __FUNCTION__); 01452 return (NULL); 01453 } 01454 if (paperspace < 0) 01455 { 01456 fprintf (stderr, 01457 (_("Error in %s () a negative value was passed.\n")), 01458 __FUNCTION__); 01459 return (NULL); 01460 } 01461 if (paperspace > 1) 01462 { 01463 fprintf (stderr, 01464 (_("Error in %s () an out of range value was passed.\n")), 01465 __FUNCTION__); 01466 return (NULL); 01467 } 01468 insert->paperspace = paperspace; 01469 #if DEBUG 01470 DXF_DEBUG_END 01471 #endif 01472 return (insert); 01473 } 01474 01475 01483 int 01484 dxf_insert_get_graphics_data_size 01485 ( 01486 DxfInsert *insert 01488 ) 01489 { 01490 #if DEBUG 01491 DXF_DEBUG_BEGIN 01492 #endif 01493 /* Do some basic checks. */ 01494 if (insert == NULL) 01495 { 01496 fprintf (stderr, 01497 (_("Error in %s () a NULL pointer was passed.\n")), 01498 __FUNCTION__); 01499 return (EXIT_FAILURE); 01500 } 01501 if (insert->graphics_data_size < 0) 01502 { 01503 fprintf (stderr, 01504 (_("Warning in %s () a negative value was found.\n")), 01505 __FUNCTION__); 01506 } 01507 if (insert->graphics_data_size == 0) 01508 { 01509 fprintf (stderr, 01510 (_("Warning in %s () a zero value was found.\n")), 01511 __FUNCTION__); 01512 } 01513 #if DEBUG 01514 DXF_DEBUG_END 01515 #endif 01516 return (insert->graphics_data_size); 01517 } 01518 01519 01527 DxfInsert * 01528 dxf_insert_set_graphics_data_size 01529 ( 01530 DxfInsert *insert, 01532 int graphics_data_size 01535 ) 01536 { 01537 #if DEBUG 01538 DXF_DEBUG_BEGIN 01539 #endif 01540 /* Do some basic checks. */ 01541 if (insert == NULL) 01542 { 01543 fprintf (stderr, 01544 (_("Error in %s () a NULL pointer was passed.\n")), 01545 __FUNCTION__); 01546 return (NULL); 01547 } 01548 if (graphics_data_size < 0) 01549 { 01550 fprintf (stderr, 01551 (_("Error in %s () a negative value was passed.\n")), 01552 __FUNCTION__); 01553 return (NULL); 01554 } 01555 if (graphics_data_size == 0) 01556 { 01557 fprintf (stderr, 01558 (_("Warning in %s () a zero value was passed.\n")), 01559 __FUNCTION__); 01560 } 01561 insert->graphics_data_size = graphics_data_size; 01562 #if DEBUG 01563 DXF_DEBUG_END 01564 #endif 01565 return (insert); 01566 } 01567 01568 01575 int16_t 01576 dxf_insert_get_shadow_mode 01577 ( 01578 DxfInsert *insert 01580 ) 01581 { 01582 #if DEBUG 01583 DXF_DEBUG_BEGIN 01584 #endif 01585 /* Do some basic checks. */ 01586 if (insert == NULL) 01587 { 01588 fprintf (stderr, 01589 (_("Error in %s () a NULL pointer was passed.\n")), 01590 __FUNCTION__); 01591 return (EXIT_FAILURE); 01592 } 01593 if (insert->shadow_mode < 0) 01594 { 01595 fprintf (stderr, 01596 (_("Error in %s () a negative value was found.\n")), 01597 __FUNCTION__); 01598 return (EXIT_FAILURE); 01599 } 01600 if (insert->shadow_mode > 3) 01601 { 01602 fprintf (stderr, 01603 (_("Error in %s () an out of range value was found.\n")), 01604 __FUNCTION__); 01605 return (EXIT_FAILURE); 01606 } 01607 #if DEBUG 01608 DXF_DEBUG_END 01609 #endif 01610 return (insert->shadow_mode); 01611 } 01612 01613 01620 DxfInsert * 01621 dxf_insert_set_shadow_mode 01622 ( 01623 DxfInsert *insert, 01625 int16_t shadow_mode 01627 ) 01628 { 01629 #if DEBUG 01630 DXF_DEBUG_BEGIN 01631 #endif 01632 /* Do some basic checks. */ 01633 if (insert == NULL) 01634 { 01635 fprintf (stderr, 01636 (_("Error in %s () a NULL pointer was passed.\n")), 01637 __FUNCTION__); 01638 return (NULL); 01639 } 01640 if (shadow_mode < 0) 01641 { 01642 fprintf (stderr, 01643 (_("Error in %s () a negative value was passed.\n")), 01644 __FUNCTION__); 01645 return (NULL); 01646 } 01647 if (shadow_mode > 3) 01648 { 01649 fprintf (stderr, 01650 (_("Error in %s () an out of range value was passed.\n")), 01651 __FUNCTION__); 01652 return (NULL); 01653 } 01654 insert->shadow_mode = shadow_mode; 01655 #if DEBUG 01656 DXF_DEBUG_END 01657 #endif 01658 return (insert); 01659 } 01660 01661 01670 DxfBinaryGraphicsData * 01671 dxf_insert_get_binary_graphics_data 01672 ( 01673 DxfInsert *insert 01675 ) 01676 { 01677 #if DEBUG 01678 DXF_DEBUG_BEGIN 01679 #endif 01680 /* Do some basic checks. */ 01681 if (insert == NULL) 01682 { 01683 fprintf (stderr, 01684 (_("Error in %s () a NULL pointer was passed.\n")), 01685 __FUNCTION__); 01686 return (NULL); 01687 } 01688 if (insert->binary_graphics_data == NULL) 01689 { 01690 fprintf (stderr, 01691 (_("Error in %s () a NULL pointer was found.\n")), 01692 __FUNCTION__); 01693 return (NULL); 01694 } 01695 #if DEBUG 01696 DXF_DEBUG_END 01697 #endif 01698 return ((DxfBinaryGraphicsData *) insert->binary_graphics_data); 01699 } 01700 01701 01706 DxfInsert * 01707 dxf_insert_set_binary_graphics_data 01708 ( 01709 DxfInsert *insert, 01711 DxfBinaryGraphicsData *data 01714 ) 01715 { 01716 #if DEBUG 01717 DXF_DEBUG_BEGIN 01718 #endif 01719 /* Do some basic checks. */ 01720 if (insert == NULL) 01721 { 01722 fprintf (stderr, 01723 (_("Error in %s () a NULL pointer was passed.\n")), 01724 __FUNCTION__); 01725 return (NULL); 01726 } 01727 if (data == NULL) 01728 { 01729 fprintf (stderr, 01730 (_("Error in %s () a NULL pointer was passed.\n")), 01731 __FUNCTION__); 01732 return (NULL); 01733 } 01734 insert->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01735 #if DEBUG 01736 DXF_DEBUG_END 01737 #endif 01738 return (insert); 01739 } 01740 01741 01750 char * 01751 dxf_insert_get_dictionary_owner_soft 01752 ( 01753 DxfInsert *insert 01755 ) 01756 { 01757 #if DEBUG 01758 DXF_DEBUG_BEGIN 01759 #endif 01760 /* Do some basic checks. */ 01761 if (insert == NULL) 01762 { 01763 fprintf (stderr, 01764 (_("Error in %s () a NULL pointer was passed.\n")), 01765 __FUNCTION__); 01766 return (NULL); 01767 } 01768 if (insert->dictionary_owner_soft == NULL) 01769 { 01770 fprintf (stderr, 01771 (_("Error in %s () a NULL pointer was found.\n")), 01772 __FUNCTION__); 01773 return (NULL); 01774 } 01775 #if DEBUG 01776 DXF_DEBUG_END 01777 #endif 01778 return (strdup (insert->dictionary_owner_soft)); 01779 } 01780 01781 01786 DxfInsert * 01787 dxf_insert_set_dictionary_owner_soft 01788 ( 01789 DxfInsert *insert, 01791 char *dictionary_owner_soft 01794 ) 01795 { 01796 #if DEBUG 01797 DXF_DEBUG_BEGIN 01798 #endif 01799 /* Do some basic checks. */ 01800 if (insert == NULL) 01801 { 01802 fprintf (stderr, 01803 (_("Error in %s () a NULL pointer was passed.\n")), 01804 __FUNCTION__); 01805 return (NULL); 01806 } 01807 if (dictionary_owner_soft == NULL) 01808 { 01809 fprintf (stderr, 01810 (_("Error in %s () a NULL pointer was passed.\n")), 01811 __FUNCTION__); 01812 return (NULL); 01813 } 01814 insert->dictionary_owner_soft = strdup (dictionary_owner_soft); 01815 #if DEBUG 01816 DXF_DEBUG_END 01817 #endif 01818 return (insert); 01819 } 01820 01821 01830 char * 01831 dxf_insert_get_material 01832 ( 01833 DxfInsert *insert 01835 ) 01836 { 01837 #if DEBUG 01838 DXF_DEBUG_BEGIN 01839 #endif 01840 /* Do some basic checks. */ 01841 if (insert == NULL) 01842 { 01843 fprintf (stderr, 01844 (_("Error in %s () a NULL pointer was passed.\n")), 01845 __FUNCTION__); 01846 return (NULL); 01847 } 01848 if (insert->material == NULL) 01849 { 01850 fprintf (stderr, 01851 (_("Error in %s () a NULL pointer was found.\n")), 01852 __FUNCTION__); 01853 return (NULL); 01854 } 01855 #if DEBUG 01856 DXF_DEBUG_END 01857 #endif 01858 return (strdup (insert->material)); 01859 } 01860 01861 01868 DxfInsert * 01869 dxf_insert_set_material 01870 ( 01871 DxfInsert *insert, 01873 char *material 01876 ) 01877 { 01878 #if DEBUG 01879 DXF_DEBUG_BEGIN 01880 #endif 01881 /* Do some basic checks. */ 01882 if (insert == NULL) 01883 { 01884 fprintf (stderr, 01885 (_("Error in %s () a NULL pointer was passed.\n")), 01886 __FUNCTION__); 01887 return (NULL); 01888 } 01889 if (material == NULL) 01890 { 01891 fprintf (stderr, 01892 (_("Error in %s () a NULL pointer was passed.\n")), 01893 __FUNCTION__); 01894 return (NULL); 01895 } 01896 insert->material = strdup (material); 01897 #if DEBUG 01898 DXF_DEBUG_END 01899 #endif 01900 return (insert); 01901 } 01902 01903 01912 char * 01913 dxf_insert_get_dictionary_owner_hard 01914 ( 01915 DxfInsert *insert 01917 ) 01918 { 01919 #if DEBUG 01920 DXF_DEBUG_BEGIN 01921 #endif 01922 /* Do some basic checks. */ 01923 if (insert == NULL) 01924 { 01925 fprintf (stderr, 01926 (_("Error in %s () a NULL pointer was passed.\n")), 01927 __FUNCTION__); 01928 return (NULL); 01929 } 01930 if (insert->dictionary_owner_hard == NULL) 01931 { 01932 fprintf (stderr, 01933 (_("Error in %s () a NULL pointer was found.\n")), 01934 __FUNCTION__); 01935 return (NULL); 01936 } 01937 #if DEBUG 01938 DXF_DEBUG_END 01939 #endif 01940 return (strdup (insert->dictionary_owner_hard)); 01941 } 01942 01943 01948 DxfInsert * 01949 dxf_insert_set_dictionary_owner_hard 01950 ( 01951 DxfInsert *insert, 01953 char *dictionary_owner_hard 01956 ) 01957 { 01958 #if DEBUG 01959 DXF_DEBUG_BEGIN 01960 #endif 01961 /* Do some basic checks. */ 01962 if (insert == NULL) 01963 { 01964 fprintf (stderr, 01965 (_("Error in %s () a NULL pointer was passed.\n")), 01966 __FUNCTION__); 01967 return (NULL); 01968 } 01969 if (dictionary_owner_hard == NULL) 01970 { 01971 fprintf (stderr, 01972 (_("Error in %s () a NULL pointer was passed.\n")), 01973 __FUNCTION__); 01974 return (NULL); 01975 } 01976 insert->dictionary_owner_hard = strdup (dictionary_owner_hard); 01977 #if DEBUG 01978 DXF_DEBUG_END 01979 #endif 01980 return (insert); 01981 } 01982 01983 01990 int16_t 01991 dxf_insert_get_lineweight 01992 ( 01993 DxfInsert *insert 01995 ) 01996 { 01997 #if DEBUG 01998 DXF_DEBUG_BEGIN 01999 #endif 02000 /* Do some basic checks. */ 02001 if (insert == NULL) 02002 { 02003 fprintf (stderr, 02004 (_("Error in %s () a NULL pointer was passed.\n")), 02005 __FUNCTION__); 02006 return (EXIT_FAILURE); 02007 } 02008 #if DEBUG 02009 DXF_DEBUG_END 02010 #endif 02011 return (insert->lineweight); 02012 } 02013 02014 02021 DxfInsert * 02022 dxf_insert_set_lineweight 02023 ( 02024 DxfInsert *insert, 02026 int16_t lineweight 02028 ) 02029 { 02030 #if DEBUG 02031 DXF_DEBUG_BEGIN 02032 #endif 02033 /* Do some basic checks. */ 02034 if (insert == NULL) 02035 { 02036 fprintf (stderr, 02037 (_("Error in %s () a NULL pointer was passed.\n")), 02038 __FUNCTION__); 02039 return (NULL); 02040 } 02041 insert->lineweight = lineweight; 02042 #if DEBUG 02043 DXF_DEBUG_END 02044 #endif 02045 return (insert); 02046 } 02047 02048 02055 char * 02056 dxf_insert_get_plot_style_name 02057 ( 02058 DxfInsert *insert 02060 ) 02061 { 02062 #if DEBUG 02063 DXF_DEBUG_BEGIN 02064 #endif 02065 /* Do some basic checks. */ 02066 if (insert == NULL) 02067 { 02068 fprintf (stderr, 02069 (_("Error in %s () a NULL pointer was passed.\n")), 02070 __FUNCTION__); 02071 return (NULL); 02072 } 02073 if (insert->plot_style_name == NULL) 02074 { 02075 fprintf (stderr, 02076 (_("Error in %s () a NULL pointer was found.\n")), 02077 __FUNCTION__); 02078 return (NULL); 02079 } 02080 #if DEBUG 02081 DXF_DEBUG_END 02082 #endif 02083 return (strdup (insert->plot_style_name)); 02084 } 02085 02086 02093 DxfInsert * 02094 dxf_insert_set_plot_style_name 02095 ( 02096 DxfInsert *insert, 02098 char *plot_style_name 02101 ) 02102 { 02103 #if DEBUG 02104 DXF_DEBUG_BEGIN 02105 #endif 02106 /* Do some basic checks. */ 02107 if (insert == NULL) 02108 { 02109 fprintf (stderr, 02110 (_("Error in %s () a NULL pointer was passed.\n")), 02111 __FUNCTION__); 02112 return (NULL); 02113 } 02114 if (plot_style_name == NULL) 02115 { 02116 fprintf (stderr, 02117 (_("Error in %s () a NULL pointer was passed.\n")), 02118 __FUNCTION__); 02119 return (NULL); 02120 } 02121 insert->plot_style_name = strdup (plot_style_name); 02122 #if DEBUG 02123 DXF_DEBUG_END 02124 #endif 02125 return (insert); 02126 } 02127 02128 02135 long 02136 dxf_insert_get_color_value 02137 ( 02138 DxfInsert *insert 02140 ) 02141 { 02142 #if DEBUG 02143 DXF_DEBUG_BEGIN 02144 #endif 02145 /* Do some basic checks. */ 02146 if (insert == NULL) 02147 { 02148 fprintf (stderr, 02149 (_("Error in %s () a NULL pointer was passed.\n")), 02150 __FUNCTION__); 02151 return (EXIT_FAILURE); 02152 } 02153 #if DEBUG 02154 DXF_DEBUG_END 02155 #endif 02156 return (insert->color_value); 02157 } 02158 02159 02166 DxfInsert * 02167 dxf_insert_set_color_value 02168 ( 02169 DxfInsert *insert, 02171 long color_value 02173 ) 02174 { 02175 #if DEBUG 02176 DXF_DEBUG_BEGIN 02177 #endif 02178 /* Do some basic checks. */ 02179 if (insert == NULL) 02180 { 02181 fprintf (stderr, 02182 (_("Error in %s () a NULL pointer was passed.\n")), 02183 __FUNCTION__); 02184 return (NULL); 02185 } 02186 insert->color_value = color_value; 02187 #if DEBUG 02188 DXF_DEBUG_END 02189 #endif 02190 return (insert); 02191 } 02192 02193 02200 char * 02201 dxf_insert_get_color_name 02202 ( 02203 DxfInsert *insert 02205 ) 02206 { 02207 #if DEBUG 02208 DXF_DEBUG_BEGIN 02209 #endif 02210 /* Do some basic checks. */ 02211 if (insert == NULL) 02212 { 02213 fprintf (stderr, 02214 (_("Error in %s () a NULL pointer was passed.\n")), 02215 __FUNCTION__); 02216 return (NULL); 02217 } 02218 if (insert->color_name == NULL) 02219 { 02220 fprintf (stderr, 02221 (_("Error in %s () a NULL pointer was found.\n")), 02222 __FUNCTION__); 02223 return (NULL); 02224 } 02225 #if DEBUG 02226 DXF_DEBUG_END 02227 #endif 02228 return (strdup (insert->color_name)); 02229 } 02230 02231 02238 DxfInsert * 02239 dxf_insert_set_color_name 02240 ( 02241 DxfInsert *insert, 02243 char *color_name 02246 ) 02247 { 02248 #if DEBUG 02249 DXF_DEBUG_BEGIN 02250 #endif 02251 /* Do some basic checks. */ 02252 if (insert == NULL) 02253 { 02254 fprintf (stderr, 02255 (_("Error in %s () a NULL pointer was passed.\n")), 02256 __FUNCTION__); 02257 return (NULL); 02258 } 02259 if (color_name == NULL) 02260 { 02261 fprintf (stderr, 02262 (_("Error in %s () a NULL pointer was passed.\n")), 02263 __FUNCTION__); 02264 return (NULL); 02265 } 02266 insert->color_name = strdup (color_name); 02267 #if DEBUG 02268 DXF_DEBUG_END 02269 #endif 02270 return (insert); 02271 } 02272 02273 02280 long 02281 dxf_insert_get_transparency 02282 ( 02283 DxfInsert *insert 02285 ) 02286 { 02287 #if DEBUG 02288 DXF_DEBUG_BEGIN 02289 #endif 02290 /* Do some basic checks. */ 02291 if (insert == NULL) 02292 { 02293 fprintf (stderr, 02294 (_("Error in %s () a NULL pointer was passed.\n")), 02295 __FUNCTION__); 02296 return (EXIT_FAILURE); 02297 } 02298 #if DEBUG 02299 DXF_DEBUG_END 02300 #endif 02301 return (insert->transparency); 02302 } 02303 02304 02311 DxfInsert * 02312 dxf_insert_set_transparency 02313 ( 02314 DxfInsert *insert, 02316 long transparency 02318 ) 02319 { 02320 #if DEBUG 02321 DXF_DEBUG_BEGIN 02322 #endif 02323 /* Do some basic checks. */ 02324 if (insert == NULL) 02325 { 02326 fprintf (stderr, 02327 (_("Error in %s () a NULL pointer was passed.\n")), 02328 __FUNCTION__); 02329 return (NULL); 02330 } 02331 insert->transparency = transparency; 02332 #if DEBUG 02333 DXF_DEBUG_END 02334 #endif 02335 return (insert); 02336 } 02337 02338 02345 char * 02346 dxf_insert_get_block_name 02347 ( 02348 DxfInsert *insert 02350 ) 02351 { 02352 #if DEBUG 02353 DXF_DEBUG_BEGIN 02354 #endif 02355 /* Do some basic checks. */ 02356 if (insert == NULL) 02357 { 02358 fprintf (stderr, 02359 (_("Error in %s () a NULL pointer was passed.\n")), 02360 __FUNCTION__); 02361 return (NULL); 02362 } 02363 if (insert->block_name == NULL) 02364 { 02365 fprintf (stderr, 02366 (_("Error in %s () a NULL pointer was found.\n")), 02367 __FUNCTION__); 02368 return (NULL); 02369 } 02370 #if DEBUG 02371 DXF_DEBUG_END 02372 #endif 02373 return (strdup (insert->block_name)); 02374 } 02375 02376 02383 DxfInsert * 02384 dxf_insert_set_block_name 02385 ( 02386 DxfInsert *insert, 02388 char *block_name 02391 ) 02392 { 02393 #if DEBUG 02394 DXF_DEBUG_BEGIN 02395 #endif 02396 /* Do some basic checks. */ 02397 if (insert == NULL) 02398 { 02399 fprintf (stderr, 02400 (_("Error in %s () a NULL pointer was passed.\n")), 02401 __FUNCTION__); 02402 return (NULL); 02403 } 02404 if (block_name == NULL) 02405 { 02406 fprintf (stderr, 02407 (_("Error in %s () a NULL pointer was passed.\n")), 02408 __FUNCTION__); 02409 return (NULL); 02410 } 02411 insert->block_name = strdup (block_name); 02412 #if DEBUG 02413 DXF_DEBUG_END 02414 #endif 02415 return (insert); 02416 } 02417 02418 02424 DxfPoint * 02425 dxf_insert_get_p0 02426 ( 02427 DxfInsert *insert 02429 ) 02430 { 02431 #ifdef DEBUG 02432 DXF_DEBUG_BEGIN 02433 #endif 02434 /* Do some basic checks. */ 02435 if (insert == NULL) 02436 { 02437 fprintf (stderr, 02438 (_("Error in %s () a NULL pointer was passed.\n")), 02439 __FUNCTION__); 02440 return (NULL); 02441 } 02442 if (insert->p0 == NULL) 02443 { 02444 fprintf (stderr, 02445 (_("Error in %s () a NULL pointer was found.\n")), 02446 __FUNCTION__); 02447 return (NULL); 02448 } 02449 #if DEBUG 02450 DXF_DEBUG_END 02451 #endif 02452 return (insert->p0); 02453 } 02454 02455 02461 DxfInsert * 02462 dxf_insert_set_p0 02463 ( 02464 DxfInsert *insert, 02466 DxfPoint *p0 02468 ) 02469 { 02470 #ifdef DEBUG 02471 DXF_DEBUG_BEGIN 02472 #endif 02473 /* Do some basic checks. */ 02474 if (insert == NULL) 02475 { 02476 fprintf (stderr, 02477 (_("Error in %s () a NULL pointer was passed.\n")), 02478 __FUNCTION__); 02479 return (NULL); 02480 } 02481 if (p0 == NULL) 02482 { 02483 fprintf (stderr, 02484 (_("Error in %s () a NULL pointer was passed.\n")), 02485 __FUNCTION__); 02486 return (NULL); 02487 } 02488 insert->p0 = p0; 02489 #if DEBUG 02490 DXF_DEBUG_END 02491 #endif 02492 return (insert); 02493 } 02494 02495 02502 double 02503 dxf_insert_get_x0 02504 ( 02505 DxfInsert *insert 02507 ) 02508 { 02509 #ifdef DEBUG 02510 DXF_DEBUG_BEGIN 02511 #endif 02512 02513 /* Do some basic checks. */ 02514 if (insert == NULL) 02515 { 02516 fprintf (stderr, 02517 (_("Error in %s () a NULL pointer was passed.\n")), 02518 __FUNCTION__); 02519 return (EXIT_FAILURE); 02520 } 02521 if (insert->p0 == NULL) 02522 { 02523 fprintf (stderr, 02524 (_("Error in %s () a NULL pointer was found.\n")), 02525 __FUNCTION__); 02526 return (EXIT_FAILURE); 02527 } 02528 #if DEBUG 02529 DXF_DEBUG_END 02530 #endif 02531 return (insert->p0->x0); 02532 } 02533 02534 02542 DxfInsert * 02543 dxf_insert_set_x0 02544 ( 02545 DxfInsert *insert, 02547 double x0 02550 ) 02551 { 02552 #ifdef DEBUG 02553 DXF_DEBUG_BEGIN 02554 #endif 02555 /* Do some basic checks. */ 02556 if (insert == NULL) 02557 { 02558 fprintf (stderr, 02559 (_("Error in %s () a NULL pointer was passed.\n")), 02560 __FUNCTION__); 02561 return (NULL); 02562 } 02563 if (insert->p0 == NULL) 02564 { 02565 fprintf (stderr, 02566 (_("Error in %s () a NULL pointer was found.\n")), 02567 __FUNCTION__); 02568 return (NULL); 02569 } 02570 insert->p0->x0 = x0; 02571 #if DEBUG 02572 DXF_DEBUG_END 02573 #endif 02574 return (insert); 02575 } 02576 02577 02584 double 02585 dxf_insert_get_y0 02586 ( 02587 DxfInsert *insert 02589 ) 02590 { 02591 #ifdef DEBUG 02592 DXF_DEBUG_BEGIN 02593 #endif 02594 02595 /* Do some basic checks. */ 02596 if (insert == NULL) 02597 { 02598 fprintf (stderr, 02599 (_("Error in %s () a NULL pointer was passed.\n")), 02600 __FUNCTION__); 02601 return (EXIT_FAILURE); 02602 } 02603 if (insert->p0 == NULL) 02604 { 02605 fprintf (stderr, 02606 (_("Error in %s () a NULL pointer was found.\n")), 02607 __FUNCTION__); 02608 return (EXIT_FAILURE); 02609 } 02610 #if DEBUG 02611 DXF_DEBUG_END 02612 #endif 02613 return (insert->p0->y0); 02614 } 02615 02616 02624 DxfInsert * 02625 dxf_insert_set_y0 02626 ( 02627 DxfInsert *insert, 02629 double y0 02632 ) 02633 { 02634 #ifdef DEBUG 02635 DXF_DEBUG_BEGIN 02636 #endif 02637 /* Do some basic checks. */ 02638 if (insert == NULL) 02639 { 02640 fprintf (stderr, 02641 (_("Error in %s () a NULL pointer was passed.\n")), 02642 __FUNCTION__); 02643 return (NULL); 02644 } 02645 if (insert->p0 == NULL) 02646 { 02647 fprintf (stderr, 02648 (_("Error in %s () a NULL pointer was found.\n")), 02649 __FUNCTION__); 02650 return (NULL); 02651 } 02652 insert->p0->y0 = y0; 02653 #if DEBUG 02654 DXF_DEBUG_END 02655 #endif 02656 return (insert); 02657 } 02658 02659 02666 double 02667 dxf_insert_get_z0 02668 ( 02669 DxfInsert *insert 02671 ) 02672 { 02673 #ifdef DEBUG 02674 DXF_DEBUG_BEGIN 02675 #endif 02676 02677 /* Do some basic checks. */ 02678 if (insert == NULL) 02679 { 02680 fprintf (stderr, 02681 (_("Error in %s () a NULL pointer was passed.\n")), 02682 __FUNCTION__); 02683 return (EXIT_FAILURE); 02684 } 02685 if (insert->p0 == NULL) 02686 { 02687 fprintf (stderr, 02688 (_("Error in %s () a NULL pointer was found.\n")), 02689 __FUNCTION__); 02690 return (EXIT_FAILURE); 02691 } 02692 #if DEBUG 02693 DXF_DEBUG_END 02694 #endif 02695 return (insert->p0->z0); 02696 } 02697 02698 02706 DxfInsert * 02707 dxf_insert_set_z0 02708 ( 02709 DxfInsert *insert, 02711 double z0 02714 ) 02715 { 02716 #ifdef DEBUG 02717 DXF_DEBUG_BEGIN 02718 #endif 02719 /* Do some basic checks. */ 02720 if (insert == NULL) 02721 { 02722 fprintf (stderr, 02723 (_("Error in %s () a NULL pointer was passed.\n")), 02724 __FUNCTION__); 02725 return (NULL); 02726 } 02727 if (insert->p0 == NULL) 02728 { 02729 fprintf (stderr, 02730 (_("Error in %s () a NULL pointer was found.\n")), 02731 __FUNCTION__); 02732 return (NULL); 02733 } 02734 insert->p0->z0 = z0; 02735 #if DEBUG 02736 DXF_DEBUG_END 02737 #endif 02738 return (insert); 02739 } 02740 02741 02748 double 02749 dxf_insert_get_rel_x_scale 02750 ( 02751 DxfInsert *insert 02753 ) 02754 { 02755 #ifdef DEBUG 02756 DXF_DEBUG_BEGIN 02757 #endif 02758 02759 /* Do some basic checks. */ 02760 if (insert == NULL) 02761 { 02762 fprintf (stderr, 02763 (_("Error in %s () a NULL pointer was passed.\n")), 02764 __FUNCTION__); 02765 return (EXIT_FAILURE); 02766 } 02767 if (insert->rel_x_scale == 0.0) 02768 { 02769 fprintf (stderr, 02770 (_("Warning in %s () a zero value was found.\n")), 02771 __FUNCTION__); 02772 } 02773 #if DEBUG 02774 DXF_DEBUG_END 02775 #endif 02776 return (insert->rel_x_scale); 02777 } 02778 02779 02787 DxfInsert * 02788 dxf_insert_set_rel_x_scale 02789 ( 02790 DxfInsert *insert, 02792 double rel_x_scale 02795 ) 02796 { 02797 #ifdef DEBUG 02798 DXF_DEBUG_BEGIN 02799 #endif 02800 /* Do some basic checks. */ 02801 if (insert == NULL) 02802 { 02803 fprintf (stderr, 02804 (_("Error in %s () a NULL pointer was passed.\n")), 02805 __FUNCTION__); 02806 return (NULL); 02807 } 02808 if (rel_x_scale == 0.0) 02809 { 02810 fprintf (stderr, 02811 (_("Warning in %s () a zero value was passed.\n")), 02812 __FUNCTION__); 02813 } 02814 insert->rel_x_scale = rel_x_scale; 02815 #if DEBUG 02816 DXF_DEBUG_END 02817 #endif 02818 return (insert); 02819 } 02820 02821 02828 double 02829 dxf_insert_get_rel_y_scale 02830 ( 02831 DxfInsert *insert 02833 ) 02834 { 02835 #ifdef DEBUG 02836 DXF_DEBUG_BEGIN 02837 #endif 02838 02839 /* Do some basic checks. */ 02840 if (insert == NULL) 02841 { 02842 fprintf (stderr, 02843 (_("Error in %s () a NULL pointer was passed.\n")), 02844 __FUNCTION__); 02845 return (EXIT_FAILURE); 02846 } 02847 if (insert->rel_y_scale == 0.0) 02848 { 02849 fprintf (stderr, 02850 (_("Warning in %s () a zero value was found.\n")), 02851 __FUNCTION__); 02852 } 02853 #if DEBUG 02854 DXF_DEBUG_END 02855 #endif 02856 return (insert->rel_y_scale); 02857 } 02858 02859 02867 DxfInsert * 02868 dxf_insert_set_rel_y_scale 02869 ( 02870 DxfInsert *insert, 02872 double rel_y_scale 02875 ) 02876 { 02877 #ifdef DEBUG 02878 DXF_DEBUG_BEGIN 02879 #endif 02880 /* Do some basic checks. */ 02881 if (insert == NULL) 02882 { 02883 fprintf (stderr, 02884 (_("Error in %s () a NULL pointer was passed.\n")), 02885 __FUNCTION__); 02886 return (NULL); 02887 } 02888 if (rel_y_scale == 0.0) 02889 { 02890 fprintf (stderr, 02891 (_("Warning in %s () a zero value was passed.\n")), 02892 __FUNCTION__); 02893 } 02894 insert->rel_y_scale = rel_y_scale; 02895 #if DEBUG 02896 DXF_DEBUG_END 02897 #endif 02898 return (insert); 02899 } 02900 02901 02908 double 02909 dxf_insert_get_rel_z_scale 02910 ( 02911 DxfInsert *insert 02913 ) 02914 { 02915 #ifdef DEBUG 02916 DXF_DEBUG_BEGIN 02917 #endif 02918 02919 /* Do some basic checks. */ 02920 if (insert == NULL) 02921 { 02922 fprintf (stderr, 02923 (_("Error in %s () a NULL pointer was passed.\n")), 02924 __FUNCTION__); 02925 return (EXIT_FAILURE); 02926 } 02927 if (insert->rel_z_scale == 0.0) 02928 { 02929 fprintf (stderr, 02930 (_("Warning in %s () a zero value was found.\n")), 02931 __FUNCTION__); 02932 } 02933 #if DEBUG 02934 DXF_DEBUG_END 02935 #endif 02936 return (insert->rel_z_scale); 02937 } 02938 02939 02947 DxfInsert * 02948 dxf_insert_set_rel_z_scale 02949 ( 02950 DxfInsert *insert, 02952 double rel_z_scale 02955 ) 02956 { 02957 #ifdef DEBUG 02958 DXF_DEBUG_BEGIN 02959 #endif 02960 /* Do some basic checks. */ 02961 if (insert == NULL) 02962 { 02963 fprintf (stderr, 02964 (_("Error in %s () a NULL pointer was passed.\n")), 02965 __FUNCTION__); 02966 return (NULL); 02967 } 02968 if (rel_z_scale == 0.0) 02969 { 02970 fprintf (stderr, 02971 (_("Warning in %s () a zero value was passed.\n")), 02972 __FUNCTION__); 02973 } 02974 insert->rel_z_scale = rel_z_scale; 02975 #if DEBUG 02976 DXF_DEBUG_END 02977 #endif 02978 return (insert); 02979 } 02980 02981 02988 double 02989 dxf_insert_get_column_spacing 02990 ( 02991 DxfInsert *insert 02993 ) 02994 { 02995 #ifdef DEBUG 02996 DXF_DEBUG_BEGIN 02997 #endif 02998 02999 /* Do some basic checks. */ 03000 if (insert == NULL) 03001 { 03002 fprintf (stderr, 03003 (_("Error in %s () a NULL pointer was passed.\n")), 03004 __FUNCTION__); 03005 return (EXIT_FAILURE); 03006 } 03007 if (insert->column_spacing < 0.0) 03008 { 03009 fprintf (stderr, 03010 (_("Warning in %s () a negative value was found.\n")), 03011 __FUNCTION__); 03012 } 03013 #if DEBUG 03014 DXF_DEBUG_END 03015 #endif 03016 return (insert->column_spacing); 03017 } 03018 03019 03027 DxfInsert * 03028 dxf_insert_set_column_spacing 03029 ( 03030 DxfInsert *insert, 03032 double column_spacing 03035 ) 03036 { 03037 #ifdef DEBUG 03038 DXF_DEBUG_BEGIN 03039 #endif 03040 /* Do some basic checks. */ 03041 if (insert == NULL) 03042 { 03043 fprintf (stderr, 03044 (_("Error in %s () a NULL pointer was passed.\n")), 03045 __FUNCTION__); 03046 return (NULL); 03047 } 03048 if (column_spacing < 0.0) 03049 { 03050 fprintf (stderr, 03051 (_("Warning in %s () a negative value was passed.\n")), 03052 __FUNCTION__); 03053 } 03054 insert->column_spacing = column_spacing; 03055 #if DEBUG 03056 DXF_DEBUG_END 03057 #endif 03058 return (insert); 03059 } 03060 03061 03068 double 03069 dxf_insert_get_row_spacing 03070 ( 03071 DxfInsert *insert 03073 ) 03074 { 03075 #ifdef DEBUG 03076 DXF_DEBUG_BEGIN 03077 #endif 03078 /* Do some basic checks. */ 03079 if (insert == NULL) 03080 { 03081 fprintf (stderr, 03082 (_("Error in %s () a NULL pointer was passed.\n")), 03083 __FUNCTION__); 03084 return (EXIT_FAILURE); 03085 } 03086 if (insert->row_spacing < 0.0) 03087 { 03088 fprintf (stderr, 03089 (_("Warning in %s () a negative value was found.\n")), 03090 __FUNCTION__); 03091 } 03092 #if DEBUG 03093 DXF_DEBUG_END 03094 #endif 03095 return (insert->row_spacing); 03096 } 03097 03098 03106 DxfInsert * 03107 dxf_insert_set_row_spacing 03108 ( 03109 DxfInsert *insert, 03111 double row_spacing 03114 ) 03115 { 03116 #ifdef DEBUG 03117 DXF_DEBUG_BEGIN 03118 #endif 03119 /* Do some basic checks. */ 03120 if (insert == NULL) 03121 { 03122 fprintf (stderr, 03123 (_("Error in %s () a NULL pointer was passed.\n")), 03124 __FUNCTION__); 03125 return (NULL); 03126 } 03127 if (row_spacing < 0.0) 03128 { 03129 fprintf (stderr, 03130 (_("Warning in %s () a negative value was passed.\n")), 03131 __FUNCTION__); 03132 } 03133 insert->row_spacing = row_spacing; 03134 #if DEBUG 03135 DXF_DEBUG_END 03136 #endif 03137 return (insert); 03138 } 03139 03140 03147 double 03148 dxf_insert_get_rot_angle 03149 ( 03150 DxfInsert *insert 03152 ) 03153 { 03154 #ifdef DEBUG 03155 DXF_DEBUG_BEGIN 03156 #endif 03157 /* Do some basic checks. */ 03158 if (insert == NULL) 03159 { 03160 fprintf (stderr, 03161 (_("Error in %s () a NULL pointer was passed.\n")), 03162 __FUNCTION__); 03163 return (EXIT_FAILURE); 03164 } 03165 if (insert->rot_angle < 0.0) 03166 { 03167 fprintf (stderr, 03168 (_("Warning in %s () a negative value was found.\n")), 03169 __FUNCTION__); 03170 } 03171 #if DEBUG 03172 DXF_DEBUG_END 03173 #endif 03174 03176 return (insert->rot_angle); 03177 } 03178 03179 03187 DxfInsert * 03188 dxf_insert_set_rot_angle 03189 ( 03190 DxfInsert *insert, 03192 double rot_angle 03195 ) 03196 { 03197 #ifdef DEBUG 03198 DXF_DEBUG_BEGIN 03199 #endif 03200 /* Do some basic checks. */ 03201 if (insert == NULL) 03202 { 03203 fprintf (stderr, 03204 (_("Error in %s () a NULL pointer was passed.\n")), 03205 __FUNCTION__); 03206 return (NULL); 03207 } 03208 if (rot_angle < 0.0) 03209 { 03210 fprintf (stderr, 03211 (_("Warning in %s () a negative value was passed.\n")), 03212 __FUNCTION__); 03213 } 03214 if (rot_angle > 360.0) 03215 { 03216 fprintf (stderr, 03217 (_("Warning in %s () an out of range value was passed.\n")), 03218 __FUNCTION__); 03219 } 03220 insert->rot_angle = rot_angle; 03223 #if DEBUG 03224 DXF_DEBUG_END 03225 #endif 03226 return (insert); 03227 } 03228 03229 03236 int 03237 dxf_insert_get_attributes_follow 03238 ( 03239 DxfInsert *insert 03241 ) 03242 { 03243 #if DEBUG 03244 DXF_DEBUG_BEGIN 03245 #endif 03246 /* Do some basic checks. */ 03247 if (insert == NULL) 03248 { 03249 fprintf (stderr, 03250 (_("Error in %s () a NULL pointer was passed.\n")), 03251 __FUNCTION__); 03252 return (EXIT_FAILURE); 03253 } 03254 if (insert->attributes_follow < 0) 03255 { 03256 fprintf (stderr, 03257 (_("Error in %s () a negative value was found.\n")), 03258 __FUNCTION__); 03259 return (EXIT_FAILURE); 03260 } 03261 if (insert->attributes_follow > 1) 03262 { 03263 fprintf (stderr, 03264 (_("Error in %s () an out of range value was found.\n")), 03265 __FUNCTION__); 03266 return (EXIT_FAILURE); 03267 } 03268 #if DEBUG 03269 DXF_DEBUG_END 03270 #endif 03271 return (insert->attributes_follow); 03272 } 03273 03274 03279 DxfInsert * 03280 dxf_insert_set_attributes_follow 03281 ( 03282 DxfInsert *insert, 03284 int attributes_follow 03286 ) 03287 { 03288 #if DEBUG 03289 DXF_DEBUG_BEGIN 03290 #endif 03291 /* Do some basic checks. */ 03292 if (insert == NULL) 03293 { 03294 fprintf (stderr, 03295 (_("Error in %s () a NULL pointer was passed.\n")), 03296 __FUNCTION__); 03297 return (NULL); 03298 } 03299 if (attributes_follow < 0) 03300 { 03301 fprintf (stderr, 03302 (_("Error in %s () a negative value was passed.\n")), 03303 __FUNCTION__); 03304 return (NULL); 03305 } 03306 if (attributes_follow > 1) 03307 { 03308 fprintf (stderr, 03309 (_("Error in %s () an out of range value was passed.\n")), 03310 __FUNCTION__); 03311 return (NULL); 03312 } 03313 insert->attributes_follow = attributes_follow; 03314 #if DEBUG 03315 DXF_DEBUG_END 03316 #endif 03317 return (insert); 03318 } 03319 03320 03327 int 03328 dxf_insert_get_columns 03329 ( 03330 DxfInsert *insert 03332 ) 03333 { 03334 #if DEBUG 03335 DXF_DEBUG_BEGIN 03336 #endif 03337 /* Do some basic checks. */ 03338 if (insert == NULL) 03339 { 03340 fprintf (stderr, 03341 (_("Error in %s () a NULL pointer was passed.\n")), 03342 __FUNCTION__); 03343 return (EXIT_FAILURE); 03344 } 03345 if (insert->columns < 0) 03346 { 03347 fprintf (stderr, 03348 (_("Error in %s () a negative value was found.\n")), 03349 __FUNCTION__); 03350 return (EXIT_FAILURE); 03351 } 03352 #if DEBUG 03353 DXF_DEBUG_END 03354 #endif 03355 return (insert->columns); 03356 } 03357 03358 03363 DxfInsert * 03364 dxf_insert_set_columns 03365 ( 03366 DxfInsert *insert, 03368 int columns 03370 ) 03371 { 03372 #if DEBUG 03373 DXF_DEBUG_BEGIN 03374 #endif 03375 /* Do some basic checks. */ 03376 if (insert == NULL) 03377 { 03378 fprintf (stderr, 03379 (_("Error in %s () a NULL pointer was passed.\n")), 03380 __FUNCTION__); 03381 return (NULL); 03382 } 03383 if (columns < 0) 03384 { 03385 fprintf (stderr, 03386 (_("Error in %s () a negative value was passed.\n")), 03387 __FUNCTION__); 03388 return (NULL); 03389 } 03390 insert->columns = columns; 03391 #if DEBUG 03392 DXF_DEBUG_END 03393 #endif 03394 return (insert); 03395 } 03396 03397 03404 int 03405 dxf_insert_get_rows 03406 ( 03407 DxfInsert *insert 03409 ) 03410 { 03411 #if DEBUG 03412 DXF_DEBUG_BEGIN 03413 #endif 03414 /* Do some basic checks. */ 03415 if (insert == NULL) 03416 { 03417 fprintf (stderr, 03418 (_("Error in %s () a NULL pointer was passed.\n")), 03419 __FUNCTION__); 03420 return (EXIT_FAILURE); 03421 } 03422 if (insert->rows < 0) 03423 { 03424 fprintf (stderr, 03425 (_("Error in %s () a negative value was found.\n")), 03426 __FUNCTION__); 03427 return (EXIT_FAILURE); 03428 } 03429 #if DEBUG 03430 DXF_DEBUG_END 03431 #endif 03432 return (insert->rows); 03433 } 03434 03435 03439 DxfInsert * 03440 dxf_insert_set_rows 03441 ( 03442 DxfInsert *insert, 03444 int rows 03446 ) 03447 { 03448 #if DEBUG 03449 DXF_DEBUG_BEGIN 03450 #endif 03451 /* Do some basic checks. */ 03452 if (insert == NULL) 03453 { 03454 fprintf (stderr, 03455 (_("Error in %s () a NULL pointer was passed.\n")), 03456 __FUNCTION__); 03457 return (NULL); 03458 } 03459 if (rows < 0) 03460 { 03461 fprintf (stderr, 03462 (_("Error in %s () a negative value was passed.\n")), 03463 __FUNCTION__); 03464 return (NULL); 03465 } 03466 insert->rows = rows; 03467 #if DEBUG 03468 DXF_DEBUG_END 03469 #endif 03470 return (insert); 03471 } 03472 03473 03480 double 03481 dxf_insert_get_extr_x0 03482 ( 03483 DxfInsert *insert 03485 ) 03486 { 03487 #ifdef DEBUG 03488 DXF_DEBUG_BEGIN 03489 #endif 03490 03491 /* Do some basic checks. */ 03492 if (insert == NULL) 03493 { 03494 fprintf (stderr, 03495 (_("Error in %s () a NULL pointer was passed.\n")), 03496 __FUNCTION__); 03497 return (EXIT_FAILURE); 03498 } 03499 #if DEBUG 03500 DXF_DEBUG_END 03501 #endif 03502 return (insert->extr_x0); 03503 } 03504 03505 03513 DxfInsert * 03514 dxf_insert_set_extr_x0 03515 ( 03516 DxfInsert *insert, 03518 double extr_x0 03521 ) 03522 { 03523 #ifdef DEBUG 03524 DXF_DEBUG_BEGIN 03525 #endif 03526 /* Do some basic checks. */ 03527 if (insert == NULL) 03528 { 03529 fprintf (stderr, 03530 (_("Error in %s () a NULL pointer was passed.\n")), 03531 __FUNCTION__); 03532 return (NULL); 03533 } 03534 insert->extr_x0 = extr_x0; 03535 #if DEBUG 03536 DXF_DEBUG_END 03537 #endif 03538 return (insert); 03539 } 03540 03541 03548 double 03549 dxf_insert_get_extr_y0 03550 ( 03551 DxfInsert *insert 03553 ) 03554 { 03555 #ifdef DEBUG 03556 DXF_DEBUG_BEGIN 03557 #endif 03558 03559 /* Do some basic checks. */ 03560 if (insert == NULL) 03561 { 03562 fprintf (stderr, 03563 (_("Error in %s () a NULL pointer was passed.\n")), 03564 __FUNCTION__); 03565 return (EXIT_FAILURE); 03566 } 03567 #if DEBUG 03568 DXF_DEBUG_END 03569 #endif 03570 return (insert->extr_y0); 03571 } 03572 03573 03581 DxfInsert * 03582 dxf_insert_set_extr_y0 03583 ( 03584 DxfInsert *insert, 03586 double extr_y0 03589 ) 03590 { 03591 #ifdef DEBUG 03592 DXF_DEBUG_BEGIN 03593 #endif 03594 /* Do some basic checks. */ 03595 if (insert == NULL) 03596 { 03597 fprintf (stderr, 03598 (_("Error in %s () a NULL pointer was passed.\n")), 03599 __FUNCTION__); 03600 return (NULL); 03601 } 03602 insert->extr_y0 = extr_y0; 03603 #if DEBUG 03604 DXF_DEBUG_END 03605 #endif 03606 return (insert); 03607 } 03608 03609 03616 double 03617 dxf_insert_get_extr_z0 03618 ( 03619 DxfInsert *insert 03621 ) 03622 { 03623 #ifdef DEBUG 03624 DXF_DEBUG_BEGIN 03625 #endif 03626 03627 /* Do some basic checks. */ 03628 if (insert == NULL) 03629 { 03630 fprintf (stderr, 03631 (_("Error in %s () a NULL pointer was passed.\n")), 03632 __FUNCTION__); 03633 return (EXIT_FAILURE); 03634 } 03635 #if DEBUG 03636 DXF_DEBUG_END 03637 #endif 03638 return (insert->extr_z0); 03639 } 03640 03641 03649 DxfInsert * 03650 dxf_insert_set_extr_z0 03651 ( 03652 DxfInsert *insert, 03654 double extr_z0 03657 ) 03658 { 03659 #ifdef DEBUG 03660 DXF_DEBUG_BEGIN 03661 #endif 03662 /* Do some basic checks. */ 03663 if (insert == NULL) 03664 { 03665 fprintf (stderr, 03666 (_("Error in %s () a NULL pointer was passed.\n")), 03667 __FUNCTION__); 03668 return (NULL); 03669 } 03670 insert->extr_z0 = extr_z0; 03671 #if DEBUG 03672 DXF_DEBUG_END 03673 #endif 03674 return (insert); 03675 } 03676 03677 03682 DxfInsert * 03683 dxf_insert_set_extrusion_vector_from_point 03684 ( 03685 DxfInsert *insert, 03687 DxfPoint *point 03689 ) 03690 { 03691 #if DEBUG 03692 DXF_DEBUG_BEGIN 03693 #endif 03694 /* Do some basic checks. */ 03695 if (insert == NULL) 03696 { 03697 fprintf (stderr, 03698 (_("Error in %s () a NULL pointer was passed.\n")), 03699 __FUNCTION__); 03700 return (NULL); 03701 } 03702 if (point == NULL) 03703 { 03704 fprintf (stderr, 03705 (_("Error in %s () a NULL pointer was passed.\n")), 03706 __FUNCTION__); 03707 return (NULL); 03708 } 03709 insert->extr_x0 = (double) point->x0; 03710 insert->extr_y0 = (double) point->y0; 03711 insert->extr_z0 = (double) point->z0; 03712 #if DEBUG 03713 DXF_DEBUG_END 03714 #endif 03715 return (insert); 03716 } 03717 03718 03722 DxfInsert * 03723 dxf_insert_set_extrusion_vector 03724 ( 03725 DxfInsert *insert, 03727 double extr_x0, 03729 double extr_y0, 03731 double extr_z0 03733 ) 03734 { 03735 #if DEBUG 03736 DXF_DEBUG_BEGIN 03737 #endif 03738 /* Do some basic checks. */ 03739 if (insert == NULL) 03740 { 03741 fprintf (stderr, 03742 (_("Error in %s () a NULL pointer was passed.\n")), 03743 __FUNCTION__); 03744 return (NULL); 03745 } 03746 insert->extr_x0 = extr_x0; 03747 insert->extr_y0 = extr_y0; 03748 insert->extr_z0 = extr_z0; 03749 #if DEBUG 03750 DXF_DEBUG_END 03751 #endif 03752 return (insert); 03753 } 03754 03755 03764 DxfInsert * 03765 dxf_insert_get_next 03766 ( 03767 DxfInsert *insert 03769 ) 03770 { 03771 #if DEBUG 03772 DXF_DEBUG_BEGIN 03773 #endif 03774 /* Do some basic checks. */ 03775 if (insert == NULL) 03776 { 03777 fprintf (stderr, 03778 (_("Error in %s () a NULL pointer was passed.\n")), 03779 __FUNCTION__); 03780 return (NULL); 03781 } 03782 if (insert->next == NULL) 03783 { 03784 fprintf (stderr, 03785 (_("Error in %s () a NULL pointer was found.\n")), 03786 __FUNCTION__); 03787 return (NULL); 03788 } 03789 #if DEBUG 03790 DXF_DEBUG_END 03791 #endif 03792 return ((DxfInsert *) insert->next); 03793 } 03794 03795 03800 DxfInsert * 03801 dxf_insert_set_next 03802 ( 03803 DxfInsert *insert, 03805 DxfInsert *next 03807 ) 03808 { 03809 #if DEBUG 03810 DXF_DEBUG_BEGIN 03811 #endif 03812 /* Do some basic checks. */ 03813 if (insert == NULL) 03814 { 03815 fprintf (stderr, 03816 (_("Error in %s () a NULL pointer was passed.\n")), 03817 __FUNCTION__); 03818 return (NULL); 03819 } 03820 if (next == NULL) 03821 { 03822 fprintf (stderr, 03823 (_("Error in %s () a NULL pointer was passed.\n")), 03824 __FUNCTION__); 03825 return (NULL); 03826 } 03827 insert->next = (struct DxfInsert *) next; 03828 #if DEBUG 03829 DXF_DEBUG_END 03830 #endif 03831 return (insert); 03832 } 03833 03834 03843 DxfInsert * 03844 dxf_insert_get_last 03845 ( 03846 DxfInsert *insert 03848 ) 03849 { 03850 #if DEBUG 03851 DXF_DEBUG_BEGIN 03852 #endif 03853 /* Do some basic checks. */ 03854 if (insert == NULL) 03855 { 03856 fprintf (stderr, 03857 (_("Error in %s () a NULL pointer was passed.\n")), 03858 __FUNCTION__); 03859 return (NULL); 03860 } 03861 if (insert->next == NULL) 03862 { 03863 fprintf (stderr, 03864 (_("Warning in %s () a NULL pointer was found.\n")), 03865 __FUNCTION__); 03866 return ((DxfInsert *) insert); 03867 } 03868 DxfInsert *iter = (DxfInsert *) insert->next; 03869 while (iter->next != NULL) 03870 { 03871 iter = (DxfInsert *) iter->next; 03872 } 03873 #if DEBUG 03874 DXF_DEBUG_END 03875 #endif 03876 return ((DxfInsert *) iter); 03877 } 03878 03879 03880 /* EOF */