Skip to content

Commit 712738f

Browse files
Add Vedo Text in SOFA layer.
1 parent f2aa2ed commit 712738f

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Installation
2929
setup(name='SimulationSimpleDatabase',
30-
version='22.12.2',
30+
version='22.12.3',
3131
description='A simplified API to use SQL Databases with numerical simulation.',
3232
long_description=long_description,
3333
long_description_content_type='text/markdown',

src/SOFA/Rendering/VedoFactory.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,3 +505,57 @@ def update_markers(self,
505505
symbol=symbol,
506506
size=size,
507507
filled=filled)
508+
509+
########
510+
# TEXT #
511+
########
512+
513+
def add_text(self,
514+
content: str,
515+
at: int = 0,
516+
corner: str = 'BR',
517+
c: str = 'black',
518+
font: str = 'Arial',
519+
size: float = 1.,
520+
bold: bool = False,
521+
italic: bool = False):
522+
"""
523+
Add new 2D Text to the Factory.
524+
525+
:param content: Content of the Text.
526+
:param at: Index of the window in which the Text will be rendered.
527+
:param corner: Horizontal and vertical positions of the Text between T (top), M (middle) and B (bottom) - for
528+
instance, 'BR' stands for 'bottom-right'.
529+
:param c: Text color.
530+
:param font: Font of the Text.
531+
:param size: Size of the font.
532+
:param bold: Apply bold style to the Text.
533+
:param italic: Apply italic style to the Text.
534+
"""
535+
536+
# Add object
537+
idx = self.__factory.add_text(content=content,
538+
at=at,
539+
corner=corner,
540+
c=c,
541+
font=font,
542+
size=size,
543+
bold=bold,
544+
italic=italic)
545+
return idx
546+
547+
def update_text(self,
548+
object_id: int,
549+
content: Optional[str] = None,
550+
c: Optional[str] = None):
551+
"""
552+
Update existing Text in the Factory.
553+
554+
:param object_id: Index of the object (follows the global order of creation).
555+
:param content: Content of the Text.
556+
:param c: Text color.
557+
"""
558+
559+
self.__factory.update_text(object_id=object_id,
560+
content=content,
561+
c=c)

0 commit comments

Comments
 (0)