.. _highlight-example:

#################################
Geometry: Highlight Clicked Parts 
#################################

A highlighted part is shown with a white halo. This is useful for indicating for instance 
selection. The highlighting mechanism applies to all types of parts:

-   Data parts
-   Isosurfaces
-   Isovolumes
-   Cutting planes
-   Geometry parts (using halo effect)

.. image:: ../images/tut_highlight.png
    :height: 300 
    :align: center

This example shows how highlight parts as a response to a mouse press event.

**Pick event**

Send a notification when a pick has occurred. 

Attach to the mouse pressed event in the viewer. Create a :class:`cee::Ray` object from the mouse
event coordinates and emit a picked signal using this ray.

.. literalinclude:: ../../../../EnvisionDesktop/Tutorials/QtTutorialRunner/TutorialRunnerViewer.cpp
    :language: cpp
    :lines: 62-80
    

**Create the model and connection**

Create a geometry model with four boxes. 

.. literalinclude:: ../../../../EnvisionDesktop/Tutorials/HighLighting.cpp
    :language: cpp
    :lines: 37-60


**Respond to a picking event sent from the viewer**

Highlight the last hit box

.. literalinclude:: ../../../../EnvisionDesktop/Tutorials/HighLighting.cpp
    :language: cpp
    :lines: 65-98
