gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: gump/python/gump/document/forrest resolver.py documenter.py
Date Thu, 15 Apr 2004 17:26:08 GMT
ajack       2004/04/15 10:26:08

  Modified:    python/gump/svg depdiag.py svg.py scale.py drawing.py
               python/gump/document/forrest resolver.py documenter.py
  Log:
  Added a graphic for FOG Factor.
  
  Revision  Changes    Path
  1.5       +21 -8     gump/python/gump/svg/depdiag.py
  
  Index: depdiag.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/svg/depdiag.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- depdiag.py	15 Apr 2004 13:13:26 -0000	1.4
  +++ depdiag.py	15 Apr 2004 17:26:07 -0000	1.5
  @@ -44,8 +44,13 @@
           
       def getRowCol(self):
           return (self.rowNo,self.colNo)
  +        
  +    def setPoint(self,point):
  +        self.point=point
  +        
  +    def getPoint(self):
  +        return self.point
   
  -   
   def compareNodesByProjectFOGFactor(node1,node2):
       project1=node1.getProject()    
       project2=node2.getProject()
  @@ -177,6 +182,15 @@
           # context rectangle.
           svg=SimpleSvg(rect.getWidth(),rect.getHeight())
   
  +
  +        #
  +        # Find centers
  +        #
  +        for node in self.matrix.getNodes():
  +            (row, col) = node.getRowCol()
  +            (x,y) = context.realPoint(col,rows-row)
  +            node.setPoint(Point(x,y))
  +                
           #
           # Draw dependency lines
           #
  @@ -193,11 +207,8 @@
                   depNode=self.matrix.getNodeForProject(dependProject)
                   (depRow,depCol) = depNode.getRowCol()                
                   
  -                (x,y) = context.realPoint(col,rows-row)
  -                (x1,y1) = context.realPoint(depCol,rows-depRow)
  -                
  -                print 'VIRTUAL LINE: %s,%s -> %s,%s' % (row,col,depRow,depCol),
  -                print 'LINE: %s,%s -> %s,%s' % (x,y,x1,y1)
  +                (x,y) = node.getPoint().getXY()
  +                (x1,y1) = depNode.getPoint().getXY()
                   
                   width=1+(dependProject.getFOGFactor()*3)
                   # Shape color
  @@ -222,8 +233,10 @@
               project = node.getProject()
               (row,col) = node.getRowCol()    
               
  -            (x,y) = context.realPoint(col-0.25,(rows-row)-0.25)
  -            (x1,y1) = context.realPoint(col+0.25,(rows-row)+0.25)
  +            
  +            (centerX,centerY) = node.getPoint().getXY()
  +            (x,y) = context.realPoint(centerX-0.25,centerY-0.25)
  +            (x1,y1) = context.realPoint(centerX+0.25,centerY+0.25)
               
               print 'RECTANGLE %s,%s -> %s,%s' % (x,y,x1,y1)
               
  
  
  
  1.4       +1 -1      gump/python/gump/svg/svg.py
  
  Index: svg.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/svg/svg.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- svg.py	14 Apr 2004 22:32:45 -0000	1.3
  +++ svg.py	15 Apr 2004 17:26:07 -0000	1.4
  @@ -121,7 +121,7 @@
           self.y=y
           
           # Try to size for the user...
  -        if -1 == width or -1 == heigth:
  +        if -1 == width or -1 == height:
               (self.width, self.height) = getSvgSizes(x,y)
           
           self.description=None
  
  
  
  1.2       +2 -2      gump/python/gump/svg/scale.py
  
  Index: scale.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/svg/scale.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- scale.py	14 Apr 2004 22:12:58 -0000	1.1
  +++ scale.py	15 Apr 2004 17:26:07 -0000	1.2
  @@ -27,10 +27,10 @@
   class ScaleDiagram:
       """ The interface to a chainable context """
       def __init__(self, val1, val2, width=3, height=0.5) : 
  -        self.width=width
  -        self.height=height
           self.val1=val1
           self.val2=val2
  +        self.width=width
  +        self.height=height
           
       def generateDiagram(self):
           
  
  
  
  1.4       +5 -1      gump/python/gump/svg/drawing.py
  
  Index: drawing.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/svg/drawing.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- drawing.py	15 Apr 2004 13:13:26 -0000	1.3
  +++ drawing.py	15 Apr 2004 17:26:07 -0000	1.4
  @@ -34,7 +34,8 @@
           self.y=y
           
       def getX(self): return self.x
  -    def getY(self): return self.y
  +    def getY(self): return self.y    
  +    def getXY(self): return (self.x, self.y)
           
       def dump(self, indent=0, output=sys.stdout):
           """ Display the contents of this object """
  @@ -171,6 +172,9 @@
       def __init__(self,name=None,context=None,rect=None,scaledWidth=1,scaledHeight=1):
           StandardDrawingContext.__init__(self,name,context,rect)
           
  +        if not scaledWidth: raise RuntimeError, 'Can\'t scale with 0 width.'
  +        if not scaledHeight: raise RuntimeError, 'Can\'t scale with 0 height.'
  +            
           self.scaledWidth=scaledWidth
           self.scaledHeight=scaledHeight
           
  
  
  
  1.4       +1 -1      gump/python/gump/document/forrest/resolver.py
  
  Index: resolver.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/document/forrest/resolver.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- resolver.py	14 Apr 2004 23:06:56 -0000	1.3
  +++ resolver.py	15 Apr 2004 17:26:08 -0000	1.4
  @@ -193,7 +193,7 @@
               location.setDocument(documentName)
               
           # XDocs in one place, content in another...
  -        if not extn == '.xml' or notXDocs:
  +        if (not extn == '.xml' and not extn == '.svg') or notXDocs:
               self.makePath(location.getPath(),self.contentDir)
               file=concatenate(self.contentDir,location.serialize())
           else:
  
  
  
  1.4       +11 -2     gump/python/gump/document/forrest/documenter.py
  
  Index: documenter.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/document/forrest/documenter.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- documenter.py	14 Apr 2004 23:06:56 -0000	1.3
  +++ documenter.py	15 Apr 2004 17:26:08 -0000	1.4
  @@ -2616,8 +2616,17 @@
               
               # Generate an SVG:
               # ,'FOG'
  -            #svgFile=self.resolver.getFile(stats,project.getName()+'_FOG','.svg')
  -            #fogRow.createData().createIcon(svgName.replace('.svg','.png'),'FOG Factor')
  +            if pstats.successes+pstats.failures+pstats.prereqs > 0:
  +                svgFile=self.resolver.getFile(stats,project.getName()+'_FOG','.svg')
  +                pngFile=os.path.basename(svgFile).replace('.svg','.png')
  +                from gump.svg.scale import ScaleDiagram
  +                diagram=ScaleDiagram(pstats.successes,pstats.failures+pstats.prereqs)
  +                diagram.generateDiagram().serializeToFile(svgFile)
  +                fogRow.createData().createIcon(pngFile,'FOG Factor')
  +            else:
  +                fogRow.createData('Not Available')    
  +                
  +                
               
           document.serialize()   
           
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message