diff --git a/cgi-bin/GraphOffline/Win/GraphCGI.exe b/cgi-bin/GraphOffline/Win/GraphCGI.exe index 9d149bb..3a917e4 100644 Binary files a/cgi-bin/GraphOffline/Win/GraphCGI.exe and b/cgi-bin/GraphOffline/Win/GraphCGI.exe differ diff --git a/lang/de/home.php b/lang/de/home.php index 15b2429..0c7cb29 100644 --- a/lang/de/home.php +++ b/lang/de/home.php @@ -221,4 +221,13 @@ $g_lang['selected_index'] = "Selection group"; $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> diff --git a/lang/el/home.php b/lang/el/home.php index 51a056e..40c8759 100644 --- a/lang/el/home.php +++ b/lang/el/home.php @@ -259,4 +259,13 @@ $g_lang['selected_index'] = "Selection group"; $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> diff --git a/lang/en/home.php b/lang/en/home.php index 508e1c6..7cdd514 100755 --- a/lang/en/home.php +++ b/lang/en/home.php @@ -258,4 +258,13 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit"; $g_lang['selected_index'] = "Selection group"; $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> diff --git a/lang/es/home.php b/lang/es/home.php index 6c2e4a4..95eea5a 100755 --- a/lang/es/home.php +++ b/lang/es/home.php @@ -258,4 +258,13 @@ Tenemos traducciones en griego 🇬🇷. diff --git a/lang/fr/home.php b/lang/fr/home.php index 9306fc8..e325645 100644 --- a/lang/fr/home.php +++ b/lang/fr/home.php @@ -226,4 +226,13 @@ $g_lang['selected_index'] = "Selection group"; $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> \ No newline at end of file diff --git a/lang/nl/home.php b/lang/nl/home.php index f7b5f2d..aadeb06 100644 --- a/lang/nl/home.php +++ b/lang/nl/home.php @@ -222,5 +222,14 @@ $g_lang['edge_width'] = "Edge width"; $g_lang['selected_index'] = "Selection group"; - $g_lang['all'] = "All"; + $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> diff --git a/lang/pt/home.php b/lang/pt/home.php index f6dfdd1..a7933d3 100644 --- a/lang/pt/home.php +++ b/lang/pt/home.php @@ -224,4 +224,13 @@ $g_lang['selected_index'] = "Selection group"; $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> diff --git a/lang/ru/home.php b/lang/ru/home.php index b72a7f3..7ad5da8 100755 --- a/lang/ru/home.php +++ b/lang/ru/home.php @@ -259,4 +259,13 @@ $g_lang['selected_index'] = "Группа выделения"; $g_lang['all'] = "Все"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Поиск всех путей"; + $g_lang['number_of_pathes_from'] = "Количество путей из "; + $g_lang['to'] = " в "; + $g_lang['are'] = " равно "; + $g_lang['path_n'] = "Путь №"; + $g_lang['selected_finish_vertex'] = "Выделите конечную вершину"; + $g_lang['selected_start_vertex'] = "Выделите начальную вершину"; ?> diff --git a/lang/sv/home.php b/lang/sv/home.php index f7a5187..ee7aa28 100644 --- a/lang/sv/home.php +++ b/lang/sv/home.php @@ -220,4 +220,13 @@ $g_lang['selected_index'] = "Selection group"; $g_lang['all'] = "All"; + + //FindAllPatches.js + $g_lang['find_all_pathes'] = "Find all pathes"; + $g_lang['number_of_pathes_from'] = "Number of pathes from "; + $g_lang['to'] = " to "; + $g_lang['are'] = " are "; + $g_lang['path_n'] = "Path #"; + $g_lang['selected_finish_vertex'] = "Select finish vertex"; + $g_lang['selected_start_vertex'] = "Select start vertex"; ?> diff --git a/script/plugins/FindAllPatches.js b/script/plugins/FindAllPatches.js new file mode 100644 index 0000000..3c5731c --- /dev/null +++ b/script/plugins/FindAllPatches.js @@ -0,0 +1,209 @@ +/** + * Find short path. + * + */ +function FindAllPathes(graph, app) +{ + BaseAlgorithmEx.apply(this, arguments); + this.message = g_selectStartVertex; + this.selectedObjects = {}; + this.foundSubGraphs = {}; + this.nSubgraphIndex = 0; + this.nSubGraphCount = 0; +} + + +// inheritance. +FindAllPathes.prototype = Object.create(BaseAlgorithmEx.prototype); +// First selected. +FindAllPathes.prototype.firstObject = null; +// Second selected. +FindAllPathes.prototype.secondObject = null; +// Path +FindAllPathes.prototype.pathObjects = null; +// Infinity +FindAllPathes.prototype.infinityValue = 1E9 - 1; + +FindAllPathes.prototype.getName = function(local) +{ + return g_findAllPathes; +} + +FindAllPathes.prototype.getId = function() +{ + return "Abin.FindAllPathes"; +} + +// @return message for user. +FindAllPathes.prototype.getMessage = function(local) +{ + return this.message; +} + +FindAllPathes.prototype.result = function(resultCallback) +{ + if (this.firstObject && this.secondObject) + { + this.outResultCallback = function (result ) { resultCallback(result); }; + self = this; + this.CalculateAlgorithm("prnpaths=cgiInput&start=" + this.firstObject.id + "&finish=" + this.secondObject.id + "&report=xml", function (pathObjects, properties, results) + { + self.resultCallback(pathObjects, properties, results); + }); + } + return null; +} + +FindAllPathes.prototype.setResultMessage = function() +{ + if (this.nSubGraphCount > 0) + { + this.message = g_numberOfPathesFrom + this.firstObject.mainText + + g_to + this.secondObject.mainText + g_are + + this.nSubGraphCount + " "; + } + else + { + this.message = g_pathNotExists; + } +} + +FindAllPathes.prototype.resultCallback = function(pathObjects, properties, results) +{ + var outputResult = {}; + outputResult["version"] = 1; + outputResult["minPath"] = true; + + this.pathObjects = pathObjects; + this.properties = properties; + + var bFound = results.length > 0 && results[0].value < this.infinityValue && (results[0].type == 1 || results[0].type == 2); + + if (bFound) + { + this.nSubGraphCount = results.length > 0 && results[0].type == 1 ? results[0].value : 0; + + this.setResultMessage(); + + this.foundSubGraphs = {}; + for (var i = 0; i < this.nSubGraphCount; i++) + { + this.foundSubGraphs[i] = {}; + } + + var subGraphIndex = 0; + var prevNodeId = -1; + for (var i = 0; i < results.length; i++) + { + if (results[i].type == 6) + { + subGraphIndex++; + prevNodeId = -1; + } + + if (results[i].type == 4) + { + var nodeId = parseInt(results[i].value); + var index = subGraphIndex; + var subgGraph = this.foundSubGraphs[index]; + subgGraph[nodeId] = true; + + if (prevNodeId >= 0) + { + var edgeObject = this.graph.FindEdgeMin(prevNodeId, nodeId); + subgGraph[edgeObject.id] = true; + } + prevNodeId = nodeId; + } + } + } + else + { + this.secondObject = null; + this.firstObject = null; + this.message = g_pathNotExists; + } + + this.outResultCallback(outputResult); +} + +FindAllPathes.prototype.messageWasChanged = function() +{ + var self = this; + + if ($('#enumSubgraphs')) + { + for (var i = 0; i < this.nSubGraphCount; i++) + { + $('#enumSubgraphs').append(""); + } + + $('#enumSubgraphs').change(function () { + self.nSubgraphIndex = $('#enumSubgraphs').val(); + self.app.redrawGraph(); + self.setResultMessage(); + }); + } +} + +FindAllPathes.prototype.selectVertex = function(vertex) +{ + this.pathObjects = null; + this.shortDist = null; + + if (this.firstObject) + { + this.message = g_processing; + this.secondObject = vertex; + this.selectedObjects = []; + } + else + { + this.firstObject = vertex; + this.secondObject = null; + this.selectedObjects = {}; + this.message = g_selectFinishVertex; + } + + return true; +} + +FindAllPathes.prototype.deselectAll = function() +{ + this.firstObject = null; + this.secondObject = null; + this.selectedObjects = {}; + this.foundSubGraphs = {}; + this.nSubgraphIndex = 0; + this.nSubGraphCount = 0; + this.message = g_selectStartVertex; + return true; +} + +FindAllPathes.prototype.instance = function() +{ + return false; +} + +FindAllPathes.prototype.getObjectSelectedGroup = function(object) +{ + return (this.nSubgraphIndex in this.foundSubGraphs && object.id in this.foundSubGraphs[this.nSubgraphIndex]) ? 1 : + (object.id in this.selectedObjects) ? this.selectedObjects[object.id] : ((object == this.firstObject || object == object.secondObject) ? 1 : 0); +} + +FindAllPathes.prototype.getPriority = function() +{ + return -9.4; +} + + +// Factory for connected components. +function CreateFindAllPathes(graph, app) +{ + return new FindAllPathes(graph, app) +} + +// Gerister connected component. +RegisterAlgorithm (CreateFindAllPathes); diff --git a/script/plugins/MinimumSpanningTree.js b/script/plugins/MinimumSpanningTree.js index 01bdfb6..8c354cd 100755 --- a/script/plugins/MinimumSpanningTree.js +++ b/script/plugins/MinimumSpanningTree.js @@ -146,7 +146,7 @@ MinimumSpanningTree.prototype.getObjectSelectedGroup = function(object) MinimumSpanningTree.prototype.getPriority = function() { - return -9.5; + return -9.3; } // Algorithm support multi graph diff --git a/script/texts.js b/script/texts.js index 58464ca..fd0a0d0 100644 --- a/script/texts.js +++ b/script/texts.js @@ -170,6 +170,15 @@ var g_selectedEdgeStyle = "Selected Edge Style"; var g_commonVertexStyle = "Common Vertex Style"; var g_selectedVertexStyle = "Selected Vertex Style"; +// FindAllPatches.js +var g_findAllPathes = "Find all pathes"; +var g_numberOfPathesFrom = "Number of pathes from " +var g_to = " to "; +var g_are = " are "; +var g_pathN = "Path #"; +var g_selectFinishVertex = "Select finish vertex"; +var g_selectStartVertex = "Select start vertex"; + function loadTexts() { g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML; @@ -347,4 +356,13 @@ function loadTexts() g_selectedEdgeStyle = document.getElementById("SelectedEdgeStyleText").innerHTML; g_commonVertexStyle = document.getElementById("CommonVertexStyleText").innerHTML; g_selectedVertexStyle = document.getElementById("SelectedVertexStyleText").innerHTML; + + // FindAllPatches.js + g_findAllPathes = document.getElementById("FindAllPathes").innerHTML; + g_numberOfPathesFrom = document.getElementById("NumberOfPathesFrom").innerHTML; + g_to = document.getElementById("To").innerHTML; + g_are = document.getElementById("Are").innerHTML; + g_pathN = document.getElementById("PathN").innerHTML; + g_selectFinishVertex = document.getElementById("SelectFinishVertex").innerHTML; + g_selectStartVertex = document.getElementById("SelectStartVertex").innerHTML; } diff --git a/tpl/home.php b/tpl/home.php index 515999f..442f2e0 100755 --- a/tpl/home.php +++ b/tpl/home.php @@ -10,7 +10,7 @@ - + +

+

+

+

+

+

+