My goal is to get the napari viewer to display the class label when editing annotations in a labels layer.
The default in napari 0.4.17 is that the label classes are displayed as numbers 0 being background, 1 being the first class etc.
What I would like to achieve is to hard-code a dict or something similar that states the classes of the labels, e.g. {1:"cat", 2:"dog",3:"horse"...}, so it is immediately clear what is being labeled.
An example of what it could look like is shown below.
I looked for an attribute that specifies the identity of the label classes, but did not find anything that works.
When looking into the napari.layers.Labelsdocumentation, there are the properties and the features attributes. Unfortunately, I don't see how they could be used to set the names of the labels.
Related
So, it's kind of a simple styling.
Text(
text = "some text which can extends to many lines"
)
how would someone build an annotated string to style only specif lines of the text? And by line I mean what it's actually rendering as a line - and not something predefined as a list of sub strings.
I've imagine to make a use of combined textLayoutResult with the annotated capability, but by reading the documentation I don't have much clue how to do so.
The plan was to the TextLayoutResult to retrieve the number of lines rendered on text. Then, it should be theoretically possible to retrieve the sub string on each of the lines rendered. And by pushing them on the annotated processor, the desired results would be achieved.
What am I missing?
I've managed to achieve the desired effect.
For those who want to do, you will need at least:
Two Text components;
A mutable state to keep track of offset on the text;
You limit the first Text by the number of maxLines - 1 and uses TextLayoutResult to retrieve the last offset of the last line. Then, you just update the state on the composable and create another Text component with the substring which starts from the last one. Then, you can apply the filters that you wish on this one.
Repeate the process for as many lines as you wish.
For the context, I'm working with Capella, an Eclipse RCP application based on Sirius (hence, EMF, GMF and draw2d). This application is used for MBSE, that basically means diagram representations for industrial systems.
I'm developping an add-on (viewpoint) to display custom labels next to diagram elements. These diagram elements are, to put it simply, boxes inside boxes. My problem is that usually the label text is larger than the space between a box and its container, so the label gets hidden. What I need is these labels to always be in foreground. As I'm more used to web development, what I'm looking for would be the equivalent of the z-index CSS property.
Currently I have no idea of how to achieve this, I'm using a custom .odesign that allows me to control some rendering options, like labels text, the color of some elements or to add decoration, but I dont think its the way to go for my problem. Maybe I should use a custom EditPart or a custom StyleConfiguration (I already used these components for other projects) but I have no clue where to start for this issue.
Any leads will be greatly appreciated.
We recently did this kind of changes to keep some labels in Sirius Sequence diagrams always on top: the combined fragments are placed behind the lifelines (z order) but we wanted to keep the labels of the CombinedFragments visible event their bounds intersects Lifelines, Executions or States).
This has been handled in Bug 564239 for Sirius 6.3.2 (used in Capella 1.4.1).
You could find some hints the bugzilla (Gerrits and commits can be retrieved from the See also section).
In Sirius Sequence diagram , we use org.eclipse.sirius.diagram.sequence.ui.tool.internal.layout.SequenceZOrderingRefresher to control the z-order of CombinedFragments : all the figures that composes them comes from some expressions in the odesign, and synchronization with the Capella model for exemple.
But in your case you want to control only the label, so it must not be dealt on the edit par level, but on the figure one. The "overlay" layer and figure lead might be a good one.
Do not forget another thing: in GMF/GEF, the labels of an element is displayed/shown/rendered/visible if it fits to the visible area of the parent container: in the case of a node in a container with scrollbar, the visible are will impact the visibility of the sub nodes (extended to their border nodes, edges, labels, ...)
Regards
Maxime
When using the multiple labels, how to select the color of a sample according the first label or the second label??
like data :A:a :A:b :A:c which all have 2 labels
I want to use different color, however they are coloured by A all is the same.
I have tried the :a:A :b:A :c:A but it doesn't function..
I am really confused about it
Is there a possiblity to get the parent element of the current element.
Fx: I have a two column FCE and in this two column FCE I will place a custom image element. For performance reasones I would like to render the image only as big as necessary. If the special image elememt is in a two column element the image can be smaller as it must be outside of the two column element.
Until now I did not find a way to solve this problem.
Id of parent record is always stored in {record.tx_flux_parent} - however, you may need to manually transfer the {record} variable since this does not happen automatically.
I am creating a map in which i want a polygon to display two separate variables within it. Therefore I want a stripped polygon relating to both the keys from the separate factors however I have no idea on how to do this. I messed around with multiple attributes on the properties section and could get the two variables up however could see no way of making the polygon display them both.
Thank you, any help would be appreciated
This is partially manual, but you are going to have to make a separate category within one of the fields that identifies the multivariate features. You could also create a new layer that is a selection of these features. Once you have that, go to the layer properties and display the features as 'Categories - Unique values, many fields' and hit the 'Add All Values' button. Once the categories are populated select the one you are interested in and pick a hatched symbol such as 'Radiation Overlay'. Then go to the Symbol Property Editor (double-click the symbol) and modify the two layers that make up the hatched symbol. You need to adjust the color, line thickness, offset, etc. until you get it to look the way you want. Probably not as auto as you wanted, but it will satisfy display purposes.