GoalModelEditor/FrontEnd/public/js/projectEdit/graph.js
/**
 * Renders a functional goal. The most important thing that this
 * does is call renderGoals() over each of the goals children.
 * : goal, the goal to be rendered (a Goal JSON object)
 * : graph, the graph to render the goal into
 * : source, the parent of the goal
 */
Renders a functional goal. The most important thing that this
does is call renderGoals() over each of the goals children.
: goal, the goal to be rendered (a Goal JSON object)
: graph, the graph to render the goal into
: source, the parent of the goal
Renders a functional goal . The most important thing that this does is call renderGoals () over each of the goals children . : goal the goal to be rendered ( a Goal JSON object ) : graph the graph to render the goal into : source the parent of the goal
function renderFunction(goal, graph, source = null) {
    let image = PATH_FUNCTIONAL;
    let width = SYMBOL_WIDTH;
    let height = SYMBOL_HEIGHT;
    if (source != null) {
        let geo = graph.getCellGeometry(source);
        width = geo.width * CHILD_SIZE_SCALE;
        height = geo.height * CHILD_SIZE_SCALE;
    }
    let node = graph.insertVertex(
        null,
        null,
        goal.GoalContent,
        SYMBOL_X_COORD,
        SYMBOL_Y_COORD,
        width,
        height,
        "fontSize=16;fontColor=black;shape=image;image=" + image
    );
    let edge = graph.insertEdge(null, null, null, source, node);
    if (rootGoal === null) {
        rootGoal = node;
    }
    renderGoals(goal.SubGoals, graph, node);
}
function renderFunction ( goal , graph , source = null ) { let image = PATH_FUNCTIONAL ; let width = SYMBOL_WIDTH ; let height = SYMBOL_HEIGHT ; if ( source != null ) { let geo = graph . getCellGeometry ( source ) ; width = geo . width * CHILD_SIZE_SCALE ; height = geo . height * CHILD_SIZE_SCALE ; } let node = graph . insertVertex ( null , null , goal . GoalContent , SYMBOL_X_COORD , SYMBOL_Y_COORD , width , height , "fontSize=16;fontColor=black;shape=image;image=" + image ) ; let edge = graph . insertEdge ( null , null , null , source , node ) ; if ( rootGoal === null ) { rootGoal = node ; } renderGoals ( goal . SubGoals , graph , node ) ; }
Renders a functional goal.
Renders a functional goal .
// styling // insert new vertex and edge into graph // if no root goal is registered, then store this as root // then recurse over the goal's children