Example #1
0
        /***************************************************/

        private static Dataset SetGraphDataSet(Graph graph, IView view)
        {
            if (view is DependencyChart)
            {
                DependencyChart chart            = view as DependencyChart;
                string          groupPropertName = chart.Boxes.Group;
                foreach (IBHoMObject entity in graph.Entities())
                {
                    if (chart.Boxes.GroupsToIgnore.Contains(entity.PropertyValue(groupPropertName)))
                    {
                        graph.RemoveEntity(entity);
                    }
                }
            }

            BHoMGroup <IBHoMObject> entities = new BHoMGroup <IBHoMObject>();

            entities.Elements = graph.Entities();
            entities.Name     = "Entities";

            BHoMGroup <IBHoMObject> relations = new BHoMGroup <IBHoMObject>();

            relations.Elements = graph.Relations.Cast <IBHoMObject>().ToList();
            relations.Name     = "Relations";

            Dataset graphData = new Dataset();

            graphData.Data = new List <IBHoMObject>();
            graphData.Data.Add(entities);
            graphData.Data.Add(relations);

            return(graphData);
        }
Example #2
0
        public static void View(this DependencyChart view, Dataset dataset)
        {
            if (view == null || dataset == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot modify a view if the view or dataset are null.");
                return;
            }

            view.Boxes.IRepresentationFragment(dataset, view.ViewConfig);

            view.Links.IRepresentationFragment(dataset, view.ViewConfig);
        }