From be17a112163ee2a8851612f776118d4cdf67ed14 Mon Sep 17 00:00:00 2001 From: Andras Schaffer Date: Tue, 12 Nov 2024 00:05:14 +0100 Subject: [PATCH 1/2] KML load: Fix default line width --- GCSViews/FlightPlanner.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GCSViews/FlightPlanner.cs b/GCSViews/FlightPlanner.cs index 4f4df345d3..1a53f9a3c3 100644 --- a/GCSViews/FlightPlanner.cs +++ b/GCSViews/FlightPlanner.cs @@ -5180,8 +5180,12 @@ private void processKML(Element Element, Document root = null) // convert color from ABGR to ARGB color = (int)((color & 0xFF00FF00) | ((color & 0x00FF0000) >> 16) | ((color & 0x000000FF) << 16)); - // ABGR - return (Color.FromArgb(color), (int)((Style)style).Line.Width.Value); + if (((Style)style).Line.Width != null) + { + return (Color.FromArgb(color), (int)((Style)style).Line.Width.Value); + } + else + return (Color.FromArgb(color), 2); } } } From 84d77277ac2bdb4173d74d2ca51e587053bd4c6f Mon Sep 17 00:00:00 2001 From: Andras Schaffer Date: Tue, 12 Nov 2024 00:13:08 +0100 Subject: [PATCH 2/2] Fix missing default color --- GCSViews/FlightPlanner.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GCSViews/FlightPlanner.cs b/GCSViews/FlightPlanner.cs index 1a53f9a3c3..7b75cb6816 100644 --- a/GCSViews/FlightPlanner.cs +++ b/GCSViews/FlightPlanner.cs @@ -5176,9 +5176,15 @@ private void processKML(Element Element, Document root = null) { if (((Style)style).Line != null) { - int color = ((Style)style).Line.Color.Value.Abgr; + int color; + if (((Style)style).Line.Color != null) + { + color = ((Style)style).Line.Color.Value.Abgr; + color = (int)((color & 0xFF00FF00) | ((color & 0x00FF0000) >> 16) | ((color & 0x000000FF) << 16)); + + } + else color = Color.White.ToArgb(); // convert color from ABGR to ARGB - color = (int)((color & 0xFF00FF00) | ((color & 0x00FF0000) >> 16) | ((color & 0x000000FF) << 16)); if (((Style)style).Line.Width != null) {