BRL-CAD
ged.c
Go to the documentation of this file.
1 /* G E D . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2000-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup libged */
21 /** @{ */
22 /** @file libged/ged.c
23  *
24  * A quasi-object-oriented database interface.
25  *
26  * A database object contains the attributes and methods for
27  * controlling a BRL-CAD database.
28  *
29  * Also include routines to allow libwdb to use librt's import/export
30  * interface, rather than having to know about the database formats directly.
31  *
32  */
33 /** @} */
34 
35 #include "common.h"
36 
37 #include <stdlib.h>
38 #include <string.h>
39 #include <math.h>
40 
41 
42 #include "bu/sort.h"
43 #include "vmath.h"
44 #include "bn.h"
45 #include "rtgeom.h"
46 #include "raytrace.h"
47 #include "plot3.h"
48 #include "mater.h"
49 
50 #include "solid.h"
51 
52 #include "./ged_private.h"
53 #include "./qray.h"
54 
55 
56 /* FIXME: this function should not exist. passing pointers as strings
57  * indicates a failure in design and lazy coding.
58  */
59 int
60 ged_decode_dbip(const char *dbip_string, struct db_i **dbipp)
61 {
62  if (sscanf(dbip_string, "%p", (void **)dbipp) != 1) {
63  return GED_ERROR;
64  }
65 
66  /* Could core dump */
67  RT_CK_DBI(*dbipp);
68 
69  return GED_OK;
70 }
71 
72 
73 void
74 ged_close(struct ged *gedp)
75 {
76  if (gedp == GED_NULL)
77  return;
78 
79  if (gedp->ged_wdbp) {
80  wdb_close(gedp->ged_wdbp);
81  gedp->ged_wdbp = RT_WDB_NULL;
82  }
83 
84  ged_free(gedp);
85 }
86 
87 static int
88 free_selection_set_entry(struct bu_hash_entry *entry, void *UNUSED(arg))
89 {
90  int i;
91  struct rt_selection_set *selection_set;
92  struct bu_ptbl *selections;
93  void (*free_selection)(struct rt_selection *);
94 
95  selection_set = (struct rt_selection_set *)bu_get_hash_value(entry);
96  selections = &selection_set->selections;
97  free_selection = selection_set->free_selection;
98 
99  /* free all selection objects and containing items */
100  for (i = BU_PTBL_LEN(selections) - 1; i >= 0; --i) {
101  long *s = BU_PTBL_GET(selections, i);
102  free_selection((struct rt_selection *)s);
103  bu_ptbl_rm(selections, s);
104  }
105  bu_ptbl_free(selections);
106  BU_FREE(selection_set, struct rt_selection_set);
107 
108  return 0;
109 }
110 
111 static int
112 free_object_selections(struct bu_hash_entry *entry, void *UNUSED(arg))
113 {
114  struct rt_object_selections *obj_selections;
115 
116  obj_selections = (struct rt_object_selections *)bu_get_hash_value(entry);
117 
118  /* free entries - one set for each kind of selection */
119  bu_hash_tbl_traverse(obj_selections->sets, free_selection_set_entry, NULL);
120 
121  /* free table itself */
122  bu_hash_tbl_free(obj_selections->sets);
123 
124  /* free object */
125  bu_free(obj_selections, "ged selections entry");
126 
127  return 0;
128 }
129 
130 void
131 ged_free(struct ged *gedp)
132 {
133  struct solid *sp;
134 
135  if (gedp == GED_NULL)
136  return;
137 
138  gedp->ged_wdbp = RT_WDB_NULL;
139 
140  if (gedp->ged_gdp != GED_DRAWABLE_NULL) {
141  if (gedp->ged_gdp->gd_headDisplay)
142  BU_PUT(gedp->ged_gdp->gd_headDisplay, struct bu_vls);
143  if (gedp->ged_gdp->gd_headVDraw)
144  BU_PUT(gedp->ged_gdp->gd_headVDraw, struct bu_vls);
145  qray_free(gedp->ged_gdp);
146  BU_PUT(gedp->ged_gdp, struct ged_drawable);
147  }
148 
149  if (gedp->ged_log) {
150  bu_vls_free(gedp->ged_log);
151  BU_PUT(gedp->ged_log, struct bu_vls);
152  }
153 
154  if (gedp->ged_results) {
156  BU_PUT(gedp->ged_results, struct ged_results);
157  }
158 
159  if (gedp->ged_result_str) {
161  BU_PUT(gedp->ged_result_str, struct bu_vls);
162  }
163 
164  {
165  struct solid *nsp;
166  sp = BU_LIST_NEXT(solid, &gedp->freesolid->l);
167  while (BU_LIST_NOT_HEAD(sp, &gedp->freesolid->l)) {
168  nsp = BU_LIST_PNEXT(solid, sp);
169  BU_LIST_DEQUEUE(&((sp)->l));
170  FREE_SOLID(sp, &gedp->freesolid->l);
171  sp = nsp;
172  }
173  }
174  BU_PUT(gedp->freesolid, struct solid);
175 
176  bu_hash_tbl_traverse(gedp->ged_selections, free_object_selections, NULL);
178 }
179 
180 
181 void
182 ged_init(struct ged *gedp)
183 {
184  struct solid *freesolid;
185 
186  if (gedp == GED_NULL)
187  return;
188 
189  BU_LIST_INIT(&gedp->l);
190  gedp->ged_wdbp = RT_WDB_NULL;
191 
192  BU_GET(gedp->ged_log, struct bu_vls);
193  bu_vls_init(gedp->ged_log);
194 
195  BU_GET(gedp->ged_results, struct ged_results);
196  (void)_ged_results_init(gedp->ged_results);
197 
198  /* For now, we're keeping the string... will go once no one uses it */
199  BU_GET(gedp->ged_result_str, struct bu_vls);
201 
202  BU_GET(gedp->ged_gdp, struct ged_drawable);
203  BU_GET(gedp->ged_gdp->gd_headDisplay, struct bu_list);
205  BU_GET(gedp->ged_gdp->gd_headVDraw, struct bu_list);
208 
209  gedp->ged_gdp->gd_uplotOutputMode = PL_OUTPUT_MODE_BINARY;
210  qray_init(gedp->ged_gdp);
211 
213 
214  /* init the solid list */
215  BU_GET(freesolid, struct solid);
216  BU_LIST_INIT(&freesolid->l);
217  gedp->freesolid = freesolid;
218  gedp->ged_gdp->gd_freeSolids = freesolid;
219 
220  /* (in)sanity */
221  gedp->ged_gvp = NULL;
222  gedp->ged_fbsp = NULL;
223  gedp->ged_dmp = NULL;
224  gedp->ged_refresh_clientdata = NULL;
225  gedp->ged_refresh_handler = NULL;
226  gedp->ged_output_handler = NULL;
227  gedp->ged_output_script = NULL;
228  gedp->ged_internal_call = 0;
229 
230 }
231 
232 
233 void
234 ged_view_init(struct bview *gvp)
235 {
236  if (gvp == GED_VIEW_NULL)
237  return;
238 
239  gvp->gv_scale = 500.0;
240  gvp->gv_size = 2.0 * gvp->gv_scale;
241  gvp->gv_isize = 1.0 / gvp->gv_size;
242  VSET(gvp->gv_aet, 35.0, 25.0, 0.0);
243  VSET(gvp->gv_eye_pos, 0.0, 0.0, 1.0);
244  MAT_IDN(gvp->gv_rotation);
245  MAT_IDN(gvp->gv_center);
246  VSETALL(gvp->gv_keypoint, 0.0);
247  gvp->gv_coord = 'v';
248  gvp->gv_rotate_about = 'v';
249  gvp->gv_minMouseDelta = -20;
250  gvp->gv_maxMouseDelta = 20;
251  gvp->gv_rscale = 0.4;
252  gvp->gv_sscale = 2.0;
253 
254  gvp->gv_adc.a1 = 45.0;
255  gvp->gv_adc.a2 = 45.0;
256  VSET(gvp->gv_adc.line_color, 255, 255, 0);
257  VSET(gvp->gv_adc.tick_color, 255, 255, 255);
258 
259  VSET(gvp->gv_grid.anchor, 0.0, 0.0, 0.0);
260  gvp->gv_grid.res_h = 1.0;
261  gvp->gv_grid.res_v = 1.0;
262  gvp->gv_grid.res_major_h = 5;
263  gvp->gv_grid.res_major_v = 5;
264  VSET(gvp->gv_grid.color, 255, 255, 255);
265 
266  gvp->gv_rect.draw = 0;
267  gvp->gv_rect.pos[0] = 128;
268  gvp->gv_rect.pos[1] = 128;
269  gvp->gv_rect.dim[0] = 256;
270  gvp->gv_rect.dim[1] = 256;
271  VSET(gvp->gv_rect.color, 255, 255, 255);
272 
273  gvp->gv_view_axes.draw = 0;
274  VSET(gvp->gv_view_axes.axes_pos, 0.85, -0.85, 0.0);
275  gvp->gv_view_axes.axes_size = 0.2;
276  gvp->gv_view_axes.line_width = 0;
277  gvp->gv_view_axes.pos_only = 1;
278  VSET(gvp->gv_view_axes.axes_color, 255, 255, 255);
279  VSET(gvp->gv_view_axes.label_color, 255, 255, 0);
280  gvp->gv_view_axes.triple_color = 1;
281 
282  gvp->gv_model_axes.draw = 0;
283  VSET(gvp->gv_model_axes.axes_pos, 0.0, 0.0, 0.0);
284  gvp->gv_model_axes.axes_size = 2.0;
285  gvp->gv_model_axes.line_width = 0;
286  gvp->gv_model_axes.pos_only = 0;
287  VSET(gvp->gv_model_axes.axes_color, 255, 255, 255);
288  VSET(gvp->gv_model_axes.label_color, 255, 255, 0);
289  gvp->gv_model_axes.triple_color = 0;
290  gvp->gv_model_axes.tick_enabled = 1;
291  gvp->gv_model_axes.tick_length = 4;
293  gvp->gv_model_axes.tick_interval = 100;
294  gvp->gv_model_axes.ticks_per_major = 10;
295  gvp->gv_model_axes.tick_threshold = 8;
296  VSET(gvp->gv_model_axes.tick_color, 255, 255, 0);
297  VSET(gvp->gv_model_axes.tick_major_color, 255, 0, 0);
298 
299  gvp->gv_center_dot.gos_draw = 0;
300  VSET(gvp->gv_center_dot.gos_line_color, 255, 255, 0);
301 
302  gvp->gv_prim_labels.gos_draw = 0;
303  VSET(gvp->gv_prim_labels.gos_text_color, 255, 255, 0);
304 
305  gvp->gv_view_params.gos_draw = 0;
306  VSET(gvp->gv_view_params.gos_text_color, 255, 255, 0);
307 
308  gvp->gv_view_scale.gos_draw = 0;
309  VSET(gvp->gv_view_scale.gos_line_color, 255, 255, 0);
310  VSET(gvp->gv_view_scale.gos_text_color, 255, 255, 255);
311 
312  gvp->gv_data_vZ = 1.0;
313 
314  /* FIXME: this causes the shaders.sh regression to fail */
315  /* _ged_mat_aet(gvp); */
316 
317  ged_view_update(gvp);
318 }
319 
320 
321 struct ged *
322 ged_open(const char *dbtype, const char *filename, int existing_only)
323 {
324  struct ged *gedp;
325  struct rt_wdb *wdbp;
326  struct mater *save_materp = MATER_NULL;
327 
328  if (filename == NULL)
329  return GED_NULL;
330 
331  save_materp = rt_material_head();
332  rt_new_material_head(MATER_NULL);
333 
334  if (BU_STR_EQUAL(dbtype, "db")) {
335  struct db_i *dbip;
336 
337  if ((dbip = _ged_open_dbip(filename, existing_only)) == DBI_NULL) {
338  /* Restore RT's material head */
339  rt_new_material_head(save_materp);
340 
341  return GED_NULL;
342  }
343 
344  RT_CK_DBI(dbip);
345 
346  wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_DISK);
347  } else if (BU_STR_EQUAL(dbtype, "file")) {
348  wdbp = wdb_fopen(filename);
349  } else {
350  struct db_i *dbip;
351 
352  /* FIXME: this call should not exist. passing pointers as
353  * strings indicates a failure in design and lazy coding.
354  */
355  if (sscanf(filename, "%p", (void **)&dbip) != 1) {
356  /* Restore RT's material head */
357  rt_new_material_head(save_materp);
358 
359  return GED_NULL;
360  }
361 
362  if (dbip == DBI_NULL) {
363  int i;
364 
365  BU_ALLOC(dbip, struct db_i);
366  dbip->dbi_eof = (off_t)-1L;
367  dbip->dbi_fp = NULL;
368  dbip->dbi_mf = NULL;
369  dbip->dbi_read_only = 0;
370 
371  /* Initialize fields */
372  for (i = 0; i <RT_DBNHASH; i++) {
373  dbip->dbi_Head[i] = RT_DIR_NULL;
374  }
375 
376  dbip->dbi_local2base = 1.0; /* mm */
377  dbip->dbi_base2local = 1.0;
378  dbip->dbi_title = bu_strdup("Untitled BRL-CAD Database");
379  dbip->dbi_uses = 1;
380  dbip->dbi_filename = NULL;
381  dbip->dbi_filepath = NULL;
382  dbip->dbi_version = 5;
383 
384  bu_ptbl_init(&dbip->dbi_clients, 128, "dbi_clients[]");
385  dbip->dbi_magic = DBI_MAGIC; /* Now it's valid */
386  }
387 
388  /* Could core dump */
389  RT_CK_DBI(dbip);
390 
391  if (BU_STR_EQUAL(dbtype, "disk"))
392  wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_DISK);
393  else if (BU_STR_EQUAL(dbtype, "disk_append"))
395  else if (BU_STR_EQUAL(dbtype, "inmem"))
396  wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_INMEM);
397  else if (BU_STR_EQUAL(dbtype, "inmem_append"))
399  else {
400  /* Restore RT's material head */
401  rt_new_material_head(save_materp);
402 
403  bu_log("wdb_open %s target type not recognized", dbtype);
404  return GED_NULL;
405  }
406  }
407 
408  BU_GET(gedp, struct ged);
409  GED_INIT(gedp, wdbp);
410 
411  return gedp;
412 }
413 
414 
415 /**
416  * @brief
417  * Open/Create the database and build the in memory directory.
418  */
419 struct db_i *
420 _ged_open_dbip(const char *filename, int existing_only)
421 {
422  struct db_i *dbip;
423 
424  /* open database */
425  if (((dbip = db_open(filename, DB_OPEN_READWRITE)) == DBI_NULL) &&
426  ((dbip = db_open(filename, DB_OPEN_READONLY)) == DBI_NULL)) {
427 
428  /*
429  * Check to see if we can access the database
430  */
431  if (bu_file_exists(filename, NULL) && !bu_file_readable(filename)) {
432  bu_log("_ged_open_dbip: %s is not readable", filename);
433 
434  return DBI_NULL;
435  }
436 
437  if (existing_only)
438  return DBI_NULL;
439 
440  /* db_create does a db_dirbuild */
441  if ((dbip = db_create(filename, 5)) == DBI_NULL) {
442  bu_log("_ged_open_dbip: failed to create %s\n", filename);
443 
444  return DBI_NULL;
445  }
446  } else
447  /* --- Scan geometry database and build in-memory directory --- */
448  db_dirbuild(dbip);
449 
450 
451  return dbip;
452 }
453 
454 
455 HIDDEN int
456 _ged_cmp_attr(const void *p1, const void *p2, void *UNUSED(arg))
457 {
458  return bu_strcmp(((struct bu_attribute_value_pair *)p1)->name,
459  ((struct bu_attribute_value_pair *)p2)->name);
460 }
461 
462 
463 void
464 _ged_print_node(struct ged *gedp,
465  struct directory *dp,
466  size_t pathpos,
467  int indentSize,
468  char prefix,
469  unsigned flags,
470  int displayDepth,
471  int currdisplayDepth)
472 {
473  size_t i;
474  struct directory *nextdp;
475  struct rt_db_internal intern;
476  struct rt_comb_internal *comb;
477  unsigned aflag = (flags & _GED_TREE_AFLAG);
478  unsigned cflag = (flags & _GED_TREE_CFLAG);
479  struct bu_vls tmp_str = BU_VLS_INIT_ZERO;
480 
481  /* cflag = don't show shapes, so return if this is not a combination */
482  if (cflag && !(dp->d_flags & RT_DIR_COMB)) {
483  return;
484  }
485 
486  /* set up spacing from the left margin */
487  for (i = 0; i < pathpos; i++) {
488  if (indentSize < 0) {
489  bu_vls_printf(gedp->ged_result_str, "\t");
490  if (aflag)
491  bu_vls_printf(&tmp_str, "\t");
492 
493  } else {
494  int j;
495  for (j = 0; j < indentSize; j++) {
496  bu_vls_printf(gedp->ged_result_str, " ");
497  if (aflag)
498  bu_vls_printf(&tmp_str, " ");
499  }
500  }
501  }
502 
503  /* add the prefix if desired */
504  if (prefix) {
505  bu_vls_printf(gedp->ged_result_str, "%c ", prefix);
506  if (aflag)
507  bu_vls_printf(&tmp_str, " ");
508  }
509 
510  /* now the object name */
511  bu_vls_printf(gedp->ged_result_str, "%s", dp->d_namep);
512 
513  /* suffix name if appropriate */
514  /* Output Comb and Region flags (-F?) */
515  if (dp->d_flags & RT_DIR_COMB)
516  bu_vls_printf(gedp->ged_result_str, "/");
517  if (dp->d_flags & RT_DIR_REGION)
518  bu_vls_printf(gedp->ged_result_str, "R");
519 
520  bu_vls_printf(gedp->ged_result_str, "\n");
521 
522  /* output attributes if any and if desired */
523  if (aflag) {
524  struct bu_attribute_value_set avs;
525  bu_avs_init_empty(&avs);
526  if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
527  bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for object %s\n", dp->d_namep);
528  /* need a bombing macro or set an error code here: return GED_ERROR; */
529  bu_vls_free(&tmp_str);
530  return;
531  }
532 
533  /* FIXME: manually list all the attributes, if any. should be
534  * calling ged_attr() show so output formatting is consistent.
535  */
536  if (avs.count) {
537  struct bu_attribute_value_pair *avpp;
538  int max_attr_name_len = 0;
539 
540  /* sort attribute-value set array by attribute name */
541  bu_sort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair), _ged_cmp_attr, NULL);
542 
543  for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
544  int len = (int)strlen(avpp->name);
545  if (len > max_attr_name_len) {
546  max_attr_name_len = len;
547  }
548  }
549  for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
550  bu_vls_printf(gedp->ged_result_str, "%s @ %-*.*s %s\n",
551  tmp_str.vls_str,
552  max_attr_name_len, max_attr_name_len,
553  avpp->name, avpp->value);
554  }
555  }
556  bu_vls_free(&tmp_str);
557  }
558 
559  if (!(dp->d_flags & RT_DIR_COMB))
560  return;
561 
562  /*
563  * This node is a combination (e.g., a directory).
564  * Process all the arcs (e.g., directory members).
565  */
566 
567  if (rt_db_get_internal(&intern, dp, gedp->ged_wdbp->dbip, (fastf_t *)NULL, &rt_uniresource) < 0) {
568  bu_vls_printf(gedp->ged_result_str, "Database read error, aborting");
569  return;
570  }
571  comb = (struct rt_comb_internal *)intern.idb_ptr;
572 
573  if (comb->tree) {
574  size_t node_count;
575  size_t actual_count;
577 
578  if (comb->tree && db_ck_v4gift_tree(comb->tree) < 0) {
580  if (db_ck_v4gift_tree(comb->tree) < 0) {
581  bu_vls_printf(gedp->ged_result_str, "Cannot flatten tree for listing");
582  return;
583  }
584  }
585  node_count = db_tree_nleaves(comb->tree);
586  if (node_count > 0) {
587  rt_tree_array = (struct rt_tree_array *)bu_calloc(node_count,
588  sizeof(struct rt_tree_array), "tree list");
589  actual_count = (struct rt_tree_array *)db_flatten_tree(
590  rt_tree_array, comb->tree, OP_UNION,
591  1, &rt_uniresource) - rt_tree_array;
592  BU_ASSERT_SIZE_T(actual_count, ==, node_count);
593  comb->tree = TREE_NULL;
594  } else {
595  actual_count = 0;
596  rt_tree_array = NULL;
597  }
598 
599  for (i = 0; i < actual_count; i++) {
600  char op;
601 
602  switch (rt_tree_array[i].tl_op) {
603  case OP_UNION:
604  op = DB_OP_UNION;
605  break;
606  case OP_INTERSECT:
607  op = DB_OP_INTERSECT;
608  break;
609  case OP_SUBTRACT:
610  op = DB_OP_SUBTRACT;
611  break;
612  default:
613  op = '?';
614  break;
615  }
616 
617  if ((nextdp = db_lookup(gedp->ged_wdbp->dbip, rt_tree_array[i].tl_tree->tr_l.tl_name, LOOKUP_QUIET)) == RT_DIR_NULL) {
618  size_t j;
619 
620  for (j = 0; j < pathpos+1; j++)
621  bu_vls_printf(gedp->ged_result_str, "\t");
622 
623  bu_vls_printf(gedp->ged_result_str, "%c ", op);
624  bu_vls_printf(gedp->ged_result_str, "%s\n", rt_tree_array[i].tl_tree->tr_l.tl_name);
625  } else {
626  if (currdisplayDepth < displayDepth) {
627  _ged_print_node(gedp, nextdp, pathpos+1, indentSize, op, flags, displayDepth, currdisplayDepth+1);
628  }
629  }
630  db_free_tree(rt_tree_array[i].tl_tree, &rt_uniresource);
631  }
632  if (rt_tree_array) bu_free((char *)rt_tree_array, "printnode: rt_tree_array");
633  }
634  rt_db_free_internal(&intern);
635 }
636 
637 
638 /*
639  * Local Variables:
640  * mode: C
641  * tab-width: 8
642  * indent-tabs-mode: t
643  * c-file-style: "stroustrup"
644  * End:
645  * ex: shiftwidth=4 tabstop=8
646  */
void bu_vls_init(struct bu_vls *vp)
Definition: vls.c:56
#define GED_OK
Definition: ged.h:55
char * d_namep
pointer to name string
Definition: raytrace.h:859
char filename[MAXLENGTH]
Definition: human.c:105
Definition: raytrace.h:800
int color[3]
Definition: bview.h:114
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
mat_t gv_center
Definition: bview.h:221
int rt_db_get_internal(struct rt_db_internal *ip, const struct directory *dp, const struct db_i *dbip, const mat_t mat, struct resource *resp)
Definition: dir.c:76
fastf_t gv_data_vZ
Definition: bview.h:261
#define GED_DRAWABLE_NULL
Definition: ged.h:74
#define RT_DBNHASH
hash table is an array of linked lists with this many array pointer elements (Memory use for 32-bit: ...
Definition: raytrace.h:755
int res_major_v
Definition: bview.h:113
int dbi_uses
PRIVATE: # of uses of this struct.
Definition: raytrace.h:818
unsigned char * bu_get_hash_value(const struct bu_hash_entry *hsh_entry)
Definition: hash.c:170
fastf_t axes_size
Definition: bview.h:81
struct bview_other_state gv_view_scale
Definition: bview.h:253
void bu_avs_init_empty(struct bu_attribute_value_set *avp)
Definition: avs.c:36
Definition: list.h:118
int ticks_per_major
Definition: bview.h:91
int tick_threshold
Definition: bview.h:92
size_t db_tree_nleaves(const union tree *tp)
Definition: db_comb.c:99
void bu_hash_tbl_free(struct bu_hash_tbl *hsh_tbl)
Definition: hash.c:263
Definition: ged.h:338
fastf_t a2
Definition: bview.h:64
#define DBI_MAGIC
Definition: magic.h:202
struct db_i * dbip
Definition: raytrace.h:1266
fastf_t tick_interval
Definition: bview.h:90
if lu s
Definition: nmg_mod.c:3860
Definition: clone.c:90
vect_t gv_keypoint
Definition: bview.h:217
int ged_internal_call
Definition: ged.h:374
void bu_ptbl_init(struct bu_ptbl *b, size_t len, const char *str)
Definition: ptbl.c:32
struct bview_axes_state gv_model_axes
Definition: bview.h:237
#define VSET(a, b, c, d)
Definition: color.c:53
#define VSETALL(a, s)
Definition: color.c:54
struct db_i * _ged_open_dbip(const char *filename, int existing_only)
Open/Create the database and build the in memory directory.
Definition: ged.c:420
struct directory * db_lookup(const struct db_i *, const char *name, int noisy)
Definition: db_lookup.c:153
void * ged_refresh_clientdata
client data passed to refresh handler
Definition: ged.h:366
struct ged_run_rt gd_headRunRt
head of forked rt processes
Definition: ged.h:314
int tick_length
Definition: bview.h:88
int bu_ptbl_rm(struct bu_ptbl *b, const long *p)
char ** dbi_filepath
search path for aux file opens (convenience var)
Definition: raytrace.h:810
union tree * tl_tree
Definition: raytrace.h:1247
fastf_t anchor[3]
Definition: bview.h:109
int gos_line_color[3]
Definition: bview.h:205
int gos_text_color[3]
Definition: bview.h:206
int axes_color[3]
Definition: bview.h:84
struct bview_other_state gv_prim_labels
Definition: bview.h:251
#define _GED_TREE_AFLAG
Definition: ged_private.h:68
Definition: bview.h:209
struct fbserv_obj * ged_fbsp
Definition: ged.h:362
struct rt_wdb * ged_wdbp
Definition: ged.h:340
Header file for the BRL-CAD common definitions.
int bu_file_readable(const char *path)
Definition: file.c:223
const char * value
Definition: avs.h:62
#define RT_DIR_REGION
region
Definition: raytrace.h:885
int line_width
Definition: bview.h:82
Definition: hash.h:44
void ged_init(struct ged *gedp)
Definition: ged.c:182
void ged_view_update(struct bview *gvp)
Definition: vutil.c:33
struct bu_list * gd_headDisplay
head of display list
Definition: ged.h:307
struct bu_vls * ged_log
Definition: ged.h:343
void ged_close(struct ged *gedp)
Definition: ged.c:74
#define GED_ERROR
Definition: ged.h:61
struct bview_interactive_rect_state gv_rect
Definition: bview.h:254
#define HIDDEN
Definition: common.h:86
struct bu_ptbl selections
holds struct rt_selection
Definition: raytrace.h:1959
struct bu_mapped_file * dbi_mf
PRIVATE: Only in read-only mode.
Definition: raytrace.h:822
void qray_init(struct ged_drawable *gdp)
Definition: qray.c:424
struct bview * ged_gvp
Definition: ged.h:361
int res_major_h
Definition: bview.h:112
struct ged * ged_open(const char *dbtype, const char *filename, int existing_only)
Definition: ged.c:322
int ged_decode_dbip(const char *dbip_string, struct db_i **dbipp)
Definition: ged.c:60
Definition: ptbl.h:62
fastf_t gv_minMouseDelta
Definition: bview.h:230
int tick_major_length
Definition: bview.h:89
fastf_t gv_sscale
Definition: bview.h:233
#define DB_OPEN_READWRITE
Definition: raytrace.h:3555
struct solid * freesolid
Definition: ged.h:345
fastf_t a1
Definition: bview.h:63
struct rt_tree_array * db_flatten_tree(struct rt_tree_array *rt_tree_array, union tree *tp, int op, int avail, struct resource *resp)
Definition: db_comb.c:138
if(share_geom)
Definition: nmg_mod.c:3829
void bu_vls_free(struct bu_vls *vp)
Definition: vls.c:248
struct bu_list l
Definition: ged.h:260
#define OP_SUBTRACT
Binary: L subtract R.
Definition: raytrace.h:1129
void * ged_dmp
Definition: ged.h:365
void db_non_union_push(union tree *tp, struct resource *resp)
Definition: db_tree.c:1426
#define OP_INTERSECT
Binary: L intersect R.
Definition: raytrace.h:1128
struct resource rt_uniresource
default. Defined in librt/globals.c
Definition: globals.c:41
char * dbi_title
title from IDENT rec
Definition: raytrace.h:809
int label_color[3]
Definition: bview.h:85
struct bu_attribute_value_pair * avp
Definition: avs.h:89
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
int tick_major_color[3]
Definition: bview.h:94
void * bu_calloc(size_t nelem, size_t elsize, const char *str)
Definition: malloc.c:321
fastf_t res_h
Definition: bview.h:110
fastf_t gv_isize
1.0 / size
Definition: bview.h:213
struct bview_grid_state gv_grid
Definition: bview.h:249
struct bview_other_state gv_center_dot
Definition: bview.h:250
fastf_t gv_scale
Definition: bview.h:211
off_t dbi_eof
PRIVATE: End+1 pos after db_scan()
Definition: raytrace.h:816
void(* free_selection)(struct rt_selection *)
Definition: raytrace.h:1964
#define BU_PTBL_GET(ptbl, i)
Definition: ptbl.h:108
#define LOOKUP_QUIET
Definition: raytrace.h:893
#define TREE_NULL
Definition: raytrace.h:1181
#define RT_WDB_TYPE_DB_DISK
Definition: raytrace.h:1295
fastf_t gv_size
2.0 * scale
Definition: bview.h:212
fastf_t res_v
Definition: bview.h:111
void db_free_tree(union tree *tp, struct resource *resp)
Definition: db_tree.c:1296
#define BU_GET(_ptr, _type)
Definition: malloc.h:201
void bu_sort(void *array, size_t nummemb, size_t sizememb, int(*compare)(const void *, const void *, void *), void *context)
Definition: sort.c:110
char gv_rotate_about
indicates what point rotations are about
Definition: bview.h:219
struct bu_ptbl dbi_clients
PRIVATE: List of rtip's using this db_i.
Definition: raytrace.h:823
void ged_free(struct ged *gedp)
Definition: ged.c:131
int tick_color[3]
Definition: bview.h:74
void rt_new_material_head(struct mater *newmat)
Definition: mater.c:253
char * tl_name
Name of this leaf (bu_strdup'ed)
Definition: raytrace.h:1174
#define BU_LIST_PNEXT(structure, p)
Definition: list.h:422
void ged_view_init(struct bview *gvp)
Definition: ged.c:234
struct bu_hash_tbl * ged_selections
object name -> struct rt_object_selections
Definition: ged.h:363
#define GED_NULL
Definition: ged.h:72
int line_color[3]
Definition: bview.h:73
#define UNUSED(parameter)
Definition: common.h:239
struct bview_adc_state gv_adc
Definition: bview.h:236
#define BU_PUT(_ptr, _type)
Definition: malloc.h:215
struct bu_list * gd_headVDraw
head of vdraw list
Definition: ged.h:308
struct bu_list l
Definition: ged.h:339
#define _GED_TREE_CFLAG
Definition: ged_private.h:69
#define GED_VIEW_NULL
Definition: ged.h:75
FILE * dbi_fp
PRIVATE: object hash table.
Definition: raytrace.h:815
struct bu_vls * ged_result_str
Definition: ged.h:357
double dbi_base2local
unit conversion factors
Definition: raytrace.h:808
#define BU_FREE(_ptr, _type)
Definition: malloc.h:229
point_t axes_pos
Definition: bview.h:80
void ged_results_free(struct ged_results *results)
Definition: ged_util.c:98
int triple_color
Definition: bview.h:86
struct ged_drawable * ged_gdp
Definition: ged.h:360
void(* ged_refresh_handler)(void *)
function for handling refresh requests
Definition: ged.h:367
#define BU_PTBL_LEN(ptbl)
Definition: ptbl.h:107
struct solid * gd_freeSolids
ptr to head of free solid list
Definition: ged.h:310
fastf_t gv_rscale
Definition: bview.h:232
int tick_color[3]
Definition: bview.h:93
void bu_ptbl_free(struct bu_ptbl *b)
Definition: ptbl.c:226
struct mater * rt_material_head(void)
Definition: mater.c:243
int tick_enabled
Definition: bview.h:87
int gd_uplotOutputMode
output mode for unix plots
Definition: ged.h:318
fastf_t gv_maxMouseDelta
Definition: bview.h:231
void qray_free(struct ged_drawable *gdp)
Definition: qray.c:458
#define RT_CK_DBI(_p)
Definition: raytrace.h:829
int dbi_read_only
!0 => read only file
Definition: raytrace.h:806
#define GED_INIT(_gedp, _wdbp)
Definition: ged.h:94
struct db_i * db_create(const char *name, int version)
Definition: db_open.c:225
void wdb_close(struct rt_wdb *wdbp)
Definition: wdb.c:333
int bu_strcmp(const char *string1, const char *string2)
Definition: str.c:171
mat_t gv_rotation
Definition: bview.h:220
void _ged_print_node(struct ged *gedp, struct directory *dp, size_t pathpos, int indentSize, char prefix, unsigned flags, int displayDepth, int currdisplayDepth)
Definition: ged.c:464
struct tree::tree_db_leaf tr_l
#define BU_LIST_INIT(_hp)
Definition: list.h:148
void * idb_ptr
Definition: raytrace.h:195
#define RT_DIR_COMB
combination
Definition: raytrace.h:884
struct directory * dbi_Head[RT_DBNHASH]
Definition: raytrace.h:814
#define RT_WDB_TYPE_DB_INMEM_APPEND_ONLY
Definition: raytrace.h:1298
Definition: op.h:35
#define DBI_NULL
Definition: raytrace.h:827
char gv_coord
coordinate system
Definition: bview.h:218
union tree * tree
Leading to tree_db_leaf leaves.
Definition: raytrace.h:938
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
#define RT_DIR_NULL
Definition: raytrace.h:875
#define DB_OPEN_READONLY
Definition: raytrace.h:3550
struct bview_axes_state gv_view_axes
Definition: bview.h:238
char * vls_str
Definition: vls.h:58
int pos_only
Definition: bview.h:83
struct db_i * db_open(const char *name, const char *mode)
Definition: db_open.c:59
vect_t gv_eye_pos
eye position
Definition: bview.h:216
HIDDEN int _ged_cmp_attr(const void *p1, const void *p2, void *arg)
Definition: ged.c:456
char * ged_output_script
script for use by the outputHandler
Definition: ged.h:369
void(* ged_output_handler)(struct ged *, char *)
function for handling output
Definition: ged.h:368
struct bu_hash_tbl * sets
Definition: raytrace.h:1978
int dbi_version
PRIVATE: use db_version()
Definition: raytrace.h:824
#define BU_ASSERT_SIZE_T(_lhs, _relation, _rhs)
Definition: defines.h:253
vect_t gv_aet
Definition: bview.h:215
const char * name
Definition: avs.h:61
#define RT_WDB_TYPE_DB_INMEM
Definition: raytrace.h:1297
void bu_free(void *ptr, const char *str)
Definition: malloc.c:328
int _ged_results_init(struct ged_results *results)
Definition: ged_util.c:36
double dbi_local2base
local2mm
Definition: raytrace.h:807
int db_dirbuild(struct db_i *dbip)
Definition: db5_scan.c:301
#define BU_VLS_INIT_ZERO
Definition: vls.h:84
#define RT_WDB_TYPE_DB_DISK_APPEND_ONLY
Definition: raytrace.h:1296
#define BU_LIST_DEQUEUE(cur)
Definition: list.h:209
struct bu_hash_tbl * bu_hash_tbl_create(unsigned long tbl_size)
Definition: hash.c:48
int db5_get_attributes(const struct db_i *dbip, struct bu_attribute_value_set *avs, const struct directory *dp)
Definition: db5_io.c:1027
int d_flags
flags
Definition: raytrace.h:869
Definition: vls.h:56
char * dbi_filename
file name
Definition: raytrace.h:805
double fastf_t
Definition: defines.h:300
#define OP_UNION
Binary: L union R.
Definition: raytrace.h:1127
int db_ck_v4gift_tree(const union tree *tp)
Definition: db_comb.c:927
struct rt_wdb * wdb_fopen(const char *filename)
Definition: wdb.c:56
int bu_file_exists(const char *path, int *fd)
Definition: file.c:57
#define BU_LIST_NEXT(structure, hp)
Definition: list.h:316
struct rt_wdb * wdb_dbopen(struct db_i *dbip, int mode)
Definition: wdb.c:64
#define BU_LIST_NOT_HEAD(p, hp)
Definition: list.h:324
struct bu_hash_entry * bu_hash_tbl_traverse(struct bu_hash_tbl *hsh_tbl, int(*func)(struct bu_hash_entry *, void *), void *func_arg)
Definition: hash.c:358
struct bview_other_state gv_view_params
Definition: bview.h:252
void rt_db_free_internal(struct rt_db_internal *ip)
Definition: dir.c:216
uint32_t dbi_magic
magic number
Definition: raytrace.h:801
struct ged_results * ged_results
Definition: ged.h:358
#define bu_strdup(s)
Definition: str.h:71
#define BU_STR_EQUAL(s1, s2)
Definition: str.h:126
#define RT_WDB_NULL
Definition: raytrace.h:1294