Changeset 3545:cdf2f32496fa in orange


Ignore:
Timestamp:
04/17/07 11:51:03 (7 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
2211425d347d5ba59bb73b2c6b2264268c3df146
Message:
  • added rectangle curve
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWGraphTools.py

    r3539 r3545  
    272272 
    273273 
     274class RectangleCurve(QwtPlotCurve): 
     275    def __init__(self, parent, pen = QPen(Qt.black), brush = QBrush(Qt.white), xData = None, yData = None): 
     276        QwtPlotCurve.__init__(self, parent) 
     277        if pen: 
     278            self.setPen(pen) 
     279        if brush: 
     280            self.setBrush(brush) 
     281        self.Pen = pen 
     282        self.Brush = brush 
     283        self.setStyle(QwtCurve.Lines) 
     284        if xData != None and yData != None: 
     285            self.setData(xData, yData) 
     286 
     287    def setData(self, xData, yData): 
     288        startsX = xData[::4] 
     289        startsY = yData[::4] 
     290        for i in range(len(startsX))[::-1]: 
     291            xData.insert(4+i*4, startsX[i]) 
     292            yData.insert(4+i*4, startsY[i]) 
     293        QwtPlotCurve.setData(self, xData, yData) 
     294 
     295    def drawCurve(self, painter, style, xMap, yMap, start, stop): 
     296        for i in range(start, stop, 5): 
     297            QwtPlotCurve.drawLines(self, painter, xMap, yMap, i, i+4) 
     298 
     299 
    274300# ########################################################### 
    275301# a class that is able to draw arbitrary polygon curves. 
     
    289315            self.setData(xData, yData) 
    290316 
    291 #    def drawCurve(self, painter, style, xMap, yMap, start, stop): 
    292 #        for i in range(start, stop, 4): 
    293 #            QwtPlotCurve.drawLines(self, painter, xMap, yMap, i, i+4) 
    294317 
    295318# #################################################################### 
Note: See TracChangeset for help on using the changeset viewer.