Right now we have a lot of mxds with grouplayers (even som grouplayers with grouplayers).
If I import a .lyr file in ArcMap all layerids will be -1.
I'm trying to set the Layer Id for an ILayer in an mxd document but cannot find any ArcObjects interfaces exposing this property.
ILayerDescriptions needs server objects.
Any help is appreciated.
Solved! Go to Solution.
Hi Alessandro,
p return 50
k return 3
IMapDocument mapDocument = new MapDocumentClass();
mapDocument.Open(@"C:\Temp\Scratch\testanno.mxd");
IMap b = mapDocument.get_Map(0);
ILayerExtensions c = b.get_Layer(0) as ILayerExtensions;
var p = (c.get_Extension(0) as IServerLayerExtension).ServerProperties.GetProperty("ServicelayerID");
var k = (((b.get_Layer(0) as ICompositeLayer2).get_Layer(0) as ILayerExtensions).get_Extension(0) as IServerLayerExtension).ServerProperties.GetProperty("ServicelayerID");
Hi Domenico,
Thank you for the hint!
Unfortunately testing your code using 10.3.1, I could not solve the problem.
ICompositeLayer2 allows me to access sublayer of the annotation Layer (using ((anLayer as ICompositeLayer2).get_Layer(0) ), but the cast to ILayerExtentions of the sublayer is not working.
I guess this is because of a difference in Interfaces implementation between Annotation Layer and Annotation Sub Layer (which should be a BUG addressed in greater versions)
FDOGraphicsLayer has the Interface ILayerExtentions :ArcObjects Help for .NET developers
While for FDOGraphicsSublayer, ILayerExtentions is missing: -> ArcObjects Help for .NET developers
Are you using a different version (greater than 10.3.1) ?
Thanks,
Alessandro
I have tested with 10.7.
10.3.1 is retired december 2020
I know, 10.7 has the correct intefaces.
I was wondering if ILayerExtentions could be added coding even to Annotation sublayers in 10.3.1, as Michael previously stated:
"
Just need to take care of my layers not having any ILayerExtensions.
Fixed it by just creating one and adding it to the layer.
"
Your hints are always appreciated,
Thanks
Alessandro