ProductSceneView Listener


how I should treat or add listeners to ProductSceneView component ? I am trying to add a mouse listener in order to get a right click event with no success. Besides, which class is responsible to delimit a given area in a product image in a selection provided by user ?

Thanks in advance.


If you want to add something to the context menu, you should add an ActionReference annotation to your action. This is done in the class ExportImageAction for example.
If you want to directly add the MouseListener you can try it on the LayerCanvas. ProductSceneView.getLayerCanvas()´

I think I don’t understand your second question. There is no real area selection. You can define masks, you can draw geometries and you can define subsets but there is no way to mark a region as selected.
Can you tell a bit more?


Thanks for your response.

I am talking about a Rectangular Area drawing - a selection rectangle. As far as I know, I think it is RegionSelectableWorldMapPane, but I do not know how to use this class in order to capture all the related events in order to apply to any process (or filter) only for this selected region in my ProductSceneView.

Thanks in advance.


The RegionSelectableWorldMapPane is used for example in the Mosaic processor. I don’t think that this is what you want.
Is your code available somewhere? Without knowing what you are doing it is difficult to give hints.

In general we use subsets of products to process only a region. But there are also the so called masks. If you draw a rectangle you get also a corresponding rectangle in you processing you can consider this mask and process only those pixels beneath the mask.

Maybe you want to have a look at the interactors api too.


Thank you for your response.
As far as I know, ProductSceneView have a DrawRectangleToolAction related to FigureEditor inside LayerCanvas. So, what should I do in order to see the lines of the rectangle drawn by user when trying to delimit an area to generate masks ?

Thanks in advance.


DrawRectangleToolAction and InsertRectangleFigureInteractor are doing all this already.

After selecting the rectangle tool and drawing the rectangle you get a geometry and a mask.

If you want to do something special you can implement you own ToolAction and ViewportInteractor
You can have a look at the other implementations at interactors package.
If implemented the tool shows up in the menu and can be used by the user.


Thank you for your response.
Could you please give me more details about this?
How could I get all the parameters needed in order to extract the selected subregion in a precise manner ?

I am trying to do this:

//currentView is my ProductSceneView, but getFigureSelection is not returning anything
FigureSelection figuresSelection = currentView.getFigureEditor().getFigureSelection();
if (figuresSelection != null) {
Product product = sceneView.getProduct();
if (product.isMultiSize()) {
final Product resampledProduct = MultiSizeIssue.maybeResample(product);
if (resampledProduct != null) {
product = resampledProduct;
} else {

I am using SelectionInteractor and SelectionInteractorInterceptor.
Thanks in advance.


I’ve created an example which creates a subset and based on the current geometry selection and writes it to a file.

Instead of writing to a file you can also do what is done in ExportMaskPixelsActionexportMaskPixels(Product).

Hope this makes it easier for you ta get further with your development.