1 |
# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH |
# Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Markus Rechtien <[email protected]> |
# Markus Rechtien <[email protected]> |
4 |
|
# Bernhard Reiter <[email protected]> |
5 |
# |
# |
6 |
# This program is free software under the GPL (>=v2) |
# This program is free software under the GPL (>=v2) |
7 |
# Read the file COPYING coming with Thuban for details. |
# Read the file COPYING coming with Thuban for details. |
490 |
return (12,len(text) * 10) |
return (12,len(text) * 10) |
491 |
|
|
492 |
def SetID(self, id): |
def SetID(self, id): |
493 |
"""Set the ID stored by the svg elements.""" |
"""Set second part of ID stored by the svg elements. |
494 |
|
|
495 |
|
Will be used in make_id() as first part of an XML attribute "id". |
496 |
|
Read comments at SetBaseID() and make_id(). |
497 |
|
|
498 |
|
Common practice is to only set this to integer numbers. |
499 |
|
""" |
500 |
self.id = id |
self.id = id |
501 |
|
|
502 |
def SetBaseID(self, id): |
def SetBaseID(self, id): |
503 |
"""Set the ID stored by the svg elements.""" |
"""Set first part of ID stored by the svg elements. |
504 |
|
|
505 |
|
Will be used in make_id() as first part of an XML attribute "id". |
506 |
|
The second part is set by SetID(). |
507 |
|
Check comments at make_id(). |
508 |
|
""" |
509 |
self.baseid = id |
self.baseid = id |
510 |
|
|
511 |
def SetFont(self, font): |
def SetFont(self, font): |
588 |
"""Return id= string for object out of currently set baseid and id. |
"""Return id= string for object out of currently set baseid and id. |
589 |
|
|
590 |
Return the empty string if no id was set. |
Return the empty string if no id was set. |
591 |
|
|
592 |
|
In an XML file each id should be unique |
593 |
|
(see XML 1.0 section 3.3.1 Attribute Types, Validity constraint: ID) |
594 |
|
So this function should only return a unique values. |
595 |
|
which also coforms to the the XML "Name production" (section 3.2). |
596 |
|
|
597 |
|
For this it completely depends |
598 |
|
on what has been set by SetBaseID() and SetID(). |
599 |
|
Only call this function if you have called them w unique values before |
600 |
|
(or SetID(0) to get an empty result) |
601 |
|
|
602 |
|
A check of uniqueness in this function might be time consuming, |
603 |
|
because it would require to hold and search through a complete table. |
604 |
""" |
""" |
605 |
if self.id < 0: |
if self.id < 0: |
606 |
return '' |
return '' |