OglUseCase.py :  » UML » Python-UML-Tool » pyut-1.4.0 » src » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » UML » Python UML Tool 
Python UML Tool » pyut 1.4.0 » src » OglUseCase.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

__version__ = "$Revision: 1.8 $"
__author__  = "EI5, eivd, Group Burgbacher - Waelti"
__date__    = "2001-12-12"

#from wxPython.wx     import *
#from wxPython.ogl    import *
from OglObject import *
from PyutUseCase import *
from LineSplitter import *
import wx

#----------------------------------------------------------------------

class OglUseCase(OglObject):
    """
    OGL object that represent an UML use case in use case diagrams.
    This class defines OGL objects that represents a use case for Use
    Cases diagram. You can just instanciate an OGLUseCase and add it to
    the diagram, links, resizing, ... are managed by parent class
    `OglObject`.

    For more instructions about how to create an OGL object, please refer
    to the `OglObject` class.

    :version: $Revision: 1.8 $
    :author: Philippe Waelti
    :contact: pwaelti@eivd.ch
    """

    #>------------------------------------------------------------------ 

    def __init__(self, pyutUseCase = None, w = 100.0, h = 60.0):
        """
        Constructor.
        @param Float w : Width of the shape
        @param Float h : Height of the shape

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        # Init associated PyutObject
        if pyutUseCase is None:
            pyutObject = PyutUseCase()
        else:
            pyutObject = pyutUseCase

        # Super init
        OglObject.__init__(self, pyutObject, w, h)

        # Should not draw border
        self._drawFrame = False

    #>------------------------------------------------------------------ 

    def Draw(self, dc):#, withChildren=False):
        """
        Draw the actor.
        @param wx.DC dc : Device context

        @since 1.0
        @author Philippe Waelti <pwaelti@eivd.ch>
        """
        OglObject.Draw(self, dc)#, withChildren)
        dc.SetFont(self._defaultFont)

        # Gets the minimum bounding box for the shape
        width, height = self.GetSize()

        # Calculate the top left of the shape
        x, y = self.GetPosition()

        # Draw ellipse
        dc.DrawEllipse(x + 1.0, y + 1.0, width - 2.0, height - 2.0)

        # Draw text
        x += 0.25 * width
        y += 0.25 * height
        textWidth = 0.6 * width # Text aera width
        space = 1.1 * dc.GetCharHeight() # Space between lines

        # Drawing is restricted in the specified region of the device
        dc.SetClippingRegion(x, y, textWidth, 0.6 * height)

        # Split lines
        lines = LineSplitter().split(self.getPyutObject().getName(), \
                dc, textWidth)

        # Draw text
        for line in lines:
            dc.DrawText(line, x, y)
            y += space

        dc.DestroyClippingRegion()

    #>------------------------------------------------------------------------

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.