Beispiel #1
0
        internal Workspace(Type backendType, object[] targets, GetAPI getAPI, Action Repaint, Action <Action> Exec)
        {
            this.Repaint = Repaint;
            this.Exec    = Exec;
            this.api     = getAPI(1) as RelationsInspectorAPI;

            graphBackend = (IGraphBackendInternal <T, P>)BackendTypeUtil.CreateBackendDecorator(backendType);
            graphBackend.Awake(getAPI);

            // create new layout params, they are not comming from the cfg yet
            this.layoutType     = (LayoutType)GUIUtil.GetPrefsInt(GetPrefsKeyLayout(), (int)LayoutType.Tree);
            this.graphPosTweens = new TweenCollection();

            this.builderRNG = new RNG(4);               // chosen by fair dice role. guaranteed to be random.

            expectedTargetType = BackendTypeUtil.BackendAttrType(backendType) ?? typeof(T);

            // when targets is null, show the toolbar only. don't create a graph (and view)
            // when rootEntities is empty, create graph and view anyway, so the user can add entities
            if (targets != null)
            {
                seedEntities = targets.SelectMany(graphBackend.Init).ToHashSet();
                InitGraph();
            }
        }
Beispiel #2
0
        public IMView(Graph <T, P> graph, IViewParent <T, P> parent)
        {
            this.graph  = graph;
            this.parent = parent;

            entityDrawerBounds = new Dictionary <T, Rect>();
            edgeMarkerBounds   = new Dictionary <Relation <T, P>, Rect>();

            entitySelection = new HashSet <T>();
            dragEdgeSource  = new HashSet <T>();

            // draw the targets last
            drawOrdered = new LinkedList <T>(graph.Vertices);
            foreach (var target in graph.Vertices.Where(parent.IsSeed))
            {
                drawOrdered.Remove(target);
                drawOrdered.AddLast(target);
            }

            // initialize the drawers
            tagDrawer = new BasicRelationDrawer <T, P>();

            entityWidgetType = (EntityWidgetType)GUIUtil.GetPrefsInt(PrefsKeyLayout, (int)defaultWidgetType);
            InitEntityWidget();

            // make the graph fill the view
            transform = GetOptimalTransform();
        }
Beispiel #3
0
 public static void OnEnable()
 {
     inputEventCount = GUIUtil.GetPrefsInt("DemoActions", 0);
 }