Esempio n. 1
0
 def on_render(self, cvs, system):
     Box.on_render(self, cvs, system)
     Atom.on_render(self, cvs, system)
     x = system[self.x]
     y = system[self.y]
     top = system[self.top] + PIP
     bot = system[self.bot] + PIP
     x0 = system[self.x_bot[0]]
     #cvs.stroke(path.line(x0, y-bot, x0, y+top), self.attrs)
     cvs.stroke(path.line(x0, y + top, x0, y - bot), self.attrs)
Esempio n. 2
0
    def on_render(self, cvs, system):
        Box.on_render(self, cvs, system)
        Atom.on_render(self, cvs, system)

        y = system[self.y]
        top = system[self.top] + PIP
        bot = system[self.bot]
        y0 = y + top
        x0 = system[self.x_top[0]]
        x1 = system[self.x_top[1]]
        x2 = 0.5 * (x0 + x1)
        radius = 0.5 * (x1 - x0)
        cvs.stroke(path.arc(x2, y0, radius, pi, 0.))
Esempio n. 3
0
    def on_render(self, cvs, system):
        Box.on_render(self, cvs, system)
        Atom.on_render(self, cvs, system)

        y = system[self.y]
        top = system[self.top]
        bot = system[self.bot] + PIP
        y0 = y - bot
        x0 = system[self.x_bot[0]]
        x1 = system[self.x_bot[1]]
        x2 = 0.5 * (x0 + x1)
        radius = 0.5 * (x1 - x0)
        cvs.stroke(path.arc(x2, y0, radius, 0., pi))
Esempio n. 4
0
    def on_render(self, cvs, system):
        Box.on_render(self, cvs, system)
        Atom.on_render(self, cvs, system)

        n = self.n_top + self.n_bot
        if n == 0:
            return

        y = system[self.y]
        top = system[self.top] + PIP
        bot = system[self.bot] + PIP
        y_top = y + top
        y_bot = y - bot
        x_mid, y_mid = self.get_align("center")
        x0, y0 = system[x_mid], system[y_mid]

        x_top = [system[x] for x in self.x_top]
        x_bot = [system[x] for x in self.x_bot]
        x0 = self._get_pipx(x_top, x_bot)

        conv = lambda x0, x1, t: (1. - t) * x0 + t * x1

        top_attrs = self.top_attrs
        bot_attrs = self.bot_attrs

        trace = self.trace
        trace["top"] = []
        trace["bot"] = []

        y3 = y_top
        for x3, attrs in zip(x_top, top_attrs):
            x2, y2 = x3, conv(y3, y0, 0.3)
            x1, y1 = conv(x0, x3, 0.7), conv(y3, y0, 0.7)
            p = path.curve(x3, y3, x2, y2, x1, y1, x0, y0)
            trace["top"].append(p)
            cvs.stroke(p, attrs)

        y3 = y_bot
        for x3, attrs in zip(x_bot, bot_attrs):
            x2, y2 = x3, conv(y3, y0, 0.3)
            x1, y1 = conv(x0, x3, 0.7), conv(y3, y0, 0.7)
            p = path.curve(x0, y0, x1, y1, x2, y2, x3, y3)
            trace["bot"].append(p)
            cvs.stroke(p, attrs)

        #cvs.fill(path.circle(x0, y0, 0.04))
        if self.pip is not None:
            self.pip.render(cvs, x0, y0)
Esempio n. 5
0
 def on_render(self, cvs, system):
     Box.on_render(self, cvs, system)
     Atom.on_render(self, cvs, system)