/* GeoGebra - Dynamic Mathematics for Everyone http://www.geogebra.org This file is part of GeoGebra. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. */ /* * GeoElement.java * * Created on 30. August 2001, 17:10 */ package org.geogebra.common.geogebra3D.kernel3D.geos; import org.geogebra.common.geogebra3D.euclidian3D.draw.Drawable3D; import org.geogebra.common.geogebra3D.kernel3D.Kernel3D; import org.geogebra.common.kernel.Construction; import org.geogebra.common.kernel.Matrix.Coords; import org.geogebra.common.kernel.geos.GeoElement; import org.geogebra.common.kernel.geos.Test; /** * Class for describing GeoElement in 3D version. * * <p> * * <h3>How to create a new Element</h3> * <p> * * We'll call here our new element "GeoNew3D" * * <p> * * <b> In GeoElement3D (this class), create an new constant to identify GeoNew3D * </b> * <p> * <code> public static final int GEO_CLASS_NEW3D = 30??; </code> * <p> * * <b> Create an new class GeoNew3D </b> * <ul> * <li>It will eventually extend another class (at least GeoElement3D) : * <p> * <code> final public class GeoNew3D extends ??? { </code></li> * <li>Eclipse will add auto-generated methods ; modify it : * <p> * <code> public GeoElement copy() { return null; } <br> public int getGeoClassType() { return GEO_CLASS_NEW3D; } <br> protected String getTypeString() { return "New3D"; } <br> public boolean isDefined() { return true; } <br> public boolean isEqual(GeoElementND Geo) { return false; } <br> public void set(GeoElement geo) { } <br> public void setUndefined() { } <br> protected boolean showInAlgebraView() { return true; } <br> protected boolean showInEuclidianView() { return true; } <br> public String toValueString() { return "todo"; } <br> protected String getClassName() { return "GeoNew3D"; } </code></li> * <li>Create a constructor * <p> * <code> public GeoNew3D(Construction c, ?? args) { <br>    super(c); // eventually + args <br>    + stuff <br> } </code></li> * </ul> * * <h3>See</h3> * <ul> * <li>{@link Drawable3D} to create a drawable linked to this new element.</li> * <li>{@link Kernel3D} to add a method to create this new element</li> * <li> * {@link Test} Kernel3D, geogebra.euclidian.EuclidianView, * geogebra3D.euclidian3D.EuclidianView3D, geogebra3D.Application3D)} to test it * </li> * </ul> * * * * * @author ggb3D * */ public abstract class GeoElement3D extends GeoElement { /********************************************************/ /** * Creates new GeoElement for given construction * * @param c * construction */ public GeoElement3D(Construction c) { super(c); } /** * it's a 3D GeoElement. * * @return true */ @Override public boolean isGeoElement3D() { return true; } @Override public boolean hasFillType() { return false; } @Override abstract public Coords getLabelPosition(); /** * set the alpha value to alpha for openGL * * @param alpha * alpha value */ @Override public void setAlphaValue(double alpha) { if (alpha < 0.0 || alpha > 1.0) { return; } alphaValue = alpha; } // ////////////////////////// // for toString() private StringBuilder sbToString; /** * @return builder for toString */ protected StringBuilder getSbToString() { if (sbToString == null) { sbToString = new StringBuilder(50); } return sbToString; } private StringBuilder sbBuildValueString = new StringBuilder(50); /** * @return builder for toValueString */ protected StringBuilder getSbBuildValueString() { if (sbBuildValueString == null) { sbBuildValueString = new StringBuilder(); } else { sbBuildValueString.setLength(0); } return sbBuildValueString; } }