GoalModelEditor/FrontEnd/public/js/projectEdit/graph.js
/**
 * Recursively renders the goal hierarchy.
 * : goals, the top-level array of goals
 * : graph, the graph into which goals will be rendered
 * : source, the parent goal of the given array, defaults to null
 */
Recursively renders the goal hierarchy.
: goals, the top-level array of goals
: graph, the graph into which goals will be rendered
: source, the parent goal of the given array, defaults to null
Recursively renders the goal hierarchy . : goals the top - level array of goals : graph the graph into which goals will be rendered : source the parent goal of the given array defaults to null
function renderGoals(goals, graph, source = null) {
    console.log("Logging: renderGoals() called on list: " + goals);
    let emotions = [];
    let qualities = [];
    let concerns = [];
    let stakeholders = [];
    for (let i = 0; i < goals.length; i++) {
        let goal = goals[i];
        let type = goal.GoalType;
        let content = goal.GoalContent;
        if (type === TYPE_FUNCTIONAL) {
            renderFunction(goal, graph, source);
        } else if (type === TYPE_EMOTIONAL) {
            emotions.push(content);
        } else if (type === TYPE_NEGATIVE) {
            concerns.push(content);
        } else if (type === TYPE_QUALITY) {
            qualities.push(content);
        } else if (type === TYPE_STAKEHOLDER) {
            stakeholders.push(content);
        } else {
            console.log("Logging: goal of unknown type received: " + type);
        }
    }
    var key;
    if (source === null) {
        key = ROOT_KEY;
    } else {
        key = source.value;
    }
    if (emotions.length) {
        emotionsGlob[key] = emotions;
    }
    if (qualities.length) {
        qualitiesGlob[key] = qualities;
    }
    if (concerns.length) {
        negativesGlob[key] = concerns;
    }
    if (stakeholders.length) {
        stakeholdersGlob[key] = stakeholders;
    }
}
function renderGoals ( goals , graph , source = null ) { console . log ( "Logging: renderGoals() called on list: " + goals ) ; let emotions = [ ] ; let qualities = [ ] ; let concerns = [ ] ; let stakeholders = [ ] ; for ( let i = 0 ; i < goals . length ; i ++ ) { let goal = goals [ i ] ; let type = goal . GoalType ; let content = goal . GoalContent ; if ( type === TYPE_FUNCTIONAL ) { renderFunction ( goal , graph , source ) ; } else if ( type === TYPE_EMOTIONAL ) { emotions . push ( content ) ; } else if ( type === TYPE_NEGATIVE ) { concerns . push ( content ) ; } else if ( type === TYPE_QUALITY ) { qualities . push ( content ) ; } else if ( type === TYPE_STAKEHOLDER ) { stakeholders . push ( content ) ; } else { console . log ( "Logging: goal of unknown type received: " + type ) ; } } var key ; if ( source === null ) { key = ROOT_KEY ; } else { key = source . value ; } if ( emotions . length ) { emotionsGlob [ key ] = emotions ; } if ( qualities . length ) { qualitiesGlob [ key ] = qualities ; } if ( concerns . length ) { negativesGlob [ key ] = concerns ; } if ( stakeholders . length ) { stakeholdersGlob [ key ] = stakeholders ; } }
Recursively renders the goal hierarchy.
Recursively renders the goal hierarchy .
// accumulate non-functional goals to be rendered into a single symbol // run through each goal in the given array // recurse over functional goals // accumulate non-functional descriptions into buckets // render each of the non-functional goals