All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.ucm.fdi.gaia.jcolibri.extensions.visualization.infovisual.CaseBaseVis Maven / Gradle / Ivy

Go to download

jCOLIBRI is a java framework for the development of Case-Based Reasoning systems.

There is a newer version: 3.2
Show newest version
//
//  CaseBaseVis.java
//  InfoVisual
//
//  Created by Josep Lluis Arcos on 05/04/07.
//  Copyright 2007 IIIA, CSIC. All rights reserved.
//

package es.ucm.fdi.gaia.jcolibri.extensions.visualization.infovisual;

/*
 * From prefuse ( http://prefuse.org/ ).
 */
import prefuse.Constants;
import prefuse.action.assignment.ColorAction;
import prefuse.action.assignment.DataColorAction;
import prefuse.action.layout.graph.ForceDirectedLayout;
import prefuse.data.Graph;
import prefuse.util.ColorLib;
import prefuse.visual.VisualItem;

/*
 *  La idea es provar si controlant les forces entre nodes podem simular 
 *  les distancies entre casos
 *
 */
 public class CaseBaseVis extends GraphLayout {

  //---------------------------------------------------------------
  //  PROPERTIES of the Class.
  //---------------------------------------------------------------

  /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

/** Color Constants. */

  /* 
   * Color palette for nodes:
   *   Yellow: CLASS-1, Green: CLASS-2, blue: CLASS-3,
   *     
  */
	public static int[] nodePalette = new int[] {
		ColorLib.rgb(255,255,190), ColorLib.rgb(200,255,200), ColorLib.rgb(190,190,255),
		ColorLib.rgb(255,190,190), ColorLib.rgb(190,255,255), ColorLib.rgb(255,190,255),
		ColorLib.rgb(200,200,200)
	};

  /* 
   * Color palette for groups:
   */
   static int[] GroupPalette = new int[] {
            ColorLib.rgba(255,200,200,150), ColorLib.rgba(200,255,200,150),
            ColorLib.rgba(200,200,255,150)
        };

  //---------------------------------------------------------------
  //  CONSTRUCTORS of the Class.
  //---------------------------------------------------------------

  /**
   * Empty constructor.
   */
  public CaseBaseVis (){
   super(getGraph(), true, false, false, false);
  }

  /**
   * receiving graph file as a parameter.
   */
  public CaseBaseVis (String file){
   super(file, true, false, false,false);
  }

  /**
   * receiving graph file as a parameter.
   */
  public CaseBaseVis (Graph graph){
   super(graph, true, false, false, false);
  }

  /**
   * Returns a code generated graph.
   */
//  public static Graph getGraph(){
//		CBGraph graph = new CBGraph();
//		graph.generateGraph();
//		return graph;
//  }

  
  /**
   * Returns the Forces model Layout.
   */
  public ForceDirectedLayout getForceDirectedLayout(String group){
	return new CBForceLayout(group);
  }

  /**
   * Colorizes the nodes acording to its class.
   */
  public ColorAction getNodeColors(String label){
	DataColorAction action = new DataColorAction(label, "class",
							   Constants.ORDINAL, VisualItem.FILLCOLOR, nodePalette);
	return (ColorAction) action;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy