mirror of https://github.com/CGAL/cgal
Remove QDomElements and need for QtXml
This commit is contained in:
parent
c23b0c33e3
commit
9cd0d450f9
|
|
@ -23,7 +23,7 @@ include_directories(BEFORE ./ ./include)
|
|||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
# Find Qt5 itself
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Gui Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
|||
#${CGAL_Qt5_MOC_FILES}
|
||||
)
|
||||
# Link with Qt libraries
|
||||
target_link_libraries(AABB_demo PRIVATE Qt5::OpenGL Qt5::Gui Qt5::Xml
|
||||
target_link_libraries(AABB_demo PRIVATE Qt5::OpenGL Qt5::Gui
|
||||
CGAL::CGAL CGAL::CGAL_Qt5)
|
||||
|
||||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS AABB_demo)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
include_directories(BEFORE ./include)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
include_directories(BEFORE ./include)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
include_directories(BEFORE ./include)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
include_directories(BEFORE ./include)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ if(NOT TARGET CGAL::Eigen3_support)
|
|||
return()
|
||||
endif()
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
include(${CGAL_USE_FILE})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ set(QT_USE_QTMAIN TRUE)
|
|||
set(QT_USE_QTSCRIPT TRUE)
|
||||
set(QT_USE_QTOPENGL TRUE)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
include_directories(BEFORE ./include)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ set(QT_USE_QTMAIN TRUE)
|
|||
set(QT_USE_QTSCRIPT TRUE)
|
||||
set(QT_USE_QTOPENGL TRUE)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
include_directories(BEFORE ./include)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ endif()
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef QGLVIEWER_CAMERA_H
|
||||
#define QGLVIEWER_CAMERA_H
|
||||
#include <QMap>
|
||||
#include <QDomElement>
|
||||
#include <CGAL/Qt/vec.h>
|
||||
#include <CGAL/Qt/quaternion.h>
|
||||
#include <CGAL/export/Qt.h>
|
||||
|
|
@ -435,15 +434,6 @@ public Q_SLOTS:
|
|||
void setFlySpeed(qreal speed);
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFrameModified();
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ Camera::Camera(QObject *parent)
|
|||
// Requires the interpolationKfi_
|
||||
setFrame(new ManipulatedCameraFrame());
|
||||
|
||||
// #CONNECTION# All these default values identical in initFromDOMElement.
|
||||
|
||||
// Requires fieldOfView() to define focusDistance()
|
||||
setSceneRadius(1.0);
|
||||
|
|
@ -61,7 +60,6 @@ Camera::Camera(QObject *parent)
|
|||
// projectionMatrix_ below.
|
||||
setType(PERSPECTIVE);
|
||||
|
||||
// #CONNECTION# initFromDOMElement default values
|
||||
setZNearCoefficient(0.005);
|
||||
setZClippingCoefficient(sqrt(3.0));
|
||||
|
||||
|
|
@ -2016,153 +2014,6 @@ void Camera::deletePath(unsigned int i) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the Camera.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
Concatenates the Camera parameters, the ManipulatedCameraFrame::domElement()
|
||||
and the paths' KeyFrameInterpolator::domElement().
|
||||
|
||||
Use initFromDOMElement() to restore the Camera state from the resulting \c
|
||||
QDomElement.
|
||||
|
||||
If you want to save the Camera state in a file, use:
|
||||
\code
|
||||
QDomDocument document("myCamera");
|
||||
doc.appendChild( myCamera->domElement("Camera", document) );
|
||||
|
||||
QFile f("myCamera.xml");
|
||||
if (f.open(IO_WriteOnly))
|
||||
{
|
||||
QTextStream out(&f);
|
||||
document.save(out, 2);
|
||||
}
|
||||
\endcode
|
||||
|
||||
Note that the CGAL::QGLViewer::camera() is automatically saved by
|
||||
CGAL::QGLViewer::saveStateToFile() when a CGAL::QGLViewer is closed. Use
|
||||
CGAL::QGLViewer::restoreStateFromFile() to restore it back. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement Camera::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
QDomElement de = document.createElement(name);
|
||||
QDomElement paramNode = document.createElement("Parameters");
|
||||
paramNode.setAttribute("fieldOfView", QString::number(fieldOfView()));
|
||||
paramNode.setAttribute("zNearCoefficient",
|
||||
QString::number(zNearCoefficient()));
|
||||
paramNode.setAttribute("zClippingCoefficient",
|
||||
QString::number(zClippingCoefficient()));
|
||||
paramNode.setAttribute("orthoCoef", QString::number(orthoCoef_));
|
||||
paramNode.setAttribute("sceneRadius", QString::number(sceneRadius()));
|
||||
paramNode.appendChild(sceneCenter().domElement("SceneCenter", document));
|
||||
|
||||
switch (type()) {
|
||||
case Camera::PERSPECTIVE:
|
||||
paramNode.setAttribute("Type", "PERSPECTIVE");
|
||||
break;
|
||||
case Camera::ORTHOGRAPHIC:
|
||||
paramNode.setAttribute("Type", "ORTHOGRAPHIC");
|
||||
break;
|
||||
}
|
||||
de.appendChild(paramNode);
|
||||
|
||||
de.appendChild(frame()->domElement("ManipulatedCameraFrame", document));
|
||||
|
||||
// KeyFrame paths
|
||||
for (QMap<unsigned int, KeyFrameInterpolator *>::ConstIterator
|
||||
it = kfi_.begin(),
|
||||
end = kfi_.end();
|
||||
it != end; ++it) {
|
||||
QDomElement kfNode =
|
||||
(it.value())->domElement("KeyFrameInterpolator", document);
|
||||
kfNode.setAttribute("index", QString::number(it.key()));
|
||||
de.appendChild(kfNode);
|
||||
}
|
||||
|
||||
return de;
|
||||
}
|
||||
|
||||
/*! Restores the Camera state from a \c QDomElement created by domElement().
|
||||
|
||||
Use the following code to retrieve a Camera state from a file created using
|
||||
domElement(): \code
|
||||
// Load DOM from file
|
||||
QDomDocument document;
|
||||
QFile f("myCamera.xml");
|
||||
if (f.open(IO_ReadOnly))
|
||||
{
|
||||
document.setContent(&f);
|
||||
f.close();
|
||||
}
|
||||
|
||||
// Parse the DOM tree
|
||||
QDomElement main = document.documentElement();
|
||||
myCamera->initFromDOMElement(main);
|
||||
\endcode
|
||||
|
||||
The frame() pointer is not modified by this method. The frame() state is
|
||||
however modified.
|
||||
|
||||
\attention The original keyFrameInterpolator() are deleted and should be copied
|
||||
first if they are shared. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void Camera::initFromDOMElement(const QDomElement &element) {
|
||||
QDomElement child = element.firstChild().toElement();
|
||||
|
||||
QMutableMapIterator<unsigned int, KeyFrameInterpolator *> it(kfi_);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
deletePath(it.key());
|
||||
}
|
||||
|
||||
while (!child.isNull()) {
|
||||
if (child.tagName() == "Parameters") {
|
||||
// #CONNECTION# Default values set in constructor
|
||||
//setFieldOfView(DomUtils::qrealFromDom(child, "fieldOfView", CGAL_PI / 4.0));
|
||||
setZNearCoefficient(
|
||||
DomUtils::qrealFromDom(child, "zNearCoefficient", 0.005));
|
||||
setZClippingCoefficient(
|
||||
DomUtils::qrealFromDom(child, "zClippingCoefficient", sqrt(3.0)));
|
||||
orthoCoef_ =
|
||||
DomUtils::qrealFromDom(child, "orthoCoef", tan(fieldOfView() / 2.0));
|
||||
setSceneRadius(
|
||||
DomUtils::qrealFromDom(child, "sceneRadius", sceneRadius()));
|
||||
|
||||
setType(PERSPECTIVE);
|
||||
QString type = child.attribute("Type", "PERSPECTIVE");
|
||||
if (type == "PERSPECTIVE")
|
||||
setType(Camera::PERSPECTIVE);
|
||||
if (type == "ORTHOGRAPHIC")
|
||||
setType(Camera::ORTHOGRAPHIC);
|
||||
|
||||
QDomElement child2 = child.firstChild().toElement();
|
||||
while (!child2.isNull()) {
|
||||
/* Although the scene does not change when a camera is loaded, restore
|
||||
the saved center and radius values. Mainly useful when a the viewer is
|
||||
restored on startup, with possible additional cameras. */
|
||||
if (child2.tagName() == "SceneCenter")
|
||||
setSceneCenter(Vec(child2));
|
||||
|
||||
child2 = child2.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (child.tagName() == "ManipulatedCameraFrame")
|
||||
frame()->initFromDOMElement(child);
|
||||
|
||||
|
||||
if (child.tagName() == "KeyFrameInterpolator") {
|
||||
unsigned int index = DomUtils::uintFromDom(child, "index", 0);
|
||||
setKeyFrameInterpolator(index, new KeyFrameInterpolator(frame()));
|
||||
if (keyFrameInterpolator(index))
|
||||
keyFrameInterpolator(index)->initFromDOMElement(child);
|
||||
}
|
||||
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
/*! Gives the coefficients of a 3D half-line passing through the Camera eye and
|
||||
pixel (x,y).
|
||||
|
||||
|
|
|
|||
|
|
@ -1,183 +0,0 @@
|
|||
/****************************************************************************
|
||||
|
||||
Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
|
||||
|
||||
This file is part of a fork of the QGLViewer library version 2.7.0.
|
||||
|
||||
*****************************************************************************/
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#ifndef QGLVIEWER_DOMUTILS_H
|
||||
#define QGLVIEWER_DOMUTILS_H
|
||||
#include <qglobal.h>
|
||||
#include <QColor>
|
||||
#include <QDomElement>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
// QDomElement loading with syntax checking.
|
||||
class DomUtils {
|
||||
private:
|
||||
static void warning(const QString &message) {
|
||||
qWarning("%s", message.toLatin1().constData());
|
||||
}
|
||||
|
||||
public:
|
||||
static qreal qrealFromDom(const QDomElement &e, const QString &attribute,
|
||||
qreal defValue) {
|
||||
qreal value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
bool ok;
|
||||
value = s.toDouble(&ok);
|
||||
if (!ok) {
|
||||
warning(QString("'%1' is not a valid qreal syntax for attribute \"%2\" "
|
||||
"in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(defValue)));
|
||||
value = defValue;
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(value)));
|
||||
}
|
||||
|
||||
#if defined(isnan)
|
||||
// The "isnan" method may not be available on all platforms.
|
||||
// Find its equivalent or simply remove these two lines
|
||||
if (isnan(value))
|
||||
warning(
|
||||
QString(
|
||||
"Warning, attribute \"%1\" initialized to Not a Number in \"%2\"")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName()));
|
||||
#endif
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static int intFromDom(const QDomElement &e, const QString &attribute,
|
||||
int defValue) {
|
||||
int value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
bool ok;
|
||||
value = s.toInt(&ok);
|
||||
if (!ok) {
|
||||
warning(
|
||||
QString("'%1' is not a valid integer syntax for attribute \"%2\" "
|
||||
"in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(defValue)));
|
||||
value = defValue;
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(value)));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static unsigned int uintFromDom(const QDomElement &e,
|
||||
const QString &attribute,
|
||||
unsigned int defValue) {
|
||||
unsigned int value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
bool ok;
|
||||
value = s.toUInt(&ok);
|
||||
if (!ok) {
|
||||
warning(
|
||||
QString("'%1' is not a valid unsigned integer syntax for attribute "
|
||||
"\"%2\" in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(defValue)));
|
||||
value = defValue;
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(value)));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static bool boolFromDom(const QDomElement &e, const QString &attribute,
|
||||
bool defValue) {
|
||||
bool value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
if (s.toLower() == QString("true"))
|
||||
value = true;
|
||||
else if (s.toLower() == QString("false"))
|
||||
value = false;
|
||||
else {
|
||||
warning(
|
||||
QString("'%1' is not a valid boolean syntax for attribute \"%2\" "
|
||||
"in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(defValue ? "true" : "false"));
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(value ? "true" : "false"));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static void setBoolAttribute(QDomElement &element, const QString &attribute,
|
||||
bool value) {
|
||||
element.setAttribute(attribute, (value ? "true" : "false"));
|
||||
}
|
||||
|
||||
static QDomElement QColorDomElement(const QColor &color, const QString &name,
|
||||
QDomDocument &doc) {
|
||||
QDomElement de = doc.createElement(name);
|
||||
de.setAttribute("red", QString::number(color.red()));
|
||||
de.setAttribute("green", QString::number(color.green()));
|
||||
de.setAttribute("blue", QString::number(color.blue()));
|
||||
return de;
|
||||
}
|
||||
|
||||
static QColor QColorFromDom(const QDomElement &e) {
|
||||
int color[3];
|
||||
QStringList attribute;
|
||||
attribute << "red"
|
||||
<< "green"
|
||||
<< "blue";
|
||||
for (int i = 0; i < attribute.count(); ++i)
|
||||
color[i] = DomUtils::intFromDom(e, attribute[i], 0);
|
||||
return QColor(color[0], color[1], color[2]);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DOXYGEN
|
||||
#endif //QGLVIEWER_DOMUTILS_H
|
||||
|
|
@ -425,14 +425,6 @@ public:
|
|||
}
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
private:
|
||||
// P o s i t i o n a n d o r i e n t a t i o n
|
||||
|
|
|
|||
|
|
@ -999,68 +999,6 @@ void Frame::getTransformOfFrom(const qreal src[3], qreal res[3],
|
|||
res[i] = r[i];
|
||||
}
|
||||
|
||||
//////////////////////////// STATE //////////////////////////////
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the Frame.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
The resulting QDomElement looks like:
|
||||
\code
|
||||
<name>
|
||||
<position x=".." y=".." z=".." />
|
||||
<orientation q0=".." q1=".." q2=".." q3=".." />
|
||||
</name>
|
||||
\endcode
|
||||
|
||||
Use initFromDOMElement() to restore the Frame state from the resulting \c
|
||||
QDomElement.
|
||||
|
||||
|
||||
See Vec::domElement() for a complete example. See also
|
||||
|
||||
Quaternion::domElement(), Camera::domElement()...
|
||||
|
||||
\attention The constraint() and referenceFrame() are not saved in the
|
||||
QDomElement. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement Frame::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
// TODO: use translation and rotation instead when referenceFrame is coded...
|
||||
QDomElement e = document.createElement(name);
|
||||
e.appendChild(position().domElement("position", document));
|
||||
e.appendChild(orientation().domElement("orientation", document));
|
||||
return e;
|
||||
}
|
||||
|
||||
/*! Restores the Frame state from a \c QDomElement created by domElement().
|
||||
|
||||
See domElement() for the \c QDomElement syntax. See the
|
||||
Vec::initFromDOMElement() and Quaternion::initFromDOMElement() documentations
|
||||
for details on default values if an argument is missing.
|
||||
|
||||
\attention The constraint() and referenceFrame() are not restored by this
|
||||
method and are left unchanged. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void Frame::initFromDOMElement(const QDomElement &element) {
|
||||
// TODO: use translation and rotation instead when referenceFrame is coded...
|
||||
|
||||
// Reset default values. Attention: destroys constraint.
|
||||
// *this = Frame();
|
||||
// This instead ? Better : what is not set is not changed.
|
||||
// setPositionAndOrientation(Vec(), Quaternion());
|
||||
|
||||
QDomElement child = element.firstChild().toElement();
|
||||
while (!child.isNull()) {
|
||||
if (child.tagName() == "position")
|
||||
setPosition(Vec(child));
|
||||
if (child.tagName() == "orientation")
|
||||
setOrientation(Quaternion(child).normalized());
|
||||
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////// ALIGN /////////////////////////////////
|
||||
|
||||
|
|
|
|||
|
|
@ -281,14 +281,6 @@ public Q_SLOTS:
|
|||
virtual void interpolateAtTime(qreal time);
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
private Q_SLOTS:
|
||||
virtual void update();
|
||||
virtual void invalidateValues() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ KeyFrameInterpolator::KeyFrameInterpolator(Frame *frame)
|
|||
interpolationSpeed_(1.0), interpolationStarted_(false),
|
||||
closedPath_(false), loopInterpolation_(false), pathIsValid_(false),
|
||||
valuesAreValid_(true), currentFrameValid_(false)
|
||||
// #CONNECTION# Values cut pasted initFromDOMElement()
|
||||
{
|
||||
setFrame(frame);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
|
|
@ -458,85 +457,6 @@ void KeyFrameInterpolator::interpolateAtTime(qreal time) {
|
|||
Q_EMIT interpolated();
|
||||
}
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the KeyFrameInterpolator.
|
||||
|
||||
The resulting QDomElement holds the KeyFrameInterpolator parameters as well as
|
||||
the path keyFrames (if the keyFrame is defined by a pointer to a Frame, use its
|
||||
current value).
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
Use initFromDOMElement() to restore the ManipulatedFrame state from the
|
||||
resulting QDomElement.
|
||||
|
||||
|
||||
See Vec::domElement() for a complete example. See also
|
||||
Quaternion::domElement(), Camera::domElement()...
|
||||
|
||||
Note that the Camera::keyFrameInterpolator() are automatically saved by
|
||||
CGAL::QGLViewer::saveStateToFile() when a CGAL::QGLViewer is closed. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement KeyFrameInterpolator::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
QDomElement de = document.createElement(name);
|
||||
int count = 0;
|
||||
Q_FOREACH (KeyFrame *kf, keyFrame_) {
|
||||
Frame fr(kf->position(), kf->orientation());
|
||||
QDomElement kfNode = fr.domElement("KeyFrame", document);
|
||||
kfNode.setAttribute("index", QString::number(count));
|
||||
kfNode.setAttribute("time", QString::number(kf->time()));
|
||||
de.appendChild(kfNode);
|
||||
++count;
|
||||
}
|
||||
de.setAttribute("nbKF", QString::number(keyFrame_.count()));
|
||||
de.setAttribute("time", QString::number(interpolationTime()));
|
||||
de.setAttribute("speed", QString::number(interpolationSpeed()));
|
||||
de.setAttribute("period", QString::number(interpolationPeriod()));
|
||||
DomUtils::setBoolAttribute(de, "closedPath", closedPath());
|
||||
DomUtils::setBoolAttribute(de, "loop", loopInterpolation());
|
||||
return de;
|
||||
}
|
||||
|
||||
/*! Restores the KeyFrameInterpolator state from a \c QDomElement created by
|
||||
domElement().
|
||||
|
||||
Note that the frame() pointer is not included in the domElement(): you need to
|
||||
setFrame() after this method to attach a Frame to the KeyFrameInterpolator.
|
||||
|
||||
See Vec::initFromDOMElement() for a complete code example.
|
||||
|
||||
See also Camera::initFromDOMElement() and Frame::initFromDOMElement(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void KeyFrameInterpolator::initFromDOMElement(const QDomElement &element) {
|
||||
qDeleteAll(keyFrame_);
|
||||
keyFrame_.clear();
|
||||
QDomElement child = element.firstChild().toElement();
|
||||
while (!child.isNull()) {
|
||||
if (child.tagName() == "KeyFrame") {
|
||||
Frame fr;
|
||||
fr.initFromDOMElement(child);
|
||||
qreal time = DomUtils::qrealFromDom(child, "time", 0.0);
|
||||
addKeyFrame(fr, time);
|
||||
}
|
||||
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
|
||||
// #CONNECTION# Values cut pasted from constructor
|
||||
setInterpolationTime(DomUtils::qrealFromDom(element, "time", 0.0));
|
||||
setInterpolationSpeed(DomUtils::qrealFromDom(element, "speed", 1.0));
|
||||
setInterpolationPeriod(DomUtils::intFromDom(element, "period", 40));
|
||||
setClosedPath(DomUtils::boolFromDom(element, "closedPath", false));
|
||||
setLoopInterpolation(DomUtils::boolFromDom(element, "loop", false));
|
||||
|
||||
// setFrame(nullptr);
|
||||
pathIsValid_ = false;
|
||||
valuesAreValid_ = false;
|
||||
currentFrameValid_ = false;
|
||||
|
||||
stopInterpolation();
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
|
|
|
|||
|
|
@ -199,15 +199,6 @@ protected Q_SLOTS:
|
|||
virtual void spin();
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
#ifndef DOXYGEN
|
||||
protected:
|
||||
virtual void startAction(
|
||||
|
|
|
|||
|
|
@ -117,69 +117,6 @@ void ManipulatedCameraFrame::updateSceneUpVector() {
|
|||
sceneUpVector_ = inverseTransformOf(Vec(0.0, 1.0, 0.0));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// S t a t e s a v i n g a n d r e s t o r i n g //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the ManipulatedCameraFrame.
|
||||
|
||||
Adds to the ManipulatedFrame::domElement() the ManipulatedCameraFrame specific
|
||||
informations in a \c ManipulatedCameraParameters child QDomElement.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
Use initFromDOMElement() to restore the ManipulatedCameraFrame state from the
|
||||
resulting \c QDomElement.
|
||||
|
||||
See Vec::domElement() for a complete example. See also
|
||||
Quaternion::domElement(), Frame::domElement(), Camera::domElement()... */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement ManipulatedCameraFrame::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
QDomElement e = ManipulatedFrame::domElement(name, document);
|
||||
QDomElement mcp = document.createElement("ManipulatedCameraParameters");
|
||||
mcp.setAttribute("flySpeed", QString::number(flySpeed()));
|
||||
DomUtils::setBoolAttribute(mcp, "rotatesAroundUpVector",
|
||||
rotatesAroundUpVector());
|
||||
DomUtils::setBoolAttribute(mcp, "zoomsOnPivotPoint", zoomsOnPivotPoint());
|
||||
mcp.appendChild(sceneUpVector().domElement("sceneUpVector", document));
|
||||
e.appendChild(mcp);
|
||||
return e;
|
||||
}
|
||||
|
||||
/*! Restores the ManipulatedCameraFrame state from a \c QDomElement created by
|
||||
domElement().
|
||||
|
||||
First calls ManipulatedFrame::initFromDOMElement() and then initializes
|
||||
ManipulatedCameraFrame specific parameters. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void ManipulatedCameraFrame::initFromDOMElement(const QDomElement &element) {
|
||||
// No need to initialize, since default sceneUpVector and flySpeed are not
|
||||
// meaningful. It's better to keep current ones. And it would destroy
|
||||
// constraint() and referenceFrame(). *this = ManipulatedCameraFrame();
|
||||
ManipulatedFrame::initFromDOMElement(element);
|
||||
|
||||
QDomElement child = element.firstChild().toElement();
|
||||
while (!child.isNull()) {
|
||||
if (child.tagName() == "ManipulatedCameraParameters") {
|
||||
setFlySpeed(DomUtils::qrealFromDom(child, "flySpeed", flySpeed()));
|
||||
setRotatesAroundUpVector(
|
||||
DomUtils::boolFromDom(child, "rotatesAroundUpVector", false));
|
||||
setZoomsOnPivotPoint(
|
||||
DomUtils::boolFromDom(child, "zoomsOnPivotPoint", false));
|
||||
|
||||
QDomElement schild = child.firstChild().toElement();
|
||||
while (!schild.isNull()) {
|
||||
if (schild.tagName() == "sceneUpVector")
|
||||
setSceneUpVector(Vec(schild));
|
||||
|
||||
schild = schild.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// M o u s e h a n d l i n g //
|
||||
|
|
|
|||
|
|
@ -302,15 +302,6 @@ public:
|
|||
virtual void checkIfGrabsMouse(int x, int y, const Camera *const camera);
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
#ifndef DOXYGEN
|
||||
protected:
|
||||
Quaternion deformedBallQuaternion(int x, int y, qreal cx, qreal cy,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ namespace qglviewer{
|
|||
CGAL_INLINE_FUNCTION
|
||||
ManipulatedFrame::ManipulatedFrame()
|
||||
: action_(NO_MOUSE_ACTION), keepsGrabbingMouse_(false) {
|
||||
// #CONNECTION# initFromDOMElement and accessor docs
|
||||
setRotationSensitivity(1.0);
|
||||
setTranslationSensitivity(1.0);
|
||||
setSpinningSensitivity(0.3);
|
||||
|
|
@ -101,71 +100,7 @@ void ManipulatedFrame::checkIfGrabsMouse(int x, int y,
|
|||
(fabs(y - proj.y) < thresold)));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// S t a t e s a v i n g a n d r e s t o r i n g //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the ManipulatedFrame.
|
||||
|
||||
Adds to the Frame::domElement() the ManipulatedFrame specific informations in a
|
||||
\c ManipulatedParameters child QDomElement.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
Use initFromDOMElement() to restore the ManipulatedFrame state from the
|
||||
resulting \c QDomElement.
|
||||
|
||||
See Vec::domElement() for a complete example. See also
|
||||
Quaternion::domElement(), Camera::domElement()... */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement ManipulatedFrame::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
QDomElement e = Frame::domElement(name, document);
|
||||
QDomElement mp = document.createElement("ManipulatedParameters");
|
||||
mp.setAttribute("rotSens", QString::number(rotationSensitivity()));
|
||||
mp.setAttribute("transSens", QString::number(translationSensitivity()));
|
||||
mp.setAttribute("spinSens", QString::number(spinningSensitivity()));
|
||||
mp.setAttribute("wheelSens", QString::number(wheelSensitivity()));
|
||||
mp.setAttribute("zoomSens", QString::number(zoomSensitivity()));
|
||||
e.appendChild(mp);
|
||||
return e;
|
||||
}
|
||||
|
||||
/*! Restores the ManipulatedFrame state from a \c QDomElement created by
|
||||
domElement().
|
||||
|
||||
Fields that are not described in \p element are set to their default values (see
|
||||
ManipulatedFrame()).
|
||||
|
||||
First calls Frame::initFromDOMElement() and then initializes ManipulatedFrame
|
||||
specific parameters. Note that constraint() and referenceFrame() are not
|
||||
restored and are left unchanged.
|
||||
|
||||
|
||||
See Vec::initFromDOMElement() for a complete code example. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void ManipulatedFrame::initFromDOMElement(const QDomElement &element) {
|
||||
// Not called since it would set constraint() and referenceFrame() to nullptr.
|
||||
// *this = ManipulatedFrame();
|
||||
Frame::initFromDOMElement(element);
|
||||
|
||||
stopSpinning();
|
||||
|
||||
QDomElement child = element.firstChild().toElement();
|
||||
while (!child.isNull()) {
|
||||
if (child.tagName() == "ManipulatedParameters") {
|
||||
// #CONNECTION# constructor default values and accessor docs
|
||||
setRotationSensitivity(DomUtils::qrealFromDom(child, "rotSens", 1.0));
|
||||
setTranslationSensitivity(
|
||||
DomUtils::qrealFromDom(child, "transSens", 1.0));
|
||||
setSpinningSensitivity(DomUtils::qrealFromDom(child, "spinSens", 0.3));
|
||||
setWheelSensitivity(DomUtils::qrealFromDom(child, "wheelSens", 1.0));
|
||||
setZoomSensitivity(DomUtils::qrealFromDom(child, "zoomSens", 1.0));
|
||||
}
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// M o u s e h a n d l i n g //
|
||||
|
|
|
|||
|
|
@ -921,13 +921,10 @@ protected:
|
|||
//@{
|
||||
public:
|
||||
QString stateFileName() const;
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
Q_SIGNALS:
|
||||
void needNewContext();
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
virtual void saveStateToFile(); // cannot be const because of QMessageBox
|
||||
virtual bool restoreStateFromFile();
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ void CGAL::QGLViewer::defaultConstructor() {
|
|||
// It will be set when setFullScreen(false) is called after
|
||||
// setFullScreen(true)
|
||||
|
||||
// #CONNECTION# default values in initFromDOMElement()
|
||||
manipulatedFrame_ = nullptr;
|
||||
manipulatedFrameIsACamera_ = false;
|
||||
mouseGrabberIsAManipulatedFrame_ = false;
|
||||
|
|
@ -118,7 +117,6 @@ void CGAL::QGLViewer::defaultConstructor() {
|
|||
showEntireScene();
|
||||
setStateFileName(".qglviewer.xml");
|
||||
|
||||
// #CONNECTION# default values in initFromDOMElement()
|
||||
setAxisIsDrawn(false);
|
||||
setGridIsDrawn(false);
|
||||
setFPSIsDisplayed(false);
|
||||
|
|
@ -179,11 +177,6 @@ other viewer's indexes) and allocated memory is released. The camera() is
|
|||
deleted and should be copied before if it is shared by an other viewer. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
CGAL::QGLViewer::~QGLViewer() {
|
||||
// See closeEvent comment. Destructor is called (and not closeEvent) only when
|
||||
// the widget is embedded. Hence we saveToFile here. It is however a bad idea
|
||||
// if virtual domElement() has been overloaded ! if (parent())
|
||||
// saveStateToFileForAllViewers();
|
||||
|
||||
CGAL::QGLViewer::QGLViewerPool().removeAll(this);
|
||||
|
||||
camera()->deleteLater();
|
||||
|
|
@ -656,7 +649,7 @@ void CGAL::QGLViewer::setCameraIsEdited(bool edit) {
|
|||
cameraIsEdited_ = edit;
|
||||
if (edit) {
|
||||
previousCameraZClippingCoefficient_ = camera()->zClippingCoefficient();
|
||||
// #CONNECTION# 5.0 also used in domElement() and in initFromDOMElement().
|
||||
|
||||
camera()->setZClippingCoefficient(5.0);
|
||||
} else
|
||||
camera()->setZClippingCoefficient(previousCameraZClippingCoefficient_);
|
||||
|
|
@ -3569,343 +3562,6 @@ void CGAL::QGLViewer::saveStateToFileForAllViewers() {
|
|||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// S a v e s t a t e b e t w e e n s e s s i o n s //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Returns the state file name. Default value is \c .qglviewer.xml.
|
||||
|
||||
This is the name of the XML file where saveStateToFile() saves the viewer state
|
||||
(camera state, widget geometry, display flags... see domElement()) on exit. Use
|
||||
restoreStateFromFile() to restore this state later (usually in your init()
|
||||
method).
|
||||
|
||||
Setting this value to \c QString() will disable the automatic state file
|
||||
saving that normally occurs on exit.
|
||||
|
||||
If more than one viewer are created by the application, this function will
|
||||
return a numbered file name (as in ".qglviewer1.xml", ".qglviewer2.xml"... using
|
||||
QGLViewer::QGLViewerIndex()) for extra viewers. Each viewer will then read back
|
||||
its own information in restoreStateFromFile(), provided that the viewers are
|
||||
created in the same order, which is usually the case. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QString CGAL::QGLViewer::stateFileName() const {
|
||||
QString name = stateFileName_;
|
||||
|
||||
if (!name.isEmpty() && QGLViewer::QGLViewerIndex(this) > 0) {
|
||||
QFileInfo fi(name);
|
||||
if (fi.suffix().isEmpty())
|
||||
name += QString::number(QGLViewer::QGLViewerIndex(this));
|
||||
else
|
||||
name = fi.absolutePath() + '/' + fi.completeBaseName() +
|
||||
QString::number(QGLViewer::QGLViewerIndex(this)) + "." +
|
||||
fi.suffix();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/*! Saves in stateFileName() an XML representation of the CGAL::QGLViewer state,
|
||||
obtained from domElement().
|
||||
|
||||
Use restoreStateFromFile() to restore this viewer state.
|
||||
|
||||
This method is automatically called when a viewer is closed (using Escape or
|
||||
using the window's upper right \c x close button). setStateFileName() to \c
|
||||
QString() to prevent this. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void CGAL::QGLViewer::saveStateToFile() {
|
||||
QString name = stateFileName();
|
||||
|
||||
if (name.isEmpty())
|
||||
return;
|
||||
|
||||
QFileInfo fileInfo(name);
|
||||
|
||||
if (fileInfo.isDir()) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Save to file error", "Message box window title"),
|
||||
tr("State file name (%1) references a directory instead of a file.")
|
||||
.arg(name));
|
||||
return;
|
||||
}
|
||||
|
||||
const QString dirName = fileInfo.absolutePath();
|
||||
if (!QFileInfo(dirName).exists()) {
|
||||
QDir dir;
|
||||
if (!(dir.mkdir(dirName))) {
|
||||
QMessageBox::warning(this,
|
||||
tr("Save to file error", "Message box window title"),
|
||||
tr("Unable to create directory %1").arg(dirName));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Write the DOM tree to file
|
||||
QFile f(name);
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
QTextStream out(&f);
|
||||
QDomDocument doc("QGLVIEWER");
|
||||
doc.appendChild(domElement("CGAL::QGLViewer", doc));
|
||||
doc.save(out, 2);
|
||||
f.flush();
|
||||
f.close();
|
||||
} else
|
||||
QMessageBox::warning(
|
||||
this, tr("Save to file error", "Message box window title"),
|
||||
tr("Unable to save to file %1").arg(name) + ":\n" + f.errorString());
|
||||
}
|
||||
|
||||
/*! Restores the CGAL::QGLViewer state from the stateFileName() file using
|
||||
initFromDOMElement().
|
||||
|
||||
States are saved using saveStateToFile(), which is automatically called on
|
||||
viewer exit.
|
||||
|
||||
Returns \c true when the restoration is successful. Possible problems are an non
|
||||
existing or unreadable stateFileName() file, an empty stateFileName() or an XML
|
||||
syntax error.
|
||||
|
||||
A manipulatedFrame() should be defined \e before calling this method, so that
|
||||
its state can be restored. Initialization code put \e after this function will
|
||||
override saved values: \code void Viewer::init()
|
||||
{
|
||||
// Default initialization goes here (including the declaration of a possible
|
||||
manipulatedFrame).
|
||||
|
||||
if (!restoreStateFromFile())
|
||||
showEntireScene(); // Previous state cannot be restored: fit camera to scene.
|
||||
|
||||
// Specific initialization that overrides file savings goes here.
|
||||
}
|
||||
\endcode */
|
||||
CGAL_INLINE_FUNCTION
|
||||
bool CGAL::QGLViewer::restoreStateFromFile() {
|
||||
QString name = stateFileName();
|
||||
|
||||
if (name.isEmpty())
|
||||
return false;
|
||||
|
||||
QFileInfo fileInfo(name);
|
||||
|
||||
if (!fileInfo.isFile())
|
||||
// No warning since it would be displayed at first start.
|
||||
return false;
|
||||
|
||||
if (!fileInfo.isReadable()) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Problem in state restoration", "Message box window title"),
|
||||
tr("File %1 is not readable.").arg(name));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read the DOM tree form file
|
||||
QFile f(name);
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QDomDocument doc;
|
||||
doc.setContent(&f);
|
||||
f.close();
|
||||
QDomElement main = doc.documentElement();
|
||||
initFromDOMElement(main);
|
||||
} else {
|
||||
QMessageBox::warning(
|
||||
this, tr("Open file error", "Message box window title"),
|
||||
tr("Unable to open file %1").arg(name) + ":\n" + f.errorString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the CGAL::QGLViewer.
|
||||
|
||||
Used by saveStateToFile(). restoreStateFromFile() uses initFromDOMElement() to
|
||||
restore the CGAL::QGLViewer state from the resulting \c QDomElement.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
The created QDomElement contains state values (axisIsDrawn(), FPSIsDisplayed(),
|
||||
isFullScreen()...), viewer geometry, as well as camera() (see
|
||||
CGAL::qglviewer::Camera::domElement()) and manipulatedFrame() (if defined, see
|
||||
CGAL::qglviewer::ManipulatedFrame::domElement()) states.
|
||||
|
||||
Overload this method to add your own attributes to the state file:
|
||||
\code
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement Viewer::domElement(const QString& name, QDomDocument& document)
|
||||
const
|
||||
{
|
||||
// Creates a custom node for a light
|
||||
QDomElement de = document.createElement("Light");
|
||||
de.setAttribute("state", (lightIsOn()?"on":"off"));
|
||||
// Note the include of the ManipulatedFrame domElement method.
|
||||
de.appendChild(lightManipulatedFrame()->domElement("LightFrame", document));
|
||||
|
||||
// Get default state domElement and append custom node
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement res = CGAL::QGLViewer::domElement(name, document);
|
||||
res.appendChild(de);
|
||||
return res;
|
||||
}
|
||||
\endcode
|
||||
See initFromDOMElement() for the associated restoration code.
|
||||
|
||||
\attention For the manipulatedFrame(), CGAL::qglviewer::Frame::constraint() and
|
||||
CGAL::qglviewer::Frame::referenceFrame() are not saved. See
|
||||
CGAL::qglviewer::Frame::domElement(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement CGAL::QGLViewer::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
QDomElement de = document.createElement(name);
|
||||
|
||||
QDomElement stateNode = document.createElement("State");
|
||||
// hasMouseTracking() is not saved
|
||||
stateNode.appendChild(DomUtils::QColorDomElement(
|
||||
foregroundColor(), "foregroundColor", document));
|
||||
stateNode.appendChild(DomUtils::QColorDomElement(
|
||||
backgroundColor(), "backgroundColor", document));
|
||||
// Revolve or fly camera mode is not saved
|
||||
de.appendChild(stateNode);
|
||||
|
||||
QDomElement displayNode = document.createElement("Display");
|
||||
DomUtils::setBoolAttribute(displayNode, "axisIsDrawn", axisIsDrawn());
|
||||
DomUtils::setBoolAttribute(displayNode, "gridIsDrawn", gridIsDrawn());
|
||||
DomUtils::setBoolAttribute(displayNode, "FPSIsDisplayed", FPSIsDisplayed());
|
||||
DomUtils::setBoolAttribute(displayNode, "cameraIsEdited", cameraIsEdited());
|
||||
// textIsEnabled() is not saved
|
||||
de.appendChild(displayNode);
|
||||
|
||||
QDomElement geometryNode = document.createElement("Geometry");
|
||||
DomUtils::setBoolAttribute(geometryNode, "fullScreen", isFullScreen());
|
||||
if (isFullScreen()) {
|
||||
geometryNode.setAttribute("prevPosX", QString::number(prevPos_.x()));
|
||||
geometryNode.setAttribute("prevPosY", QString::number(prevPos_.y()));
|
||||
} else {
|
||||
QWidget *tlw = topLevelWidget();
|
||||
geometryNode.setAttribute("width", QString::number(tlw->width()));
|
||||
geometryNode.setAttribute("height", QString::number(tlw->height()));
|
||||
geometryNode.setAttribute("posX", QString::number(tlw->pos().x()));
|
||||
geometryNode.setAttribute("posY", QString::number(tlw->pos().y()));
|
||||
}
|
||||
de.appendChild(geometryNode);
|
||||
|
||||
// Restore original Camera zClippingCoefficient before saving.
|
||||
if (cameraIsEdited())
|
||||
camera()->setZClippingCoefficient(previousCameraZClippingCoefficient_);
|
||||
de.appendChild(camera()->domElement("Camera", document));
|
||||
if (cameraIsEdited())
|
||||
// #CONNECTION# 5.0 from setCameraIsEdited()
|
||||
camera()->setZClippingCoefficient(5.0);
|
||||
|
||||
if (manipulatedFrame())
|
||||
de.appendChild(
|
||||
manipulatedFrame()->domElement("ManipulatedFrame", document));
|
||||
|
||||
return de;
|
||||
}
|
||||
|
||||
/*! Restores the CGAL::QGLViewer state from a \c QDomElement created by domElement().
|
||||
|
||||
Used by restoreStateFromFile() to restore the CGAL::QGLViewer state from a file.
|
||||
|
||||
Overload this method to retrieve custom attributes from the CGAL::QGLViewer state
|
||||
file. This code corresponds to the one given in the domElement() documentation:
|
||||
\code
|
||||
CGAL_INLINE_FUNCTION
|
||||
void Viewer::initFromDOMElement(const QDomElement& element)
|
||||
{
|
||||
// Restore standard state
|
||||
CGAL_INLINE_FUNCTION
|
||||
CGAL::QGLViewer::initFromDOMElement(element);
|
||||
|
||||
QDomElement child=element.firstChild().toElement();
|
||||
while (!child.isNull())
|
||||
{
|
||||
if (child.tagName() == "Light")
|
||||
{
|
||||
if (child.hasAttribute("state"))
|
||||
setLightOn(child.attribute("state").toLower() == "on");
|
||||
|
||||
// Assumes there is only one child. Otherwise you need to parse child's children
|
||||
recursively. QDomElement lf = child.firstChild().toElement(); if (!lf.isNull()
|
||||
&& lf.tagName() == "LightFrame")
|
||||
lightManipulatedFrame()->initFromDomElement(lf);
|
||||
}
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
See also CGAL::qglviewer::Camera::initFromDOMElement(),
|
||||
CGAL::qglviewer::ManipulatedFrame::initFromDOMElement().
|
||||
|
||||
\note The manipulatedFrame() \e pointer is not modified by this method. If
|
||||
defined, its state is simply set from the \p element values. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void CGAL::QGLViewer::initFromDOMElement(const QDomElement &element) {
|
||||
QDomElement child = element.firstChild().toElement();
|
||||
bool tmpCameraIsEdited = cameraIsEdited();
|
||||
while (!child.isNull()) {
|
||||
if (child.tagName() == "State") {
|
||||
// #CONNECTION# default values from defaultConstructor()
|
||||
// setMouseTracking(DomUtils::boolFromDom(child, "mouseTracking", false));
|
||||
// if ((child.attribute("cameraMode", "revolve") == "fly") &&
|
||||
// (cameraIsInRevolveMode())) toggleCameraMode();
|
||||
|
||||
QDomElement ch = child.firstChild().toElement();
|
||||
while (!ch.isNull()) {
|
||||
if (ch.tagName() == "foregroundColor")
|
||||
setForegroundColor(DomUtils::QColorFromDom(ch));
|
||||
if (ch.tagName() == "backgroundColor")
|
||||
setBackgroundColor(DomUtils::QColorFromDom(ch));
|
||||
ch = ch.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (child.tagName() == "Display") {
|
||||
// #CONNECTION# default values from defaultConstructor()
|
||||
setAxisIsDrawn(DomUtils::boolFromDom(child, "axisIsDrawn", false));
|
||||
setGridIsDrawn(DomUtils::boolFromDom(child, "gridIsDrawn", false));
|
||||
setFPSIsDisplayed(DomUtils::boolFromDom(child, "FPSIsDisplayed", false));
|
||||
}
|
||||
|
||||
if (child.tagName() == "Geometry") {
|
||||
setFullScreen(DomUtils::boolFromDom(child, "fullScreen", false));
|
||||
|
||||
if (!isFullScreen())
|
||||
{
|
||||
int width = DomUtils::intFromDom(child, "width", 600);
|
||||
int height = DomUtils::intFromDom(child, "height", 400);
|
||||
topLevelWidget()->resize(width, height);
|
||||
camera()->setScreenWidthAndHeight(this->width(), this->height());
|
||||
|
||||
QPoint pos;
|
||||
pos.setX(DomUtils::intFromDom(child, "posX", 0));
|
||||
pos.setY(DomUtils::intFromDom(child, "posY", 0));
|
||||
topLevelWidget()->move(pos);
|
||||
}
|
||||
}
|
||||
|
||||
child = child.nextSibling().toElement();
|
||||
}
|
||||
|
||||
// The Camera always stores its "real" zClippingCoef in domElement(). If it is
|
||||
// edited, its "real" coef must be saved and the coef set to 5.0, as is done
|
||||
// in setCameraIsEdited(). BUT : Camera and Display are read in an arbitrary
|
||||
// order. We must initialize Camera's "real" coef BEFORE calling
|
||||
// setCameraIsEdited. Hence this temp cameraIsEdited and delayed call
|
||||
cameraIsEdited_ = tmpCameraIsEdited;
|
||||
if (cameraIsEdited_) {
|
||||
previousCameraZClippingCoefficient_ = camera()->zClippingCoefficient();
|
||||
// #CONNECTION# 5.0 from setCameraIsEdited.
|
||||
camera()->setZClippingCoefficient(5.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
void CGAL::QGLViewer::copyBufferToTexture(GLint , GLenum ) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,12 +300,6 @@ public:
|
|||
static Quaternion randomQuaternion();
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
explicit Quaternion(const QDomElement &element);
|
||||
QDomElement domElement(const QString &name, QDomDocument &document) const;
|
||||
void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/*! @name Output stream */
|
||||
|
|
|
|||
|
|
@ -211,71 +211,6 @@ qreal Quaternion::angle() const {
|
|||
return (angle <= CGAL_PI) ? angle : 2.0 * CGAL_PI - angle;
|
||||
}
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the Quaternion.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
When output to a file, the resulting QDomElement will look like:
|
||||
\code
|
||||
<name q0=".." q1=".." q2=".." q3=".." />
|
||||
\endcode
|
||||
|
||||
Use initFromDOMElement() to restore the Quaternion state from the resulting \c
|
||||
QDomElement. See also the Quaternion(const QDomElement&) constructor.
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
See the Vec::domElement() documentation for a complete QDomDocument creation
|
||||
and saving example.
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
See also Frame::domElement(), Camera::domElement(),
|
||||
CGAL_INLINE_FUNCTION
|
||||
KeyFrameInterpolator::domElement()... */
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement Quaternion::domElement(const QString &name,
|
||||
QDomDocument &document) const {
|
||||
QDomElement de = document.createElement(name);
|
||||
de.setAttribute("q0", QString::number(q[0]));
|
||||
de.setAttribute("q1", QString::number(q[1]));
|
||||
de.setAttribute("q2", QString::number(q[2]));
|
||||
de.setAttribute("q3", QString::number(q[3]));
|
||||
return de;
|
||||
}
|
||||
|
||||
/*! Restores the Quaternion state from a \c QDomElement created by domElement().
|
||||
|
||||
The \c QDomElement should contain the \c q0, \c q1 , \c q2 and \c q3
|
||||
attributes. If one of these attributes is missing or is not a number, a warning
|
||||
is displayed and these fields are respectively set to 0.0, 0.0, 0.0 and 1.0
|
||||
(identity Quaternion).
|
||||
|
||||
See also the Quaternion(const QDomElement&) constructor. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void Quaternion::initFromDOMElement(const QDomElement &element) {
|
||||
Quaternion q(element);
|
||||
*this = q;
|
||||
}
|
||||
|
||||
/*! Constructs a Quaternion from a \c QDomElement representing an XML code of
|
||||
the form \code< anyTagName q0=".." q1=".." q2=".." q3=".." />\endcode
|
||||
|
||||
If one of these attributes is missing or is not a number, a warning is
|
||||
displayed and the associated value is respectively set to 0, 0, 0 and 1
|
||||
(identity Quaternion).
|
||||
|
||||
See also domElement() and initFromDOMElement(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
Quaternion::Quaternion(const QDomElement &element) {
|
||||
QStringList attribute;
|
||||
attribute << "q0"
|
||||
<< "q1"
|
||||
<< "q2"
|
||||
<< "q3";
|
||||
for (int i = 0; i < attribute.size(); ++i)
|
||||
q[i] = DomUtils::qrealFromDom(element, attribute[i], ((i < 3) ? 0.0 : 1.0));
|
||||
}
|
||||
|
||||
/*! Returns the Quaternion associated 4x4 OpenGL rotation matrix.
|
||||
|
||||
Use \c glMultMatrixd(q.matrix()) to apply the rotation represented by
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
#include <QDomElement>
|
||||
|
||||
// Included by all files as vec.h is at the end of the include hierarchy
|
||||
#include <CGAL/export/Qt.h>
|
||||
|
||||
|
|
@ -334,12 +332,6 @@ Normalizing a null vector will result in \c NaN values. */
|
|||
void projectOnPlane(const Vec &normal);
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
explicit Vec(const QDomElement &element);
|
||||
QDomElement domElement(const QString &name, QDomDocument &document) const;
|
||||
void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/*! @name Output stream */
|
||||
|
|
|
|||
|
|
@ -72,100 +72,6 @@ Vec Vec::orthogonalVec() const {
|
|||
return Vec(-y, x, 0.0);
|
||||
}
|
||||
|
||||
/*! Constructs a Vec from a \c QDomElement representing an XML code of the form
|
||||
\code< anyTagName x=".." y=".." z=".." />\endcode
|
||||
|
||||
If one of these attributes is missing or is not a number, a warning is displayed
|
||||
and the associated value is set to 0.0.
|
||||
|
||||
See also domElement() and initFromDOMElement(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
Vec::Vec(const QDomElement &element) {
|
||||
QStringList attribute;
|
||||
attribute << "x"
|
||||
<< "y"
|
||||
<< "z";
|
||||
for (int i = 0; i < attribute.size(); ++i)
|
||||
#ifdef QGLVIEWER_UNION_NOT_SUPPORTED
|
||||
this->operator[](i) = DomUtils::qrealFromDom(element, attribute[i], 0.0);
|
||||
#else
|
||||
v_[i] = DomUtils::qrealFromDom(element, attribute[i], 0.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! Returns an XML \c QDomElement that represents the Vec.
|
||||
|
||||
\p name is the name of the QDomElement tag. \p doc is the \c QDomDocument
|
||||
factory used to create QDomElement.
|
||||
|
||||
When output to a file, the resulting QDomElement will look like:
|
||||
\code
|
||||
<name x=".." y=".." z=".." />
|
||||
\endcode
|
||||
|
||||
Use initFromDOMElement() to restore the Vec state from the resulting \c
|
||||
QDomElement. See also the Vec(const QDomElement&) constructor.
|
||||
|
||||
Here is complete example that creates a QDomDocument and saves it into a file:
|
||||
\code
|
||||
Vec sunPos;
|
||||
QDomDocument document("myDocument");
|
||||
QDomElement sunElement = document.createElement("Sun");
|
||||
document.appendChild(sunElement);
|
||||
sunElement.setAttribute("brightness", sunBrightness());
|
||||
sunElement.appendChild(sunPos.domElement("sunPosition", document));
|
||||
// Other additions to the document hierarchy...
|
||||
|
||||
// Save doc document
|
||||
QFile f("myFile.xml");
|
||||
if (f.open(IO_WriteOnly))
|
||||
{
|
||||
QTextStream out(&f);
|
||||
document.save(out, 2);
|
||||
f.close();
|
||||
}
|
||||
\endcode
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
See also Quaternion::domElement(), Frame::domElement(), Camera::domElement()...
|
||||
*/
|
||||
CGAL_INLINE_FUNCTION
|
||||
QDomElement Vec::domElement(const QString &name, QDomDocument &document) const {
|
||||
QDomElement de = document.createElement(name);
|
||||
de.setAttribute("x", QString::number(x));
|
||||
de.setAttribute("y", QString::number(y));
|
||||
de.setAttribute("z", QString::number(z));
|
||||
return de;
|
||||
}
|
||||
|
||||
/*! Restores the Vec state from a \c QDomElement created by domElement().
|
||||
|
||||
The \c QDomElement should contain \c x, \c y and \c z attributes. If one of
|
||||
these attributes is missing or is not a number, a warning is displayed and the
|
||||
associated value is set to 0.0.
|
||||
|
||||
To restore the Vec state from an xml file, use:
|
||||
\code
|
||||
// Load DOM from file
|
||||
QDomDocument doc;
|
||||
QFile f("myFile.xml");
|
||||
if (f.open(IO_ReadOnly))
|
||||
{
|
||||
doc.setContent(&f);
|
||||
f.close();
|
||||
}
|
||||
// Parse the DOM tree and initialize
|
||||
QDomElement main=doc.documentElement();
|
||||
myVec.initFromDOMElement(main);
|
||||
\endcode
|
||||
|
||||
See also the Vec(const QDomElement&) constructor. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void Vec::initFromDOMElement(const QDomElement &element) {
|
||||
const Vec v(element);
|
||||
*this = v;
|
||||
}
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
std::ostream &operator<<(std::ostream &o, const Vec &v) {
|
||||
return o << v.x << '\t' << v.y << '\t' << v.z;
|
||||
|
|
|
|||
|
|
@ -1157,7 +1157,7 @@ if(CGAL_BRANCH_BUILD)
|
|||
find_package(GMP REQUIRED)
|
||||
find_package(Doxygen REQUIRED)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Widgets Xml OpenGL Gui REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Widgets OpenGL Gui REQUIRED)
|
||||
find_package(VTK COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE)
|
||||
find_package(IPE)
|
||||
find_package(RS3)
|
||||
|
|
@ -1168,10 +1168,9 @@ if(CGAL_BRANCH_BUILD)
|
|||
set(compile_options
|
||||
"\
|
||||
${CMAKE_CXX_FLAGS} -DCGAL_EIGEN3_ENABLED -DCGAL_PROFILE \
|
||||
${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5OpenGL_DEFINITIONS} ${Qt5Gui_DEFINITIONS} \
|
||||
${Qt5Widgets_DEFINITIONS} ${Qt5OpenGL_DEFINITIONS} ${Qt5Gui_DEFINITIONS} \
|
||||
${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS} -fPIC \
|
||||
${Qt5Gui_EXECUTABLE_COMPILE_FLAGS} \
|
||||
${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} \
|
||||
${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_Qt5_3RD_PARTY_DEFINITIONS} \
|
||||
${CGAL_DEFINITIONS}")
|
||||
message("COMPILATION OPTIONS ARE : ${compile_options}")
|
||||
|
|
@ -1267,7 +1266,6 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.")
|
|||
${GMP_INCLUDE_DIR}
|
||||
${Qt5OpenGL_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${Qt5Xml_INCLUDE_DIRS}
|
||||
${Qt5Gui_DEFINITIONS}
|
||||
${CGAL_3RD_PARTY_INCLUDE_DIRS}
|
||||
${CGAL_Qt5_3RD_PARTY_INCLUDE_DIRS})
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ add_definitions(-DCGAL_PROFILE_LCC_DEMO)
|
|||
##################
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
|
||||
|
||||
if(NOT
|
||||
(CGAL_Qt5_FOUND
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ endif()
|
|||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
# Find Qt5 itself
|
||||
find_package(Qt5 QUIET COMPONENTS Xml OpenGL Help Core)
|
||||
find_package(Qt5 QUIET COMPONENTS OpenGL Help Core)
|
||||
|
||||
if(Qt5_FOUND)
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ set(CMAKE_AUTOMOC ON)
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script Help OpenGL Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script Help OpenGL Svg)
|
||||
|
||||
if(Qt5Help_VERSION VERSION_LESS 5.12)
|
||||
set(CGAL_QCOLLECTIONGENERATOR_TARGET Qt5::qcollectiongenerator)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ include(${CGAL_USE_FILE})
|
|||
|
||||
find_package(
|
||||
Qt5 QUIET
|
||||
COMPONENTS OpenGL Script Xml
|
||||
COMPONENTS OpenGL Script
|
||||
OPTIONAL_COMPONENTS ScriptTools WebSockets)
|
||||
|
||||
set_package_properties(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5 ImageIO)
|
|||
# Find Qt5 itself
|
||||
find_package(
|
||||
Qt5 QUIET
|
||||
COMPONENTS OpenGL Script Svg Xml
|
||||
COMPONENTS OpenGL Script Svg
|
||||
OPTIONAL_COMPONENTS ScriptTools WebSockets)
|
||||
|
||||
if(RUNNING_CGAL_AUTO_TEST)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
|||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Widgets Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL Widgets Svg)
|
||||
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ if(NOT TARGET CGAL::Eigen3_support)
|
|||
endif()
|
||||
|
||||
# Find Qt5 itself
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
||||
find_package(Qt5 QUIET COMPONENTS Script OpenGL)
|
||||
|
||||
if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ endforeach()
|
|||
|
||||
include_directories(./)
|
||||
|
||||
# QGLViwer needs Qt5 configured with QtOpenGL and QtXml support
|
||||
# QGLViewer needs Qt5 configured with QtOpenGL
|
||||
|
||||
find_package(CGAL REQUIRED COMPONENTS ImageIO Qt5)
|
||||
if(CGAL_Qt5_FOUND AND CGAL_ImageIO_FOUND)
|
||||
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS OpenGL Xml Svg)
|
||||
find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
|
||||
find_package(OpenGL)
|
||||
|
||||
if(Qt5_FOUND
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ set(CMAKE_AUTOMOC ON)
|
|||
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
find_package(Qt5 QUIET COMPONENTS OpenGL Xml)
|
||||
find_package(Qt5 QUIET COMPONENTS OpenGL)
|
||||
|
||||
if(Qt5_FOUND)
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
|
@ -70,7 +70,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
|
|||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS T3_demo)
|
||||
|
||||
target_link_libraries(T3_demo PRIVATE CGAL::CGAL CGAL::CGAL_Qt5)
|
||||
target_link_libraries(T3_demo PRIVATE Qt5::OpenGL Qt5::Xml)
|
||||
target_link_libraries(T3_demo PRIVATE Qt5::OpenGL)
|
||||
if(TARGET CGAL::TBB_support)
|
||||
target_link_libraries(T3_demo PUBLIC CGAL::TBB_support)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in New Issue