Major grammar and typo fixes

This commit is contained in:
Ivan 2022-07-10 21:54:45 +05:00
parent 964f1e5723
commit 835911ad04
15 changed files with 229 additions and 224 deletions

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"cSpell.words": [
"Emscripten"
]
}

View File

@ -3,8 +3,8 @@
* *
*/ */
// Return list of vertex with connected vertex. // Return list of 'vertex = [connected vertices]'
function getVertexToVertexArray(graph, ignoryDirection) function getVertexToVertexArray(graph, ignoreDirection)
{ {
res = {}; res = {};
@ -16,7 +16,7 @@ function getVertexToVertexArray(graph, ignoryDirection)
res[edge.vertex1.id] = []; res[edge.vertex1.id] = [];
} }
res[edge.vertex1.id].push(edge.vertex2); res[edge.vertex1.id].push(edge.vertex2);
if (!edge.isDirect || ignoryDirection) if (!edge.isDirect || ignoreDirection)
{ {
if (!res.hasOwnProperty(edge.vertex2.id)) if (!res.hasOwnProperty(edge.vertex2.id))
{ {
@ -34,7 +34,7 @@ function getVertexToVertexArray(graph, ignoryDirection)
var g_Algorithms = []; var g_Algorithms = [];
var g_AlgorithmIds = []; var g_AlgorithmIds = [];
// Call this function to register your factory algoritm. // Call this function to register your factory algorithm.
function RegisterAlgorithm (factory) function RegisterAlgorithm (factory)
{ {
g_Algorithms.push(factory); g_Algorithms.push(factory);
@ -48,13 +48,13 @@ function BaseAlgorithm (graph, app)
this.app = app; this.app = app;
} }
// @return name of algorthm. For now we supports only 2 locals: "ru" and "en" // @return name of algorithm. For now we supports only 2 locals: "ru" and "en"
BaseAlgorithm.prototype.getName = function(local) BaseAlgorithm.prototype.getName = function(local)
{ {
return "unknown_name_" + local; return "unknown_name_" + local;
} }
// @return id of algorthm. Please use format: "your id"."algorithm id". Ex. "OlegSh.ConnectedComponent" // @return id of algorithm. Please use format: "your id"."algorithm id". Ex. "OlegSh.ConnectedComponent"
BaseAlgorithm.prototype.getId = function() BaseAlgorithm.prototype.getId = function()
{ {
return "unknown.unknown"; return "unknown.unknown";
@ -109,7 +109,7 @@ BaseAlgorithm.prototype.needRestoreUpText = function()
return true; return true;
} }
// @return true, if you change resotry graph after use. // @return true, if you change restore graph after use.
BaseAlgorithm.prototype.wantRestore = function() BaseAlgorithm.prototype.wantRestore = function()
{ {
return false; return false;
@ -126,7 +126,7 @@ BaseAlgorithm.prototype.getObjectSelectedGroup = function(object)
return 0; return 0;
} }
// This methos is called, when messages was updated on html page. // This method is called, when messages was updated on html page.
BaseAlgorithm.prototype.messageWasChanged = function() {} BaseAlgorithm.prototype.messageWasChanged = function() {}
// Algorithm priority in menu // Algorithm priority in menu
@ -172,7 +172,7 @@ BaseAlgorithmEx.prototype.CalculateAlgorithm = function(algorithmName, otherPara
if (!graph.HasConnectedNodes(graph.vertices[i])) if (!graph.HasConnectedNodes(graph.vertices[i]))
ignoreNodes[graph.vertices[i].id] = 1; ignoreNodes[graph.vertices[i].id] = 1;
var creator = new GraphMLCreater(graph.vertices, graph.edges, ignoreNodes); var creator = new GraphMLCreator(graph.vertices, graph.edges, ignoreNodes);
var pathObjects = []; var pathObjects = [];
var properties = {}; var properties = {};
var result = []; var result = [];

View File

@ -11,7 +11,7 @@ function Application(document, window)
this.canvas = this.document.getElementById('canvas'); this.canvas = this.document.getElementById('canvas');
this.handler = new AddGraphHandler(this); this.handler = new AddGraphHandler(this);
this.savedGraphName = ""; this.savedGraphName = "";
this.currentEnumVertesType = new BaseEnumVertices(this, 1);//this.enumVertexesTextList[0]; this.currentEnumVerticesType = new BaseEnumVertices(this, 1);//this.enumVerticesTextList[0];
this.findPathReport = 1; this.findPathReport = 1;
this.isTimerRender = false; this.isTimerRender = false;
globalApplication = this; globalApplication = this;
@ -20,7 +20,7 @@ function Application(document, window)
this.renderPathLength = 0; this.renderPathLength = 0;
this.renderPathCounter = 0; this.renderPathCounter = 0;
this.renderPathLoops = 0; this.renderPathLoops = 0;
this.enumVertexesTextList = [new BaseEnumVertices(this, 1), new BaseEnumVertices(this, 0), new TextEnumVertexs(this), new TextEnumVertexsCyr(this), new TextEnumVertexsGreek(this), new TextEnumVertexsCustom(this)]; this.enumVerticesTextList = [new BaseEnumVertices(this, 1), new BaseEnumVertices(this, 0), new TextEnumVertices(this), new TextEnumVerticesCyr(this), new TextEnumVerticesGreek(this), new TextEnumVerticesCustom(this)];
this.SetDefaultTransformations(); this.SetDefaultTransformations();
this.algorithmsValues = {}; this.algorithmsValues = {};
this.userAction = function(){}; this.userAction = function(){};
@ -58,7 +58,7 @@ function Application(document, window)
// List of graph. // List of graph.
//Application.prototype.graph.vertices = []; //Application.prototype.graph.vertices = [];
// Current draged object. // Current dragged object.
Application.prototype.graph = new Graph(); Application.prototype.graph = new Graph();
Application.prototype.dragObject = -1; Application.prototype.dragObject = -1;
// List of graph.edges. // List of graph.edges.
@ -326,17 +326,17 @@ Application.prototype.GetBaseArcDrawer = function(context, edge)
{ {
var arcDrawer = new BaseEdgeDrawer(context); var arcDrawer = new BaseEdgeDrawer(context);
if (edge.model.type == EdgeModels.cruvled) if (edge.model.type == EdgeModels.curve)
{ {
var curvedArcDrawer = new CurvedArcDrawer(context, edge.model); var curvedArcDrawer = new CurvedArcDrawer(context, edge.model);
arcDrawer = new BaseEdgeDrawer(context, arcDrawer = new BaseEdgeDrawer(context,
{ {
drawArc : curvedArcDrawer, drawArc : curvedArcDrawer,
startArrowDiretion : curvedArcDrawer, startArrowDirection : curvedArcDrawer,
finishArrowDiretion : curvedArcDrawer, finishArrowDirection : curvedArcDrawer,
textCenterObject : curvedArcDrawer, textCenterObject : curvedArcDrawer,
getPointOnArc : curvedArcDrawer getPointOnArc : curvedArcDrawer
} }
); );
} }
@ -570,7 +570,7 @@ Application.prototype.CreateNewGraph = function(x, y)
{ {
var app = this; var app = this;
this.currentEnumVertesType.GetVertexTextAsync( this.currentEnumVerticesType.GetVertexTextAsync(
function (enumType) function (enumType)
{ {
app.graph.AddNewVertex(new BaseVertex(x, y, enumType)); app.graph.AddNewVertex(new BaseVertex(x, y, enumType));
@ -587,7 +587,7 @@ Application.prototype.CreateNewArc = function(graph1, graph2, isDirect, weight,
{ {
var edge = this.AddNewEdge(new BaseEdge(graph1, graph2, isDirect, weight, upText), replaceIfExist); var edge = this.AddNewEdge(new BaseEdge(graph1, graph2, isDirect, weight, upText), replaceIfExist);
this.graph.FixEdgeCurved(edge); this.graph.FixEdgeCurve(edge);
var edgeObject = this.graph.edges[edge]; var edgeObject = this.graph.edges[edge];
@ -661,9 +661,9 @@ Application.prototype.FindAllEdges = function(id1, id2)
Application.prototype.SetHandlerMode = function(mode) Application.prototype.SetHandlerMode = function(mode)
{ {
var manipolationHandlers = ["default", "addGraph", "addArc", "delete", "findPath", "connectedComponent", "eulerianLoop"]; var manipulationHandlers = ["default", "addGraph", "addArc", "delete", "findPath", "connectedComponent", "eulerianLoop"];
if (this.handler && (g_AlgorithmIds.indexOf(mode) >= 0 || manipolationHandlers.indexOf(mode) >= 0)) if (this.handler && (g_AlgorithmIds.indexOf(mode) >= 0 || manipulationHandlers.indexOf(mode) >= 0))
{ {
this.handler.RestoreAll(); this.handler.RestoreAll();
} }
@ -799,7 +799,7 @@ Application.prototype.getParameterByName = function (name)
Application.prototype.onPostLoadEvent = function() Application.prototype.onPostLoadEvent = function()
{ {
this.SetEnumVertexsType(document.cookie.replace(/(?:(?:^|.*;\s*)enumType\s*\=\s*([^;]*).*$)|^.*$/, "$1")); this.SetEnumVerticesType(document.cookie.replace(/(?:(?:^|.*;\s*)enumType\s*\=\s*([^;]*).*$)|^.*$/, "$1"));
var wasLoad = false; var wasLoad = false;
var matrix = document.getElementById("inputMatrix").innerHTML; var matrix = document.getElementById("inputMatrix").innerHTML;
@ -927,7 +927,7 @@ Application.prototype.SetAdjacencyMatrix = function (matrix, separator)
res = false; res = false;
} }
this.graph.SetAdjacencyMatrix(matrix, new Point(this.GetRealWidth(), this.GetRealHeight()), this.currentEnumVertesType, separator); this.graph.SetAdjacencyMatrix(matrix, new Point(this.GetRealWidth(), this.GetRealHeight()), this.currentEnumVerticesType, separator);
this.AutoAdjustViewport(); this.AutoAdjustViewport();
this.redrawGraph(); this.redrawGraph();
return res; return res;
@ -955,7 +955,7 @@ Application.prototype.SetIncidenceMatrix = function (matrix)
res = false; res = false;
} }
this.graph.SetIncidenceMatrix(matrix, new Point(this.GetRealWidth(), this.GetRealHeight()), this.currentEnumVertesType); this.graph.SetIncidenceMatrix(matrix, new Point(this.GetRealWidth(), this.GetRealHeight()), this.currentEnumVerticesType);
this.AutoAdjustViewport(); this.AutoAdjustViewport();
this.redrawGraph(); this.redrawGraph();
return res; return res;
@ -1206,17 +1206,17 @@ Application.prototype.SetDefaultHandler = function()
this.SetHandlerMode("default"); this.SetHandlerMode("default");
} }
Application.prototype.GetEnumVertexsList = function() Application.prototype.GetEnumVerticesList = function()
{ {
var res = []; var res = [];
for (var i = 0; i < this.enumVertexesTextList.length; i ++) for (var i = 0; i < this.enumVerticesTextList.length; i ++)
{ {
var one = {}; var one = {};
one["text"] = this.enumVertexesTextList[i].GetText(); one["text"] = this.enumVerticesTextList[i].GetText();
one["value"] = this.enumVertexesTextList[i].GetValue(); one["value"] = this.enumVerticesTextList[i].GetValue();
one["select"] = this.enumVertexesTextList[i].GetValue() == this.currentEnumVertesType.GetValue(); one["select"] = this.enumVerticesTextList[i].GetValue() == this.currentEnumVerticesType.GetValue();
res.push(one); res.push(one);
} }
@ -1224,13 +1224,13 @@ Application.prototype.GetEnumVertexsList = function()
return res; return res;
} }
Application.prototype.SetEnumVertexsType = function(value) Application.prototype.SetEnumVerticesType = function(value)
{ {
for (var i = 0; i < this.enumVertexesTextList.length; i ++) for (var i = 0; i < this.enumVerticesTextList.length; i ++)
{ {
if (this.enumVertexesTextList[i].GetValue() == value) if (this.enumVerticesTextList[i].GetValue() == value)
{ {
this.currentEnumVertesType = this.enumVertexesTextList[i]; this.currentEnumVerticesType = this.enumVerticesTextList[i];
document.cookie = "enumType=" + value; document.cookie = "enumType=" + value;
break; break;
} }
@ -1698,14 +1698,14 @@ Application.prototype.ResetBackgroundStyle = function ()
this.isBackgroundCommonStyleCustom = false; this.isBackgroundCommonStyleCustom = false;
} }
Application.prototype.GetAvalibleCruvledValue = function(neighbourEdges, originalEdge) Application.prototype.GetAvailableCurveValue = function(neighborEdges, originalEdge)
{ {
return this.graph.GetAvalibleCruvledValue(neighbourEdges, originalEdge); return this.graph.GetAvailableCurveValue(neighborEdges, originalEdge);
} }
Application.prototype.GraphTypeChanged = function() Application.prototype.GraphTypeChanged = function()
{ {
$("#CanvasMessage").text(this.graph.isMulti() ? g_GrapsIsMultiMessage : g_GrapsIsGeneralMessage); $("#CanvasMessage").text(this.graph.isMulti() ? g_GraphIsMultiMessage : g_GraphIsGeneralMessage);
} }
Application.prototype.UpdateEdgePresets = function(weight) Application.prototype.UpdateEdgePresets = function(weight)
@ -1793,7 +1793,7 @@ Application.prototype.GetStyle = function(type, styleName, object, index)
} }
Application.prototype._RedrawGraph = function(context, backgroundPosition, backgroundStyle, bDrawSelectedRect, Application.prototype._RedrawGraph = function(context, backgroundPosition, backgroundStyle, bDrawSelectedRect,
forceVertexCommon, forceVertexSeleceted, forceEdgeCommon, forceEdgeSelected) forceVertexCommon, forceVertexSelected, forceEdgeCommon, forceEdgeSelected)
{ {
var backgroundDrawer = new BaseBackgroundDrawer(context); var backgroundDrawer = new BaseBackgroundDrawer(context);
@ -1805,7 +1805,7 @@ Application.prototype._RedrawGraph = function(context, backgroundPosition, backg
this.canvasScale); this.canvasScale);
this.UpdateEdgesCurrentStyle(forceEdgeCommon, forceEdgeSelected); this.UpdateEdgesCurrentStyle(forceEdgeCommon, forceEdgeSelected);
this.UpdateNodesCurrentStyle(forceVertexCommon, forceVertexSeleceted); this.UpdateNodesCurrentStyle(forceVertexCommon, forceVertexSelected);
this.RedrawEdges(context); this.RedrawEdges(context);
this.RedrawNodes(context); this.RedrawNodes(context);

View File

@ -194,13 +194,13 @@ BaseEdge.prototype.GetEdgePositions = function()
var d1 = diameter1; var d1 = diameter1;
var d2 = diameter2; var d2 = diameter2;
if (this.model.type == EdgeModels.cruvled) if (this.model.type == EdgeModels.curve)
{ {
var dist = position1.distance(position2); var dist = position1.distance(position2);
var point1 = this.model.GetCurvedPoint(position1, position2, 10.0 / dist); var point1 = this.model.GetCurvePoint(position1, position2, 10.0 / dist);
direction1 = position1.subtract(point1); direction1 = position1.subtract(point1);
var point2 = this.model.GetCurvedPoint(position1, position2, 1.0 - 10.0 / dist); var point2 = this.model.GetCurvePoint(position1, position2, 1.0 - 10.0 / dist);
direction2 = position2.subtract(point2); direction2 = position2.subtract(point2);
d2 = diameter2; d2 = diameter2;

View File

@ -34,8 +34,8 @@ const WeightTextCenter = 0,
baseStyle.fillStyle = this.fillStyle; baseStyle.fillStyle = this.fillStyle;
if (this.hasOwnProperty('textPadding')) if (this.hasOwnProperty('textPadding'))
baseStyle.textPadding = this.textPadding; baseStyle.textPadding = this.textPadding;
if (this.hasOwnProperty('textStrockeWidth')) if (this.hasOwnProperty('textStrokeWidth'))
baseStyle.textStrockeWidth = this.textStrockeWidth; baseStyle.textStrokeWidth = this.textStrokeWidth;
if (this.hasOwnProperty('lineDash')) if (this.hasOwnProperty('lineDash'))
baseStyle.lineDash = this.lineDash; baseStyle.lineDash = this.lineDash;
if (this.hasOwnProperty('additionalTextColor')) if (this.hasOwnProperty('additionalTextColor'))
@ -63,7 +63,7 @@ BaseEdgeStyle.prototype.FixNewFields = function (style)
delete this.strokeStyle; delete this.strokeStyle;
delete this.fillStyle; delete this.fillStyle;
delete this.textPadding; delete this.textPadding;
delete this.textStrockeWidth; delete this.textStrokeWidth;
delete this.lineDash; delete this.lineDash;
delete this.additionalTextColor; delete this.additionalTextColor;
delete this.weightPosition; delete this.weightPosition;
@ -82,7 +82,7 @@ function CommonEdgeStyle()
this.weightText = '#f0d543'; this.weightText = '#f0d543';
this.fillStyle = '#68aeba'; this.fillStyle = '#68aeba';
this.textPadding = 4; this.textPadding = 4;
this.textStrockeWidth = 2; this.textStrokeWidth = 2;
this.lineDash = 0; this.lineDash = 0;
this.additionalTextColor = '#c7b7c7'; this.additionalTextColor = '#c7b7c7';
this.weightPosition = WeightTextCenter; this.weightPosition = WeightTextCenter;
@ -98,7 +98,7 @@ function CommonPrintEdgeStyle()
this.weightText = '#000000'; this.weightText = '#000000';
this.fillStyle = '#FFFFFF'; this.fillStyle = '#FFFFFF';
this.textPadding = 4; this.textPadding = 4;
this.textStrockeWidth = 2; this.textStrokeWidth = 2;
this.baseStyles.push("common"); this.baseStyles.push("common");
} }
@ -194,8 +194,8 @@ function BaseEdgeDrawer(context, drawObjects)
this.drawObject = null; this.drawObject = null;
this.drawArc = null; this.drawArc = null;
this.startArrowDiretion = null; this.startArrowDirection = null;
this.finishArrowDiretion = null; this.finishArrowDirection = null;
this.textCenterObject = null; this.textCenterObject = null;
this.getPointOnArc = null; this.getPointOnArc = null;
@ -205,10 +205,10 @@ function BaseEdgeDrawer(context, drawObjects)
this.drawObject = drawObjects.drawObject; this.drawObject = drawObjects.drawObject;
if (drawObjects.hasOwnProperty("drawArc")) if (drawObjects.hasOwnProperty("drawArc"))
this.drawArc = drawObjects.drawArc; this.drawArc = drawObjects.drawArc;
if (drawObjects.hasOwnProperty("startArrowDiretion")) if (drawObjects.hasOwnProperty("startArrowDirection"))
this.startArrowDiretion = drawObjects.startArrowDiretion; this.startArrowDirection = drawObjects.startArrowDirection;
if (drawObjects.hasOwnProperty("finishArrowDiretion")) if (drawObjects.hasOwnProperty("finishArrowDirection"))
this.finishArrowDiretion = drawObjects.finishArrowDiretion; this.finishArrowDirection = drawObjects.finishArrowDirection;
if (drawObjects.hasOwnProperty("textCenterObject")) if (drawObjects.hasOwnProperty("textCenterObject"))
this.textCenterObject = drawObjects.textCenterObject; this.textCenterObject = drawObjects.textCenterObject;
if (drawObjects.hasOwnProperty("getPointOnArc")) if (drawObjects.hasOwnProperty("getPointOnArc"))
@ -242,13 +242,13 @@ BaseEdgeDrawer.prototype.Draw = function(baseEdge, arcStyle)
if (hasStartStyle) if (hasStartStyle)
{ {
var dirArrow = this.GetStartArrowDiretion(positions[0], positions[1], lengthArrow); var dirArrow = this.GetStartArrowDirection(positions[0], positions[1], lengthArrow);
arcPos1 = arcPos1.add(dirArrow.multiply(lengthArrow / 2)); arcPos1 = arcPos1.add(dirArrow.multiply(lengthArrow / 2));
} }
if (hasFinishStyle) if (hasFinishStyle)
{ {
var dirArrow = this.GetFinishArrowDiretion(positions[0], positions[1], lengthArrow); var dirArrow = this.GetFinishArrowDirection(positions[0], positions[1], lengthArrow);
arcPos2 = arcPos2.add(dirArrow.multiply(-lengthArrow / 2)); arcPos2 = arcPos2.add(dirArrow.multiply(-lengthArrow / 2));
} }
@ -259,11 +259,11 @@ BaseEdgeDrawer.prototype.Draw = function(baseEdge, arcStyle)
if (hasStartStyle) if (hasStartStyle)
{ {
this.DrawArrow(positions[0], this.GetStartArrowDiretion(positions[0], positions[1], lengthArrow), lengthArrow, widthArrow); this.DrawArrow(positions[0], this.GetStartArrowDirection(positions[0], positions[1], lengthArrow), lengthArrow, widthArrow);
} }
if (hasFinishStyle) if (hasFinishStyle)
{ {
this.DrawArrow(positions[1], this.GetFinishArrowDiretion(positions[0], positions[1], lengthArrow), lengthArrow, widthArrow); this.DrawArrow(positions[1], this.GetFinishArrowDirection(positions[0], positions[1], lengthArrow), lengthArrow, widthArrow);
} }
this.SetupStyle(baseEdge, arcStyle); this.SetupStyle(baseEdge, arcStyle);
@ -336,7 +336,7 @@ BaseEdgeDrawer.prototype.DrawWeight = function(position1, position2, text, arcSt
this.context.font = "bold 16px sans-serif"; this.context.font = "bold 16px sans-serif";
this.context.textBaseline = "middle"; this.context.textBaseline = "middle";
this.context.lineWidth = arcStyle.textStrockeWidth; this.context.lineWidth = arcStyle.textStrokeWidth;
this.context.fillStyle = arcStyle.fillStyle; this.context.fillStyle = arcStyle.fillStyle;
var widthText = this.context.measureText(text).width; var widthText = this.context.measureText(text).width;
@ -399,11 +399,11 @@ BaseEdgeDrawer.prototype.DrawArrow = function(position, direction, length, width
this.context.fill(); this.context.fill();
} }
BaseEdgeDrawer.prototype.GetStartArrowDiretion = function(position1, position2, lengthArrow) BaseEdgeDrawer.prototype.GetStartArrowDirection = function(position1, position2, lengthArrow)
{ {
if (this.startArrowDiretion && this.startArrowDiretion != this) if (this.startArrowDirection && this.startArrowDirection != this)
{ {
return this.startArrowDiretion.GetStartArrowDiretion(position1, position2, lengthArrow); return this.startArrowDirection.GetStartArrowDirection(position1, position2, lengthArrow);
} }
var direction = position1.subtract(position2); var direction = position1.subtract(position2);
@ -411,11 +411,11 @@ BaseEdgeDrawer.prototype.GetStartArrowDiretion = function(position1, position2,
return direction; return direction;
} }
BaseEdgeDrawer.prototype.GetFinishArrowDiretion = function(position1, position2, lengthArrow) BaseEdgeDrawer.prototype.GetFinishArrowDirection = function(position1, position2, lengthArrow)
{ {
if (this.finishArrowDiretion && this.finishArrowDiretion != this) if (this.finishArrowDirection && this.finishArrowDirection != this)
{ {
return this.finishArrowDiretion.GetFinishArrowDiretion(position1, position2, lengthArrow); return this.finishArrowDirection.GetFinishArrowDirection(position1, position2, lengthArrow);
} }
var direction = position2.subtract(position1); var direction = position2.subtract(position1);
@ -441,14 +441,14 @@ BaseEdgeDrawer.prototype.GetTextCenterPoint = function (position1, position2, ha
return centerPoint; return centerPoint;
} }
BaseEdgeDrawer.prototype.GetPointOnArc = function (position1, position2, procent) BaseEdgeDrawer.prototype.GetPointOnArc = function (position1, position2, percent)
{ {
if (this.getPointOnArc && this.getPointOnArc != this) if (this.getPointOnArc && this.getPointOnArc != this)
{ {
return this.getPointOnArc.GetPointOnArc(position1, position2, procent); return this.getPointOnArc.GetPointOnArc(position1, position2, percent);
} }
return Point.interpolate(position1, position2, procent); return Point.interpolate(position1, position2, percent);
} }
function ProgressArcDrawer(context, baseDrawer, progress) function ProgressArcDrawer(context, baseDrawer, progress)
@ -526,25 +526,25 @@ CurvedArcDrawer.prototype.DrawArc = function(position1, position2, arcStyle)
this.context.setLineDash([]); this.context.setLineDash([]);
} }
CurvedArcDrawer.prototype.GetStartArrowDiretion = function(position1, position2, lengthArrow) CurvedArcDrawer.prototype.GetStartArrowDirection = function(position1, position2, lengthArrow)
{ {
var dist = position1.distance(position2); var dist = position1.distance(position2);
var direction = position1.subtract(this.model.GetCurvedPoint(position1, position2, lengthArrow / dist)); var direction = position1.subtract(this.model.GetCurvePoint(position1, position2, lengthArrow / dist));
direction.normalize(1.0); direction.normalize(1.0);
return direction; return direction;
} }
CurvedArcDrawer.prototype.GetFinishArrowDiretion = function(position1, position2, lengthArrow) CurvedArcDrawer.prototype.GetFinishArrowDirection = function(position1, position2, lengthArrow)
{ {
var dist = position1.distance(position2); var dist = position1.distance(position2);
var direction = position2.subtract(this.model.GetCurvedPoint(position1, position2, 1.0 - lengthArrow / dist)); var direction = position2.subtract(this.model.GetCurvePoint(position1, position2, 1.0 - lengthArrow / dist));
direction.normalize(1.0); direction.normalize(1.0);
return direction; return direction;
} }
CurvedArcDrawer.prototype.GetTextCenterPoint = function (position1, position2, hasPair, arcStyle) CurvedArcDrawer.prototype.GetTextCenterPoint = function (position1, position2, hasPair, arcStyle)
{ {
var centerPoint = this.model.GetCurvedPoint(position1, position2, 0.5) var centerPoint = this.model.GetCurvePoint(position1, position2, 0.5)
if (position1.equals(position2)) if (position1.equals(position2))
{ {
centerPoint.y = centerPoint.y - Math.cos(this.model.GetLoopShiftAngel()) * this.model.GetLoopSize() * 2; centerPoint.y = centerPoint.y - Math.cos(this.model.GetLoopShiftAngel()) * this.model.GetLoopSize() * 2;
@ -554,7 +554,7 @@ CurvedArcDrawer.prototype.GetTextCenterPoint = function (position1, position2, h
return centerPoint; return centerPoint;
} }
CurvedArcDrawer.prototype.GetPointOnArc = function (position1, position2, procent) CurvedArcDrawer.prototype.GetPointOnArc = function (position1, position2, percent)
{ {
return this.model.GetCurvedPoint(position1, position2, procent); return this.model.GetCurvePoint(position1, position2, percent);
} }

View File

@ -113,9 +113,9 @@ BaseVertex.prototype.HitTest = function (pos)
} }
else else
{ {
var relativPos = (new Point(pos.x, pos.y)).subtract(this.position); var relativePos = (new Point(pos.x, pos.y)).subtract(this.position);
var lineFinish1 = relativPos.add(new Point(1000, 0)); var lineFinish1 = relativePos.add(new Point(1000, 0));
var lineFinish2 = relativPos.add(new Point(-1000, 0)); var lineFinish2 = relativePos.add(new Point(-1000, 0));
var pointsVertex1 = GetPointsForShape(shape, this.model.diameter + width); var pointsVertex1 = GetPointsForShape(shape, this.model.diameter + width);
pointsVertex1.push(pointsVertex1[0]); pointsVertex1.push(pointsVertex1[0]);
@ -125,12 +125,12 @@ BaseVertex.prototype.HitTest = function (pos)
for (var i = 0; i < pointsVertex1.length - 1; i ++) for (var i = 0; i < pointsVertex1.length - 1; i ++)
{ {
var hitTest = Point.hitTest(relativPos, lineFinish1, pointsVertex1[i], pointsVertex1[i + 1]); var hitTest = Point.hitTest(relativePos, lineFinish1, pointsVertex1[i], pointsVertex1[i + 1]);
if (hitTest != null) if (hitTest != null)
{ {
hitNumber1++; hitNumber1++;
} }
hitTest = Point.hitTest(relativPos, lineFinish2, pointsVertex1[i], pointsVertex1[i + 1]); hitTest = Point.hitTest(relativePos, lineFinish2, pointsVertex1[i], pointsVertex1[i + 1]);
if (hitTest != null) if (hitTest != null)
{ {
hitNumber2++; hitNumber2++;

View File

@ -3,7 +3,7 @@
* *
*/ */
var EdgeModels = {"line": 0, "cruvled" : 1}; var EdgeModels = {"line": 0, "curve" : 1};
const defaultEdgeWidth = 4; const defaultEdgeWidth = 4;
@ -11,19 +11,19 @@ function EdgeModel()
{ {
this.width = globalApplication.GetDefaultEdgeWidth(); this.width = globalApplication.GetDefaultEdgeWidth();
this.type = EdgeModels.line; this.type = EdgeModels.line;
this.curvedValue = EdgeModel.prototype.defaultCruved; this.curveValue = EdgeModel.prototype.defaultCurve;
this.default = true; this.default = true;
this.sizeOfLoop = 24; this.sizeOfLoop = 24;
this.loopShiftAngel = Math.PI / 6; this.loopShiftAngel = Math.PI / 6;
} }
EdgeModel.prototype.defaultCruved = 0.1; EdgeModel.prototype.defaultCurve = 0.1;
EdgeModel.prototype.copyFrom = function(other) EdgeModel.prototype.copyFrom = function(other)
{ {
this.width = other.width; this.width = other.width;
this.type = other.type; this.type = other.type;
this.curvedValue = other.curvedValue; this.curveValue = other.curveValue;
this.default = other.default; this.default = other.default;
} }
@ -31,7 +31,7 @@ EdgeModel.prototype.SaveToXML = function ()
{ {
return "model_width=\"" + this.width + "\" " + return "model_width=\"" + this.width + "\" " +
"model_type=\"" + this.type + "\" " + "model_type=\"" + this.type + "\" " +
"model_curvedValue=\"" + this.curvedValue + "\" " "model_curveValue=\"" + this.curveValue + "\" "
"model_default=\"" + this.default + "\" "; "model_default=\"" + this.default + "\" ";
} }
@ -39,11 +39,11 @@ EdgeModel.prototype.LoadFromXML = function (xml, graph)
{ {
this.width = xml.attr('model_width') == null ? this.width : parseFloat(xml.attr("model_width")); this.width = xml.attr('model_width') == null ? this.width : parseFloat(xml.attr("model_width"));
this.type = xml.attr('model_type') == null ? this.type : xml.attr("model_type"); this.type = xml.attr('model_type') == null ? this.type : xml.attr("model_type");
this.curvedValue = xml.attr('model_curvedValue') == null ? this.curvedValue : parseFloat(xml.attr("model_curvedValue")); this.curveValue = xml.attr('model_curveValue') == null ? this.curveValue : parseFloat(xml.attr("model_curveValue"));
this.default = xml.attr('model_default') == null ? this.default : parseFloat(xml.attr("model_default")); this.default = xml.attr('model_default') == null ? this.default : parseFloat(xml.attr("model_default"));
} }
EdgeModel.prototype.GetCurvedPoint = function(position1, position2, t) EdgeModel.prototype.GetCurvePoint = function(position1, position2, t)
{ {
var points = this.GetBezierPoints(position1, position2); var points = this.GetBezierPoints(position1, position2);
var firstBezierPoint = points[0]; var firstBezierPoint = points[0];
@ -76,7 +76,7 @@ EdgeModel.prototype.GetBezierPoints = function(position1, position2)
direction.normalize(1.0); direction.normalize(1.0);
var normal = direction.normal(); var normal = direction.normal();
var deltaOffsetPixels = delta * this.curvedValue; var deltaOffsetPixels = delta * this.curveValue;
var yOffset = normal.multiply(deltaOffsetPixels); var yOffset = normal.multiply(deltaOffsetPixels);
var firstBezierPointShift = (direction.multiply(delta * 0.2)).add(yOffset); var firstBezierPointShift = (direction.multiply(delta * 0.2)).add(yOffset);
var secondBezierPointShift = (direction.multiply(-delta * 0.2)).add(yOffset); var secondBezierPointShift = (direction.multiply(-delta * 0.2)).add(yOffset);
@ -91,8 +91,8 @@ EdgeModel.prototype.HitTest = function(position1, position2, mousePos)
{ {
if (this.type == EdgeModels.line) if (this.type == EdgeModels.line)
return this.HitTestLine(position1, position2, mousePos); return this.HitTestLine(position1, position2, mousePos);
else if (this.type == EdgeModels.cruvled) else if (this.type == EdgeModels.curve)
return this.HitTestCurved(position1, position2, mousePos); return this.HitTestCurve(position1, position2, mousePos);
return false; return false;
} }
@ -139,7 +139,7 @@ EdgeModel.prototype.HitTestLine = function(position1, position2, mousePos, facto
return false; return false;
} }
EdgeModel.prototype.HitTestCurved = function(position1, position2, mousePos) EdgeModel.prototype.HitTestCurve = function(position1, position2, mousePos)
{ {
var pos1 = position1; var pos1 = position1;
var pos2 = position2; var pos2 = position2;
@ -159,7 +159,7 @@ EdgeModel.prototype.HitTestCurved = function(position1, position2, mousePos)
var start = position1; var start = position1;
for (var i = 0; i < interval_count; i ++) for (var i = 0; i < interval_count; i ++)
{ {
var finish = this.GetCurvedPoint(position1, position2, i / interval_count); var finish = this.GetCurvePoint(position1, position2, i / interval_count);
if (this.HitTestLine(start, finish, mousePos, 2.0)) if (this.HitTestLine(start, finish, mousePos, 2.0))
return true; return true;
@ -170,33 +170,33 @@ EdgeModel.prototype.HitTestCurved = function(position1, position2, mousePos)
return false; return false;
} }
EdgeModel.prototype.ChangeCurvedValue = function (delta) EdgeModel.prototype.ChangeCurveValue = function (delta)
{ {
if (this.type == EdgeModels.line) if (this.type == EdgeModels.line)
{ {
this.type = EdgeModels.cruvled; this.type = EdgeModels.curve;
this.curvedValue = 0.0; this.curveValue = 0.0;
} }
this.curvedValue = this.curvedValue + delta; this.curveValue = this.curveValue + delta;
if (Math.abs(this.curvedValue) <= 0.01) if (Math.abs(this.curveValue) <= 0.01)
this.type = EdgeModels.line; this.type = EdgeModels.line;
this.default = false; this.default = false;
} }
EdgeModel.prototype.SetCurvedValue = function (value) EdgeModel.prototype.SetCurveValue = function (value)
{ {
if (this.type == EdgeModels.line) if (this.type == EdgeModels.line)
{ {
this.type = EdgeModels.cruvled; this.type = EdgeModels.curve;
this.curvedValue = 0.0; this.curveValue = 0.0;
} }
this.curvedValue = value; this.curveValue = value;
if (Math.abs(this.curvedValue) <= 0.01) if (Math.abs(this.curveValue) <= 0.01)
this.type = EdgeModels.line; this.type = EdgeModels.line;
this.default = false; this.default = false;

View File

@ -1,10 +1,10 @@
/* /*
Classes for create text for vertexs. Classes for creating text for vertices.
*/ */
/** /**
* Base Enum Vertexs. * Base Enum Vertices.
* *
*/ */
function BaseEnumVertices(app, startNumber) function BaseEnumVertices(app, startNumber)
@ -55,7 +55,7 @@ TextEnumTitle.prototype.GetVertexText = function(id)
* Text Enum * Text Enum
* *
*/ */
function TextEnumVertexs(app) function TextEnumVertices(app)
{ {
BaseEnumVertices.apply(this, arguments); BaseEnumVertices.apply(this, arguments);
this.pattern = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; this.pattern = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@ -63,9 +63,9 @@ function TextEnumVertexs(app)
// inheritance. // inheritance.
TextEnumVertexs.prototype = Object.create(BaseEnumVertices.prototype); TextEnumVertices.prototype = Object.create(BaseEnumVertices.prototype);
TextEnumVertexs.prototype.GetVertexText = function(id) TextEnumVertices.prototype.GetVertexText = function(id)
{ {
var res = ""; var res = "";
@ -81,12 +81,12 @@ TextEnumVertexs.prototype.GetVertexText = function(id)
} }
TextEnumVertexs.prototype.GetText = function() TextEnumVertices.prototype.GetText = function()
{ {
return "A, B, ... Z"; return "A, B, ... Z";
} }
TextEnumVertexs.prototype.GetValue = function() TextEnumVertices.prototype.GetValue = function()
{ {
return "Latin"; return "Latin";
} }
@ -95,22 +95,22 @@ TextEnumVertexs.prototype.GetValue = function()
* Text Enum * Text Enum
* *
*/ */
function TextEnumVertexsCyr(app) function TextEnumVerticesCyr(app)
{ {
TextEnumVertexs.apply(this, arguments); TextEnumVertices.apply(this, arguments);
this.pattern = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"; this.pattern = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
} }
// inheritance. // inheritance.
TextEnumVertexsCyr.prototype = Object.create(TextEnumVertexs.prototype); TextEnumVerticesCyr.prototype = Object.create(TextEnumVertices.prototype);
TextEnumVertexsCyr.prototype.GetText = function() TextEnumVerticesCyr.prototype.GetText = function()
{ {
return "А, Б, ... Я"; return "А, Б, ... Я";
} }
TextEnumVertexsCyr.prototype.GetValue = function() TextEnumVerticesCyr.prototype.GetValue = function()
{ {
return "Cyrillic"; return "Cyrillic";
} }
@ -120,22 +120,22 @@ TextEnumVertexsCyr.prototype.GetValue = function()
* Text Enum * Text Enum
* *
*/ */
function TextEnumVertexsGreek(app) function TextEnumVerticesGreek(app)
{ {
TextEnumVertexs.apply(this, arguments); TextEnumVertices.apply(this, arguments);
this.pattern = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"; this.pattern = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ";
} }
// inheritance. // inheritance.
TextEnumVertexsGreek.prototype = Object.create(TextEnumVertexs.prototype); TextEnumVerticesGreek.prototype = Object.create(TextEnumVertices.prototype);
TextEnumVertexsGreek.prototype.GetText = function() TextEnumVerticesGreek.prototype.GetText = function()
{ {
return "Α, Β, ... Ω"; return "Α, Β, ... Ω";
} }
TextEnumVertexsGreek.prototype.GetValue = function() TextEnumVerticesGreek.prototype.GetValue = function()
{ {
return "Greek"; return "Greek";
} }
@ -144,7 +144,7 @@ TextEnumVertexsGreek.prototype.GetValue = function()
* Text Enum * Text Enum
* *
*/ */
function TextEnumVertexsCustom(app) function TextEnumVerticesCustom(app)
{ {
BaseEnumVertices.apply(this, arguments); BaseEnumVertices.apply(this, arguments);
this.pattern = ""; this.pattern = "";
@ -153,25 +153,25 @@ function TextEnumVertexsCustom(app)
// inheritance. // inheritance.
TextEnumVertexsCustom.prototype = Object.create(BaseEnumVertices.prototype); TextEnumVerticesCustom.prototype = Object.create(BaseEnumVertices.prototype);
TextEnumVertexsCustom.prototype.GetText = function() TextEnumVerticesCustom.prototype.GetText = function()
{ {
return g_customEnumVertex; return g_customEnumVertex;
} }
TextEnumVertexsCustom.prototype.GetValue = function() TextEnumVerticesCustom.prototype.GetValue = function()
{ {
return "Custom"; return "Custom";
} }
TextEnumVertexsCustom.prototype.GetVertexTextAsync = function(callback) TextEnumVerticesCustom.prototype.GetVertexTextAsync = function(callback)
{ {
this.ShowDialog(callback, g_addVertex, g_addVertex, "A"); this.ShowDialog(callback, g_addVertex, g_addVertex, "A");
} }
TextEnumVertexsCustom.prototype.ShowDialog = function(callback, buttonText, titleTitle, title) TextEnumVerticesCustom.prototype.ShowDialog = function(callback, buttonText, titleTitle, title)
{ {
var dialogButtons = {}; var dialogButtons = {};
app = this.app; app = this.app;

View File

@ -226,7 +226,7 @@ BaseHandler.prototype.addContextMenu = function()
handler.RenameVertex(enumType.GetVertexText(0), handler.contextMenuObject); handler.RenameVertex(enumType.GetVertexText(0), handler.contextMenuObject);
userAction("RenameVertex_contextMenu"); userAction("RenameVertex_contextMenu");
}; };
var customEnum = new TextEnumVertexsCustom(handler.app); var customEnum = new TextEnumVerticesCustom(handler.app);
customEnum.ShowDialog(callback, g_rename, g_renameVertex, handler.contextMenuObject.mainText); customEnum.ShowDialog(callback, g_rename, g_renameVertex, handler.contextMenuObject.mainText);
} }
}); });
@ -481,8 +481,8 @@ function DefaultHandler(app)
DefaultHandler.prototype = Object.create(BaseHandler.prototype); DefaultHandler.prototype = Object.create(BaseHandler.prototype);
// Is pressed // Is pressed
DefaultHandler.prototype.pressed = false; DefaultHandler.prototype.pressed = false;
// Cuvled change value. // Curve change value.
DefaultHandler.prototype.curvedValue = 0.1; DefaultHandler.prototype.curveValue = 0.1;
DefaultHandler.prototype.GetSelectedVertex = function() DefaultHandler.prototype.GetSelectedVertex = function()
{ {
@ -633,7 +633,7 @@ DefaultHandler.prototype.MouseUp = function(pos)
}; };
$('#message').unbind(); $('#message').unbind();
$('#message').on('click', '#renameButton', function(){ $('#message').on('click', '#renameButton', function(){
var customEnum = new TextEnumVertexsCustom(handler.app); var customEnum = new TextEnumVerticesCustom(handler.app);
customEnum.ShowDialog(callback, g_rename, g_renameVertex, handler.selectedObject.mainText); customEnum.ShowDialog(callback, g_rename, g_renameVertex, handler.selectedObject.mainText);
}); });
$('#message').on('click', '#changeCommonStyle', function(){ $('#message').on('click', '#changeCommonStyle', function(){
@ -717,7 +717,7 @@ DefaultHandler.prototype.MouseUp = function(pos)
$('#message').on('click', '#incCurvel', function(){ $('#message').on('click', '#incCurvel', function(){
handler.app.PushToStack("ChangeCurvelEdge"); handler.app.PushToStack("ChangeCurvelEdge");
handler.selectedObject.model.ChangeCurvedValue(DefaultHandler.prototype.curvedValue); handler.selectedObject.model.ChangeCurveValue(DefaultHandler.prototype.curveValue);
handler.needRedraw = true; handler.needRedraw = true;
handler.app.redrawGraph(); handler.app.redrawGraph();
userAction("Edge.Bend"); userAction("Edge.Bend");
@ -725,7 +725,7 @@ DefaultHandler.prototype.MouseUp = function(pos)
$('#message').on('click', '#decCurvel', function(){ $('#message').on('click', '#decCurvel', function(){
handler.app.PushToStack("ChangeCurvelEdge"); handler.app.PushToStack("ChangeCurvelEdge");
handler.selectedObject.model.ChangeCurvedValue(-DefaultHandler.prototype.curvedValue); handler.selectedObject.model.ChangeCurveValue(-DefaultHandler.prototype.curveValue);
handler.needRedraw = true; handler.needRedraw = true;
handler.app.redrawGraph(); handler.app.redrawGraph();
userAction("Edge.Bend"); userAction("Edge.Bend");
@ -841,11 +841,11 @@ DefaultHandler.prototype.MouseUp = function(pos)
handler.app.AddNewEdge(newObject); handler.app.AddNewEdge(newObject);
if (!toNewVertex) if (!toNewVertex)
{ {
var neighbourEdges = handler.app.graph.getNeighbourEdges(newObject); var neighborEdges = handler.app.graph.getNeighborEdges(newObject);
if (neighbourEdges.length >= 1) if (neighborEdges.length >= 1)
{ {
var cruvled = handler.app.GetAvalibleCruvledValue(neighbourEdges, newObject); var curve = handler.app.GetAvailableCurveValue(neighborEdges, newObject);
newObject.model.SetCurvedValue(cruvled); newObject.model.SetCurveValue(curve);
} }
} }
newSelected.push(newObject); newSelected.push(newObject);
@ -956,7 +956,7 @@ AddGraphHandler.prototype.InitControls = function()
var enumVertexsText = document.getElementById("enumVertexsText"); var enumVertexsText = document.getElementById("enumVertexsText");
if (enumVertexsText) if (enumVertexsText)
{ {
var enumsList = this.app.GetEnumVertexsList(); var enumsList = this.app.GetEnumVerticesList();
for (var i = 0; i < enumsList.length; i ++) for (var i = 0; i < enumsList.length; i ++)
{ {
var option = document.createElement('option'); var option = document.createElement('option');
@ -980,7 +980,7 @@ AddGraphHandler.prototype.ChangedType = function()
{ {
var enumVertexsText = document.getElementById("enumVertexsText"); var enumVertexsText = document.getElementById("enumVertexsText");
this.app.SetEnumVertexsType(enumVertexsText.options[enumVertexsText.selectedIndex].value); this.app.SetEnumVerticesType(enumVertexsText.options[enumVertexsText.selectedIndex].value);
} }
@ -1062,7 +1062,7 @@ ConnectionGraphHandler.prototype.SelectFirst = function()
let hasDirectedEdges = this.app.graph.hasDirectEdge(); let hasDirectedEdges = this.app.graph.hasDirectEdge();
let hasUndirectedEdges = this.app.graph.hasUndirectEdge(); let hasUndirectedEdges = this.app.graph.hasUndirectEdge();
this.message = g_selectFisrtVertexToConnect + this.GetSelect2VertexMenu(); this.message = g_selectFirstVertexToConnect + this.GetSelect2VertexMenu();
if (!hasEdges) { if (!hasEdges) {
return; return;
@ -1071,7 +1071,7 @@ ConnectionGraphHandler.prototype.SelectFirst = function()
this.message = this.message =
". <div class=\"btn-group\" style=\"float:right; position: relative; margin-left: 8px\">" ". <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\">" + "<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>" + g_additionalActions + " <span class=\"caret\"></span>"
+ " </button> " + " </button> "
+ "<ul class=\"dropdown-menu dropdown-menu-right\" style=\"z-index:15; position: absolute;\">" + "<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=\"reverseAll\">" + g_reverseAllEdges + "</a></li>" : "")
@ -1457,7 +1457,7 @@ SavedDialogGraphImageHandler.prototype.pathObjects = null;
// Objects. // Objects.
SavedDialogGraphImageHandler.prototype.objects = null; SavedDialogGraphImageHandler.prototype.objects = null;
SavedDialogGraphImageHandler.prototype.showDialogCallback = function (imageExtention) SavedDialogGraphImageHandler.prototype.showDialogCallback = function (imageExtension)
{ {
var dialogButtons = {}; var dialogButtons = {};
@ -1465,7 +1465,7 @@ SavedDialogGraphImageHandler.prototype.showDialogCallback = function (imageExten
$( this ).dialog( "close" ); $( this ).dialog( "close" );
}; };
var fileLocation = "tmp/saved/" + this.imageName.substr(0, 2) + "/"+ this.imageName + "." + imageExtention var fileLocation = "tmp/saved/" + this.imageName.substr(0, 2) + "/"+ this.imageName + "." + imageExtension
document.getElementById("showSavedImageGraph").src = "/" + fileLocation; document.getElementById("showSavedImageGraph").src = "/" + fileLocation;
document.getElementById("showSavedImageGraphRef").href = "/" + fileLocation; document.getElementById("showSavedImageGraphRef").href = "/" + fileLocation;
@ -1538,7 +1538,7 @@ function AlgorithmGraphHandler(app, algorithm)
this.algorithm = algorithm; this.algorithm = algorithm;
this.SaveUpText(); this.SaveUpText();
this.UpdateResultAndMesasge(); this.UpdateResultAndMessage();
} }
// inheritance. // inheritance.
@ -1565,7 +1565,7 @@ AlgorithmGraphHandler.prototype.MouseDown = function(pos)
this.needRedraw = true; this.needRedraw = true;
} }
this.UpdateResultAndMesasge(); this.UpdateResultAndMessage();
} }
else if (selectedObject && (selectedObject instanceof BaseEdge)) else if (selectedObject && (selectedObject instanceof BaseEdge))
{ {
@ -1574,14 +1574,14 @@ AlgorithmGraphHandler.prototype.MouseDown = function(pos)
this.needRedraw = true; this.needRedraw = true;
} }
this.UpdateResultAndMesasge(); this.UpdateResultAndMessage();
} }
else else
{ {
if (this.algorithm.deselectAll()) if (this.algorithm.deselectAll())
{ {
this.needRedraw = true; this.needRedraw = true;
this.UpdateResultAndMesasge(); this.UpdateResultAndMessage();
} }
} }
} }
@ -1632,7 +1632,7 @@ AlgorithmGraphHandler.prototype.RestoreUpText = function()
} }
} }
AlgorithmGraphHandler.prototype.UpdateResultAndMesasge = function() AlgorithmGraphHandler.prototype.UpdateResultAndMessage = function()
{ {
var self = this; var self = this;
result = this.algorithm.result(function (result) result = this.algorithm.result(function (result)
@ -1737,7 +1737,7 @@ SetupVertexStyle.prototype.show = function(index, selectedVertexes)
var app = this.app; var app = this.app;
this.forAll = selectedVertexes == null; this.forAll = selectedVertexes == null;
var forAll = this.forAll; var forAll = this.forAll;
var sefl = this; var self = this;
var applyIndex = function(index) var applyIndex = function(index)
{ {

View File

@ -138,7 +138,7 @@ Graph.prototype.FindVertex = function(id)
return res; return res;
} }
// depricated // deprecated
Graph.prototype.FindEdge = function(id1, id2) Graph.prototype.FindEdge = function(id1, id2)
{ {
return this.FindEdgeAny(id1, id2); return this.FindEdgeAny(id1, id2);
@ -480,7 +480,7 @@ Graph.prototype.VertexesReposition = function (viewportSize, newVertexes)
if (distance > maxDistance) if (distance > maxDistance)
{ {
// countin the attraction // counting the attraction
var force = (otherVertex.position.subtract(currentVertex.object.position)).normalize(edgeGravityKof * (distance - maxDistance)); var force = (otherVertex.position.subtract(currentVertex.object.position)).normalize(edgeGravityKof * (distance - maxDistance));
currentVertex.net_force = currentVertex.net_force.add(force); currentVertex.net_force = currentVertex.net_force.add(force);
} }
@ -516,7 +516,7 @@ Graph.prototype.VertexesReposition = function (viewportSize, newVertexes)
} }
// Looks like somthing going wrong and will use circle algorithm for reposition. // Looks like something going wrong and will use circle algorithm for reposition.
var bbox = this.getGraphBBox(); var bbox = this.getGraphBBox();
if (bbox.size().length() > viewportSize.length() * 1000) if (bbox.size().length() > viewportSize.length() * 1000)
{ {
@ -530,7 +530,7 @@ Graph.prototype.VertexesReposition = function (viewportSize, newVertexes)
{ {
// Try to rotate graph to fill small area. // Try to rotate graph to fill small area.
var count = 10; var count = 10;
var agnle = 360.0 / count; var angle = 360.0 / count;
var viewportAspect = viewportSize.x / viewportSize.y; var viewportAspect = viewportSize.x / viewportSize.y;
var bestIndex = 0; var bestIndex = 0;
var graphSize = bbox.size(); var graphSize = bbox.size();
@ -541,7 +541,7 @@ Graph.prototype.VertexesReposition = function (viewportSize, newVertexes)
{ {
for(j = 0; j < newVertexes.length; j++) // loop through vertices for(j = 0; j < newVertexes.length; j++) // loop through vertices
{ {
newVertexes[j].position.rotate(center, agnle); newVertexes[j].position.rotate(center, angle);
} }
var newBBox = this.getGraphBBox(); var newBBox = this.getGraphBBox();
@ -556,12 +556,12 @@ Graph.prototype.VertexesReposition = function (viewportSize, newVertexes)
// Rotate to best aspect. // Rotate to best aspect.
for(j = 0; j < newVertexes.length; j++) // loop through vertices for(j = 0; j < newVertexes.length; j++) // loop through vertices
{ {
newVertexes[j].position.rotate(center, - agnle * (count - bestIndex - 1)); newVertexes[j].position.rotate(center, - angle * (count - bestIndex - 1));
} }
} }
} }
Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnumVertesType, separator) Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnumVerticesType, separator)
{ {
if (separator === undefined) if (separator === undefined)
{ {
@ -594,14 +594,14 @@ Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnum
if (j >= this.vertices.length) if (j >= this.vertices.length)
{ {
var newPos = this.GetRandomPositionOfVertex (matrix, j, viewportSize); var newPos = this.GetRandomPositionOfVertex (matrix, j, viewportSize);
newVertexes.push(new BaseVertex(newPos.x, newPos.y, currentEnumVertesType)); newVertexes.push(new BaseVertex(newPos.x, newPos.y, currentEnumVerticesType));
this.AddNewVertex(newVertexes[newVertexes.length - 1]); this.AddNewVertex(newVertexes[newVertexes.length - 1]);
} }
if (cols[i][j] > 0) if (cols[i][j] > 0)
{ {
var nEdgeIndex = this.AddNewEdgeSafe(this.vertices[i], this.vertices[j], cols[i][j] != cols[j][i], cols[i][j], true); var nEdgeIndex = this.AddNewEdgeSafe(this.vertices[i], this.vertices[j], cols[i][j] != cols[j][i], cols[i][j], true);
this.FixEdgeCurved(nEdgeIndex); this.FixEdgeCurve(nEdgeIndex);
if (nEdgeIndex >= 0) if (nEdgeIndex >= 0)
{ {
bWeightGraph = bWeightGraph || this.edges[nEdgeIndex].weight != 1; bWeightGraph = bWeightGraph || this.edges[nEdgeIndex].weight != 1;
@ -610,7 +610,7 @@ Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnum
} }
} }
// Set use weight false, because we have unwieghts graph. // Set use weight false, because we have unweighted graph.
if (!bWeightGraph) if (!bWeightGraph)
{ {
this.edges.forEach(function(part, index, theArray) { this.edges.forEach(function(part, index, theArray) {
@ -694,7 +694,7 @@ Graph.prototype.TestIncidenceMatrix = function (matrix, rowsObj, colsObj, separa
return bGoodFormat; return bGoodFormat;
} }
Graph.prototype.SetIncidenceMatrix = function (matrix, viewportSize, currentEnumVertesType) Graph.prototype.SetIncidenceMatrix = function (matrix, viewportSize, currentEnumVerticesType)
{ {
var rowsObj = {}; var rowsObj = {};
var colsObj = {}; var colsObj = {};
@ -721,7 +721,7 @@ Graph.prototype.SetIncidenceMatrix = function (matrix, viewportSize, currentEnum
{ {
var newPos = new Point(0, 0);//this.GetRandomPositionOfVertex (matrix, j, viewportSize); var newPos = new Point(0, 0);//this.GetRandomPositionOfVertex (matrix, j, viewportSize);
newVertexes.push(new BaseVertex(newPos.x, newPos.y, currentEnumVertesType)); newVertexes.push(new BaseVertex(newPos.x, newPos.y, currentEnumVerticesType));
this.AddNewVertex(newVertexes[newVertexes.length - 1]); this.AddNewVertex(newVertexes[newVertexes.length - 1]);
} }
@ -752,7 +752,7 @@ Graph.prototype.SetIncidenceMatrix = function (matrix, viewportSize, currentEnum
var nEdgeIndex = this.AddNewEdgeSafe(this.vertices[edgeIndex[0]], this.vertices[edgeIndex[1]], var nEdgeIndex = this.AddNewEdgeSafe(this.vertices[edgeIndex[0]], this.vertices[edgeIndex[1]],
edgeValue[0] != edgeValue[1], Math.abs(edgeValue[1]), false); edgeValue[0] != edgeValue[1], Math.abs(edgeValue[1]), false);
this.FixEdgeCurved(nEdgeIndex); this.FixEdgeCurve(nEdgeIndex);
if (nEdgeIndex >= 0) if (nEdgeIndex >= 0)
{ {
bWeightGraph = bWeightGraph || this.edges[nEdgeIndex].weight != 1; bWeightGraph = bWeightGraph || this.edges[nEdgeIndex].weight != 1;
@ -760,7 +760,7 @@ Graph.prototype.SetIncidenceMatrix = function (matrix, viewportSize, currentEnum
} }
} }
// Set use weight false, because we have unwieghts graph. // Set use weight false, because we have unweighted graph.
if (!bWeightGraph) if (!bWeightGraph)
{ {
this.edges.forEach(function(part, index, theArray) { this.edges.forEach(function(part, index, theArray) {
@ -882,21 +882,21 @@ Graph.prototype.SaveToXML = function (additionalData)
var mainHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><graphml>"; var mainHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><graphml>";
var header = "<graph id=\"Graph\" uidGraph=\"" + this.uidGraph + "\"" + " uidEdge=\"" + this.uidEdge + "\">"; var header = "<graph id=\"Graph\" uidGraph=\"" + this.uidGraph + "\"" + " uidEdge=\"" + this.uidEdge + "\">";
var xmlBoby = ""; var xmlBody = "";
for (var i = 0; i < this.vertices.length; i++) for (var i = 0; i < this.vertices.length; i++)
{ {
xmlBoby = xmlBoby + this.vertices[i].SaveToXML(); xmlBody = xmlBody + this.vertices[i].SaveToXML();
} }
xmlBoby = xmlBoby + ""; xmlBody = xmlBody + "";
for (var i = 0; i < this.edges.length; i++) for (var i = 0; i < this.edges.length; i++)
{ {
xmlBoby = xmlBoby + this.edges[i].SaveToXML(); xmlBody = xmlBody + this.edges[i].SaveToXML();
} }
xmlBoby = xmlBoby + ""; xmlBody = xmlBody + "";
additionalField = ""; additionalField = "";
if (additionalData.length > 0) if (additionalData.length > 0)
@ -904,7 +904,7 @@ Graph.prototype.SaveToXML = function (additionalData)
additionalField = "<additional data=\"" + additionalData + "\"/>" additionalField = "<additional data=\"" + additionalData + "\"/>"
} }
return mainHeader + header + xmlBoby + "</graph>" + additionalField + "</graphml>"; return mainHeader + header + xmlBody + "</graph>" + additionalField + "</graphml>";
} }
Graph.prototype.LoadFromXML = function (xmlText, additionalData) Graph.prototype.LoadFromXML = function (xmlText, additionalData)
@ -922,7 +922,7 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
loadedEdgeId = parseInt($(this).attr('uidEdge')); loadedEdgeId = parseInt($(this).attr('uidEdge'));
}); });
// Back comportebility. // Backward compatibility
if (isNaN(loadedEdgeId)) if (isNaN(loadedEdgeId))
{ {
loadedEdgeId = this.edgesOffset; loadedEdgeId = this.edgesOffset;
@ -936,14 +936,14 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
$nodes = $xml.find( "node" ); $nodes = $xml.find( "node" );
var vertexs = []; var vertices = [];
$nodes.each(function(){ $nodes.each(function(){
var vertex = new BaseVertex(); var vertex = new BaseVertex();
vertex.LoadFromXML($(this)); vertex.LoadFromXML($(this));
vertexs.push(vertex); vertices.push(vertex);
}); });
this.vertices = vertexs; this.vertices = vertices;
$edges = $xml.find( "edge" ); $edges = $xml.find( "edge" );
@ -1033,20 +1033,20 @@ Graph.prototype.getGraphBBox = function (viewportSize)
pointMax = pointMax.max(vertex.position.add(deltaVector)); pointMax = pointMax.max(vertex.position.add(deltaVector));
} }
var max_cruvled_length = 32; var max_curve_length = 32;
for(i = 0; i < this.edges.length; i++) for(i = 0; i < this.edges.length; i++)
{ {
var edge = this.edges[i]; var edge = this.edges[i];
if (edge.model.type == EdgeModels.cruvled) if (edge.model.type == EdgeModels.curve)
{ {
var max_cruvled = edge.vertex2.position.subtract(edge.vertex1.position).length() / max_cruvled_length; var max_curve = edge.vertex2.position.subtract(edge.vertex1.position).length() / max_curve_length;
for (j = 0; j < max_cruvled; j++) for (j = 0; j < max_curve; j++)
{ {
var point = edge.model.GetCurvedPoint(edge.vertex1.position, edge.vertex2.position, j / max_cruvled); var point = edge.model.GetCurvePoint(edge.vertex1.position, edge.vertex2.position, j / max_curve);
var deltaVector = new Point(max_cruvled_length, max_cruvled_length); var deltaVector = new Point(max_curve_length, max_curve_length);
pointMin = pointMin.min(point.subtract(deltaVector)); pointMin = pointMin.min(point.subtract(deltaVector));
pointMax = pointMax.max(point.add(deltaVector)); pointMax = pointMax.max(point.add(deltaVector));
} }
@ -1063,12 +1063,12 @@ Graph.prototype.hasPair = function (edge)
Graph.prototype.FindPairFor = function (edge) Graph.prototype.FindPairFor = function (edge)
{ {
var res = this.getNeighbourEdges(edge); var res = this.getNeighborEdges(edge);
return res.length == 1 ? res[0] : null; return res.length == 1 ? res[0] : null;
} }
Graph.prototype.getNeighbourEdges = function (edge) Graph.prototype.getNeighborEdges = function (edge)
{ {
var res = []; var res = [];
@ -1138,51 +1138,51 @@ Graph.prototype.isNeedReposition = function ()
return res; return res;
} }
Graph.prototype.FixEdgeCurved = function (edgeIndex) Graph.prototype.FixEdgeCurve = function (edgeIndex)
{ {
var edgeObject = this.edges[edgeIndex]; var edgeObject = this.edges[edgeIndex];
var hasPair = this.hasPair(edgeObject); var hasPair = this.hasPair(edgeObject);
var neighbourEdges = this.getNeighbourEdges(edgeObject); var neighborEdges = this.getNeighborEdges(edgeObject);
if (hasPair) if (hasPair)
{ {
if (edgeObject.model.default) if (edgeObject.model.default)
edgeObject.model.type = EdgeModels.cruvled; edgeObject.model.type = EdgeModels.curve;
var pairEdge = this.FindPairFor(edgeObject); var pairEdge = this.FindPairFor(edgeObject);
if (pairEdge.model.default) if (pairEdge.model.default)
{ {
pairEdge.model.type = EdgeModels.cruvled; pairEdge.model.type = EdgeModels.curve;
if (pairEdge.vertex1 == edgeObject.vertex1 && pairEdge.vertex2 == edgeObject.vertex2) if (pairEdge.vertex1 == edgeObject.vertex1 && pairEdge.vertex2 == edgeObject.vertex2)
pairEdge.model.curvedValue = -pairEdge.model.curvedValue; pairEdge.model.curveValue = -pairEdge.model.curveValue;
} }
} }
else if (neighbourEdges.length >= 2) else if (neighborEdges.length >= 2)
{ {
var cruvled = this.GetAvalibleCruvledValue(neighbourEdges, edgeObject); var curve = this.GetAvailableCurveValue(neighborEdges, edgeObject);
if (edgeObject.model.default) if (edgeObject.model.default)
{ {
edgeObject.model.type = EdgeModels.cruvled; edgeObject.model.type = EdgeModels.curve;
edgeObject.model.curvedValue = cruvled; edgeObject.model.curveValue = curve;
} }
} }
} }
Graph.prototype.GetAvalibleCruvledValue = function(neighbourEdges, originalEdge) Graph.prototype.GetAvailableCurveValue = function(neighborEdges, originalEdge)
{ {
var values = []; var values = [];
for (var i = 0; i < neighbourEdges.length; i ++) for (var i = 0; i < neighborEdges.length; i ++)
{ {
var edge = neighbourEdges[i]; var edge = neighborEdges[i];
var sameDirection = (originalEdge.vertex1.id == edge.vertex1.id); var sameDirection = (originalEdge.vertex1.id == edge.vertex1.id);
if (edge.model.type == EdgeModels.cruvled) if (edge.model.type == EdgeModels.curve)
{ {
values[(sameDirection ? edge.model.curvedValue : -edge.model.curvedValue)] = true; values[(sameDirection ? edge.model.curveValue : -edge.model.curveValue)] = true;
} }
} }
var changeValue = DefaultHandler.prototype.curvedValue; var changeValue = DefaultHandler.prototype.curveValue;
var defaultValue = 0.0; var defaultValue = 0.0;
var maxSearch = 10; var maxSearch = 10;

14
script/GraphMLCreater.js → script/GraphMLCreator.js Executable file → Normal file
View File

@ -4,7 +4,7 @@
*/ */
function GraphMLCreater(nodes, arcs, ignoreNodes = {}) function GraphMLCreator(nodes, arcs, ignoreNodes = {})
{ {
this.nodes = nodes; this.nodes = nodes;
this.arcs = arcs; this.arcs = arcs;
@ -12,7 +12,7 @@ function GraphMLCreater(nodes, arcs, ignoreNodes = {})
} }
GraphMLCreater.prototype.GetXMLString = function() GraphMLCreator.prototype.GetXMLString = function()
{ {
var mainHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><graphml>"; var mainHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><graphml>";
var directedHeader = "<graph id=\"Graph\" edgedefault=\"directed\">"; var directedHeader = "<graph id=\"Graph\" edgedefault=\"directed\">";
@ -24,12 +24,12 @@ GraphMLCreater.prototype.GetXMLString = function()
"<default>" + defaultWeight + "</default>" + "<default>" + defaultWeight + "</default>" +
"</key>"; "</key>";
var xmlBoby = ""; var xmlBody = "";
for (var i = 0; i < this.nodes.length; i++) for (var i = 0; i < this.nodes.length; i++)
{ {
if (!this.ignoreNodes.hasOwnProperty(this.nodes[i].id)) if (!this.ignoreNodes.hasOwnProperty(this.nodes[i].id))
xmlBoby = xmlBoby + "<node id=\"" + this.nodes[i].id + "\"/>"; xmlBody = xmlBody + "<node id=\"" + this.nodes[i].id + "\"/>";
} }
var hasDirected = false; var hasDirected = false;
for (var i = 0; i < this.arcs.length; i++) for (var i = 0; i < this.arcs.length; i++)
@ -50,13 +50,13 @@ GraphMLCreater.prototype.GetXMLString = function()
weightData = "<data key=" + weightKeyId + ">" + arc.weight + "</data>"; weightData = "<data key=" + weightKeyId + ">" + arc.weight + "</data>";
} }
xmlBoby = xmlBoby + "<edge source=\"" + arc.vertex1.id + "\" target=\"" xmlBody = xmlBody + "<edge source=\"" + arc.vertex1.id + "\" target=\""
+ arc.vertex2.id + "\" " + + arc.vertex2.id + "\" " +
(arc.isDirect != hasDirected ? (hasDirected ? "directed=\"false\"" : "directed=\"true\"") : "") + (arc.isDirect != hasDirected ? (hasDirected ? "directed=\"false\"" : "directed=\"true\"") : "") +
" id=\"" + arc.id + "\""; " id=\"" + arc.id + "\"";
xmlBoby = xmlBoby + ((weightData != "") ? ">" + weightData + "</edge>" : "/>") xmlBody = xmlBody + ((weightData != "") ? ">" + weightData + "</edge>" : "/>")
} }
xml = mainHeader + weightNode + (hasDirected ? directedHeader : undirectedHeader) + xmlBoby + "</graph></graphml>" xml = mainHeader + weightNode + (hasDirected ? directedHeader : undirectedHeader) + xmlBody + "</graph></graphml>"
return xml; return xml;
} }

View File

@ -1,6 +1,6 @@
var SiteDir = ""; var SiteDir = "";
var DisableEmscripted = false; var DisableEmscripten = false;
var algorithmsVersion = 2; var algorithmsVersion = 2;
var application = new Application(document, window); var application = new Application(document, window);
@ -103,7 +103,7 @@ function preLoadPage()
function createAlgorithmMenu() function createAlgorithmMenu()
{ {
var algorihtmsBaseId = "Algo"; var algorithmBaseId = "Algo";
var algorithms = application.getAlgorithmNames(); var algorithms = application.getAlgorithmNames();
var index = 0; var index = 0;
@ -283,7 +283,7 @@ function postLoadPage()
{ {
selectHandler('DeleteObject', 'delete'); selectHandler('DeleteObject', 'delete');
} }
// Disabled becase it is easy to lose graph, when you press miss letter. // Disabled because it is easy to lose graph, when you press miss letter.
//else if (key == 'n' || key == 'т') // new //else if (key == 'n' || key == 'т') // new
//{ //{
// userAction('NewGraph_shortcut'); // userAction('NewGraph_shortcut');
@ -740,9 +740,9 @@ $(document).ready(function ()
document.getElementById('canvas').addEventListener("touchend", touchHandler, true); document.getElementById('canvas').addEventListener("touchend", touchHandler, true);
document.getElementById('canvas').addEventListener("touchcancel", touchHandler, true); document.getElementById('canvas').addEventListener("touchcancel", touchHandler, true);
// Try load emscripted implementation // Try load emscripten implementation
var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i); var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i);
if (!isMobile && !DisableEmscripted) { if (!isMobile && !DisableEmscripten) {
const jsScript = document.createElement('script'); const jsScript = document.createElement('script');
jsScript.src = '/script/Graphoffline.Emscripten.js'; jsScript.src = '/script/Graphoffline.Emscripten.js';
document.body.appendChild(jsScript); document.body.appendChild(jsScript);

View File

@ -15,10 +15,10 @@ file_put_contents($outputFilename, file_get_contents("BaseEdgeDrawer.js"), FILE_
file_put_contents($outputFilename, file_get_contents("BaseBackgroundDrawer.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("BaseBackgroundDrawer.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("Algorithms.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("Algorithms.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("EventHandlers.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("EventHandlers.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("GraphMLCreater.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("GraphMLCreator.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("Graph.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("Graph.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("EnumVertices.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("EnumVertices.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("Appilcation.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("Application.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("main.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("main.js"), FILE_APPEND);
file_put_contents($outputFilename, file_get_contents("BaseTraversal.js"), FILE_APPEND); file_put_contents($outputFilename, file_get_contents("BaseTraversal.js"), FILE_APPEND);

View File

@ -207,7 +207,7 @@ FloidAlgorithm.prototype.restore = function()
var edge = this.graph.edges[edgeIndex]; var edge = this.graph.edges[edgeIndex];
edge.model.type = this.egdesCopy[i].model.type; edge.model.type = this.egdesCopy[i].model.type;
edge.model.curvedValue = this.egdesCopy[i].model.curvedValue; edge.model.curveValue = this.egdesCopy[i].model.curveValue;
//edge.model = this.egdesCopy[i].model; //edge.model = this.egdesCopy[i].model;
} }

View File

@ -1,5 +1,5 @@
/** /**
* Place here all tests constans. * Place here all tests constants.
* *
*/ */
@ -7,7 +7,7 @@
var g_textsSelectAndMove = "Drag objects"; var g_textsSelectAndMove = "Drag objects";
var g_moveCursorForMoving = "Move cursor"; var g_moveCursorForMoving = "Move cursor";
var g_clickToAddVertex = "Click to add vertex"; var g_clickToAddVertex = "Click to add vertex";
var g_selectFisrtVertexToConnect = "Select first vertex to connect"; var g_selectFirstVertexToConnect = "Select first vertex to connect";
var g_selectSecondVertexToConnect = "Select second vertex to connect"; var g_selectSecondVertexToConnect = "Select second vertex to connect";
var g_selectStartVertexForShortPath = "Select start vertex for shortest path"; var g_selectStartVertexForShortPath = "Select start vertex for shortest path";
var g_selectFinishVertexForShortPath = "Select finish vertex for shortest path"; var g_selectFinishVertexForShortPath = "Select finish vertex for shortest path";
@ -17,8 +17,8 @@ var g_selectObjectToDelete = "Select object to delete";
var g_addEdge = "Add edge"; var g_addEdge = "Add edge";
var g_orintEdge = "Orient"; var g_orintEdge = "Directed";
var g_notOrintEdge = "not Orient"; var g_notOrintEdge = "Undirected";
var g_adjacencyMatrixText = "Adjacency Matrix"; var g_adjacencyMatrixText = "Adjacency Matrix";
var g_save = "Save"; var g_save = "Save";
@ -102,14 +102,14 @@ var g_Undo = "Undo";
var g_default = "default"; var g_default = "default";
var g_vertexDraw = "Vertex draw style"; var g_vertexDraw = "Vertex draw style";
var g_edgeDraw = "Edge draw style"; var g_edgeDraw = "Edge draw style";
var g_backgroundStyle = "Bacgkround style"; var g_backgroundStyle = "Background style";
var g_GrapsIsMultiMessage = "Graph is multigraph"; var g_GraphIsMultiMessage = "Graph is multigraph";
var g_GrapsIsGeneralMessage = ""; var g_GraphIsGeneralMessage = "";
var g_DefaultWeightPreset = "no weight"; var g_DefaultWeightPreset = "no weight";
var g_dragGroupText = "Drag group."; var g_dragGroupText = "Drag group.";
var g_selectGroupText = "Select using ctrl"; var g_selectGroupText = "Select using ctrl";
var g_copyGroupeButton = "Dublicate"; var g_copyGroupeButton = "Duplicate";
var g_removeGroupeButton = "Remove objects"; var g_removeGroupeButton = "Remove objects";
var g_BFSName = "Breadth-first search"; var g_BFSName = "Breadth-first search";
@ -124,7 +124,7 @@ var g_HamiltoianCycleName = "Find Hamiltonian cycle";
var g_HamiltonianPath = "Find Hamiltonian path"; var g_HamiltonianPath = "Find Hamiltonian path";
var g_MaxFlowName = "Find Maximum flow"; var g_MaxFlowName = "Find Maximum flow";
var g_minimumSpanningTree = "Search of minimum spanning tree"; var g_minimumSpanningTree = "Search of minimum spanning tree";
var g_modernGraphStyleName = "Visualisation based on weight"; var g_modernGraphStyleName = "Visualization based on weight";
var g_RadiusAndDiameter = "Search graph radius and diameter"; var g_RadiusAndDiameter = "Search graph radius and diameter";
var g_findShortPathName = "Find shortest path using Dijkstra's algorithm"; var g_findShortPathName = "Find shortest path using Dijkstra's algorithm";
var g_VerticesDegreeName = "Calculate vertexes degree"; var g_VerticesDegreeName = "Calculate vertexes degree";
@ -171,8 +171,8 @@ var g_commonVertexStyle = "Common Vertex Style";
var g_selectedVertexStyle = "Selected Vertex Style"; var g_selectedVertexStyle = "Selected Vertex Style";
// FindAllPatches.js // FindAllPatches.js
var g_findAllPathes = "Find all pathes"; var g_findAllPathes = "Find all paths";
var g_numberOfPathesFrom = "Number of pathes from " var g_numberOfPathesFrom = "Number of paths from "
var g_to = " to "; var g_to = " to ";
var g_are = " are "; var g_are = " are ";
var g_pathN = "Path #"; var g_pathN = "Path #";
@ -189,7 +189,7 @@ 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_additionalActions = "Additional actions";
var g_reverseAllEdges = "Reverse all edges"; var g_reverseAllEdges = "Reverse all edges";
var g_makeAllUndirected = "Make all edges undirected"; var g_makeAllUndirected = "Make all edges undirected";
var g_makeAllDirected = "Make all edges directed"; var g_makeAllDirected = "Make all edges directed";
@ -199,7 +199,7 @@ function loadTexts()
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML; g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
g_moveCursorForMoving = document.getElementById("MoveCursorForMoving").innerHTML; g_moveCursorForMoving = document.getElementById("MoveCursorForMoving").innerHTML;
g_clickToAddVertex = document.getElementById("clickToAddVertex").innerHTML; g_clickToAddVertex = document.getElementById("clickToAddVertex").innerHTML;
g_selectFisrtVertexToConnect = document.getElementById("selectFisrtVertextToConnect").innerHTML; g_selectFirstVertexToConnect = document.getElementById("selectFisrtVertextToConnect").innerHTML;
g_selectSecondVertexToConnect = document.getElementById("selectSecondVertextToConnect").innerHTML; g_selectSecondVertexToConnect = document.getElementById("selectSecondVertextToConnect").innerHTML;
g_selectStartVertexForShortPath = document.getElementById("selectStartShortPathVertex").innerHTML; g_selectStartVertexForShortPath = document.getElementById("selectStartShortPathVertex").innerHTML;
g_selectFinishVertexForShortPath = document.getElementById("selectFinishShortPathVertex").innerHTML; g_selectFinishVertexForShortPath = document.getElementById("selectFinishShortPathVertex").innerHTML;
@ -299,8 +299,8 @@ function loadTexts()
g_backgroundStyle = document.getElementById("backgroundStyle").innerHTML; g_backgroundStyle = document.getElementById("backgroundStyle").innerHTML;
g_GrapsIsMultiMessage = document.getElementById("graphIsMultiMessage").innerHTML; g_GraphIsMultiMessage = document.getElementById("graphIsMultiMessage").innerHTML;
g_GrapsIsGeneralMessage = document.getElementById("graphIsGeneralMessage").innerHTML; g_GraphIsGeneralMessage = document.getElementById("graphIsGeneralMessage").innerHTML;
g_DefaultWeightPreset = document.getElementById("defaultWeightPreset").innerHTML; g_DefaultWeightPreset = document.getElementById("defaultWeightPreset").innerHTML;
var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0; var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0;
@ -391,7 +391,7 @@ function loadTexts()
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_additionalActions = document.getElementById("additionlActions").innerHTML;
g_reverseAllEdges = document.getElementById("reverseAllEdges").innerHTML; g_reverseAllEdges = document.getElementById("reverseAllEdges").innerHTML;
g_makeAllUndirected = document.getElementById("makeAllUndirected").innerHTML; g_makeAllUndirected = document.getElementById("makeAllUndirected").innerHTML;
g_makeAllDirected = document.getElementById("makeAllDirected").innerHTML; g_makeAllDirected = document.getElementById("makeAllDirected").innerHTML;