Loading Comparison/src/main/java/cz/fidentis/analyst/Project.java +0 −2 Original line number Diff line number Diff line package cz.fidentis.analyst; import cz.fidentis.analyst.face.HumanFace; import cz.fidentis.analyst.mesh.events.MeshEvent; import java.util.ArrayList; import java.util.Collections; import java.util.List; Loading @@ -15,7 +14,6 @@ import java.util.List; */ public class Project { //private HumanFace primaryFace; private List<HumanFace> faces = new ArrayList<>(); /** Loading Comparison/src/main/java/cz/fidentis/analyst/face/FaceStateComparator.java 0 → 100644 +45 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.face; import java.util.Comparator; /** * Comparator for HumanFace faces * * @author Matej Kovar */ public class FaceStateComparator implements Comparator<HumanFace> { /* private boolean kdTreeFilter = false; private boolean featurePointsFilter = false; private boolean alphabeticalFilter = false; public FaceStateComparator(boolean kdTreeFilter, boolean featurePointsFilter, boolean alphabeticalFilter) { this.kdTreeFilter = kdTreeFilter; this.featurePointsFilter = featurePointsFilter; this.alphabeticalFilter = alphabeticalFilter; }*/ @Override public int compare(HumanFace face1, HumanFace face2) { int comparison; comparison = Boolean.compare(face1.hasFeaturePoints(), face2.hasFeaturePoints()); // Both have feature points if (comparison == 0) { comparison = Boolean.compare(face1.hasKdTree(), face2.hasKdTree()); // Both have KD Tree if (comparison == 0) { // Alphabeticaly comparison = face1.getShortName().compareTo(face2.getShortName()); } } return comparison; } } Comparison/src/main/java/cz/fidentis/analyst/face/HumanFace.java +39 −17 Original line number Diff line number Diff line Loading @@ -4,10 +4,14 @@ import com.google.common.eventbus.EventBus; import cz.fidentis.analyst.feature.FeaturePoint; import cz.fidentis.analyst.feature.services.FeaturePointImportService; import cz.fidentis.analyst.kdtree.KdTree; import cz.fidentis.analyst.kdtree.events.KdTreeCreated; import cz.fidentis.analyst.kdtree.events.KdTreeDestroyed; import cz.fidentis.analyst.kdtree.events.KdTreeEvent; import cz.fidentis.analyst.mesh.core.MeshFacet; import cz.fidentis.analyst.mesh.core.MeshModel; import cz.fidentis.analyst.mesh.events.MeshEvent; import cz.fidentis.analyst.mesh.events.MeshListener; import cz.fidentis.analyst.kdtree.events.KdTreeListener; import cz.fidentis.analyst.mesh.io.MeshObjLoader; import cz.fidentis.analyst.symmetry.Plane; import cz.fidentis.analyst.visitors.face.HumanFaceVisitor; Loading @@ -25,7 +29,6 @@ import java.util.Collections; import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Observable; //import org.nustaq.serialization.FSTConfiguration; //import org.nustaq.serialization.FSTObjectInput; //import org.nustaq.serialization.FSTObjectOutput; Loading @@ -51,7 +54,7 @@ import java.util.Observable; * * @author Radek Oslejsek */ public class HumanFace extends Observable implements MeshListener, Serializable { public class HumanFace implements MeshListener, KdTreeListener, Serializable { private MeshModel meshModel; Loading Loading @@ -107,6 +110,7 @@ public class HumanFace extends Observable implements MeshListener, Serializable throw new IllegalArgumentException("meshModel"); } this.meshModel = meshModel; //eventBus.post(new MeshChangedEvent()); } /** Loading @@ -115,10 +119,8 @@ public class HumanFace extends Observable implements MeshListener, Serializable * * @param listener Listener concerned in the human face changes. */ public void registerListener(MeshListener listener) { public void registerListener(HumanFaceListener listener) { eventBus.register(listener); setChanged(); notifyObservers(this); } /** Loading @@ -126,10 +128,8 @@ public class HumanFace extends Observable implements MeshListener, Serializable * * @param listener Registered listener */ public void unregisterListener(MeshListener listener) { public void unregisterListener(HumanFaceListener listener) { eventBus.unregister(listener); setChanged(); notifyObservers(this); } /** Loading Loading @@ -187,8 +187,6 @@ public class HumanFace extends Observable implements MeshListener, Serializable */ public void setFeaturePoints(List<FeaturePoint> points) { featurePoints = points; setChanged(); notifyObservers(this); } /** Loading @@ -200,8 +198,6 @@ public class HumanFace extends Observable implements MeshListener, Serializable */ public void loadFeaturePoints(String path, String fileName) throws IOException { featurePoints = FeaturePointImportService.importFeaturePoints(path, fileName); setChanged(); notifyObservers(this); } /** Loading @@ -215,6 +211,14 @@ public class HumanFace extends Observable implements MeshListener, Serializable return Collections.unmodifiableList(featurePoints); } /** * Checks if HumanFace has feature points * @return true if yes and false if not */ public boolean hasFeaturePoints() { return featurePoints != null; } /** * Returns unique ID of the face. * Loading Loading @@ -252,6 +256,14 @@ public class HumanFace extends Observable implements MeshListener, Serializable return this.kdTree; } /** * Checks if HumanFace has KdTree calculated * @return true if yes and false if not */ public boolean hasKdTree() { return kdTree != null; } /** * Computes new k-d tree or returns the existing one. * Loading @@ -262,8 +274,8 @@ public class HumanFace extends Observable implements MeshListener, Serializable public KdTree computeKdTree(boolean recompute) { if (kdTree == null || recompute) { kdTree = new KdTree(new ArrayList<>(meshModel.getFacets())); setChanged(); notifyObservers(this); kdTree.registerListener(this); eventBus.post(new KdTreeCreated(this.getShortName())); } return kdTree; } Loading @@ -275,11 +287,21 @@ public class HumanFace extends Observable implements MeshListener, Serializable public KdTree removeKdTree() { KdTree ret = this.kdTree; this.kdTree = null; setChanged(); notifyObservers(this); eventBus.post(new KdTreeDestroyed(this.getShortName())); return ret; } /** * Captures events fired by {@link cz.fidentis.analyst.kdtree.KdTree} and * redirects them to our listeners. * * @param event A fired event. */ @Override public void kdTreeEvent(KdTreeEvent event) { eventBus.post(event); } /** * Creates serialized dump of the human face. Event buses are not stored. * Therefore, listeners have to re-register again after recovery. Loading Comparison/src/main/java/cz/fidentis/analyst/face/HumanFaceListener.java +3 −2 Original line number Diff line number Diff line package cz.fidentis.analyst.face; import cz.fidentis.analyst.kdtree.events.KdTreeListener; import cz.fidentis.analyst.mesh.events.MeshListener; /** Loading @@ -9,6 +10,6 @@ import cz.fidentis.analyst.mesh.events.MeshListener; * * @author Radek Oslejsek */ public interface HumanFaceListener extends MeshListener { public interface HumanFaceListener extends KdTreeListener, MeshListener { } GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.form +280 −522 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
Comparison/src/main/java/cz/fidentis/analyst/Project.java +0 −2 Original line number Diff line number Diff line package cz.fidentis.analyst; import cz.fidentis.analyst.face.HumanFace; import cz.fidentis.analyst.mesh.events.MeshEvent; import java.util.ArrayList; import java.util.Collections; import java.util.List; Loading @@ -15,7 +14,6 @@ import java.util.List; */ public class Project { //private HumanFace primaryFace; private List<HumanFace> faces = new ArrayList<>(); /** Loading
Comparison/src/main/java/cz/fidentis/analyst/face/FaceStateComparator.java 0 → 100644 +45 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.face; import java.util.Comparator; /** * Comparator for HumanFace faces * * @author Matej Kovar */ public class FaceStateComparator implements Comparator<HumanFace> { /* private boolean kdTreeFilter = false; private boolean featurePointsFilter = false; private boolean alphabeticalFilter = false; public FaceStateComparator(boolean kdTreeFilter, boolean featurePointsFilter, boolean alphabeticalFilter) { this.kdTreeFilter = kdTreeFilter; this.featurePointsFilter = featurePointsFilter; this.alphabeticalFilter = alphabeticalFilter; }*/ @Override public int compare(HumanFace face1, HumanFace face2) { int comparison; comparison = Boolean.compare(face1.hasFeaturePoints(), face2.hasFeaturePoints()); // Both have feature points if (comparison == 0) { comparison = Boolean.compare(face1.hasKdTree(), face2.hasKdTree()); // Both have KD Tree if (comparison == 0) { // Alphabeticaly comparison = face1.getShortName().compareTo(face2.getShortName()); } } return comparison; } }
Comparison/src/main/java/cz/fidentis/analyst/face/HumanFace.java +39 −17 Original line number Diff line number Diff line Loading @@ -4,10 +4,14 @@ import com.google.common.eventbus.EventBus; import cz.fidentis.analyst.feature.FeaturePoint; import cz.fidentis.analyst.feature.services.FeaturePointImportService; import cz.fidentis.analyst.kdtree.KdTree; import cz.fidentis.analyst.kdtree.events.KdTreeCreated; import cz.fidentis.analyst.kdtree.events.KdTreeDestroyed; import cz.fidentis.analyst.kdtree.events.KdTreeEvent; import cz.fidentis.analyst.mesh.core.MeshFacet; import cz.fidentis.analyst.mesh.core.MeshModel; import cz.fidentis.analyst.mesh.events.MeshEvent; import cz.fidentis.analyst.mesh.events.MeshListener; import cz.fidentis.analyst.kdtree.events.KdTreeListener; import cz.fidentis.analyst.mesh.io.MeshObjLoader; import cz.fidentis.analyst.symmetry.Plane; import cz.fidentis.analyst.visitors.face.HumanFaceVisitor; Loading @@ -25,7 +29,6 @@ import java.util.Collections; import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Observable; //import org.nustaq.serialization.FSTConfiguration; //import org.nustaq.serialization.FSTObjectInput; //import org.nustaq.serialization.FSTObjectOutput; Loading @@ -51,7 +54,7 @@ import java.util.Observable; * * @author Radek Oslejsek */ public class HumanFace extends Observable implements MeshListener, Serializable { public class HumanFace implements MeshListener, KdTreeListener, Serializable { private MeshModel meshModel; Loading Loading @@ -107,6 +110,7 @@ public class HumanFace extends Observable implements MeshListener, Serializable throw new IllegalArgumentException("meshModel"); } this.meshModel = meshModel; //eventBus.post(new MeshChangedEvent()); } /** Loading @@ -115,10 +119,8 @@ public class HumanFace extends Observable implements MeshListener, Serializable * * @param listener Listener concerned in the human face changes. */ public void registerListener(MeshListener listener) { public void registerListener(HumanFaceListener listener) { eventBus.register(listener); setChanged(); notifyObservers(this); } /** Loading @@ -126,10 +128,8 @@ public class HumanFace extends Observable implements MeshListener, Serializable * * @param listener Registered listener */ public void unregisterListener(MeshListener listener) { public void unregisterListener(HumanFaceListener listener) { eventBus.unregister(listener); setChanged(); notifyObservers(this); } /** Loading Loading @@ -187,8 +187,6 @@ public class HumanFace extends Observable implements MeshListener, Serializable */ public void setFeaturePoints(List<FeaturePoint> points) { featurePoints = points; setChanged(); notifyObservers(this); } /** Loading @@ -200,8 +198,6 @@ public class HumanFace extends Observable implements MeshListener, Serializable */ public void loadFeaturePoints(String path, String fileName) throws IOException { featurePoints = FeaturePointImportService.importFeaturePoints(path, fileName); setChanged(); notifyObservers(this); } /** Loading @@ -215,6 +211,14 @@ public class HumanFace extends Observable implements MeshListener, Serializable return Collections.unmodifiableList(featurePoints); } /** * Checks if HumanFace has feature points * @return true if yes and false if not */ public boolean hasFeaturePoints() { return featurePoints != null; } /** * Returns unique ID of the face. * Loading Loading @@ -252,6 +256,14 @@ public class HumanFace extends Observable implements MeshListener, Serializable return this.kdTree; } /** * Checks if HumanFace has KdTree calculated * @return true if yes and false if not */ public boolean hasKdTree() { return kdTree != null; } /** * Computes new k-d tree or returns the existing one. * Loading @@ -262,8 +274,8 @@ public class HumanFace extends Observable implements MeshListener, Serializable public KdTree computeKdTree(boolean recompute) { if (kdTree == null || recompute) { kdTree = new KdTree(new ArrayList<>(meshModel.getFacets())); setChanged(); notifyObservers(this); kdTree.registerListener(this); eventBus.post(new KdTreeCreated(this.getShortName())); } return kdTree; } Loading @@ -275,11 +287,21 @@ public class HumanFace extends Observable implements MeshListener, Serializable public KdTree removeKdTree() { KdTree ret = this.kdTree; this.kdTree = null; setChanged(); notifyObservers(this); eventBus.post(new KdTreeDestroyed(this.getShortName())); return ret; } /** * Captures events fired by {@link cz.fidentis.analyst.kdtree.KdTree} and * redirects them to our listeners. * * @param event A fired event. */ @Override public void kdTreeEvent(KdTreeEvent event) { eventBus.post(event); } /** * Creates serialized dump of the human face. Event buses are not stored. * Therefore, listeners have to re-register again after recovery. Loading
Comparison/src/main/java/cz/fidentis/analyst/face/HumanFaceListener.java +3 −2 Original line number Diff line number Diff line package cz.fidentis.analyst.face; import cz.fidentis.analyst.kdtree.events.KdTreeListener; import cz.fidentis.analyst.mesh.events.MeshListener; /** Loading @@ -9,6 +10,6 @@ import cz.fidentis.analyst.mesh.events.MeshListener; * * @author Radek Oslejsek */ public interface HumanFaceListener extends MeshListener { public interface HumanFaceListener extends KdTreeListener, MeshListener { }
GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.form +280 −522 File changed.Preview size limit exceeded, changes collapsed. Show changes