Skip to content

Move TileRendererFactory code into TileRender and make it all static #19

@pauldendulk

Description

@pauldendulk

A proposal for some refactoring.

The TileRendererFactory does not implement the factory pattern. I asked ChatGPT what it thinks it does and it said:

Image
That is exactly what I would think, but instead it is a collection of static render methods, So TileRenderer would be a more appropriate name.

The current TileRenderer class does very little apart from initializing the VectorStyle (which is not rendering) and wrapping the render calls. It also disposes the connection, but this is something it should not do because you are not supposed to dispose injected objects.

I propose to make the TileRenderer static. Initialization of the VectorStyle should be done on the outside and it should be passed as argument to the render calls. All the static methods from the TileRendererFactory should be moved into the TileRenderer.

Another way to approach it is to delete the TileRenderer and rename the TileRendererFactory to TileRenderer. The caller of TileRenderer will need to do a bit more work.

Btw, for me it was a bit confusing that a VectorStyle contains data (the VectorTileSource is assigned), this is not something to expect. It would be less confusing if the VectorTileSource would contain a style, but perhaps they should be completely separated. Or perhaps a class which holds them both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions