Interface NetworkImageFactory
This service is used to create images for a given CyNetworkView
.
This service can be used to create thumbnail images of a network without
the need to create a RenderingEngine
or Swing components.
The images are generated by Cytoscape's default 2D renderer with
the default set of VisualProperties and a high level of detail.
Note: Nested networks are not supported in the generated images.
- Since:
- 3.9
Module: presentation-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault Image
createImage
(CyNetworkView networkView, int width, int height) Creates a network image thumbnail with the given width and height.createImage
(CyNetworkView networkView, Collection<Annotation> annotations, Map<String, Object> properties) Creates a network image thumbnail with the given properties.
-
Field Details
-
HEIGHT
The height of the image, default: 100- See Also:
-
WIDTH
The width of the returned image, default: 100- See Also:
-
FIT_CONTENT
If true the network will be automatically centered and scaled to fit inside the image bounds.
If false then the network Visual Properties NETWORK_SCALE_FACTOR, NETWORK_CENTER_X_LOCATION, NETWORK_CENTER_Y_LOCATION will be used to position and scale the image. The origin for the image coordinates is at the center of the image.
Default: true.- See Also:
-
-
Method Details
-
createImage
Image createImage(CyNetworkView networkView, Collection<Annotation> annotations, Map<String, Object> properties) Creates a network image thumbnail with the given properties.
Example:Map<String,Object> properties = new HashMap<>(); properties.put(WIDTH, width); properties.put(HEIGHT, height); properties.put(FIT_CONTENT, true); Image image = thumbnailFactory.createThumbnail(networkView, null, properties);
- Parameters:
networkView
- ACyNetworkView
that was created from Cytoscape's defaultCyNetworkViewFactory
.annotations
- A list of Annotations that will be included in the image. May be null.properties
- A Map of key-value pairs where the keys are constants in this interface. May be null.- Throws:
NullPointerException
- If networkView is null.IllegalArgumentException
- If the given networkView was not created by Cytoscape's defaultCyNetworkViewFactory
.
-
createImage
Creates a network image thumbnail with the given width and height. The network will be centered and scaled to fit within the image bounds.
Equivalent to:Map<String,Object> properties = new HashMap<>(); properties.put(WIDTH, width); properties.put(HEIGHT, height); properties.put(FIT_CONTENT, true); Image image = thumbnailFactory.createThumbnail(networkView, null, properties);
-