Example #1
0
        void InitGraph()
        {
            graph = GraphBuilder <T, P> .Build(seedEntities, graphBackend.GetRelations, builderRNG, Settings.Instance.maxGraphNodes);

            if (graph == null)
            {
                return;
            }

            // delay the view construction, so this.drawRect can be set before that runs.
            Exec(() => view = new IMView <T, P>(graph, this));

            // run layout, unless the user wants to use caches and a cache could be loaded
            bool runLayout = Settings.Instance.cacheLayouts ?
                             !GraphPosSerialization.LoadGraphLayout(graph, seedEntities, graphBackend.GetDecoratedType()) :
                             true;

            if (runLayout)
            {
                layoutRunning = true;
                // make the view focus on the initial graph unfolding
                adjustTransformMode = AdjustTransformMode.Instant;
                Exec(DoAutoLayout);
            }
        }
Example #2
0
 public void OnDestroy()
 {
     if (graph != null && !layoutRunning && Settings.Instance.cacheLayouts)
     {
         GraphPosSerialization.SaveGraphLayout(graph, seedEntities, graphBackend.GetDecoratedType());
     }
     graphBackend.OnDestroy();
 }