Scene Raster Transformer

The SceneRasterTransformer shall provide access to a scenerastertransform that transforms from one rasterdatanode's (model) crs onto a scene (model) crs.

The SceneRasterTransformer will make use of some of the methods that are used by SceneRasterTransformUtils now. It will not consist of static methods.
The SceneRasterTransformer is retrieved per RasterDataNode. (RasterDataNode.getSceneRasterTransformer()).
Methods:
transformToSceneCoords(PixelPos)
transformToImageCoords(PixelPos)
transformToSceneCoords(Shape)
transformToImageCoords(Shape)
canTransformToSceneCoords()
canTrnsformToImageCoords()

The SceneRasterTransformer encapsulates the scenerastertransform, so that it is not passed to the outside for the actual conduct of a transformation. However, currently the SceneRasterTransform is still needed (as is SceneRasterTransformUtils), as there are parts where a transformation needs to be made, but no RasterDataNode is present (e.g., VectorDataLayer). -> Use the Transformer instead?
Parts where the Transformer is needed can be found in the code looking for todos with the tag [Multisize_products] or for occurences of scenerastertransform.

The Transformer shall also hold methods which state whether a transformation can be made or not.

Major Update

We will not use a class named SceneRasterTransformer. Instead, we will make more use of the Geotools-Framework. The methods mentioned above will not be used. Instead, there will only be

Mathtransform.transform(Point2D, Point2D) 

and

JTS.transform(Geometry, MathTransform)

The math transforms here will be the transforms previously known as forward and inverse.

We will not use the classes SceneRasterTransform or SceneRasterTransformUtils anymore. Instead, there will be an interface SceneTransform which is implemented by RasterDataNode. It has these methods:

getSceneToModelTransform(): MathTransform2D

getModelToSceneTransform(): MathTransform2D

where the first corresponds to what used to be inverse and the second to what used to be forward. Both can be null. RasterDataNode will provide a default implementation (the identity transform). Both can be explicitly set, but the setters are not part of the interface. The interface can be passed to places where it is not desired to have a rasterdatanode (such as a figure).

The transforms will be between the model crs of a rasterdatanode and the product's scene crs. To convert to the image, a RasterDataNode may have methods

getSceneToImageTransform(): MathTransform2D

and

getImageToSceneTransform(): MathTransform2d

which encapsulate the ModelToImageTransform/ImageToModelTransform . 

 

Question:

Shall the Transforms be changed when there is a change of the geocoding (see Product.findSceneRasterTransform)?

-> Compare this to the explicit setting of imageToModelTransforms which can become invalid after a geo-coding change. In general, it is the software engineer's duty to set all transforms right. The method findSceneRasterTransform can be well used to set the transform after a geo-coding change.

How to deal with different levels in a MultiLevelModel?

-> No level-specific transformation method or class is needed, as the level is important during the transformation from model to image coordinates and vice versa. Methods getSceneToImageTransform and getImageToSceneTransform should state in their description that they refer to level 0. Convenience methods that refer to certain levels of the scene model are possible, but we have not yet identified any use for them.