Xoetrope
HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Carousel logo

XGroupHierarchy

class com.xoetrope.svg.XGroupHierarchy

Extracts the group hierarchy from an SVG image.

GroupHierarchy

1. Example


public class Welcome extends XPage
{
  protected XSvgImageMap svgImage; 

  public void pageCreated()
  {
    svgImage = new XSvgImageMap();
    svgImage.setURL( ClassLoader.getSystemResource( "images/image1.svg" ));

    XGroupHierarchy gh = new XGroupHierarchy( svgImage );
    DefaultMutableTreeNode root = gh.getGroupHierarchy();
    JTree tree = new JTree( root );

    JFrame frame = new JFrame();
    frame.setSize( 375, 400 );
    frame.setLocation( 100, 100 );
    frame.getContentPane().add( new JScrollPane( tree ),   
    BorderLayout.CENTER );
    frame.setVisible( true );   
  }
}


The code example above shows how the how the component can be used in a program by passing it an instance of the XSvgImageMap and then diplaying the results in a JTree within a JFrame.

2. Constructor


public XGroupHierarchy( XSvgImageMap imageMap )


Creates a new instance of XGroupHierarchy. The XSvgImageMap instance passed contains the SVG diagram that the group info will be extratced from.

3. Methods


1. extractGroups

public void extractGroups()

Method called by the user to recursively extract the SVG groups from the SVG image and place them in the correct hierarchy.

2. getGroupHierarchy

public DefaultMutableTreeNode getGroupHierarchy()

Returns the extracted SVG group hierarchy to the user as a DefaultMutableTreeNode.

There are no comments on this page. [Add comment]

Page was generated in 0.3050 seconds