public TransformationModule(GraphPresentation presentation)
        {
            myPresentation    = presentation;
            myTransformations = new List <IGraphTransformation>();

            // Hint: we already add DynamicClusterTransformation here so that all fold operations are behind that and
            // that newly added nodes to a cluster are automatically folded (if folding is applied)
            Add(new DynamicClusterTransformation());
        }
        private IEnumerable <Cluster> GetClusters(GraphPresentation lhs, IGraphPresentation rhs)
        {
            if (lhs.Graph == null)
            {
                return(rhs.Graph.Clusters);
            }
            if (rhs.Graph == null)
            {
                return(lhs.Graph.Clusters);
            }

            return(lhs.Graph.Clusters.Concat(rhs.Graph.Clusters));
        }
        private IEnumerable <Edge> GetEdges(GraphPresentation lhs, IGraphPresentation rhs)
        {
            if (lhs.Graph == null)
            {
                return(rhs.Graph.Edges);
            }
            if (rhs.Graph == null)
            {
                return(lhs.Graph.Edges);
            }

            return(lhs.Graph.Edges.Concat(rhs.Graph.Edges));
        }
示例#4
0
        public IGraphPresentation Read()
        {
            var presentation = new GraphPresentation();

            var version = myReader.ReadInt32();

            Contract.Invariant(version == Version, "Unexpected version: " + version);

            presentation.Graph = ReadGraph();

            ReadNodeMasks(presentation.GetModule <NodeMaskModule>());
            ReadTansformations(presentation);
            ReadCaptions(presentation.GetModule <CaptionModule>());
            ReadNodeStyles(presentation.GetPropertySetFor <NodeStyle>());
            ReadEdgeStyles(presentation.GetPropertySetFor <EdgeStyle>());

            // intentionally left out
            // - GraphLayoutModule
            // - PropertySetModule<Selection>
            // - PropertySetModule<ToolTipContent>

            return(presentation);
        }