vtkInformation issues

Dear all,

I am trying to use vtkInformation in order to set values to newly created actors so that I can reference them later in an easier way. I am using VTK 9.1 with Java wrappers on ubuntu 18.04. I am not so sure how I should use vtkInformation, here is what I do:

vtkInformationStringKey stringKey = new vtkInformationStringKey();
vtkInformation info = pointactor.GetProperty().GetInformation();
info.Set(stringKey, “hello”);

At this stage invoking pointactor.GetProperty().GetInformation().GetNumberOfKeys() returns 1, as well as pointactor.GetProperty().GetInformation().Get(stringKey) returns “hello”.

I then add this actor to a renderer, then access it later by retrieving actor collection from the renderer. Problem is that the key added earlier seems to have disappeared, actor.GetProperty().GetInformation().GetNumberOfKeys() returns 0.

I would really appreciate if someone could give me a hand on this, or has a working example.

Let me give some more context, afterall I may not take the right way to achieve what I want.

I am drawing from the mouse points. I join these points to form lines, then select these lines to form surfaces. Each entity is encapsulated in an actor and rendered. Then I would like to set one or several attributes to a selection of these actors. The objective is that, when I traverse the collection of actors I can easily extract actors that have given attribute. Maybe vtkInformation is not the right way to go. Nevertheless I do not understand how this works.

Many thanks for any hint

Well, I may have found the way it works in case somebody else need it. Not convinced this is the right way, but it seems to work for me.

private vtkInformationStringKey elemtype,elemtag;
elemtype = new vtkInformationStringKey().MakeKey("Type","root");
elemtag = new vtkInformationStringKey().MakeKey("Tag","root");

// Somewhere I create node actors
vtkInformation eleminfo = new vtkInformation();
eleminfo.Set(elemtype, "Node");
eleminfo.Set(elemtag, "helloNode");

// Somewherelse I create line actors
vtkInformation eleminfo = new vtkInformation();
eleminfo.Set(elemtype, "Line");
eleminfo.Set(elemtag, "helloLine");

// Retrieve info later by traversing actor list