BRL-CAD
select.h
Go to the documentation of this file.
1/* S E L E C T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2008-2023 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_select
21 *
22 * Geometry EDiting Library Object Selection Functions.
23 *
24 */
25/** @{ */
26/** @file ged/view/select.h */
27
28#ifndef GED_VIEW_SELECT_H
29#define GED_VIEW_SELECT_H
30
31#include "common.h"
32#include "bv/defines.h"
33#include "ged/defines.h"
34
35__BEGIN_DECLS
36
38 struct ged *gedp;
39 struct bu_vls path;
40 struct bu_ptbl sobjs; // struct bv_scene_obj pointers
42};
43
44struct ged_selection_set_impl;
46 struct ged *gedp;
47 struct bu_vls name;
48 struct ged_selection_set_impl *i;
49};
50
51struct ged_selection_sets_impl;
53 struct ged *gedp;
54 struct ged_selection_sets_impl *i;
55};
56
57// Routines to manage a set of selection sets
58GED_EXPORT extern struct ged_selection_sets *ged_selection_sets_create(struct ged *gedp);
59GED_EXPORT extern void ged_selection_sets_destroy(struct ged_selection_sets *s);
60
61// Routines for creating and destroying temporary sets (normally should be created within
62// the context of a selection set - these are for temporary processing sets)
63GED_EXPORT struct ged_selection_set *ged_selection_set_create(const char *s_name, struct ged *gedp);
65
66// Routines to retrieve and remove individual selection sets
67GED_EXPORT struct ged_selection_set *ged_selection_sets_get(struct ged_selection_sets *s, const char *s_path);
68GED_EXPORT void ged_selection_sets_put(struct ged_selection_sets *s, const char *s_path);
69GED_EXPORT int ged_selection_set_cpy(struct ged_selection_set *to, struct ged_selection_set *from);
70GED_EXPORT size_t ged_selection_sets_lookup(struct bu_ptbl *sets, struct ged_selection_sets *s, const char *pattern);
71
72// Retrieve data.
73GED_EXPORT int ged_selection_find(struct ged_selection_set *s, const char *s_name);
74GED_EXPORT size_t ged_selection_lookup(struct bu_ptbl *matches, struct ged_selection_set *s, const char *s_path);
75GED_EXPORT size_t ged_selection_lookup_fp(struct bu_ptbl *matches, struct ged_selection_set *s, struct db_full_path *fp);
76GED_EXPORT int ged_selection_set_list(char ***keys, struct ged_selection_set *s);
77GED_EXPORT void ged_selection_set_clear(struct ged_selection_set *s);
78
79// Manipulate data
80GED_EXPORT struct ged_selection *ged_selection_insert(struct ged_selection_set *s, const char *s_path);
81GED_EXPORT struct ged_selection *ged_selection_insert_fp(struct ged_selection_set *s, struct db_full_path *fp);
83GED_EXPORT void ged_selection_remove(struct ged_selection_set *s, const char *s_path);
84GED_EXPORT void ged_selection_remove_fp(struct ged_selection_set *s, struct db_full_path *fp);
85GED_EXPORT void ged_selection_remove_obj(struct ged_selection_set *s, struct bv_scene_obj *o);
86GED_EXPORT int ged_selection_set_expand(struct ged_selection_set *s_out, struct ged_selection_set *s);
87GED_EXPORT int ged_selection_set_collapse(struct ged_selection_set *s_out, struct ged_selection_set *s);
88
89// Given a set, associate the DBOBJ scene objects with any matching selection objects.
91GED_EXPORT void ged_selection_toggle_illum(struct ged_selection_set *s, char ill_state);
92
93// Given a set, return the hash of its contents
94GED_EXPORT unsigned long long ged_selection_hash_set(struct ged_selection_set *s);
95
96// Given a set of sets, return the hash of all the set names and their contents
97GED_EXPORT unsigned long long ged_selection_hash_sets(struct ged_selection_sets *ss);
98
99
100/**
101 * Returns a list of items within the previously defined rectangle.
102 */
103GED_EXPORT extern int ged_rselect(struct ged *gedp, int argc, const char *argv[]);
104
105/**
106 * Returns a list of items within the specified rectangle or circle.
107 */
108GED_EXPORT extern int ged_select(struct ged *gedp, int argc, const char *argv[]);
109
110/**
111 * Return ged selections for specified object. Created if it doesn't
112 * exist.
113 */
114GED_EXPORT struct rt_object_selections *ged_get_object_selections(struct ged *gedp,
115 const char *object_name);
116
117/**
118 * Return ged selections of specified kind for specified object.
119 * Created if it doesn't exist.
120 */
121GED_EXPORT struct rt_selection_set *ged_get_selection_set(struct ged *gedp,
122 const char *object_name,
123 const char *selection_name);
124
125
126
127
128__END_DECLS
129
130#endif /* GED_VIEW_SELECT_H */
131
132/** @} */
133
134/*
135 * Local Variables:
136 * tab-width: 8
137 * mode: C
138 * indent-tabs-mode: t
139 * c-file-style: "stroustrup"
140 * End:
141 * ex: shiftwidth=4 tabstop=8
142 */
Header file for the BRL-CAD common definitions.
struct ged_selection_sets * ged_selection_sets_create(struct ged *gedp)
size_t ged_selection_lookup_fp(struct bu_ptbl *matches, struct ged_selection_set *s, struct db_full_path *fp)
unsigned long long ged_selection_hash_set(struct ged_selection_set *s)
size_t ged_selection_lookup(struct bu_ptbl *matches, struct ged_selection_set *s, const char *s_path)
void ged_selection_sets_put(struct ged_selection_sets *s, const char *s_path)
void ged_selection_remove(struct ged_selection_set *s, const char *s_path)
struct ged_selection * ged_selection_insert_fp(struct ged_selection_set *s, struct db_full_path *fp)
void ged_selection_set_clear(struct ged_selection_set *s)
void ged_selection_remove_fp(struct ged_selection_set *s, struct db_full_path *fp)
int ged_selection_set_list(char ***keys, struct ged_selection_set *s)
int ged_selection_set_cpy(struct ged_selection_set *to, struct ged_selection_set *from)
void ged_selection_set_destroy(struct ged_selection_set *)
int ged_rselect(struct ged *gedp, int argc, const char *argv[])
struct ged_selection * ged_selection_insert_obj(struct ged_selection_set *s, struct bv_scene_obj *o)
struct ged_selection_set * ged_selection_sets_get(struct ged_selection_sets *s, const char *s_path)
void ged_selection_assign_objs(struct ged_selection_set *s)
int ged_selection_set_collapse(struct ged_selection_set *s_out, struct ged_selection_set *s)
int ged_select(struct ged *gedp, int argc, const char *argv[])
size_t ged_selection_sets_lookup(struct bu_ptbl *sets, struct ged_selection_sets *s, const char *pattern)
void ged_selection_remove_obj(struct ged_selection_set *s, struct bv_scene_obj *o)
struct ged_selection * ged_selection_insert(struct ged_selection_set *s, const char *s_path)
struct rt_object_selections * ged_get_object_selections(struct ged *gedp, const char *object_name)
struct ged_selection_set * ged_selection_set_create(const char *s_name, struct ged *gedp)
int ged_selection_find(struct ged_selection_set *s, const char *s_name)
int ged_selection_set_expand(struct ged_selection_set *s_out, struct ged_selection_set *s)
void ged_selection_sets_destroy(struct ged_selection_sets *s)
struct rt_selection_set * ged_get_selection_set(struct ged *gedp, const char *object_name, const char *selection_name)
unsigned long long ged_selection_hash_sets(struct ged_selection_sets *ss)
void ged_selection_toggle_illum(struct ged_selection_set *s, char ill_state)
Definition: ptbl.h:53
Definition: vls.h:53
struct ged_selection_set_impl * i
Definition: select.h:48
struct bu_vls name
Definition: select.h:47
struct ged * gedp
Definition: select.h:46
struct ged * gedp
Definition: select.h:53
struct ged_selection_sets_impl * i
Definition: select.h:54
struct bu_vls path
Definition: select.h:39
struct rt_object_selections * r_os
Definition: select.h:41
struct bu_ptbl sobjs
Definition: select.h:40
struct ged * gedp
Definition: select.h:38
Definition: defines.h:195