mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 23:36:00 +00:00
Add special actions for edges.
This commit is contained in:
parent
18eac65c92
commit
194715260d
@ -280,4 +280,9 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
|
|||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -279,5 +279,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -242,5 +242,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -280,5 +280,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -279,5 +279,10 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -279,5 +279,10 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -247,5 +247,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -244,5 +244,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -245,5 +245,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -280,5 +280,11 @@
|
|||||||
$g_lang['use_context_menu'] = "Используйте контекстное меню для дополнительных действий.";
|
$g_lang['use_context_menu'] = "Используйте контекстное меню для дополнительных действий.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Поиск самого длинного пути";
|
$g_lang['find_longest_path'] = "Поиск самого длинного пути";
|
||||||
$g_lang['length_of_longest_path_from'] = "Длина самого длинного пути ровна ";
|
$g_lang['length_of_longest_path_from'] = "Длина самого длинного пути ровна ";
|
||||||
|
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Особые действия";
|
||||||
|
$g_lang['reverse_all_edges'] = "Поменять направление всех дуг";
|
||||||
|
$g_lang['make_all_undirected'] = "Сделать все дуги неориентированными";
|
||||||
|
$g_lang['make_all_directed'] = "Сделать все дуги ориентированными";
|
||||||
?>
|
?>
|
||||||
|
@ -241,5 +241,10 @@
|
|||||||
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
$g_lang['use_context_menu'] = "Use context menu for additional actions.";
|
||||||
|
|
||||||
$g_lang['find_longest_path'] = "Find the longest path";
|
$g_lang['find_longest_path'] = "Find the longest path";
|
||||||
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
$g_lang['length_of_longest_path_from'] = "Length of the longest path from ";
|
||||||
|
|
||||||
|
$g_lang['additionl_actions'] = "Special actions";
|
||||||
|
$g_lang['reverse_all_edges'] = "Reverse all edges";
|
||||||
|
$g_lang['make_all_undirected'] = "Make all edges undirected";
|
||||||
|
$g_lang['make_all_directed'] = "Make all edges directed";
|
||||||
?>
|
?>
|
||||||
|
@ -1035,6 +1035,8 @@ ConnectionGraphHandler.prototype.SelectVertex = function(selectedObject)
|
|||||||
|
|
||||||
ConnectionGraphHandler.prototype.MouseDown = function(pos)
|
ConnectionGraphHandler.prototype.MouseDown = function(pos)
|
||||||
{
|
{
|
||||||
|
$('#message').unbind();
|
||||||
|
|
||||||
var selectedObject = this.GetSelectedGraph(pos);
|
var selectedObject = this.GetSelectedGraph(pos);
|
||||||
if (selectedObject && (selectedObject instanceof BaseVertex))
|
if (selectedObject && (selectedObject instanceof BaseVertex))
|
||||||
{
|
{
|
||||||
@ -1055,7 +1057,55 @@ ConnectionGraphHandler.prototype.GetSelectedGroup = function(object)
|
|||||||
ConnectionGraphHandler.prototype.SelectFirst = function()
|
ConnectionGraphHandler.prototype.SelectFirst = function()
|
||||||
{
|
{
|
||||||
this.firstObject = null;
|
this.firstObject = null;
|
||||||
|
|
||||||
|
let hasEdges = this.app.graph.hasEdges();
|
||||||
|
let hasDirectedEdges = this.app.graph.hasDirectEdge();
|
||||||
|
let hasUndirectedEdges = this.app.graph.hasUndirectEdge();
|
||||||
|
|
||||||
this.message = g_selectFisrtVertexToConnect + this.GetSelect2VertexMenu();
|
this.message = g_selectFisrtVertexToConnect + this.GetSelect2VertexMenu();
|
||||||
|
|
||||||
|
if (!hasEdges) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.message =
|
||||||
|
". <div class=\"btn-group\" style=\"float:right; position: relative; margin-left: 8px\">"
|
||||||
|
+ "<button type=\"button\" class=\"btn btn-default btn-sm dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">"
|
||||||
|
+ g_additionlActions + " <span class=\"caret\"></span>"
|
||||||
|
+ " </button> "
|
||||||
|
+ "<ul class=\"dropdown-menu dropdown-menu-right\" style=\"z-index:15; position: absolute;\">"
|
||||||
|
+ (hasDirectedEdges ? " <li><a href=\"#\" id=\"reverseAll\">" + g_reverseAllEdges + "</a></li>" : "")
|
||||||
|
+ (hasDirectedEdges ? " <li><a href=\"#\" id=\"makeAllUndirected\">" + g_makeAllUndirected + "</a></li>" : "")
|
||||||
|
+ (hasUndirectedEdges ? " <li><a href=\"#\" id=\"makeAllDirected\">" + g_makeAllDirected + "</a></li>" : "")
|
||||||
|
+ "</ul>"
|
||||||
|
+ "</div> " + this.message;
|
||||||
|
|
||||||
|
let handler = this;
|
||||||
|
|
||||||
|
$('#message').on('click', '#reverseAll', function() {
|
||||||
|
handler.app.PushToStack("ReverseAllEdges");
|
||||||
|
|
||||||
|
handler.app.graph.reverseAllEdges();
|
||||||
|
handler.app.redrawGraph();
|
||||||
|
|
||||||
|
userAction("ReverseAllEdges");
|
||||||
|
});
|
||||||
|
$('#message').on('click', '#makeAllUndirected', function(){
|
||||||
|
handler.app.PushToStack("makeAllEdgesUndirected");
|
||||||
|
|
||||||
|
handler.app.graph.makeAllEdgesUndirected();
|
||||||
|
handler.app.redrawGraph();
|
||||||
|
|
||||||
|
userAction("makeAllEdgesUndirected");
|
||||||
|
});
|
||||||
|
$('#message').on('click', '#makeAllDirected', function(){
|
||||||
|
handler.app.PushToStack("makeAllEdgesDirected");
|
||||||
|
|
||||||
|
handler.app.graph.makeAllEdgesDirected();
|
||||||
|
handler.app.redrawGraph();
|
||||||
|
|
||||||
|
userAction("makeAllEdgesDirected");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionGraphHandler.prototype.SelectSecond = function(selectedObject)
|
ConnectionGraphHandler.prototype.SelectSecond = function(selectedObject)
|
||||||
|
@ -986,6 +986,26 @@ Graph.prototype.hasDirectEdge = function ()
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Graph.prototype.hasUndirectEdge = function ()
|
||||||
|
{
|
||||||
|
var res = false;
|
||||||
|
for (var i = 0; i < this.edges.length; i++)
|
||||||
|
{
|
||||||
|
if(!this.edges[i].isDirect)
|
||||||
|
{
|
||||||
|
res = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graph.prototype.hasEdges = function ()
|
||||||
|
{
|
||||||
|
return this.edges.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
Graph.prototype.clampPositions = function (viewportSize)
|
Graph.prototype.clampPositions = function (viewportSize)
|
||||||
{
|
{
|
||||||
var diameter = (new VertexModel()).diameter;
|
var diameter = (new VertexModel()).diameter;
|
||||||
@ -1178,4 +1198,45 @@ Graph.prototype.GetAvalibleCruvledValue = function(neighbourEdges, originalEdge)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Graph.prototype.reverseAllEdges = function ()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < this.edges.length; i++)
|
||||||
|
{
|
||||||
|
if(this.edges[i].isDirect)
|
||||||
|
{
|
||||||
|
let v1 = this.edges[i].vertex1;
|
||||||
|
this.edges[i].vertex1 = this.edges[i].vertex2;
|
||||||
|
this.edges[i].vertex2 = v1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isMultiGraph = this.checkMutiGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
Graph.prototype.makeAllEdgesDirected = function ()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < this.edges.length; i++)
|
||||||
|
{
|
||||||
|
if(!this.edges[i].isDirect)
|
||||||
|
{
|
||||||
|
this.edges[i].isDirect = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isMultiGraph = this.checkMutiGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
Graph.prototype.makeAllEdgesUndirected = function ()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < this.edges.length; i++)
|
||||||
|
{
|
||||||
|
if(this.edges[i].isDirect)
|
||||||
|
{
|
||||||
|
this.edges[i].isDirect = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isMultiGraph = this.checkMutiGraph();
|
||||||
|
}
|
||||||
|
@ -189,6 +189,11 @@ var g_useContextMenuText = "Use context menu for addition actions."
|
|||||||
var g_findLongestPath = "Find the longest path";
|
var g_findLongestPath = "Find the longest path";
|
||||||
var g_LengthOfLongestPathFrom = "Length of the longest path from ";
|
var g_LengthOfLongestPathFrom = "Length of the longest path from ";
|
||||||
|
|
||||||
|
var g_additionlActions = "Additional actions";
|
||||||
|
var g_reverseAllEdges = "Reverse all edges";
|
||||||
|
var g_makeAllUndirected = "Make all edges undirected";
|
||||||
|
var g_makeAllDirected = "Make all edges directed";
|
||||||
|
|
||||||
function loadTexts()
|
function loadTexts()
|
||||||
{
|
{
|
||||||
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
|
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
|
||||||
@ -384,5 +389,10 @@ function loadTexts()
|
|||||||
g_useContextMenuText = document.getElementById("UseContextMenuText").innerHTML;
|
g_useContextMenuText = document.getElementById("UseContextMenuText").innerHTML;
|
||||||
|
|
||||||
g_findLongestPath = document.getElementById("findLongestPath").innerHTML;
|
g_findLongestPath = document.getElementById("findLongestPath").innerHTML;
|
||||||
g_LengthOfLongestPathFrom = document.getElementById("LengthOfLongestPathFrom").innerHTML;
|
g_LengthOfLongestPathFrom = document.getElementById("LengthOfLongestPathFrom").innerHTML;
|
||||||
|
|
||||||
|
g_additionlActions = document.getElementById("additionlActions").innerHTML;
|
||||||
|
g_reverseAllEdges = document.getElementById("reverseAllEdges").innerHTML;
|
||||||
|
g_makeAllUndirected = document.getElementById("makeAllUndirected").innerHTML;
|
||||||
|
g_makeAllDirected = document.getElementById("makeAllDirected").innerHTML;
|
||||||
}
|
}
|
||||||
|
10
tpl/home.php
10
tpl/home.php
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<script src="<?= Root('i/js/dev/jquery-ui.js')?>"></script>
|
<script src="<?= Root('i/js/dev/jquery-ui.js')?>"></script>
|
||||||
<script src="<?= Root('i/js/dev/jquery.feedback_me.js')?>"></script>
|
<script src="<?= Root('i/js/dev/jquery.feedback_me.js')?>"></script>
|
||||||
<script src="<?= Root("script/example.js?v=62")?>" ></script>
|
<script src="<?= Root("script/example.js?v=63")?>" ></script>
|
||||||
|
|
||||||
<!-- Yandex.RTB -->
|
<!-- Yandex.RTB -->
|
||||||
<script>window.yaContextCb=window.yaContextCb||[]</script>
|
<script>window.yaContextCb=window.yaContextCb||[]</script>
|
||||||
@ -838,7 +838,13 @@
|
|||||||
<p id="UseContextMenuText" class="translation"><?= L('use_context_menu')?></p>
|
<p id="UseContextMenuText" class="translation"><?= L('use_context_menu')?></p>
|
||||||
|
|
||||||
<p id="findLongestPath" class="translation"><?= L('find_longest_path')?></p>
|
<p id="findLongestPath" class="translation"><?= L('find_longest_path')?></p>
|
||||||
<p id="LengthOfLongestPathFrom" class="translation"><?= L('length_of_longest_path_from')?></p>
|
<p id="LengthOfLongestPathFrom" class="translation"><?= L('length_of_longest_path_from')?></p>
|
||||||
|
|
||||||
|
<p id="additionlActions" class="translation"><?= L('additionl_actions')?></p>
|
||||||
|
<p id="reverseAllEdges" class="translation"><?= L('reverse_all_edges')?></p>
|
||||||
|
<p id="makeAllUndirected" class="translation"><?= L('make_all_undirected')?></p>
|
||||||
|
<p id="makeAllDirected" class="translation"><?= L('make_all_directed')?></p>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<!--
|
<!--
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user