Delete services/html_generator.py
This commit is contained in:
parent
74f5bab0fe
commit
97a44bc38a
1 changed files with 0 additions and 87 deletions
|
|
@ -1,87 +0,0 @@
|
|||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from config import EPT_DIR, POTREE_URL
|
||||
import config
|
||||
|
||||
def generate_viewer_html(pc_id: str, ept_dir: Optional[str],
|
||||
embed: bool = False, potree_url: Optional[str] = None) -> str:
|
||||
# Fallback : cherche ept.json si le manifest est absent
|
||||
if not ept_dir:
|
||||
out_dir = EPT_DIR / pc_id
|
||||
ept_json = out_dir / "ept.json"
|
||||
if ept_json.exists():
|
||||
ept_dir = pc_id
|
||||
else:
|
||||
return "<h3>Erreur : ept.json introuvable pour cet ID</h3>"
|
||||
|
||||
height_style = "100vh" if embed else "800px"
|
||||
base_url = "/static/potree"
|
||||
potree_url = potree_url or config.POTREE_URL
|
||||
|
||||
# L'URL vers ept.json servi via le montage statique /ept_data
|
||||
ept_json_url = f"/ept_data/{ept_dir}/ept.json"
|
||||
|
||||
return f"""<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<title>EPT Viewer - {pc_id}</title>
|
||||
<link rel="stylesheet" href="{base_url}/build/potree/potree.css">
|
||||
<link rel="stylesheet" href="{base_url}/libs/jquery-ui/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="{base_url}/libs/spectrum/spectrum.css">
|
||||
<link rel="stylesheet" href="{base_url}/libs/jstree/themes/mixed/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="{base_url}/libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="{base_url}/libs/spectrum/spectrum.js"></script>
|
||||
<script src="{base_url}/libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="{base_url}/libs/other/BinaryHeap.js"></script>
|
||||
<script src="{base_url}/libs/tween/tween.min.js"></script>
|
||||
<script src="{base_url}/libs/d3/d3.js"></script>
|
||||
<script src="{base_url}/libs/proj4/proj4.js"></script>
|
||||
<script src="{base_url}/libs/openlayers3/ol.js"></script>
|
||||
<script src="{base_url}/libs/i18next/i18next.js"></script>
|
||||
<script src="{base_url}/libs/jstree/jstree.js"></script>
|
||||
<script src="{base_url}/libs/copc/index.js"></script>
|
||||
<script src="{base_url}/build/potree/potree.js"></script>
|
||||
<script src="{base_url}/libs/plasio/js/laslaz.js"></script>
|
||||
|
||||
<div class="potree_container" style="position:absolute;width:100%;height:{height_style};left:0;top:0;">
|
||||
<div id="potree_render_area"></div>
|
||||
<div id="potree_sidebar_container"></div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setBackground("skybox");
|
||||
viewer.setDescription("EPT - {pc_id}");
|
||||
|
||||
viewer.loadGUI(() => {{
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_tools").next().show();
|
||||
viewer.toggleSidebar();
|
||||
}});
|
||||
|
||||
// Potree 2.x charge EPT directement via l'URL de ept.json
|
||||
const eptUrl = "{ept_json_url}";
|
||||
console.log("Chargement EPT depuis:", eptUrl);
|
||||
|
||||
Potree.loadPointCloud(eptUrl, "{pc_id}", e => {{
|
||||
let pointcloud = e.pointcloud;
|
||||
let material = pointcloud.material;
|
||||
material.size = 1;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
material.shape = Potree.PointShape.SQUARE;
|
||||
|
||||
viewer.scene.addPointCloud(pointcloud);
|
||||
viewer.fitToScreen();
|
||||
console.log("EPT chargé avec succès");
|
||||
}});
|
||||
</script>
|
||||
</body>
|
||||
</html>"""
|
||||
Loading…
Add table
Add a link
Reference in a new issue