/// <summary> /// Resolves all the styles in the specified <see cref="Feature"/>. /// </summary> /// <param name="feature"> /// The <c>Feature</c> to search for styles. /// </param> /// <param name="file"> /// The <see cref="KmlFile"/> the feature belongs to. /// </param> /// <param name="state"> /// The <see cref="StyleState"/> of the styles to look for. /// </param> /// <param name="resolver"> /// Used to resolve external files referenced by the styles. /// </param> /// <param name="cache">IKMLCache object to use previously loaded external files</param> /// <returns> /// A new <see cref="Style"/> that has been resolved. /// </returns> /// <exception cref="ArgumentNullException">feature/file is null.</exception> public static Style CreateResolvedStyle(Feature feature, KmlFile file, StyleState state, IFileResolver resolver, IKmlCache cache = null) { if (feature == null) { throw new ArgumentNullException("feature"); } if (file == null) { throw new ArgumentNullException("file"); } var instance = new StyleResolver(file.StyleMap); instance.fileResolver = resolver; instance.state = state; instance.cache = cache; instance.Merge(feature.StyleUrl); foreach (StyleSelector selector in feature.Styles) { instance.Merge(selector); } return instance.style; }
/// <summary> /// Resolves all the styles in the specified <see cref="Feature"/>. /// </summary> /// <param name="feature"> /// The <c>Feature</c> to search for styles. /// </param> /// <param name="file"> /// The <see cref="KmlFile"/> the feature belongs to. /// </param> /// <param name="state"> /// The <see cref="StyleState"/> of the styles to look for. /// </param> /// <param name="resolver"> /// Used to resolve external files referenced by the styles. /// </param> /// <returns> /// A new <see cref="Style"/> that has been resolved. /// </returns> /// <exception cref="ArgumentNullException">feature/file is null.</exception> public static Style CreateResolvedStyle(Feature feature, KmlFile file, StyleState state, IFileResolver resolver) { Check.IsNotNull(feature, nameof(feature)); Check.IsNotNull(file, nameof(file)); var instance = new StyleResolver(file.StyleMap) { fileResolver = resolver, state = state, }; instance.Merge(feature.StyleUrl); foreach (StyleSelector selector in feature.Styles) { instance.Merge(selector); } return(instance.style); }
/// <summary>Resolves all the styles in the specified Feature.</summary> /// <param name="feature">The Feature to search for Styles.</param> /// <param name="file">The KmlFile the feature belongs to.</param> /// <param name="state">The StyleState of the styles to look for.</param> /// <returns>A new Style that has been resolved.</returns> /// <exception cref="ArgumentNullException">feature/file is null.</exception> public static Style CreateResolvedStyle(Feature feature, KmlFile file, StyleState state) { if (feature == null) { throw new ArgumentNullException("feature"); } if (file == null) { throw new ArgumentNullException("file"); } var instance = new StyleResolver(file.StyleMap); instance._state = state; instance.Merge(feature.StyleUrl, feature.StyleSelector); return(instance._style); }