I have a sort of tree structure that represent a hierarchy of layers in a map, divided by types of layers and categories. Each node can be a different class for different types of layers (but all nodes implement a common interface).
I need to convert that class to an ASP.NET TreeView control. Each node in the input tree is a node in the output tree, with properties set that are dependant on the type of the node. I don't want the input tree classes to know the UI classes, so I can't write a "ToTreeViewNode()" method in them. There are currently 4 types of concrete node classes, 2 of them are composite (contain child-nodes) and 2 of them are leaves. This might change in the future.
It feels like there is a design pattern here itching to be used, can you help me find what it is?