Skip to content

Commit

Permalink
feat: adding urchin textmodel
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Apr 4, 2024
1 parent 1d23797 commit e6ca640
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions models/csharp/UrchinModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,23 @@ public StructureModel(string name, string acronym, int atlasId, Color color, boo
}
}


[Serializable]
public struct TextModel
{
public string ID;
public string Text;
public Color Color;
public int FontSize;
public Vector2 Position;

public TextModel(string id, string text, Color color, int fontSize, Vector2 position)
{
ID = id;
Text = text;
Color = color;
FontSize = fontSize;
Position = position;
}
}

1 change: 1 addition & 0 deletions models/schemas/urchin/TextModel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector2": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}}, "title": "Vector2", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "Text": {"title": "Text", "type": "string"}, "Color": {"allOf": [{"$ref": "#/$defs/Color"}], "default": {"r": 0.0, "g": 0.0, "b": 0.0, "a": 1.0}}, "FontSize": {"default": 12, "title": "Fontsize", "type": "integer"}, "Position": {"allOf": [{"$ref": "#/$defs/Vector2"}], "default": {"x": 0.0, "y": 0.0}}}, "required": ["ID", "Text"], "title": "TextModel", "type": "object"}
8 changes: 8 additions & 0 deletions src/vbl_aquarium/models/urchin.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ class ParticleGroupModel(VBLBaseModel):

colors: list[Color]

# Text

class TextModel(VBLBaseModel):
id: str = Field(alias="ID")
text: str
color: Color = Color(r = 0, g = 0, b = 0)
font_size: int = 12
position: Vector2 = Vector2()

# Utilities

Expand Down

0 comments on commit e6ca640

Please sign in to comment.