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
|
||||
/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
|
||||
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.
@ -220,6 +220,10 @@ BaseAlgorithmEx.prototype.CalculateAlgorithm = function(queryString, resultCallb
|
||||
var source = $(this).attr('source');
|
||||
var target = $(this).attr('target');
|
||||
var edge = graph.FindEdge(source, target);
|
||||
if (typeof $(this).attr('id') !== 'undefined')
|
||||
{
|
||||
edge = graph.FindEdgeById($(this).attr('id'));
|
||||
}
|
||||
pathObjects.push(edge);
|
||||
|
||||
$data = $(this).find("data");
|
||||
|
@ -103,7 +103,16 @@ Application.prototype.redrawGraphTimer = function()
|
||||
var i = 0
|
||||
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();
|
||||
if (currentLength > this.renderPathCounter)
|
||||
{
|
||||
@ -120,7 +129,15 @@ Application.prototype.redrawGraphTimer = function()
|
||||
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();
|
||||
|
||||
@ -239,9 +256,10 @@ Application.prototype.stopRenderTimer = function()
|
||||
}
|
||||
}
|
||||
|
||||
Application.prototype.setRenderPath = function(renderPath)
|
||||
Application.prototype.setRenderPath = function(renderPath, renderMinPath)
|
||||
{
|
||||
this.renderPath = renderPath;
|
||||
this.renderMinPath = renderMinPath;
|
||||
|
||||
if (this.renderPath.length > 0)
|
||||
{
|
||||
@ -537,68 +555,6 @@ Application.prototype.FindAllEdges = function(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)
|
||||
{
|
||||
var manipolationHandlers = ["default", "addGraph", "addArc", "delete", "findPath", "connectedComponent", "eulerianLoop"];
|
||||
@ -1270,7 +1226,7 @@ Application.prototype.resultCallback = function(paths)
|
||||
console.log(paths);
|
||||
if ((paths instanceof Object) && "paths" in paths)
|
||||
{
|
||||
this.setRenderPath(paths["paths"][0]);
|
||||
this.setRenderPath(paths["paths"][0], "minPath" in paths);
|
||||
}
|
||||
this.updateMessage();
|
||||
this.redrawGraph();
|
||||
|
@ -120,6 +120,21 @@ Graph.prototype.FindEdge = function(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)
|
||||
{
|
||||
var res = null;
|
||||
|
@ -41,14 +41,17 @@ GraphMLCreater.prototype.GetXMLString = function()
|
||||
for (var i = 0; i < this.arcs.length; i++)
|
||||
{
|
||||
var weightData = "";
|
||||
var arc = this.arcs[i];
|
||||
|
||||
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=\""
|
||||
+ this.arcs[i].vertex2.id + "\" "+
|
||||
(this.arcs[i].isDirect != hasDirected ? (hasDirected ? "directed=\"false\"" : "directed=\"true\"") : "");
|
||||
xmlBoby = xmlBoby + "<edge source=\"" + arc.vertex1.id + "\" target=\""
|
||||
+ arc.vertex2.id + "\" " +
|
||||
(arc.isDirect != hasDirected ? (hasDirected ? "directed=\"false\"" : "directed=\"true\"") : "") +
|
||||
" id=\"" + arc.id + "\"";
|
||||
|
||||
xmlBoby = xmlBoby + ((weightData != "") ? ">" + weightData + "</edge>" : "/>")
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ FloidAlgorithm.prototype.result = function(resultCallback)
|
||||
// Remove all edges.
|
||||
this.egdesCopy = this.graph.edges.slice();
|
||||
this.removeAllEdges();
|
||||
this.isGraphMulti = this.graph.isMulti();
|
||||
|
||||
this.graph.hasDirect = false;
|
||||
|
||||
@ -206,7 +207,13 @@ FloidAlgorithm.prototype.restore = function()
|
||||
|
||||
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>"
|
||||
}
|
||||
|
||||
// Algorithm support multi graph
|
||||
FloidAlgorithm.prototype.IsSupportMultiGraph = function ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateFloidAlgorithm(graph, app)
|
||||
{
|
||||
|
@ -73,6 +73,7 @@ MinimumSpanningTree.prototype.result = function(resultCallback)
|
||||
|
||||
var result = {};
|
||||
result["version"] = 1;
|
||||
result["minPath"] = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -145,6 +146,12 @@ MinimumSpanningTree.prototype.getPriority = function()
|
||||
return -9.5;
|
||||
}
|
||||
|
||||
// Algorithm support multi graph
|
||||
MinimumSpanningTree.prototype.IsSupportMultiGraph = function ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Factory for algorithm.
|
||||
function CreateMinimumSpanningTree(graph, app)
|
||||
|
@ -55,6 +55,7 @@ FindShortPathNew.prototype.resultCallback = function(pathObjects, properties, re
|
||||
{
|
||||
var outputResult = {};
|
||||
outputResult["version"] = 1;
|
||||
outputResult["minPath"] = true;
|
||||
|
||||
this.pathObjects = pathObjects;
|
||||
this.properties = properties;
|
||||
@ -205,6 +206,12 @@ FindShortPathNew.prototype.getPriority = function()
|
||||
return -10;
|
||||
}
|
||||
|
||||
// Algorithm support multi graph
|
||||
FindShortPathNew.prototype.IsSupportMultiGraph = function ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateFindShortPathNew(graph, app)
|
||||
|
@ -173,6 +173,7 @@
|
||||
</section>
|
||||
|
||||
<? if (L('current_language') == "ru" && false): ?>
|
||||
<!--
|
||||
<section style="height:32px;text-align: center;" id="adv" class="hidden-phone">
|
||||
|
||||
<a class="ProgresssBarLink" href="/donate" target="_blank">
|
||||
@ -181,6 +182,7 @@
|
||||
<span class="ProgressBarText" style="top:-28px"><p>Поддержите наш проект: сбор средств добавления новых алгоритмов.</p></span>
|
||||
</div>
|
||||
</a>
|
||||
-->
|
||||
<!-- Yandex.RTB R-A-202319-1 -->
|
||||
<!--
|
||||
<div style="text-align:center;">
|
||||
@ -205,7 +207,9 @@
|
||||
})(this, this.document, "yandexContextAsyncCallbacks");
|
||||
</script>
|
||||
-->
|
||||
<!--
|
||||
</section>
|
||||
-->
|
||||
<? endif; ?>
|
||||
<section class="translation">
|
||||
<div id="addEdge">
|
||||
|
Loading…
x
Reference in New Issue
Block a user