@Override public Point apply(N node) { if (this.origin == NE) { return applyNE(node); } else { return applyCenter(node); } } }
/** * @param layoutModel * @param p the pick point * @return the node associated with location p */ @Override public N getNode(LayoutModel<N> layoutModel, Point p) { return getNode(layoutModel, p.x, p.y); }
public Node(LayoutModel<N> layoutModel) { super(layoutModel); this.accessor = new RadiusNetworkNodeAccessor<>(); }
@Override public void layoutChanged(LayoutEvent<N> evt) { Point location = evt.getLocation(); N node = evt.getNode(); this.update(node, evt.getLocation()); }
.setSize(layoutSize.width, layoutSize.height) .setInitializer( new RandomLocationTransformer<N>( layoutSize.width, layoutSize.height, System.currentTimeMillis())) .build(); ((LayoutEventSupport) layoutModel).addLayoutChangeListener(this);
private void fireLayoutChanged(LayoutEvent<N> layoutEvent, Network<N, E> network) { if (!layoutChangeListeners.isEmpty()) { LayoutEvent<N> evt = new LayoutNetworkEvent<N>(layoutEvent, network); for (LayoutChangeListener<N> listener : layoutChangeListeners) { listener.layoutChanged(evt); } } }
protected void fireLayoutChanged(N node, Point location) { if (layoutChangeListeners.size() > 0) { LayoutEvent<N> layoutEvent = new LayoutEvent(node, location); for (LayoutChangeListener<N> layoutChangeListener : layoutChangeListeners) { layoutChangeListener.layoutChanged(layoutEvent); } } }
@Override public void layoutChanged(LayoutNetworkEvent<N> evt) { update(evt.getNode(), evt.getLocation()); } }
public void initialize() { layoutModel.setInitializer( new RandomLocationTransformer<N>(layoutModel.getWidth(), layoutModel.getHeight())); maxEpoch = 2000; epoch = 1; radiusConstantTime = 100; radius = 5; minRadius = 1; initialAdaption = 90.0D / 100.0D; adaption = initialAdaption; minAdaption = 0; //factor = 0; //Will be set later on coolingFactor = 2; //temperature = 0.03; //initialJumpRadius = 100; //jumpRadius = initialJumpRadius; //delay = 100; }
public LayoutGraphEvent(LayoutEvent<N> layoutEvent, Graph<N> graph) { super(layoutEvent.getNode(), layoutEvent.location); this.graph = graph; }
private synchronized void adjust() { double width = layoutModel.getWidth(); double height = layoutModel.getHeight(); //Generate random position in graph space // creates a new XY data location Point tempXYD = Point.of(10 + Math.random() * width, 10 + Math.random() * height); //Get closest node to random position N winner = elementAccessor.getNode(layoutModel, tempXYD.x, tempXYD.y); while (true) { try { for (N node : layoutModel.getGraph().nodes()) { ISOMNodeData ivd = getISOMNodeData(node); ivd.distance = 0; ivd.visited = false; } break; } catch (ConcurrentModificationException cme) { } } adjustNode(winner, tempXYD); }
/** stop any running Relaxer */ public void stopRelaxer() { if (this.visRunnable != null) { this.visRunnable.stop(); } if (theFuture != null) { theFuture.cancel(true); } setRelaxing(false); }
/** * disconnect listeners that will no longer be used * * @param spatial */ private void disconnectListeners(Spatial<?> spatial) { if (model instanceof LayoutEventSupport) { if (spatial instanceof LayoutChangeListener) { model.removeLayoutChangeListener((LayoutChangeListener) spatial); } } if (model.getLayoutModel() instanceof LayoutEventSupport) { ((LayoutEventSupport) model.getLayoutModel()) .removeLayoutChangeListener((LayoutChangeListener) spatial); } if (model.getLayoutModel() instanceof LayoutModel.ChangeSupport) { if (spatial instanceof LayoutModel.ChangeListener) { ((LayoutModel.ChangeSupport) model.getLayoutModel()) .removeChangeListener((LayoutModel.ChangeListener) spatial); } } model.getLayoutModel().getLayoutStateChangeSupport().removeLayoutStateChangeListener(spatial); }
protected AbstractSpatial(LayoutModel<NT> layoutModel) { this.layoutModel = layoutModel; if (layoutModel != null) { this.rectangle = new Rectangle2D.Double(0, 0, layoutModel.getWidth(), layoutModel.getHeight()); this.fallback = new RadiusNetworkNodeAccessor(); } }
@Override public void layoutChanged(LayoutEvent<N> evt) { this.update(evt.getNode(), evt.getLocation()); }
@Override public void layoutChanged(LayoutNetworkEvent<N> evt) { this.update(evt.getNode(), evt.getLocation()); }
public LayoutNetworkEvent(LayoutEvent<N> layoutEvent, Network<N, ?> network) { super(layoutEvent.getNode(), layoutEvent.location); this.network = network; }
@Override public void visit(LayoutModel<N> layoutModel) { if (log.isTraceEnabled()) { log.trace("visiting {}", layoutModel); } super.visit(layoutModel); this.elementAccessor = new RadiusNetworkNodeAccessor<>(); initialize(); }
@Override public void layoutChanged(LayoutEvent<N> evt) { // need to take care of edge changes N node = evt.getNode(); Point p = evt.getLocation(); if (visualizationModel.getNetwork().nodes().contains(node)) { Set<E> edges = visualizationModel.getNetwork().incidentEdges(node); for (E edge : edges) { update(edge, p); } } }
@Override public void layoutChanged(LayoutNetworkEvent<N> evt) { N node = evt.getNode(); Point p = evt.getLocation(); if (visualizationModel.getNetwork().nodes().contains(node)) { Set<E> edges = visualizationModel.getNetwork().incidentEdges(node); for (E edge : edges) { update(edge, p); } } }