Merge branch 'dev' into 'main'
Dev See merge request p2406187/sae201!20
This commit is contained in:
commit
5df8be4fba
3
data.qrc
3
data.qrc
@ -20,4 +20,7 @@
|
||||
<file>data/images/underline.png</file>
|
||||
<file>data/images/add.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/data/filejson">
|
||||
<file>data/parcours1.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
100
data/parcours.html
Normal file
100
data/parcours.html
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Carte du parcours</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: whitesmoke ;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 60%;
|
||||
border-radius: 5%;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
#fiche {
|
||||
width: 40%;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #aaa;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
background-color:#095228;
|
||||
border-radius: 5%;
|
||||
}
|
||||
body h1 {
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
text-align: center;
|
||||
color: blue;
|
||||
font-style: bold;
|
||||
margin-bottom: 20px;
|
||||
background-color:#70726e;
|
||||
border-radius:12px;
|
||||
height: 75px;
|
||||
}
|
||||
#fiche h2{
|
||||
color:white;
|
||||
}
|
||||
#fiche p{
|
||||
color:white;
|
||||
}
|
||||
#fiche img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fiche du parcours</h1>
|
||||
<div id="container">
|
||||
<div id="map"></div>
|
||||
<div id="fiche">
|
||||
<h2>parcous1</h2>
|
||||
<p><strong>Ville :</strong> Bourg en bresse</p>
|
||||
<p><strong>Département :</strong> 1</p>
|
||||
<p><strong>Difficulté :</strong> 2</p>
|
||||
<p><strong>Durée (heures) :</strong> 2.3</p>
|
||||
<p><strong>Longueur (km) :</strong> 17.3</p>
|
||||
<img src="data/parcours1.png">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
<script>
|
||||
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
L.marker([45.62, -1.03348]).addTo(map).bindPopup("<b>Étape 1</b><br><b>Personnages :</b><ul><li>Quentin</li><li>Malo</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||
L.marker([-45.62, 1.03348]).addTo(map).bindPopup("<b>Étape 2</b><br><b>Personnages :</b><ul><li>Antoine</li><li>Giovanni</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||
var latlngs = [
|
||||
[45.62, -1.03348],
|
||||
[-45.62, 1.03348],
|
||||
];
|
||||
|
||||
var polyline = L.polyline(latlngs, {
|
||||
color: 'purple',
|
||||
weight: 2,
|
||||
dashArray: '10, 10',
|
||||
opacity: 0.7
|
||||
}).addTo(map);
|
||||
map.fitBounds(polyline.getBounds());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -5,7 +5,7 @@
|
||||
"difficulty": 2,
|
||||
"duration": 2.3,
|
||||
"length": 17.3,
|
||||
"image": "data/parcours1.png",
|
||||
"image": "../data/parcours1.png",
|
||||
"steps": [
|
||||
{
|
||||
"numero": 1,
|
||||
|
||||
53
index.html
Normal file
53
index.html
Normal file
@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Liste des parcours</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial;
|
||||
margin: 40px;
|
||||
background-color: whitesmoke;
|
||||
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: black;
|
||||
font-style: bold;
|
||||
}
|
||||
ul {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
li {
|
||||
background: white;
|
||||
margin: 10px 0;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 6px rgba(0,0,0,0.1);
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
li:hover {
|
||||
background-color:black;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: purple;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Liste des parcours</h1>
|
||||
<ul>
|
||||
<li><a href="./pages/parcours1.html">parcous1</a></li>
|
||||
<li><a href="./pages/parcours2.html">Chemin des</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
9
main.cpp
9
main.cpp
@ -1,16 +1,19 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "path.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <step.h>
|
||||
#include <QFile>
|
||||
|
||||
#include <web.h>
|
||||
using namespace std;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
QStringList fichiers = {"data/parcours1.json", "data/parcours2.json"};
|
||||
w.loadAndExportPaths(fichiers);
|
||||
Web u(w.getPath());
|
||||
u.siteHtml();
|
||||
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
|
||||
268
mainwindow.cpp
268
mainwindow.cpp
@ -5,15 +5,15 @@
|
||||
#include "Undo.h"
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <fstream>
|
||||
#include <QLineEdit>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
int MainWindow::indexPath = 0;
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
@ -22,8 +22,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
, Clipboard(QGuiApplication::clipboard())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
indexPath++;
|
||||
currentPath = new Path();
|
||||
|
||||
|
||||
connect(ui->titleEdit, &QLineEdit::editingFinished, this, [this]() {
|
||||
static QString previousText;
|
||||
QString currentText = ui->titleEdit->text();
|
||||
@ -65,16 +67,11 @@ MainWindow::~MainWindow()
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updatePathView()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
void MainWindow::updateStepView(size_t num)
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
void MainWindow::onTextChanged()
|
||||
{
|
||||
@ -152,19 +149,209 @@ void MainWindow::loadStep(Step s) {
|
||||
|
||||
void MainWindow::addNewPath()
|
||||
{
|
||||
|
||||
path.append(currentPath);
|
||||
}
|
||||
|
||||
void MainWindow::addNewStep()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::exportHTMLMap()
|
||||
void MainWindow::exportHTMLMap(int index)
|
||||
{
|
||||
std::ofstream file("./pages/parcours" + std::to_string(index) + ".html");
|
||||
|
||||
if (!file.is_open()) {
|
||||
QMessageBox::warning(this, "Erreur", "Impossible d'ouvrir le fichier.");
|
||||
return;
|
||||
}
|
||||
|
||||
file << R"(<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Carte du parcours</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 60%;
|
||||
border-radius: 5%;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
#fiche {
|
||||
padding-right:20px;
|
||||
width: 40%;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #aaa;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
background-color:#095228;
|
||||
border-radius: 5%;
|
||||
}
|
||||
#fiche ul {
|
||||
padding-left: 20px;
|
||||
list-style-type: disc;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
#fiche li {
|
||||
white-space: normal;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
body h1 {
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
text-align: center;
|
||||
color: black;
|
||||
font-style: bold;
|
||||
margin-bottom: 20px;
|
||||
background-color:brown;
|
||||
border-radius:12px;
|
||||
height: 75px;
|
||||
}
|
||||
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||
color: white;
|
||||
}
|
||||
#fiche img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fiche du parcours</h1>
|
||||
<div id="container">
|
||||
<div id="map"></div>
|
||||
<div id="fiche">
|
||||
)";
|
||||
|
||||
if (currentPath) {
|
||||
Path* p = currentPath;
|
||||
file << "<h2>" << p->getName().toStdString() << "</h2>\n";
|
||||
file << "<p><strong>Ville :</strong> " << p->getCity().toStdString() << "</p>\n";
|
||||
file << "<p><strong>Département :</strong> " << p->getDepartement() << "</p>\n";
|
||||
file << "<p><strong>Difficulté :</strong> " << p->getDifficulty() << "</p>\n";
|
||||
file << "<p><strong>Durée (heures) :</strong> " << p->getDuration() << "</p>\n";
|
||||
file << "<p><strong>Longueur (km) :</strong> " << p->getLength() << "</p>\n";
|
||||
if (!p->getImage().isEmpty()) {
|
||||
file << "<img src=\"" << p->getImage().toStdString() << "\">\n";
|
||||
}
|
||||
int stepNum = 1;
|
||||
for (const Step& s : p->getStep()) {
|
||||
file << "<h3>Étape " << stepNum << "</h3>\n";
|
||||
const QList<QString> persos = s.getPersonnage();
|
||||
const QList<QString> textes = s.getTexte();
|
||||
|
||||
if (!persos.isEmpty()) {
|
||||
file << "<p><strong>Personnages :</strong></p>\n<ul>";
|
||||
for (const QString& pers : persos) {
|
||||
file << "<li>" << pers.toStdString() << "</li>\n";
|
||||
}
|
||||
file << "</ul>\n";
|
||||
}
|
||||
|
||||
if (!textes.isEmpty()) {
|
||||
file << "<p><strong>Dialogues :</strong></p>\n<ul>";
|
||||
for (const QString& txt : textes) {
|
||||
file << "<li>" << txt.toStdString() << "</li>\n";
|
||||
}
|
||||
file << "</ul>\n";
|
||||
}
|
||||
|
||||
stepNum++;
|
||||
}
|
||||
}
|
||||
|
||||
file << R"(
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
<script>
|
||||
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
)";
|
||||
|
||||
if (!path.isEmpty() && path[0]) {
|
||||
Path* p = path[0];
|
||||
int stepNum = 1;
|
||||
|
||||
for (const Step& s : p->getStep()) {
|
||||
float lat = s.getLatitude();
|
||||
float lon = s.getLongitude();
|
||||
QList<QString> personnages = s.getPersonnage();
|
||||
QList<QString> textes = s.getTexte();
|
||||
QString popupHtml = "<b>Étape " + QString::number(stepNum) + "</b><br>";
|
||||
if (!personnages.isEmpty()) {
|
||||
popupHtml += "<b>Personnages :</b><ul>";
|
||||
for (const QString& pers : personnages) {
|
||||
popupHtml += "<li>" + pers + "</li>";
|
||||
}
|
||||
popupHtml += "</ul>";
|
||||
}
|
||||
if (!textes.isEmpty()) {
|
||||
popupHtml += "<b>Textes :</b><ul>";
|
||||
for (const QString& txt : textes) {
|
||||
popupHtml += "<li>" + txt + "</li>";
|
||||
}
|
||||
popupHtml += "</ul>";
|
||||
}
|
||||
|
||||
file << "L.marker([" << lat << ", " << lon << "]).addTo(map)"
|
||||
<< ".bindPopup(\"" << popupHtml.toStdString() << "\");\n";
|
||||
|
||||
++stepNum;
|
||||
}
|
||||
|
||||
file << "var latlngs = [\n";
|
||||
for (const Step& s : p->getStep()) {
|
||||
float lat = s.getLatitude();
|
||||
float lon = s.getLongitude();
|
||||
file << " [" << lat << ", " << lon << "],\n";
|
||||
}
|
||||
file << "];\n";
|
||||
|
||||
file << R"(
|
||||
var polyline = L.polyline(latlngs, {
|
||||
color: 'purple',
|
||||
weight: 2,
|
||||
dashArray: '10, 10',
|
||||
opacity: 0.7
|
||||
}).addTo(map);
|
||||
map.fitBounds(polyline.getBounds());
|
||||
)";
|
||||
}
|
||||
|
||||
file << R"(
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
)";
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::loadImage(QString fileName) {
|
||||
QString ext[] = {"png", "jpeg", "jpg"};
|
||||
|
||||
@ -218,6 +405,45 @@ void MainWindow::on_toolButton_clicked()
|
||||
loadImage(fileName);
|
||||
}
|
||||
|
||||
int MainWindow::getIndexPath() const
|
||||
{
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
void MainWindow::setIndexPath(int newIndexPath)
|
||||
{
|
||||
indexPath = newIndexPath;
|
||||
}
|
||||
|
||||
QString MainWindow::getCurrentFile() const
|
||||
{
|
||||
return currentFile;
|
||||
}
|
||||
|
||||
void MainWindow::setCurrentFile(const QString &newCurrentFile)
|
||||
{
|
||||
currentFile = newCurrentFile;
|
||||
}
|
||||
|
||||
QList<Path *> MainWindow::getPath() const
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
void MainWindow::setPath(const QList<Path *> &newPath)
|
||||
{
|
||||
path = newPath;
|
||||
}
|
||||
|
||||
Path *MainWindow::getCurrentPath() const
|
||||
{
|
||||
return currentPath;
|
||||
}
|
||||
|
||||
void MainWindow::setCurrentPath(Path *newCurrentPath)
|
||||
{
|
||||
currentPath = newCurrentPath;
|
||||
}
|
||||
|
||||
void MainWindow::saveFile(){
|
||||
QString fileName;
|
||||
@ -344,3 +570,19 @@ void MainWindow::on_validateBtn_clicked()
|
||||
currentPath->getStep()[ui->stepNumber->value()-1].setResponse(ui->responseSpin->value());
|
||||
}
|
||||
|
||||
void MainWindow::loadAndExportPaths(QStringList fichiers) {
|
||||
|
||||
|
||||
for (const QString& nomFichier : fichiers) {
|
||||
QFile* f = new QFile(nomFichier);
|
||||
|
||||
Path* p = new Path(f);
|
||||
path.append(p);
|
||||
}
|
||||
|
||||
int exportIndex = 1;
|
||||
for (Path* p : path) {
|
||||
currentPath = p;
|
||||
exportHTMLMap(exportIndex++);
|
||||
}
|
||||
}
|
||||
|
||||
12
mainwindow.h
12
mainwindow.h
@ -27,6 +27,17 @@ public:
|
||||
void loadStep(Step s);
|
||||
void addNewPath();
|
||||
void addNewStep();
|
||||
void exportHTMLMap(int index);
|
||||
void loadAndExportPaths(QStringList fichiers);
|
||||
QString getCurrentFile() const;
|
||||
void setCurrentFile(const QString &newCurrentFile);
|
||||
QList<Path *> getPath() const;
|
||||
void setPath(const QList<Path *> &newPath);
|
||||
Path *getCurrentPath() const;
|
||||
void setCurrentPath(Path *newCurrentPath);
|
||||
|
||||
int getIndexPath() const;
|
||||
void setIndexPath(int newIndexPath);
|
||||
void exportHTMLMap();
|
||||
void saveFile();
|
||||
|
||||
@ -56,6 +67,7 @@ private slots:
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QString currentFile;
|
||||
static int indexPath;
|
||||
bool textChanged;
|
||||
QList<Path*> path;
|
||||
Path* currentPath;
|
||||
|
||||
130
pages/parcours1.html
Normal file
130
pages/parcours1.html
Normal file
@ -0,0 +1,130 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Carte du parcours</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 60%;
|
||||
border-radius: 5%;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
#fiche {
|
||||
padding-right:20px;
|
||||
width: 40%;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #aaa;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
background-color:#095228;
|
||||
border-radius: 5%;
|
||||
}
|
||||
#fiche ul {
|
||||
padding-left: 20px;
|
||||
list-style-type: disc;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
#fiche li {
|
||||
white-space: normal;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
body h1 {
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
text-align: center;
|
||||
color: black;
|
||||
font-style: bold;
|
||||
margin-bottom: 20px;
|
||||
background-color:brown;
|
||||
border-radius:12px;
|
||||
height: 75px;
|
||||
}
|
||||
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||
color: white;
|
||||
}
|
||||
#fiche img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fiche du parcours</h1>
|
||||
<div id="container">
|
||||
<div id="map"></div>
|
||||
<div id="fiche">
|
||||
<h2>parcous1</h2>
|
||||
<p><strong>Ville :</strong> Bourg en bresse</p>
|
||||
<p><strong>Département :</strong> 1</p>
|
||||
<p><strong>Difficulté :</strong> 2</p>
|
||||
<p><strong>Durée (heures) :</strong> 2.3</p>
|
||||
<p><strong>Longueur (km) :</strong> 17.3</p>
|
||||
<img src="../data/parcours1.png">
|
||||
<h3>Étape 1</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Quentin</li>
|
||||
<li>Malo</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>ligne de dialogue 1</li>
|
||||
<li>ligne de dialogue 2</li>
|
||||
</ul>
|
||||
<h3>Étape 2</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Antoine</li>
|
||||
<li>Giovanni</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>ligne de dialogue 1</li>
|
||||
<li>ligne de dialogue 2</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
<script>
|
||||
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
L.marker([45.62, -1.03348]).addTo(map).bindPopup("<b>Étape 1</b><br><b>Personnages :</b><ul><li>Quentin</li><li>Malo</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||
L.marker([-45.62, 1.03348]).addTo(map).bindPopup("<b>Étape 2</b><br><b>Personnages :</b><ul><li>Antoine</li><li>Giovanni</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||
var latlngs = [
|
||||
[45.62, -1.03348],
|
||||
[-45.62, 1.03348],
|
||||
];
|
||||
|
||||
var polyline = L.polyline(latlngs, {
|
||||
color: 'purple',
|
||||
weight: 2,
|
||||
dashArray: '10, 10',
|
||||
opacity: 0.7
|
||||
}).addTo(map);
|
||||
map.fitBounds(polyline.getBounds());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
148
pages/parcours2.html
Normal file
148
pages/parcours2.html
Normal file
@ -0,0 +1,148 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Carte du parcours</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 60%;
|
||||
border-radius: 5%;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
#fiche {
|
||||
padding-right:20px;
|
||||
width: 40%;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #aaa;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
background-color:#095228;
|
||||
border-radius: 5%;
|
||||
}
|
||||
#fiche ul {
|
||||
padding-left: 20px;
|
||||
list-style-type: disc;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
#fiche li {
|
||||
white-space: normal;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
body h1 {
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
text-align: center;
|
||||
color: black;
|
||||
font-style: bold;
|
||||
margin-bottom: 20px;
|
||||
background-color:brown;
|
||||
border-radius:12px;
|
||||
height: 75px;
|
||||
}
|
||||
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||
color: white;
|
||||
}
|
||||
#fiche img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fiche du parcours</h1>
|
||||
<div id="container">
|
||||
<div id="map"></div>
|
||||
<div id="fiche">
|
||||
<h2>Chemin des</h2>
|
||||
<p><strong>Ville :</strong> Bourg en Bresse</p>
|
||||
<p><strong>Département :</strong> 0</p>
|
||||
<p><strong>Difficulté :</strong> 3</p>
|
||||
<p><strong>Durée (heures) :</strong> 3.8</p>
|
||||
<p><strong>Longueur (km) :</strong> 24.6</p>
|
||||
<img src="data/parcours1.png">
|
||||
<h3>Étape 1</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Clémentine</li>
|
||||
<li>Léo</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>Bienvenue à tous, voici le centre historique !</li>
|
||||
<li>Regardez cette magnifique horloge, elle date du XIXe siècle !</li>
|
||||
</ul>
|
||||
<h3>Étape 2</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Aurélie</li>
|
||||
<li>Sami</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>Ici, on trouve les meilleurs fromages de la région !</li>
|
||||
<li>Combien de colonnes vois-tu à l'entrée ?</li>
|
||||
</ul>
|
||||
<h3>Étape 3</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Juliette</li>
|
||||
<li>Marc</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>La Reyssouze apporte de la fraîcheur en été.</li>
|
||||
<li>Regarde cette inscription ancienne sur la pierre, tu arrives à la lire ?</li>
|
||||
</ul>
|
||||
<h3>Étape 4</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Claire</li>
|
||||
<li>Nathalie</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>Voilà l'abbaye ! Admire l'architecture.</li>
|
||||
<li>C'est ici la dernière étape. Observez bien la date !</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
<script>
|
||||
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
L.marker([45.62, -1.03348]).addTo(map).bindPopup("<b>Étape 1</b><br><b>Personnages :</b><ul><li>Quentin</li><li>Malo</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||
L.marker([-45.62, 1.03348]).addTo(map).bindPopup("<b>Étape 2</b><br><b>Personnages :</b><ul><li>Antoine</li><li>Giovanni</li></ul><b>Textes :</b><ul><li>ligne de dialogue 1</li><li>ligne de dialogue 2</li></ul>");
|
||||
var latlngs = [
|
||||
[45.62, -1.03348],
|
||||
[-45.62, 1.03348],
|
||||
];
|
||||
|
||||
var polyline = L.polyline(latlngs, {
|
||||
color: 'purple',
|
||||
weight: 2,
|
||||
dashArray: '10, 10',
|
||||
opacity: 0.7
|
||||
}).addTo(map);
|
||||
map.fitBounds(polyline.getBounds());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -13,12 +13,14 @@ SOURCES += \
|
||||
mainwindow.cpp \
|
||||
step.cpp \
|
||||
path.cpp \
|
||||
web.cpp
|
||||
|
||||
HEADERS += \
|
||||
Undo.h \
|
||||
mainwindow.h \
|
||||
step.h \
|
||||
path.h \
|
||||
web.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
31
step.cpp
31
step.cpp
@ -27,6 +27,16 @@ int Step::getResponse() const
|
||||
return response;
|
||||
}
|
||||
|
||||
QList<QString> Step::getPersonnage() const
|
||||
{
|
||||
return personnage;
|
||||
}
|
||||
|
||||
QList<QString> Step::getTexte() const
|
||||
{
|
||||
return texte;
|
||||
}
|
||||
|
||||
void Step::setTitle(const QString &newTitle)
|
||||
{
|
||||
title = newTitle;
|
||||
@ -37,23 +47,22 @@ void Step::setResponse(int newResponse)
|
||||
response = newResponse;
|
||||
}
|
||||
|
||||
void Step::setPersonnage(const QList<QString> &newPersonnage)
|
||||
{
|
||||
personnage = newPersonnage;
|
||||
}
|
||||
|
||||
void Step::setTexte(const QList<QString> &newTexte)
|
||||
{
|
||||
texte = newTexte;
|
||||
}
|
||||
|
||||
Step::Step() {
|
||||
latitude = 0.0;
|
||||
longitude = 0.0;
|
||||
response = 0;
|
||||
}
|
||||
|
||||
|
||||
QList<QString> Step::getPersonnage() const
|
||||
{
|
||||
return personnage;
|
||||
}
|
||||
|
||||
QList<QString> Step::getTexte() const
|
||||
{
|
||||
return texte;
|
||||
}
|
||||
|
||||
Step::Step( QJsonObject &in)
|
||||
{
|
||||
title = in["title"].toString();
|
||||
|
||||
4
step.h
4
step.h
@ -26,11 +26,13 @@ public:
|
||||
float getLatitude() const;
|
||||
float getLongitude() const;
|
||||
int getResponse() const;
|
||||
QString toGPSFormat();
|
||||
QList<QString> getPersonnage() const;
|
||||
QList<QString> getTexte() const;
|
||||
void setTitle(const QString &newTitle);
|
||||
void setResponse(int newResponse);
|
||||
void setPersonnage(const QList<QString> &newPersonnage);
|
||||
void setTexte(const QList<QString> &newTexte);
|
||||
QString toGPSFormat();
|
||||
};
|
||||
|
||||
#endif // STEP_H
|
||||
|
||||
85
web.cpp
Normal file
85
web.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
#include "web.h"
|
||||
#include <fstream>
|
||||
Web::Web()
|
||||
{}
|
||||
|
||||
Web::Web(const QList<Path*>& list) : list(list)
|
||||
{}
|
||||
|
||||
void Web::siteHtml()
|
||||
{
|
||||
std::ofstream file("index.html");
|
||||
if (!file.is_open()) {
|
||||
qWarning("Impossible d'ouvrir le fichier index.html");
|
||||
return;
|
||||
}
|
||||
|
||||
file << R"(<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Liste des parcours</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial;
|
||||
margin: 40px;
|
||||
background-color: whitesmoke;
|
||||
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: black;
|
||||
font-style: bold;
|
||||
}
|
||||
ul {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
li {
|
||||
background: white;
|
||||
margin: 10px 0;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 6px rgba(0,0,0,0.1);
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
li:hover {
|
||||
background-color:black;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: purple;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Liste des parcours</h1>
|
||||
<ul>
|
||||
)";
|
||||
|
||||
int index = 1;
|
||||
for (const Path* p : list) {
|
||||
QString fileName = QString("parcours%1.html").arg(index);
|
||||
QString name = p->getName();
|
||||
file << " <li><a href=\"./pages/"
|
||||
<< fileName.toStdString()
|
||||
<< "\">"
|
||||
<< name.toStdString()
|
||||
<< "</a></li>\n";
|
||||
++index;
|
||||
}
|
||||
|
||||
file << R"( </ul>
|
||||
</body>
|
||||
</html>
|
||||
)";
|
||||
|
||||
file.close();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user