-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# This is the CMake script for compiling a CGAL application. | ||
|
||
cmake_minimum_required(VERSION 3.1...3.23) | ||
project(Globus_demo) | ||
|
||
if(NOT POLICY CMP0070 AND POLICY CMP0053) | ||
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. | ||
cmake_policy(SET CMP0053 OLD) | ||
endif() | ||
|
||
if(POLICY CMP0071) | ||
cmake_policy(SET CMP0071 NEW) | ||
endif() | ||
|
||
# General | ||
set(GLOBUS_MODULES_REL_DIR cmake/modules) | ||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/${GLOBUS_MODULES_REL_DIR}) | ||
|
||
find_package(CGAL QUIET COMPONENTS Qt5 OPTIONAL_COMPONENTS Core) | ||
find_package(Qt5 QUIET COMPONENTS Gui Widgets) | ||
find_package(FileGDBAPI REQUIRED) | ||
|
||
if (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND) | ||
include(${CGAL_USE_FILE}) | ||
add_compile_definitions(QT_NO_KEYWORDS) | ||
include_directories( BEFORE ./ ) | ||
include_directories(${FileGDBAPI_INCLUDE_DIR}) | ||
|
||
# Arrangement package includes | ||
add_definitions(-DQT_NO_KEYWORDS) | ||
option(COMPILE_UTILS_INCREMENTALLY | ||
"Compile files in Utils directory incrementally, or compile them all as a unit. \ | ||
Incremental compilation will be better for development and consume less \ | ||
memory while compiling but will take longer to compile." | ||
OFF) | ||
|
||
set(UTILS_SOURCE_FILES "") | ||
|
||
if (COMPILE_UTILS_INCREMENTALLY) | ||
set(UTILS_COMPILE_FILES ${UTILS_SOURCE_FILES}) | ||
else() | ||
set(UTILS_CPP_FILES_INCLUDES "") | ||
foreach(utils_src IN LISTS UTILS_SOURCE_FILES) | ||
string(APPEND UTILS_CPP_FILES_INCLUDES "#include \"${utils_src}\"\n") | ||
endforeach() | ||
file(WRITE "${CMAKE_BINARY_DIR}/CombinedUtils.cpp" ${UTILS_CPP_FILES_INCLUDES}) | ||
set(UTILS_COMPILE_FILES "${CMAKE_BINARY_DIR}/CombinedUtils.cpp") | ||
endif() | ||
|
||
|
||
qt5_wrap_ui(globus_uis | ||
Globus_window.ui) | ||
|
||
qt5_wrap_cpp(CGAL_Qt5_MOC_FILES | ||
Globus_window.h) | ||
|
||
qt5_add_resources(CGAL_Qt5_RESOURCE_FILES Globus.qrc) | ||
|
||
add_executable(globus | ||
globus.cpp | ||
Globus_window.cpp | ||
${UTILS_COMPILE_FILES} | ||
${globus_uis} | ||
${CGAL_Qt5_RESOURCE_FILES} | ||
${CGAL_Qt5_MOC_FILES}) | ||
|
||
target_link_libraries(globus ${FileGDBAPI_LIBRARY}) | ||
target_link_libraries(globus Qt5::Core Qt5::Gui Qt5::Widgets) | ||
target_link_libraries(globus CGAL::CGAL CGAL::CGAL_Qt5) | ||
if(CGAL_Core_FOUND) | ||
target_link_libraries(globus CGAL::CGAL_Core) | ||
endif() | ||
|
||
add_to_cached_list(CGAL_EXECUTABLE_TARGETS globus) | ||
|
||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) | ||
cgal_add_compilation_test(globus) | ||
|
||
set_property(TARGET globus PROPERTY INSTALL_RPATH "${FileGDBAPI_LIBRARY_DIR}") | ||
set_property(TARGET globus PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
|
||
set_target_properties(globus PROPERTIES LINK_FLAGS "-Wl,--disable-new-dtags") | ||
|
||
else() | ||
set(MISSING_DEPS "") | ||
|
||
if(NOT CGAL_FOUND) | ||
set(MISSING_DEPS "CGAL, ${MISSING_DEPS}") | ||
endif() | ||
if(NOT CGAL_Qt5_FOUND) | ||
set(MISSING_DEPS "the CGAL Qt5 library, ${MISSING_DEPS}") | ||
endif() | ||
if(NOT Qt5_FOUND) | ||
set(MISSING_DEPS "Qt5, ${MISSING_DEPS}") | ||
endif() | ||
message(STATUS | ||
"NOTICE: This demo requires ${MISSING_DEPS} and will not be compiled.") | ||
endif() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<RCC> | ||
<qresource prefix="/cgal/icons"> | ||
<file alias="zoomin.xpm">resources/icons/zoomin.xpm</file> | ||
<file alias="zoomout.xpm">resources/icons/zoomout.xpm</file> | ||
<file alias="zoomreset.xpm">resources/icons/zoomreset.xpm</file> | ||
<file alias="yellow_icon.xpm">resources/icons/yellow_icon.xpm</file> | ||
<file alias="red_icon.xpm">resources/icons/red_icon.xpm</file> | ||
<file alias="green_icon.xpm">resources/icons/green_icon.xpm</file> | ||
<file alias="blue_icon.xpm">resources/icons/blue_icon.xpm</file> | ||
<file alias="pink_icon.xpm">resources/icons/pink_icon.xpm</file> | ||
<file alias="hand.xpm">resources/icons/hand.xpm</file> | ||
|
||
<file alias="delete.xpm">resources/icons/delete.xpm</file> | ||
</qresource> | ||
<qresource prefix="/cgal/Globus"> | ||
<file alias="about.html">resources/about.html</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
// Copyright (c) 2022 Tel-Aviv University (Israel). | ||
// All rights reserved. | ||
// | ||
// This file is part of CGAL (www.cgal.org). | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial | ||
// | ||
// Author(s): Efi Fogel <[email protected]> | ||
|
||
#include <QActionGroup> | ||
#include <QColorDialog> | ||
#include <QFileDialog> | ||
#include <QInputDialog> | ||
#include <QMessageBox> | ||
#include <QString> | ||
#include <QGraphicsView> | ||
#include <QLabel> | ||
|
||
#include <CGAL/Qt/GraphicsViewNavigation.h> | ||
|
||
#include "Globus_window.h" | ||
#include "ui_Globus_window.h" | ||
|
||
//! \brief constructs | ||
Globus_window::Globus_window(QWidget* parent) : | ||
CGAL::Qt::DemosMainWindow(parent), ui(new Ui::Globus_window) { | ||
this->setup_ui(); | ||
// this->setupStatusBar(); | ||
// this->setupOptionsMenu(); | ||
this->addAboutDemo(":/cgal/Arrangement_on_surface_2/about.html"); | ||
this->addAboutCGAL(); | ||
} | ||
|
||
//! \brief destructs | ||
Globus_window::~Globus_window() {} | ||
|
||
//! \brief | ||
void Globus_window::setup_ui() { | ||
this->ui->setupUi(this); | ||
|
||
this->mode_group = new QActionGroup(this); | ||
this->mode_group->addAction(this->ui->action_drag); | ||
} | ||
|
||
//! \brief | ||
// void Globus_window::resetActionGroups(ArrangementDemoTab* tab, TraitsType tt) { | ||
// this->hideInsertMethods(); | ||
// this->ui->actionInsert->setChecked(false); | ||
// this->ui->actionDrag->setChecked(false); | ||
// this->ui->actionLowerEnvelope->setChecked(false); | ||
// this->ui->actionUpperEnvelope->setChecked(false); | ||
// this->ui->actionShowGrid->setChecked(tab->isGridVisible()); | ||
// this->ui->actionGridSnapMode->setChecked(tab->isSnapToGridEnabled()); | ||
// this->ui->actionArrangementSnapMode->setChecked( | ||
// tab->isSnapToArrangementEnabled()); | ||
// this->ui->actionLowerEnvelope->setChecked(tab->isLowerEnvelopeShown()); | ||
// this->ui->actionUpperEnvelope->setChecked(tab->isUpperEnvelopeShown()); | ||
|
||
// if ( | ||
// tt != TraitsType::SEGMENT_TRAITS && tt != TraitsType::POLYLINE_TRAITS && | ||
// tt != TraitsType::LINEAR_TRAITS) | ||
// this->ui->actionArrangementSnapMode->setVisible(false); | ||
// else | ||
// this->ui->actionArrangementSnapMode->setVisible(true); | ||
|
||
// // default action group is scrolling | ||
// this->ui->actionDrag->activate(QAction::Trigger); | ||
// } | ||
|
||
//! \brief | ||
// void Globus_window::reset_callback_state(ArrangementDemoTab* tab) { | ||
// if (tab) { | ||
// tab->getView()->setDragMode(QGraphicsView::NoDrag); | ||
// tab->unhookCallbacks(); | ||
// } | ||
// } | ||
|
||
//! \brief | ||
void Globus_window::on_action_quit_triggered() { qApp->exit(); } | ||
|
||
//! \brief | ||
void Globus_window::on_action_open_triggered() { | ||
const QString filename = | ||
QFileDialog::getOpenFileName(this, tr("Open file"), "", | ||
"Globus files (*.gdb)"); | ||
if (filename.isNull()) return; | ||
|
||
if (filename.endsWith(".gdb")) { | ||
QMessageBox::information(this, "Oops", "Not implemented yet"); | ||
// auto tab = this->openArrFile(filename); | ||
// if (tab) { | ||
// tab->setParent(this); | ||
// this->addTab(tab, this->makeTabLabel(tab->traitsType())); | ||
// tab->adjustViewport(); | ||
// } | ||
} | ||
else { | ||
QMessageBox::information(this, "Oops", "Unsupported file format"); | ||
} | ||
} | ||
|
||
//! \brief | ||
void Globus_window::on_action_preferences_triggered() { | ||
// ArrangementDemoPropertiesDialog dialog{this}; | ||
|
||
// if (dialog.exec() == QDialog::Accepted) { | ||
// typedef ArrangementDemoPropertiesDialog Dialog; | ||
// ArrangementDemoTab::Preferences pref; | ||
|
||
// pref.edgeColor = dialog.property(Dialog::EDGE_COLOR_KEY).value<QColor>(); | ||
// pref.edgeWidth = | ||
// dialog.property(Dialog::EDGE_WIDTH_KEY).value<unsigned int>(); | ||
// pref.vertexColor = | ||
// dialog.property(Dialog::VERTEX_COLOR_KEY).value<QColor>(); | ||
// pref.vertexRadius = | ||
// dialog.property(Dialog::VERTEX_RADIUS_KEY).value<unsigned int>(); | ||
// pref.envelopeEdgeColor = | ||
// dialog.property(Dialog::ENVELOPE_EDGE_COLOR_KEY).value<QColor>(); | ||
// pref.envelopeEdgeWidth = | ||
// dialog.property(Dialog::ENVELOPE_EDGE_WIDTH_KEY).value<unsigned int>(); | ||
// pref.envelopeVertexColor = | ||
// dialog.property(Dialog::ENVELOPE_VERTEX_COLOR_KEY).value<QColor>(); | ||
// pref.envelopeVertexRadius = | ||
// dialog.property(Dialog::ENVELOPE_VERTEX_RADIUS_KEY).value<unsigned int>(); | ||
// pref.verticalRayEdgeColor = | ||
// dialog.property(Dialog::VERTICAL_RAY_EDGE_COLOR_KEY).value<QColor>(); | ||
// pref.verticalRayEdgeWidth = | ||
// dialog.property(Dialog::VERTICAL_RAY_EDGE_WIDTH_KEY) | ||
// .value<unsigned int>(); | ||
// pref.axesColor = dialog.property(Dialog::GRID_COLOR_KEY).value<QColor>(); | ||
// pref.gridColor = pref.axesColor; | ||
// pref.gridColor.setAlphaF(0.5); | ||
// currentTab->updatePreferences(pref); | ||
// } | ||
} | ||
|
||
//! \brief | ||
void Globus_window::on_action_save_as_triggered() { | ||
QMessageBox::information(this, "Save as", "Not implemented yet"); | ||
} | ||
|
||
//! \brief | ||
void Globus_window::on_action_zoom_in_triggered() { | ||
// QGraphicsView* view = currentTab->getView(); | ||
// view->scale(2.0, 2.0); | ||
} | ||
|
||
//! \brief | ||
void Globus_window::on_action_zoom_out_triggered() { | ||
// QGraphicsView* view = currentTab->getView(); | ||
// view->scale(0.5, 0.5); | ||
} | ||
|
||
//! \brief | ||
void Globus_window::on_action_zoom_reset_triggered() { | ||
// currentTab->adjustViewport(); | ||
} | ||
|
||
void Globus_window::on_action_drag_toggled(bool checked) { | ||
// TODO: Move this to DemoTab | ||
// QGraphicsView* activeView = currentTab->getView(); | ||
// if (!checked) | ||
// activeView->setDragMode(QGraphicsView::NoDrag); | ||
// else | ||
// activeView->setDragMode(QGraphicsView::ScrollHandDrag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) 2022 Tel-Aviv University (Israel). | ||
// All rights reserved. | ||
// | ||
// This file is part of CGAL (www.cgal.org). | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial | ||
// | ||
// Author(s): Efi Fogel <[email protected]> | ||
|
||
#ifndef GLOBUS_WINDOW_H | ||
#define GLOBUS_WINDOW_H | ||
|
||
#include <utility> | ||
#include <vector> | ||
|
||
#include <Qt> | ||
|
||
#include <CGAL/Object.h> | ||
#include <CGAL/Qt/DemosMainWindow.h> | ||
|
||
namespace Ui { class Globus_window; } | ||
|
||
namespace CGAL { | ||
class Object; | ||
namespace Qt { | ||
class GraphicsViewNavigation; | ||
} | ||
} | ||
|
||
class QActionGroup; | ||
|
||
class Globus_window : public CGAL::Qt::DemosMainWindow { | ||
Q_OBJECT | ||
|
||
public: | ||
Globus_window(QWidget* parent = nullptr); | ||
~Globus_window(); | ||
|
||
public Q_SLOTS: | ||
void on_action_quit_triggered(); | ||
void on_action_open_triggered(); | ||
void on_action_save_as_triggered(); | ||
void on_action_preferences_triggered(); | ||
void on_action_zoom_in_triggered(); | ||
void on_action_zoom_out_triggered(); | ||
void on_action_zoom_reset_triggered(); | ||
void on_action_drag_toggled(bool); | ||
|
||
Q_SIGNALS: | ||
|
||
protected: | ||
void setup_ui(); | ||
|
||
private: | ||
Ui::Globus_window* ui; | ||
QActionGroup* mode_group; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.