/[navidoc]/navidoc/navidoc/mp/uml.py
ViewVC logotype

Diff of /navidoc/navidoc/mp/uml.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by humppake, Thu Jun 12 09:06:35 2003 UTC revision 1.20 by humppake, Fri Jun 13 07:34:28 2003 UTC
# Line 216  class mpclass(navidoc.mp.MetapostElement Line 216  class mpclass(navidoc.mp.MetapostElement
216              maxwidctr(%%.maxwid, %%.cls);              maxwidctr(%%.maxwid, %%.cls);
217    
218              %%.sep = nullpicture;              %%.sep = nullpicture;
219              addto %%.sep doublepath (0,0)--(%%.maxwid,0) withpen currentpen;              addto %%.sep doublepath (0,0)--(%%.maxwid,0) withpen currentpen;
220              %%.pict = stackpics(%%.stereo, %%.cls, %%.sep, %%.meth, %%.sep, %%.fiel);              """
221            if self.fields and self.methods:
222                s = s + """
223                %%.pict = stackpics(%%.stereo, %%.cls, %%.sep, %%.meth, %%.sep, %%.fiel);
224                """
225            elif self.fields or self.methods:
226                s = s + """
227                %%.pict = stackpics(%%.stereo, %%.cls, %%.sep, %%.meth, %%.fiel);
228                """
229            else:
230                s = s + """
231                %%.pict = stackpics(%%.stereo, %%.cls, %%.meth, %%.fiel);
232                """
233            s = s + """
234                setbounds %%.pict to bbox %%.pict;
235              picmeasurements(%%);              picmeasurements(%%);
236              """              """
237          s = s.replace("FIELDS", ", ".join(          s = s.replace("FIELDS", ", ".join(
# Line 252  class mppackage(navidoc.mp.MetapostEleme Line 265  class mppackage(navidoc.mp.MetapostEleme
265          s = """          s = """
266              picture %%.pict;              picture %%.pict;
267              %%.pict = classTitle("%name%");              %%.pict = classTitle("%name%");
268                setbounds %%.pict to bbox %%.pict;
269              picmeasurements(%%);              picmeasurements(%%);
270              """              """
271          return self.repl(s)          return self.repl(s)
# Line 296  class mpcomponent(navidoc.mp.SimpleEleme Line 310  class mpcomponent(navidoc.mp.SimpleEleme
310              %%.titl = classTitle("%name%");              %%.titl = classTitle("%name%");
311              %%.pict = %%.titl;              %%.pict = %%.titl;
312              addto %%.pict doublepath bbox %%.titl;              addto %%.pict doublepath bbox %%.titl;
313                setbounds %%.pict to bbox %%.pict;
314              picmeasurements(%%);              picmeasurements(%%);
315              """              """
316          return self.repl(s)          return self.repl(s)
317        def draw_code(self):
318            s = """
319                drawmeasuredpic(%%);
320                """
321            return self.repl(s)
322    
323  class mpinterface(navidoc.mp.SimpleElement):  class mpinterface(navidoc.mp.SimpleElement):
324      key = 'interface'      key = 'interface'
# Line 359  class mpbigpackage(navidoc.mp.MetapostEl Line 378  class mpbigpackage(navidoc.mp.MetapostEl
378          s = """          s = """
379              picture %%.titl.pict;              picture %%.titl.pict;
380              %%.titl.pict = classTitle("%name%");              %%.titl.pict = classTitle("%name%");
381                setbounds %%.titl.pict to bbox %%.titl.pict;
382              addto %%.titl.pict doublepath (urcorner(%%.titl.pict)--lrcorner(%%.titl.pict)) withpen currentpen;              addto %%.titl.pict doublepath (urcorner(%%.titl.pict)--lrcorner(%%.titl.pict)) withpen currentpen;
383              addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--llcorner(%%.titl.pict)) withpen currentpen;              addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--llcorner(%%.titl.pict)) withpen currentpen;
384              addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--urcorner(%%.titl.pict)) withpen currentpen;              addto %%.titl.pict doublepath (ulcorner(%%.titl.pict)--urcorner(%%.titl.pict)) withpen currentpen;
# Line 437  class mpassoc(navidoc.mp.MetapostElement Line 457  class mpassoc(navidoc.mp.MetapostElement
457                      if mat:                      if mat:
458                          self.role = mat.group(1)                          self.role = mat.group(1)
459                          continue                          continue
460                        mat = re.match("^multi\((.*)\)$", el)
461                        if mat:
462                            self.multi = mat.group(1)
463                            continue
464                      raise UMLException("Invalid assoc adorn "+el)                      raise UMLException("Invalid assoc adorn "+el)
465          def setup_code(self):          def setup_code(self):
466              s = """              s = """
# Line 460  class mpassoc(navidoc.mp.MetapostElement Line 484  class mpassoc(navidoc.mp.MetapostElement
484          self.var = var or random_var()          self.var = var or random_var()
485          self.name = ""          self.name = ""
486    
487            # XXX This might not be a good idea. Anyway, the point is to allow
488            # creating very simple assoc with only "assoc foo" without '-' at start.
489            # as in "assoc - foo".
490            if toks.count('-') == 0:
491                toks.insert(1, '-')
492                
493          self.a = self.end(self.var+".a", toks)          self.a = self.end(self.var+".a", toks)
494          toks.reverse()          toks.reverse()
495          self.b = self.end(self.var+".b", toks)          self.b = self.end(self.var+".b", toks)

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26