25#ifndef OCCTL_HPP_VIZ_HPP
26#define OCCTL_HPP_VIZ_HPP
149 aResult.
uid =
UID(theC.uid);
176 : myHandle(theOther.myHandle)
178 theOther.myHandle =
nullptr;
183 if (
this != &theOther)
186 myHandle = theOther.myHandle;
187 theOther.myHandle =
nullptr;
215 : myHandle(theOther.myHandle)
217 theOther.myHandle =
nullptr;
222 if (
this != &theOther)
225 myHandle = theOther.myHandle;
226 theOther.myHandle =
nullptr;
252 Presentable(
const Presentable&) =
delete;
253 Presentable& operator=(
const Presentable&) =
delete;
255 Presentable(Presentable&& theOther) noexcept
256 : myHandle(theOther.myHandle)
258 theOther.myHandle =
nullptr;
261 Presentable& operator=(Presentable&& theOther)
noexcept
263 if (
this != &theOther)
266 myHandle = theOther.myHandle;
267 theOther.myHandle =
nullptr;
284 int32_t aChanged = 0;
286 return aChanged != 0;
295 std::vector<::occtl_node_id_t> aIds;
296 aIds.reserve(theNodes.size());
297 for (
const NodeId& aNode : theNodes)
298 aIds.push_back(aNode.get());
326 View& operator=(
const View&) =
delete;
329 : myHandle(theOther.myHandle)
331 theOther.myHandle =
nullptr;
334 View& operator=(
View&& theOther)
noexcept
336 if (
this != &theOther)
339 myHandle = theOther.myHandle;
340 theOther.myHandle =
nullptr;
358 void resize(
const int32_t theWidth,
const int32_t theHeight)
398 void pan(
const int32_t theDx,
const int32_t theDy)
404 void zoom(
const int32_t theX1,
const int32_t theY1,
const int32_t theX2,
const int32_t theY2)
425 thePresentable.get(),
430 void pick(
const int32_t theX,
const int32_t theY,
const bool theSelect,
PickResult& theResult)
442 std::vector<std::uint8_t> aPixels(aCount);
RAII handle for a topology graph. Mirrors occtl_graph_t.
Definition topo.hpp:1444
::occtl_graph_t * get() const noexcept
Borrows-it pointer to the underlying C handle, for direct ABI calls.
Definition topo.hpp:1494
Session-local identity of a graph node. Mirrors occtl_node_id_t.
Definition topo.hpp:52
::occtl_node_id_t get() const noexcept
Borrows-it view of the underlying C value type, for direct ABI calls.
Definition topo.hpp:64
Session-local identity of a reference entry. Mirrors occtl_ref_id_t.
Definition topo.hpp:90
Persistent identity surviving node removal and graph compaction. Mirrors occtl_uid_t.
Definition uid.hpp:39
RAII wrapper for the process-local visualization driver.
Definition viz.hpp:162
RAII wrapper for a display object bound to a graph root.
Definition viz.hpp:241
void set_display_mode(const DisplayMode theMode)
Sets the display mode.
Definition viz.hpp:273
void clear_visible_nodes()
Clears a visible node mask (display everything).
Definition viz.hpp:303
bool synchronize()
Synchronizes presentation after graph or metadata changes.
Definition viz.hpp:282
void set_visible_nodes(const std::vector< NodeId > &theNodes)
Restricts display to a visible node mask.
Definition viz.hpp:293
void invalidate()
Invalidates cached presentation state.
Definition viz.hpp:290
Presentable(Viewer &theViewer, Graph &theGraph, const NodeId theRoot)
Creates a display object for a graph root.
Definition viz.hpp:244
RAII wrapper for a native or offscreen view.
Definition viz.hpp:315
void zoom(const int32_t theX1, const int32_t theY1, const int32_t theX2, const int32_t theY2)
Zooms using two screen-space points.
Definition viz.hpp:404
void orbit_start(const int32_t theX, const int32_t theY)
Starts an orbit interaction at a screen point.
Definition viz.hpp:410
void pick(const int32_t theX, const int32_t theY, const bool theSelect, PickResult &theResult)
Picks or selects at a screen point and returns graph identity.
Definition viz.hpp:430
void pan(const int32_t theDx, const int32_t theDy)
Pans the camera by screen-space pixels.
Definition viz.hpp:398
void orbit_update(const int32_t theX, const int32_t theY)
Updates an orbit interaction at a screen point.
Definition viz.hpp:416
void redraw()
Redraws the view.
Definition viz.hpp:364
void activate_selection(Presentable &thePresentable, const SelectionMode theMode)
Activates graph-native selection for a presentable.
Definition viz.hpp:422
void set_background(const ::occtl_color_rgba_t &theColor)
Sets the view background colour.
Definition viz.hpp:370
void dump_image(const std::string &thePath)
Dumps a view image to a PNG path when OCCT image codecs are available.
Definition viz.hpp:448
std::vector< std::uint8_t > read_pixels_rgba()
Reads view pixels as tightly packed RGBA bytes (two-call buffer pattern).
Definition viz.hpp:438
void erase(Presentable &thePresentable)
Erases a presentable from this view.
Definition viz.hpp:352
void resize(const int32_t theWidth, const int32_t theHeight)
Resizes the view.
Definition viz.hpp:358
void set_camera(const Camera &theCamera)
Sets the camera.
Definition viz.hpp:376
Camera get_camera() const
Returns the current camera.
Definition viz.hpp:383
void display(Presentable &thePresentable)
Displays a presentable in this view.
Definition viz.hpp:346
void fit_all()
Fits all displayed content into view.
Definition viz.hpp:367
void set_standard_view(const StandardView theView)
Sets a standard camera orientation.
Definition viz.hpp:391
RAII wrapper for a viewer bound to a Driver.
Definition viz.hpp:202
C++ veneer for the core module.
void check(const ::occtl_status_t theStatus)
Throw on non-OK; otherwise a no-op.
Definition core.hpp:85
OCCT-Light: graph-native visualization module public API.
occtl_status_t occtl_viz_view_zoom(occtl_viz_view_t *view, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
#define OCCTL_VIZ_VIEW_OPTIONS_INIT
Definition occtl_viz.h:203
@ OCCTL_VIZ_SELECT_WIRE
Definition occtl_viz.h:125
@ OCCTL_VIZ_SELECT_PRODUCT
Definition occtl_viz.h:129
@ OCCTL_VIZ_SELECT_WHOLE
Definition occtl_viz.h:121
@ OCCTL_VIZ_SELECT_VERTEX
Definition occtl_viz.h:124
@ OCCTL_VIZ_SELECT_COEDGE
Definition occtl_viz.h:128
@ OCCTL_VIZ_SELECT_SHELL
Definition occtl_viz.h:126
@ OCCTL_VIZ_SELECT_COMPSOLID
Definition occtl_viz.h:131
@ OCCTL_VIZ_SELECT_SOLID
Definition occtl_viz.h:127
@ OCCTL_VIZ_SELECT_FACE
Definition occtl_viz.h:122
@ OCCTL_VIZ_SELECT_COMPOUND
Definition occtl_viz.h:130
@ OCCTL_VIZ_SELECT_EDGE
Definition occtl_viz.h:123
void occtl_viz_view_free(occtl_viz_view_t *view)
void occtl_viz_presentable_free(occtl_viz_presentable_t *presentable)
struct occtl_viz_viewer occtl_viz_viewer_t
Definition occtl_viz.h:68
occtl_status_t occtl_viz_presentable_clear_visible_nodes(occtl_viz_presentable_t *presentable)
occtl_status_t occtl_viz_view_display(occtl_viz_view_t *view, occtl_viz_presentable_t *presentable)
occtl_status_t occtl_viz_driver_create(const occtl_viz_driver_options_t *options, occtl_viz_driver_t **out_driver)
occtl_status_t occtl_viz_view_dump_image(occtl_viz_view_t *view, const char *path)
enum occtl_viz_selection_mode occtl_viz_selection_mode_t
enum occtl_viz_display_mode occtl_viz_display_mode_t
occtl_status_t occtl_viz_viewer_create(occtl_viz_driver_t *driver, occtl_viz_viewer_t **out_viewer)
occtl_status_t occtl_viz_view_set_camera(occtl_viz_view_t *view, const occtl_viz_camera_t *camera)
@ OCCTL_VIZ_VIEW_TOP
Definition occtl_viz.h:148
@ OCCTL_VIZ_VIEW_ISO
Definition occtl_viz.h:150
@ OCCTL_VIZ_VIEW_RIGHT
Definition occtl_viz.h:147
@ OCCTL_VIZ_VIEW_LEFT
Definition occtl_viz.h:146
@ OCCTL_VIZ_VIEW_BOTTOM
Definition occtl_viz.h:149
@ OCCTL_VIZ_VIEW_BACK
Definition occtl_viz.h:145
@ OCCTL_VIZ_VIEW_FRONT
Definition occtl_viz.h:144
occtl_status_t occtl_viz_presentable_create(occtl_viz_viewer_t *viewer, occtl_graph_t *graph, occtl_node_id_t root, occtl_viz_presentable_t **out_presentable)
occtl_status_t occtl_viz_view_set_background(occtl_viz_view_t *view, occtl_color_rgba_t color)
occtl_status_t occtl_viz_view_read_pixels_rgba(occtl_viz_view_t *view, uint8_t *out_rgba, size_t cap, size_t *out_count)
#define OCCTL_VIZ_DRIVER_OPTIONS_INIT
Definition occtl_viz.h:178
void occtl_viz_driver_free(occtl_viz_driver_t *driver)
occtl_status_t occtl_viz_view_create(occtl_viz_viewer_t *viewer, const occtl_viz_view_options_t *options, occtl_viz_view_t **out_view)
struct occtl_viz_presentable occtl_viz_presentable_t
Definition occtl_viz.h:94
occtl_status_t occtl_viz_view_get_camera(const occtl_viz_view_t *view, occtl_viz_camera_t *out_camera)
occtl_status_t occtl_viz_presentable_synchronize(occtl_viz_presentable_t *presentable, int32_t *out_has_changed)
occtl_status_t occtl_viz_view_activate_selection(occtl_viz_view_t *view, occtl_viz_presentable_t *presentable, occtl_viz_selection_mode_t mode)
occtl_status_t occtl_viz_view_pick(occtl_viz_view_t *view, int32_t x, int32_t y, int32_t select, occtl_viz_pick_result_t *out_pick)
occtl_status_t occtl_viz_view_set_standard_view(occtl_viz_view_t *view, occtl_viz_standard_view_t standard_view)
occtl_status_t occtl_viz_view_fit_all(occtl_viz_view_t *view)
occtl_status_t occtl_viz_presentable_set_display_mode(occtl_viz_presentable_t *presentable, occtl_viz_display_mode_t mode)
void occtl_viz_viewer_free(occtl_viz_viewer_t *viewer)
occtl_status_t occtl_viz_view_orbit_update(occtl_viz_view_t *view, int32_t x, int32_t y)
occtl_status_t occtl_viz_view_orbit_start(occtl_viz_view_t *view, int32_t x, int32_t y)
occtl_status_t occtl_viz_view_resize(occtl_viz_view_t *view, int32_t width, int32_t height)
enum occtl_viz_standard_view occtl_viz_standard_view_t
@ OCCTL_VIZ_DISPLAY_WIREFRAME
Definition occtl_viz.h:105
@ OCCTL_VIZ_DISPLAY_SHADED
Definition occtl_viz.h:106
@ OCCTL_VIZ_DISPLAY_MESH_DEBUG
Definition occtl_viz.h:108
@ OCCTL_VIZ_DISPLAY_SHADED_WITH_EDGES
Definition occtl_viz.h:107
occtl_status_t occtl_viz_view_redraw(occtl_viz_view_t *view)
struct occtl_viz_view occtl_viz_view_t
Definition occtl_viz.h:81
occtl_status_t occtl_viz_view_pan(occtl_viz_view_t *view, int32_t dx, int32_t dy)
occtl_status_t occtl_viz_presentable_invalidate(occtl_viz_presentable_t *presentable)
occtl_status_t occtl_viz_presentable_set_visible_nodes(occtl_viz_presentable_t *presentable, const occtl_node_id_t *nodes, size_t n_nodes)
struct occtl_viz_driver occtl_viz_driver_t
Definition occtl_viz.h:55
occtl_status_t occtl_viz_view_erase(occtl_viz_view_t *view, occtl_viz_presentable_t *presentable)
3D point value type. Mirrors occtl_point3_t with STL-flavoured access.
Definition geom.hpp:82
const occtl_point3_t & c_type() const noexcept
Borrows-it view of the underlying C value type, for direct ABI calls.
Definition geom.hpp:102
3D free-vector value type. Mirrors occtl_vector3_t.
Definition geom.hpp:184
const occtl_vector3_t & c_type() const noexcept
Borrows-it view of the underlying C value type.
Definition geom.hpp:204
Camera placement (eye, target, up) for a viz view.
Definition viz.hpp:114
static Camera from_c(const ::occtl_viz_camera_t &theC) noexcept
Constructs from the C value type received from the ABI.
Definition viz.hpp:130
::occtl_viz_camera_t to_c() const noexcept
Converts to the C value type for passing to the ABI.
Definition viz.hpp:120
Vector3 up
Camera up vector.
Definition viz.hpp:117
Point3 center
Camera target point.
Definition viz.hpp:116
Point3 eye
Camera eye point.
Definition viz.hpp:115
Options for creating a visualization driver.
Definition viz.hpp:80
bool enable_vsync
Request vertical sync.
Definition viz.hpp:82
bool enable_vbo
Enable VBOs before view creation.
Definition viz.hpp:81
Graph identity returned by View::pick().
Definition viz.hpp:138
RefId ref
Picked reference, or invalid when none.
Definition viz.hpp:141
Transform usage_transform
Accumulated usage transform.
Definition viz.hpp:143
UID uid
Persistent identity of the picked node.
Definition viz.hpp:139
NodeId node
Session-local picked node ID.
Definition viz.hpp:140
static PickResult from_c(const ::occtl_viz_pick_result_t &theC) noexcept
Constructs from the C value type received from the ABI.
Definition viz.hpp:146
SelectionMode selection_mode
Selection mode that produced the owner.
Definition viz.hpp:142
Options for creating a native or offscreen view.
Definition viz.hpp:95
void * native_handle
Borrowed native window/view handle; nullptr for offscreen.
Definition viz.hpp:98
bool offscreen
Create an offscreen-capable view when true.
Definition viz.hpp:99
int width
View width in pixels.
Definition viz.hpp:96
int height
View height in pixels.
Definition viz.hpp:97
Definition occtl_viz.h:213
occtl_vector3_t up
Definition occtl_viz.h:216
occtl_point3_t eye
Definition occtl_viz.h:214
occtl_point3_t center
Definition occtl_viz.h:215
Definition occtl_viz.h:168
int32_t enable_vbo
Definition occtl_viz.h:171
int32_t enable_vsync
Definition occtl_viz.h:172
Definition occtl_viz.h:229
Definition occtl_viz.h:191
void * native_handle
Definition occtl_viz.h:196
int32_t height
Definition occtl_viz.h:195
int32_t offscreen
Definition occtl_viz.h:197
int32_t width
Definition occtl_viz.h:194
C++ veneer for the topo module.
DisplayMode
Display mode for graph presentables.
Definition viz.hpp:43
SelectionMode
Graph-native selection mode for picking.
Definition viz.hpp:52
StandardView
Standard camera orientation presets.
Definition viz.hpp:68