Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Editor live
Ocultar espaços em branco
Recolher inalteradas
Sem quebra de linha
Layout
Dividido
Unificado
Nível de detalhe
Inteligente
Palavra
Caractere
Estilos de texto
Alterar aparência
Realce de sintaxe
Escolher sintaxe
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
autocomplete vs manual
Criado
ano passado
O diff nunca expira
Limpar
Exportar
Compartilhar
Explicar
13 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
39 linhas
Copiar tudo
63 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
87 linhas
Copiar tudo
Copiar
Copiado
Copiar
Copiado
internal static List<GraphLayout.Graph> DoGraphAutoLayout
(this WorkspaceModel workspace
)
/// <summary>
/// This function wraps a few methods on the workspace model layer
/// to set up and run the graph layout algorithm.
/// </summary>
/// <param name="workspace">Workspace on which graph layout will be performed.</param>
/// <param name="originalNodeGUID"></param>
/// <param name="newNodes"></param>
/// <param name="misplacedNodes"></param>
/// <param name="portType"></param>
internal static List<GraphLayout.Graph> DoGraphAutoLayout
Autocomplete
(this WorkspaceModel workspace
,
Guid originalNodeGUID,
IEnumerable<NodeModel> newNodes,
IEnumerable<NodeModel> misplacedNodes, PortType portType)
{
{
if (workspace.Nodes.Count() < 2) return null;
if (workspace.Nodes.Count() < 2) return null;
Copiar
Copiado
Copiar
Copiado
var selection = DynamoSelection.Instance.Selection;
const bool isGroupLayout = false;
// Check if all the selected models are groups
bool isGroupLayout = selection.Count > 0 &&
selection.All(x => x is AnnotationModel ||
selection.OfType<AnnotationModel>().Any(g => g.Nodes.Contains(x)));
List<GraphLayout.Graph> layoutSubgraphs;
List<GraphLayout.Graph> layoutSubgraphs;
List<List<GraphLayout.Node>> subgraphClusters;
List<List<GraphLayout.Node>> subgraphClusters;
GenerateCombinedGraph(workspace, isGroupLayout, out layoutSubgraphs, out subgraphClusters);
GenerateCombinedGraph(workspace, isGroupLayout, out layoutSubgraphs, out subgraphClusters);
Copiar
Copiado
Copiar
Copiado
//only record graph layout undo when it is not node autocomplete
var misplacedGuidSet = misplacedNodes.Select(x => x.GUID).ToHashSet();
RecordUndoGraphLayout(workspace, isGroupLayout, false);
foreach (var node in layoutSubgraphs.First().Nodes)
{
//this is a virtual IsSelected - it doesnt change the workspace node models but marks it as touchable to the algorithm
node.IsSelected = node.Id == originalNodeGUID || misplacedGuidSet.Contains(node.Id);
}
// Generate subgraphs separately for each cluster
// Generate subgraphs separately for each cluster
subgraphClusters.ForEach(
subgraphClusters.ForEach(
x => GenerateSeparateSubgraphs(new HashSet<GraphLayout.Node>(x), layoutSubgraphs));
x => GenerateSeparateSubgraphs(new HashSet<GraphLayout.Node>(x), layoutSubgraphs));
// Deselect all nodes
// Deselect all nodes
subgraphClusters.ForEach(c => c.ForEach(x => x.IsSelected = false));
subgraphClusters.ForEach(c => c.ForEach(x => x.IsSelected = false));
var activeComponents = layoutSubgraphs.Skip(1).ToList();
var activeComponents = layoutSubgraphs.Skip(1).ToList();
Copiar
Copiado
Copiar
Copiado
var targetSubgraph = activeComponents.FirstOrDefault(x => x.Nodes.Any(x => x.Id == originalNodeGUID));
var targetNode = targetSubgraph.Nodes.First(x => x.Id == originalNodeGUID);
// Run layout algorithm for each subgraph
// Run layout algorithm for each subgraph
activeComponents.ForEach(g => RunLayoutSubgraph(g, isGroupLayout));
activeComponents.ForEach(g => RunLayoutSubgraph(g, isGroupLayout));
Copiar
Copiado
Copiar
Copiado
AvoidSubgraphOverlap(layoutSubgraphs);
//original node shouldn't move: move others around
var diffX = targetNode.X - targetNode.InitialX;
var diffY = targetNode.Y - targetNode.InitialY;
foreach (var relatedNode in targetSubgraph.Nodes)
{
relatedNode.X -= diffX;
relatedNode.Y -= diffY;
}
Copiar
Copiado
Copiar
Copiado
SaveLayoutGraph(workspace, layoutSubgraphs);
if (portType == PortType.Output)
{
double minX = double.MaxValue;
foreach (var relatedNode in targetSubgraph.Nodes)
{
if (newNodes.Any(x => x.GUID == relatedNode.Id))
{
minX = Math.Min(minX, relatedNode.X);
}
}
double targetMinX = targetNode.X + targetNode.Width + GraphLayout.Graph.HorizontalNodeDistance;
var displacement = minX == double.MaxValue ? 0 : targetMinX - minX;
Copiar
Copiado
Copiar
Copiado
// Restore the workspace model selection information
foreach (var relatedNode in targetSubgraph.Nodes)
selection.ToList().ForEach(x => x.Select());
{
if (newNodes.Any(x => x.GUID == relatedNode.Id))
{
relatedNode.X += displacement;
}
}
}
// right now cluster nodes only work on outputs, single nodes dont need to be relayouted as above
AvoidSubgraphOverlap(layoutSubgraphs, originalNodeGUID);
var maybeUpdateSet = workspace.Nodes.Any(x => x.IsTransient) ?
workspace.Nodes.Where(x => x.GUID == originalNodeGUID || misplacedGuidSet.Contains(x.GUID)) :
workspace.Nodes;
SaveLayoutGraphForNodeAutoComplete(workspace, maybeUpdateSet.ToList(), layoutSubgraphs, originalNodeGUID);
return layoutSubgraphs;
return layoutSubgraphs;
}
}
Diferenças salvas
Texto original
Abrir arquivo
internal static List<GraphLayout.Graph> DoGraphAutoLayout(this WorkspaceModel workspace) { if (workspace.Nodes.Count() < 2) return null; var selection = DynamoSelection.Instance.Selection; // Check if all the selected models are groups bool isGroupLayout = selection.Count > 0 && selection.All(x => x is AnnotationModel || selection.OfType<AnnotationModel>().Any(g => g.Nodes.Contains(x))); List<GraphLayout.Graph> layoutSubgraphs; List<List<GraphLayout.Node>> subgraphClusters; GenerateCombinedGraph(workspace, isGroupLayout, out layoutSubgraphs, out subgraphClusters); //only record graph layout undo when it is not node autocomplete RecordUndoGraphLayout(workspace, isGroupLayout, false); // Generate subgraphs separately for each cluster subgraphClusters.ForEach( x => GenerateSeparateSubgraphs(new HashSet<GraphLayout.Node>(x), layoutSubgraphs)); // Deselect all nodes subgraphClusters.ForEach(c => c.ForEach(x => x.IsSelected = false)); var activeComponents = layoutSubgraphs.Skip(1).ToList(); // Run layout algorithm for each subgraph activeComponents.ForEach(g => RunLayoutSubgraph(g, isGroupLayout)); AvoidSubgraphOverlap(layoutSubgraphs); SaveLayoutGraph(workspace, layoutSubgraphs); // Restore the workspace model selection information selection.ToList().ForEach(x => x.Select()); return layoutSubgraphs; }
Texto alterado
Abrir arquivo
/// <summary> /// This function wraps a few methods on the workspace model layer /// to set up and run the graph layout algorithm. /// </summary> /// <param name="workspace">Workspace on which graph layout will be performed.</param> /// <param name="originalNodeGUID"></param> /// <param name="newNodes"></param> /// <param name="misplacedNodes"></param> /// <param name="portType"></param> internal static List<GraphLayout.Graph> DoGraphAutoLayoutAutocomplete(this WorkspaceModel workspace, Guid originalNodeGUID, IEnumerable<NodeModel> newNodes, IEnumerable<NodeModel> misplacedNodes, PortType portType) { if (workspace.Nodes.Count() < 2) return null; const bool isGroupLayout = false; List<GraphLayout.Graph> layoutSubgraphs; List<List<GraphLayout.Node>> subgraphClusters; GenerateCombinedGraph(workspace, isGroupLayout, out layoutSubgraphs, out subgraphClusters); var misplacedGuidSet = misplacedNodes.Select(x => x.GUID).ToHashSet(); foreach (var node in layoutSubgraphs.First().Nodes) { //this is a virtual IsSelected - it doesnt change the workspace node models but marks it as touchable to the algorithm node.IsSelected = node.Id == originalNodeGUID || misplacedGuidSet.Contains(node.Id); } // Generate subgraphs separately for each cluster subgraphClusters.ForEach( x => GenerateSeparateSubgraphs(new HashSet<GraphLayout.Node>(x), layoutSubgraphs)); // Deselect all nodes subgraphClusters.ForEach(c => c.ForEach(x => x.IsSelected = false)); var activeComponents = layoutSubgraphs.Skip(1).ToList(); var targetSubgraph = activeComponents.FirstOrDefault(x => x.Nodes.Any(x => x.Id == originalNodeGUID)); var targetNode = targetSubgraph.Nodes.First(x => x.Id == originalNodeGUID); // Run layout algorithm for each subgraph activeComponents.ForEach(g => RunLayoutSubgraph(g, isGroupLayout)); //original node shouldn't move: move others around var diffX = targetNode.X - targetNode.InitialX; var diffY = targetNode.Y - targetNode.InitialY; foreach (var relatedNode in targetSubgraph.Nodes) { relatedNode.X -= diffX; relatedNode.Y -= diffY; } if (portType == PortType.Output) { double minX = double.MaxValue; foreach (var relatedNode in targetSubgraph.Nodes) { if (newNodes.Any(x => x.GUID == relatedNode.Id)) { minX = Math.Min(minX, relatedNode.X); } } double targetMinX = targetNode.X + targetNode.Width + GraphLayout.Graph.HorizontalNodeDistance; var displacement = minX == double.MaxValue ? 0 : targetMinX - minX; foreach (var relatedNode in targetSubgraph.Nodes) { if (newNodes.Any(x => x.GUID == relatedNode.Id)) { relatedNode.X += displacement; } } } // right now cluster nodes only work on outputs, single nodes dont need to be relayouted as above AvoidSubgraphOverlap(layoutSubgraphs, originalNodeGUID); var maybeUpdateSet = workspace.Nodes.Any(x => x.IsTransient) ? workspace.Nodes.Where(x => x.GUID == originalNodeGUID || misplacedGuidSet.Contains(x.GUID)) : workspace.Nodes; SaveLayoutGraphForNodeAutoComplete(workspace, maybeUpdateSet.ToList(), layoutSubgraphs, originalNodeGUID); return layoutSubgraphs; }
Encontrar Diferença