      1 /*
      2     Copyright 2008-2025
      3         Matthias Ehmann,
      4         Michael Gerhaeuser,
      5         Carsten Miller,
      6         Bianca Valentin,
      7         Alfred Wassermann,
      8         Peter Wilfahrt
      9
     10     This file is part of JSXGraph.
     11
     12     JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
     13
     14     You can redistribute it and/or modify it under the terms of the
     15
     16       * GNU Lesser General Public License as published by
     17         the Free Software Foundation, either version 3 of the License, or
     18         (at your option) any later version
     19       OR
     20       * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
     21
     22     JSXGraph is distributed in the hope that it will be useful,
     23     but WITHOUT ANY WARRANTY; without even the implied warranty of
     24     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     25     GNU Lesser General Public License for more details.
     26
     27     You should have received a copy of the GNU Lesser General Public License and
     28     the MIT License along with JSXGraph. If not, see <https://www.gnu.org/licenses/>
     29     and <https://opensource.org/licenses/MIT/>.
     30  */
     31
     32 /*global JXG: true, define: true, AMprocessNode: true, MathJax: true, document: true */
     33 /*jslint nomen: true, plusplus: true, newcap:true, unparam: true*/
     34 /*eslint no-unused-vars: "off"*/
     35
     36 /**
     37  * @fileoverview JSXGraph can use various technologies to render the contents of a construction, e.g.
     38  * SVG, VML, and HTML5 Canvas. To accomplish this, The rendering and the logic and control mechanisms
     39  * are completely separated from each other. Every rendering technology has it's own class, called
     40  * Renderer, e.g. SVGRenderer for SVG, the same for VML and Canvas. The common base for all available
     41  * renderers is the class AbstractRenderer.
     42  */
     43
     44 import JXG from "../jxg.js";
     45 import AbstractRenderer from "./abstract.js";
     46
     47 /**
     48  * This renderer draws nothing. It is intended to be used in environments where none of our rendering engines
     49  * are available, e.g. WebWorkers. All methods are empty.
     50  *
     51  * @class JXG.NoRenderer
     52  * @augments JXG.AbstractRenderer
     53  * @see JXG.AbstractRenderer
     54  */
     55 JXG.NoRenderer = function () {
     56     /**
     57      * If this property is set to <tt>true</tt> the visual properties of the elements are updated
     58      * on every update. Visual properties means: All the stuff stored in the
     59      * {@link JXG.GeometryElement#visProp} property won't be set if enhancedRendering is <tt>false</tt>
     60      * @type Boolean
     61      * @default true
     62      */
     63     this.enhancedRendering = false;
     64
     65     /**
     66      * This is used to easily determine which renderer we are using
     67      * @example if (board.renderer.type === 'vml') {
     68      *     // do something
     69      * }
     70      * @type String
     71      */
     72     this.type = "no";
     73 };
     74
     75 JXG.extend(
     76     JXG.NoRenderer.prototype,
     77     /** @lends JXG.NoRenderer.prototype */ {
     78
     79         // All methods are already documented in JXG.AbstractRenderer
     80
     81         /* ********* Point related stuff *********** */
     82
     83         drawPoint: function (el) {},
     84
     85         updatePoint: function (el) {},
     86
     87         changePointStyle: function (el) {},
     88
     89         /* ********* Line related stuff *********** */
     90
     91         drawLine: function (el) {},
     92
     93         updateLine: function (el) {},
     94
     95         drawTicks: function (el) {},
     96
     97         updateTicks: function (el) {},
     98
     99         /* ********* Curve related stuff *********** */
    100
    101         drawCurve: function (el) {},
    102
    103         updateCurve: function (el) {},
    104
    105         /* ********* Circle related stuff *********** */
    106
    107         drawEllipse: function (el) {},
    108
    109         updateEllipse: function (el) {},
    110
    111         /* ********* Polygon related stuff *********** */
    112
    113         drawPolygon: function (el) {},
    114
    115         updatePolygon: function (el) {},
    116
    117         /* ********* Text related stuff *********** */
    118
    119         displayCopyright: function (str, fontsize) {},
    120
    121         drawInternalText: function (el) {},
    122
    123         updateInternalText: function (el) {},
    124
    125         drawText: function (el) {},
    126
    127         updateText: function (el) {},
    128
    129         updateTextStyle: function (el, doHighlight) {},
    130
    131         updateInternalTextStyle: function (el, strokeColor, strokeOpacity) {},
    132
    133         /* ********* Image related stuff *********** */
    134
    135         drawImage: function (el) {},
    136
    137         updateImage: function (el) {},
    138
    139         updateImageURL: function (el) {},
    140
    141         /* ********* Render primitive objects *********** */
    142
    143         appendChildPrim: function (node, level) {},
    144
    145         appendNodesToElement: function (el, type) {},
    146
    147         remove: function (node) {},
    148
    149         makeArrows: function (el) {},
    150
    151         updateEllipsePrim: function (node, x, y, rx, ry) {},
    152
    153         updateLinePrim: function (node, p1x, p1y, p2x, p2y, board) {},
    154
    155         updatePathPrim: function (node, pathString, board) {},
    156
    157         updatePathStringPoint: function (el, size, type) {},
    158
    159         updatePathStringPrim: function (el) {},
    160
    161         updatePathStringBezierPrim: function (el) {},
    162
    163         updatePolygonPrim: function (node, el) {},
    164
    165         updateRectPrim: function (node, x, y, w, h) {},
    166
    167         setPropertyPrim: function (node, key, val) {},
    168
    169         /* ********* Set attributes *********** */
    170
    171         show: function (el) {},
    172
    173         hide: function (el) {},
    174
    175         setBuffering: function (node, type) {},
    176
    177         setDashStyle: function (el) {},
    178
    179         setDraft: function (el) {},
    180
    181         removeDraft: function (el) {},
    182
    183         setGradient: function (el) {},
    184
    185         updateGradient: function (el) {},
    186
    187         setObjectTransition: function (el, duration) {},
    188
    189         setObjectFillColor: function (el, color, opacity) {},
    190
    191         setObjectStrokeColor: function (el, color, opacity) {},
    192
    193         setObjectStrokeWidth: function (el, width) {},
    194
    195         setShadow: function (el) {},
    196
    197         highlight: function (el) {},
    198
    199         noHighlight: function (el) {},
    200
    201         /* ********* Renderer control *********** */
    202
    203         suspendRedraw: function () {},
    204
    205         unsuspendRedraw: function () {},
    206
    207         drawNavigationBar: function (board) {},
    208
    209         getElementById: function (id) { return null; },
    210
    211         resize: function (w, h) {},
    212
    213         removeToInsertLater: function () { return function () {}; }
    214     }
    215 );
    216
    217 /**
    218  * @ignore
    219  */
    220 JXG.NoRenderer.prototype = new AbstractRenderer();
    221
    222 export default JXG.NoRenderer;
    223