Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tree 我怎样在榆树上画一条线?_Tree_Draw_Diagram_Lines_Elm - Fatal编程技术网

Tree 我怎样在榆树上画一条线?

Tree 我怎样在榆树上画一条线?,tree,draw,diagram,lines,elm,Tree,Draw,Diagram,Lines,Elm,这段代码是一个没有线条的树形图。如何实现和绘制代码中的线条 main = collage 700 700 ( drawTree exampleTree (0,0) 1) drawNode name = group [filled red <| circle 50 , text <|fromString name] type Tree = Node String Tree Tree | Nil exampl

这段代码是一个没有线条的树形图。如何实现和绘制代码中的线条

main = collage 700 700 ( drawTree exampleTree (0,0) 1)

drawNode name = group 
                  [filled red <| circle 50
                  , text <|fromString name]

type Tree = Node String Tree Tree | Nil

exampleTree = Node "Me" (Node "Mother" 
                             (Node "Grandmother" Nil Nil)
                             (Node "Grandfather" Nil Nil))
                       (Node "Father"
                             (Node "Grandfather" Nil Nil)
                             (Node "Grandmother" Nil Nil))

drawTree : Tree ->(Float, Float) -> Float -> List Form
drawTree tree (x,y) depth = case tree of
                        (Node ss t1 t2 )-> move (x,y) (drawNode ss) :: (List.append (drawTree t1 (x+100+depth,y+100) (depth+50)) (drawTree t2 (x-100-depth,y+100)(depth+50)))
                        Nil -> []
main=collage 700 700(drawTree示例树(0,0)1)
drawNode名称=组
[填写红色浮动->列表表单
drawTree树(x,y)深度=案例树
(节点ss t1 t2)->移动(x,y)(drawNode ss):(List.append(drawTree t1(x+100+深度,y+100)(深度+50))(drawTree t2(x-100-深度,y+100)(深度+50)))
零->[]

因此,您已经找到了
拼贴
;在文档的同一页上,您应该能够找到和它的函数…

我对如何应用文档感到困惑也许您可以尝试编写一个简单的独立elm程序,只画一条线,然后一旦您理解了,请再次尝试使用该树uld帮助。是的,我试过了,但我不知道如何将其实现到我的代码中以便显示。嗯,看起来您正在设法在
drawNode
中创建一些形状;也许可以从添加一些线条开始?