ItEr21S08CUVisualizacionModelosPlanificacionItErItEr20S10: Added graphical support for start-start dependencies
This commit is contained in:
parent
0cfb36139a
commit
f15729da86
2 changed files with 68 additions and 6 deletions
|
|
@ -1,5 +1,9 @@
|
|||
zkDependency = {};
|
||||
|
||||
zkDependency.START_END = "start_end";
|
||||
zkDependency.START_START = "start_start";
|
||||
zkDependency.END_END = "end_end";
|
||||
|
||||
zkDependency.origin = function(dependency) {
|
||||
var id = dependency.getAttribute("idTaskOrig");
|
||||
return document.getElementById(id);
|
||||
|
|
@ -21,7 +25,10 @@ zkDependency.draw = function(dependency) {
|
|||
if (separation > 0 ) {
|
||||
offsetX = offsetX - separation;
|
||||
}
|
||||
orig[0] = orig[0] + Math.max( 0, offsetX );
|
||||
if (dependency.getAttribute('type') == zkDependency.START_END ||
|
||||
dependency.getAttribute('type') == null ) {
|
||||
orig[0] = orig[0] + Math.max( 0, offsetX );
|
||||
}
|
||||
|
||||
orig[1] = orig[1] + zkTask.HEIGHT;
|
||||
dest[1] = dest[1] + zkTask.HALF_HEIGHT;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,63 @@ zkPlanner.setupArrow = function(arrowDiv){
|
|||
}
|
||||
|
||||
zkPlanner.drawArrow = function(arrow, orig, dest){
|
||||
var xorig = orig[0] - zkTask.CORNER_WIDTH/2;
|
||||
var yorig = orig[1] - zkTask.CORNER_WIDTH/2;
|
||||
var xend = dest[0];
|
||||
var yend = dest[1];
|
||||
|
||||
width1 = zkTask.CORNER_WIDTH;
|
||||
width2 = Math.abs(xend - xorig) + zkTask.CORNER_WIDTH;
|
||||
height = Math.abs(yend - yorig);
|
||||
|
||||
if (xorig > xend) {
|
||||
width1 = width2;
|
||||
width2 = zkTask.CORNER_WIDTH;
|
||||
}
|
||||
|
||||
// First segment
|
||||
var depstart = this.findImageElement(arrow, 'start');
|
||||
depstart.style.left = (xorig - width1) + "px";
|
||||
depstart.style.top = yorig + "px";
|
||||
depstart.style.width = width1 + "px";
|
||||
depstart.style.display = "inline";
|
||||
|
||||
// Second segment
|
||||
var depmid = this.findImageElement(arrow, 'mid');
|
||||
depmid.style.left = depstart.style.left;
|
||||
if (yend > yorig) {
|
||||
depmid.style.top = yorig + "px";
|
||||
} else {
|
||||
depmid.style.top = yend + "px";
|
||||
}
|
||||
depmid.style.height = height + "px";
|
||||
|
||||
// Third segment
|
||||
var depend = this.findImageElement(arrow, 'end');
|
||||
depend.style.left = depstart.style.left;
|
||||
depend.style.top = yend + "px";
|
||||
depend.style.width = width2 + "px";
|
||||
|
||||
var deparrow = this.findImageElement(arrow, 'arrow');
|
||||
deparrow.src = this.getImagesDir()+"arrow.png";
|
||||
deparrow.style.top = yend - 5 + "px";
|
||||
deparrow.style.left = xend - 15 + "px";
|
||||
}
|
||||
|
||||
|
||||
zkPlanner.drawArrow = function(dependency, orig, dest) {
|
||||
|
||||
switch(dependency.getAttribute('type'))
|
||||
{
|
||||
case zkDependency.START_START:
|
||||
zkPlanner.drawArrowStartEnd(dependency, orig, dest);
|
||||
case zkDependency.START_END:
|
||||
default:
|
||||
zkPlanner.drawArrowStartEnd(dependency, orig, dest);
|
||||
}
|
||||
}
|
||||
|
||||
zkPlanner.drawArrowStartEnd = function(arrow, orig, dest){
|
||||
var xorig = orig[0] - zkTask.DEPENDENCY_PADDING;
|
||||
var yorig = orig[1] - zkTask.HALF_DEPENDENCY_PADDING;
|
||||
var xend = dest[0] - zkTask.DEPENDENCY_PADDING;
|
||||
|
|
@ -59,13 +116,11 @@ zkPlanner.drawArrow = function(arrow, orig, dest){
|
|||
var width = (xend - xorig);
|
||||
var xmid = xorig + width;
|
||||
|
||||
// First segment not used
|
||||
var depstart = this.findImageElement(arrow, 'start');
|
||||
/*
|
||||
* depstart.style.top = yorig + "px"; depstart.style.left = xorig + "px";
|
||||
* depstart.style.width = width + "px";
|
||||
*/
|
||||
depstart.style.display = "none";
|
||||
|
||||
// Second segment not used
|
||||
var depmid = this.findImageElement(arrow, 'mid');
|
||||
if (yend > yorig) {
|
||||
depmid.style.top = yorig + "px";
|
||||
|
|
@ -104,5 +159,5 @@ zkPlanner.drawArrow = function(arrow, orig, dest){
|
|||
deparrow.style.left = xend + "px";
|
||||
deparrow.style.top = yend - 5 + "px";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue