Esempio n. 1
0
def drawSideFacePair(topCorners, bottomCorners, color):
    pointList = []
    pointList2 = []
    output = G()
    XYStyle1 = StyleBuilder()
    #XYStyle1.setStroke('black')
    #XYStyle1.setStrokeWidth(1.5)
    XYStyle1.setFilling(color)
    #XYStyle1.setFillOpacity(0.8)
    XYStyle2 = StyleBuilder()
    XYStyle2.setStroke(color)
    XYStyle2.setStrokeWidth(0.5)
    XYStyle2.setFilling(color)
    pointList.append(strPathStart(topCorners[2]))
    pointList.append(strPathPoint(topCorners[3]))
    pointList.append(strPathPoint(bottomCorners[3]))
    pointList.append(strPathPoint(bottomCorners[2]))
    svgCode1 = pGram(pointList)
    pointList2.append(strPathStart(topCorners[0]))
    pointList2.append(strPathPoint(topCorners[1]))
    pointList2.append(strPathPoint(bottomCorners[1]))
    pointList2.append(strPathPoint(bottomCorners[0]))
    svgCode2 = pGram(pointList2)
    rightFace = Path(svgCode1)
    rightFace.set_style(XYStyle1.getStyle())
    leftFace = Path(svgCode2)
    leftFace.set_style(XYStyle2.getStyle())
    output.addElement(leftFace)
    output.addElement(rightFace)

    return output
Esempio n. 2
0
def drawFrontFacePair(topCorners, bottomCorners, color):
    pointList = []
    pointList2 = []
    output = G()
    YZStyle1 = StyleBuilder()
    #YZStyle1.setStroke('black')
    #YZStyle1.setStrokeWidth(1.5)
    YZStyle1.setFilling(color)
    YZStyle1.setFillOpacity(0.75)
    YZStyle2 = StyleBuilder()
    YZStyle2.setStroke('black')
    YZStyle2.setStrokeWidth(0.5)
    YZStyle2.setFillOpacity(0.75)
    YZStyle2.setFilling('#ffffff')
    pointList.append(strPathStart(topCorners[1]))
    pointList.append(strPathPoint(topCorners[2]))
    pointList.append(strPathPoint(bottomCorners[2]))
    pointList.append(strPathPoint(bottomCorners[1]))
    svgCode1 = pGram(pointList)
    pointList2.append(strPathStart(topCorners[0]))
    pointList2.append(strPathPoint(topCorners[3]))
    pointList2.append(strPathPoint(bottomCorners[3]))
    pointList2.append(strPathPoint(bottomCorners[0]))
    svgCode2 = pGram(pointList2)
    frontFace = Path(svgCode1)
    frontFace.set_style(YZStyle1.getStyle())
    backFace = Path(svgCode2)
    backFace.set_style(YZStyle2.getStyle())
    output.addElement(backFace)
    output.addElement(frontFace)

    return output
Esempio n. 3
0
 def draw(self):
     rectangleStyle = StyleBuilder()
     rectangleStyle.setStroke('black')
     rectangleStyle.setStrokeWidth(2)
     rectangleStyle.setFilling(self.color)
     self.view = Rect(self.gridCoord[0], self.gridCoord[1], self.dimA*SCALING_FACTOR, self.dimB*SCALING_FACTOR)
     self.view.set_style(rectangleStyle.getStyle())
     return self.view
Esempio n. 4
0
 def image(self):
     style_line = StyleBuilder()
     style_line.setStrokeWidth(self.dim_x / 100)
     return pysvg.shape.rect(self.pos_x - self.dim_x / 2,
                             self.pos_y - self.dim_y / 2,
                             self.dim_x,
                             self.dim_y,
                             stroke='black',
                             fill='white',
                             style=style_line.getStyle())
Esempio n. 5
0
 def image(self):
     style_line = StyleBuilder()
     style_line.setStrokeWidth(self.dim_x / 100)
     return pysvg.shape.rect(self.pos_x - self.dim_x / 2,
                             self.pos_y - self.dim_y / 2,
                             self.dim_x,
                             self.dim_y,
                             stroke='black',
                             fill='white',
                             style=style_line.getStyle())
Esempio n. 6
0
    def makerow(self):
        frameStyle = StyleBuilder()
        frameStyle.setStrokeWidth(1.5)
        frameStyle.setStroke('black')
        frameStyle.setFilling('white')
        out = G()
        yCoord = 10 + (FRAMELEN + 20) * self.i
        for z in range(0, 4):
            newFrame = Rect(10 + (FRAMELEN + 20) * z, yCoord, FRAMELEN,
                            FRAMELEN)
            newFrame.set_style(frameStyle.getStyle())
            out.addElement(newFrame)
            self.rowCoords.append([10 + (FRAMELEN + 20) * z, yCoord])

        return out
Esempio n. 7
0
 def image(self):
     style_line = StyleBuilder()
     style_line.setStrokeWidth(self.type.dim_x / 100)
     if self.type.shape == 'ellipse':
         return pysvg.shape.ellipse(self.pos_x,
                                    self.pos_y,
                                    self.type.dim_x / 2,
                                    self.type.dim_y / 2,
                                    stroke='black',
                                    fill=self.type.color,
                                    style=style_line.getStyle())
     elif self.type.shape == 'rectangle':
         return pysvg.shape.rect(self.pos_x - self.type.dim_x / 2,
                                 self.pos_y - self.type.dim_y / 2,
                                 self.type.dim_x,
                                 self.type.dim_y,
                                 stroke='black',
                                 fill=self.type.color,
                                 style=style_line.getStyle())
Esempio n. 8
0
 def image(self):
     style_line = StyleBuilder()
     style_line.setStrokeWidth(self.type.dim_x / 100)
     if self.type.shape == 'ellipse':
         return pysvg.shape.ellipse(self.pos_x,
                                    self.pos_y,
                                    self.type.dim_x / 2,
                                    self.type.dim_y / 2,
                                    stroke='black',
                                    fill=self.type.color,
                                    style=style_line.getStyle())
     elif self.type.shape == 'rectangle':
         return pysvg.shape.rect(self.pos_x - self.type.dim_x / 2,
                                 self.pos_y - self.type.dim_y / 2,
                                 self.type.dim_x,
                                 self.type.dim_y,
                                 stroke='black',
                                 fill=self.type.color,
                                 style=style_line.getStyle())
Esempio n. 9
0
    def draw(self):
        faceStyle = StyleBuilder()
        faceStyle.setFilling('blue')
        faceStyle.setStroke('black')
        faceStyle.setFillOpacity(0.5)
        topStyle = StyleBuilder()
        topStyle.setFilling('green')
        topStyle.setStroke('black')
        topStyle.setStrokeWidth(2)
        topStyle.setFillOpacity(0.5)
        sideStyle = StyleBuilder()
        sideStyle.setFilling('red')
        sideStyle.setStroke('black')
        sideStyle.setStrokeWidth(2)
        sideStyle.setFillOpacity(0.5)
        frontFace = Rect(self.startCoord[0], self.startCoord[1], self.x, self.z)
        backFace = Rect(self.startCoord[0] + self.y/math.sqrt(2), self.startCoord[1] - self.y/math.sqrt(2), self.x, self.z)
        # draw parallelogram, grab corners
        cornerBack = backFace.getEdgePoints()
        cornerFront = frontFace.getEdgePoints()
        # Top face string
        pointListT = []
        pointListT.append(strPathStart(cornerBack[0]))
        pointListT.append(strPathPoint(cornerBack[1]))
        pointListT.append(strPathPoint(cornerFront[1]))
        pointListT.append(strPathPoint(cornerFront[0]))
        topFaceString = pGram(pointListT)
        # right side face
        pointListR = [strPathStart(cornerBack[1])]
        pointListR.append(strPathPoint(cornerBack[2]))
        pointListR.append(strPathPoint(cornerFront[2]))
        pointListR.append(strPathPoint(cornerFront[1]))
        # bottom face
        pointListB = [strPathStart(cornerBack[2])]
        pointListB.append(strPathPoint(cornerBack[3]))
        pointListB.append(strPathPoint(cornerFront[3]))
        pointListB.append(strPathPoint(cornerFront[2]))
        # left
        pointListL = [strPathStart(cornerBack[0])]
        pointListL.append(strPathPoint(cornerBack[3]))
        pointListL.append(strPathPoint(cornerFront[3]))
        pointListL.append(strPathPoint(cornerFront[0]))
        # make faces
        topFace = Path(pGram(pointListT))
        rightFace = Path(pGram(pointListR))
        leftFace = Path(pGram(pointListL))
        bottomFace = Path(pGram(pointListB))

        topFace.set_style(topStyle.getStyle())
        bottomFace.set_style(topStyle.getStyle())

        rightFace.set_style(sideStyle.getStyle())
        leftFace.set_style(sideStyle.getStyle())

        frontFace.set_style(faceStyle.getStyle())
        backFace.set_style(faceStyle.getStyle())


        self.out.addElement(backFace)
        self.out.addElement(frontFace)

        self.out.addElement(rightFace)
        self.out.addElement(leftFace)

        self.out.addElement(bottomFace)
        self.out.addElement(topFace)

        return self.out