{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Creating Layer2d","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":false}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"creating-layer2d","__idx":0},"children":["Creating Layer2d"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"creating-your-own-2d-layer","__idx":1},"children":["Creating your own 2D Layer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This tutorial will teach you how to write your own implementation of a 2D layer."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-your-module-template-in-netbeans","__idx":2},"children":["Create your module template in NetBeans"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["File -> New Project"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the New Project wizard select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["NetBeans Modules"]}," from the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Categories"]}," list and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module"]}," from the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," list and click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next >"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Project Name"]},", specify ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["MyHorizonLayer"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select option ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Standalone Module"]}," and make sure to specify the INTViewer platform in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["NetBeans Platform"]}," field."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next >"]}," and specify ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["com.mycompany.myviewer.myhorizonlayer"]}," for the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Code Name Base"]}," and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["MyHorizonLayerModule"]}," for the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module Display Name"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Generate XML Layer"]}," checkbox (if this option is not present, check the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/intviewer-platform-and-modules/registering-the-layer-xml-file"},"children":["Registering the layer.xml file"]}," article)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click on ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Finish."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree view, you should see your project which includes a number of files that have been created for you."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configuring-your-module","__idx":3},"children":["Configuring your Module"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree, right click on the module ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MyHorizonLayerModule"]}," and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Properties"]}," from the list."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Under ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Categories"]},", select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Libraries"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Java plaform"]}," ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["JDK1.7"]}," or your current version."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click on the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Add"]}," button next to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module Dependencies"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the list, select ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["AllDeps, IntviewerCore, JCarnacProWrapper, Lookup, Utilities API, Viewer2D"]}," and click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OK"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OK"]}," in Project Properties Dialog"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-your-horizonlayer-class","__idx":4},"children":["Create your HorizonLayer class"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree, right click on the module ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MyHorizonLayerModule"]}," and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["New -> Java Class..."]}," from the list."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enter ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["HorizonLayer"]}," as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Class Name"]}," and select ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["com.mycompany.myviewer.myhorizonlayer"]}," as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Package"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Finish"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the class editor, indicate that this HorizonLayer class extends AbstractLayer2D."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Right-click in the class editor and select \"Fix Imports\". This will automatically import the abstract class AbstractLayer2D."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On the line with the class definition, click on the little light bulb with the red exclamation mark."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click on \"Implement all abstract methods\" to make skeletons for all the methods."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Comment out all the \"throw new UnsupportedOperationException...\" to make them dummy methods."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For methods that require a return value, simply return \"null\" for right now."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add a constructor to override the AbstractLayer2D constructor."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Be sure to ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["fix imports"]}," to import ILayeredWindow."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-new-horizon-layer-action","__idx":5},"children":["Create a New Horizon Layer action"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now we will create a user action that triggers the creation of a new horizon."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree, right click on the module ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MyHorizonLayerModule"]}," and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["New -> Action..."]}," from the list."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure the radio button \"",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Always Enabled"]},"\" is clicked, and click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next >"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the GUI registration, make sure it is in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["File"]}," category."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Then change the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Menu"]}," selection to \"",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["File"]},"\" and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Position"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<separator> - HERE"]},". Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next >"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In practice, this screen is how you specify where and what will trigger your action."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the class name write \"",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["NewHorizonLayerAction"]},",\" and the display name put \"",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["New Horizon Layer."]},"\" Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Finish"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you run the program now you will see the action is successfully wired up but does not actually do anything when clicked on."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now we will code up an action to create a horizon layer. Since horizon layers only make sense in relation to a seismic layer, we need to know which seismic layer has been selected, if at all. To do this, we will need to use a class called ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["GlobalSelection"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Edit ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["NewHorizonLayerAction.java"]}," to contain the following code. You may have to ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Fix Imports"]}," or add the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Seismic2D"]}," library through the Module Properties like before."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now click on the green arrow to run the program. Click on Open Data in New XSection Window and then Seismic."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Choose a data file to open and click OK on the properties box."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now when you click on \"Add Horizon\" in the file menu, the new horizon layer will show up in the Layers screen."]}]}]}]},"headings":[{"value":"Creating Layer2d","id":"creating-layer2d","depth":1},{"value":"Creating your own 2D Layer","id":"creating-your-own-2d-layer","depth":2},{"value":"Create your module template in NetBeans","id":"create-your-module-template-in-netbeans","depth":3},{"value":"Configuring your Module","id":"configuring-your-module","depth":3},{"value":"Create your HorizonLayer class","id":"create-your-horizonlayer-class","depth":3},{"value":"Create a New Horizon Layer action","id":"create-a-new-horizon-layer-action","depth":3}],"frontmatter":{"title":"Creating Layer2d","pageId":"intviewer-api-for-layers/creating-layer2d","seo":{"title":"Creating Layer2d"}},"lastModified":"2026-10-22T14:32:05.573Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/intviewer-api-for-layers/creating-layer2d","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}