Пример #1
0
    def realizePoint(self, pp, grp, arp, iPoint):
        p = self.points[iPoint]
        x = p.getX()
        y = p.getY()
        # skip points at undefined locations
        if (Double.isNaN(x))  or  (Double.isNaN(y)):
            return

        prevX = Double.NaN
        prevY = Double.NaN
        if iPoint > 0:
            prevP = self.points[iPoint-1]
            prevX = prevP.getX()
            prevY = prevP.getY()

        nextX = Double.NaN
        nextY = Double.NaN
        nextP = None
        if iPoint < self.getNPoints()-1:
            nextP = self.points[iPoint+1]
            nextX = nextP.getX()
            nextY = nextP.getY()


        # if point was not assigned to any band, it's not drawn
        # at all (undefined x or y, or off chart entirely)
        drawMainSymbol = (p.getINextInBand() != iPoint)

        self.getSymbol().realizeSymbol(pp, grp, arp, p.getAnnotation(),
                                    self.onY2(),
                                    self.getActuallyClippedToPlotArea(),
                                    self.getParent().getClipToDecoratedChart(),
                                    drawMainSymbol,
                                    x, y, prevX, prevY, nextX, nextY)
Пример #2
0
    def getBand(self, iPoint, bandThickness):
        result = NAI
        symType = self.getSymbol().getSymbolType()
        xPx = symType.getCenterX(self.chart.plotPanel, self.getSymbol(), iPoint)
        if Double.isNaN(xPx):
            return result; # NaN points not in any band

        yPx = symType.getCenterY( self.chart.plotPanel, self.getSymbol(),
                                  iPoint, self.onY2())
        if Double.isNaN(yPx):
            return result; # NaN points not in any band

        # now, we've got a point with x,y values in some sort of band

        if self.getSymbol().isHorizontallyBanded():
            if yPx < 0:
                result = 0; # off-chart point above chart

            elif yPx >= (len(self.bandList)-EXTRA_BANDS)*bandThickness:
                result = len(self.bandList)-1; # off-chart point below chart

            else:
                # inside a normal, chart-covering, band
                result = 1 + int ( math.floor(yPx/bandThickness) )


        else:
            # vertically banded
            if xPx < 0:
                result = 0;  # off-chart point to the left

            elif xPx >= (len(self.bandList)-EXTRA_BANDS)*bandThickness:
                result = len(self.bandList)-1; # off-chart point to the right

            else:
                # within one of the real bands covering the chart
                result = 1 + int ( math.floor(xPx/bandThickness) )


        return result
Пример #3
0
def withinRange(x, minLim, maxLim):
    result = Double.isNaN(x) and True or (x >= minLim  and  x <= maxLim)
    return result