private void AddSpecificStyle(Feature feature) { String path = document.GetNodePath(feature); IEnumerable<StyleInfo> styleConstraints = configFacade.GetStylesPartial(path); List<Style> specificStyles = new List<Style>(); foreach (var item in styleConstraints) { specificStyles.Add(StyleFactory.CreateStyle(item, defaults)); } foreach (var style in specificStyles) { feature.AddStyle(style, true); //Should we check style compatibility here } foreach (var subFeature in feature.GetChildFeatures()) { AddSpecificStyle(subFeature); } }
private void AddStyle(Feature feature) { IEnumerable<StyleInfo> stylesConstraints = randomizer.GetRandomStyleSubset(feature.Name); float styleAddingProb = Config.Default.StyleAddProb; float randomVal = (float) randomNumber.NextDouble(); //Only add styles to fraction of features if (randomVal < styleAddingProb) { List<Style> possibleStyles = new List<Style>(); foreach (var item in stylesConstraints) { possibleStyles.Add(StyleFactory.CreateStyle(item, defaults)); } foreach (var style in possibleStyles) { feature.AddStyle(style); } } foreach (var subFeature in feature.GetChildFeatures()) { AddStyle(subFeature); } }