{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab"]},"type":"markdown"},"seo":{"title":"Picking","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":true,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"picking","__idx":0},"children":["Picking"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"introduction","__idx":1},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/pages/carnac/overview/picking#intro"},"children":["#"]}," Introduction"]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/picking.e14bc4db298c9705351d683011aaaff66507d618a07c966fb4fc36dc605d3aa8.e2926594.png"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Picking is based on the rendering procedure. This structuring avoids duplication in the source code. The figure above shows the selection, which contains a mechanism that picks nodes in the scene graph using spatial properties. During selection, a special implementation of a visitor can visit nodes and emulate rendering with specific implementations of context and graphics. The selected nodes will be put in a list. In addition, the context can give information about the type of rendering."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"usage","__idx":2},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/pages/carnac/overview/picking#usage"},"children":["#"]}," Usage"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The code below shows a typical usage of the point selection API."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"main","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ts","header":{"controls":{"copy":{}}},"source":"import {Selector} from '@int/geotoolkit/selection/Selector'\n\nconst selection =  new Selector();\nconst nodes = selection.select(plot.getRoot(), posx, posy, 2, 2);\nif (nodes && nodes.length > 0) {\n    const text = 'Selected nodes:';\n    for (let i = 0; i < nodes.length; ++i) {\n        text = text + nodes[i];\n    }\n    alert(text);\n}\n","lang":"ts"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This code creates a selector and calls the method ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["select"]}," and provides a root node to start picking at the specified position and spot area. It returns an array of nodes in direct Z order. For example, if there is a track and a curve in the container display then an array contains two elements {track, curve}."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"architecture","__idx":3},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/pages/carnac/overview/picking#architecture"},"children":["#"]}," Architecture"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The class diagram below shows selection architecture."]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/selector.ee12cb6ec472d8bc03fc8dd5c4250bd4ade8fbff729058412b9a106ee670f744.e2926594.png"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A user calls the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["select"]}," method on the selector. The selector creates an instance of PointSelectionContext, an implementation of RenderingContext, and passes the new context to the root node. If the geometry of a node intersects a specified spot area then that node is added to a collection of the selected nodes. PointSelectionContext emulates the rendering procedures to check for geometry intersections or containment. The same logic works in a retained mode with RenderingState. A PointSelectionContext provides its own implementation of RenderingState, which checks geometry with context."]}]},"headings":[{"value":"Picking","id":"picking","depth":1},{"value":"Introduction","id":"introduction","depth":3},{"value":"Usage","id":"usage","depth":3},{"value":"Architecture","id":"architecture","depth":3}],"frontmatter":{"title":"Picking","seo":{"title":"Picking"}},"lastModified":"2026-02-11T19:54:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/geotoolkit/programmers-guide/architecture-overview/carnac/picking","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}