mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 23:36:00 +00:00
Merge branch 'master' of https://github.com/UnickSoft/graphonline
This commit is contained in:
commit
b659e2cd60
@ -34,7 +34,7 @@ In files:
|
|||||||
/wiki/local/config.php
|
/wiki/local/config.php
|
||||||
/en/wiki/local/config.php
|
/en/wiki/local/config.php
|
||||||
|
|
||||||
7. Maybe you need to disable autoredirect to https. Commends lines:
|
7. Maybe you need to disable autoredirect to https. Comments or remove lines:
|
||||||
```
|
```
|
||||||
RewriteCond %{HTTPS} off
|
RewriteCond %{HTTPS} off
|
||||||
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||||
|
BIN
cgi-bin/GraphOffline/OSX/GraphCGI.exe
Normal file
BIN
cgi-bin/GraphOffline/OSX/GraphCGI.exe
Normal file
Binary file not shown.
BIN
cgi-bin/GraphOffline/Windows/GraphCGI.exe
Normal file
BIN
cgi-bin/GraphOffline/Windows/GraphCGI.exe
Normal file
Binary file not shown.
@ -219,7 +219,11 @@ BaseAlgorithmEx.prototype.CalculateAlgorithm = function(queryString, resultCallb
|
|||||||
$edges.each(function(){
|
$edges.each(function(){
|
||||||
var source = $(this).attr('source');
|
var source = $(this).attr('source');
|
||||||
var target = $(this).attr('target');
|
var target = $(this).attr('target');
|
||||||
var edge = graph.FindEdge(source, target);
|
var edge = graph.FindEdge(source, target);
|
||||||
|
if (typeof $(this).attr('id') !== 'undefined')
|
||||||
|
{
|
||||||
|
edge = graph.FindEdgeById($(this).attr('id'));
|
||||||
|
}
|
||||||
pathObjects.push(edge);
|
pathObjects.push(edge);
|
||||||
|
|
||||||
$data = $(this).find("data");
|
$data = $(this).find("data");
|
||||||
|
@ -103,7 +103,16 @@ Application.prototype.redrawGraphTimer = function()
|
|||||||
var i = 0
|
var i = 0
|
||||||
for (i = 0; i < this.renderPath.length - 1; i++)
|
for (i = 0; i < this.renderPath.length - 1; i++)
|
||||||
{
|
{
|
||||||
var edge = this.graph.FindEdge(this.renderPath[i], this.renderPath[i + 1]);
|
var edge = null;
|
||||||
|
if (this.renderMinPath)
|
||||||
|
{
|
||||||
|
edge = this.graph.FindEdgeMin(this.renderPath[i], this.renderPath[i + 1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
edge = this.graph.FindEdge(this.renderPath[i], this.renderPath[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
currentLength += edge.GetPixelLength();
|
currentLength += edge.GetPixelLength();
|
||||||
if (currentLength > this.renderPathCounter)
|
if (currentLength > this.renderPathCounter)
|
||||||
{
|
{
|
||||||
@ -120,7 +129,15 @@ Application.prototype.redrawGraphTimer = function()
|
|||||||
this.renderPathLoops += 1;
|
this.renderPathLoops += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var edge = this.graph.FindEdge(this.renderPath[i], this.renderPath[i + 1]);
|
var edge = null;
|
||||||
|
if (this.renderMinPath)
|
||||||
|
{
|
||||||
|
edge = this.graph.FindEdgeMin(this.renderPath[i], this.renderPath[i + 1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
edge = this.graph.FindEdge(this.renderPath[i], this.renderPath[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
var progress = (this.renderPathCounter - currentLength) / edge.GetPixelLength();
|
var progress = (this.renderPathCounter - currentLength) / edge.GetPixelLength();
|
||||||
|
|
||||||
@ -239,9 +256,10 @@ Application.prototype.stopRenderTimer = function()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.prototype.setRenderPath = function(renderPath)
|
Application.prototype.setRenderPath = function(renderPath, renderMinPath)
|
||||||
{
|
{
|
||||||
this.renderPath = renderPath;
|
this.renderPath = renderPath;
|
||||||
|
this.renderMinPath = renderMinPath;
|
||||||
|
|
||||||
if (this.renderPath.length > 0)
|
if (this.renderPath.length > 0)
|
||||||
{
|
{
|
||||||
@ -537,68 +555,6 @@ Application.prototype.FindAllEdges = function(id1, id2)
|
|||||||
return this.graph.FindAllEdges(id1, id2);
|
return this.graph.FindAllEdges(id1, id2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.prototype.FindPath = function(graph1, graph2)
|
|
||||||
{
|
|
||||||
var creator = new GraphMLCreater(this.graph.vertices, this.graph.edges);
|
|
||||||
var app = this;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "/" + SiteDir + "cgi-bin/GraphCGI.exe?dsp=cgiInput&start=" + graph1.id + "&finish=" + graph2.id + "&report=xml",
|
|
||||||
data: creator.GetXMLString(),
|
|
||||||
dataType: "text"
|
|
||||||
})
|
|
||||||
.done(function( msg )
|
|
||||||
{
|
|
||||||
$('#debug').text(msg);
|
|
||||||
xmlDoc = $.parseXML( msg );
|
|
||||||
var $xml = $( xmlDoc );
|
|
||||||
|
|
||||||
$nodes = $xml.find( "node" );
|
|
||||||
|
|
||||||
var pathObjects = new Array();
|
|
||||||
var shortDistObjects = {};
|
|
||||||
|
|
||||||
$nodes.each(function(){
|
|
||||||
var id = $(this).attr('id');
|
|
||||||
$data = $(this).find("data");
|
|
||||||
$data.each(function(){
|
|
||||||
if ("hightlightNode" == $(this).attr('key') && $(this).text() == "1")
|
|
||||||
{
|
|
||||||
pathObjects.push(app.FindVertex(id));
|
|
||||||
}
|
|
||||||
if ("lowestDistance" == $(this).attr('key'))
|
|
||||||
{
|
|
||||||
shortDistObjects[id] = $(this).text();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$edges = $xml.find( "edge" );
|
|
||||||
|
|
||||||
$edges.each(function(){
|
|
||||||
var source = $(this).attr('source');
|
|
||||||
var target = $(this).attr('target');
|
|
||||||
pathObjects.push(app.FindEdge(source, target));
|
|
||||||
});
|
|
||||||
|
|
||||||
var $graph = $xml.find( "graph" );
|
|
||||||
$graph.each(function(){
|
|
||||||
var shortPathResult = $(this).attr('result');
|
|
||||||
app.handler.SetShortPath(shortPathResult);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.handler.SetObjects(pathObjects);
|
|
||||||
app.handler.SetShortDist(shortDistObjects);
|
|
||||||
|
|
||||||
app.redrawGraph();
|
|
||||||
app.updateMessage();
|
|
||||||
});
|
|
||||||
|
|
||||||
// return empty, will set later.
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
Application.prototype.SetHandlerMode = function(mode)
|
Application.prototype.SetHandlerMode = function(mode)
|
||||||
{
|
{
|
||||||
var manipolationHandlers = ["default", "addGraph", "addArc", "delete", "findPath", "connectedComponent", "eulerianLoop"];
|
var manipolationHandlers = ["default", "addGraph", "addArc", "delete", "findPath", "connectedComponent", "eulerianLoop"];
|
||||||
@ -1270,7 +1226,7 @@ Application.prototype.resultCallback = function(paths)
|
|||||||
console.log(paths);
|
console.log(paths);
|
||||||
if ((paths instanceof Object) && "paths" in paths)
|
if ((paths instanceof Object) && "paths" in paths)
|
||||||
{
|
{
|
||||||
this.setRenderPath(paths["paths"][0]);
|
this.setRenderPath(paths["paths"][0], "minPath" in paths);
|
||||||
}
|
}
|
||||||
this.updateMessage();
|
this.updateMessage();
|
||||||
this.redrawGraph();
|
this.redrawGraph();
|
||||||
|
@ -120,6 +120,21 @@ Graph.prototype.FindEdge = function(id1, id2)
|
|||||||
return this.FindEdgeAny(id1, id2);
|
return this.FindEdgeAny(id1, id2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Graph.prototype.FindEdgeById = function(edgeId)
|
||||||
|
{
|
||||||
|
var res = null;
|
||||||
|
for (var i = 0; i < this.edges.length; i++)
|
||||||
|
{
|
||||||
|
if (this.edges[i].id == edgeId)
|
||||||
|
{
|
||||||
|
res = this.edges[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
Graph.prototype.FindEdgeAny = function(id1, id2)
|
Graph.prototype.FindEdgeAny = function(id1, id2)
|
||||||
{
|
{
|
||||||
var res = null;
|
var res = null;
|
||||||
|
@ -40,15 +40,18 @@ GraphMLCreater.prototype.GetXMLString = function()
|
|||||||
}
|
}
|
||||||
for (var i = 0; i < this.arcs.length; i++)
|
for (var i = 0; i < this.arcs.length; i++)
|
||||||
{
|
{
|
||||||
var weightData = "";
|
var weightData = "";
|
||||||
|
var arc = this.arcs[i];
|
||||||
|
|
||||||
if (this.arcs[i].weight != defaultWeight)
|
if (this.arcs[i].weight != defaultWeight)
|
||||||
{
|
{
|
||||||
weightData = "<data key="+ weightKeyId + ">"+ this.arcs[i].weight + "</data>";
|
weightData = "<data key=" + weightKeyId + ">" + arc.weight + "</data>";
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlBoby = xmlBoby + "<edge source=\"" + this.arcs[i].vertex1.id + "\" target=\""
|
xmlBoby = xmlBoby + "<edge source=\"" + arc.vertex1.id + "\" target=\""
|
||||||
+ this.arcs[i].vertex2.id + "\" "+
|
+ arc.vertex2.id + "\" " +
|
||||||
(this.arcs[i].isDirect != hasDirected ? (hasDirected ? "directed=\"false\"" : "directed=\"true\"") : "");
|
(arc.isDirect != hasDirected ? (hasDirected ? "directed=\"false\"" : "directed=\"true\"") : "") +
|
||||||
|
" id=\"" + arc.id + "\"";
|
||||||
|
|
||||||
xmlBoby = xmlBoby + ((weightData != "") ? ">" + weightData + "</edge>" : "/>")
|
xmlBoby = xmlBoby + ((weightData != "") ? ">" + weightData + "</edge>" : "/>")
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ FloidAlgorithm.prototype.result = function(resultCallback)
|
|||||||
// Remove all edges.
|
// Remove all edges.
|
||||||
this.egdesCopy = this.graph.edges.slice();
|
this.egdesCopy = this.graph.edges.slice();
|
||||||
this.removeAllEdges();
|
this.removeAllEdges();
|
||||||
|
this.isGraphMulti = this.graph.isMulti();
|
||||||
|
|
||||||
this.graph.hasDirect = false;
|
this.graph.hasDirect = false;
|
||||||
|
|
||||||
@ -206,7 +207,13 @@ FloidAlgorithm.prototype.restore = function()
|
|||||||
|
|
||||||
for (var i = 0; i < this.egdesCopy.length; i ++)
|
for (var i = 0; i < this.egdesCopy.length; i ++)
|
||||||
{
|
{
|
||||||
this.graph.AddNewEdgeSafe(this.egdesCopy[i].vertex1, this.egdesCopy[i].vertex2, this.egdesCopy[i].isDirect, this.egdesCopy[i].weight);
|
var edge = this.graph.AddNewEdgeSafe(this.egdesCopy[i].vertex1,
|
||||||
|
this.egdesCopy[i].vertex2,
|
||||||
|
this.egdesCopy[i].isDirect,
|
||||||
|
this.egdesCopy[i].weight,
|
||||||
|
this.isGraphMulti);
|
||||||
|
|
||||||
|
//edge.model = this.egdesCopy[i].model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,6 +223,12 @@ FloidAlgorithm.prototype.updateMessage = function(save)
|
|||||||
"<button type=\"button\" class=\"btn btn-default btn-xs\" id=\"showFloidMatrix\" style=\"float:right\">" + g_showDistMatrix + "</button>"
|
"<button type=\"button\" class=\"btn btn-default btn-xs\" id=\"showFloidMatrix\" style=\"float:right\">" + g_showDistMatrix + "</button>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Algorithm support multi graph
|
||||||
|
FloidAlgorithm.prototype.IsSupportMultiGraph = function ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Factory for connected components.
|
// Factory for connected components.
|
||||||
function CreateFloidAlgorithm(graph, app)
|
function CreateFloidAlgorithm(graph, app)
|
||||||
{
|
{
|
||||||
|
@ -73,6 +73,7 @@ MinimumSpanningTree.prototype.result = function(resultCallback)
|
|||||||
|
|
||||||
var result = {};
|
var result = {};
|
||||||
result["version"] = 1;
|
result["version"] = 1;
|
||||||
|
result["minPath"] = true;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -145,6 +146,12 @@ MinimumSpanningTree.prototype.getPriority = function()
|
|||||||
return -9.5;
|
return -9.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Algorithm support multi graph
|
||||||
|
MinimumSpanningTree.prototype.IsSupportMultiGraph = function ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Factory for algorithm.
|
// Factory for algorithm.
|
||||||
function CreateMinimumSpanningTree(graph, app)
|
function CreateMinimumSpanningTree(graph, app)
|
||||||
|
@ -55,6 +55,7 @@ FindShortPathNew.prototype.resultCallback = function(pathObjects, properties, re
|
|||||||
{
|
{
|
||||||
var outputResult = {};
|
var outputResult = {};
|
||||||
outputResult["version"] = 1;
|
outputResult["version"] = 1;
|
||||||
|
outputResult["minPath"] = true;
|
||||||
|
|
||||||
this.pathObjects = pathObjects;
|
this.pathObjects = pathObjects;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
@ -205,6 +206,12 @@ FindShortPathNew.prototype.getPriority = function()
|
|||||||
return -10;
|
return -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Algorithm support multi graph
|
||||||
|
FindShortPathNew.prototype.IsSupportMultiGraph = function ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Factory for connected components.
|
// Factory for connected components.
|
||||||
function CreateFindShortPathNew(graph, app)
|
function CreateFindShortPathNew(graph, app)
|
||||||
|
@ -173,6 +173,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<? if (L('current_language') == "ru" && false): ?>
|
<? if (L('current_language') == "ru" && false): ?>
|
||||||
|
<!--
|
||||||
<section style="height:32px;text-align: center;" id="adv" class="hidden-phone">
|
<section style="height:32px;text-align: center;" id="adv" class="hidden-phone">
|
||||||
|
|
||||||
<a class="ProgresssBarLink" href="/donate" target="_blank">
|
<a class="ProgresssBarLink" href="/donate" target="_blank">
|
||||||
@ -181,6 +182,7 @@
|
|||||||
<span class="ProgressBarText" style="top:-28px"><p>Поддержите наш проект: сбор средств добавления новых алгоритмов.</p></span>
|
<span class="ProgressBarText" style="top:-28px"><p>Поддержите наш проект: сбор средств добавления новых алгоритмов.</p></span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
-->
|
||||||
<!-- Yandex.RTB R-A-202319-1 -->
|
<!-- Yandex.RTB R-A-202319-1 -->
|
||||||
<!--
|
<!--
|
||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
@ -205,7 +207,9 @@
|
|||||||
})(this, this.document, "yandexContextAsyncCallbacks");
|
})(this, this.document, "yandexContextAsyncCallbacks");
|
||||||
</script>
|
</script>
|
||||||
-->
|
-->
|
||||||
|
<!--
|
||||||
</section>
|
</section>
|
||||||
|
-->
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
<section class="translation">
|
<section class="translation">
|
||||||
<div id="addEdge">
|
<div id="addEdge">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user