1 /*
  2     Copyright 2008-2023
  3         Matthias Ehmann,
  4         Carsten Miller,
  5         Andreas Walter,
  6         Alfred Wassermann
  7 
  8     This file is part of JSXGraph.
  9 
 10     JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
 11 
 12     You can redistribute it and/or modify it under the terms of the
 13 
 14       * GNU Lesser General Public License as published by
 15         the Free Software Foundation, either version 3 of the License, or
 16         (at your option) any later version
 17       OR
 18       * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
 19 
 20     JSXGraph is distributed in the hope that it will be useful,
 21     but WITHOUT ANY WARRANTY; without even the implied warranty of
 22     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 23     GNU Lesser General Public License for more details.
 24 
 25     You should have received a copy of the GNU Lesser General Public License and
 26     the MIT License along with JSXGraph. If not, see <https://www.gnu.org/licenses/>
 27     and <https://opensource.org/licenses/MIT/>.
 28  */
 29 /*global JXG:true, define: true*/
 30 
 31 import JXG from "../jxg";
 32 
 33 /**
 34  * Constructs a new GeometryElement3D object.
 35  * @class This is the basic class for 3D geometry elements like Point3D and Line3D.
 36  * @constructor
 37  * @param {string} elType
 38  * @borrows JXG.EventEmitter#on as this.on
 39  * @borrows JXG.EventEmitter#off as this.off
 40  * @borrows JXG.EventEmitter#triggerEventHandlers as this.triggerEventHandlers
 41  * @borrows JXG.EventEmitter#eventHandlers as this.eventHandlers
 42  */
 43 JXG.GeometryElement3D = function (view, elType) {
 44     this.elType = elType;
 45     this.id = this.board.setId(this, elType);
 46 
 47     /**
 48      * Pointer to the view3D in which the elemtn is constructed
 49      * @type JXG.View3D
 50      * @private
 51      */
 52     this.view = view;
 53 
 54     /**
 55      * Link to the 2D element(s) used to visualize the 3D element
 56      * in a view. In case, there are several 2D elements, it is an array.
 57      *
 58      * @type JXG.GeometryElement,Array
 59      * @private
 60      *
 61      * @example
 62      *   p.element2D;
 63      */
 64     this.element2D = null;
 65 
 66     /**
 67      * If this property exists (and is true) the element is a 3D element.
 68      *
 69      * @type Boolean
 70      * @private
 71      */
 72     this.is3D = true;
 73     this.view.objects[this.id] = this;
 74     this.view.objectsList.push(this);
 75 
 76     if (this.name !== "") {
 77         this.view.elementsByName[this.name] = this;
 78     }
 79 };
 80 
 81 export default JXG.GeometryElement3D;
 82