BRL-CAD
view.h
Go to the documentation of this file.
1 /* V I E W . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2024 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 ged_view
21  *
22  * Geometry EDiting Library Database View Related Functions.
23  *
24  */
25 /** @{ */
26 /** @file ged/view.h */
27 
28 #ifndef GED_VIEW_H
29 #define GED_VIEW_H
30 
31 #include "common.h"
32 #include "ged/defines.h"
33 #include "bg/polygon.h"
34 #include "ged/view/matrix.h"
35 #include "ged/view/select.h"
36 #include "ged/view/state.h"
37 
38 __BEGIN_DECLS
39 
40 
41 /** Check if a drawable exists */
42 #define GED_CHECK_DRAWABLE(_gedp, _flags) \
43  if (_gedp->ged_gdp == GED_DRAWABLE_NULL) { \
44  int ged_check_drawable_quiet = (_flags) & GED_QUIET; \
45  if (!ged_check_drawable_quiet) { \
46  bu_vls_trunc((_gedp)->ged_result_str, 0); \
47  bu_vls_printf((_gedp)->ged_result_str, "A drawable does not exist."); \
48  } \
49  return (_flags); \
50  }
51 
52 /** Check if a view exists */
53 #define GED_CHECK_VIEW(_gedp, _flags) \
54  if (_gedp->ged_gvp == GED_VIEW_NULL) { \
55  int ged_check_view_quiet = (_flags) & GED_QUIET; \
56  if (!ged_check_view_quiet) { \
57  bu_vls_trunc((_gedp)->ged_result_str, 0); \
58  bu_vls_printf((_gedp)->ged_result_str, "A view does not exist."); \
59  } \
60  return (_flags); \
61  }
62 
63 struct ged_bv_data {
64  struct db_full_path s_fullpath;
65  void *u_data;
66 };
67 /* Check ged_bv data associated with a display list */
68 GED_EXPORT extern unsigned long long ged_dl_hash(struct display_list *dl);
69 
70 
71 /* defined in display_list.c */
72 GED_EXPORT void dl_set_iflag(struct bu_list *hdlp, int iflag);
73 GED_EXPORT extern void dl_color_soltab(struct bu_list *hdlp);
74 GED_EXPORT extern void dl_erasePathFromDisplay(struct ged *gedp, const char *path, int allow_split);
75 GED_EXPORT extern struct display_list *dl_addToDisplay(struct bu_list *hdlp, struct db_i *dbip, const char *name);
76 
77 GED_EXPORT extern int invent_solid(struct ged *gedp, char *name, struct bu_list *vhead, long int rgb, int copy, fastf_t transparency, int dmode, int csoltab);
78 
79 /**
80  * Grid utility command.
81  */
82 GED_EXPORT extern int ged_grid(struct ged *gedp, int argc, const char *argv[]);
83 
84 /**
85  * Convert grid coordinates to model coordinates.
86  */
87 GED_EXPORT extern int ged_grid2model_lu(struct ged *gedp, int argc, const char *argv[]);
88 
89 /**
90  * Convert grid coordinates to view coordinates.
91  */
92 GED_EXPORT extern int ged_grid2view_lu(struct ged *gedp, int argc, const char *argv[]);
93 
94 /**
95  * Overlay the specified 2D/3D UNIX plot file
96  */
97 GED_EXPORT extern int ged_overlay(struct ged *gedp, int argc, const char *argv[]);
98 
99 /**
100  * Create a unix plot file of the currently displayed objects.
101  */
102 GED_EXPORT extern int ged_plot(struct ged *gedp, int argc, const char *argv[]);
103 
104 /**
105  * Create a png file of the view.
106  */
107 GED_EXPORT extern int ged_png(struct ged *gedp, int argc, const char *argv[]);
108 GED_EXPORT extern int ged_screen_grab(struct ged *gedp, int argc, const char *argv[]);
109 
110 /**
111  * Create a postscript file of the view.
112  */
113 GED_EXPORT extern int ged_ps(struct ged *gedp, int argc, const char *argv[]);
114 
115 /**
116  * Returns the solid table & vector list as a string
117  */
118 GED_EXPORT extern int ged_solid_report(struct ged *gedp, int argc, const char *argv[]);
119 
120 /**
121  * Save the view
122  */
123 GED_EXPORT extern int ged_saveview(struct ged *gedp, int argc, const char *argv[]);
124 
125 
126 /**
127  * Return the object hierarchy for all object(s) specified or for all currently displayed
128  */
129 GED_EXPORT extern int ged_tree(struct ged *gedp, int argc, const char *argv[]);
130 
131 
132 /**
133  * Vector drawing utility.
134  */
135 GED_EXPORT extern int ged_vdraw(struct ged *gedp, int argc, const char *argv[]);
136 
137 /**
138  * Get/set view attributes
139  */
140 GED_EXPORT extern int ged_view_func(struct ged *gedp, int argc, const char *argv[]);
141 
142 /**
143  * Get/set the unix plot output mode
144  */
145 GED_EXPORT extern int ged_set_uplotOutputMode(struct ged *gedp, int argc, const char *argv[]);
146 
147 GED_EXPORT extern int ged_export_polygon(struct ged *gedp, bv_data_polygon_state *gdpsp, size_t polygon_i, const char *sname);
148 GED_EXPORT extern struct bg_polygon *ged_import_polygon(struct ged *gedp, const char *sname);
149 GED_EXPORT extern int ged_polygons_overlap(struct ged *gedp, struct bg_polygon *polyA, struct bg_polygon *polyB);
150 GED_EXPORT extern void ged_polygon_fill_segments(struct ged *gedp, struct bg_polygon *poly, vect2d_t vfilldir, fastf_t vfilldelta);
151 
152 __END_DECLS
153 
154 #endif /* GED_VIEW_H */
155 
156 /** @} */
157 
158 /*
159  * Local Variables:
160  * tab-width: 8
161  * mode: C
162  * indent-tabs-mode: t
163  * c-file-style: "stroustrup"
164  * End:
165  * ex: shiftwidth=4 tabstop=8
166  */
Header file for the BRL-CAD common definitions.
int ged_vdraw(struct ged *gedp, int argc, const char *argv[])
int ged_grid2view_lu(struct ged *gedp, int argc, const char *argv[])
int ged_screen_grab(struct ged *gedp, int argc, const char *argv[])
void ged_polygon_fill_segments(struct ged *gedp, struct bg_polygon *poly, vect2d_t vfilldir, fastf_t vfilldelta)
int ged_polygons_overlap(struct ged *gedp, struct bg_polygon *polyA, struct bg_polygon *polyB)
void dl_set_iflag(struct bu_list *hdlp, int iflag)
struct bg_polygon * ged_import_polygon(struct ged *gedp, const char *sname)
int ged_saveview(struct ged *gedp, int argc, const char *argv[])
int ged_tree(struct ged *gedp, int argc, const char *argv[])
int invent_solid(struct ged *gedp, char *name, struct bu_list *vhead, long int rgb, int copy, fastf_t transparency, int dmode, int csoltab)
int ged_export_polygon(struct ged *gedp, bv_data_polygon_state *gdpsp, size_t polygon_i, const char *sname)
unsigned long long ged_dl_hash(struct display_list *dl)
int ged_grid2model_lu(struct ged *gedp, int argc, const char *argv[])
int ged_ps(struct ged *gedp, int argc, const char *argv[])
int ged_grid(struct ged *gedp, int argc, const char *argv[])
int ged_set_uplotOutputMode(struct ged *gedp, int argc, const char *argv[])
void dl_color_soltab(struct bu_list *hdlp)
int ged_solid_report(struct ged *gedp, int argc, const char *argv[])
int ged_plot(struct ged *gedp, int argc, const char *argv[])
void dl_erasePathFromDisplay(struct ged *gedp, const char *path, int allow_split)
int ged_view_func(struct ged *gedp, int argc, const char *argv[])
int ged_overlay(struct ged *gedp, int argc, const char *argv[])
struct display_list * dl_addToDisplay(struct bu_list *hdlp, struct db_i *dbip, const char *name)
int ged_png(struct ged *gedp, int argc, const char *argv[])
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:334
fastf_t vect2d_t[ELEMENTS_PER_VECT2D]
2-tuple vector
Definition: vmath.h:337
Definition: list.h:132
struct db_full_path s_fullpath
Definition: view.h:64
void * u_data
Definition: view.h:65
Definition: defines.h:205