def realizeOneImageOfSymbol(self, pp, grp, arp, symbol, annotation, onY2, clipPlotArea, clipDecoratedChart, xPx, yPx, prevXPx, prevYPx, nextXPx, nextYPx, width, height):


        xMin = pp.getXMin()
        xMax = pp.getXMax()
        xMid = symbol.getBaseline()
        if (Double.NaN==(xMid)):
            xMid = (xMin + xMax)/2.

        xMinPx = pp.xToPixel(xMin)
        xMaxPx = pp.xToPixel(xMax)
        xMidPx = pp.xToPixel(xMid)

        symWidth = self.getAdjustedWidth(width, xPx,
                                        prevXPx, nextXPx,
                                        xMinPx, xMaxPx, xMidPx)
        if (Double.NaN==(symWidth)):
            return


        xLeft = self.getUpperLeftX(width, xPx,
                                    prevXPx, nextXPx,
                                    xMinPx, xMaxPx, xMidPx,
                                    pp.getXMousePlotArea())
        if (Double.NaN==(xLeft)):
            return


        xCenter = xLeft + symWidth/2.
        # the data and pixel Y coordinates are flipped, hence
        # the (counter-intuitive) min/max interchange below:
        if onY2:
            yMin =  pp.getY2Max()
            yMax =  pp.getY2Min()
        else:
            yMin =  pp.getYMax()
            yMax =  pp.getYMin()
        yMid = symbol.getBaseline()
        if (Double.NaN==(yMid)):
            yMid = (yMin + yMax)/2.

        yMinPx = pp.yToPixel(yMin,onY2)
        yMaxPx = pp.yToPixel(yMax,onY2)
        yMidPx = pp.yToPixel(yMid,onY2)

        symHeight = self.getAdjustedHeight( height, yPx,
                                            prevYPx, nextYPx,
                                            yMinPx, yMaxPx, yMidPx)
        if (Double.NaN==(symHeight)):
            return


        yTop = self.getUpperLeftY(height, yPx,
                            prevYPx, nextYPx,
                            yMinPx, yMaxPx, yMidPx,
                            pp.getYMousePlotArea())
        if (Double.NaN==(yTop)):
            return


        yCenter =  yTop + symHeight/2.

        if clipPlotArea  and  not self.intersects(xMinPx, yMinPx, xMaxPx, yMaxPx, xLeft, yTop, xLeft+symWidth, yTop+symHeight):
            return; # image is completely off plot area, so skip it.

        elif clipDecoratedChart:
            yAxisWidth = pp.getYAxisEnsembleWidth()
            titleThickness = pp.chartTitleThickness()
            if not self.intersects(xMinPx - yAxisWidth, yMinPx - titleThickness,
                              pp.getXChartSizeDecoratedQuickly()-yAxisWidth,
                              pp.getYChartSizeDecoratedQuickly()-titleThickness,
                              xLeft, yTop, xLeft+symWidth, yTop+symHeight):
                return; # image completely off decorated chart, so skip


        # translate negative width, height to equivalent
        # positive values that image tags can handle
        signWidth = 1
        if symWidth < 0:
            xLeft = xLeft + symWidth
            symWidth *= -1
            signWidth = -1

        signHeight = 1
        if symHeight < 0:
            yTop = yTop + symHeight
            symHeight *= -1
            signHeight = -1


        # Positive pixel padding pushes the specified edge
        # outward from the center by the given amount, without
        # changing the location of the center the symbol.
        # Similarly, negative padding, pushes the edge inward.

        if symWidth != 0:
            xLeft -= self.pixelPadLeft
            symWidth += self.pixelPadLeft + self.pixelPadRight

        # else, zero width, keep it that way (no padding added)

        if symHeight != 0:
            yTop -= self.pixelPadTop
            symHeight += self.pixelPadTop + self.pixelPadBottom

        # else, zero height, keep it that way (no padding added)

        borderWidth = symbol.getBorderWidth()
        # borderWidth < 0 ==> external border
        if (symWidth > 0  and  symHeight > 0)  or  borderWidth < 0:
            grp.renderBorderedImage(symbol.getBackgroundColorCSS(),
                                    symbol.getBorderColorCSS(),
                                    symbol.getBorderStyle(),
                                    borderWidth,
                                    symWidth,
                                    symHeight,
                                    xLeft, yTop, symbol.getImageURL())

        # if the image has an attached label, realize that
        if (annotation!=None  and  (annotation.getText() is not None  or
            annotation.getWidget() is not None)  and  
            annotation.getVisible()):
            loc = annotation.getLocation()
            if None == loc:
                loc = self.defaultAnnotationLocation()

            loc = AnnotationLocation.transform(loc, signWidth, signHeight)
            # Note: yShift follows orientation of cartesian y
            # Axis, which is 180 degrees different from pixel y
            # coordinates, hence the extra "-" below.
            #
            # signWidth, signHeight multipliers assure that shifts are
            # appropriately symetrical for bars above and below or to the
            # left or right of their baselines (only baseline bars use
            # negative symbol widths) For example, a yShift of
            # 10px would shift up for bars above the baseline, and down
            # for bars below the baseline, which is usually what you
            # want (e.g. placing labels above or below the bars).
            arp.renderAnnotation(annotation, loc,
                                xCenter+signWidth*annotation.getXShift(),
                                yCenter-signHeight*annotation.getYShift(),
                                symWidth, symHeight,
                                symbol)




    # Distance from the point (x1, y1) to the point (x2, y2)
dataset/ETHPy150Open anandology/pyjamas/library/gwt/chart/SymbolType.py/SymbolType.realizeOneImageOfSymbol/original