diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..37d644ec --- /dev/null +++ b/.classpath @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 00000000..8f5f53d8 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + eng2 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/graphics/3d_render.png b/graphics/3d_render.png new file mode 100644 index 00000000..cc88bbc6 Binary files /dev/null and b/graphics/3d_render.png differ diff --git a/lib/Graph3d/linux/Graph3d.jar b/lib/Graph3d/linux/Graph3d.jar new file mode 100644 index 00000000..c107adac Binary files /dev/null and b/lib/Graph3d/linux/Graph3d.jar differ diff --git a/lib/Graph3d/linux/lib/j3dcore.jar b/lib/Graph3d/linux/lib/j3dcore.jar new file mode 100644 index 00000000..08eae2b7 Binary files /dev/null and b/lib/Graph3d/linux/lib/j3dcore.jar differ diff --git a/lib/Graph3d/linux/lib/j3dutils.jar b/lib/Graph3d/linux/lib/j3dutils.jar new file mode 100644 index 00000000..05546020 Binary files /dev/null and b/lib/Graph3d/linux/lib/j3dutils.jar differ diff --git a/lib/Graph3d/linux/lib/libj3dcore-ogl-cg.so b/lib/Graph3d/linux/lib/libj3dcore-ogl-cg.so new file mode 100644 index 00000000..c27b3a9b Binary files /dev/null and b/lib/Graph3d/linux/lib/libj3dcore-ogl-cg.so differ diff --git a/lib/Graph3d/linux/lib/libj3dcore-ogl.so b/lib/Graph3d/linux/lib/libj3dcore-ogl.so new file mode 100644 index 00000000..7447aa9b Binary files /dev/null and b/lib/Graph3d/linux/lib/libj3dcore-ogl.so differ diff --git a/lib/Graph3d/linux/lib/vecmath.jar b/lib/Graph3d/linux/lib/vecmath.jar new file mode 100644 index 00000000..d9b945d3 Binary files /dev/null and b/lib/Graph3d/linux/lib/vecmath.jar differ diff --git a/lib/Graph3d/windows/Graph3d.jar b/lib/Graph3d/windows/Graph3d.jar new file mode 100644 index 00000000..8a0373af Binary files /dev/null and b/lib/Graph3d/windows/Graph3d.jar differ diff --git a/lib/Graph3d/windows/lib/j3dcore-d3d.dll b/lib/Graph3d/windows/lib/j3dcore-d3d.dll new file mode 100644 index 00000000..6731fe02 Binary files /dev/null and b/lib/Graph3d/windows/lib/j3dcore-d3d.dll differ diff --git a/lib/Graph3d/windows/lib/j3dcore-ogl-cg.dll b/lib/Graph3d/windows/lib/j3dcore-ogl-cg.dll new file mode 100644 index 00000000..51fbcacd Binary files /dev/null and b/lib/Graph3d/windows/lib/j3dcore-ogl-cg.dll differ diff --git a/lib/Graph3d/windows/lib/j3dcore-ogl.dll b/lib/Graph3d/windows/lib/j3dcore-ogl.dll new file mode 100644 index 00000000..1ba29df1 Binary files /dev/null and b/lib/Graph3d/windows/lib/j3dcore-ogl.dll differ diff --git a/lib/Graph3d/windows/lib/j3dcore.jar b/lib/Graph3d/windows/lib/j3dcore.jar new file mode 100644 index 00000000..572f6aba Binary files /dev/null and b/lib/Graph3d/windows/lib/j3dcore.jar differ diff --git a/lib/Graph3d/windows/lib/j3dutils.dll b/lib/Graph3d/windows/lib/j3dutils.dll new file mode 100644 index 00000000..56974ab0 Binary files /dev/null and b/lib/Graph3d/windows/lib/j3dutils.dll differ diff --git a/lib/Graph3d/windows/lib/j3dutils.jar b/lib/Graph3d/windows/lib/j3dutils.jar new file mode 100644 index 00000000..5004dcea Binary files /dev/null and b/lib/Graph3d/windows/lib/j3dutils.jar differ diff --git a/lib/Graph3d/windows/lib/vecmath.jar b/lib/Graph3d/windows/lib/vecmath.jar new file mode 100644 index 00000000..053e113d Binary files /dev/null and b/lib/Graph3d/windows/lib/vecmath.jar differ diff --git a/src/enginuity/maps/DataCell.java b/src/enginuity/maps/DataCell.java index 7854526e..a01175b1 100644 --- a/src/enginuity/maps/DataCell.java +++ b/src/enginuity/maps/DataCell.java @@ -300,4 +300,12 @@ public class DataCell extends JLabel implements MouseListener, Serializable { public void multiply(double factor) { setRealValue(Double.parseDouble(getText()) * factor+""); } + + /** + * Used by 3d graph renderer. + * @return + */ + public double getValue() { + return calcDisplayValue(binValue, table.getScale().getExpression()); + } } \ No newline at end of file diff --git a/src/enginuity/maps/Table3D.java b/src/enginuity/maps/Table3D.java index 217086e7..8c8d0b54 100644 --- a/src/enginuity/maps/Table3D.java +++ b/src/enginuity/maps/Table3D.java @@ -846,4 +846,8 @@ public class Table3D extends Table { xAxis.setScaleByName(getScale().getName()); yAxis.setScaleByName(getScale().getName()); } + + public DataCell[][] get3dData(){ + return data; + } } \ No newline at end of file diff --git a/src/enginuity/swing/TableToolBar.java b/src/enginuity/swing/TableToolBar.java index d94e804c..24411228 100644 --- a/src/enginuity/swing/TableToolBar.java +++ b/src/enginuity/swing/TableToolBar.java @@ -1,7 +1,10 @@ package enginuity.swing; +import enginuity.maps.DataCell; import enginuity.maps.Scale; import enginuity.maps.Table; +import enginuity.maps.Table3D; + import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -11,6 +14,7 @@ import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.ParseException; import java.util.Vector; @@ -27,12 +31,16 @@ import javax.swing.JToolBar; import javax.swing.KeyStroke; import javax.swing.border.LineBorder; +import com.ecm.graphics.Graph3d; + public class TableToolBar extends JToolBar implements MouseListener, ItemListener { private JButton incrementFine = new JButton(new ImageIcon("./graphics/icon-incfine.png")); private JButton decrementFine = new JButton(new ImageIcon("./graphics/icon-decfine.png")); private JButton incrementCoarse = new JButton(new ImageIcon("./graphics/icon-inccoarse.png")); - private JButton decrementCoarse = new JButton(new ImageIcon("./graphics/icon-deccoarse.png")); + private JButton decrementCoarse = new JButton(new ImageIcon("./graphics/icon-deccoarse.png")); + private JButton enable3d = new JButton(new ImageIcon("./graphics/3d_render.png")); + private JButton setValue = new JButton("Set"); private JButton multiply = new JButton("Mul"); @@ -55,6 +63,7 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene this.add(new JLabel(" ")); this.add(incrementCoarse); this.add(decrementCoarse); + this.add(new JLabel(" ")); this.add(incrementByCoarse); this.add(new JLabel(" ")); @@ -62,6 +71,13 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene this.add(new JLabel(" ")); this.add(setValue); this.add(multiply); + this.add(new JLabel(" ")); + + //Only add the 3d button if table includes 3d data + if(table.getType() == Table.TABLE_3D){ + this.add(enable3d); + } + this.add(new JLabel(" ")); //this.add(scaleSelection); @@ -73,6 +89,8 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene incrementCoarse.setBorder(new LineBorder(new Color(150,150,150), 1)); decrementCoarse.setMaximumSize(new Dimension(33,33)); decrementCoarse.setBorder(new LineBorder(new Color(150,150,150), 1)); + enable3d.setMaximumSize(new Dimension(33,33)); + enable3d.setBorder(new LineBorder(new Color(150,150,150), 1)); setValue.setMaximumSize(new Dimension(33,23)); setValue.setBorder(new LineBorder(new Color(150,150,150), 1)); multiply.setMaximumSize(new Dimension(33,23)); @@ -94,6 +112,7 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene decrementFine.setToolTipText("Decrement Value (Fine)"); incrementCoarse.setToolTipText("Increment Value (Coarse)"); decrementCoarse.setToolTipText("Decrement Value (Coarse)"); + enable3d.setToolTipText("Render data in 3d"); setValue.setToolTipText("Set Absolute Value"); setValueText.setToolTipText("Set Absolute Value"); incrementByFine.setToolTipText("Fine Value Adjustment"); @@ -104,6 +123,7 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene decrementFine.addMouseListener(this); incrementCoarse.addMouseListener(this); decrementCoarse.addMouseListener(this); + enable3d.addMouseListener(this); setValue.addMouseListener(this); multiply.addMouseListener(this); scaleSelection.addItemListener(this); @@ -164,6 +184,7 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene public void mouseClicked(MouseEvent e) { if (e.getSource() == incrementCoarse) incrementCoarse(); else if (e.getSource() == decrementCoarse) decrementCoarse(); + else if (e.getSource() == enable3d) enable3d(); else if (e.getSource() == incrementFine) incrementFine(); else if (e.getSource() == decrementFine) decrementFine(); else if (e.getSource() == multiply) multiply(); @@ -194,6 +215,45 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene public void decrementCoarse() { table.increment(0 - Double.parseDouble(incrementByCoarse.getValue()+"")); + } + + public void enable3d() { + System.out.println("Toggle 3d"); + int rowCount = 0; + int valueCount = 0; + + //Pull data into format 3d graph understands + Vector graphValues = new Vector(); + if(table.getType() == Table.TABLE_3D){ + Table3D table3d = (Table3D)table; + DataCell[][] tableData = table3d.get3dData(); + valueCount = tableData.length; + DataCell[] dataRow = tableData[0]; + rowCount = dataRow.length; + + for(int j = (rowCount-1); j >= 0; j-- ){ + float[] rowValues = new float[valueCount]; + for(int i = 0; i < valueCount; i++){ + DataCell theCell = tableData[i][j]; + float theValue = (float)theCell.getValue(); + BigDecimal finalRoundedValue = new BigDecimal(theValue).setScale(2,BigDecimal.ROUND_HALF_UP); + rowValues[i] = finalRoundedValue.floatValue(); + } + graphValues.add(rowValues); + } + + int[] testX = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000 }; + int[] testZ = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 , 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}; + + + + Graph3d graph3d = new Graph3d(graphValues, testX, testZ, "X Label", "Graph Title", "Z Label"); + graph3d.theFrame.setVisible(true); + } + + + + } public void setCoarseValue(double input) {