/// <summary>
        /// Creates a new MapCSS interpreter from a stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="imageSource"></param>
        public MapCSSInterpreter(Stream stream, IMapCSSImageSource imageSource)
        {
            if (imageSource == null)
            {
                throw new ArgumentNullException("imageSource");
            }

            _mapCSSFile          = MapCSSFile.FromStream(stream);
            _mapCSSImageSource   = imageSource;
            _geometryInterpreter = GeometryInterpreter.DefaultInterpreter;
        }
        public MapCSSVectorTileStyler(Stream stream)
        {
            var _mapCSSFile = MapCSSFile.FromStream(stream);

            _keysForNodes     = new HashSet <string>();
            _keysForWays      = new HashSet <string>();
            _keysForRelations = new HashSet <string>();
            _keysForLines     = new HashSet <string>();
            _keysForAreas     = new HashSet <string>();

            if (_mapCSSFile != null && _mapCSSFile.Rules != null)
            {
                foreach (var rule in _mapCSSFile.Rules)
                {
                    foreach (var selector in rule.Selectors)
                    {
                        if (selector.SelectorRule == null)
                        { // there is no selector rule, not irrelevant tags, no short-list of relevant tags possible.
                            switch (selector.Type)
                            {
                            case SelectorTypeEnum.Node:
                                _keysForNodes = null;
                                break;

                            case SelectorTypeEnum.Way:
                                _keysForWays = null;
                                break;

                            case SelectorTypeEnum.Relation:
                                _keysForRelations = null;
                                break;

                            case SelectorTypeEnum.Line:
                                _keysForLines = null;
                                break;

                            case SelectorTypeEnum.Area:
                                _keysForAreas = null;
                                break;
                            }
                        }
                        else
                        { // there might be relevant tags in this selector rule.
                            switch (selector.Type)
                            {
                            case SelectorTypeEnum.Node:
                                selector.SelectorRule.AddRelevantKeysTo(_keysForNodes);
                                break;

                            case SelectorTypeEnum.Way:
                                selector.SelectorRule.AddRelevantKeysTo(_keysForWays);
                                break;

                            case SelectorTypeEnum.Relation:
                                selector.SelectorRule.AddRelevantKeysTo(_keysForRelations);
                                break;

                            case SelectorTypeEnum.Line:
                                selector.SelectorRule.AddRelevantKeysTo(_keysForLines);
                                break;

                            case SelectorTypeEnum.Area:
                                selector.SelectorRule.AddRelevantKeysTo(_keysForAreas);
                                break;
                            }
                        }
                    }
                }
            }

            _unsuccesfullWays = new HashSet <TagsCollectionBase>();
            _succesfullWays   = new Dictionary <TagsCollectionBase, List <MapCSSRuleProperties> >();
        }