Skip to content

Commit 1b086ea

Browse files
committed
2 parents 4980d30 + 269233a commit 1b086ea

File tree

15 files changed

+794
-31
lines changed

15 files changed

+794
-31
lines changed

GraphLayout/Drawing/Edge.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ public EdgeAttr Attr {
129129
/// <param name="source"> cannot be null</param>
130130
/// <param name="labelText">label can be null</param>
131131
/// <param name="target">cannot be null</param>
132-
public Edge(string source, string labelText, string target) {
132+
public Edge(string source, string labelText, string target, EdgeAttr edgeAttr= null) {
133133
if (String.IsNullOrEmpty(source) || String.IsNullOrEmpty(target))
134134
throw new InvalidOperationException("Creating an edge with null or empty source or target IDs");
135135
this.source = source;
136136
this.target = target;
137137

138-
this.attr = new EdgeAttr();
138+
this.attr = edgeAttr?? new EdgeAttr();
139139
if (!String.IsNullOrEmpty(labelText))
140140
{
141141
Label = new Label(labelText) {Owner = this};
@@ -148,8 +148,8 @@ public Edge(string source, string labelText, string target) {
148148
/// <param name="sourceNode"></param>
149149
/// <param name="targetNode"></param>
150150
/// <param name="connection">controls is the edge will be connected to the graph</param>
151-
public Edge(Node sourceNode, Node targetNode, ConnectionToGraph connection)
152-
: this(sourceNode.Id, null, targetNode.Id) {
151+
public Edge(Node sourceNode, Node targetNode, ConnectionToGraph connection, EdgeAttr edgeAttr = null)
152+
: this(sourceNode.Id, null, targetNode.Id, edgeAttr) {
153153
this.SourceNode = sourceNode;
154154
this.TargetNode = targetNode;
155155
if (connection == ConnectionToGraph.Connected) {

GraphLayout/Drawing/LayoutEditing/LayoutEditor.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ public UndoRedoAction CurrentUndoAction {
228228
get { return geomGraphEditor.UndoMode ? geomGraphEditor.CurrentUndoAction : geomGraphEditor.CurrentRedoAction; }
229229
}
230230

231-
231+
public EdgeAttr EdgeAttr { get => edgeAttr; set => edgeAttr = value; }
232+
233+
232234
/// <summary>
233235
/// signals that there is a change in the undo/redo list
234236
/// There are four possibilities: Undo(Redo) becomes available (unavailable)
@@ -895,7 +897,7 @@ void HandleMouseUpOnLayoutEnabled(MsaglMouseEventArgs args) {
895897
SourceOfInsertedEdge = TargetOfInsertedEdge = null;
896898
SourcePort = TargetPort = null;
897899
}
898-
900+
EdgeAttr edgeAttr = new EdgeAttr();
899901
void InsertEdgeOnMouseUp() {
900902
if (DraggingStraightLine()) {
901903
viewer.StopDrawingRubberLine();
@@ -928,7 +930,7 @@ void InsertEdgeOnMouseUp() {
928930

929931
void AddEdge() {
930932
var drawingEdge = new Edge(SourceOfInsertedEdge.DrawingObject as Node,
931-
TargetOfInsertedEdge.DrawingObject as Node, ConnectionToGraph.Disconnected);
933+
TargetOfInsertedEdge.DrawingObject as Node, ConnectionToGraph.Disconnected, this.EdgeAttr.Clone());
932934
var geomEdge = new Core.Layout.Edge(GeometryNode(SourceOfInsertedEdge),
933935
GeometryNode(TargetOfInsertedEdge)) {EdgeGeometry = EdgeGeometry};
934936
drawingEdge.GeometryEdge = geomEdge;
@@ -941,11 +943,16 @@ void AddEdge() {
941943
}
942944

943945
void FinishRoutingEdge() {
946+
EdgeGeometry.SourceArrowhead = this.EdgeAttr.ArrowheadAtSource != ArrowStyle.None ? new Arrowhead() { Length = this.EdgeAttr.ArrowheadLength } : null;
947+
948+
EdgeGeometry.TargetArrowhead = this.EdgeAttr.ArrowheadAtTarget != ArrowStyle.None ? new Arrowhead() { Length = this.EdgeAttr.ArrowheadLength } : null;
949+
944950
if (TargetOfInsertedEdge != SourceOfInsertedEdge) {
945951
InteractiveEdgeRouter.TryToRemoveInflectionsAndCollinearSegments(EdgeGeometry.SmoothedPolyline);
946952
InteractiveEdgeRouter.SmoothCorners(EdgeGeometry.SmoothedPolyline);
947953
EdgeGeometry.Curve = EdgeGeometry.SmoothedPolyline.CreateCurve();
948-
EdgeGeometry.TargetArrowhead = new Arrowhead();
954+
955+
949956
Arrowheads.TrimSplineAndCalculateArrowheads(EdgeGeometry,
950957
GeometryNode(SourceOfInsertedEdge).BoundaryCurve,
951958
GeometryNode(TargetOfInsertedEdge).BoundaryCurve,

GraphLayout/GraphLayout.sln

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "agl", "tools\agl\agl.csproj
106106
EndProject
107107
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PopulateGViewerWithPrecalculatedDrawingGraph", "Samples\PopulateGViewerWithPrecalculatedDrawingGraph\PopulateGViewerWithPrecalculatedDrawingGraph.csproj", "{02053710-70B8-4CEB-80DB-DC55BEDAA2C0}"
108108
EndProject
109-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrawingFromGeometryWithGtk", "Samples\DrawingFromGeometryWithGtk\DrawingFromGeometryWithGtk.csproj", "{AA8D2135-1BD2-47DD-9DC9-2FC266711536}"
109+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawingFromGeometryWithGtk", "Samples\DrawingFromGeometryWithGtk\DrawingFromGeometryWithGtk.csproj", "{AA8D2135-1BD2-47DD-9DC9-2FC266711536}"
110+
EndProject
111+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdgeDirectionTest", "Samples\EdgeDirectionTest\EdgeDirectionTest.csproj", "{02EAF869-FB5A-40BD-AD78-92E193946B5D}"
110112
EndProject
111113
Global
112114
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1022,6 +1024,26 @@ Global
10221024
{AA8D2135-1BD2-47DD-9DC9-2FC266711536}.Release|x64.Build.0 = Release|Any CPU
10231025
{AA8D2135-1BD2-47DD-9DC9-2FC266711536}.Release|x86.ActiveCfg = Release|Any CPU
10241026
{AA8D2135-1BD2-47DD-9DC9-2FC266711536}.Release|x86.Build.0 = Release|Any CPU
1027+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1028+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
1029+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|ARM.ActiveCfg = Debug|Any CPU
1030+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|ARM.Build.0 = Debug|Any CPU
1031+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
1032+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|ARM64.Build.0 = Debug|Any CPU
1033+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|x64.ActiveCfg = Debug|Any CPU
1034+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|x64.Build.0 = Debug|Any CPU
1035+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|x86.ActiveCfg = Debug|Any CPU
1036+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Debug|x86.Build.0 = Debug|Any CPU
1037+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
1038+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|Any CPU.Build.0 = Release|Any CPU
1039+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|ARM.ActiveCfg = Release|Any CPU
1040+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|ARM.Build.0 = Release|Any CPU
1041+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|ARM64.ActiveCfg = Release|Any CPU
1042+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|ARM64.Build.0 = Release|Any CPU
1043+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x64.ActiveCfg = Release|Any CPU
1044+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x64.Build.0 = Release|Any CPU
1045+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x86.ActiveCfg = Release|Any CPU
1046+
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x86.Build.0 = Release|Any CPU
10251047
EndGlobalSection
10261048
GlobalSection(SolutionProperties) = preSolution
10271049
HideSolutionNode = FALSE
@@ -1070,6 +1092,7 @@ Global
10701092
{1E85BCE2-6C50-4148-B4AE-B873BFDE77CE} = {9E51C177-3DF6-474E-AC7A-ED036ED32F05}
10711093
{02053710-70B8-4CEB-80DB-DC55BEDAA2C0} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
10721094
{AA8D2135-1BD2-47DD-9DC9-2FC266711536} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
1095+
{02EAF869-FB5A-40BD-AD78-92E193946B5D} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
10731096
EndGlobalSection
10741097
GlobalSection(ExtensibilityGlobals) = postSolution
10751098
SolutionGuid = {0D81D757-911D-4F8B-A4B3-4C4F1CBD5B60}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{02EAF869-FB5A-40BD-AD78-92E193946B5D}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>EdgeDirectionTest</RootNamespace>
10+
<AssemblyName>EdgeDirectionTest</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Data.DataSetExtensions" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Deployment" />
43+
<Reference Include="System.Drawing" />
44+
<Reference Include="System.Net.Http" />
45+
<Reference Include="System.Windows.Forms" />
46+
<Reference Include="System.Xml" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Compile Include="Form1.cs">
50+
<SubType>Form</SubType>
51+
</Compile>
52+
<Compile Include="Form1.Designer.cs">
53+
<DependentUpon>Form1.cs</DependentUpon>
54+
</Compile>
55+
<Compile Include="Program.cs" />
56+
<Compile Include="Properties\AssemblyInfo.cs" />
57+
<EmbeddedResource Include="Form1.resx">
58+
<DependentUpon>Form1.cs</DependentUpon>
59+
<SubType>Designer</SubType>
60+
</EmbeddedResource>
61+
<EmbeddedResource Include="Properties\Resources.resx">
62+
<Generator>ResXFileCodeGenerator</Generator>
63+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
64+
<SubType>Designer</SubType>
65+
</EmbeddedResource>
66+
<Compile Include="Properties\Resources.Designer.cs">
67+
<AutoGen>True</AutoGen>
68+
<DependentUpon>Resources.resx</DependentUpon>
69+
</Compile>
70+
<None Include="Properties\Settings.settings">
71+
<Generator>SettingsSingleFileGenerator</Generator>
72+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
73+
</None>
74+
<Compile Include="Properties\Settings.Designer.cs">
75+
<AutoGen>True</AutoGen>
76+
<DependentUpon>Settings.settings</DependentUpon>
77+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
78+
</Compile>
79+
</ItemGroup>
80+
<ItemGroup>
81+
<None Include="App.config" />
82+
</ItemGroup>
83+
<ItemGroup>
84+
<ProjectReference Include="..\..\Drawing\AutomaticGraphLayout.Drawing.csproj">
85+
<Project>{b76f8f71-4b00-4242-be36-c9f0732511f7}</Project>
86+
<Name>AutomaticGraphLayout.Drawing</Name>
87+
</ProjectReference>
88+
<ProjectReference Include="..\..\MSAGL\AutomaticGraphLayout.csproj">
89+
<Project>{415d3e3f-7105-46c1-84d2-7ecb34213d92}</Project>
90+
<Name>AutomaticGraphLayout</Name>
91+
</ProjectReference>
92+
<ProjectReference Include="..\..\Tools\GraphViewerGDI\GraphViewerGDI.csproj">
93+
<Project>{725cd2cb-cf37-414e-a5a6-f1d87d4d6ede}</Project>
94+
<Name>GraphViewerGDI</Name>
95+
</ProjectReference>
96+
</ItemGroup>
97+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
98+
</Project>

GraphLayout/Samples/EdgeDirectionTest/Form1.Designer.cs

Lines changed: 111 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)