import java.io.File;
import java.io.IOException;
import java.util.*;

        import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;

import org.eclipse.core.*;
import org.eclipse.core.commands.*;
import org.eclipse.equinox.*;
import org.eclipse.osgi.*;
import org.eclipse.draw2d.*;
import org.eclipse.nebula.visualization.xygraph.*;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import 
org.eclipse.nebula.visualization.xygraph.dataprovider.CircularBufferDataProvider;
import org.eclipse.nebula.visualization.xygraph.figures.*;
import org.eclipse.nebula.visualization.xygraph.figures.Trace.PointStyle;
import org.eclipse.nebula.visualization.xygraph.figures.Trace.TraceType;
import org.eclipse.nebula.visualization.xygraph.util.XYGraphMediaFactory;
        public class PlotKomp  // wird von Fileread.java aufgerufen
        {
               Scanner scanAusgabe;  // Um ausgabe.txt zu durchsuchen
public void drawGraph()
               {
                   File ausgabe = new File("D:\\ausgabe.txt");
                     int probenzahl =0;
                     //Scanner scanAusgabe;
//                   PlotKomp plotobj = new PlotKomp();
                     try{
                         scanAusgabe = new Scanner(ausgabe);
                         System.out.println(ausgabe);
}catch(IOException ausg) {System.out.println("ausgabe.txt nicht gefunden");}
                     // So und nun die Ausgabefile von calc_minerals auslesen 
und die quotientenWerte in arraylists abspeichern.
ArrayList <String> arrlistsio2 = new ArrayList<String>(); ArrayList <String> arrlistsio2xrd = new ArrayList<String>(); ArrayList <String> arrlistsio2rfa = new ArrayList<String>(); while(scanAusgabe.hasNextLine())
                     {
                            String lineliste = scanAusgabe.nextLine();
                            if(lineliste.startsWith("limsnr"))  // Fängt am 
Anfang von ausgabe.txt an, nur zum Zählen
                            {
probenzahl = probenzahl+1; } if(lineliste.contains("SiO2"))
                            {                           
String[] sio2arr = lineliste.split("\\s+"); arrlistsio2.add(sio2arr[4]); // Quotient
                                   arrlistsio2xrd.add(sio2arr[2]);  // XRD
                                   arrlistsio2rfa.add(sio2arr[3]);  // XRF
} } // Ende while(scanAusgabe.hasNextLine()) //----------------------------------------------------------------------------------------------------------------------------------- String[] arrsio2xrdstring = arrlistsio2xrd.toArray(new String[arrlistsio2xrd.size()]);
                      double[] arrsio2xrdend = new 
double[arrsio2xrdstring.length];
for(int g1= 0; g1 < arrsio2xrdend.length;g1++)
                  {
                          arrsio2xrdend[g1] = 
Double.parseDouble(arrsio2xrdstring[g1]);
                  }
                  String[] arrsio2rfastring = arrlistsio2rfa.toArray(new 
String[arrlistsio2rfa.size()]);
                  double[] arrsio2rfaend = new double[arrsio2rfastring.length];
for(int g1= 0; g1 < arrsio2rfaend.length;g1++)
                  {
                          arrsio2rfaend[g1] = 
Double.parseDouble(arrsio2rfastring[g1]);
                        //16.05.2016              System.out.println("im letzt sio2arr_xrf 
"+ arrsio2rfaend[g1]+"  indexxx "+g1);
                  }
        
//----------------------------------------------------------------------------------------------------------------------------------
                          Display display = Display.getDefault();
                  Shell shell = new Shell(display);
shell.setSize(600, 450);
                        shell.open();
                        // so verschiebt man am Ende den Plot
                        shell.setLocation(100, 100);
                     // Jetzt arraylists auslesen für die Graphik mit 
"essentials..."
                     LightweightSystem lwssio2 = new LightweightSystem(shell);
// create several new xy-graphs
                     XYGraph xysio2graph = new XYGraph();
xysio2graph.setTitle("SiO2");
                     // set it as content of LightWeightSystem
                     lwssio2.setContents(xysio2graph);
// Configure XYGraph
                     xysio2graph.primaryXAxis.setShowMajorGrid(true);
                     xysio2graph.primaryYAxis.setShowMajorGrid(true);
// Bezeichnung der Achsen
                     xysio2graph.primaryXAxis.setTitle("XRD-Value [%]");
                     xysio2graph.primaryYAxis.setTitle("XRF-Value [%]");
// Create a trace data provider, which will provide the data to the trace XRD and XRF CircularBufferDataProvider tdpsio2 = new CircularBufferDataProvider(false); tdpsio2.setBufferSize(200); tdpsio2.setCurrentXDataArray(arrsio2xrdend);
                     tdpsio2.setCurrentYDataArray(arrsio2rfaend);
                  // Create a trace data provider for the line
Trace tracesio2 = new Trace("SiO2-XY Plot", xysio2graph.primaryXAxis, xysio2graph.primaryYAxis, tdpsio2);
                     // set trace property (Messpunkte xrd - xrf)
tracesio2.setTraceType(TraceType.POINT);
                     tracesio2.setPointStyle(PointStyle.FILLED_DIAMOND);
                     tracesio2.setPointSize(10);
                     tracesio2.setAreaAlpha(250);
                     
tracesio2.setTraceColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_BLUE));
xysio2graph.addTrace(tracesio2); CircularBufferDataProvider tdpsio2line = new CircularBufferDataProvider(false); tdpsio2line.setBufferSize(200); tdpsio2line.setCurrentXDataArray(new double[]{0.0, 50.0, 100.0});
                     tdpsio2line.setCurrentYDataArray(new double[]{0.0, 50.0, 
100.0});
Trace tracesio2line = new Trace("SiO2-XY Plot", xysio2graph.primaryXAxis, xysio2graph.primaryYAxis, tdpsio2line); tracesio2line.setTraceType(TraceType.SOLID_LINE);
                     tracesio2line.setLineWidth(2);
                     
tracesio2line.setTraceColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_BLACK));
xysio2graph.addTrace(tracesio2line); while(!shell.isDisposed())
                                 {
                                         if(!display.readAndDispatch())
                                                 display.sleep();
                                 }
               }  // Ende Mehtode drawkomp

        public static void main(String[] args)
        {
                PlotKomp plotversuch = new PlotKomp();
                plotversuch.drawGraph();
        }

}


The file ausgabe.txt has got the following Formate:

imsnr    Komponente  XRD       XRF     Quotient  Kommentar

1504629 SiO2 53.18 50.17 1.05 1504629 TiO2 0.0 0.01 0.0 1504629 Al2O3 0.0 0.23 0.0 1504629 Fe2O3 38.21 38.32 0.99 1504629 MnO 0.0 0.06 0.0 1504629 MgO 0.0 2.63 0.0 no minerals for MgO 1504629 CaO 0.0 0.55 0.0 no minerals for CaO 1504629 Na2O 6.68 5.77 1.15 zu viel Na2O berechnet 1504629 K2O 0.0 0.06 0.0 1504629 P2O5 0.0 0.09 0.0 1504629 SO3 0.0 0.01 0.0 1504629 BaO 0.0 0.001 0.0
My Environment: PC hp, win 7, Java Version: 1.8.0_91, PC has got 64 bit 
operating System and processor: Intel(R) Core(TM) i5-4210 M
The program is developed on eclipse Luna

Does anyboy has any idea why this program does not run ?



To participate in the discussion, go here: 
https://www.eclipse.org/forums/index.php?t=rview&frm_id=64
_______________________________________________
nebula-dev mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/nebula-dev

Reply via email to