Beispiel #1
0
    def interpret(self, inputmtg=None, turtle=None):
        if inputmtg is None:
            if self.currentmtg is None: self.init()
            mtg = self.currentmtg
        else:
            mtg = inputmtg

        if turtle is None:
            from openalea.plantgl.all import PglTurtle
            turtle = PglTurtle()

        turtle.start()

        rules = self.__get_rules('__isinterpretation__')

        def preorder(node):
            if node.edge_type() == '+': turtle.push()
            turtle.setId(node._vid)
            if rules.has_key(node.label):
                rules[node.label](node, turtle)

        def postorder(node):
            if node.edge_type() == '+': turtle.pop()

        nodes_forward_traversal(mtg, preorder, postorder)

        turtle.stop()

        return turtle
Beispiel #2
0
    def interpret(self, inputmtg=None, turtle=None):
        if inputmtg is None:
            if self.currentmtg is None:
                self.init()
            mtg = self.currentmtg
        else:
            mtg = inputmtg

        if turtle is None:
            from openalea.plantgl.all import PglTurtle

            turtle = PglTurtle()

        turtle.start()

        rules = self.__get_rules("__isinterpretation__")

        def preorder(node):
            if node.edge_type() == "+":
                turtle.push()
            turtle.setId(node._vid)
            if rules.has_key(node.label):
                rules[node.label](node, turtle)

        def postorder(node):
            if node.edge_type() == "+":
                turtle.pop()

        nodes_forward_traversal(mtg, preorder, postorder)

        turtle.stop()

        return turtle
Beispiel #3
0
def sweepSymbol(path,
                section,
                length,
                dlength,
                radius=1,
                radiusvariation=None):
    from openalea.plantgl.all import PglTurtle
    t = PglTurtle()
    t.start()
    return t.startGC().sweep(path, section, length, dlength, radius,
                             radiusvariation).stopGC().getScene()[0].geometry
Beispiel #4
0
 def sweepSymbol(self, path):
   from openalea.plantgl.all import PglTurtle
   t = PglTurtle()
   t.start()
   return t.startGC().sweep(path, self.section, self.length, self.dlength, self.radius, self.radiusvariation).stopGC().getScene()[0].geometry