def drawTdo(self):
     turtle = KfTurtle()
     bitmap = TBitmap()
     
     if self.plant == None:
         return
     if self.tdo == None:
         return
     # set up clipping bitmap 
     bitmap = delphi_compatability.TBitmap().Create()
     bitmap.Width = kTdoSize
     bitmap.Height = kTdoSize
     bitmap.Canvas.Brush.Color = delphi_compatability.clWhite
     bitmap.Canvas.Rectangle(0, 0, bitmap.Width, bitmap.Height)
     # set up turtle 
     turtle = uturtle.KfTurtle.defaultStartUsing()
     try:
         turtle.drawingSurface.pane = bitmap.Canvas
         turtle.setDrawOptionsForDrawingTdoOnly()
         # must be after pane and draw options set 
         turtle.reset()
         turtle.xyz(self.position.X, self.position.Y, 0)
         try:
             turtle.push()
             turtle.rotateY(self.rotateAngle)
             turtle.drawingSurface.recordingStart()
             self.tdo.draw(turtle, self.scale, "", "", 0, 0)
             turtle.drawingSurface.recordingStop()
             turtle.drawingSurface.recordingDraw()
             turtle.drawingSurface.clearTriangles()
             turtle.pop()
         except Exception, e:
             usupport.messageForExceptionType(e, "PdTdoParameterPanel.drawTdo")
             bitmap.free
         ubmpsupport.copyBitmapToCanvasWithGlobalPalette(bitmap, self.Canvas, self.tdoRect)
Esempio n. 2
0
 def fractionLive(self):
     result = 0.0
     result = 0.0
     try:
         if self.totalBiomass_pctMPB() > 0.0:
             result = umath.safedivExcept(self.liveBiomass_pctMPB, self.totalBiomass_pctMPB(), 0)
         else:
             result = 0.0
     except Exception, e:
         usupport.messageForExceptionType(e, "PdPlantPart.fractionLive")
Esempio n. 3
0
 def fractionLive(self):
     result = 0.0
     result = 0.0
     try:
         if self.totalBiomass_pctMPB() > 0.0:
             result = umath.safedivExcept(self.liveBiomass_pctMPB,
                                          self.totalBiomass_pctMPB(), 0)
         else:
             result = 0.0
     except Exception, e:
         usupport.messageForExceptionType(e, "PdPlantPart.fractionLive")
Esempio n. 4
0
def linearGrowthWithFactor(current, optimal, minDays, growthFactor):
    amountNeeded = 0.0
    maxPossible = 0.0
    
    try:
        amountNeeded = optimal - current
        maxPossible = umath.safedivExcept(optimal, minDays, optimal)
        amountNeeded = umath.max(0.0, umath.min(amountNeeded, maxPossible))
        current = current + amountNeeded * growthFactor
    except Exception, e:
        usupport.messageForExceptionType(e, "linearGrowthWithFactor")
Esempio n. 5
0
def linearGrowthResult(current, optimal, minDays):
    result = 0.0
    amountNeeded = 0.0
    maxPossible = 0.0
    
    result = 0.0
    try:
        amountNeeded = optimal - current
        maxPossible = umath.safedivExcept(optimal, minDays, optimal)
        amountNeeded = umath.max(0.0, umath.min(amountNeeded, maxPossible))
        result = amountNeeded
    except Exception, e:
        usupport.messageForExceptionType(e, "linearGrowthResult")
Esempio n. 6
0
    def drawTdo(self):
        turtle = KfTurtle()
        bitmap = TBitmap()

        if self.plant == None:
            return
        if self.tdo == None:
            return
        # set up clipping bitmap
        bitmap = delphi_compatability.TBitmap().Create()
        bitmap.Width = kTdoSize
        bitmap.Height = kTdoSize
        bitmap.Canvas.Brush.Color = delphi_compatability.clWhite
        bitmap.Canvas.Rectangle(0, 0, bitmap.Width, bitmap.Height)
        # set up turtle
        turtle = uturtle.KfTurtle.defaultStartUsing()
        try:
            turtle.drawingSurface.pane = bitmap.Canvas
            turtle.setDrawOptionsForDrawingTdoOnly()
            # must be after pane and draw options set
            turtle.reset()
            turtle.xyz(self.position.X, self.position.Y, 0)
            try:
                turtle.push()
                turtle.rotateY(self.rotateAngle)
                turtle.drawingSurface.recordingStart()
                self.tdo.draw(turtle, self.scale, "", "", 0, 0)
                turtle.drawingSurface.recordingStop()
                turtle.drawingSurface.recordingDraw()
                turtle.drawingSurface.clearTriangles()
                turtle.pop()
            except Exception, e:
                usupport.messageForExceptionType(
                    e, "PdTdoParameterPanel.drawTdo")
                bitmap.free
            ubmpsupport.copyBitmapToCanvasWithGlobalPalette(
                bitmap, self.Canvas, self.tdoRect)