Esempio n. 1
0
        public static ClosedWayTest Build(RuleBuilder rule)
        {
            switch (rule.Closed)
            {
            case "yes":
                return(ClosedWayTester);

            case "no":
                return(OpenedWayTester);

            default:
                return(null);
            }
        }
Esempio n. 2
0
        public static KeyNoValueTest Build(RuleBuilder rule)
        {
            if (!rule.valueList.Contains("~"))
            {
                return(null);
            }
            List <string> keyList = new List <string>(rule.keyList);

            if (!keyList.Any())
            {
                keyList.Add("*");
            }

            return(new KeyNoValueTest(keyList));
        }
Esempio n. 3
0
        public static ClassTester Build(RuleBuilder rule)
        {
            switch (rule.ElementClass)
            {
            case "way":
                return(WayTester);

            case "node":
            case "poi":
                return(NodeTester);

            default:
                return(null);
            }
        }
Esempio n. 4
0
        public static KeyValueTest Build(RuleBuilder rule)
        {
            List <string> keyList   = new List <string>(rule.keyList);
            List <string> valueList = new List <string>(rule.valueList);

            if ((!keyList.Any() || keyList.Contains("*")))
            {
                keyList.Clear();
                keyList.Add("*");
            }
            valueList.Remove("~");
            if ((!valueList.Any() || valueList.Contains("*")))
            {
                valueList.Clear();
                valueList.Add("*");
            }

            if (keyList[0] == "*" && valueList[0] == "*")
            {
                return(null);
            }
            return(new KeyValueTest(keyList, valueList));
        }
Esempio n. 5
0
 public void StartElement(string uri, string localName, string qName, IEnumerable <XAttribute> attributes)
 {
     try {
         if ("rendertheme".Equals(qName))
         {
             CheckState(qName, Element.RenderTheme);
             this.renderTheme = new RenderThemeBuilder(qName, attributes).build();
         }
         else if (ElementNameRule.Equals(qName))
         {
             CheckState(qName, Element.Rule);
             Rule rule = new RuleBuilder(qName, attributes, this.ruleStack).build();
             if (this.ruleStack.Count != 0)
             {
                 this.currentRule.AddSubRule(rule);
             }
             this.currentRule = rule;
             this.ruleStack.Push(this.currentRule);
         }
         else if ("area".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Area area = new AreaBuilder(qName, attributes, this.level++, this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(area);
         }
         else if ("caption".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Caption caption = new CaptionBuilder(qName, attributes).build();
             this.currentRule.AddRenderingInstruction(caption);
         }
         else if ("circle".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Circle circle = new CircleBuilder(qName, attributes, this.level++).build();
             this.currentRule.AddRenderingInstruction(circle);
         }
         else if ("line".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Line line = new LineBuilder(qName, attributes, this.level++, this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(line);
         }
         else if ("lineSymbol".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             LineSymbol lineSymbol = new LineSymbolBuilder(qName, attributes,
                                                           this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(lineSymbol);
         }
         else if ("pathText".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             PathText pathText = new PathTextBuilder(qName, attributes).build();
             this.currentRule.AddRenderingInstruction(pathText);
         }
         else if ("symbol".Equals(qName))
         {
             CheckState(qName, Element.RenderingInstruction);
             Symbol symbol = new SymbolBuilder(qName, attributes, this.relativePathPrefix).build();
             this.currentRule.AddRenderingInstruction(symbol);
         }
         else
         {
             throw new XmlException("unknown element: " + qName);
         }
     } catch (IOException e) {
         throw new XmlException(null, e);
     }
 }
Esempio n. 6
0
 public Rule(RuleBuilder ruleBuilder)
 {
     this.RuleTests          = ruleBuilder.RuleTests;
     this.renderInstructions = new List <RenderInstruction>(4);
     this.subRules           = new List <Rule>(4);
 }