GoalModelEditor/FrontEnd/public/js/projectEdit/graph.js
/**
 * Renders a non-functional goal. No need to recurse here since
 * non-functional goals have no children.
 * : descriptions, the names of the non-functional goals to be
 *      rendered into a single symbol (array of strings)
 * : graph, the graph that the goal will be rendered into
 * : source, the functional goal that the goal will be associated to
 * : type, the type of the non-functional goal (string), this is included
 *      because we need it to know which symbol we are going to render the
 *      goal into
 */
Renders a non-functional goal. No need to recurse here since
non-functional goals have no children.
: descriptions, the names of the non-functional goals to be
rendered into a single symbol (array of strings)
: graph, the graph that the goal will be rendered into
: source, the functional goal that the goal will be associated to
: type, the type of the non-functional goal (string), this is included
because we need it to know which symbol we are going to render the
goal into
Renders a non - functional goal . No need to recurse here since non - functional goals have no children . : descriptions the names of the non - functional goals to be rendered into a single symbol ( array of strings ) : graph the graph that the goal will be rendered into : source the functional goal that the goal will be associated to : type the type of the non - functional goal ( string ) this is included because we need it to know which symbol we are going to render the goal into
function renderNonFunction(descriptions, graph, source=null, type="None") {
    let geo = graph.getCellGeometry(source);
    let x = 0;
    let y = 0;
    let sourceX = geo.x;
    let sourceY = geo.y;
    let fWidth = geo.width;
    let fHeight = geo.height;
    let width = fWidth;
    let height = fHeight;
    let image = "";
    switch (type) {
        case TYPE_EMOTIONAL:
            image = PATH_EMOTIONAL;
            width = fWidth * SW_EMOTIONAL;
            height = fHeight * SH_EMOTIONAL;
            x = sourceX - width / 2 - fWidth / 4;
            y = sourceY - height / 2 - fHeight / 4;
            break;
        case TYPE_NEGATIVE:
            image = PATH_NEGATIVE;
            width = fWidth * SW_NEGATIVE;
            height = fHeight * SH_NEGATIVE;
            x = sourceX + fWidth * 1.15 - width / 2;
            y = sourceY - height / 2 - fHeight / 4;
            break;
        case TYPE_QUALITY:
            image = PATH_QUALITY;
            width = fWidth * SW_QUALITY;
            height = fHeight * SH_QUALITY;
            x = sourceX - width / 2 - fWidth / 4;
            y = sourceY + fHeight * 1.15 - height / 2;
            break;
        case TYPE_STAKEHOLDER:
            image = PATH_STAKEHOLDER;
            width = fWidth * SW_STAKEHOLDER;
            height = fHeight * SH_STAKEHOLDER;
            x = sourceX + fWidth * 1.05 - width / 2;
            y = sourceY + fHeight * 1.0 - height / 2;
            break;
    }
    let style = "fontSize=16;fontColor=black;shape=image;image=" + image;
    if (type === TYPE_STAKEHOLDER) {
        style = style + ";verticalAlign=top;verticalLabelPosition=bottom";
    }
    let node = graph.insertVertex(
        null,
        null,
        descriptions.join(";\n"),
        x,
        y,
        width,
        height,
        style
    );
    let edge = graph.insertEdge(null, null, null, source, node);
    edge.visible = false;
}
function renderNonFunction ( descriptions , graph , source = null , type = "None" ) { let geo = graph . getCellGeometry ( source ) ; let x = 0 ; let y = 0 ; let sourceX = geo . x ; let sourceY = geo . y ; let fWidth = geo . width ; let fHeight = geo . height ; let width = fWidth ; let height = fHeight ; let image = "" ; switch ( type ) { case TYPE_EMOTIONAL : image = PATH_EMOTIONAL ; width = fWidth * SW_EMOTIONAL ; height = fHeight * SH_EMOTIONAL ; x = sourceX - width / 2 - fWidth / 4 ; y = sourceY - height / 2 - fHeight / 4 ; break ; case TYPE_NEGATIVE : image = PATH_NEGATIVE ; width = fWidth * SW_NEGATIVE ; height = fHeight * SH_NEGATIVE ; x = sourceX + fWidth * 1.15 - width / 2 ; y = sourceY - height / 2 - fHeight / 4 ; break ; case TYPE_QUALITY : image = PATH_QUALITY ; width = fWidth * SW_QUALITY ; height = fHeight * SH_QUALITY ; x = sourceX - width / 2 - fWidth / 4 ; y = sourceY + fHeight * 1.15 - height / 2 ; break ; case TYPE_STAKEHOLDER : image = PATH_STAKEHOLDER ; width = fWidth * SW_STAKEHOLDER ; height = fHeight * SH_STAKEHOLDER ; x = sourceX + fWidth * 1.05 - width / 2 ; y = sourceY + fHeight * 1.0 - height / 2 ; break ; } let style = "fontSize=16;fontColor=black;shape=image;image=" + image ; if ( type === TYPE_STAKEHOLDER ) { style = style + ";verticalAlign=top;verticalLabelPosition=bottom" ; } let node = graph . insertVertex ( null , null , descriptions . join ( ";\n" ) , x , y , width , height , style ) ; let edge = graph . insertEdge ( null , null , null , source , node ) ; edge . visible = false ; }
Renders a non-functional goal.
Renders a non - functional goal .
// fetch parent coordinates // customize vertex style // if stakeholder, text goes at bottom // insert the vertex // make the edge invisible - we still want to create the edge // the edge is needed when running the autolayout logic