Giving Edge Color to Edge Target Arrow

21 views
Skip to first unread message

pritam saha

unread,
Jul 14, 2021, 3:05:38 PMJul 14
to cytoscape-app-dev
Hello Everyone, 

I am trying to apply RGB color the edge target arrow which is of delta shape. 
I have used this below code to apply the Delta shape for edge target arrow. 
VisualStyle vs = cyServiceRegistrar.getService(VisualStyleFactory.class).createVisualStyle(currentStyle);
vs.setDefaultValue(BasicVisualLexicon.EDGE_TARGET_ARROW_SHAPE, ArrowShapeVisualProperty.DELTA);

But I am not able to give color to the tip of the edge. 

There is some property which we can do from a xml file. Below is the sample example
<visualProperty name="EDGE_TARGET_ARROW_UNSELECTED_PAINT" default="#000000"/>
<visualProperty name="EDGE_TARGET_ARROW_SELECTED_PAINT" default="#ffff00"/>

I need to do this using programmatically.  

Please help me with this issue. 

Thanks,
Pritam 

alex.pico

unread,
Jul 15, 2021, 12:06:24 PMJul 15
to cytoscape-app-dev
First guess:  Did you apply the style?

pritam saha

unread,
Jul 19, 2021, 6:14:58 PMJul 19
to cytoscape-app-dev

Hi Alex,

Thank you for your response. 

Actually, I was not able to find the class for the property Edge Target Arrow like BasicVisualLexicon.EDGE_UNSELECTED_PAINT under   BasicVisualLexicon

It was not defined there. 

So, I have tried to find some solutions in the GitHub repositories and then I have seen some of the properties are used from the rendering manager. 
I have used the below code.

VisualLexicon lex = cyServiceRegistrar.getService(RenderingEngineManager.class).getDefaultVisualLexicon(); 
VisualProperty targetedgecolor = lex.lookup(CyEdge.class,"EDGE_TARGET_ARROW_UNSELECTED_PAINT"); 
vs.setDefaultValue(targetedgecolor,Greencolor);

And It worked. 

Thanks,
Pritam

Scooter Morris

unread,
Jul 29, 2021, 11:21:31 AMJul 29
to cytoscape-app-dev
Hi Pritam,
  Exactly right!  Not all properties are available through the BasicVisualLexicon.  In particular, the EDGE_TARGET and EDGE_SOURCE paints are only defined in "ding", the default 2D renderer.  That's why you need to actually go through the lookup.

-- scooter
Reply all
Reply to author
Forward
0 new messages