/*
______________________________________________________________________
*
* 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: Edit3dPoint.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.JCActionTable;
import com.klg.jclass.chart3d.JCChart3d;
import com.klg.jclass.chart3d.data.JCEditable3dPointDataSource;
import com.klg.jclass.util.swing.JCExitFrame;
import examples.chart3d.j3d.BaseExample;

import javax.vecmath.Point3d;

/**
 * This class demonstrates the JCEditable3dPointDataSource
 */
public class Edit3dPoint extends BaseExample {

protected JCEditable3dPointDataSource ds;

public Edit3dPoint()
{
    this("Editable Point Datasource");
}

public Edit3dPoint(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");
    }
    if (getChart3d() != null) {
        JCActionTable at = getChart3d().getActionTable();
        at.addAction(at.DEFAULT_MOUSE_EDIT_ACTION,
                     at.getDefaultEditActionClass());
    }
}

public void initData()
{
    ds = new JCEditable3dPointDataSource();
    ds.setDataSourceName("My Point Chart");

    // Create some 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)
{
    Edit3dPoint example = null;
    example = new Edit3dPoint();
    final JCExitFrame frame = new JCExitFrame(example.getTitle());
    frame.getContentPane().add(example);

    frame.pack();
    frame.show();
    example.updateChart3d();
}

}




