{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab"]},"type":"markdown"},"seo":{"title":"Custom FlippedComponentNode","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":"custom-flippedcomponentnode","__idx":0},"children":["Custom FlippedComponentNode"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This tutorial shows how to create a custom component node implementation derived from the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/doc/classes/geotoolkit.schematics.scene.flippedcomponentnode.flippedcomponentnode.html"},"children":["FlippedComponentNode"]}]}," class."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note that schematics elements derived from the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/doc/classes/geotoolkit.schematics.scene.flippedcomponentnode.flippedcomponentnode.html"},"children":["FlippedComponentNode"]}]}," class accept data specified as follows:"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"options","__idx":1},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/Schematics/CustomFlippedComponentNode/customFlippedComponentNode#Options"},"children":["#"]}," Options"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Optional parameters are:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["description"]}," - used for labeling (if not set then the registered component name is used as the default value)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["offset"]}," - used to move an element across a wellbore axis (if not set then \"0\" is used as the default value)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["General information on how to register your custom component, add a component's data to a wellbore, and visualize it is represented in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/Schematics/GeneralInformation/customNodes"},"children":["General Information"]}," tutorial."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"perforation-schematic-element-implementation","__idx":2},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/Schematics/CustomFlippedComponentNode/customFlippedComponentNode#perforation"},"children":["#"]}," 'Perforation' schematic element implementation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An example of a \"perforation\" schematic element is shown below:"]},{"$$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 { ComponentNodeFactoryRegistry } from \"@int/geotoolkit/schematics/factory/ComponentNodeFactoryRegistry.ts\";\nimport { MyFlippedComponentNode } from \"/src/code/Schematics/CustomFlippedComponentNode/myFlippedComponentNode.ts\";\nimport { WellBoreData } from \"@int/geotoolkit/schematics/data/WellBoreData.ts\";\nimport { WellBoreNode } from \"@int/geotoolkit/schematics/scene/WellBoreNode.ts\";\nimport { Rect } from \"@int/geotoolkit/util/Rect.ts\";\nimport { Plot } from \"@int/geotoolkit/plot/Plot.ts\";\nimport { Events } from \"@int/geotoolkit/scene/Node.ts\";\nconst createScene = (canvas) => {\n  const componentName = \"MyFlippedComponent\";\n  const factoryRegistry = new ComponentNodeFactoryRegistry();\n  factoryRegistry.setFactory(componentName, () => new MyFlippedComponentNode());\n  const wellBoreData = new WellBoreData();\n  const options = {\n    \"description\": componentName,\n    \"geometry\": {\n      \"depth\": { \"from\": 50, \"to\": 100 },\n      \"diameter\": { \"outer\": 50, \"inner\": 25 },\n      \"offset\": 0\n    }\n  };\n  wellBoreData.addComponent(componentName, options);\n  const wellBoreShape = new WellBoreNode({\n    \"data\": wellBoreData,\n    \"registry\": factoryRegistry\n  });\n  const plotMinY = 0, plotMaxY = 250, plotMinX = 0, plotMaxX = 250;\n  const plotSizeX = plotMaxX - plotMinX;\n  const plotSizeY = plotMaxY - plotMinY;\n  const wellBoreShapeBounds = new Rect(\n    plotMinX + plotSizeX / 4,\n    plotMinY,\n    plotMaxX - plotSizeX / 4,\n    plotMaxY\n  );\n  wellBoreShape.setBounds(wellBoreShapeBounds);\n  const plot = new Plot({\n    \"canvaselement\": canvas,\n    \"root\": wellBoreShape\n  });\n  wellBoreShape.on(Events.Invalidate, () => plot.update);\n  return plot.setSize(plotSizeX, plotSizeY);\n};\nexport { createScene };\n\ncreateScene(document.querySelector('[ref=\"plot\"]'));\n\n","lang":"ts"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"css","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"css","header":{"controls":{"copy":{}}},"source":"\n.cg-tooltip-holder {\n  position: relative;\n}\n\n.cg-tooltip {\n  position: absolute;\n  display: block;\n  padding: 2px 12px 3px 7px;\n  overflow: visible !important;\n  font-family: Roboto, Helvetica, Arial, sans-serif;\n  font-size: 13px;\n  background: white !important;\n  opacity: 0.9;\n  color: #333333;\n  border: solid 1px gray;\n  border-radius: 5px;\n  text-align: left;\n  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);\n  border-radius: 5px;\n  margin: 0 !important;\n  z-index: 10000;\n  max-width: 400px;\n  text-wrap: normal !important;\n  white-space: normal !important;\n}\n/* Default setting for tooltip */\n.cg-tooltip-container {\n  position: absolute;\n  display: block;\n  overflow: visible !important;\n  font-family: Roboto, Helvetica, Arial, sans-serif;\n  font-size: 12px;\n  padding: 3px 7px;\n  background: #f7f7f7;\n  color: #333333;\n  border: 1px solid #938e8e;\n  opacity: 0.8;\n  text-align: left;\n  box-shadow: 3px 3px 10px #888;\n  margin: 0 !important;\n  z-index: 10000;\n  max-width: 400px;\n  text-wrap: normal !important;\n  white-space: normal !important;\n  user-select: none;\n}\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n  .cg-tooltip-container {\n    border-radius: 0;\n  }\n}\n/* Default left arrow for tooltip */\n.cg-tooltip-arrow-left::before {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  left: 0;\n  top: 50%;\n  border: 5px solid transparent;\n  border-left: 0;\n  border-right: 5px solid  #938e8e;\n  transform: translate(calc(-100%), -50%);\n}\n.cg-tooltip-arrow-left::after {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  left: 0;\n  top: 50%;\n  border: 4px solid transparent;\n  border-left: 0;\n  border-right: 4px solid #f7f7f7;\n  transform: translate(calc(-100%), -50%);\n}\n/* Default top arrow for tooltip */\n.cg-tooltip-arrow-top::before {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  left: 50%;\n  top: 0;\n  border: 5px solid transparent;\n  border-top: 0;\n  border-bottom: 5px solid #938e8e;\n  transform: translate(-50%, -100%);\n}\n.cg-tooltip-arrow-top::after {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  left: 50%;\n  top: 0;\n  border: 4px solid transparent;\n  border-top: 0;\n  border-bottom: 4px solid #f7f7f7;\n  transform: translate(-50%, -100%);\n}\n/* Default right arrow for tooltip */\n.cg-tooltip-arrow-right::before {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  right: 0;\n  top: 50%;\n  border: 5px solid transparent;\n  border-right: 0;\n  border-left: 5px solid #938e8e;\n  transform: translate(100%, -50%);\n}\n.cg-tooltip-arrow-right::after {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  right: 0;\n  top: 50%;\n  border: 4px solid transparent;\n  border-right: 0;\n  border-left: 4px solid #f7f7f7;\n  transform: translate(100%, -50%);\n}\n/* Default bottom arrow for tooltip */\n.cg-tooltip-arrow-bottom::before {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  left: 50%;\n  bottom: 0px;\n  border: 5px solid transparent;\n  border-bottom: 0;\n  border-top: 5px solid #938e8e;\n  transform: translate(-50%, 100%);\n  z-index: 10000;\n}\n.cg-tooltip-arrow-bottom::after {\n  content: '';\n  position: absolute;\n  display: block;\n  width: 0px;\n  left: 50%;\n  bottom: 0;\n  border: 4px solid transparent;\n  border-bottom: 0;\n  border-top: 4px solid #f7f7f7;\n  transform: translate(-50%, 100%);\n  z-index: 10000;\n}\n/* Tooltip item name */\n/* Tooltip item value */\n/* .cg-tooltip-item-value */\n/* Tooltip item value */\n.cg-tooltip-item-unit {\n  text-transform: none;\n}\n\n.cg-tooltip-item-name {\n    text-transform: capitalize;\n    white-space: nowrap;\n    vertical-align: middle;\n    font-size: 13px;\n}\n.cg-tooltip-row {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  white-space: pre-wrap;\n  font-size: 12px;\n  line-height: 100%;\n  margin: 1px 0;\n}\n.cg-tooltip-title {\n  font-size: 13px;\n  height: 14px;\n  text-transform: capitalize;\n}\n.cg-tooltip-title .cg-tooltip-symbol {\n  margin-right: 0 !important;\n}\n.cg-tooltip-title-name {\n  vertical-align: middle;\n}\n.cg-tooltip-row + .cg-tooltip-row {\n  margin-top: 4px;\n}\n.cg-tooltip-row.cg-tooltip-title + .cg-tooltip-row {\n  margin-top: 5px;\n}\n.cg-tooltip-item-value + .cg-tooltip-item-unit {\n    margin-left: 1px;\n}\n/* Tooltip symbol */\n.cg-tooltip-symbol-cell {\n  display: inline-flex;\n  min-width: 13px; /* 10px size + 3px margin */\n}\n.cg-tooltip-symbol {\n  margin-right: 3px;\n  background-color: transparent;\n  display: block;\n}\n.cg-tooltip-symbol > img {\n  display: block;\n}\n.cg-tooltip-list-cell {\n  display: inline-flex;\n}\n.cg-tooltip-list-symbol {\n  display: block;\n  margin-right: 3px;\n  width: 6px;\n  height: 6px;\n  vertical-align: middle;\n  border-radius: 50%;\n  border: 1px solid rgba(0,0,0,.4);\n}\n.cg-tooltip-symbol-legacy {\n  border-radius: 4px;\n  margin-right: 5px;\n  height: 8px;\n  width: 8px;\n  display: inline-block;\n}\n.cg-tooltip-title-legacy {\n  font-weight: 900;\n}\n\n/* Tooltip symbol circle */\n.cg-tooltip-symbol.circle {\n  height: 10px;\n  width: 10px;\n  display: inline-block;\n  border-radius: 50%;\n  border: 1px solid rgba(0,0,0,.4);\n}\n/* Tooltip symbol line */\n.cg-tooltip-symbol.line {\n    height: 10px;\n    width: 10px;\n    display: inline-block;\n    transform: scale(1.2, 0.2);\n}\n/* Tooltip symbol diamond */\n.cg-tooltip-symbol.diamond {\n    height: 10px;\n    width: 10px;\n    display: inline-block;\n    transform: rotate(45deg);\n    border-radius: 0px;\n}\n/* Tooltip symbol square */\n.cg-tooltip-symbol.square {\n    height: 10px;\n    width: 10px;\n    display: inline-block;\n    border-radius: 0px;\n    border: 1px solid rgba(0,0,0,.4);\n}\n\n","lang":"css"},"children":[]}]}]},{"$$mdtype":"Tag","name":"iframe","attributes":{"src":"https://dc2-documentation.s3.amazonaws.com/documentation/slb-docs-test/5.0/examples/vue/tutorials/index.html#/Schematics/CustomFlippedComponentNode/customFlippedComponentNode?section=perforation&extract=true","width":"100%","height":"338.5px","style":{"border":"none"}},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Compared to just ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/doc/classes/geotoolkit.schematics.scene.componentnode.componentnode.html"},"children":["ComponentNode"]}]},", ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/doc/classes/geotoolkit.schematics.scene.flippedcomponentnode.flippedcomponentnode.html"},"children":["FlippedComponentNode"]}]}," lets the user implement a custom component node more efficiently because ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["only the \"positive half\" of a node's geometry class has to be created; it is reused to render the \"negative half\" of the shape internally (as well as ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["all"]}," other nodes of the particular type in well bore data)."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note that unlike straight-forward ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/doc/classes/geotoolkit.schematics.scene.componentnode.componentnode.html"},"children":["ComponentNode"]}]}," -based implementation, a re-usable (template) shape's geometry is defined in its own coordinate system – the key is just to report its ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getTemplateBounds()"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getTemplateNode()"]}," to SchematicsJS – and the library internally translates the template shape to a proper component geometry:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"gets-template-bounds","__idx":3},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/Schematics/CustomFlippedComponentNode/customFlippedComponentNode#GetTemplateBounds"},"children":["#"]}," Gets template bounds"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["So, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getTemplateBounds()"]}," is:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"gets-template-node","__idx":4},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#/Schematics/CustomFlippedComponentNode/customFlippedComponentNode#GetTemplateNode"},"children":["#"]}," Gets template node"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["So, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["getTemplateNode()"]}," is:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[]}]},"headings":[{"value":"Custom FlippedComponentNode","id":"custom-flippedcomponentnode","depth":1},{"value":"Options","id":"options","depth":3},{"value":"'Perforation' schematic element implementation","id":"perforation-schematic-element-implementation","depth":3},{"value":"Gets template bounds","id":"gets-template-bounds","depth":3},{"value":"Gets template node","id":"gets-template-node","depth":3}],"frontmatter":{"title":"Custom FlippedComponentNode","seo":{"title":"Custom FlippedComponentNode"}},"lastModified":"2026-02-11T19:54:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/geotoolkit/tutorials/schematics/custom-nodes/custom-flipped-component-node","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}