

def realizeSymbol(self, pp, grp, arp, symbol, annotation, onY2, clipPlotArea, clipDecoratedChart, drawMainSymbol, x, y, prevX, prevY, nextX, nextY):
    if ((Double.NaN == x) or (Double.NaN == y)):
        return
    xPx = pp.xToPixel(x)
    yPx = pp.yToPixel(y, onY2)
    prevXPx = pp.xToPixel(prevX)
    prevYPx = pp.yToPixel(prevY, onY2)
    nextXPx = pp.xToPixel(nextX)
    nextYPx = pp.yToPixel(nextY, onY2)
    spacing = symbol.getFillSpacing()
    thickness = symbol.getFillThickness()
    canvas = grp.getCanvas()
    if ((0 == spacing) and (None != canvas) and (thickness > 0)):
        if (None == self.horizontallyBanded):
            '\n                * Continuous fill, canvas available, and not explicitly\n                * horizontally or vertically banded. For example, BOX_*\n                * symbol types are not explicitly oriented, but VBAR_*\n                * (vertically) and HBAR_* (horizontally) are: use canvas\n                * to draw a straight line between points.  <p>\n                *\n                * Code in this branch also gets executed by the LINE\n                * symbol type.\n                *\n                '
            borderWidth = symbol.getBorderWidth()
            if (borderWidth >= 0):
                externalLineWidth = thickness
            else:
                externalLineWidth = (thickness + (2 * abs(borderWidth)))
            if (borderWidth >= 0):
                internalLineWidth = max((thickness - (2 * borderWidth)), 0)
            else:
                internalLineWidth = thickness
            borderColor = symbol.getBorderColor()
            backgroundColor = symbol.getBackgroundColor()
            if ((externalLineWidth > 0) and (((GChartConsts.TRANSPARENT_BORDER_COLOR != borderColor) and ('transparent' != borderColor)) or ((GChartConsts.TRANSPARENT_BORDER_COLOR != backgroundColor) and ('transparent' != backgroundColor)))):
                if ((Double.NaN == prevX) or (Double.NaN == prevY)):
                    canvas.beginPath()
                    canvas.moveTo((xPx - grp.x0), (yPx - grp.y0))
                if ((Double.NaN == nextX) or (Double.NaN == nextY)):
                    if ((GChartConsts.TRANSPARENT_BORDER_COLOR != borderColor) and ('transparent' != borderColor) and (externalLineWidth > 0)):
                        canvas.setStrokeStyle(borderColor)
                        canvas.setLineWidth(externalLineWidth)
                        canvas.stroke()
                    if ((GChartConsts.TRANSPARENT_BORDER_COLOR != backgroundColor) and ('transparent' != backgroundColor) and (internalLineWidth > 0)):
                        canvas.setLineWidth(internalLineWidth)
                        canvas.setStrokeStyle(backgroundColor)
                        canvas.stroke()
                else:
                    canvas.lineTo((nextXPx - grp.x0), (nextYPx - grp.y0))
        else:
            '\n                * Explicitly oriented bandedness occurs only for vert or\n                * horizontal bars. x,y coordinates are connected into\n                * a path (as in a line chart), and then that path\n                * is extended into a closed polygon by adding a\n                * closing segment formed from an appropriate\n                * section of an axis or baseline.\n                *\n                '
            '\n                * Draw area interpolated between successive bars.\n                *\n                * Note that the "opposite" edge could be a point on an\n                * x or y axis, or on the curve\'s baseline, depending\n                * on the kind of bar chart involved: it\'s the edge\n                * of the bar that is furthest from the x,y point.\n                *\n                '
            closeStrokeAndFill = False
            if (False == self.horizontallyBanded):
                if ((Double.NaN == prevX) or (Double.NaN == prevY)):
                    self.oppositeEdge = self.getEdgeOppositeVertically(pp, symbol, y, onY2)
                    canvas.beginPath()
                    canvas.moveTo((xPx - grp.x0), (self.oppositeEdge - grp.y0))
                    canvas.lineTo((xPx - grp.x0), (yPx - grp.y0))
                if ((Double.NaN == nextX) or (Double.NaN == nextY)):
                    canvas.lineTo((xPx - grp.x0), (self.oppositeEdge - grp.y0))
                    closeStrokeAndFill = True
                else:
                    canvas.lineTo((nextXPx - grp.x0), (nextYPx - grp.y0))
            else:
                if ((Double.NaN == prevX) or (Double.NaN == prevY)):
                    self.oppositeEdge = self.getEdgeOppositeHorizontally(pp, symbol, x, onY2)
                    canvas.beginPath()
                    canvas.moveTo((self.oppositeEdge - grp.x0), (yPx - grp.y0))
                    canvas.lineTo((xPx - grp.x0), (yPx - grp.y0))
                if ((Double.NaN == nextX) or (Double.NaN == nextY)):
                    canvas.lineTo((self.oppositeEdge - grp.x0), (yPx - grp.y0))
                    closeStrokeAndFill = True
                else:
                    canvas.lineTo((nextXPx - grp.x0), (nextYPx - grp.y0))
            if closeStrokeAndFill:
                canvas.closePath()
                borderWidth = symbol.getBorderWidth()
                if (borderWidth >= 0):
                    lineWidth = borderWidth
                else:
                    lineWidth = (2 * abs(borderWidth))
                borderColor = symbol.getBorderColor()
                backgroundColor = symbol.getBackgroundColor()
                ' XXX: Simply dropping the rendering as we do below does not\n                    * exactly simulate the effect of transparent border/fill,\n                    * specifically:\n                    *\n                    * <ol>\n                    *   <li> Transparent internal border ==> the background\n                    *          fill shines through the inner half of that border\n                    *   <li> Transparent external border ==> Works OK\n                    *   <li> Transparent fill w external border ==>\n                    *           border extended internally to width\n                    *   <li> Transparent fill w internal border ==> works OK\n                    * </ol>\n                    *\n                    * GWTCanvas does not (?) provide a mechanism to "stroke\n                    * transparent pixels", which is what I really needed. And\n                    * emulating this, though possible via properly positioned\n                    * inner/outter regions, etc. would have required a lot of effort\n                    * to assure that sharply peaked angles, say, get rendered right.\n                    *\n                    '
                if ((borderWidth >= 0) and (thickness > 0) and (GChartConsts.TRANSPARENT_BORDER_COLOR != backgroundColor) and ('transparent' != backgroundColor)):
                    canvas.setFillStyle(backgroundColor)
                    canvas.fill()
                if ((borderWidth != 0) and (GChartConsts.TRANSPARENT_BORDER_COLOR != borderColor) and ('transparent' != borderColor)):
                    canvas.setStrokeStyle(borderColor)
                    canvas.setLineWidth(lineWidth)
                    canvas.stroke()
                if ((borderWidth < 0) and (thickness > 0) and (GChartConsts.TRANSPARENT_BORDER_COLOR != backgroundColor) and ('transparent' != backgroundColor)):
                    canvas.setFillStyle(backgroundColor)
                    canvas.fill()
    elif ((not (Double.NaN == nextX)) and (not (Double.NaN == nextY)) and (thickness > 0) and ((x != nextX) or (y != nextY))):
        if (0 == spacing):
            spacing = 1
        d = self.distance(xPx, yPx, nextXPx, nextYPx)
        nChunks = int(round((d / spacing)))
        if (nChunks > 1):
            deltaX = (nextXPx - xPx)
            deltaY = (nextYPx - yPx)
            dXIsLonger = ((deltaX * deltaX) > (deltaY * deltaY))
            if dXIsLonger:
                deltaY /= deltaX
                deltaX /= nChunks
            else:
                deltaX /= deltaY
                deltaY /= nChunks
            for i in range(1, nChunks):
                if dXIsLonger:
                    xi = round((xPx + (deltaX * i)))
                    yi = round((yPx + (deltaY * (xi - xPx))))
                else:
                    yi = round((yPx + (deltaY * i)))
                    xi = round((xPx + (deltaX * (yi - yPx))))
                self.realizeOneImageOfSymbol(pp, grp, arp, symbol, None, onY2, clipPlotArea, clipDecoratedChart, xi, yi, prevXPx, prevYPx, nextXPx, nextYPx, thickness, thickness)
    if drawMainSymbol:
        self.realizeOneImageOfSymbol(pp, grp, arp, symbol, annotation, onY2, clipPlotArea, clipDecoratedChart, xPx, yPx, prevXPx, prevYPx, nextXPx, nextYPx, symbol.getWidth(pp), symbol.getHeight(pp, onY2))

dataset/ETHPy150Open anandology/pyjamas/library/gwt/chart/SymbolType.py SymbolType.realizeSymbol/original