private static PolygonTemplate RegisterPriorityPolygonTemplate( string ruleName, GisColor color, MapMakerSettings mapMakerSettings) { string colorAsString = string.Format( CultureInfo.InvariantCulture, "{000000:X}", color.Rgb); List <string> colors = new List <string> (); colors.Add(colorAsString); PolygonTemplate template = new PolygonTemplate(); template.Style.SetParameter( "rulename", ruleName); template.Style.SetParameter("colors", colors); //template.Style.SetParameter ("typename", typeName); template.RegisterType( ruleName, mapMakerSettings.TypesRegistry, true); return(template); }
private void ParseAreaRule(IList <string> tableRowCells) { string ruleName = GetTableRowCell(tableRowCells, 0, false, "Rule name missing"); string selectorText = GetTableRowCell(tableRowCells, 1, false, "Rule selector missing"); string minLevelText = GetTableRowCell(tableRowCells, 2, true, null); string maxLevelText = GetTableRowCell(tableRowCells, 3, true, null); string typeName = GetTableRowCell(tableRowCells, 4, true, null); string label = GetTableRowCell(tableRowCells, 5, true, null); string colorsText = GetTableRowCell(tableRowCells, 6, false, "Area colors value missing"); string patternText = GetTableRowCell(tableRowCells, 7, true, null); IOsmElementSelector osmElementSelector = ParseRuleSelector(tableRowCells[1]); IList <string> colors = ParseColors(colorsText); PolygonTemplate template = new PolygonTemplate(); template.Style.SetParameter("rulename", ruleName); if (false == string.IsNullOrEmpty(minLevelText)) { template.Style.MinZoomFactor = ParseLevel(minLevelText); } if (false == string.IsNullOrEmpty(maxLevelText)) { template.Style.MaxZoomFactor = ParseLevel(maxLevelText); } template.Style.SetParameter("colors", colors); if (false == string.IsNullOrEmpty(typeName)) { template.Style.SetParameter("typename", typeName); } if (false == String.IsNullOrEmpty(label)) { template.Style.SetParameter("label", label); } if (false == String.IsNullOrEmpty(patternText)) { template.Style.SetParameter("pattern", ParseAreaPattern(patternText)); } RenderingRule rule = new RenderingRule(ruleName, RenderingRuleTargets.Areas, osmElementSelector, template); rules.AddRule(rule); }
public RenderingRulesMother AddAreaRule() { string ruleName = counter.ToString(CultureInfo.InvariantCulture); PolygonTemplate template = new PolygonTemplate(); template.Style.SetParameter("rulename", ruleName); List <string> colors = new List <string> (); colors.Add("ffffff"); template.Style.SetParameter("colors", colors); currentRule = new RenderingRule( ruleName, RenderingRuleTargets.Areas, new OsmElementSelectorContainer(OsmElementSelectorContainerOperation.And), template); rules.AddRule(currentRule); counter++; return(this); }