Skip to content

Commit 6012ed1

Browse files
edgardozoppipanthernet
authored andcommitted
Some minor bug fixes and improvements (#74)
* Fixing bug when casting from IMutableBidirectionalGraph<TVertex, TEdge> to TGraph. * Enabling FitButton in ZoomControl's ViewFinder.
1 parent cd4bc87 commit 6012ed1

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

GraphX.Controls/Themes/Generic.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
Orientation="Horizontal"
314314
IsEnabled="True"
315315
/>
316-
<Button IsEnabled="False" x:Name="FitButton" Command="graphx:ZoomControl.ResetZoom" ToolTip="Fit Content within Bounds" Width="20px" Height="20px" Margin="2,0" Style="{StaticResource TransparentButton}">
316+
<Button x:Name="FitButton" Command="graphx:ZoomControl.ResetZoom" ToolTip="Fit Content within Bounds" Width="20px" Height="20px" Margin="2,0" Style="{StaticResource TransparentButton}">
317317
<Image Source="{StaticResource FitContentGlyph}" Margin="2"/>
318318
</Button>
319319
<Button x:Name="FillButton" Command="graphx:ZoomControl.Fill" ToolTip="Fill Bounds with Content" Width="20px" Height="20px" Margin="2,0" Style="{StaticResource TransparentButton}">

GraphX.PCL.Logic/Models/AlgorithmFactory.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ public ILayoutAlgorithm<TVertex, TEdge, TGraph> CreateLayoutAlgorithm(LayoutAlgo
3131
if (parameters == null) parameters = CreateLayoutParameters(newAlgorithmType);
3232
var graph = iGraph.CopyToGraph<TGraph, TVertex, TEdge>();
3333

34-
var tGraph = (IMutableBidirectionalGraph<TVertex, TEdge>) graph;
35-
if (tGraph != null)
36-
{
37-
tGraph.RemoveEdgeIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
38-
tGraph.RemoveVertexIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
39-
}
34+
graph.RemoveEdgeIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
35+
graph.RemoveVertexIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
4036

4137
switch (newAlgorithmType)
4238
{
@@ -230,18 +226,18 @@ public IExternalEdgeRouting<TVertex, TEdge> CreateEdgeRoutingAlgorithm(EdgeRouti
230226
{
231227
//if (Rectangles == null) return null;
232228
if (parameters == null) parameters = CreateEdgeRoutingParameters(newAlgorithmType);
233-
IMutableBidirectionalGraph<TVertex, TEdge> graph = iGraph.CopyToBidirectionalGraph();
229+
var graph = iGraph.CopyToGraph<TGraph, TVertex, TEdge>();
234230
graph.RemoveEdgeIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
235231
graph.RemoveVertexIf(a => a.SkipProcessing == ProcessingOptionEnum.Exclude);
236232

237233
switch (newAlgorithmType)
238234
{
239235
case EdgeRoutingAlgorithmTypeEnum.SimpleER:
240-
return new SimpleEdgeRouting<TVertex, TEdge, TGraph>((TGraph)graph, positions, rectangles, parameters);
236+
return new SimpleEdgeRouting<TVertex, TEdge, TGraph>(graph, positions, rectangles, parameters);
241237
case EdgeRoutingAlgorithmTypeEnum.Bundling:
242-
return new BundleEdgeRouting<TVertex, TEdge, TGraph>(graphArea, (TGraph)graph, positions, rectangles, parameters);
238+
return new BundleEdgeRouting<TVertex, TEdge, TGraph>(graphArea, graph, positions, rectangles, parameters);
243239
case EdgeRoutingAlgorithmTypeEnum.PathFinder:
244-
return new PathFinderEdgeRouting<TVertex, TEdge, TGraph>((TGraph)graph, positions, rectangles, parameters);
240+
return new PathFinderEdgeRouting<TVertex, TEdge, TGraph>(graph, positions, rectangles, parameters);
245241
default:
246242
return null;
247243
}

0 commit comments

Comments
 (0)