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


Python Group.add方法代码示例

本文整理汇总了Python中HealthNet.static.reportlab.graphics.shapes.Group.add方法的典型用法代码示例。如果您正苦于以下问题:Python Group.add方法的具体用法?Python Group.add怎么用?Python Group.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HealthNet.static.reportlab.graphics.shapes.Group的用法示例。


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

示例1: makeSwatchSample

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def makeSwatchSample(self,rowNo, x, y, width, height):
        baseStyle = self.lines
        styleIdx = rowNo % len(baseStyle)
        style = baseStyle[styleIdx]
        color = style.strokeColor
        yh2 = y+height/2.
        lineStyle = getattr(style,'lineStyle',None)
        if lineStyle=='bar':
            dash = getattr(style, 'strokeDashArray', getattr(baseStyle,'strokeDashArray',None))
            strokeWidth= getattr(style, 'strokeWidth', getattr(style, 'strokeWidth',None))
            L = Rect(x,y,width,height,strokeWidth=strokeWidth,strokeColor=color,strokeLineCap=0,strokeDashArray=dash,fillColor=getattr(style,'fillColor',color))
        elif self.joinedLines or lineStyle=='joinedLine':
            dash = getattr(style, 'strokeDashArray', getattr(baseStyle,'strokeDashArray',None))
            strokeWidth= getattr(style, 'strokeWidth', getattr(style, 'strokeWidth',None))
            L = Line(x,yh2,x+width,yh2,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.,yh2,color)
        if S and L:
            g = Group()
            g.add(L)
            g.add(S)
            return g
        return S or L
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:36,代码来源:linecharts.py

示例2: _Flag_Greece

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def _Flag_Greece(self):
        s = _size
        g = Group()

        box = Rect(0, 0, s*2, s, fillColor = colors.gold,
                        strokeColor = colors.black, strokeWidth=0)
        g.add(box)

        for stripecounter in range (9,0, -1):
            stripeheight = s/9.0
            if not (stripecounter%2 == 0):
                stripecolor = colors.deepskyblue
            else:
                stripecolor = colors.mintcream

            blueorwhiteline = Rect(0, (s-(stripeheight*stripecounter)), width=s*2, height=stripeheight,
                fillColor = stripecolor, strokeColor = None, strokeWidth=20)
            g.add(blueorwhiteline)

        bluebox1 = Rect(0, ((s)-stripeheight*5), width=(stripeheight*5), height=stripeheight*5,
            fillColor = colors.deepskyblue, strokeColor = None, strokeWidth=0)
        g.add(bluebox1)

        whiteline1 = Rect(0, ((s)-stripeheight*3), width=stripeheight*5, height=stripeheight,
            fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
        g.add(whiteline1)

        whiteline2 = Rect((stripeheight*2), ((s)-stripeheight*5), width=stripeheight, height=stripeheight*5,
            fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
        g.add(whiteline2)

        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:34,代码来源:flags.py

示例3: _Flag_Spain

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
 def _Flag_Spain(self):
     s = _size
     g = Group()
     w = self._width = s*1.5
     g.add(Rect(0, 0, width=w, height=s, fillColor = colors.red, strokeColor = None, strokeWidth=0))
     g.add(Rect(0, (s/4.0), width=w, height=s/2.0, fillColor = colors.yellow, strokeColor = None, strokeWidth=0))
     return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:9,代码来源:flags.py

示例4: draw

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def draw(self):
        s = float(self.size)  #abbreviate as we will use this a lot
        g = Group()

        # new algorithm from markers.StarFive
        R = float(self.size)/2
        r = R*sin(18*(pi/180.0))/cos(36*(pi/180.0))
        P = []
        angle = 90
        for i in range(5):
            for radius in R, r:
                theta = angle*(pi/180.0)
                P.append(radius*cos(theta))
                P.append(radius*sin(theta))
                angle = angle + 36
        # star specific bits
        star = Polygon(P,
                    fillColor = self.fillColor,
                    strokeColor = self.strokeColor,
                    strokeWidth=s/50)
        g.rotate(self.angle)
        g.shift(self.x+self.dx,self.y+self.dy)
        g.add(star)

        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:27,代码来源:flags.py

示例5: rotatedEnclosingRect

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
def rotatedEnclosingRect(P, angle, rect):
    '''
    given P a sequence P of x,y coordinate pairs and an angle in degrees
    find the centroid of P and the axis at angle theta through it
    find the extreme points of P wrt axis parallel distance and axis
    orthogonal distance. Then compute the least rectangle that will still
    enclose P when rotated by angle.

    The class R
    '''
    from math import pi, cos, sin, tan
    x0, y0 = centroid(P)
    theta = (angle/180.)*pi
    s,c=sin(theta),cos(theta)
    def parallelAxisDist(xy,s=s,c=c,x0=x0,y0=y0):
        x,y = xy
        return (s*(y-y0)+c*(x-x0))
    def orthogonalAxisDist(xy,s=s,c=c,x0=x0,y0=y0):
        x,y = xy
        return (c*(y-y0)+s*(x-x0))
    L = list(map(parallelAxisDist,P))
    L.sort()
    a0, a1 = L[0], L[-1]
    L = list(map(orthogonalAxisDist,P))
    L.sort()
    b0, b1 = L[0], L[-1]
    rect.x, rect.width = a0, a1-a0
    rect.y, rect.height = b0, b1-b0
    g = Group(transform=(c,s,-s,c,x0,y0))
    g.add(rect)
    return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:33,代码来源:grids.py

示例6: getTalkRect

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def getTalkRect(self, startTime, duration, trackId, text):
        "Return shapes for a specific talk"
        g = Group()
        y_bottom = self.scaleTime(startTime + duration)
        y_top = self.scaleTime(startTime)
        y_height = y_top - y_bottom

        if trackId is None:
            #spans all columns
            x = self._colLeftEdges[1]
            width = self.width - self._colWidths[0]
        else:
            #trackId is 1-based and these arrays have the margin info in column
            #zero, so no need to add 1
            x = self._colLeftEdges[trackId]
            width = self._colWidths[trackId]

        lab = Label()
        lab.setText(text)
        lab.setOrigin(x + 0.5*width, y_bottom+0.5*y_height)
        lab.boxAnchor = 'c'
        lab.width = width
        lab.height = y_height
        lab.fontSize = 6

        r = Rect(x, y_bottom, width, y_height, fillColor=colors.cyan)
        g.add(r)
        g.add(lab)

        #now for a label
        # would expect to color-code and add text
        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:34,代码来源:eventcal.py

示例7: makeInnerTiles

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def makeInnerTiles(self):
        # inner grid lines
        group = Group()

        w, h = self.width, self.height

        # inner grid stripes (solid rectangles)
        if self.useRects == 1:
            cols = self.stripeColors

            if self.orientation == 'vertical':
                r = self.makeLinePosList(self.x, isX=1)
            elif self.orientation == 'horizontal':
                r = self.makeLinePosList(self.y, isX=0)

            dist = makeDistancesList(r)

            i = 0
            for j in range(len(dist)):
                if self.orientation == 'vertical':
                    x = r[j]
                    stripe = Rect(x, self.y, dist[j], h)
                elif self.orientation == 'horizontal':
                    y = r[j]
                    stripe = Rect(self.x, y, w, dist[j])
                stripe.fillColor = cols[i % len(cols)]
                stripe.strokeColor = None
                group.add(stripe)
                i = i + 1

        return group
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:33,代码来源:grids.py

示例8: makeCircularString

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
def makeCircularString(x, y, radius, angle, text, fontName, fontSize, inside=0, G=None,textAnchor='start'):
    '''make a group with circular text in it'''
    if not G: G = Group()

    angle %= 360
    pi180 = pi/180
    phi = angle*pi180
    width = stringWidth(text, fontName, fontSize)
    sig = inside and -1 or 1
    hsig = sig*0.5
    sig90 = sig*90

    if textAnchor!='start':
        if textAnchor=='middle':
            phi += sig*(0.5*width)/radius
        elif textAnchor=='end':
            phi += sig*float(width)/radius
        elif textAnchor=='numeric':
            phi += sig*float(numericXShift(textAnchor,text,width,fontName,fontSize,None))/radius

    for letter in text:
        width = stringWidth(letter, fontName, fontSize)
        beta = float(width)/radius
        h = Group()
        h.add(String(0, 0, letter, fontName=fontName,fontSize=fontSize,textAnchor="start"))
        h.translate(x+cos(phi)*radius,y+sin(phi)*radius)    #translate to radius and angle
        h.rotate((phi-hsig*beta)/pi180-sig90)               # rotate as needed
        G.add(h)                                            #add to main group
        phi -= sig*beta                                     #increment

    return G
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:33,代码来源:utils.py

示例9: _Flag_Japan

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
 def _Flag_Japan(self):
     s = _size
     g = Group()
     w = self._width = s*1.5
     g.add(Rect(0,0,w,s,fillColor=colors.mintcream,strokeColor=None, strokeWidth=0))
     g.add(Circle(cx=w/2.0,cy=s/2.0,r=0.3*w,fillColor=colors.red,strokeColor=None, strokeWidth=0))
     return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:9,代码来源:flags.py

示例10: draw

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def draw(self):
        self.qr.make()

        g = Group()

        color = self.barFillColor
        border = self.barBorder
        width = self.barWidth
        height = self.barHeight
        x = self.x
        y = self.y

        g.add(SRect(x, y, width, height, fillColor=None))

        moduleCount = self.qr.getModuleCount()
        minwh = float(min(width, height))
        boxsize = minwh / (moduleCount + border * 2.0)
        offsetX = x + (width - minwh) / 2.0
        offsetY = y + (minwh - height) / 2.0

        for r, row in enumerate(self.qr.modules):
            row = map(bool, row)
            c = 0
            for t, tt in itertools.groupby(row):
                isDark = t
                count = len(list(tt))
                if isDark:
                    x = (c + border) * boxsize
                    y = (r + border + 1) * boxsize
                    s = SRect(offsetX + x, offsetY + height - y, count * boxsize, boxsize)
                    g.add(s)
                c += count

        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:36,代码来源:qr.py

示例11: _borderDraw

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
 def _borderDraw(self,f):
     s = self.size  # abbreviate as we will use this a lot
     g = Group()
     g.add(f)
     x, y, sW = self.x+self.dx, self.y+self.dy, self.strokeWidth/2.
     g.insert(0,Rect(-sW, -sW, width=getattr(self,'_width',2*s)+3*sW, height=getattr(self,'_height',s)+2*sW,
             fillColor = None, strokeColor = self.strokeColor, strokeWidth=sW*2))
     g.shift(x,y)
     g.scale(s/_size, s/_size)
     return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:12,代码来源:flags.py

示例12: draw

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
 def draw(self):
     dx = self.width / 16.0
     dy = self.height / 16.0
     g = Group()
     g.add(Rect(self.x, self.y, self.width, self.height,
                fillColor=None, strokeColor=colors.black))
     for x in range(16):
         for y in range(16):
             charValue = y * 16 + x
             if charValue > 32:
                 s = String(self.x + x * dx,
                            self.y + (self.height - y*dy), int2Byte(charValue))
                 g.add(s)
     return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:16,代码来源:codecharts.py

示例13: makeBackground

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def makeBackground(self):
        g = Group()

        g.add(HorizontalLineChart.makeBackground(self))

        valAxis = self.valueAxis
        valTickPositions = valAxis._tickValues

        for y in valTickPositions:
            y = valAxis.scale(y)
            g.add(Line(self.x, y, self.x+self.width, y,
                       strokeColor = self.strokeColor))

        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:16,代码来源:linecharts.py

示例14: _Flag_Cuba

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def _Flag_Cuba(self):
        s = _size
        g = Group()

        for i in range(5):
            stripe = Rect(0, i*s/5.0, width=s*2, height=s/5.0,
                fillColor = [colors.darkblue, colors.mintcream][i%2],
                strokeColor = None,
                strokeWidth=0)
            g.add(stripe)

        redwedge = Polygon(points = [ 0, 0, 4*s/5.0, (s/2.0), 0, s],
                    fillColor = colors.red, strokeColor = None, strokeWidth=0)
        g.add(redwedge)

        star = Star()
        star.x = 2.5*s/10.0
        star.y = s/2.0
        star.size = 3*s/10.0
        star.fillColor = colors.white
        g.add(star)

        box = Rect(0, 0, s*2, s,
            fillColor = None,
            strokeColor = colors.black,
            strokeWidth=0)
        g.add(box)

        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:31,代码来源:flags.py

示例15: _Flag_Turkey

# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import add [as 别名]
    def _Flag_Turkey(self):
        s = _size
        g = Group()

        box = Rect(0, 0, s*2, s,
            fillColor = colors.red,
                        strokeColor = colors.black,
            strokeWidth=0)
        g.add(box)

        whitecircle = Circle(cx=((s*0.35)*2), cy=s/2.0, r=s*0.3,
            fillColor = colors.mintcream,
            strokeColor = None,
            strokeWidth=0)
        g.add(whitecircle)

        redcircle = Circle(cx=((s*0.39)*2), cy=s/2.0, r=s*0.24,
            fillColor = colors.red,
            strokeColor = None,
            strokeWidth=0)
        g.add(redcircle)

        ws = Star()
        ws.angle = 15
        ws.size = s/5.0
        ws.x = (s*0.5)*2+ws.size/2.0
        ws.y = (s*0.5)
        ws.fillColor = colors.mintcream
        ws.strokeColor = None
        g.add(ws)
        return g
开发者ID:bellyflopp,项目名称:HealthNet,代码行数:33,代码来源:flags.py


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