Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

563 incremental layout #636

Merged
merged 133 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
cb8d0ff
created new class IncrementalTreemapLayout #563
m4xxed Mar 23, 2023
3b897b1
Cleaned up the new class #563
m4xxed Mar 23, 2023
1733348
start incrementel tree map, setup firtst classes etc, no real functio…
Apr 6, 2023
46f8cda
init tNodes in ITMLayout, an own representation for Graph and its Layout
Apr 8, 2023
045a011
Add methods for traversing graph and recursively calculate new layout…
Apr 14, 2023
9ab5b2a
impl. dissect
Apr 15, 2023
d19c6b3
finished dissect, defined some properties, incTreemap should now work…
Apr 17, 2023
6be8031
add IncrementalTreeMap to NodeLayoutKind etc, so it can be used now #563
Apr 17, 2023
a278a62
setup for local moves in IncTreeMap Layout
Apr 18, 2023
26346d5
local moves: addNode
Apr 18, 2023
42ce904
local moves: addNodes
Apr 18, 2023
63b5c69
refactor local moves class
Apr 18, 2023
f4cf70e
local moves, flip move case clockwise-vertical
Apr 18, 2023
4051849
finished local moves: apply flip move
Apr 19, 2023
fd23d51
start apply stretch moves
Apr 19, 2023
1e48a64
finished LocalMove
Apr 19, 2023
22ec0c0
local moves delete node
Apr 19, 2023
d5f36ac
IncrementalTreeMapLayout constructor in SEECity and code style fixes
May 24, 2023
a3c8f86
add MathNet.Numerics
May 24, 2023
6e71425
init correct areas
May 24, 2023
8f8e997
correctAreas
May 25, 2023
632cd05
Fix major bugs
May 27, 2023
9ab1ad9
Integrate the special IncrementalTreeMap case in EvolutionRendererLayout
May 27, 2023
9817317
Dictionary Key Bug Fix
May 27, 2023
146570c
local moves now fully implemented + some renaming
May 28, 2023
ee3a4f4
simplify TNode
May 28, 2023
daa3e29
Fixed rectangle size in flip move
Jul 27, 2023
14607f9
fixed stretch move
Jul 27, 2023
37ab19b
rewrite makeLocalMoves
Jul 27, 2023
737b895
Custom debug display
Jul 27, 2023
a2a3f41
fix stretch move
Jul 27, 2023
7b3e481
fix stretch move segment registration
Jul 27, 2023
d54c840
fix delete node, make node grounded with best seg
Jul 27, 2023
9b4cbe3
563 - rework hill climbing precision
SchrammJonas Aug 3, 2023
749b088
563 - interim state
SchrammJonas Aug 3, 2023
8327c52
563 - remove findILayoutNodeByID, use dict now
Aug 4, 2023
2337b81
563 - extract debug function CheckEqualNodeSets
Aug 4, 2023
5a9480d
563 - use TNode Map instead of find expr
Aug 4, 2023
87f5f29
563 add interface for incremental node layouts
Aug 10, 2023
b020e3e
563 - reset local moves parameter
Aug 10, 2023
bd31d47
564 rename TNode Methode
Aug 10, 2023
553748d
563 add a new utils class for layout
Aug 10, 2023
2acb2d0
563 - extract argmin/max to utils
Aug 10, 2023
889210c
563 - change Rectangles to double domain
Aug 10, 2023
d4f3382
563 segment - setter for Const property
Aug 10, 2023
a42d8bd
563 redo usage of TNodeMap cause old nodes are not set here
Aug 10, 2023
5d37c97
563 start enhance correct areas with divide and conquer
Aug 10, 2023
6195cc8
563 IsSliceable
Aug 10, 2023
8565a7a
563 Split node on slicing segment
Aug 10, 2023
3fd27cb
563 move TransformRectangles to utils
Aug 10, 2023
ee73858
563 adjust slice able layout by moving slicing segment
Aug 10, 2023
20d0be8
563 small style fix
Aug 10, 2023
5b06297
563 small code style fix
Aug 10, 2023
e0ca24e
563 move all parameters for the layout algorithm to a new class Param…
Aug 10, 2023
7b8d054
563 some style changes
Aug 10, 2023
f119e16
563 rename arg max/min functions
Aug 10, 2023
03ec2a2
563 refactor layout classes, style
Aug 10, 2023
819c014
563 rename files
Aug 10, 2023
5a185a6
563 rework local moves main algorithm
Aug 10, 2023
d85adeb
563 - increase performance of local moves
Aug 11, 2023
105aebf
563 fix selecting best layout in local moves
Aug 11, 2023
2806483
563 Check remove check func from IncrementalTreeMapLayout.cs
Aug 11, 2023
579ea35
563 try new parameters
Aug 11, 2023
ca3c341
563 make splitting more robust
Aug 11, 2023
f7c1622
563 add DebuggerDisplay for LocalMove
Aug 11, 2023
e3ab035
563 redo ToList call
Aug 11, 2023
d5b9f28
563 add consistency checks
Aug 11, 2023
f82fdc5
563 fixed bug - relevantNodes could be nodes from older clone graph
Aug 11, 2023
bbf0a55
563 small formatting
Aug 11, 2023
2d080f3
563 add serializable settings for incrementalTreeMapLayout
Aug 12, 2023
5c39ead
563 refactor for using IncrementalTreeMapSettings.cs instead of Param…
Aug 12, 2023
999aac8
563 remove obsolete Parameters.cs
Aug 12, 2023
649e90b
563 documentation for IncrementalTreeMapSetting.cs and some renaming …
Aug 15, 2023
5f5ad1e
563 fixed namespace of IIncrementalNodeLayout
Aug 15, 2023
14e234b
563 fixed restore method in IncrementalTreeMapSetting.cs
Aug 15, 2023
2a177be
563 IncrementalTreeMapSetting.cs format
Aug 15, 2023
6a6adec
563 doc and some refactoring IncrementalTreeMapLayout.cs
Aug 15, 2023
b87f1c4
563 some refactoring in IncrementalTreeMapLayout.cs
Aug 15, 2023
000976a
563 format IncrementalTreeMapLayout.cs
Aug 15, 2023
0021b29
563 doc and formatting in utils
Aug 15, 2023
856c459
563 refactor utils extract method for cloning segments
Aug 16, 2023
8bef696
563 use new CloneSegment Method
Aug 16, 2023
274623f
563 minor changes in utils doc
Aug 16, 2023
006f4ce
563 doc and format LocalMoves.cs
Aug 16, 2023
24c32b2
563 doc Segment.cst
Aug 16, 2023
d973726
563 refactor Rectangle.cs
Aug 16, 2023
5db36a6
563 small code style fix
Aug 16, 2023
13eb37f
563 - doc and formatting Rectangle.cs
Aug 16, 2023
5d12494
563 doc and formatting in Nodes.cs
Aug 16, 2023
c371814
563 doc and formatting in LocalMove.cs
Aug 16, 2023
63ec0e2
563 doc and format Dissect.cs
Aug 16, 2023
81fb709
563 doc and formatting Direction.cs, formatting in Node.cs
Aug 16, 2023
e8373d6
563 classes to internal
Aug 16, 2023
09ff0f4
563 fix doc in LocalMove.cs
Aug 16, 2023
c125863
563 - doc and formatting in CorrectArea.cs
Aug 16, 2023
e0e7b74
563 better way to get the settings
Aug 17, 2023
6e64ec6
563 small fix in LocalMove.cs
Aug 17, 2023
8cc8620
563 fix IsSliceAble
Aug 17, 2023
52243c9
563 change the way for adjusting a slice able layout to a more consis…
Aug 17, 2023
4157bd9
563 removed checker functions
Aug 17, 2023
27278a4
563 removed debug log warning msg
Aug 18, 2023
e9e5ff6
563 mainly doc correction and formatting, some small code adjustments
Aug 18, 2023
86f8970
563 fix casting
Aug 18, 2023
631af9a
Apply suggestions from code review
SchrammJonas Aug 18, 2023
b9580d9
563 remove old comment fragment
Aug 21, 2023
811767e
IncrementalTreeMapSetting, applied Falko's suggestions for documentat…
Aug 31, 2023
355aed8
563 IncrementalTreeMapSetting, revised PNorm property.
Aug 31, 2023
778a9a3
563 IncrementalTreeMapSetting, resolved 'var' expression
Aug 31, 2023
5703fa5
Fix code style in IncrementalTreeMapSetting #563
Aug 31, 2023
bca02de
Apply code review suggestions to CorrectArea #563
Aug 31, 2023
b5d0708
Direction.cs: applied Falko's suggestions (doc) #563
Aug 31, 2023
14bbb03
563 Dissect, applied Falkos suggestions (doc)
Aug 31, 2023
d56d0a0
563 Dissect, fixed redundant calculation
Aug 31, 2023
1154b84
563 LocalMove, applied Falkos suggestion (doc, formatting)
Aug 31, 2023
97bf23d
LocalMove, renaming removed '_' from methods and private fields #563
Aug 31, 2023
6547bdc
563 LocalMove, removed 'var' expressions
Aug 31, 2023
1bda030
563 LocalMove, moved FlipMove and StretchMove to new files
Aug 31, 2023
c4df7dc
563 LocalMoves, applied Falkos suggestions (doc, renaming)
Aug 31, 2023
62850ee
563 LocalMoves, removed 'var' expressions and added missing braces
Aug 31, 2023
3ceb289
563 LocalMoves, refactor RecursiveMakeMoves to use value tuples
Aug 31, 2023
0f82946
563 Node, applied Falkos suggestions (doc, renaming)
Aug 31, 2023
ebfebeb
563 Rectangle, applied Falko's suggestion (doc)
Aug 31, 2023
6cdcacd
Segment, code style, doc #563
Aug 31, 2023
64e5aa8
563 Utils, applied Falko's suggestions (doc)
Aug 31, 2023
1248fee
563 Utils, removed 'var' expressions
Aug 31, 2023
1a46e36
563 IncrementalTreeMapLayout.cs, applied Falko's suggestion (renaming…
Sep 1, 2023
ee06437
563 IncrementalTreeMapLayout.cs, removed 'var' expressions, add missi…
Sep 1, 2023
37343fa
563 IncrementalTreeMapLayout.cs, new Exception in OldLayout.
Sep 1, 2023
2945706
563 LocalMoves, applied Falko's suggestion for a better evaluation ch…
Sep 1, 2023
9b15d78
563 Utils, applied Falko's suggestions (style, doc)
Sep 5, 2023
da8a1e1
Apply automated suggestions (EOF newlines and trailing whitespace)
SchrammJonas Sep 8, 2023
b45dc59
#563 Minor code improvements.
koschke Sep 18, 2023
0c0612c
Apply suggestions from code review (github-actions bot) regarding whi…
koschke Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ Assets/StreamingAssets/Videos.meta filter=lfs diff=lfs merge=lfs -text
Assets/StreamingAssets/Videos/** filter=lfs diff=lfs merge=lfs -text
Assets/Trailer/** filter=lfs diff=lfs merge=lfs -text
Assets/Resources/External/** filter=lfs diff=lfs merge=lfs -text


3 changes: 3 additions & 0 deletions Assets/Plugins/MathNet.Numerics.dll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Plugins/MathNet.Numerics.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Assets/SEE/Game/City/AbstractSEECityExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public static NodelayoutModel GetModel(this NodeLayoutKind nodeLayout)
return new NodelayoutModel(OnlyLeaves: false, CanApplySublayouts: false, InnerNodesEncloseLeafNodes: true, IsCircular: false, isHierarchical: true);
case NodeLayoutKind.Treemap:
return new NodelayoutModel(OnlyLeaves: false, CanApplySublayouts: false, InnerNodesEncloseLeafNodes: true, IsCircular: false, isHierarchical: true);
case NodeLayoutKind.IncrementalTreeMap:
return new NodelayoutModel(OnlyLeaves: false, CanApplySublayouts: false, InnerNodesEncloseLeafNodes: true, IsCircular: false, isHierarchical: true);
case NodeLayoutKind.CirclePacking:
return new NodelayoutModel(OnlyLeaves: false, CanApplySublayouts: false, InnerNodesEncloseLeafNodes: true, IsCircular: true, isHierarchical: true);
case NodeLayoutKind.Manhattan:
Expand Down
145 changes: 145 additions & 0 deletions Assets/SEE/Game/City/IncrementalTreeMapSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using SEE.Utils;
using Sirenix.OdinInspector;
using UnityEngine;

namespace SEE.Game.City
{
/// <summary>
/// The settings for <see cref="Layout.NodeLayouts.IncrementalTreeMapLayout"/>.
/// </summary>
[Serializable]
public class IncrementalTreeMapSetting : ConfigIO.PersistentConfigItem
{
/// <summary>
/// The depth of the local moves search.
/// </summary>
[SerializeField]
[Range(0, 5)]
[Tooltip("The maximal depth for local moves algorithm. Increase for higher visual quality, " +
"decrease for higher stability and to save runtime")]
public int LocalMovesDepth = 3;

/// <summary>
/// The maximal branching factor of the local moves search.
/// </summary>
[SerializeField]
[Range(1, 10)]
[Tooltip("The maximal branching factor for local moves algorithm. Increase for higher visual quality, " +
"decrease for higher stability and to save runtime")]
public int LocalMovesBranchingLimit = 4;

/// <summary>
/// Defines the specific p norm used in the local moves algorithm. See here:
/// <see cref="Layout.NodeLayouts.IncrementalTreeMap.LocalMoves.AspectRatiosPNorm"/>.
///
/// Notice:
/// The kind of p norm changes which layout is considered to have the greatest visual quality.
/// For example with p=1 (Manhattan Norm) the algorithm would
/// minimize the sum of aspect ratios, while with p=infinity (Chebyshev Norm)
/// the algorithm would minimize the maximal aspect ratio over the layout nodes.
/// The other p norms range between these extremes.
///
/// Needs therefor a mapping from <see cref="PNormRange"/> to a double value p, which is realized with the
/// property <see cref="PNorm"/>.
/// </summary>
[SerializeField]
[Tooltip("Norm for the visual quality of a set of nodes, " +
"larger p values lead to stronger penalties for larger deviations in aspect ratio of single nodes.")]
private PNormRange pNorm = PNormRange.P2Euclidean;

/// <summary>
/// The absolute padding between neighboring nodes so that they can be distinguished (in millimeters).
/// </summary>
[SerializeField]
[Range(0.1f, 100f)]
[LabelText("Padding (mm)")]
[Tooltip("The distance between two neighbour nodes in mm")]
public float PaddingMm = 5f;

/// <summary>
/// The maximal error for the method
/// <see cref="Layout.NodeLayouts.IncrementalTreeMap.CorrectAreas.GradientDecent"/> as power of 10.
/// </summary>
[SerializeField]
[Range(-7, -2)]
[LabelText("Gradient Descent Precision (10^n)")]
[Tooltip("The maximal error for the gradient descent method as power of 10")]
public int GradientDescentPrecisionExponent = -4;

/// <summary>
/// Maps <see cref="pNorm"/> to a double.
/// </summary>
public double PNorm => pNorm switch
{
(PNormRange.P1Manhattan) => 1d,
(PNormRange.P2Euclidean) => 2d,
(PNormRange.P3) => 3d,
(PNormRange.P4) => 4d,
(PNormRange.PInfinityChebyshev) => double.PositiveInfinity,
_ => throw new InvalidEnumArgumentException("Unrecognized PNormRange value.")
};

public void Save(ConfigWriter writer, string label)
{
writer.BeginGroup(label);
writer.Save(LocalMovesDepth, LocalMovesDepthLabel);
writer.Save(LocalMovesBranchingLimit, LocalMovesBranchingLimitLabel);
writer.Save(pNorm.ToString(), PNormLabel);
writer.Save(GradientDescentPrecisionExponent, GradientDescentPrecisionLabel);
writer.Save(PaddingMm, PaddingLabel);
writer.EndGroup();
}

public bool Restore(Dictionary<string, object> attributes, string label)
{
if (!attributes.TryGetValue(label, out object dictionary))
{
return false;
}
Dictionary<string, object> values = dictionary as Dictionary<string, object>;
bool result = ConfigIO.Restore(values, LocalMovesDepthLabel, ref LocalMovesDepth);
result |= ConfigIO.Restore(values, LocalMovesBranchingLimitLabel, ref LocalMovesBranchingLimit);
result |= ConfigIO.RestoreEnum(values, PNormLabel, ref pNorm);
result |= ConfigIO.Restore(values, GradientDescentPrecisionLabel, ref GradientDescentPrecisionExponent);
result |= ConfigIO.Restore(values, PaddingLabel, ref PaddingMm);
return result;
}

/// <summary>
/// Configuration label for <see cref="LocalMovesDepth"/>.
/// </summary>
private const string LocalMovesDepthLabel = "LocalMovesDepth";
/// <summary>
/// Configuration label for <see cref="LocalMovesBranchingLimit"/>.
/// </summary>
private const string LocalMovesBranchingLimitLabel = "LocalMovesBranchingLimit";
/// <summary>
/// Configuration label for <see cref="PNorm"/>.
/// </summary>
private const string PNormLabel = "PNorm";
/// <summary>
/// Configuration label for <see cref="GradientDescentPrecisionExponent"/>.
/// </summary>
private const string GradientDescentPrecisionLabel = "GradientDescentPrecision";
/// <summary>
/// Configuration label for <see cref="PaddingMm"/>.
/// </summary>
private const string PaddingLabel = "Padding";
}

/// <summary>
/// Selection of possible PNorms. Used for better access in Unity Editor for the field
/// <see cref="IncrementalTreeMapSetting.pNorm"/>.
/// </summary>
public enum PNormRange
{
P1Manhattan,
P2Euclidean,
P3,
P4,
PInfinityChebyshev,
}
}
3 changes: 3 additions & 0 deletions Assets/SEE/Game/City/IncrementalTreeMapSetting.cs.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 32bc90aa558d49f5b773a0e799a1bdbe
timeCreated: 1691856370
23 changes: 19 additions & 4 deletions Assets/SEE/Game/City/NodeLayoutAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public class NodeLayoutAttributes : LayoutSettings
/// </summary>
public NodeLayoutKind Kind = NodeLayoutKind.Balloon;

/// <summary>
/// Settings for the <see cref="SEE.Layout.NodeLayouts.IncrementalTreeMapLayout"/>.
/// </summary>
public IncrementalTreeMapSetting IncrementalTreeMapSetting = new();

/// <summary>
/// The path for the layout file containing the node layout information.
/// If the file extension is <see cref="Filenames.GVLExtension"/>, the layout is expected
Expand All @@ -24,15 +29,13 @@ public class NodeLayoutAttributes : LayoutSettings
/// data of a game object.
/// </summary>
[OdinSerialize]
public FilePath LayoutPath = new FilePath();

private const string LayoutPathLabel = "LayoutPath";

public FilePath LayoutPath = new();
public override void Save(ConfigWriter writer, string label)
{
writer.BeginGroup(label);
writer.Save(Kind.ToString(), NodeLayoutLabel);
LayoutPath.Save(writer, LayoutPathLabel);
IncrementalTreeMapSetting.Save(writer, IncrementalTreeMapLabel);
writer.EndGroup();
}

Expand All @@ -44,9 +47,21 @@ public override void Restore(Dictionary<string, object> attributes, string label

ConfigIO.RestoreEnum(values, NodeLayoutLabel, ref Kind);
LayoutPath.Restore(values, LayoutPathLabel);
IncrementalTreeMapSetting.Restore(values, IncrementalTreeMapLabel);
}
}

/// <summary>
/// Configuration label for <see cref="LayoutPath"/>.
/// </summary>
private const string LayoutPathLabel = "LayoutPath";
/// <summary>
/// Configuration label for <see cref="IncrementalTreeMapSetting"/>.
/// </summary>
private const string IncrementalTreeMapLabel = "IncrementalTreeMap";
/// <summary>
/// Configuration label for <see cref="Kind"/>.
/// </summary>
private const string NodeLayoutLabel = "NodeLayout";
}
}
1 change: 1 addition & 0 deletions Assets/SEE/Game/City/NodeLayoutKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public enum NodeLayoutKind : byte
CirclePacking,
Manhattan,
CompoundSpringEmbedder,
IncrementalTreeMap,
FromFile
}
}
14 changes: 14 additions & 0 deletions Assets/SEE/Game/Evolution/EvolutionRendererLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public partial class EvolutionRenderer
private IList<Dictionary<string, ILayoutEdge<ILayoutNode>>> EdgeLayouts { get; }
= new List<Dictionary<string, ILayoutEdge<ILayoutNode>>>();

/// <summary>
/// The last calculated <see cref="NodeLayout"/> used for <see cref="IncrementalTreeMapLayout"/>.
/// </summary>
private NodeLayout oldLayout = null;

/// <summary>
/// Creates and saves the node and edge layouts for all given <paramref name="graphs"/>. This will
/// also create all necessary game nodes and game edges-- even those game nodes and game edges
Expand Down Expand Up @@ -105,12 +110,21 @@ private void CalculateLayout(Graph graph)
gameObjects.Add(gameNode);
}

// Since incremental layouts must know the layout of the last revision
// but are also bound to the function calls of NodeLayout
// we must hand over this argument here separately
if (nodeLayout is IIncrementalNodeLayout iNodeLayout && oldLayout is IIncrementalNodeLayout iOldLayout)
{
iNodeLayout.OldLayout = iOldLayout;
}

// Calculate and apply the node layout
ICollection<LayoutGraphNode> layoutNodes = GraphRenderer.ToAbstractLayoutNodes(gameObjects);
// Note: Apply applies its results only on the layoutNodes but not on the game objects
// these layoutNodes represent. Here, we leave the game objects untouched. The layout
// must be later applied when we render a city. Here, we only store the layout for later use.
nodeLayout.Apply(layoutNodes);
oldLayout = nodeLayout;
GraphRenderer.Fit(gameObject, layoutNodes);
GraphRenderer.Stack(gameObject, layoutNodes);

Expand Down
5 changes: 5 additions & 0 deletions Assets/SEE/Game/GraphRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,11 @@ public NodeLayout GetLayout(GameObject parent) =>
NodeLayoutKind.RectanglePacking => new RectanglePackingNodeLayout(GroundLevel),
NodeLayoutKind.EvoStreets => new EvoStreetsNodeLayout(GroundLevel),
NodeLayoutKind.Treemap => new TreemapLayout(GroundLevel, parent.transform.lossyScale.x, parent.transform.lossyScale.z),
NodeLayoutKind.IncrementalTreeMap => new IncrementalTreeMapLayout(
GroundLevel,
parent.transform.lossyScale.x,
parent.transform.lossyScale.z,
Settings.NodeLayoutSettings.IncrementalTreeMapSetting),
NodeLayoutKind.Balloon => new BalloonNodeLayout(GroundLevel),
NodeLayoutKind.CirclePacking => new CirclePackingNodeLayout(GroundLevel),
NodeLayoutKind.CompoundSpringEmbedder => new CoseLayout(GroundLevel, Settings),
Expand Down
6 changes: 4 additions & 2 deletions Assets/SEE/Game/NodeRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ private float[] SelectMetrics(Node node)
else
{
Vector3 scale = GetScale(node);
if (Settings.NodeLayoutSettings.Kind == NodeLayoutKind.Treemap)
if (Settings.NodeLayoutSettings.Kind == NodeLayoutKind.Treemap
|| Settings.NodeLayoutSettings.Kind == NodeLayoutKind.IncrementalTreeMap)
{
// FIXME: This is ugly. The graph renderer should not need to care what
// kind of layout was applied.
Expand Down Expand Up @@ -351,7 +352,8 @@ public void AdjustScaleOfLeaf(GameObject gameNode)
Vector3 scale = GetScale(node);

// Scale according to the metrics.
if (Settings.NodeLayoutSettings.Kind == NodeLayoutKind.Treemap)
if (Settings.NodeLayoutSettings.Kind == NodeLayoutKind.Treemap
|| Settings.NodeLayoutSettings.Kind == NodeLayoutKind.IncrementalTreeMap)
{
// FIXME: This is ugly. The graph renderer should not need to care what
// kind of layout was applied.
Expand Down
6 changes: 6 additions & 0 deletions Assets/SEE/Layout/NodeLayouts/Cose/CoseHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ public static NodeLayout GetNodelayout(NodeLayoutKind nodeLayout, float groundLe
return new EvoStreetsNodeLayout(groundLevel);
case NodeLayoutKind.Treemap:
return new TreemapLayout(groundLevel, 1000.0f, 1000.0f);
case NodeLayoutKind.IncrementalTreeMap:
return new IncrementalTreeMapLayout(
groundLevel,
1000.0f,
1000.0f,
settings.NodeLayoutSettings.IncrementalTreeMapSetting);
case NodeLayoutKind.Balloon:
return new BalloonNodeLayout(groundLevel);
case NodeLayoutKind.CirclePacking:
Expand Down
19 changes: 19 additions & 0 deletions Assets/SEE/Layout/NodeLayouts/IIncrementalNodeLayout.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace SEE.Layout.NodeLayouts
{
/// <summary>
/// Defines the interface for incremental node layouts.
///
/// Incremental node layouts are designed for the animation of evolution
/// and each layout depends on the layout of the last revision.
///
/// This interface extends a layout by <see cref="OldLayout"/>
/// to hand over the layout of the last revision.
/// </summary>
public interface IIncrementalNodeLayout
{
/// <summary>
/// Setter for the layout of the last revision.
/// </summary>
IIncrementalNodeLayout OldLayout { set; }
}
}
11 changes: 11 additions & 0 deletions Assets/SEE/Layout/NodeLayouts/IIncrementalNodeLayout.cs.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c08a007a03783def3883f51a6fecb1b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
8 changes: 8 additions & 0 deletions Assets/SEE/Layout/NodeLayouts/IncrementalTreeMap.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3d3e0b38dff2821d59a3dde1e44d24c9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Loading
Loading