Skip to content
Snippets Groups Projects
Commit 6c8f10cd authored by Matej Kovár's avatar Matej Kovár
Browse files

HumanFace now extends Observable

parent 0d12a329
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ 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;
......@@ -50,7 +51,7 @@ import java.util.Objects;
*
* @author Radek Oslejsek
*/
public class HumanFace implements MeshListener, Serializable {
public class HumanFace extends Observable implements MeshListener, Serializable {
private MeshModel meshModel;
......@@ -116,6 +117,8 @@ public class HumanFace implements MeshListener, Serializable {
*/
public void registerListener(MeshListener listener) {
eventBus.register(listener);
setChanged();
notifyObservers(this);
}
/**
......@@ -125,6 +128,8 @@ public class HumanFace implements MeshListener, Serializable {
*/
public void unregisterListener(MeshListener listener) {
eventBus.unregister(listener);
setChanged();
notifyObservers(this);
}
/**
......@@ -182,6 +187,8 @@ public class HumanFace implements MeshListener, Serializable {
*/
public void setFeaturePoints(List<FeaturePoint> points) {
featurePoints = points;
setChanged();
notifyObservers(this);
}
/**
......@@ -193,6 +200,8 @@ public class HumanFace implements MeshListener, Serializable {
*/
public void loadFeaturePoints(String path, String fileName) throws IOException {
featurePoints = FeaturePointImportService.importFeaturePoints(path, fileName);
setChanged();
notifyObservers(this);
}
/**
......@@ -253,6 +262,8 @@ public class HumanFace implements MeshListener, Serializable {
public KdTree computeKdTree(boolean recompute) {
if (kdTree == null || recompute) {
kdTree = new KdTree(new ArrayList<>(meshModel.getFacets()));
setChanged();
notifyObservers(this);
}
return kdTree;
}
......@@ -264,6 +275,8 @@ public class HumanFace implements MeshListener, Serializable {
public KdTree removeKdTree() {
KdTree ret = this.kdTree;
this.kdTree = null;
setChanged();
notifyObservers(this);
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment