{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Rectangularevent","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":"rectangularevent","__idx":0},"children":["Rectangularevent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This type of event is generated when a user performs a rectangular selection on a 2D layer such as a seismic, cross-plot or map layer."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example illustrates how to handle such an event for a seismic layer."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Event registration can be done as follows, where this is the class that implements ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IEventSubscriber<RectangularEvent>"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    EventBroadcaster.getInstance().subscribe(RectangularEvent.class, this);\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An example implementation of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IEventSubscriber<RectangularEvent>"]}," method onEvent for dealing with rectangular selection on seismic data:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    public void onEvent(RectangularEvent event) {\n        if (event.getSource() instanceof ISeismicLayer) {\n            ISeismicLayer seismicLayer = (ISeismicLayer) event.getSource();\n            ISeismicData data = (ISeismicData) seismicLayer.getData();\n            // convert selection rectangle to model units\n            Point2D modelP1 = seismicLayer.deviceToModel(new Point((int) event.getMinX(), (int) event.getMinY()));\n            Point2D modelP2 = seismicLayer.deviceToModel(new Point((int) event.getMaxX(), (int) event.getMaxY()));\n            double startTime = Math.min(modelP1.getY(), modelP2.getY());\n            double endTime = Math.max(modelP1.getY(), modelP2.getY());\n            // convert to trace index\n            int startTraceIndex = seismicLayer.modelToTraceIndex(Math.min(modelP1.getX(), modelP2.getX()));\n            int endTraceIndex = seismicLayer.modelToTraceIndex(Math.max(modelP1.getX(), modelP2.getX()));\n            // check if selection fell in a gap\n            if (startTraceIndex != -1 && endTraceIndex != -1) {\n                ISeismicReader reader = seismicLayer.getReader();\n                ITrace startTrace = reader.getTrace(startTraceIndex);\n                ITrace endTrace = reader.getTrace(endTraceIndex);\n                // from here you can read the traces, extract header information, etc.\n                ...\n            } else {\n                // error handling\n                DialogManager.getDefault().showMessageDialog(\"Cannot start or end selection in a gap\",\n                        \"Selection Warning\", DialogManager.WARNING);\n            }\n        }\n    }\n"},"children":[]}]},"headings":[{"value":"Rectangularevent","id":"rectangularevent","depth":1}],"frontmatter":{"title":"Rectangularevent","pageId":"events/rectangularevent","seo":{"title":"Rectangularevent"}},"lastModified":"2026-10-22T14:32:05.573Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/events/rectangularevent","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}