Skip to content

Commit

Permalink
Merge pull request #30 from cytoscape/UD-2932
Browse files Browse the repository at this point in the history
Resolved the issue of incorrect export values for network visual properties
  • Loading branch information
jingjingbic authored Sep 14, 2024
2 parents b97f970 + c6a20d9 commit 506d7bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private final static <T> void addProperties(final View<? extends CyIdentifiable

}

private static <T> String getSerializableVisualProperty(View<? extends CyIdentifiable> view, VisualProperty<T> vp) {
public static <T> String getSerializableVisualProperty(View<? extends CyIdentifiable> view, VisualProperty<T> vp) {
T prop = view.getVisualProperty(vp);
if (prop == null) {
return null;
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/org/cytoscape/io/internal/cxio/CxExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public final class CxExporter {
private CyNetworkView view;

private TaskMonitor taskMonitor;

/**
* Constructor for CxExporter to write network (and it's collection) to CX. Specify
* if the exporter should attempt to use CX IDs from a previous import
Expand Down Expand Up @@ -1531,7 +1531,7 @@ private void writeCX2VisualProperties (CXWriter cx2Writer) throws NdexException,
current_visual_style, editorProps);
VisualPropertiesGatherer.addCx2EditorPropsDependency(CxUtil.NODE_SIZE_LOCKED, current_visual_style, editorProps);
VisualPropertiesGatherer.addCx2EditorPropsDependency(CxUtil.ARROW_COLOR_MATCHES_EDGE, current_visual_style, editorProps);

Map<String, Object> rawProps = editorProps.getProperties();
boolean nodeSizeLocked = rawProps.get(CxUtil.NODE_SIZE_LOCKED).equals(Boolean.TRUE);
boolean arrowColorMatchesEdge = rawProps.get(CxUtil.ARROW_COLOR_MATCHES_EDGE).equals(Boolean.TRUE);
Expand All @@ -1543,9 +1543,9 @@ private void writeCX2VisualProperties (CXWriter cx2Writer) throws NdexException,
Map<String,String> cx1Style = new HashMap<>();
for (final VisualProperty<?> visual_property : all_visual_properties) {
if (visual_property.getTargetDataType() == CyNetwork.class) {
String value_str = VisualPropertiesGatherer.getDefaultPropertyAsString(current_visual_style, visual_property);
if (value_str !=null && !CxioUtil.isEmpty(value_str)) {
cx1Style.put(visual_property.getIdString(), value_str);
String value_str = VisualPropertiesGatherer.getSerializableVisualProperty(view, visual_property);
if (value_str !=null && !CxioUtil.isEmpty(value_str)) {
cx1Style.put(visual_property.getIdString(), value_str);
}
}
}
Expand Down Expand Up @@ -1662,7 +1662,7 @@ private void writeCX2VisualProperties (CXWriter cx2Writer) throws NdexException,

List<CxEdgeBypass> edgeBypasses = VisualPropertiesGatherer.getEdgeBypasses(
view, all_visual_properties, useCxId, arrowColorMatchesEdge );
cx2Writer.writeFullAspectFragment(edgeBypasses);
cx2Writer.writeFullAspectFragment(edgeBypasses);


}
Expand Down Expand Up @@ -1852,8 +1852,7 @@ private CxAttributeDeclaration getAttributeDeclarations() {
return result;

}



public final void writeNetworkInCX2(Collection<String> aspects, final OutputStream out) throws IOException, NdexException {


Expand Down

0 comments on commit 506d7bc

Please sign in to comment.