{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Layeredwindowevent","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":"layeredwindowevent","__idx":0},"children":["Layeredwindowevent"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"viewerwindowevent","__idx":1},"children":["ViewerWindowEvent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This type of event is generated when a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["layer"]}," is created, deleted, selected or moved."]},{"$$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<ViewerWindowEvent>"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    EventBroadcaster.getInstance().subscribe(ViewerWindowEvent.class, this);\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the example below, we want to be notified if a certain layer is deleted. We do this in method onEvent which implements the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IEventSubscriber<ViewerWindowEvent>"]}," interface:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    private IVisual myLayer; // the layer we want to keep track of\n    public void onEvent(ViewerWindowEvent event) {\n        if (event.getEventType().equals(ViewerWindowEvent.VISUALS_REMOVED_EVENT_TYPE)) {\n            IVisual[] layers = event.getVisuals();\n            for (IVisual layer: layers) {\n                if (layer == myLayer) {\n                   // do some cleanup\n                   EventBroadcaster.getInstance().unsubscribe(ViewerWindowEvent.class, this);\n                   myLayer = null;\n                   ....\n                }\n            }\n        }\n    }\n"},"children":[]}]},"headings":[{"value":"Layeredwindowevent","id":"layeredwindowevent","depth":1},{"value":"ViewerWindowEvent","id":"viewerwindowevent","depth":2}],"frontmatter":{"title":"Layeredwindowevent","pageId":"events/layeredwindowevent","seo":{"title":"Layeredwindowevent"}},"lastModified":"2026-10-22T14:32:05.573Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/events/layeredwindowevent","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}