Skip to content

Commit

Permalink
Merge pull request #63 from DSD-DBS/sab-styles
Browse files Browse the repository at this point in the history
Sab styles
  • Loading branch information
vik378 authored Feb 17, 2022
2 parents f1d0335 + bf3c8e1 commit 36f0615
Show file tree
Hide file tree
Showing 7 changed files with 1,112 additions and 10 deletions.
23 changes: 23 additions & 0 deletions capellambse/aird/capstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,14 @@ class in the form::
"stroke": COLORS["black"],
},
),
"Box.FIP": {
"fill": COLORS["dark_orange"],
"stroke-width": 0,
},
"Box.FOP": {
"fill": COLORS["_CAP_xAB_Function_Border_Green"],
"stroke-width": 0,
},
"Box.SystemComponent": {
"fill": [COLORS["_CAP_Actor_Blue_min"], COLORS["_CAP_Actor_Blue"]],
"stroke": COLORS["_CAP_Actor_Border_Blue"],
Expand All @@ -757,6 +765,21 @@ class in the form::
"stroke-width": 2,
"text_fill": COLORS["_CAP_Component_Border_Blue"],
},
"Edge.FunctionalExchange": {
"stroke": COLORS["_CAP_xAB_Function_Border_Green"],
"stroke-width": 2,
"text_fill": COLORS["_CAP_xAB_Function_Border_Green"],
},
"Edge.FIPAllocation": {
"stroke": COLORS["dark_orange"],
"stroke-width": 2,
"stroke-dasharray": "5",
},
"Edge.FOPAllocation": {
"stroke": COLORS["_CAP_xAB_Function_Border_Green"],
"stroke-width": 2,
"stroke-dasharray": "5",
},
},
"System Data Flow Blank": {
"Box.FIP": {
Expand Down
6 changes: 3 additions & 3 deletions capellambse/model/common/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def __get__(self, obj, objtype=None):
class ReferenceSearchingAccessor(PhysicalAccessor[T]):
__slots__ = ("attrs",)

attrs: tuple[str, ...]
attrs: tuple[operator.attrgetter, ...]

def __init__(
self,
Expand All @@ -827,7 +827,7 @@ def __init__(
aslist: type[element.ElementList] | None = None,
) -> None:
super().__init__(class_, aslist=aslist)
self.attrs = attrs
self.attrs = tuple(operator.attrgetter(i) for i in attrs)

def __get__(self, obj, objtype=None):
del objtype
Expand All @@ -838,7 +838,7 @@ def __get__(self, obj, objtype=None):
for candidate in obj._model.search(self.class_.__name__):
for attr in self.attrs:
try:
value = getattr(candidate, attr)
value = attr(candidate)
except AttributeError:
continue
if (
Expand Down
8 changes: 7 additions & 1 deletion capellambse/model/crosslayer/cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class PhysicalPath(c.GenericElement):
)

@property
def involved_links(self):
def involved_links(self) -> c.ElementList[PhysicalLink]:
return self.involved_items.by_type("PhysicalLink")


Expand Down Expand Up @@ -138,6 +138,12 @@ class Component(c.GenericElement):
parts = c.ReferenceSearchingAccessor(Part, "type", aslist=c.ElementList)
physical_paths = c.ProxyAccessor(PhysicalPath, aslist=c.ElementList)
physical_links = c.ProxyAccessor(PhysicalLink, aslist=c.ElementList)
exchanges = c.ReferenceSearchingAccessor(
fa.ComponentExchange,
"source.owner",
"target.owner",
aslist=c.ElementList,
)


@c.xtype_handler(None)
Expand Down
11 changes: 11 additions & 0 deletions capellambse/model/crosslayer/fa.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,14 @@ def __dir__(self) -> list[str]:
aslist=c.ElementList,
),
)

c.set_accessor(
Function,
"exchanges",
c.ReferenceSearchingAccessor(
FunctionalExchange,
"source.owner",
"target.owner",
aslist=c.ElementList,
),
)
15 changes: 9 additions & 6 deletions capellambse/model/layers/oa.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,13 @@ class Entity(AbstractEntity):
entities: c.Accessor

@property
def inputs(self) -> c.ElementList[fa.FunctionalExchange]:
def inputs(self) -> c.ElementList[CommunicationMean]:
return self._model.oa.all_entity_exchanges.by_target(self)

@property
def outputs(self) -> c.ElementList[fa.FunctionalExchange]:
def outputs(self) -> c.ElementList[CommunicationMean]:
return self._model.oa.all_entity_exchanges.by_source(self)

@property
def exchanges(self) -> c.ElementList[fa.FunctionalExchange]:
return self.inputs + self.outputs


@c.xtype_handler(XT_ARCH)
class OperationalActivityPkg(c.GenericElement):
Expand Down Expand Up @@ -275,6 +271,13 @@ class OperationalAnalysis(crosslayer.BaseArchitectureLayer):
aslist=c.ElementList,
),
)
c.set_accessor(
Entity,
"exchanges",
c.ReferenceSearchingAccessor(
CommunicationMean, "source", "target", aslist=c.ElementList
),
)
c.set_self_references(
(OperationalActivityPkg, "packages"),
(OperationalCapabilityPkg, "packages"),
Expand Down
Loading

0 comments on commit 36f0615

Please sign in to comment.