提交 cad4b16e 编写于 作者: M Mathieu Bastian

Implement #1490 add postProcess() to Preview's Renderer

上级 c841ebb6
......@@ -191,7 +191,7 @@ public class PreviewControllerImpl implements PreviewController {
}
}
//Destrow view
//Destroy view
if (previewModel.getProperties().getFloatValue(PreviewProperty.VISIBILITY_RATIO) < 1f) {
graphModel.destroyView(graph.getView());
}
......@@ -245,6 +245,7 @@ public class PreviewControllerImpl implements PreviewController {
int tasks = 0;
for (Renderer r : renderers) {
if (!mousePressed || r instanceof MouseResponsiveRenderer) {
tasks++;
for (String type : previewModel.getItemTypes()) {
for (Item item : previewModel.getItems(type)) {
if (r.isRendererForitem(item, properties)) {
......@@ -269,14 +270,21 @@ public class PreviewControllerImpl implements PreviewController {
Progress.progress(progressTicket);
if (target instanceof AbstractRenderTarget) {
if (((AbstractRenderTarget) target).isCancelled()) {
Progress.finish(progressTicket);
return;
}
}
}
}
}
// Call post-process
r.postProcess(previewModel, target, properties);
Progress.progress(progressTicket);
}
}
Progress.finish(progressTicket);
}
}
......
......@@ -148,6 +148,17 @@ public interface Renderer {
*/
void render(Item item, RenderTarget target, PreviewProperties properties);
/**
* This method is called after rendering all items to perform post-processing.
* <p>
* This method has access to the <code>model</code> but also to the <code>target</code> and <code>properties</code>.
*
* @param previewModel the model to get items from
* @param target the target to render the item on
* @param properties the central properties
*/
void postProcess(PreviewModel previewModel, RenderTarget target, PreviewProperties properties);
/**
* Returns all associated properties for this renderer. Properties can be built
* using static <code>PreviewProperty.createProperty()</code> methods.
......
......@@ -139,6 +139,10 @@ public class ArrowRenderer implements Renderer {
}
}
@Override
public void postProcess(PreviewModel previewModel, RenderTarget renderTarget, PreviewProperties properties) {
}
@Override
public CanvasSize getCanvasSize(
final Item item,
......
......@@ -232,6 +232,10 @@ public class EdgeLabelRenderer implements Renderer {
}
}
@Override
public void postProcess(PreviewModel previewModel, RenderTarget renderTarget, PreviewProperties properties) {
}
@Override
public CanvasSize getCanvasSize(
final Item item,
......
......@@ -296,6 +296,10 @@ public class EdgeRenderer implements Renderer {
}
}
@Override
public void postProcess(PreviewModel previewModel, RenderTarget renderTarget, PreviewProperties properties) {
}
@Override
public CanvasSize getCanvasSize(Item item, PreviewProperties properties) {
if (isSelfLoopEdge(item)) {
......
......@@ -212,6 +212,10 @@ public class NodeLabelRenderer implements Renderer {
}
}
@Override
public void postProcess(PreviewModel previewModel, RenderTarget renderTarget, PreviewProperties properties) {
}
@Override
public CanvasSize getCanvasSize(
final Item item,
......
......@@ -94,6 +94,10 @@ public class NodeRenderer implements Renderer {
}
}
@Override
public void postProcess(PreviewModel previewModel, RenderTarget renderTarget, PreviewProperties properties) {
}
@Override
public CanvasSize getCanvasSize(
final Item item,
......
......@@ -16,7 +16,7 @@
<hr>
<h2>API Changes</h2>
<h3>0.9.3</h3>
<h4>Graph API (stable)</h4>
<h4>Graph API</h4>
<ul>
<li>Add <code>getEdges(int type)</code> to <code>Graph</code> to allow retrieval of only edges of a specific type.</li>
<li>Add <code>getEdgeTypeLabels(boolean)</code> to <code>GraphModel</code>.</li>
......@@ -30,7 +30,7 @@
<li>Add <code>getElementIndex()</code> methods to <code>GraphModel</code> when providing a <code>Table</code>.</li>
<li>Add <code>isNodeTable()</code> and <code>isEdgeTable()</code> methods to <code>Table</code>.</li>
</ul>
<h4>Appearance API (unstable)</h4>
<h4>Appearance API (under development)</h4>
<ul>
<li><code>Partition</code> and <code>Ranking</code> now always receive the <code>Graph</code> as parameter for all methods that do need access to the underlying index to facilitate local scale support.</li>
<li>Add <code>getColumn()</code> to <code>Ranking</code> so it aligns with <code>Partition</code>.</li>
......@@ -42,6 +42,10 @@
<li>Make <code>Function</code> getters in <code>AppearanceModel</code> independent from <code>Graph</code> as this should be handled automatically based on the local/global state.</li>
<li>Only keep <code>getNodeFunctions()</code> and <code>getEdgeFunctions()</code> in <code>AppearanceModel</code> to keep it simple. Filtering can easily be achieved by the client instead.</li>
</ul>
<h4>Preview API</h4>
<ul>
<li>A <code>postProcess()</code> method has been added to the <code>Renderer</code> SPI to allow customization once all items have been rendered.</li>
</ul>
<h3>Archive</h3>
<ul>
<li>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册