Making a selection in a custom layer


The custom layer is managing the items and properties needed in order to draw the layer, and implementing the layer actual drawing. When a selection is made on the layer, the selected items or properties are identified and being rendered with dedicated selection symbols.
The custom layer needs to supply a method that lets the application (or a tool) set the selection geometry that specifies the selection area. This geometry should be stored and used in the layer’s draw methods.
When the custom layer draws, it needs to loop through its items and determine whether it is inside or outside of the selected area. Each item that is inside the selected area, is identified as a selected item, and will be marked as selected in the layer’s internal table. Each item that is outside of the selected area will be rendered using the layer’s symbols. After all of the non-selected items are rendered, the layer will render the selected items, on top of the non-selected items, using the specific selected symbols.