Skip to content
Snippets Groups Projects
Commit 42761201 authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Merge branch '113-introduce-new-features-on-list-of-faces-in-a-project' into 'master'

Resolve "Introduce new features on list of faces in a project"

Closes #113

See merge request grp-fidentis/analyst2!125
parents 972a5551 4e7d7f99
No related branches found
No related tags found
No related merge requests found
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;
/**
* This class encapsulates data for a "comparison project", i.e., a project
* enabling analysts to compare and investigate human faces.
......@@ -16,37 +18,6 @@ public class Project {
//private HumanFace primaryFace;
private List<HumanFace> faces = new ArrayList<>();
/**
* Returns primary face
*
* @return HumanFace primary face
public HumanFace getPrimaryFace() {
return primaryFace;
}
/**
* Sets new primary face
*
* @param primaryFace which will be new primary face
* @throws IllegalArgumentException when argument primaryFace is null
public void setPrimaryFace(HumanFace primaryFace) {
if (primaryFace == null) {
throw new IllegalArgumentException("Primary face is null");
}
this.primaryFace = primaryFace;
}
/**
* Removes primary face and sets primaryFace attribute to null
public void removePrimaryFace() {
this.primaryFace = null;
}*/
/**
* Returns list of HumanFace secondary faces
*
......@@ -132,5 +103,5 @@ public class Project {
}
return null;
}
}
......@@ -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;
}
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cz.fidentis.analyst.gui;
import cz.fidentis.analyst.face.HumanFace;
import java.util.Observable;
import java.util.Observer;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Matej Kovar
*/
public class ModelsTableModel extends DefaultTableModel implements Observer {
/**
* Constructor for table model
* @param columnNames names of Columns
* @param rowCount number of rows
*/
public ModelsTableModel(Object[] columnNames, int rowCount) {
super(columnNames, rowCount);
}
private Class[] types = new Class [] {
java.lang.Boolean.class, java.lang.String.class, java.lang.Boolean.class
};
private boolean[] canEdit = new boolean [] {
true, false, false
};
@Override
public Class getColumnClass(int columnIndex) {
return types [columnIndex];}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
public Class[] getTypes() {
return types;}
public void setTypes(Class[] types) {
this.types = types;}
public boolean[] getCanEdit() {
return canEdit;}
public void setCanEdit(boolean[] canEdit) {
this.canEdit = canEdit;
}
@Override
public void update(Observable o, Object o1) {
HumanFace face = (HumanFace)o1;
String name = face.getShortName();
boolean hasKD = false;
if (face.getKdTree() != null) {
hasKD = true;
}
for (int i = 0; i < getRowCount(); i++) {
if (getValueAt(i, 1).equals(name)) {
this.setValueAt(hasKD, i, 2);
break;
}
}
}
}
......@@ -9,15 +9,31 @@ PostRegistrationCP.rotationZFTF.text=0
PostRegistrationCP.rotationYFTF.text=0
PostRegistrationCP.jFormattedTextField1.text=jFormattedTextField1
SingleFaceTab.jButton2.text=jButton2
ProjectTopComp.addButton1.text=Add
ProjectTopComp.inflateButton1.text=Inflate
ProjectTopComp.deselectAllButton1.text=Deselect all
ProjectTopComp.selectAllButton1.text=Select all
ProjectTopComp.removeButton1.text=Remove
ProjectTopComp.jTable1.columnModel.title0=Title 1
ProjectTopComp.jTable1.columnModel.title3=Title 4
ProjectTopComp.jTable1.columnModel.title1=Title 2
ProjectTopComp.jTable1.columnModel.title0_1=Models
ProjectTopComp.jTable1.columnModel.title1_1=
ProjectTopComp.oneOnOneButton1.text=Open 1:1
ProjectTopComp.analyseButton1.text=Analyse
ProjectTopComp.oneOnOneButton1.text=Open 1:1
ProjectTopComp.inflateButton1.text=Inflate
ProjectTopComp.deselectAllButton1.text=Deselect all
ProjectTopComp.selectAllButton1.text=Select all
ProjectTopComp.removeButton1.text=Remove
ProjectTopComp.addButton1.text=Add
ProjectTopComp.jRadioButton1.text=mesh model registered
ProjectTopComp.jRadioButton2.text=has KD Tree calculated
ProjectTopComp.jRadioButton3.text=...
ProjectTopComp.jRadioButton4.text=...
ProjectTopComp.jLabel1.text=Face state
ProjectTopComp.jRadioButton5.text=...
ProjectTopComp.jLabel2.text=Filter
ProjectTopComp.jCheckBox1.text=which has kd-tree
ProjectTopComp.jLabel3.text=Average Hausdorff distance of selected faces : xx
ProjectTopComp.jCheckBox2.text=with feature points
ProjectTopComp.jCheckBox3.text=...
ProjectTopComp.jCheckBox4.text=registered
ProjectTopComp.jCheckBox5.text=...
ProjectTopComp.jCheckBox6.text=...
ProjectTopComp.jCheckBox7.text=...
ProjectTopComp.jButton1.text=Apply filters
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