After opening a MxD document and getting the main map then a feature layer, I want to duplicate the layer with ArcObjects in order to inherit its properties (symbology, layer def and labelling). Then, I want to edit the name of the copy and its layer defs query.
I managed to get both IMap and source feature layer.
IMap map = mapDocument.getMap(0); IFeatureLayer sourceFeatureLayer = map.getLayer(0); IFeatureLayer destinationFeatureLayer = ...? destinationFeatureLayer.setName("layer_2"); map.addLayer(destinationFeatureLayer);
How do I duplicate the source layer?