Commit 7892daeb authored by Thilo Rörig's avatar Thilo Rörig

Merge branch 'master' into ttf-label-visualization

# Conflicts:
#	lib/jreality/jReality.jar
parents 44ff5bdd 491a14d0
No preview for this file type
package de.jtem.halfedgetools.adapter;
import org.junit.Assert;
import org.junit.Test;
import de.jtem.halfedge.Node;
import de.jtem.halfedgetools.adapter.type.Position;
@Position
public class AdaperSetTest {
private class PriorityAdapter extends AbstractAdapter<Double> {
private double priority = 0;
public PriorityAdapter(double priority) {
super(Double.class, true, false);
this.priority = priority;
}
@Override
public <N extends Node<?, ?, ?>> boolean canAccept(Class<N> nodeClass) {
return true;
}
@Override
public double getPriority() {
return this.priority;
}
}
@Test
public void adpterPriorityTest1() {
PriorityAdapter a1 = new PriorityAdapter(1.0);
PriorityAdapter a2 = new PriorityAdapter(2.0);
AdapterSet a = new AdapterSet(a1, a2);
PriorityAdapter result = a.query(PriorityAdapter.class);
Assert.assertEquals(result, a2);
}
@Test
public void adpterPriorityTest2() {
PriorityAdapter a1 = new PriorityAdapter(2.0);
PriorityAdapter a2 = new PriorityAdapter(1.0);
AdapterSet a = new AdapterSet(a1, a2);
PriorityAdapter result = a.query(PriorityAdapter.class);
Assert.assertEquals(result, a1);
}
}
package de.jtem.halfedgetools.algorithm.subdivision;
import java.util.Map;
import java.util.TreeMap;
import de.jtem.halfedge.Edge;
import de.jtem.halfedge.Face;
import de.jtem.halfedge.HalfEdgeDataStructure;
import de.jtem.halfedge.Vertex;
import de.jtem.halfedge.util.HalfEdgeUtils;
import de.jtem.halfedgetools.adapter.AdapterSet;
import de.jtem.halfedgetools.adapter.type.Position;
public class DualGraphSubdivision {
public <
V extends Vertex<V, E, F>,
E extends Edge<V, E, F>,
F extends Face<V, E, F>,
HDS extends HalfEdgeDataStructure<V, E, F>
> void subdivide(
HDS graph,
HDS r,
AdapterSet a,
Map<F, V> faceVertexMap,
Map<E, E> edgeEdgeMap,
Map<V, F> vertexFaceMap
) {
if (faceVertexMap == null) {
faceVertexMap = new TreeMap<>();
}
if (edgeEdgeMap == null) {
edgeEdgeMap = new TreeMap<>();
}
if (vertexFaceMap == null) {
vertexFaceMap = new TreeMap<>();
}
for (F f : graph.getFaces()) {
V v = r.addNewVertex();
a.set(Position.class, v, a.getD(Position.class, f));
faceVertexMap.put(f, v);
}
for (E e : graph.getEdges()) {
if (HalfEdgeUtils.isBoundaryEdge(e)) { continue; }
E ee = r.addNewEdge();
edgeEdgeMap.put(e, ee);
}
for (V v : graph.getVertices()) {
if (HalfEdgeUtils.isBoundaryVertex(v)) { continue; }
F f = r.addNewFace();
vertexFaceMap.put(v, f);
}
// linkage
for (E e : graph.getEdges()) {
if (HalfEdgeUtils.isBoundaryEdge(e)) continue;
E ee = edgeEdgeMap.get(e);
E eeOpp = edgeEdgeMap.get(e.getOppositeEdge());
ee.linkOppositeEdge(eeOpp);
ee.setTargetVertex(faceVertexMap.get(e.getLeftFace()));
ee.setLeftFace(vertexFaceMap.get(e.getStartVertex()));
E ePrev = e.getPreviousEdge();
while (HalfEdgeUtils.isBoundaryEdge(ePrev)) {
// find next on boundary
ePrev = ePrev.getPreviousEdge();
}
ee.linkNextEdge(edgeEdgeMap.get(ePrev.getOppositeEdge()));
}
}
}
......@@ -31,6 +31,13 @@ OF SUCH DAMAGE.
package de.jtem.halfedgetools.algorithm.subdivision;
import static de.jreality.math.Rn.add;
import static de.jreality.math.Rn.linearCombination;
import static de.jreality.math.Rn.times;
import static de.jtem.halfedge.util.HalfEdgeUtils.incomingEdges;
import static java.lang.StrictMath.cos;
import static java.lang.StrictMath.pow;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
......@@ -38,12 +45,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import de.jreality.math.Rn;
import de.jtem.halfedge.Edge;
import de.jtem.halfedge.Face;
import de.jtem.halfedge.HalfEdgeDataStructure;
import de.jtem.halfedge.Vertex;
import de.jtem.halfedge.util.HalfEdgeUtils;
import de.jtem.halfedgetools.adapter.TypedAdapterSet;
import de.jtem.halfedgetools.adapter.type.BaryCenter;
import de.jtem.halfedgetools.adapter.type.Position;
......@@ -70,11 +75,10 @@ public class Loop {
Map<V, double[]> oldVtoPos = new HashMap<V, double[]>();
Map<V,E> newVtoOldE = new HashMap<V,E>();
Map<E, Set<E>> oldEtoNewEs = new HashMap<E,Set<E>>();
// Map<E,Set<E>> oldEtoOldEs = new HashMap<E,Set<E>>();
int maxDeg = 0;
for(V v : oldHeds.getVertices()) {
maxDeg = Math.max(maxDeg, HalfEdgeUtils.incomingEdges(v).size());
maxDeg = Math.max(maxDeg, incomingEdges(v).size());
}
......@@ -84,54 +88,18 @@ public class Loop {
HashMap<Integer, Double> alphaMap = new HashMap<Integer, Double>();
for(int i = 1; i <= maxDeg; i++) {
double alpha = 0.0;
if(i == 6)
if(i == 6) {
alpha = 3.0/8.0;
else
alpha = 5.0/8.0 - StrictMath.pow(3.0/8.0 + 1.0/4.0 * StrictMath.cos(2*Math.PI/i),2);
} else {
alpha = 5.0/8.0 - pow(3.0/8.0 + 1.0/4.0 * cos(2*Math.PI/i),2);
}
alphaMap.put(i, alpha);
}
//just an idea for a map to locate the n-gon
// (in this case triangle) of the grid
//maybe we can use this later to locate the symmetry cycle
// for (E e: oldHeds.getEdges()){
// Set<E> oldEs = new HashSet<E>();
// E tmp = e.getNextEdge();
// while (tmp != e){
// oldEs.add(tmp);
// tmp.getNextEdge();
// }
// oldEtoOldEs.put(e, oldEs);
// }
// Set<E> checkE = new HashSet<E>();
for(E e : oldHeds.getPositiveEdges()) {
double[] pos = new double[3];
// calc with edge midpoint
// eA.setEdgeAlpha(0.5);
// eA.setEdgeIgnore(true);
// pos = eA.get(e);
// calc with original scheme
// Verschiebung der neuen Punkte p_neu = 1/8*(3*a+3*b+1*c+1*d)
// eA.setEdgeIgnore(true);
// eA.setEdgeAlpha(1.0);
// double[] a = eA.get(e.getPreviousEdge());
// double[] b = eA.get(e.getOppositeEdge().getPreviousEdge());
// eA.setEdgeIgnore(false);
// double[] c = eA.get(e.getOppositeEdge().getNextEdge());
// double[] d = eA.get(e.getNextEdge().getOppositeEdge());
//
// Rn.times(a,3.0,a);
// Rn.times(b,3.0,b);
// Rn.add(pos, b, a);
// Rn.add(pos, c, pos);
// Rn.add(pos, d, pos);
// Rn.times(pos, 1.0/8.0, pos);
if (e.getLeftFace() == null || e.getRightFace() == null){
if (e.getLeftFace() == null || e.getRightFace() == null) {
// boarderhandling edge-midpoints
a.setParameter("alpha", 0.5);
a.setParameter("ignore", true);
......@@ -146,12 +114,12 @@ public class Loop {
a.setParameter("ignore", true);
double[] m = a.get(BaryCenter.class, e);
Rn.times(b1, 3.0/8.0, b1);
Rn.times(b2, 3.0/8.0, b2);
Rn.times(m, 1.0/4.0, m);
times(b1, 3.0/8.0, b1);
times(b2, 3.0/8.0, b2);
times(m, 1.0/4.0, m);
Rn.add(pos, b1, b2);
Rn.add(pos, m, pos);
add(pos, b1, b2);
add(pos, m, pos);
oldEtoPos.put(e, pos);
}
......@@ -162,21 +130,21 @@ public class Loop {
// Falls der Grad d := #Nachbarn =6,
// ist der Punkt regulär.
for(V v : oldHeds.getVertices()) {
List<E> star = HalfEdgeUtils.incomingEdges(v);
List<E> star = incomingEdges(v);
int deg = star.size();
double[] mid = new double[3];
for(E e : star) {
a.setParameter("alpha", 0.0);
a.setParameter("ignore", false);
Rn.add(mid, a.get(BaryCenter3d.class, e), mid);
add(mid, a.get(BaryCenter3d.class, e), mid);
}
Rn.times(mid, 1.0 / deg, mid);
times(mid, 1.0 / deg, mid);
double[] newpos = new double[3];
double alpha = alphaMap.get(deg);
double[] p = a.get(BaryCenter3d.class, v);
Rn.linearCombination(newpos, 1.0 - alpha, p, alpha, mid);
linearCombination(newpos, 1.0 - alpha, p, alpha, mid);
oldVtoPos.put(v, newpos);
}
......
......@@ -111,7 +111,11 @@ public class HalfedgeIO {
if(hds.numVertices() == 0) {
continue;
}
count += WriterOBJ.write(converter.heds2ifs(hds, adapters,null), name, count, fos);
if(hds.numFaces() != 0) {
count += WriterOBJ.write(converter.heds2ifs(hds, adapters,null), name, count, fos);
} else {
count += WriterOBJ.write(converter.heds2ifs(hds, adapters, null), name, count, true, fos);
}
}
fos.close();
} catch (Exception e1) {
......
......@@ -30,11 +30,11 @@ import de.jtem.jrworkspace.plugin.flavor.ToolBarFlavor;
public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
private Map<String, JComboBox<AlgorithmPlugin>>
private Map<AlgorithmCategory, JComboBox<AlgorithmPlugin>>
comboMap = new HashMap<>();
private Map<String, Set<AlgorithmPlugin>>
algoMap = new HashMap<String, Set<AlgorithmPlugin>>();
private Map<AlgorithmCategory, Set<AlgorithmPlugin>>
algoMap = new HashMap<AlgorithmCategory, Set<AlgorithmPlugin>>();
private JToolBar
comboToolBar = new JToolBar("Halfedge Algorithms");
......@@ -43,15 +43,15 @@ public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
}
private void addComboBox(String cat) {
private void addComboBox(AlgorithmCategory cat) {
JComboBox<AlgorithmPlugin> catCombo = new JComboBox<>();
catCombo.setMaximumRowCount(50);
AlgorithmComboModel model = new AlgorithmComboModel(cat);
catCombo.setModel(model);
AlgorithmCellRenderer renderer = new AlgorithmCellRenderer(cat);
catCombo.setRenderer(renderer);
comboMap.put(cat.toString(), catCombo);
algoMap.put(cat.toString(), new HashSet<AlgorithmPlugin>());
comboMap.put(cat, catCombo);
algoMap.put(cat, new HashSet<AlgorithmPlugin>());
updateComboBoxes();
}
......@@ -63,10 +63,10 @@ public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
private static final long
serialVersionUID = 1L;
private String
category = AlgorithmCategory.Custom.toString();
private AlgorithmCategory
category = AlgorithmCategory.Custom;
public AlgorithmCellRenderer(String cat) {
public AlgorithmCellRenderer(AlgorithmCategory cat) {
this.category = cat;
}
......@@ -92,10 +92,10 @@ public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
private class AlgorithmComboModel implements ComboBoxModel<AlgorithmPlugin> {
private String
category = AlgorithmCategory.Custom.toString();
private AlgorithmCategory
category = AlgorithmCategory.Custom;
public AlgorithmComboModel(String cat) {
public AlgorithmComboModel(AlgorithmCategory cat) {
this.category = cat;
}
......@@ -136,7 +136,7 @@ public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
}
protected List<AlgorithmPlugin> getAlgorithms(String cat) {
protected List<AlgorithmPlugin> getAlgorithms(AlgorithmCategory cat) {
List<AlgorithmPlugin> result = new LinkedList<AlgorithmPlugin>();
Set<AlgorithmPlugin> algoSet = algoMap.get(cat);
result.addAll(algoSet);
......@@ -151,10 +151,10 @@ public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
int numCombos = 0;
LinkedList<String> algorithmCategories = new LinkedList<String>(comboMap.keySet());
LinkedList<AlgorithmCategory> algorithmCategories = new LinkedList<>(comboMap.keySet());
Collections.sort(algorithmCategories);
for (String cat : algorithmCategories) {
for (AlgorithmCategory cat : algorithmCategories) {
JComboBox<AlgorithmPlugin> combo = comboMap.get(cat);
Set<AlgorithmPlugin> algos = algoMap.get(cat);
if (algos.isEmpty()) continue;
......@@ -183,7 +183,7 @@ public class AlgorithmDropdownToolbar extends Plugin implements ToolBarFlavor {
}
public void addAlgorithm(AlgorithmPlugin ap) {
String algoName = ap.getCategory();
AlgorithmCategory algoName = ap.getCategory();
if(!algoMap.containsKey(algoName)) {
addComboBox(algoName);
}
......
......@@ -225,6 +225,8 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
private boolean
normalizeContent = true;
private boolean
autoUpdate = true;
public HalfedgeInterface() {
makeLayout();
......@@ -640,6 +642,7 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
@Override
public void actionPerformed(ActionEvent e) {
autoUpdate = false;
if((e.getModifiers() & CTRL_MASK) == CTRL_MASK) {
Window w = getWindowAncestor(shrinkPanel);
int result = JOptionPane.showConfirmDialog(w, "Delete all layers?");
......@@ -667,6 +670,7 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
if(layers.isEmpty()) {
createLayer("Default Layer");
}
autoUpdate = true;
updateStates();
checkContent();
}
......@@ -1017,6 +1021,9 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
}
protected void updateStates() {
if(!autoUpdate) {
return;
}
Runnable updateStatesRunner = new Runnable() {
@Override
public void run() {
......@@ -1437,6 +1444,9 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
}
public void checkContent() {
if(!autoUpdate) {
return;
}
if (scene == null) return;
List<SceneGraphPath> paths = getPathsBetween(scene.getSceneRoot(), root);
if (paths.isEmpty()) {
......@@ -1684,5 +1694,9 @@ public class HalfedgeInterface extends ShrinkPanelPlugin implements
public void setNormalizeContent(boolean normalizeContent) {
this.normalizeContent = normalizeContent;
}
public void setAutoUpdate(boolean b) {
autoUpdate = b;
}
}
......@@ -31,9 +31,6 @@ OF SUCH DAMAGE.
package de.jtem.halfedgetools.plugin;
import java.util.HashSet;
import java.util.Set;
import de.jreality.plugin.job.JobMonitorPlugin;
import de.jtem.halfedgetools.jreality.node.DefaultJREdge;
import de.jtem.halfedgetools.jreality.node.DefaultJRFace;
......@@ -42,77 +39,27 @@ import de.jtem.halfedgetools.jreality.node.DefaultJRVertex;
import de.jtem.halfedgetools.plugin.algorithm.generator.ConvexHullGenerator;
import de.jtem.halfedgetools.plugin.algorithm.generator.RandomEllipsoidGenerator;
import de.jtem.halfedgetools.plugin.algorithm.generator.RandomSphereGenerator;
import de.jtem.halfedgetools.plugin.algorithm.geometry.CopyVertexPositions;
import de.jtem.halfedgetools.plugin.algorithm.geometry.PasteVertexPositions;
import de.jtem.halfedgetools.plugin.algorithm.geometry.PerturbPlugin;
import de.jtem.halfedgetools.plugin.algorithm.geometry.ProjectPlugin;
import de.jtem.halfedgetools.plugin.algorithm.geometry.SwapPosTexPos;
import de.jtem.halfedgetools.plugin.algorithm.selection.BoundaryEdgeSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.BoundaryFaceSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.BoundaryVertexSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.ClearEdgeSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.ClearFaceSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.ClearSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.ClearVertexSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.ExportSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.ImportSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.InvertEdgeSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.InvertFaceSelection;
import de.jtem.halfedgetools.plugin.algorithm.selection.InvertVertexSelection;
import de.jtem.halfedgetools.plugin.algorithm.geometry.*;
import de.jtem.halfedgetools.plugin.algorithm.selection.*;
import de.jtem.halfedgetools.plugin.algorithm.simplification.GarlandHeckbertPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.CatmullClarkLinearPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.CatmullClarkPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.DooSabinPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.LoopLinearPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.LoopPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.MedialGraphLinearPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.QuadGraphLinearPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.Sqrt3LinearPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.Sqrt3Plugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.StellarLinearPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.TriangulateCutCornersPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.TriangulatePlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.DelaunayPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.EdgeCollapsePlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.EdgeFlipperPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.EdgeRemoverFillPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.EdgeRemoverPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.EdgeSplitterPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.FaceCollapserPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.FaceCreatePlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.FaceRemoverPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.FaceScalerPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.FaceSplitterPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.FillHolesPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.RemoveSelectedNodesPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.RemoveVertexFillPlugin;
import de.jtem.halfedgetools.plugin.algorithm.topology.VertexRemoverPlugin;
import de.jtem.halfedgetools.plugin.algorithm.subdivision.*;
import de.jtem.halfedgetools.plugin.algorithm.topology.*;
import de.jtem.halfedgetools.plugin.algorithm.vectorfield.CurvatureVectorFields;
import de.jtem.halfedgetools.plugin.data.VisualizationInterface;
import de.jtem.halfedgetools.plugin.data.source.FacePlanarityDataSource;
import de.jtem.halfedgetools.plugin.data.source.SceneGraphTestSource;
import de.jtem.halfedgetools.plugin.data.visualizer.ColoredBeadsVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.HistogramVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.Immersion3DVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.LabelVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.NodeColorVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.SceneGraphNodeVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.TableDataVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.TextDumpVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.VectorFieldVisualizer;
import de.jtem.halfedgetools.plugin.data.visualizer.*;
import de.jtem.halfedgetools.plugin.misc.RerunLastAlgorithmPlugin;
import de.jtem.halfedgetools.plugin.modes.EditMode;
import de.jtem.halfedgetools.plugin.modes.SelectionMode;
import de.jtem.halfedgetools.plugin.texturespace.TextureSpaceInterface;
import de.jtem.halfedgetools.plugin.visualizers.DirichletEnergyVisualizer;
import de.jtem.halfedgetools.plugin.visualizers.EdgeLengthVisualizer;
import de.jtem.halfedgetools.plugin.visualizers.FacePlanarityVisualizer;
import de.jtem.halfedgetools.plugin.visualizers.NodeIndexVisualizer;
import de.jtem.halfedgetools.plugin.visualizers.NormalVisualizer;
import de.jtem.halfedgetools.plugin.visualizers.*;
import de.jtem.halfedgetools.plugin.widget.ContextMenuWidget;
import de.jtem.halfedgetools.plugin.widget.ViewSwitchWidget;
import de.jtem.jrworkspace.plugin.Plugin;
import java.util.HashSet;
import java.util.Set;
public class HalfedgePluginFactory {
......@@ -161,6 +108,7 @@ public class HalfedgePluginFactory {
s.add(new StellarLinearPlugin());
s.add(new TriangulatePlugin());
s.add(new TriangulateCutCornersPlugin());
s.add(new DualGraphSubdivisionPlugin());
return s;
}
......@@ -216,7 +164,7 @@ public class HalfedgePluginFactory {
s.add(new Immersion3DVisualizer<DefaultJRVertex, DefaultJREdge, DefaultJRFace, DefaultJRHDS>());
s.add(new SceneGraphNodeVisualizer());
s.add(new FacePlanarityDataSource());
s.add(new SceneGraphTestSource());
s.add(new PointSetVisualizer());
return s;
}
......
......@@ -197,7 +197,7 @@ public abstract class AlgorithmPlugin extends Plugin implements Comparable<Algor
view = c.getPlugin(View.class);
hcp = c.getPlugin(HalfedgeInterface.class);
viewMenuBar = c.getPlugin(ViewMenuBar.class);
String catName = getCategory();
String catName = getCategory().toString();
viewMenuBar.addMenuItem(getClass(), getPriority(), action, "Halfedge", catName);
dropdownToolbar = c.getPlugin(AlgorithmDropdownToolbar.class);
dropdownToolbar.addAlgorithm(this);
......@@ -219,8 +219,8 @@ public abstract class AlgorithmPlugin extends Plugin implements Comparable<Algor
return null;
}
public String getCategory() {
return getAlgorithmCategory().toString();
public AlgorithmCategory getCategory() {
return getAlgorithmCategory();
}
public AlgorithmCategory getAlgorithmCategory() {
......
/**
This file is part of a jTEM project.
All jTEM projects are licensed under the FreeBSD license
or 2-clause BSD license (see http://www.opensource.org/licenses/bsd-license.php).
Copyright (c) 2002-2010, Technische Universität Berlin, jTEM
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
**/
package de.jtem.halfedgetools.plugin.algorithm.subdivision;
import de.jtem.halfedge.Edge;
import de.jtem.halfedge.Face;
import de.jtem.halfedge.HalfEdgeDataStructure;
import de.jtem.halfedge.Vertex;
import de.jtem.halfedgetools.adapter.AdapterSet;
import de.jtem.halfedgetools.adapter.TypedAdapterSet;
import de.jtem.halfedgetools.algorithm.subdivision.DualGraphSubdivision;
import de.jtem.halfedgetools.plugin.HalfedgeInterface;
import de.jtem.halfedgetools.plugin.algorithm.AlgorithmCategory;
import de.jtem.halfedgetools.plugin.algorithm.AlgorithmPlugin;
import de.jtem.halfedgetools.plugin.image.ImageHook;
import de.jtem.jrworkspace.plugin.PluginInfo;
public class DualGraphSubdivisionPlugin extends AlgorithmPlugin {
private DualGraphSubdivision
subdivider = new DualGraphSubdivision();
@Override
public <
V extends Vertex<V, E, F>,
E extends Edge<V, E, F>,
F extends Face<V, E, F>,
HDS extends HalfEdgeDataStructure<V, E, F>
> void execute(HDS hds, AdapterSet a, HalfedgeInterface hcp) {
HDS hds2 = hcp.createEmpty(hds);
TypedAdapterSet<double[]> da = a.querySet(double[].class);
subdivider.subdivide(hds, hds2, da, null, null, null);
hcp.set(hds2);
}