comparison toolboxes/graph_visualisation/graphViz4Matlab/layouts/Abstractlayout.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 classdef Abstractlayout < handle
2 % This class represents an abstract graph layout. Subclass to create actual
3 % layouts.
4
5 properties(Abstract = true)
6 xmin; % The left most point on the graph axis in data units
7 xmax; % The right most point on the graph axis in data units
8 ymin; % The bottom most point on the graph axis in data units
9 ymax; % The top most point on the graph axis in data units
10 adjMatrix; % The adjacency matrix
11 maxNodeSize; % The maximum diameter of a node in data units
12 image; % A 20-by-20-by-3 array specifying an image for
13 % the smartgraph button that will launch this
14 % layout.
15 name; % A unique name for instances of this class.
16 shortDescription; % A short description used for tooltips.
17 nodeSize; % The calculated node size, call dolayout() before accessing
18 centers; % The calculated node centers in an n-by-2 matrix
19 end
20
21 methods
22 function dolayout(obj,adjMatrix,graphAxis,maxNodeSize)
23 % Calculate the node centers and an optimal size
24 obj.adjMatrix = adjMatrix;
25 obj.maxNodeSize = maxNodeSize;
26 xlimits = get(graphAxis,'XLim');
27 ylimits = get(graphAxis,'YLim');
28 obj.xmin = xlimits(1); obj.xmax = xlimits(2);
29 obj.ymin = xlimits(1); obj.ymax = ylimits(2);
30 obj.calcLayout();
31 end
32
33 function available = isavailable(obj)
34 % Test to see if this layout is available.
35 available = true;
36 end
37
38 end
39
40 methods(Access = 'protected')
41
42 function setImage(obj,color)
43 % Sets the image to a grid with the specified color in rgb normalized
44 % units, i.e. [0.2 0.5 0.9].
45 obj.image = cat(3,color(1)*ones(20,20),color(2)*ones(20,20),color(3)*ones(20,20));
46 obj.image(1:4:20,:,:) = 0;
47 obj.image(:,1:4:20,:) = 0;
48 end
49
50
51 end
52
53 methods(Abstract = true, Access = 'protected')
54 calcLayout(obj); % do the actual work
55 end
56
57 end