PreviousUpNext

15.4.236  src/lib/compiler/back/low/display/graph-layout.pkg

## graph-layout.pkg
#
# Some graph layout annotations.
#
# -- Allen Leung

# Compiled by:
#     src/lib/compiler/back/low/lib/visual.lib



stipulate
    package mdv =  mapped_digraph_view;                                 # mapped_digraph_view           is from   src/lib/graph/mapped-digraph-view.pkg
    package nt  =  note;                                                # note                          is from   src/lib/src/note.pkg
    package odg =  oop_digraph;                                         # oop_digraph           is from   src/lib/graph/oop-digraph.pkg
herein


    package graph_layout {
        #
        Format
            = LABEL            String
            | COLOR            String
            | NODE_COLOR       String
            | EDGE_COLOR       String
            | TEXT_COLOR       String
            | ARROW_COLOR      String
            | BACKARROW_COLOR  String
            | BORDER_COLOR     String
            | BORDERLESS 
            | SHAPE            String 
            | ALGORITHM        String
            | EDGEPATTERN      String
            | DIR                       # For internal use only! 
            ;

        style = nt::make_notekind (THE (fn _ = "STYLE"))
             :  nt::Notekind( List( Format ) );

        Style (N,E,G) =                                         # Here N,E,G stand stead for the types of client-package-supplied records associated with (respectively) nodes, edges and graphs.
          { edge:   odg::Edge(E) -> List(Format),
            node:   odg::Node(N) -> List(Format),
            graph:  G -> List( Format )
          };

        Layout = odg::Digraph ( List(Format),  List(Format),  List(Format) );

        fun make_layout { node_fn, edge_fn, info_fn } ggg
            = 
            mdv::make_mapped_digraph_view  node_fn  edge_fn  info_fn  ggg;

        fun make_layout' ggg
            =
            {   edge_color = [COLOR "red"];

                make_layout { node_fn => fn (i, _) = [LABEL (int::to_string i)],
                              edge_fn => fn _ = edge_color,
                              info_fn => fn _ = []
                            }
                            ggg;
           };
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext