示例#1
0
        protected void ProcessTypeCollection()
        {
            foreach (SemanticTypeInstance typeInstance in Program.SemanticTypeSystem.Instances.Values)
            {
                ISemanticType instance = typeInstance.Instance;
                string        name     = typeInstance.Name;

                if (!ignoreNames.Contains(name))
                {
                    // A distinct type name, used for coloration logic.
                    distinctTypes.AddIfUnique(name);

                    // Also, for each type, we have a specific location to group all instances of that type.
                    if (!typeGroups.ContainsKey(name))
                    {
                        typeGroups[name] = new TypeGroup();
                        AdjustGroupLocations();
                        ResetAllTargets();
                    }

                    VisualSemanticType vst = new VisualSemanticType(instance, name);
                    vtypes.Add(vst);                                    // Only the collections go in this space.

                    // Add all the collection elements.
                    if (name == "PopulationByStateByYear")
                    {
                        // This is a collection.
                        List <ISemanticType> stList = (List <ISemanticType>)((dynamic)vst.SemanticType).Collection.Items;
                        int items = stList.Count;

                        stList.ForEachWithIndex((st, idx2) =>
                        {
                            // Create the collection types.  This is for every item in the collection, so many will be repeated (like year and state)
                            string subname = Program.SemanticTypeSystem.GetSemanticTypeName(st);
                            distinctTypes.AddIfUnique(subname);
                            VisualSemanticType vst2  = new VisualSemanticType(st, subname);
                            CollectionSubtype cs     = new CollectionSubtype(instance, st);
                            typeVisualizationMap[cs] = vst2;
                            // vtypes.Add(vst2);
                        });
                    }
                }
            }
        }
示例#2
0
        protected void ProcessTypeCollection()
        {
            foreach (SemanticTypeInstance typeInstance in Program.SemanticTypeSystem.Instances.Values)
            {
                ISemanticType instance = typeInstance.Instance;
                string name = typeInstance.Name;

                if (!ignoreNames.Contains(name))
                {
                    // A distinct type name, used for coloration logic.
                    distinctTypes.AddIfUnique(name);

                    // Also, for each type, we have a specific location to group all instances of that type.
                    if (!typeGroups.ContainsKey(name))
                    {
                        typeGroups[name] = new TypeGroup();
                        AdjustGroupLocations();
                        ResetAllTargets();
                    }

                    VisualSemanticType vst = new VisualSemanticType(instance, name);
                    vtypes.Add(vst);		// Only the collections go in this space.

                    // Add all the collection elements.
                    if (name == "PopulationByStateByYear")
                    {
                        // This is a collection.
                        List<ISemanticType> stList = (List<ISemanticType>)((dynamic)vst.SemanticType).Collection.Items;
                        int items = stList.Count;

                        stList.ForEachWithIndex((st, idx2) =>
                        {
                            // Create the collection types.  This is for every item in the collection, so many will be repeated (like year and state)
                            string subname = Program.SemanticTypeSystem.GetSemanticTypeName(st);
                            distinctTypes.AddIfUnique(subname);
                            VisualSemanticType vst2 = new VisualSemanticType(st, subname);
                            CollectionSubtype cs = new CollectionSubtype(instance, st);
                            typeVisualizationMap[cs] = vst2;
                            // vtypes.Add(vst2);
                        });
                    }
                }
            }
        }