protected virtual void ConvertProperties(KmlStyle style, GeoJsonProperties properties) { if (style == null) { return; } ConvertProperties(style.IconStyle, properties); ConvertProperties(style.LineStyle, properties); ConvertProperties(style.PolyStyle, properties); }
protected virtual void ConvertProperties(KmlPolyStyle style, GeoJsonProperties properties) { if (style == null) { return; } if (style.Color.HasValue() && KmlUtils.TryParseHexColor(style.Color, out byte r, out byte g, out byte b, out float a)) { properties.Fill = "#" + KmlUtils.RgbToHex(r, g, b); properties.FillOpacity = (float)Math.Round(a, 2); } }
protected virtual void ConvertProperties(KmlIconStyle style, GeoJsonProperties properties) { if (style == null) { return; } if (string.IsNullOrWhiteSpace(style.Icon?.Href) == false) { properties.MarkerSymbol = style.Icon.Href; } if (style.Scale > 0) { properties.MarkerSize = style.Scale.ToString("N2"); } if (style.Color.HasValue()) { properties.MarkerColor = style.Color; } }
/// <summary> /// Initializes a new instance based on the specified <paramref name="type"/> and <paramref name="json"/>. /// </summary> /// <param name="type">The type of the feature.</param> /// <param name="json">An instance of <see cref="JObject"/> representing the feature.</param> protected GeoJsonFeatureBase(GeoJsonType type, JObject json) : base(type) { Properties = json.GetObject <GeoJsonProperties>("properties"); }
/// <summary> /// Initializes a new instance with the specified <paramref name="type"/>. /// </summary> /// <param name="type">The type of the feature.</param> protected GeoJsonFeatureBase(GeoJsonType type) : base(type) { Properties = new GeoJsonProperties(); }
/// <summary> /// Initializes a new instance with the specified <paramref name="geometry"/>. /// </summary> /// <param name="geometry">The geometry of the feature.</param> /// <param name="properties">The properties of the feature.</param> public GeoJsonFeature(GeoJsonGeometry geometry, GeoJsonProperties properties) : base(GeoJsonType.Feature) { Geometry = geometry; Properties = properties ?? new GeoJsonProperties(); }
/// <summary> /// Initializes a new instance with the specified <paramref name="geometry"/>. /// </summary> /// <param name="geometry">The geometry of the feature.</param> public GeoJsonFeature(GeoJsonGeometry geometry) : base(GeoJsonType.Feature) { Geometry = geometry; Properties = new GeoJsonProperties(); }
/// <summary> /// Initializes a new empty instance. /// </summary> public GeoJsonFeature() : base(GeoJsonType.Feature) { Properties = new GeoJsonProperties(); }