Solved! Go to Solution.
ILabelEngineLayerProperties2 test = labEngLyrProp as ILabelEngineLayerProperties2; if(test == null) { Console.WriteLine("NOT an ILabelEngineLayerProperties2"); } else { Console.WriteLine("IS an ILabelEngineLayerProperties2"); IOverposterLayerProperties olp = test.OverposterLayerProperties; if (olp is IMaplexOverposterLayerProperties) { Console.WriteLine("olp is IMaplexOverposterLayerProperties"); } else if (olp is IBasicOverposterLayerProperties) { Console.WriteLine("olp is IBasicOverposterLayerProperties); } else { Console.WriteLine("olp is an unknown type!"); } }//C# ILabelEngineLayerProperties2 lelp = alp as ILabelEngineLayerProperties2; if (lelp == null) continue;
'VB.NET Dim lelp as ILabelEngineLayerProperties2 = TryCast(alp, ILabelEngineLayerProperties2) If lelp Is Nothing Then Continue For
ILabelEngineLayerProperties::BasicOverposterProperties is not implemented by MaplexLabelEngineLayerProperties. See ILabelEngineLayerProperties2 for methods for generic handling of labeling properties for both label engines.
//C#
IOverposterLayerProperties olp = lelp.OverposterLayerProperties;
IBasicOverposterLayerProperties bolp = olp as IBasicOverposterLayerProperties;
IMaplexOverposterLayerProperties molp = olp as IMaplexOverposterLayerProperties;
if (bolp != null)
{
//Do something here with bolp
}
else if (molp != null)
{
//Do something here with molp
}
ILabelEngineLayerProperties2 test = labEngLyrProp as ILabelEngineLayerProperties2; if(test == null) { Console.WriteLine("NOT an ILabelEngineLayerProperties2"); } else { Console.WriteLine("IS an ILabelEngineLayerProperties2"); IOverposterLayerProperties olp = test.OverposterLayerProperties; if (olp is IMaplexOverposterLayerProperties) { Console.WriteLine("olp is IMaplexOverposterLayerProperties"); } else if (olp is IBasicOverposterLayerProperties) { Console.WriteLine("olp is IBasicOverposterLayerProperties); } else { Console.WriteLine("olp is an unknown type!"); } }