-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gx:drawOrder on any geometry type #19
Comments
Looking at the latest documentation, I still can only see it on the However, if you wanted to add support for any other [KmlElement("drawOrder", KmlNamespaces.GX22Namespace)]
public class PointExtension : Element
{
public int? Value
{
get
{
if (int.TryParse(this.InnerText, out int value))
{
return value;
}
else
{
return null;
}
}
set
{
this.ClearInnerText();
this.AddInnerText(value.ToString());
}
}
}
// Somewhere in your main function
KmlFactory.RegisterExtension<Point, PointExtension>(); This would allow you to add a public static class PointExtensions
{
public static int? DrawOrder(this Point point)
{
return point.Children
.OfType<PointExtension>()
.FirstOrDefault()
?.Value;
}
public static void DrawOrder(this Point point, int value)
{
PointExtension extension =
point.Children
.OfType<PointExtension>()
.FirstOrDefault();
if (extension == null)
{
extension = new PointExtension();
point.AddChild(extension);
}
extension.Value = value;
}
} Usage would then be relativly simple: var point = new Point
{
Id = "point123",
AltitudeMode = AltitudeMode.Absolute,
};
point.DrawOrder(123); Hope that helps and gets you going in the right direction. |
Thanks for your answer. |
Seeing how the behaviour is not documented and differs between different versions of GE, I don't think it's a feature that can be added to the library (as it will open up questions about it not working correctly). Thanks for the suggestion though, I hope the workaround code is useful and lets you get closer to achieving your requirements. |
Hi there,
Is there a way to extend GXDrawOrder property on all types derived from Geometry ?
link
Thanks
The text was updated successfully, but these errors were encountered: