com.googlecode.blaisemath.graph.view.VisualGraph Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blaise-graphtheory Show documentation
Show all versions of blaise-graphtheory Show documentation
Link graph definitions, algorithms, and visualization.
The newest version!
/*
* VisualGraph.java
* Created Jan 31, 2011
*/
package com.googlecode.blaisemath.graph.view;
/*
* #%L
* BlaiseGraphTheory
* --
* Copyright (C) 2009 - 2016 Elisha Peterson
* --
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import com.google.common.base.Functions;
import com.google.common.base.Supplier;
import com.googlecode.blaisemath.graph.Graph;
import com.googlecode.blaisemath.graph.GraphLayoutManager;
import com.googlecode.blaisemath.graph.modules.layout.SpringLayout;
import com.googlecode.blaisemath.graphics.core.DelegatingNodeLinkGraphic;
import com.googlecode.blaisemath.style.AttributeSet;
import com.googlecode.blaisemath.style.ObjectStyler;
import com.googlecode.blaisemath.style.Renderer;
import com.googlecode.blaisemath.style.Styles;
import com.googlecode.blaisemath.util.AnchoredText;
import com.googlecode.blaisemath.util.Edge;
import com.googlecode.blaisemath.util.coordinate.CoordinateManager;
import java.awt.Color;
import java.awt.Shape;
import java.awt.geom.Point2D;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.annotation.Nullable;
/**
*
* Combines a {@link GraphLayoutManager} and a {@link DelegatingNodeLinkGraphic}
* to manage a graph and its node locations. The graph is maintained by the manager,
* and the visual elements by the graphic.
*
*
* @param graphics canvas type
* @author Elisha Peterson
*/
public class VisualGraph {
/** Default graph node style */
public static final AttributeSet DEFAULT_NODE_STYLE = Styles.fillStroke(
new Color(0, 0, 128, 128), new Color(0, 0, 128, 192), .5f)
.and(Styles.MARKER_RADIUS, 3f);
/** Default graph edge style */
public static final AttributeSet DEFAULT_EDGE_STYLE = Styles.strokeWidth(
new Color(0, 128, 0, 128), 1f);
/** Responsible for instantiating the view graph */
@Nullable
private final Supplier,G>> viewGraphSupplier;
/** Stores the visible graph */
@Nullable
private DelegatingNodeLinkGraphic © 2015 - 2025 Weber Informatics LLC | Privacy Policy