/*
______________________________________________________________________
*
* Copyright (c) 1996-2004, QUEST SOFTWARE INC. All Rights Reserved.
* http://java.quest.com
*
* This file is provided for demonstration and educational uses only.
* Permission to use, copy, modify and distribute this file for
* any purpose and without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies, and that the name of Quest Software not be used in advertising
* or publicity pertaining to this material without the specific,
* prior written permission of an authorized representative of
* Quest Software.
*
* QUEST SOFTWARE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
* OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. QUEST SOFTWARE SHALL NOT BE LIABLE FOR ANY
* DAMAGES SUFFERED BY USERS AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
* ______________________________________________________________________
*/

//   RCSID -- $RCSfile: Default3dPoint.java,v $ $Revision: 1.1.1.1 $
//            $Date: 2006-03-09 22:09:06 $  $Locker:  $  Quest Software Inc.

package examples.chart3d.j3d.data;

import com.klg.jclass.chart3d.JCChart3d;
import com.klg.jclass.chart3d.data.JCDefault3dPointDataSource;
import com.klg.jclass.util.swing.JCExitFrame;
import examples.chart3d.j3d.BaseExample;

import javax.vecmath.Point3d;

/**
 * This class demonstrates the JCDefault3dPointDataSource
 */
public class Default3dPoint extends BaseExample {

public Default3dPoint()
{
    this("Default Point Datasource");
}

public Default3dPoint(String title)
{
    super(title);
}

public void init()
{
    try {
        init(JCChart3d.SCATTER);
    }
    catch (InstantiationException e) {
        showErrorMessage(e.toString(),
                         "JClass Chart3D could not be instantiated",
                         "JClass Chart3D Error");
    }
}

public void initData()
{
    JCDefault3dPointDataSource ds = new JCDefault3dPointDataSource();
    ds.setDataSourceName("My Point Chart");

    // Create some point data
    Point3d[][] points = new Point3d[3][5];
    for (int i = 0; i < points.length; i++) {
        for (int j = 0; j < 5; j++) {
            Point3d p = new Point3d((double)i+1, (double)j+1, (double)i+j+1);
            points[i][j] = p;
        }
    }
    ds.setPoints(points);

    String[] seriesLabels = {"Series 1", "Series 2", "Series 3"};
    ds.setSeriesLabels(seriesLabels);

    getDataView().setElevationDataSource(ds);
}

public static void main(String[] args)
{
    Default3dPoint example = null;
    example = new Default3dPoint();
    final JCExitFrame frame = new JCExitFrame(example.getTitle());
    frame.getContentPane().add(example);

    frame.pack();
    frame.show();
    example.updateChart3d();
}

}
