modif export + automatisation + fonction qui centralise tout les exports
This commit is contained in:
parent
0ca9c535c5
commit
105f1a6918
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,
|
"difficulty": 2,
|
||||||
"duration": 2.3,
|
"duration": 2.3,
|
||||||
"length": 17.3,
|
"length": 17.3,
|
||||||
"image": "data/parcours1.png",
|
"image": "../data/parcours1.png",
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"numero": 1,
|
"numero": 1,
|
||||||
|
|||||||
44
data/parcours2.json
Normal file
44
data/parcours2.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"name": "parcours2",
|
||||||
|
"city": "Paris",
|
||||||
|
"departement": 1,
|
||||||
|
"difficulty": 2,
|
||||||
|
"duration": 2.3,
|
||||||
|
"length": 17.3,
|
||||||
|
"image": "../data/parcours1.png",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"numero": 1,
|
||||||
|
"title": "Première étape",
|
||||||
|
"GPS": "N 45 37.199 W 1 2.009",
|
||||||
|
"reponse": -1,
|
||||||
|
"dialogue": [
|
||||||
|
{
|
||||||
|
"personnage": "Quentin",
|
||||||
|
"texte": "ligne de dialogue 1 HJDDDZJJJJJJJJJJJJJJJJJJJDBJBDJZBZJDBJ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"personnage": "Malo",
|
||||||
|
"texte": "ligne de dialogue 2BDJJHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHBDHDBHBZHVZDHVHVHEDHJVHVDHEDJD"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"numero": 2,
|
||||||
|
"title": "Deuxième étape",
|
||||||
|
"GPS": "S 45 37.199 E 1 2.009",
|
||||||
|
"reponse": 4156,
|
||||||
|
"dialogue": [
|
||||||
|
{
|
||||||
|
"personnage": "Antoine",
|
||||||
|
"texte": "ligne de dialogue 1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"personnage": "Giovanni",
|
||||||
|
"texte": "ligne de dialogue 2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
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">parcours2</a></li>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
32
main.cpp
32
main.cpp
@ -9,39 +9,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
QFile file1("data/parcours1.json");
|
w.loadAndExportPaths();
|
||||||
if (!file1.open(QIODevice::ReadOnly)) {
|
|
||||||
qWarning() << "Impossible d'ouvrir le fichier data/parcours1.json";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
Path* p = new Path(&file1);
|
|
||||||
file1.close();
|
|
||||||
|
|
||||||
QFile file2("data/parcours1.json");
|
|
||||||
if (!file2.open(QIODevice::ReadOnly)) {
|
|
||||||
qWarning() << "Impossible d'ouvrir le fichier data/parcours2.json";
|
|
||||||
delete p;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
Path* p2 = new Path(&file2);
|
|
||||||
file2.close();
|
|
||||||
|
|
||||||
QList<Path*> paths = w.getPath();
|
|
||||||
paths.append(p);
|
|
||||||
paths.append(p2);
|
|
||||||
w.setPath(paths);
|
|
||||||
|
|
||||||
w.setCurrentPath(p);
|
|
||||||
w.exportHTMLMap();
|
|
||||||
|
|
||||||
w.setCurrentPath(p2);
|
|
||||||
w.exportHTMLMap();
|
|
||||||
|
|
||||||
Web u(w.getPath());
|
Web u(w.getPath());
|
||||||
u.siteHtml();
|
u.siteHtml();
|
||||||
|
|
||||||
delete p;
|
|
||||||
delete p2;
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
174
mainwindow.cpp
174
mainwindow.cpp
@ -6,11 +6,14 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
int MainWindow::indexPath = 0;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
indexPath++;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -22,16 +25,11 @@ MainWindow::~MainWindow()
|
|||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updatePathView()
|
void MainWindow::updatePathView()
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateStepView(size_t num)
|
void MainWindow::updateStepView(size_t num)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::onTextChanged()
|
void MainWindow::onTextChanged()
|
||||||
{
|
{
|
||||||
@ -65,17 +63,16 @@ void MainWindow::loadPath()
|
|||||||
|
|
||||||
void MainWindow::addNewPath()
|
void MainWindow::addNewPath()
|
||||||
{
|
{
|
||||||
|
path.append(currentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addNewStep()
|
void MainWindow::addNewStep()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void MainWindow::exportHTMLMap(int index)
|
||||||
void MainWindow::exportHTMLMap()
|
|
||||||
{
|
{
|
||||||
std::ofstream file("parcours.html");
|
std::ofstream file("./pages/parcours" + std::to_string(index) + ".html");
|
||||||
|
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
QMessageBox::warning(this, "Erreur", "Impossible d'ouvrir le fichier.");
|
QMessageBox::warning(this, "Erreur", "Impossible d'ouvrir le fichier.");
|
||||||
return;
|
return;
|
||||||
@ -89,16 +86,116 @@ void MainWindow::exportHTMLMap()
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<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" />
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||||
<style>
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 20px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
#map {
|
#map {
|
||||||
height: 600px;
|
height: 600px;
|
||||||
width: 70%;
|
width: 60%;
|
||||||
border-radius:8%;
|
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>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Carte du parcours</h1>
|
<h1>Fiche du parcours</h1>
|
||||||
<div id="map"></div>
|
<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 src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||||
<script>
|
<script>
|
||||||
@ -112,12 +209,6 @@ void MainWindow::exportHTMLMap()
|
|||||||
if (!path.isEmpty() && path[0]) {
|
if (!path.isEmpty() && path[0]) {
|
||||||
Path* p = path[0];
|
Path* p = path[0];
|
||||||
int stepNum = 1;
|
int stepNum = 1;
|
||||||
// c un test
|
|
||||||
// qDebug() << "Nombre d'étapes dans le path :" << p->getStep().size();
|
|
||||||
for (const Step& s : p->getStep()) {
|
|
||||||
qDebug() << s.getTitle() << s.getLatitude() << s.getLongitude();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (const Step& s : p->getStep()) {
|
for (const Step& s : p->getStep()) {
|
||||||
float lat = s.getLatitude();
|
float lat = s.getLatitude();
|
||||||
@ -125,7 +216,6 @@ void MainWindow::exportHTMLMap()
|
|||||||
QList<QString> personnages = s.getPersonnage();
|
QList<QString> personnages = s.getPersonnage();
|
||||||
QList<QString> textes = s.getTexte();
|
QList<QString> textes = s.getTexte();
|
||||||
QString popupHtml = "<b>Étape " + QString::number(stepNum) + "</b><br>";
|
QString popupHtml = "<b>Étape " + QString::number(stepNum) + "</b><br>";
|
||||||
// ajout des perso
|
|
||||||
if (!personnages.isEmpty()) {
|
if (!personnages.isEmpty()) {
|
||||||
popupHtml += "<b>Personnages :</b><ul>";
|
popupHtml += "<b>Personnages :</b><ul>";
|
||||||
for (const QString& pers : personnages) {
|
for (const QString& pers : personnages) {
|
||||||
@ -133,11 +223,20 @@ void MainWindow::exportHTMLMap()
|
|||||||
}
|
}
|
||||||
popupHtml += "</ul>";
|
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)"
|
file << "L.marker([" << lat << ", " << lon << "]).addTo(map)"
|
||||||
<< ".bindPopup(\"" << popupHtml.toStdString() << "\");\n";
|
<< ".bindPopup(\"" << popupHtml.toStdString() << "\");\n";
|
||||||
|
|
||||||
++stepNum;
|
++stepNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
file << "var latlngs = [\n";
|
file << "var latlngs = [\n";
|
||||||
for (const Step& s : p->getStep()) {
|
for (const Step& s : p->getStep()) {
|
||||||
float lat = s.getLatitude();
|
float lat = s.getLatitude();
|
||||||
@ -146,26 +245,27 @@ void MainWindow::exportHTMLMap()
|
|||||||
}
|
}
|
||||||
file << "];\n";
|
file << "];\n";
|
||||||
|
|
||||||
// Ajouter la polyline en pointillés
|
|
||||||
file << R"(
|
file << R"(
|
||||||
var polyline = L.polyline(latlngs, {
|
var polyline = L.polyline(latlngs, {
|
||||||
color: 'purple',
|
color: 'purple',
|
||||||
weight: 2,
|
weight: 2,
|
||||||
dashArray: '10, 10', // ligne en pointillés
|
dashArray: '10, 10',
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
map.fitBounds(polyline.getBounds());
|
map.fitBounds(polyline.getBounds());
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
|
|
||||||
file << R"(
|
file << R"(
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
)";
|
)";
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::loadImage(QString fileName) {
|
void MainWindow::loadImage(QString fileName) {
|
||||||
|
|
||||||
QString ext[] = {"png", "jpeg", "jpg"};
|
QString ext[] = {"png", "jpeg", "jpg"};
|
||||||
@ -220,6 +320,16 @@ void MainWindow::on_toolButton_clicked()
|
|||||||
loadImage(fileName);
|
loadImage(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MainWindow::getIndexPath() const
|
||||||
|
{
|
||||||
|
return indexPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setIndexPath(int newIndexPath)
|
||||||
|
{
|
||||||
|
indexPath = newIndexPath;
|
||||||
|
}
|
||||||
|
|
||||||
QString MainWindow::getCurrentFile() const
|
QString MainWindow::getCurrentFile() const
|
||||||
{
|
{
|
||||||
return currentFile;
|
return currentFile;
|
||||||
|
|||||||
@ -24,8 +24,8 @@ public:
|
|||||||
void loadPath();
|
void loadPath();
|
||||||
void addNewPath();
|
void addNewPath();
|
||||||
void addNewStep();
|
void addNewStep();
|
||||||
void exportHTMLMap();
|
void exportHTMLMap(int index);
|
||||||
|
void loadAndExportPaths();
|
||||||
QString getCurrentFile() const;
|
QString getCurrentFile() const;
|
||||||
void setCurrentFile(const QString &newCurrentFile);
|
void setCurrentFile(const QString &newCurrentFile);
|
||||||
QList<Path *> getPath() const;
|
QList<Path *> getPath() const;
|
||||||
@ -33,6 +33,9 @@ public:
|
|||||||
Path *getCurrentPath() const;
|
Path *getCurrentPath() const;
|
||||||
void setCurrentPath(Path *newCurrentPath);
|
void setCurrentPath(Path *newCurrentPath);
|
||||||
|
|
||||||
|
int getIndexPath() const;
|
||||||
|
void setIndexPath(int newIndexPath);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
|
|
||||||
@ -43,6 +46,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QString currentFile;
|
QString currentFile;
|
||||||
|
static int indexPath;
|
||||||
bool textChanged;
|
bool textChanged;
|
||||||
QList<Path*> path;
|
QList<Path*> path;
|
||||||
Path* currentPath;
|
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>
|
||||||
130
pages/parcours2.html
Normal file
130
pages/parcours2.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>parcours2</h2>
|
||||||
|
<p><strong>Ville :</strong> Paris</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 HJDDDZJJJJJJJJJJJJJJJJJJJDBJBDJZBZJDBJ</li>
|
||||||
|
<li>ligne de dialogue 2BDJJHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHBDHDBHBZHVZDHVHVHEDHJVHVDHEDJD</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>
|
||||||
@ -1,44 +0,0 @@
|
|||||||
<!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>
|
|
||||||
#map {
|
|
||||||
height: 600px;
|
|
||||||
width: 70%;
|
|
||||||
border-radius:8%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Carte du parcours</h1>
|
|
||||||
<div id="map"></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>");
|
|
||||||
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>");
|
|
||||||
var latlngs = [
|
|
||||||
[45.62, -1.03348],
|
|
||||||
[-45.62, 1.03348],
|
|
||||||
];
|
|
||||||
|
|
||||||
var polyline = L.polyline(latlngs, {
|
|
||||||
color: 'purple',
|
|
||||||
weight: 2,
|
|
||||||
dashArray: '10, 10', // ligne en pointillés
|
|
||||||
opacity: 0.7
|
|
||||||
}).addTo(map);
|
|
||||||
map.fitBounds(polyline.getBounds());
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
4
path.cpp
4
path.cpp
@ -51,10 +51,10 @@ QList<Step> Path::getStep() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path::Path(QFile *file){
|
Path::Path(QFile *file){
|
||||||
/*if (!file->open(QIODevice::ReadOnly)) {
|
if (!file->open(QIODevice::ReadOnly)) {
|
||||||
qWarning() << "Could not open file:" << file->errorString();
|
qWarning() << "Could not open file:" << file->errorString();
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
QByteArray data = file->readAll();
|
QByteArray data = file->readAll();
|
||||||
file->close();
|
file->close();
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(data);
|
QJsonDocument doc = QJsonDocument::fromJson(data);
|
||||||
|
|||||||
@ -13,11 +13,13 @@ SOURCES += \
|
|||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
step.cpp \
|
step.cpp \
|
||||||
path.cpp \
|
path.cpp \
|
||||||
|
web.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
step.h \
|
step.h \
|
||||||
path.h \
|
path.h \
|
||||||
|
web.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
|||||||
23
web.cpp
23
web.cpp
@ -21,15 +21,15 @@ void Web::siteHtml()
|
|||||||
<title>Liste des parcours</title>
|
<title>Liste des parcours</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial;
|
||||||
margin: 40px;
|
margin: 40px;
|
||||||
background-color: #f0f0f0;
|
background-color: whitesmoke;
|
||||||
color: #333;
|
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: purple;
|
color: black;
|
||||||
font-style: italic;
|
font-style: bold;
|
||||||
}
|
}
|
||||||
ul {
|
ul {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
@ -45,9 +45,9 @@ void Web::siteHtml()
|
|||||||
box-shadow: 0 0 6px rgba(0,0,0,0.1);
|
box-shadow: 0 0 6px rgba(0,0,0,0.1);
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
/*li:hover {
|
li:hover {
|
||||||
background-color: red;
|
background-color:black;
|
||||||
}*/
|
}
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: purple;
|
color: purple;
|
||||||
@ -68,8 +68,11 @@ void Web::siteHtml()
|
|||||||
for (const Path* p : list) {
|
for (const Path* p : list) {
|
||||||
QString fileName = QString("parcours%1.html").arg(index);
|
QString fileName = QString("parcours%1.html").arg(index);
|
||||||
QString name = p->getName();
|
QString name = p->getName();
|
||||||
file << " <li><a href=\"" << fileName.toStdString() << "\">"
|
file << " <li><a href=\"./pages/"
|
||||||
<< name.toStdString() << "</a></li>\n";
|
<< fileName.toStdString()
|
||||||
|
<< "\">"
|
||||||
|
<< name.toStdString()
|
||||||
|
<< "</a></li>\n";
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user