Example #1
0
        // Requests coming to a list input in Grasshopper, e.g. the Find components via Specify or Panel outputs
        public ParseRequest(List <string> metaDataRawValues)
        {
            var cleanedGhInput = SplitTextStreamIntoIndividualItems(metaDataRawValues);

            // Transform the key:value formatted strings into OSM items and assign them
            this.Requests = new List <OSMTag>();
            foreach (string inputString in cleanedGhInput)
            {
                var osmItem = new OSMTag(inputString);
                if (osmItem != null)
                {
                    if (!this.Requests.Contains(osmItem)) // Prevent duplicates
                    {
                        this.Requests.Add(osmItem);
                    }
                }
            }
        }
Example #2
0
        public static TreeGridItemCollection GetTreeCollection()
        {
            var selectableOSMs = new TreeGridItemCollection();
            var indexOfParents = new Dictionary <string, int>();

            var primaryFeatures = new List <OSMTag>(OSMPrimaryTypes.Keys.Values);

            for (var i = 0; i < primaryFeatures.Count; i++)
            {
                var parentItem = new OSMTreeGridItem(primaryFeatures[i],
                                                     0, 0, false, false);

                selectableOSMs.Add(parentItem);
                indexOfParents[primaryFeatures[i].Value] = i;
            }

            var secondaryFeatures = OSMPrimaryTypes.Values;

            foreach (var keyValue in secondaryFeatures.Keys)
            {
                var item       = secondaryFeatures[keyValue];
                var parentItem = selectableOSMs[indexOfParents[item["key"]]] as OSMTreeGridItem;

                var childOSM  = new OSMTag(item["value"], null, item["description"], parentItem.OSMData);
                var childItem = new OSMTreeGridItem(childOSM,
                                                    int.Parse(item["nodes"]), int.Parse(item["ways"]), false, false);

                if (childItem.OSMData.Value == "yes")
                {
                    parentItem.Children.Insert(0, childItem);
                }
                else
                {
                    parentItem.Children.Add(childItem);
                }
            }

            return(selectableOSMs);
        }
Example #3
0
        private void AddItem(OSMTag match, Dictionary <string, string> nodeTags, List <Coord> coords)
        {
            var newFind = new FoundItem(nodeTags, coords);

            this.FoundData[match].Add(newFind);
        }