This tutorial shows how to create custom component node (shape) class, plug it in components' registry and display it in wellbore shape.
# Customization
To plug in WellBoreNode component node container, custom component node must inherit ComponentNode class:
# Create node factory
At the same time trivial implementation of AbstractComponentNodeFactory should be provided that returns the node's class instance in createComponentNode method call:
# Registry node factory
Then the factory implemented has to be registered in ComponentNodeFactoryRegistry object to be used in WellBoreNode object of interest.
Note: the name used as the component node's name in the call setFactory above (here: "MySimpleComponent") is the name to use in WellBoreData's addComponent call.
It is to be noted that while inheritance on ComponentNode class is a must for user-defined component node, SchematicsJS has three extra options for user convenience to use instead.
The options are as follows:
- ReusableComponentNode (inherited from ComponentNode) - see "Custom ComponentNode" tutorial for more info)
- RegularComponentNode (inherited from ReusableComponentNode) - see "Custom RegularComponentNode" tutorial for more info
- FlippedComponentNode (inherited from ReusableComponentNode) - see "Custom FlippedComponentNode" tutorial for more info
Which class out of those three to choose as a base one, user decides depending on:
- How complex custom element is going to be;
- Is the element specially symmetrical;
- How critical performance/memory consumption requirements are.