A fundamental client problem with the CGAL arrangement_2 class: how do you recover handles to the edges you insert? Note that the insertion APIs do not return halfedge handles unless you use very specialized (read: limited) functions.
I have found basically two strategies:
If you can afford to iterate across every single half-edge in the arrangement, use Arr_consolidated_curve_data_traits_2 to tag your input curves with an index number back to the original source data.
After the insert (and you can use any kind of bulk insert you want), simply iterate across all edges (remember, a single curve is shared between two halfedges), pull out your key, and you now have a link from half-edge to original curve. This is a many-to-many relationship - the consolidated cure traits will make sure that multiple keys make it to a half-edge if needed.
If you are doing a small amount of incremental work, attach an observer. You will need to override the following observer messages:
- after_create_edge to detect new half-edges induced for your insertion.
- after_modify_edge to detect cases where your edge completely overlaps an existing half-edge.
- after_split_edge to detect the case where your edge partly overlaps an existing edge. (The existing edge will be split so that there is a vertex at the end of your inserted curve.)
- If the curves you are inserting intersect with each other, after_split_edge also needs to detect the case where an edge you previously inserted and care about is split in two.
I use the latter strategy to detect induced rings when I am adding small areas and not using the sweep-line algorithm.
Future work: I have not had time to analyze whether incremental observation is better/worse for performance than bulk insertion with consolidated data keys.