/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Data Visualization module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
  \qmltype AbstractGraph3D
  \inqmlmodule QtDataVisualization
  \since QtDataVisualization 1.0
  \ingroup datavisualization_qml
  \brief Base type for 3D visualizations.

  The base type for all 3D visualizations in QtDataVisualization.

  This type is uncreatable, but it contains properties that are shared between
  the 3D visualizations.

  \sa Bars3D, Scatter3D, Surface3D, {Qt Data Visualization C++ Classes}
 */

/*!
  \qmlproperty AbstractGraph3D.SelectionMode AbstractGraph3D::selectionMode
  The active selection mode in the visualization.
  One of the QAbstract3DGraph::SelectionFlag enum values.

  \sa QAbstract3DGraph::SelectionFlag
 */

/*!
  \qmlproperty AbstractGraph3D.ShadowQuality AbstractGraph3D::shadowQuality
  The quality of shadows. One of the QAbstract3DGraph::ShadowQuality enum
  values.

  \sa QAbstract3DGraph::ShadowQuality
 */

/*!
  \qmlproperty bool AbstractGraph3D::shadowsSupported
  This read-only property indicates whether shadows are supported with the
  current configuration. OpenGL ES2 configurations do not support shadows.
 */

/*!
  \qmlproperty Scene3D AbstractGraph3D::scene
  The Scene3D pointer that can be used to manipulate the scene and access the
  scene elements, such as the active camera.

  This property is read-only.
 */

/*!
  \qmlproperty AbstractInputHandler3D AbstractGraph3D::inputHandler
  The active input handler used in the graph. You can disable default input
  handlers by setting this property to null.
 */

/*!
  \qmlproperty Theme3D AbstractGraph3D::theme
  The active theme of the graph.

  \sa Theme3D
 */

/*!
  \qmlproperty AbstractGraph3D.RenderingMode AbstractGraph3D::renderingMode

  How the graph will be rendered. Defaults to \c{RenderIndirect}.

  \value RenderDirectToBackground
         Indicates that the graph will be rendered directly on the window background.
  Clears the whole window before rendering the graph, including the areas
  outside the graph.
  Since the graphs in this rendering mode are drawn on the window background under other QML
  items, the regular QML window clearing before rendering is suppressed. The graphs handle the clearing
  themselves instead.
  If the surface format of the window supports antialiasing, it will be used (see
  \c {QtDataVisualization::qDefaultSurfaceFormat()}).
  This rendering mode offers the best performance at the expense of non-standard QML behavior. For example,
  the graphs do not obey the z ordering of QML items and the opacity value has no effect on them.

  \value RenderDirectToBackground_NoClear
         Similar to \c RenderDirectToBackground mode, except that the graph will not clear the whole
  window before rendering the graph. This mode is better for windows where you have other custom items
  besides the graphs that also draw on the window background. In that case you need to either take care
  of the window clearing yourself or ensure that all areas of the window are fully covered with opaque
  items.
  If one graph in the window uses either of the direct rendering modes, then all other graphs in the
  same window also drawn in direct modes should use the exact same direct rendering mode.
  Otherwise some graphs may not show up, depending on the drawing order of the graphs.

  \value RenderIndirect
         Indicates the graph will be first rendered to an offscreen surface that
  is then drawn during normal QML item rendering. The rendered image is
  antialiased using the multisampling method if it is supported in the current environment and the
  msaaSamples property value is greater than zero.
  This rendering mode offers good quality and normal QML item behavior at the expense of performance.

  \note Antialiasing is not supported in OpenGL ES2 environments in any rendering mode.

  \note Setting the \c antialiasing property of the graph does not do anything. However, it is
  set by the graph itself if the current rendering mode uses antialiasing.

  \sa msaaSamples
 */

/*!
  \qmlproperty int AbstractGraph3D::msaaSamples
  The number of samples used in multisample antialiasing when renderingMode is \c RenderIndirect.
  When renderingMode is \c RenderDirectToBackground or \c RenderDirectToBackground_NoClear, this
  property value is read-only and returns the number of samples specified by the window surface
  format.
  Defaults to \c{4}.

  \sa renderingMode
 */

/*!
 * \qmlproperty bool AbstractGraph3D::measureFps
 * \since QtDataVisualization 1.1
 *
 * If \c {true}, the rendering is done continuously instead of on demand, and
 * the value of the currentFps property is updated. Defaults to \c{false}.
 *
 * \sa currentFps
 */

/*!
 * \qmlproperty int AbstractGraph3D::currentFps
 * \since QtDataVisualization 1.1
 *
 * When FPS measuring is enabled, the results for the last second are stored in this read-only
 * property. It takes at least a second before this value updates after measuring is activated.
 *
 * \sa measureFps
 */

/*!
 * \qmlproperty list<Custom3DItem> AbstractGraph3D::customItemList
 * \since QtDataVisualization 1.1
 *
 * The list of \l{Custom3DItem} items added to the graph. The graph takes ownership
 * of the added items.
 */

/*!
 * \qmlproperty bool AbstractGraph3D::polar
 * \since QtDataVisualization 1.2
 *
 * If \c {true}, the horizontal axes are changed into polar axes. The x-axis
 * becomes the angular axis and the z-axis becomes the radial axis.
 * Polar mode is not available for bar graphs.
 *
 * Defaults to \c{false}.
 *
 * \sa orthoProjection, radialLabelOffset
 */

/*!
 * \qmlproperty real AbstractGraph3D::radialLabelOffset
 * \since QtDataVisualization 1.2
 *
 * This property specifies the normalized horizontal offset for the axis labels of the radial
 * polar axis. The value \c 0.0 indicates that the labels should be drawn next
 * to the 0-angle angular axis grid line. The value \c 1.0 indicates that the
 * labels are drawn in their usual place at the edge of the graph background.
 * This property is ignored if the polar property value is \c{false}. Defaults
 * to \c 1.0.
 *
 * \sa polar
 */

/*!
 * \qmlmethod void AbstractGraph3D::clearSelection()
 * Clears selection from all attached series.
 */

/*!
 * \qmlmethod int AbstractGraph3D::addCustomItem(Custom3DItem item)
 *
 * Adds a Custom3DItem \a item to the graph. Graph takes ownership of the added item.
 *
 * \return index to the added item if add was successful, -1 if trying to add a null item, and
 * index of the item if trying to add an already added item.
 *
 * \sa removeCustomItems(), removeCustomItem(), removeCustomItemAt()
 *
 * \since QtDataVisualization 1.1
 */

/*!
 * \qmlmethod void AbstractGraph3D::removeCustomItems()
 *
 * Removes all custom items. Deletes the resources allocated to them.
 *
 * \since QtDataVisualization 1.1
 */

/*!
 * \qmlmethod void AbstractGraph3D::removeCustomItem(Custom3DItem item)
 *
 * Removes the custom \a {item}. Deletes the resources allocated to it.
 *
 * \since QtDataVisualization 1.1
 */

/*!
 * \qmlmethod void AbstractGraph3D::removeCustomItemAt(vector3d position)
 *
 * Removes all custom items at \a {position}. Deletes the resources allocated to them.
 *
 * \since QtDataVisualization 1.1
 */

/*!
 * \qmlmethod void AbstractGraph3D::releaseCustomItem(Custom3DItem item)
 *
 * Gets ownership of \a item back and removes the \a item from the graph.
 *
 * \since QtDataVisualization 1.1
 *
 * \note If the same item is added back to the graph, the texture file needs to be re-set.
 *
 * \sa Custom3DItem::textureFile
 */

/*!
 * \qmlmethod int AbstractGraph3D::selectedLabelIndex()
 *
 * Can be used to query the index of the selected label after receiving \c selectedElementChanged
 * signal with any label type. Selection is valid until the next \c selectedElementChanged signal.
 *
 * \return index of the selected label, or -1.
 *
 * \since QtDataVisualization 1.1
 *
 * \sa selectedElement
 */

/*!
 * \qmlmethod Abstract3DAxis AbstractGraph3D::selectedAxis()
 *
 * Can be used to get the selected axis after receiving \c selectedElementChanged signal with any label
 * type. Selection is valid until the next \c selectedElementChanged signal.
 *
 * \return the selected axis, or null.
 *
 * \since QtDataVisualization 1.1
 *
 * \sa selectedElement
 */

/*!
 * \qmlmethod int AbstractGraph3D::selectedCustomItemIndex()
 *
 * Can be used to query the index of the selected custom item after receiving \c selectedElementChanged
 * signal with \l{QAbstract3DGraph::ElementCustomItem}{ElementCustomItem} type. Selection is valid
 * until the next \c selectedElementChanged signal.
 *
 * \return index of the selected custom item, or -1.
 *
 * \since QtDataVisualization 1.1
 *
 * \sa selectedElement
 */

/*!
 * \qmlmethod Custom3DItem AbstractGraph3D::selectedCustomItem()
 *
 * Can be used to get the selected custom item after receiving \c selectedElementChanged signal with
 * \l{QAbstract3DGraph::ElementCustomItem}{ElementCustomItem} type. Ownership of the item remains
 * with the graph. Selection is valid until the next \c selectedElementChanged signal.
 *
 * \return the selected custom item, or null.
 *
 * \since QtDataVisualization 1.1
 *
 * \sa selectedElement
 */

/*!
 * \qmlproperty AbstractGraph3D.ElementType AbstractGraph3D::selectedElement
 *
 * The element selected in the graph.
 *
 * This property can be used to query the selected element type.
 * The type is valid until a new selection is made in the graph and the
 * \c selectedElementChanged signal is emitted.
 *
 * The signal can be used for example for implementing customized input
 * handling, as demonstrated by the \l {Qt Quick 2 Axis Dragging Example}.
 *
 * \sa selectedLabelIndex(), selectedAxis(), selectedCustomItemIndex(), selectedCustomItem(),
 * Bars3D::selectedSeries, Scatter3D::selectedSeries, Scene3D::selectionQueryPosition,
 * QAbstract3DGraph::ElementType
 *
 * \since QtDataVisualization 1.1
 */

/*!
 * \qmlproperty bool AbstractGraph3D::orthoProjection
 * \since QtDataVisualization 1.1
 *
 * If \c {true}, orthographic projection will be used for displaying the graph. Defaults to \c{false}.
 * \note Shadows will be disabled when set to \c{true}.
 */

/*!
 * \qmlproperty real AbstractGraph3D::aspectRatio
 * \since QtDataVisualization 1.1
 *
 * The ratio of the graph scaling between the longest axis on the horizontal
 * plane and the y-axis. Defaults to \c{2.0}.
 *
 * \note Has no effect on Bars3D.
 *
 * \sa horizontalAspectRatio
 */

/*!
 * \qmlproperty real AbstractGraph3D::horizontalAspectRatio
 * \since QtDataVisualization 1.2
 *
 * The ratio of the graph scaling between the x-axis and z-axis.
 * The value of \c 0.0 indicates automatic scaling according to axis ranges.
 * Defaults to \c{0.0}.
 *
 * \note Has no effect on Bars3D, which handles scaling on the horizontal plane via the
 * \l{Bars3D::barThickness}{barThickness} and \l{Bars3D::barSpacing}{barSpacing} properties.
 * Polar graphs also ignore this property.
 *
 * \sa aspectRatio, polar, Bars3D::barThickness, Bars3D::barSpacing
 */

/*!
 * \qmlproperty AbstractGraph3D.OptimizationHints AbstractGraph3D::optimizationHints
 * \since QtDataVisualization 1.1
 *
 * Whether the default or static mode is used for rendering optimization.
 *
 * The default mode provides the full feature set at a reasonable level of
 * performance. The static mode optimizes graph rendering and is ideal for
 * large non-changing data sets. It is slower with dynamic data changes and item rotations.
 * Selection is not optimized, so using the static mode with massive data sets is not advisable.
 * Static optimization works only on scatter graphs.
 * Defaults to \l{QAbstract3DGraph::OptimizationDefault}{OptimizationDefault}.
 *
 * \note On some environments, large graphs using static optimization may not render, because
 * all of the items are rendered using a single draw call, and different graphics drivers
 * support different maximum vertice counts per call.
 * This is mostly an issue on 32bit and OpenGL ES2 platforms.
 * To work around this issue, choose an item mesh with a low vertex count or use
 * the point mesh.
 *
 * \sa Abstract3DSeries::mesh, QAbstract3DGraph::OptimizationHint
 */

/*!
 * \qmlproperty bool AbstractGraph3D::reflection
 * \since QtDataVisualization 1.2
 *
 * Sets floor reflections on or off. Defaults to \c{false}.
 *
 * \note Affects only Bars3D. However, in Bars3D graphs holding both positive
 * and negative values, reflections are not supported
 * for custom items that intersect the floor plane. In that case, reflections should be turned off
 * to avoid incorrect rendering.
 *
 * \sa reflectivity
 */

/*!
 * \qmlproperty real AbstractGraph3D::reflectivity
 * \since QtDataVisualization 1.2
 *
 * Sets floor reflectivity. Larger numbers make the floor more reflective. The
 * valid range is \c{[0...1]}.
 * Defaults to \c{0.5}.
 *
 * \note Affects only Bars3D.
 *
 * \sa reflection
 */

/*!
 * \qmlproperty locale AbstractGraph3D::locale
 * \since QtDataVisualization 1.2
 *
 * Sets the locale used for formatting various numeric labels.
 * Defaults to the \c{"C"} locale.
 *
 * \sa ValueAxis3D::labelFormat
 */

/*!
 * \qmlproperty vector3d AbstractGraph3D::queriedGraphPosition
 * \since QtDataVisualization 1.2
 *
 * This read-only property contains the latest graph position values along each axis queried using
 * Scene3D::graphPositionQuery. The values are normalized to range \c{[-1, 1]}.
 * If the queried position was outside the graph bounds, the values
 * will not reflect the real position, but will instead be some undefined position outside
 * the range \c{[-1, 1]}. The value will be undefined until a query is made.
 *
 * There is no single correct 3D coordinate to match a particular screen position, so to be
 * consistent, the queries are always done against the inner sides of an invisible box surrounding
 * the graph.
 *
 * \note Bar graphs only allow querying graph position at the graph floor level,
 * so the y-value is always zero for bar graphs and valid queries can be only made at
 * screen positions that contain the floor of the graph.
 *
 * \sa Scene3D::graphPositionQuery
 */

/*!
 * \qmlproperty real AbstractGraph3D::margin
 * \since QtDataVisualization 1.2
 *
 * The absolute value used for the space left between the edge of the
 * plottable graph area and the edge of the graph background.
 *
 * If the margin value is negative, the margins are determined automatically and can vary according
 * to the size of the items in the series and the type of the graph.
 * The value is interpreted as a fraction of the y-axis range if the graph
 * aspect ratios have not beed changed from the default values.
 * Defaults to \c{-1.0}.
 *
 * \note Setting a smaller margin for a scatter graph than the automatically
 * determined margin can cause the scatter items at the edges of the graph to
 * overlap with the graph background.
 *
 * \note On scatter and surface graphs, if the margin is small in comparison to the axis label
 * size, the positions of the edge labels of the axes are adjusted to avoid overlap with
 * the edge labels of the neighboring axes.
 */
