本文整理汇总了Python中HealthNet.static.reportlab.graphics.shapes.Group.shift方法的典型用法代码示例。如果您正苦于以下问题:Python Group.shift方法的具体用法?Python Group.shift怎么用?Python Group.shift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HealthNet.static.reportlab.graphics.shapes.Group
的用法示例。
在下文中一共展示了Group.shift方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw
# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import shift [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
示例2: _borderDraw
# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import shift [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
示例3: draw
# 需要导入模块: from HealthNet.static.reportlab.graphics.shapes import Group [as 别名]
# 或者: from HealthNet.static.reportlab.graphics.shapes.Group import shift [as 别名]
def draw(self):
g = Group()
ys = self.bottomPadding+(self.triangleHeight/2)+self.sourceLabelOffset+self.sourceLabelFontSize
if self.background:
x,y = self._getDrawingDimensions()
g.add(Rect(-self.leftPadding,-ys,x,y,
strokeColor=None,
strokeWidth=0,
fillColor=self.background))
ascent=getFont(self.labelFontName).face.ascent/1000.
if ascent==0: ascent=0.718 # default (from helvetica)
ascent=ascent*self.labelFontSize # normalize
colorsList = self._getColors()
# Draw the boxes - now uses ShadedRect from grids
x=0
for f in range (0,self.numberOfBoxes):
sr=ShadedRect()
sr.x=x
sr.y=0
sr.width=self.boxWidth
sr.height=self.boxHeight
sr.orientation = 'vertical'
sr.numShades = 30
sr.fillColorStart = colorsList[f]
sr.fillColorEnd = colorsList[f+1]
sr.strokeColor = None
sr.strokeWidth = 0
g.add(sr)
g.add(Rect(x,0,self.boxWidth,self.boxHeight,
strokeColor=self.boxOutlineColor,
strokeWidth=self.boxOutlineWidth,
fillColor=None))
g.add(String(x+self.boxWidth/2.,(self.boxHeight-ascent)/2.,
text = str(f+1),
fillColor = self.labelFillColor,
strokeColor=self.labelStrokeColor,
textAnchor = 'middle',
fontName = self.labelFontName,
fontSize = self.labelFontSize))
x=x+self.boxWidth+self.boxSpacing
#do triangles
xt = (self.trianglePosition*self.boxWidth)
if self.trianglePosition>1:
xt = xt+(self.trianglePosition-1)*self.boxSpacing
xt = xt-(self.boxWidth/2)
g.add(Polygon(
strokeColor = self.triangleStrokeColor,
strokeWidth = self.triangleStrokeWidth,
fillColor = self.triangleFillColor,
points=[xt,self.boxHeight-(self.triangleHeight/2),
xt-(self.triangleWidth/2),self.boxHeight+(self.triangleHeight/2),
xt+(self.triangleWidth/2),self.boxHeight+(self.triangleHeight/2),
xt,self.boxHeight-(self.triangleHeight/2)]))
g.add(Polygon(
strokeColor = self.triangleStrokeColor,
strokeWidth = self.triangleStrokeWidth,
fillColor = self.triangleFillColor,
points=[xt,0+(self.triangleHeight/2),
xt-(self.triangleWidth/2),0-(self.triangleHeight/2),
xt+(self.triangleWidth/2),0-(self.triangleHeight/2),
xt,0+(self.triangleHeight/2)]))
#source label
if self.sourceLabelText != None:
g.add(String(x-self.boxSpacing,0-(self.triangleHeight/2)-self.sourceLabelOffset-(self.sourceLabelFontSize),
text = self.sourceLabelText,
fillColor = self.sourceLabelFillColor,
textAnchor = 'end',
fontName = self.sourceLabelFontName,
fontSize = self.sourceLabelFontSize))
g.shift(self.leftPadding, ys)
return g