当前位置: 首页>>代码示例>>Python>>正文


Python shapes.Line类代码示例

本文整理汇总了Python中reportlab.graphics.shapes.Line的典型用法代码示例。如果您正苦于以下问题:Python Line类的具体用法?Python Line怎么用?Python Line使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Line类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeSwatchSample

    def makeSwatchSample(self,rowNo, x, y, width, height):
        baseStyle = self.lines
        styleIdx = rowNo % len(baseStyle)
        style = baseStyle[styleIdx]
        color = style.strokeColor
        y = y+height/2.
        if self.joinedLines:
            dash = getattr(style, 'strokeDashArray', getattr(baseStyle,'strokeDashArray',None))
            strokeWidth= getattr(style, 'strokeWidth', getattr(style, 'strokeWidth',None))
            L = Line(x,y,x+width,y,strokeColor=color,strokeLineCap=0)
            if strokeWidth: L.strokeWidth = strokeWidth
            if dash: L.strokeDashArray = dash
        else:
            L = None

        if hasattr(style, 'symbol'):
            S = style.symbol
        elif hasattr(baseStyle, 'symbol'):
            S = baseStyle.symbol
        else:
            S = None

        if S: S = uSymbol2Symbol(S,x+width/2.,y,color)
        if S and L:
            g = Group()
            g.add(L)
            g.add(S)
            return g
        return S or L
开发者ID:wolf29,项目名称:EG-notifications,代码行数:29,代码来源:linecharts.py

示例2: makeSwatchSample

    def makeSwatchSample(self,rowNo, x, y, width, height):
        styleCount = len(self.lines)
        styleIdx = rowNo % styleCount
        rowColor = self.lines[styleIdx].strokeColor

        if self.joinedLines:
            dash = getattr(self.lines[styleIdx], 'strokeDashArray', getattr(self.lines,'strokeDashArray',None))
            strokeWidth= getattr(self.lines[styleIdx], 'strokeWidth', getattr(self.lines[styleIdx], 'strokeWidth',None))
            L = Line(x,y,x+width,y+height,strokeColor=rowColor,strokeLineCap=0)
            if strokeWidth: L.strokeWidth = strokeWidth
            if dash: L.strokeDashArray = dash
        else:
            L = None

        if hasattr(self.lines[styleIdx], 'symbol'):
            S = self.lines[styleIdx].symbol
        elif hasattr(self.lines, 'symbol'):
            S = self.lines.symbol
        else:
            S = None

        if S: S = uSymbol2Symbol(S,x+width/2.,y+height/2.,rowColor)
        if S and L:
            g = Group()
            g.add(S)
            g.add(L)
            return g
        return S or L
开发者ID:eaudeweb,项目名称:naaya,代码行数:28,代码来源:lineplots.py

示例3: _draw_segment

    def _draw_segment(self, cur_drawing):
        """Draw a half circle representing the end of a linear chromosome.
        """
        # set the coordinates of the segment -- it'll take up the left part
        # of the space we have.
        width = (self.end_x_position - self.start_x_position) \
                * self.chr_percent
        height = self.start_y_position - self.end_y_position

        center_x = self.start_x_position + width / 2
        if self._inverted:
            center_y = self.start_y_position
            start_angle = 180
            end_angle = 360
        else:
            center_y = self.end_y_position
            start_angle = 0
            end_angle = 180
        
        cap_wedge = Wedge(center_x, center_y, width / 2,
                          start_angle, end_angle, height / 2)

        cap_wedge.fillColor = self.fill_color
        cur_drawing.add(cap_wedge)

        # draw a line to cover up the the bottom part of the wedge
        if self._inverted:
            cover_line = Line(self.start_x_position, self.start_y_position,
                              self.start_x_position + width,
                              self.start_y_position)
        else:
            cover_line = Line(self.start_x_position, self.end_y_position,
                              self.start_x_position + width,
                              self.end_y_position)

        if self.fill_color is not None:
            cover_color = self.fill_color
        else:
            cover_color = colors.white

        cover_line.strokeColor = cover_color
        cur_drawing.add(cover_line)
开发者ID:dbmi-pitt,项目名称:DIKB-Evidence-analytics,代码行数:42,代码来源:BasicChromosome.py

示例4: makeInnerLines

    def makeInnerLines(self):
        # inner grid lines
        group = Group()

        w, h = self.width, self.height

        if self.useLines == 1:
            if self.orientation == 'vertical':
                r = self.makeLinePosList(self.x, isX=1)
                for x in r:
                    line = Line(x, self.y, x, self.y + h)
                    line.strokeColor = self.strokeColor
                    line.strokeWidth = self.strokeWidth
                    group.add(line)
            elif self.orientation == 'horizontal':
                r = self.makeLinePosList(self.y, isX=0)
                for y in r:
                    line = Line(self.x, y, self.x + w, y)
                    line.strokeColor = self.strokeColor
                    line.strokeWidth = self.strokeWidth
                    group.add(line)

        return group
开发者ID:halimath,项目名称:taskcardmaker,代码行数:23,代码来源:grids.py

示例5: draw

 def draw(self):
     l = Line(self.x,self.y,self.x+self.width,self.y)
     l.strokeColor = self.strokeColor
     l.strokeDashArray  = self.strokeDashArray
     l.strokeWidth = self.height
     return l
开发者ID:Distrotech,项目名称:reportlab,代码行数:6,代码来源:legends.py

示例6: render


#.........这里部分代码省略.........
                            target = element
                            break

                if target is None:
                    msg = "Could not find use node '%s'" % link_id
                    raise SVGError(msg)

            self.render(target, group)

            parent.add(group)

            # apply transform
            transforms = node.get('transform')
            if transforms:
                for op in parseTransform.iterparse(transforms):
                    self.applyTransformOnGroup(group, op)

            # apply 'x' and 'y' attribute as translation of defs object
            if node.get('x') or node.get('y'):
                dx = parseLength(node.get('x','0'))
                dy = parseLength(node.get('y','0'))

                self.applyTransformOnGroup(group, ('translate', (dx,dy)))

            self.level -= 1

        elif node.tag == self.SVG_LINE:
            # get coordinates
            x1 = parseLength(node.get('x1', '0'))
            y1 = parseLength(node.get('y1', '0'))
            x2 = parseLength(node.get('x2', '0'))
            y2 = parseLength(node.get('y2', '0'))

            shape = Line(x1, y1, x2, y2)
            self.addShape(parent, node, shape)

        elif node.tag == self.SVG_RECT:
            # get coordinates
            x = parseLength(node.get('x', '0'))
            y = parseLength(node.get('y', '0'))
            width = parseLength(node.get('width'))
            height = parseLength(node.get('height'))

            rx = parseLength(node.get('rx', '0'))
            ry = parseLength(node.get('ry', '0'))

            shape = Rect(x, y, width, height, rx=rx, ry=ry)
            self.addShape(parent, node, shape)

        elif node.tag == self.SVG_CIRCLE:
            cx = parseLength(node.get('cx', '0'))
            cy = parseLength(node.get('cy', '0'))
            r = parseLength(node.get('r'))

            if r > 0.:
                shape = Circle(cx, cy, r)
                self.addShape(parent, node, shape)

        elif node.tag == self.SVG_ELLIPSE:
            cx = parseLength(node.get('cx', '0'))
            cy = parseLength(node.get('cy', '0'))
            rx = parseLength(node.get('rx'))
            ry = parseLength(node.get('ry'))

            if rx > 0. and ry > 0.:
                shape = Ellipse(cx, cy, rx, ry)
开发者ID:eseifert,项目名称:svg2rlg,代码行数:67,代码来源:svg2rlg.py


注:本文中的reportlab.graphics.shapes.Line类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。