Skip to content

Commit

Permalink
+Added debug mode flag (#5) to get output when selecting nodes and re…
Browse files Browse the repository at this point in the history
…move the output, when its not needed anymore

+Added a method to the geometry2D class to get a string representation of all 3D points for debug mode

-Deleted old .ugx files
  • Loading branch information
esontak committed Apr 20, 2015
1 parent baeea41 commit ed7948e
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 141 deletions.
Binary file modified .gradle/2.0/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified .gradle/2.0/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/2.0/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/2.0/taskArtifacts/taskArtifacts.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions src/main/java/edu/gcsc/jfx3d/Geometry2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
package edu.gcsc.jfx3d;

import java.util.ArrayList;

/**
*
* @author Eugen
Expand All @@ -18,6 +20,7 @@ public abstract class Geometry2D {
public abstract void setNodes(int[] array);
public abstract int[] getFacesArray();
public abstract int getIndex();
public abstract String getCoordinatesOfPoints(ArrayList listOfAllVertices);



Expand Down
1 change: 1 addition & 0 deletions src/main/java/edu/gcsc/jfx3d/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public Group createContent() {
ugxr.setFlagHighResolution(true);
ugxr.setFlagDoubleFacesOnEdges(true);
ugxr.setFlagRenderFaces(true);
ugxr.setFlagDebugMode(true);
ugxGeometry = ugxr.xbuildUGX();
subsetNameArray = ugxr.getSubssetNameArray();

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/edu/gcsc/jfx3d/Quadrilateral.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
package edu.gcsc.jfx3d;

import java.util.ArrayList;

/**
*
* @author Eugen
Expand Down Expand Up @@ -43,5 +45,12 @@ public int[] getFacesArray() {
return arr;
}

public String getCoordinatesOfPoints(ArrayList listOfAllVertices) {
return ("2D Object : " + this.index + " (Part of a quadrilateral)\n"+
"Vertex 1: " + listOfAllVertices.get(nodes[0]*3) + " " +listOfAllVertices.get(nodes[0]*3+1) + " " + listOfAllVertices.get(nodes[0]*3+2) + "\n" +
"Vertex 2: " + listOfAllVertices.get(nodes[1]*3) + " " +listOfAllVertices.get(nodes[1]*3+1) + " " + listOfAllVertices.get(nodes[1]*3+2) + "\n" +
"Vertex 3: " + listOfAllVertices.get(nodes[2]*3) + " " +listOfAllVertices.get(nodes[2]*3+1) + " " + listOfAllVertices.get(nodes[2]*3+2) + "\n" +
"Vertex 4: " + listOfAllVertices.get(nodes[3]*3) + " " +listOfAllVertices.get(nodes[3]*3+1) + " " + listOfAllVertices.get(nodes[3]*3+2) );
}

}
10 changes: 10 additions & 0 deletions src/main/java/edu/gcsc/jfx3d/Triangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
package edu.gcsc.jfx3d;

import java.util.ArrayList;

/**
*
* @author Eugen
Expand Down Expand Up @@ -41,5 +43,13 @@ public int[] getFacesArray() {
int[] arr = {this.nodes[0],0,this.nodes[1],0,this.nodes[2],0};
return arr;
}

@Override
public String getCoordinatesOfPoints(ArrayList listOfAllVertices) {
return ("2D Object : " + this.index + "\n"+
"Vertex 1: " + listOfAllVertices.get(nodes[0]*3) + " " +listOfAllVertices.get(nodes[0]*3+1) + " " + listOfAllVertices.get(nodes[0]*3+2) + "\n" +
"Vertex 2: " + listOfAllVertices.get(nodes[1]*3) + " " +listOfAllVertices.get(nodes[1]*3+1) + " " + listOfAllVertices.get(nodes[1]*3+2) + "\n" +
"Vertex 3: " + listOfAllVertices.get(nodes[2]*3) + " " +listOfAllVertices.get(nodes[2]*3+1) + " " + listOfAllVertices.get(nodes[2]*3+2) + "\n" );
}

}
49 changes: 31 additions & 18 deletions src/main/java/edu/gcsc/jfx3d/UGXReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ public Group xbuildUGX (){
faceMeshViewArray[j].setCullFace(CullFace.NONE);

}
System.out.println("--");
for (int j = triangleMeshList.size(), k = 0; k < quadriMeshList.size(); j++,k++) {
faceMeshViewArray[j] = quadriMeshList.get(k);
faceMeshViewArray[j].setMaterial(faceMat);
Expand Down Expand Up @@ -894,7 +893,9 @@ private void addFaceInteraction(Group faceMeshView) {
Node pickedNode = mouseClick.getPickResult().getIntersectedNode();
PickResult res = mouseClick.getPickResult();

System.out.println(newFaceMap.get(pickedNode));
if (debugMode) {
System.out.println(newFaceMap.get(pickedNode));
}
handleSelection(faceNodeSelection, faceNodeSelectionMaterial, pickedNode, new MeshView());
}

Expand All @@ -911,8 +912,10 @@ private void addVolumeInteraction(MeshView faceMeshView) {
Node pickedNode = mouseClick.getPickResult().getIntersectedNode();
PickResult res = mouseClick.getPickResult();

System.out.println("Selected node is a volume!");
System.out.println(newFaceMap.get(pickedNode));
if (debugMode) {
System.out.println("Selected node is a volume!");
System.out.println(newFaceMap.get(pickedNode));
}
handleSelection(faceNodeSelection, faceNodeSelectionMaterial, pickedNode, new MeshView());
}

Expand All @@ -927,8 +930,10 @@ private void addLowResolutionInteraction(Shape3D shape){
if (mouseClick.getButton().toString().matches("SECONDARY")) {

Node pickedNode = mouseClick.getPickResult().getIntersectedNode();
PickResult res = mouseClick.getPickResult();
System.out.println(pickedNode);

if (debugMode) {
System.out.println(pickedNode);
}

//handleSelection(subsetNodeSelection, subsetNodeSelectionMaterial, pickedNode, new MeshView());
handleLowResolutionSelection(pickedNode);
Expand Down Expand Up @@ -991,11 +996,13 @@ private void handleLowResolutionSelection(Node pickResult){

}
}
System.out.print("\nClicked Subset: ");
System.out.println(subsetMapMeshToSubset.get(pickResult).getSubsetName());
UGXsubset testss = subsetMapMeshToSubset.get(pickResult);

System.out.println("Selected subset is split in the following MeshViews " +subsetMapSubsetToMesh.get(testss));
if (debugMode) {
System.out.print("\nClicked Subset: ");
System.out.println(subsetMapMeshToSubset.get(pickResult).getSubsetName());
UGXsubset testss = subsetMapMeshToSubset.get(pickResult);

System.out.println("Selected subset is split in the following MeshViews " + subsetMapSubsetToMesh.get(testss));
}
}

private void handleSelection(ArrayList<Node> nodeList, ArrayList<Material> materialList, Node pickResult, Shape3D geometryType) {
Expand Down Expand Up @@ -1075,21 +1082,23 @@ private void handleSelection(ArrayList<Node> nodeList, ArrayList<Material> mater
}

}
System.out.println("Elements in selection :");
if (debugMode) {
System.out.println("Elements in selection :");
for (int i = 0; i < nodeList.size(); i++) {
System.out.print(nodeList.get(i) + " ");
System.out.println(nodeList.get(i) + " ");

if (vertexMap.containsKey(pickResult)) {
if (vertexMap.containsKey(pickResult)) {
float[] resultV = vertexMap.get(vertexNodeSelection.get(i));
System.out.println(resultV[0] + " " + resultV[1] + " " + resultV[2]);
} else if (edgesMap.containsKey(pickResult)) {
System.out.println(edgesMap.get(edgeNodeSelection.get(i)).toString());
}else if (faceMapMesh.containsKey(pickResult)){
System.out.println(faceMapMesh.get(faceNodeSelection.get(i)).toString());
} else if (newFaceMap.containsKey(pickResult)) {
System.out.println(newFaceMap.get(faceNodeSelection.get(i)).getCoordinatesOfPoints(globalVertexList));
}
}
System.out.println("All selected nodes: " + vertexNodeSelection.size() + " vertices. "
+ edgeNodeSelection.size() + " edges. " + faceNodeSelection.size() + " faces." );
System.out.println("\nAll selected nodes: " + vertexNodeSelection.size() + " vertices. "
+ edgeNodeSelection.size() + " edges. " + faceNodeSelection.size() + " faces.");
}

}

Expand Down Expand Up @@ -1172,4 +1181,8 @@ public void setFlagRenderFaces(boolean rfaces){
renderFaces = rfaces;
}

public void setFlagDebugMode(boolean debug){
debugMode = debug;
}

}
23 changes: 0 additions & 23 deletions src/main/java/edu/gcsc/jfx3d/ugx/hexahedron.ugx

This file was deleted.

38 changes: 38 additions & 0 deletions src/main/java/edu/gcsc/jfx3d/ugx/lowResSubsetTest.ugx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<grid name="defGrid">
<vertices coords="3">2 2 -1 4 2 -1 4 4 -1 2 4 -1 2 2 1 4 2 1 4 4 1 2 4 1 -4 -4 -1 -2 -4 -1 -2 -2 -1 -4 -2 -1 -4 -4 1 -2 -4 1 -2 -2 1 -4 -2 1 2 -4 -1 4 -4 -1 4 -2 -1 2 -2 -1 2 -4 1 4 -4 1 4 -2 1 2 -2 1 -4 2 -1 -2 2 -1 -2 4 -1 -4 4 -1 -4 2 1 -2 2 1 -2 4 1 -4 4 1</vertices>
<edges>0 3 3 2 2 1 1 0 1 5 5 4 4 0 2 6 6 5 3 7 7 6 4 7 8 11 11 10 10 9 9 8 9 13 13 12 12 8 10 14 14 13 11 15 15 14 12 15 16 19 19 18 18 17 17 16 17 21 21 20 20 16 18 22 22 21 19 23 23 22 20 23 24 27 27 26 26 25 25 24 25 29 29 28 28 24 26 30 30 29 27 31 31 30 28 31</edges>
<quadrilaterals>0 3 2 1 0 1 5 4 1 2 6 5 2 3 7 6 3 0 4 7 4 5 6 7 8 11 10 9 8 9 13 12 9 10 14 13 10 11 15 14 11 8 12 15 12 13 14 15 16 19 18 17 16 17 21 20 17 18 22 21 18 19 23 22 19 16 20 23 20 21 22 23 24 27 26 25 24 25 29 28 25 26 30 29 26 27 31 30 27 24 28 31 28 29 30 31</quadrilaterals>
<subset_handler name="defSH">
<subset name="0" color="0.588235 0.588235 1 1" state="262144">
<vertices>24 25 26 27 28 29 30 31</vertices>
<edges>36 37 38 39 40 41 42 43 44 45 46 47</edges>
<faces>18 19 20 21 22 23</faces>
</subset>
<subset name="1" color="1 0 0 1" state="262144">
<vertices>0 1 2 3 4 5 6 7</vertices>
<edges>0 1 2 3 4 5 6 7 8 9 10 11</edges>
<faces>0 1 2 3 4 5</faces>
</subset>
<subset name="2" color="0 1 0 1" state="262144">
<vertices>8 9 10 11 12 13 14 15</vertices>
<edges>12 13 14 15 16 17 18 19 20 21 22 23</edges>
<faces>6 7 8 9 10 11</faces>
</subset>
<subset name="3" color="0 0 1 1" state="262144">
<vertices>16 17 18 19 20 21 22 23</vertices>
<edges>24 25 26 27 28 29 30 31 32 33 34 35</edges>
<faces>12 13 14 15 16 17</faces>
</subset>
</subset_handler>
<subset_handler name="markSH">
<subset name="crease" color="1 1 1 1" state="0"/>
<subset name="fixed" color="1 1 1 1" state="0"/>
</subset_handler>
<selector name="defSel">
<vertices>24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1</vertices>
<edges>36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1</edges>
<faces>18 1 19 1 20 1 21 1 22 1 23 1</faces>
</selector>
</grid>

24 changes: 0 additions & 24 deletions src/main/java/edu/gcsc/jfx3d/ugx/prism.ugx

This file was deleted.

24 changes: 0 additions & 24 deletions src/main/java/edu/gcsc/jfx3d/ugx/pyramid.ugx

This file was deleted.

24 changes: 0 additions & 24 deletions src/main/java/edu/gcsc/jfx3d/ugx/testobject - Kopie.ugx

This file was deleted.

28 changes: 0 additions & 28 deletions src/main/java/edu/gcsc/jfx3d/ugx/tetrah.ugx

This file was deleted.

0 comments on commit ed7948e

Please sign in to comment.