вынес навигацию в отдельную панель

переработал сайдбар в отдельный компонент на react
рабочий функционал навигации, внешний вид.
инструменты, сцена и фильтры пока не работают.
This commit is contained in:
Georgy Shive 2025-05-29 19:51:56 +07:00
parent 6ee574546b
commit be8c17bcef
6 changed files with 1309 additions and 478 deletions

View File

@ -0,0 +1,287 @@
/* Навигационная панель */
.navigation-panel {
position: fixed;
right: 20px;
top: 50%;
transform: translateY(-50%);
z-index: 2000;
}
/* Кнопка-триггер */
.nav-trigger {
width: 50px;
height: 50px;
border-radius: 50%;
background: rgba(76, 175, 80, 0.9);
border: none;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.nav-trigger:hover {
background: rgba(76, 175, 80, 1);
transform: scale(1.1);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.nav-trigger.active {
background: rgba(76, 175, 80, 1);
transform: scale(1.05);
}
.nav-trigger svg {
transition: transform 0.3s ease;
}
.nav-trigger.active svg {
transform: rotate(180deg);
}
/* Оверлей */
.nav-overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: transparent;
z-index: 1999;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
/* Попап с инструментами */
.nav-popup {
position: absolute;
right: 60px;
top: 50%;
transform: translateY(-50%);
background: rgba(142, 152, 168, 0.95);
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.2);
min-width: 280px;
max-width: 320px;
animation: slideInRight 0.3s ease;
z-index: 2001;
}
@keyframes slideInRight {
from {
opacity: 0;
transform: translateY(-50%) translateX(20px);
}
to {
opacity: 1;
transform: translateY(-50%) translateX(0);
}
}
/* Заголовок попапа */
.nav-popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(0, 0, 0, 0.3);
border-radius: 12px 12px 0 0;
}
.nav-popup-header h3 {
margin: 0;
color: white;
font-size: 16px;
font-weight: bold;
}
.nav-close {
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: all 0.2s ease;
}
.nav-close:hover {
background: rgba(255, 255, 255, 0.2);
transform: scale(1.1);
}
/* Содержимое попапа */
.nav-popup-content {
padding: 20px;
max-height: 60vh;
overflow-y: auto;
}
/* Секции навигации */
.nav-section {
margin-bottom: 20px;
}
.nav-section:last-child {
margin-bottom: 0;
}
.nav-section h4 {
margin: 0 0 12px 0;
color: white;
font-size: 14px;
font-weight: bold;
padding-bottom: 5px;
border-bottom: 1px solid rgba(76, 175, 80, 0.3);
}
/* Сетка инструментов навигации */
.nav-tools-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
/* Кнопки инструментов навигации */
.nav-tool-button {
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 8px;
padding: 12px 8px;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
transition: all 0.2s ease;
color: white;
text-align: center;
}
.nav-tool-button:hover {
background: rgba(76, 175, 80, 0.3);
border-color: #4CAF50;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.nav-tool-button img {
width: 24px;
height: 24px;
filter: brightness(0) invert(1);
transition: filter 0.2s ease;
}
.nav-tool-button:hover img {
filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(90deg);
}
.nav-tool-button span {
font-size: 11px;
font-weight: 500;
line-height: 1.2;
max-width: 100%;
word-wrap: break-word;
}
/* Скроллбар для содержимого */
.nav-popup-content::-webkit-scrollbar {
width: 6px;
}
.nav-popup-content::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
border-radius: 3px;
}
.nav-popup-content::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 3px;
}
.nav-popup-content::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
/* Адаптивность */
@media (max-width: 768px) {
.navigation-panel {
right: 15px;
}
.nav-trigger {
width: 45px;
height: 45px;
}
.nav-popup {
right: 55px;
min-width: 250px;
max-width: 280px;
}
.nav-popup-header {
padding: 12px 15px;
}
.nav-popup-content {
padding: 15px;
}
.nav-tools-grid {
gap: 8px;
}
.nav-tool-button {
padding: 10px 6px;
}
.nav-tool-button img {
width: 20px;
height: 20px;
}
.nav-tool-button span {
font-size: 10px;
}
}
/* Анимация для мобильных устройств */
@media (max-width: 480px) {
.nav-popup {
position: fixed;
right: 10px;
left: 10px;
top: auto;
bottom: 80px;
transform: none;
animation: slideInUp 0.3s ease;
}
@keyframes slideInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
}

View File

@ -0,0 +1,189 @@
import React, { useState } from 'react';
import './NavigationPanel.css';
// Простое объявление типов для избежания конфликтов
declare const window: any;
interface NavigationPanelProps {
viewer?: any;
}
const NavigationPanel: React.FC<NavigationPanelProps> = ({ viewer }) => {
const [isOpen, setIsOpen] = useState(false);
const togglePanel = () => {
setIsOpen(!isOpen);
};
const navigationTools = [
{
icon: '/potree/resources/icons/earth_controls.svg',
title: 'Управление Землёй',
action: () => {
viewer?.setControls?.(viewer.earthControls);
}
},
{
icon: '/potree/resources/icons/fps_controls.svg',
title: 'Управление полётом',
action: () => {
viewer?.setControls?.(viewer.fpControls);
if (viewer?.fpControls) {
viewer.fpControls.lockElevation = false;
}
}
},
{
icon: '/potree/resources/icons/helicopter_controls.svg',
title: 'Управление вертолётом',
action: () => {
viewer?.setControls?.(viewer.fpControls);
if (viewer?.fpControls) {
viewer.fpControls.lockElevation = true;
}
}
},
{
icon: '/potree/resources/icons/orbit_controls.svg',
title: 'Управление орбитой',
action: () => {
viewer?.setControls?.(viewer.orbitControls);
}
},
{
icon: '/potree/resources/icons/focus.svg',
title: 'Полный обзор',
action: () => {
viewer?.fitToScreen?.();
}
},
{
icon: '/potree/resources/icons/left.svg',
title: 'Вид слева',
action: () => {
viewer?.setLeftView?.();
}
},
{
icon: '/potree/resources/icons/right.svg',
title: 'Вид справа',
action: () => {
viewer?.setRightView?.();
}
},
{
icon: '/potree/resources/icons/front.svg',
title: 'Вид спереди',
action: () => {
viewer?.setFrontView?.();
}
},
{
icon: '/potree/resources/icons/back.svg',
title: 'Вид сзади',
action: () => {
viewer?.setBackView?.();
}
},
{
icon: '/potree/resources/icons/top.svg',
title: 'Вид сверху',
action: () => {
viewer?.setTopView?.();
}
},
{
icon: '/potree/resources/icons/bottom.svg',
title: 'Вид снизу',
action: () => {
viewer?.setBottomView?.();
}
}
];
return (
<div className="navigation-panel">
{/* Кнопка-триггер */}
<button
className={`nav-trigger ${isOpen ? 'active' : ''}`}
onClick={togglePanel}
title="Навигация"
>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 2L13.09 8.26L20 9L13.09 9.74L12 16L10.91 9.74L4 9L10.91 8.26L12 2Z"
fill="currentColor"
/>
<path
d="M19 15L19.5 17L21 17.5L19.5 18L19 20L18.5 18L17 17.5L18.5 17L19 15Z"
fill="currentColor"
/>
<path
d="M5 6L5.5 7.5L7 8L5.5 8.5L5 10L4.5 8.5L3 8L4.5 7.5L5 6Z"
fill="currentColor"
/>
</svg>
</button>
{/* Попап с инструментами навигации */}
{isOpen && (
<>
{/* Оверлей для закрытия при клике вне панели */}
<div className="nav-overlay" onClick={() => setIsOpen(false)} />
{/* Панель с инструментами */}
<div className="nav-popup">
<div className="nav-popup-header">
<h3>Навигация</h3>
<button
className="nav-close"
onClick={() => setIsOpen(false)}
title="Закрыть"
>
×
</button>
</div>
<div className="nav-popup-content">
<div className="nav-section">
<h4>Управление</h4>
<div className="nav-tools-grid">
{navigationTools.slice(0, 4).map((tool, index) => (
<button
key={index}
className="nav-tool-button"
title={tool.title}
onClick={tool.action}
>
<img src={tool.icon} alt={tool.title} />
<span>{tool.title}</span>
</button>
))}
</div>
</div>
<div className="nav-section">
<h4>Виды</h4>
<div className="nav-tools-grid">
{navigationTools.slice(4).map((tool, index) => (
<button
key={index + 4}
className="nav-tool-button"
title={tool.title}
onClick={tool.action}
>
<img src={tool.icon} alt={tool.title} />
<span>{tool.title}</span>
</button>
))}
</div>
</div>
</div>
</div>
</>
)}
</div>
);
};
export default NavigationPanel;

View File

@ -0,0 +1,346 @@
/* Стили для React-компонента сайдбара */
.potree-sidebar-react {
width: 100%;
height: 100%;
background: rgba(142, 152, 168, 1);
color: white;
font-family: Arial, sans-serif;
font-size: 14px;
overflow-y: auto;
}
/* Заголовок сайдбара */
.sidebar-header {
padding: 15px;
background: rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
display: flex;
justify-content: space-between;
align-items: center;
}
.sidebar-brand a {
color: #4CAF50;
text-decoration: none;
font-weight: bold;
font-size: 16px;
}
.sidebar-brand a:hover {
color: #5CBF60;
}
.sidebar-version {
color: #9AA1A4;
font-size: 12px;
font-weight: 100;
}
/* Содержимое сайдбара */
.sidebar-content {
padding: 0;
}
/* Секции сайдбара */
.sidebar-section {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.section-header {
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 12px 15px;
margin: 0;
cursor: pointer;
font-size: 14px;
font-weight: bold;
border: none;
transition: background-color 0.2s ease;
user-select: none;
}
.section-header:hover {
background: rgba(0, 0, 0, 0.9);
}
.section-header.active {
background: rgba(0, 0, 0, 0.9);
}
.section-content {
padding: 15px;
background: rgba(122, 132, 148, 0.9);
}
/* Разделители */
.divider {
color: white;
font-weight: bold;
margin: 15px 0 10px 0;
padding: 5px 0;
border-bottom: 1px solid rgba(76, 175, 80, 0.3);
font-size: 13px;
}
/* Группы элементов управления */
.control-group {
margin-bottom: 15px;
}
.control-group label {
display: block;
margin-bottom: 5px;
font-size: 13px;
color: white;
}
.control-group .value {
color: rgba(182, 237, 227, 1);
font-weight: bold;
float: right;
}
/* Слайдеры */
.slider {
width: 100%;
height: 8px;
border-radius: 4px;
background: rgba(60, 60, 60, 0.8);
outline: none;
border: 1px solid rgba(255, 255, 255, 0.2);
margin-top: 5px;
cursor: pointer;
}
.slider::-webkit-slider-thumb {
appearance: none;
width: 18px;
height: 18px;
border-radius: 50%;
background: linear-gradient(to bottom, #4CAF50, #45a049);
border: 2px solid #fff;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
transition: all 0.2s ease;
}
.slider::-webkit-slider-thumb:hover {
background: linear-gradient(to bottom, #5CBF60, #4CAF50);
transform: scale(1.1);
}
.slider::-moz-range-thumb {
width: 18px;
height: 18px;
border-radius: 50%;
background: linear-gradient(to bottom, #4CAF50, #45a049);
border: 2px solid #fff;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
transition: all 0.2s ease;
}
.slider::-moz-range-thumb:hover {
background: linear-gradient(to bottom, #5CBF60, #4CAF50);
transform: scale(1.1);
}
/* Чекбоксы */
.checkbox-label {
display: flex !important;
align-items: center;
cursor: pointer;
margin-bottom: 8px !important;
}
.checkbox-label input[type="checkbox"] {
accent-color: #4CAF50;
width: 16px;
height: 16px;
margin-right: 8px;
cursor: pointer;
}
/* Радиокнопки */
.radio-group {
display: flex;
flex-direction: column;
gap: 8px;
}
.radio-label {
display: flex !important;
align-items: center;
cursor: pointer;
margin-bottom: 5px !important;
}
.radio-label input[type="radio"] {
accent-color: #4CAF50;
width: 16px;
height: 16px;
margin-right: 8px;
cursor: pointer;
}
/* Сетка инструментов */
.tools-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
gap: 8px;
margin-bottom: 15px;
}
.tool-button {
width: 40px;
height: 40px;
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.tool-button:hover {
background: rgba(0, 0, 0, 0.5);
border-color: #4CAF50;
transform: scale(1.05);
}
.tool-button img {
width: 24px;
height: 24px;
filter: brightness(0) invert(1);
}
.tool-button:hover img {
filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(90deg);
}
/* Кнопки экспорта */
.export-buttons {
display: flex;
gap: 10px;
margin-bottom: 15px;
}
.export-btn {
width: 32px;
height: 32px;
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.export-btn:hover {
background: rgba(0, 0, 0, 0.5);
border-color: #4CAF50;
}
.export-btn img {
width: 20px;
height: 20px;
filter: brightness(0) invert(1);
}
/* Дерево сцены */
.scene-tree {
background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
padding: 10px;
margin-bottom: 15px;
}
.tree-item {
padding: 5px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
cursor: pointer;
transition: color 0.2s ease;
}
.tree-item:hover {
color: #4CAF50;
}
.tree-item:last-child {
border-bottom: none;
}
/* Список классификации */
.classification-list {
background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
padding: 10px;
}
/* Адаптивность */
@media (max-width: 768px) {
.potree-sidebar-react {
font-size: 12px;
}
.sidebar-header {
padding: 10px;
}
.section-content {
padding: 10px;
}
.tools-grid {
grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
gap: 6px;
}
.tool-button {
width: 35px;
height: 35px;
}
.tool-button img {
width: 20px;
height: 20px;
}
}
/* Анимации */
.section-content {
animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
from {
opacity: 0;
max-height: 0;
}
to {
opacity: 1;
max-height: 1000px;
}
}
/* Скроллбар */
.potree-sidebar-react::-webkit-scrollbar {
width: 8px;
}
.potree-sidebar-react::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
}
.potree-sidebar-react::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 4px;
}
.potree-sidebar-react::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}

View File

@ -1,299 +1,468 @@
import React from 'react';
import React, { useState, useEffect, useRef } from 'react';
import './PotreeSidebar.css';
// Простое объявление типов для избежания конфликтов
declare const window: any;
interface SidebarProps {
viewer?: any;
}
const PotreeSidebar: React.FC<SidebarProps> = ({ viewer }) => {
const [activeSection, setActiveSection] = useState<string>('appearance');
const [pointBudget, setPointBudget] = useState(1000000);
const [fov, setFov] = useState(60);
const [edlEnabled, setEdlEnabled] = useState(false);
const [edlRadius, setEdlRadius] = useState(1.4);
const [edlStrength, setEdlStrength] = useState(0.4);
const [edlOpacity, setEdlOpacity] = useState(1.0);
const [background, setBackground] = useState('skybox');
const [splatQuality, setSplatQuality] = useState('standard');
const [minNodeSize, setMinNodeSize] = useState(30);
const [showBoundingBox, setShowBoundingBox] = useState(false);
const [freeze, setFreeze] = useState(false);
const [moveSpeed, setMoveSpeed] = useState(8.4);
// Refs для слайдеров
const pointBudgetRef = useRef<HTMLInputElement>(null);
const fovRef = useRef<HTMLInputElement>(null);
const edlRadiusRef = useRef<HTMLInputElement>(null);
const edlStrengthRef = useRef<HTMLInputElement>(null);
const edlOpacityRef = useRef<HTMLInputElement>(null);
const minNodeSizeRef = useRef<HTMLInputElement>(null);
const moveSpeedRef = useRef<HTMLInputElement>(null);
// Синхронизация с viewer
useEffect(() => {
if (!viewer) return;
// Обновляем состояние из viewer
setPointBudget(viewer.getPointBudget?.() || 1000000);
setFov(viewer.getFOV?.() || 60);
setEdlEnabled(viewer.getEDLEnabled?.() || false);
setEdlRadius(viewer.getEDLRadius?.() || 1.4);
setEdlStrength(viewer.getEDLStrength?.() || 0.4);
setEdlOpacity(viewer.getEDLOpacity?.() || 1.0);
setBackground(viewer.getBackground?.() || 'skybox');
setMinNodeSize(viewer.getMinNodeSize?.() || 30);
setMoveSpeed(viewer.getMoveSpeed?.() || 8.4);
// Добавляем слушатели событий
const listeners = [
viewer.addEventListener?.('point_budget_changed', () => setPointBudget(viewer.getPointBudget())),
viewer.addEventListener?.('fov_changed', () => setFov(viewer.getFOV())),
viewer.addEventListener?.('use_edl_changed', () => setEdlEnabled(viewer.getEDLEnabled())),
viewer.addEventListener?.('edl_radius_changed', () => setEdlRadius(viewer.getEDLRadius())),
viewer.addEventListener?.('edl_strength_changed', () => setEdlStrength(viewer.getEDLStrength())),
viewer.addEventListener?.('background_changed', () => setBackground(viewer.getBackground())),
viewer.addEventListener?.('minnodesize_changed', () => setMinNodeSize(viewer.getMinNodeSize())),
viewer.addEventListener?.('move_speed_changed', () => setMoveSpeed(viewer.getMoveSpeed())),
];
return () => {
// Cleanup listeners if needed
};
}, [viewer]);
const handleSliderChange = (type: string, value: number) => {
if (!viewer) return;
switch (type) {
case 'pointBudget':
viewer.setPointBudget?.(value);
setPointBudget(value);
break;
case 'fov':
viewer.setFOV?.(value);
setFov(value);
break;
case 'edlRadius':
viewer.setEDLRadius?.(value);
setEdlRadius(value);
break;
case 'edlStrength':
viewer.setEDLStrength?.(value);
setEdlStrength(value);
break;
case 'edlOpacity':
viewer.setEDLOpacity?.(value);
setEdlOpacity(value);
break;
case 'minNodeSize':
viewer.setMinNodeSize?.(value);
setMinNodeSize(value);
break;
case 'moveSpeed':
viewer.setMoveSpeed?.(value);
setMoveSpeed(value);
break;
}
};
const handleCheckboxChange = (type: string, checked: boolean) => {
if (!viewer) return;
switch (type) {
case 'edlEnabled':
viewer.setEDLEnabled?.(checked);
setEdlEnabled(checked);
break;
case 'showBoundingBox':
viewer.setShowBoundingBox?.(checked);
setShowBoundingBox(checked);
break;
case 'freeze':
viewer.setFreeze?.(checked);
setFreeze(checked);
break;
}
};
const handleBackgroundChange = (value: string) => {
if (!viewer) return;
viewer.setBackground?.(value);
setBackground(value);
};
const handleSplatQualityChange = (value: string) => {
if (!viewer) return;
viewer.useHQ = value === 'hq';
setSplatQuality(value);
};
const toggleSection = (section: string) => {
setActiveSection(activeSection === section ? '' : section);
};
const formatNumber = (num: number): string => {
return num.toLocaleString();
};
const createToolButton = (icon: string, title: string, onClick: () => void) => (
<button
key={title}
className="tool-button"
title={title}
onClick={onClick}
>
<img src={icon} alt={title} />
</button>
);
const measurementTools = [
{ icon: '/potree/resources/icons/angle.svg', title: 'Измерение угла', action: () => console.log('Angle measurement') },
{ icon: '/potree/resources/icons/point.svg', title: 'Измерение точки', action: () => console.log('Point measurement') },
{ icon: '/potree/resources/icons/distance.svg', title: 'Измерение расстояния', action: () => console.log('Distance measurement') },
{ icon: '/potree/resources/icons/height.svg', title: 'Измерение высоты', action: () => console.log('Height measurement') },
{ icon: '/potree/resources/icons/circle.svg', title: 'Измерение круга', action: () => console.log('Circle measurement') },
{ icon: '/potree/resources/icons/area.svg', title: 'Измерение площади', action: () => console.log('Area measurement') },
{ icon: '/potree/resources/icons/volume.svg', title: 'Измерение объёма', action: () => console.log('Volume measurement') },
{ icon: '/potree/resources/icons/profile.svg', title: 'Профиль высот', action: () => console.log('Height profile') },
{ icon: '/potree/resources/icons/annotation.svg', title: 'Аннотация', action: () => console.log('Annotation') },
{ icon: '/potree/resources/icons/reset_tools.svg', title: 'Удалить все измерения', action: () => console.log('Remove all') },
];
const clippingTools = [
{ icon: '/potree/resources/icons/clip_volume.svg', title: 'Объём обрезки', action: () => console.log('Clip volume') },
{ icon: '/potree/resources/icons/clip-polygon.svg', title: 'Полигон обрезки', action: () => console.log('Clip polygon') },
{ icon: '/potree/resources/icons/clip-screen.svg', title: 'Экранная обрезка', action: () => console.log('Screen clip') },
{ icon: '/potree/resources/icons/remove.svg', title: 'Удалить обрезку', action: () => console.log('Remove clipping') },
];
const PotreeSidebar: React.FC = () => {
return (
<div id="sidebar_root" className="">
<div id="sidebar_header">
<span id="potree_branding" className="potree_sidebar_brand">
<div className="potree-sidebar-react">
<div className="sidebar-header">
<span className="sidebar-brand">
<a href="https://cybercode.pro/" target="_blank" rel="noopener noreferrer">
КиберКод
</a>
<span style={{ flexGrow: 1 }}></span>
<span
id="potree_version_number"
style={{ color: '#9AA1A4', fontSize: '80%', fontWeight: 100 }}
></span>
</span>
<span className="sidebar-version">1.8.0</span>
</div>
<div>
<div id="potree_menu" className="accordion">
{/* ВНЕШНИЙ ВИД */}
<h3 id="menu_appearance">
<span data-i18n="tb.rendering_opt">Внешний вид</span>
</h3>
<div>
<ul className="pv-menu-list">
<li>
<span data-i18n="appearance.nb_max_pts">Макс. точек</span>:
<span id="lblPointBudget"></span>
<div id="sldPointBudget"></div>
</li>
<li>
<span data-i18n="appearance.field_view">Поле зрения</span>:
<span id="lblFOV"></span>
<div id="sldFOV"></div>
</li>
<div className="divider">
<span>Обводка по глубине(EDL)</span>
<div className="sidebar-content">
{/* ВНЕШНИЙ ВИД */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'appearance' ? 'active' : ''}`}
onClick={() => toggleSection('appearance')}
>
Внешний вид
</h3>
{activeSection === 'appearance' && (
<div className="section-content">
<div className="control-group">
<label>Лимит точек: <span className="value">{formatNumber(pointBudget)}</span></label>
<input
ref={pointBudgetRef}
type="range"
min="100000"
max="10000000"
step="1000"
value={pointBudget}
onChange={(e) => handleSliderChange('pointBudget', parseInt(e.target.value))}
className="slider"
/>
</div>
<li>
<label>
<input type="checkbox" id="chkEDLEnabled"/>
<span data-i18n="appearance.edl_enable">Включить EDL</span>
<div className="control-group">
<label>Поле зрения: <span className="value">{fov}</span></label>
<input
ref={fovRef}
type="range"
min="20"
max="100"
step="1"
value={fov}
onChange={(e) => handleSliderChange('fov', parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Обводка по глубине (EDL)</div>
<div className="control-group">
<label className="checkbox-label">
<input
type="checkbox"
checked={edlEnabled}
onChange={(e) => handleCheckboxChange('edlEnabled', e.target.checked)}
/>
Включить EDL
</label>
</li>
<li>
<span data-i18n="appearance.edl_radius">Радиус EDL</span>:
<span id="lblEDLRadius"></span>
<div id="sldEDLRadius"></div>
</li>
<li>
<span data-i18n="appearance.edl_strength">Сила EDL</span>:
<span id="lblEDLStrength"></span>
<div id="sldEDLStrength"></div>
</li>
<li>
<span data-i18n="appearance.edl_opacity">Прозрачность EDL</span>:
<span id="lblEDLOpacity"></span>
<div id="sldEDLOpacity"></div>
</li>
<div className="divider">
<span>Фон</span>
</div>
<li>
<div id="background_options">
<div>
<input type="radio" id="background_options_skybox" name="background" value="skybox" />
<label htmlFor="background_options_skybox">Небо</label>
</div>
<div>
<input type="radio" id="background_options_gradient" name="background" value="gradient" />
<label htmlFor="background_options_gradient">Градиент</label>
</div>
<div>
<input type="radio" id="background_options_black" name="background" value="black" />
<label htmlFor="background_options_black">Чёрный</label>
</div>
<div>
<input type="radio" id="background_options_white" name="background" value="white" />
<label htmlFor="background_options_white">Белый</label>
</div>
<div>
<input type="radio" id="background_options_none" name="background" value="null" />
<label htmlFor="background_options_none">Без фона</label>
</div>
</div>
</li>
<div className="divider">
<span>Прочее</span>
<div className="control-group">
<label>Радиус EDL: <span className="value">{edlRadius.toFixed(1)}</span></label>
<input
ref={edlRadiusRef}
type="range"
min="1"
max="4"
step="0.01"
value={edlRadius}
onChange={(e) => handleSliderChange('edlRadius', parseFloat(e.target.value))}
className="slider"
/>
</div>
<li>
<div id="splat_quality_options">
<div>
<input type="radio" id="splat_quality_options_standard" name="splat_quality" value="standard" />
<label htmlFor="splat_quality_options_standard">Стандартное</label>
</div>
<div>
<input type="radio" id="splat_quality_options_hq" name="splat_quality" value="hq" />
<label htmlFor="splat_quality_options_hq">Высокое качество</label>
</div>
</div>
</li>
<div className="control-group">
<label>Сила EDL: <span className="value">{edlStrength.toFixed(1)}</span></label>
<input
ref={edlStrengthRef}
type="range"
min="0"
max="5"
step="0.01"
value={edlStrength}
onChange={(e) => handleSliderChange('edlStrength', parseFloat(e.target.value))}
className="slider"
/>
</div>
<li>
<span data-i18n="appearance.min_node_size">Мин. размер узла</span>:
<span id="lblMinNodeSize"></span>
<div id="sldMinNodeSize"></div>
</li>
<li>
<label>
<input id="show_bounding_box" type="checkbox" />
<span data-i18n="appearance.box">Показать границы</span>
<div className="control-group">
<label>Непрозрачность EDL: <span className="value">{edlOpacity.toFixed(1)}</span></label>
<input
ref={edlOpacityRef}
type="range"
min="0"
max="1"
step="0.01"
value={edlOpacity}
onChange={(e) => handleSliderChange('edlOpacity', parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Фон</div>
<div className="control-group">
<div className="radio-group">
{['skybox', 'gradient', 'black', 'white', 'null'].map((bg) => (
<label key={bg} className="radio-label">
<input
type="radio"
name="background"
value={bg}
checked={background === bg}
onChange={(e) => handleBackgroundChange(e.target.value)}
/>
{bg === 'skybox' ? 'Небо' :
bg === 'gradient' ? 'Градиент' :
bg === 'black' ? 'Чёрный' :
bg === 'white' ? 'Белый' : 'Без фона'}
</label>
))}
</div>
</div>
<div className="divider">Прочее</div>
<div className="control-group">
<div className="radio-group">
<label className="radio-label">
<input
type="radio"
name="splatQuality"
value="standard"
checked={splatQuality === 'standard'}
onChange={(e) => handleSplatQualityChange(e.target.value)}
/>
Стандартное качество
</label>
<label className="radio-label">
<input
type="radio"
name="splatQuality"
value="hq"
checked={splatQuality === 'hq'}
onChange={(e) => handleSplatQualityChange(e.target.value)}
/>
Высокое качество
</label>
</div>
</div>
<div className="control-group">
<label>Минимальный размер узла: <span className="value">{minNodeSize}</span></label>
<input
ref={minNodeSizeRef}
type="range"
min="0"
max="1000"
step="1"
value={minNodeSize}
onChange={(e) => handleSliderChange('minNodeSize', parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<label className="checkbox-label">
<input
type="checkbox"
checked={showBoundingBox}
onChange={(e) => handleCheckboxChange('showBoundingBox', e.target.checked)}
/>
Показать границы
</label>
</li>
<li>
<label>
<input id="set_freeze" type="checkbox" />
<span data-i18n="appearance.freeze">Заморозить</span>
</div>
<div className="control-group">
<label className="checkbox-label">
<input
type="checkbox"
checked={freeze}
onChange={(e) => handleCheckboxChange('freeze', e.target.checked)}
/>
Заблокировать вид
</label>
</li>
</ul>
</div>
{/* ИНСТРУМЕНТЫ */}
<h3 id="menu_tools">
<span data-i18n="tb.tools_opt">Инструменты</span>
</h3>
<div className="pv-menu-list">
<div className="divider">
<span>Измерение</span>
</div>
<li id="tools"></li>
<li>
<div id="measurement_options_show">
<div>
<input type="radio" id="measurement_options_show_yes" name="measurement_show" value="SHOW" />
<label htmlFor="measurement_options_show_yes">Показать</label>
</div>
<div>
<input type="radio" id="measurement_options_show_no" name="measurement_show" value="HIDE" />
<label htmlFor="measurement_options_show_no">Скрыть</label>
</div>
</div>
</li>
<div className="divider">
<span>Обрезка</span>
</div>
<li id="clipping_tools"></li>
<li>
<div id="cliptask_options">
<div>
<input type="radio" id="cliptask_options_none" name="cliptask" value="NONE" />
<label htmlFor="cliptask_options_none">Нет</label>
</div>
<div>
<input type="radio" id="cliptask_options_highlight" name="cliptask" value="HIGHLIGHT" />
<label htmlFor="cliptask_options_highlight">Выделение</label>
</div>
<div>
<input type="radio" id="cliptask_options_show_inside" name="cliptask" value="SHOW_INSIDE" />
<label htmlFor="cliptask_options_show_inside">Внутри</label>
</div>
<div>
<input type="radio" id="cliptask_options_show_outside" name="cliptask" value="SHOW_OUTSIDE" />
<label htmlFor="cliptask_options_show_outside">Снаружи</label>
</div>
</div>
</li>
<li>
<div id="clipmethod_options">
<div>
<input type="radio" id="clipmethod_options_any" name="clipmethod" value="INSIDE_ANY" />
<label htmlFor="clipmethod_options_any">Внутри любого</label>
</div>
<div>
<input type="radio" id="clipmethod_options_all" name="clipmethod" value="INSIDE_ALL" />
<label htmlFor="clipmethod_options_all">Внутри всех</label>
</div>
</div>
</li>
<div className="divider">
<span>Навигация</span>
</div>
<li id="navigation"></li>
<li>
<span data-i18n="appearance.move_speed">Скорость движения</span>:
<span id="lblMoveSpeed"></span>
<div id="sldMoveSpeed"></div>
</li>
</div>
{/* СЦЕНА */}
<h3 id="menu_scene">
<span data-i18n="tb.scene_opt">Сцена</span>
</h3>
<div className="pv-menu-list">
<div id="scene_export"></div>
<div className="divider">
<span>Объекты</span>
</div>
<div id="scene_objects"></div>
<div className="divider">
<span>Свойства</span>
</div>
<div id="scene_object_properties"></div>
</div>
{/* ФИЛЬТРЫ */}
<h3 id="menu_filters">
<span data-i18n="tb.filters_opt">Фильтры</span>
</h3>
<div>
<div className="divider">
<span>Классификация</span>
</div>
<ul id="classificationList" className="pv-menu-list"></ul>
<div className="divider">
<span>Возвраты</span>
</div>
<div id="return_filter_panel">
<ul className="pv-menu-list">
<li>
<span data-i18n="filters.return_number">Номер возврата</span>:
<span id="lblReturnNumber"></span>
<div id="sldReturnNumber"></div>
</li>
<li>
<span data-i18n="filters.number_of_returns">Количество возвратов</span>:
<span id="lblNumberOfReturns"></span>
<div id="sldNumberOfReturns"></div>
</li>
</ul>
</div>
<div className="divider">
<span>ID источника точек</span>
</div>
<div>
<ul className="pv-menu-list" id="pointsourceid_filter_panel">
</ul>
</div>
<div className="divider">
<span>GPS-время</span>
</div>
<div id="gpstime_filter_panel">
<ul className="pv-menu-list">
<div id="gpstime_multilevel_range_container">
<li>
<span style={{ display: 'flex' }}>
<span>Время:</span>
<input id="txtGpsTime" type="text" style={{ margin: 'auto 2px' }}/>
<input id="btnFindGpsTime" type="button" value="Найти" />
</span>
</li>
</div>
</ul>
</div>
</div>
{/* О ПРОГРАММЕ */}
<h3 id="menu_about">
<span data-i18n="tb.about_opt">О программе</span>
</h3>
<div>
{/* Содержимое раздела "О программе" можно добавить здесь */}
</div>
)}
</div>
<div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
{/* ИНСТРУМЕНТЫ */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'tools' ? 'active' : ''}`}
onClick={() => toggleSection('tools')}
>
Инструменты
</h3>
{activeSection === 'tools' && (
<div className="section-content">
<div className="divider">Измерение</div>
<div className="tools-grid">
{measurementTools.map((tool) =>
createToolButton(tool.icon, tool.title, tool.action)
)}
</div>
<div className="divider">Обрезка</div>
<div className="tools-grid">
{clippingTools.map((tool) =>
createToolButton(tool.icon, tool.title, tool.action)
)}
</div>
<div className="control-group">
<label>Скорость движения: <span className="value">{moveSpeed.toFixed(1)}</span></label>
<input
ref={moveSpeedRef}
type="range"
min="1"
max="1000"
step="0.1"
value={moveSpeed}
onChange={(e) => handleSliderChange('moveSpeed', parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Примечание</div>
<p style={{ fontSize: '12px', color: 'rgba(255, 255, 255, 0.7)', margin: 0 }}>
Инструменты навигации перенесены в отдельную панель справа →
</p>
</div>
)}
</div>
{/* СЦЕНА */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'scene' ? 'active' : ''}`}
onClick={() => toggleSection('scene')}
>
Сцена
</h3>
{activeSection === 'scene' && (
<div className="section-content">
<div className="divider">Экспорт</div>
<div className="export-buttons">
<button className="export-btn" title="Экспорт GeoJSON">
<img src="/potree/resources/icons/file_geojson.svg" alt="GeoJSON" />
</button>
<button className="export-btn" title="Экспорт DXF">
<img src="/potree/resources/icons/file_dxf.svg" alt="DXF" />
</button>
<button className="export-btn" title="Экспорт Potree">
<img src="/potree/resources/icons/file_potree.svg" alt="Potree" />
</button>
</div>
<div className="divider">Объекты</div>
<div className="scene-tree">
{/* Здесь будет дерево объектов сцены */}
<div className="tree-item">Point Clouds</div>
<div className="tree-item">Measurements</div>
<div className="tree-item">Annotations</div>
<div className="tree-item">Other</div>
</div>
</div>
)}
</div>
{/* ФИЛЬТРЫ */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'filters' ? 'active' : ''}`}
onClick={() => toggleSection('filters')}
>
Фильтры
</h3>
{activeSection === 'filters' && (
<div className="section-content">
<div className="divider">Классификация</div>
<div className="classification-list">
{/* Здесь будут элементы классификации */}
<label className="checkbox-label">
<input type="checkbox" defaultChecked />
Показать/скрыть всё
</label>
</div>
</div>
)}
</div>
</div>
</div>

View File

@ -127,192 +127,21 @@
transform: translateX(-100%);
}
/* Стили для сайдбара Potree */
#potree_sidebar_container {
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 300px !important;
height: 100% !important;
background: rgba(142, 152, 168, 1) !important;
z-index: 1000 !important;
overflow-y: auto !important;
transition: transform 0.3s ease !important;
}
/* Стили для содержимого сайдбара - удалены, используем React компонент */
#potree_sidebar_container.hidden {
transform: translateX(-100%) !important;
}
/* Стили для меню - удалены, используем React компонент */
/* Стили для содержимого сайдбара */
#sidebar_root {
width: 100% !important;
height: 100% !important;
color: white !important;
}
/* Стили для заголовков аккордеона - удалены, используем React компонент */
#sidebar_header {
padding: 10px !important;
background: rgba(0, 0, 0, 0.3) !important;
border-bottom: 1px solid #555 !important;
}
/* Стили для слайдеров - удалены, используем React компонент */
.potree_sidebar_brand a {
color: #4CAF50 !important;
text-decoration: none !important;
font-weight: bold !important;
}
/* Стили для чекбоксов и радиокнопок - удалены, используем React компонент */
/* Стили для меню */
.accordion {
background: transparent !important;
}
/* Стили для лейблов - удалены, используем React компонент */
/* Стили для заголовков аккордеона - черный текст без обводки */
#potree_sidebar_container .accordion h3,
#potree_sidebar_container .ui-accordion-header,
#potree_sidebar_container h3.ui-accordion-header,
.potree-sidebar .accordion h3,
.potree-sidebar .ui-accordion-header,
.accordion h3 {
color: black !important;
text-shadow: none !important;
-webkit-text-stroke: none !important;
text-stroke: none !important;
font-weight: bold !important;
padding: 10px !important;
margin: 0 !important;
cursor: pointer !important;
}
/* Стили для разделителей - удалены, используем React компонент */
.accordion .ui-accordion-content {
background: rgba(122, 132, 148, 0.9) !important;
color: white !important;
padding: 10px !important;
border: none !important;
}
.pv-menu-list {
list-style: none !important;
padding: 0 !important;
margin: 0 !important;
}
.pv-menu-list li {
padding: 5px 0 !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}
/* Стили для слайдеров - более специфичные селекторы */
#potree_sidebar_container .ui-slider,
#potree_sidebar_container div.ui-slider,
.potree-sidebar .ui-slider,
.ui-slider {
background: rgba(60, 60, 60, 0.8) !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
border-radius: 4px !important;
height: 8px !important;
margin: 5px 0 !important;
}
#potree_sidebar_container .ui-slider-horizontal,
#potree_sidebar_container div.ui-slider-horizontal,
.potree-sidebar .ui-slider-horizontal,
.ui-slider-horizontal {
height: 8px !important;
}
#potree_sidebar_container .ui-slider .ui-slider-handle,
#potree_sidebar_container div.ui-slider .ui-slider-handle,
#potree_sidebar_container .ui-slider-handle,
.potree-sidebar .ui-slider .ui-slider-handle,
.ui-slider .ui-slider-handle,
.ui-slider-handle {
background: linear-gradient(to bottom, #4CAF50, #45a049) !important;
border: 2px solid #fff !important;
border-radius: 50% !important;
width: 18px !important;
height: 18px !important;
top: -6px !important;
cursor: pointer !important;
outline: none !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
position: absolute !important;
}
#potree_sidebar_container .ui-slider .ui-slider-handle:hover,
#potree_sidebar_container div.ui-slider .ui-slider-handle:hover,
#potree_sidebar_container .ui-slider-handle:hover,
.potree-sidebar .ui-slider .ui-slider-handle:hover,
.ui-slider .ui-slider-handle:hover,
.ui-slider-handle:hover {
background: linear-gradient(to bottom, #5CBF60, #4CAF50) !important;
transform: scale(1.1) !important;
transition: all 0.2s ease !important;
}
#potree_sidebar_container .ui-slider .ui-slider-handle:focus,
#potree_sidebar_container div.ui-slider .ui-slider-handle:focus,
#potree_sidebar_container .ui-slider-handle:focus,
.potree-sidebar .ui-slider .ui-slider-handle:focus,
.ui-slider .ui-slider-handle:focus,
.ui-slider-handle:focus {
background: linear-gradient(to bottom, #5CBF60, #4CAF50) !important;
box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3) !important;
}
#potree_sidebar_container .ui-slider-range,
#potree_sidebar_container div.ui-slider-range,
.potree-sidebar .ui-slider-range,
.ui-slider-range {
background: linear-gradient(to right, #4CAF50, #45a049) !important;
border-radius: 4px !important;
height: 100% !important;
}
/* Стили для активных слайдеров */
#potree_sidebar_container .ui-slider.ui-state-focus,
#potree_sidebar_container .ui-slider:focus,
.potree-sidebar .ui-slider.ui-state-focus,
.potree-sidebar .ui-slider:focus,
.ui-slider.ui-state-focus,
.ui-slider:focus {
outline: none !important;
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3) !important;
}
/* Стили для чекбоксов и радиокнопок */
#potree_sidebar_container input[type="checkbox"],
#potree_sidebar_container input[type="radio"] {
accent-color: #4CAF50 !important;
width: 16px !important;
height: 16px !important;
margin-right: 8px !important;
}
/* Стили для лейблов */
#potree_sidebar_container label {
color: white !important;
cursor: pointer !important;
display: flex !important;
align-items: center !important;
margin: 5px 0 !important;
}
/* Стили для разделителей */
#potree_sidebar_container .divider {
color: #ffffff !important;
font-weight: bold !important;
margin: 10px 0 5px 0 !important;
padding: 5px 0 !important;
border-bottom: 1px solid rgba(76, 175, 80, 0.3) !important;
}
/* Стили для значений слайдеров */
#potree_sidebar_container span[id^="lbl"] {
color: rgba(182, 237, 227, 1) !important;
font-weight: bold !important;
}
/* Стили для значений слайдеров - удалены, используем React компонент */
/* Адаптивность */
@media (max-width: 768px) {
@ -341,10 +170,6 @@
height: 35px;
font-size: 16px;
}
#potree_sidebar_container {
width: 250px !important;
}
}
/* Отдельная кнопка для управления сайдбаром */

View File

@ -1,5 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import PotreeSidebar from '../components/PotreeSidebar';
import NavigationPanel from '../components/NavigationPanel';
import '../components/PotreeViewer.css';
// Простое объявление типов для избежания конфликтов
@ -8,11 +10,11 @@ declare const window: any;
const PotreeViewer: React.FC = () => {
const navigate = useNavigate();
const renderAreaRef = useRef<HTMLDivElement>(null);
const sidebarRef = useRef<HTMLDivElement>(null);
const [isLoading, setIsLoading] = useState(true);
const [loadingMessage, setLoadingMessage] = useState('Инициализация...');
const [error, setError] = useState<string | null>(null);
const [sidebarVisible, setSidebarVisible] = useState(true);
const [viewer, setViewer] = useState<any>(null);
// Функция для принудительного применения стилей к слайдерам
const applySliderStyles = () => {
@ -282,7 +284,19 @@ const PotreeViewer: React.FC = () => {
// Создаем viewer
window.viewer = new window.Potree.Viewer(renderAreaRef.current);
setViewer(window.viewer); // Сохраняем ссылку для React-компонента
// Отключаем встроенный сайдбар Potree
if (window.viewer.sidebar) {
window.viewer.sidebar.dom.hide();
}
// Скрываем встроенные элементы управления
const sidebarContainer = document.getElementById('potree_sidebar_container');
if (sidebarContainer) {
sidebarContainer.style.display = 'none';
}
if (!window.viewer) {
throw new Error('Viewer creation returned null');
}
@ -618,18 +632,6 @@ const PotreeViewer: React.FC = () => {
const toggleSidebar = () => {
setSidebarVisible(!sidebarVisible);
// Управляем видимостью сайдбара через CSS класс
const sidebarContainer = document.getElementById('potree_sidebar_container');
if (sidebarContainer) {
if (sidebarVisible) {
sidebarContainer.classList.add('hidden');
} else {
sidebarContainer.classList.remove('hidden');
}
}
// НЕ вызываем встроенный метод Potree, используем только нашу логику
console.log('Sidebar toggled:', !sidebarVisible);
};
@ -689,6 +691,9 @@ const PotreeViewer: React.FC = () => {
</button>
</div>
{/* Навигационная панель */}
<NavigationPanel viewer={viewer} />
{/* Контейнер Potree */}
<div className="potree_container">
<div
@ -696,14 +701,24 @@ const PotreeViewer: React.FC = () => {
ref={renderAreaRef}
/>
{/* Сайдбар */}
<div
id="potree_sidebar_container"
ref={sidebarRef}
className={`potree-sidebar ${!sidebarVisible ? 'hidden' : ''}`}
>
{/* Potree создаст свой сайдбар здесь */}
</div>
{/* React Сайдбар */}
{sidebarVisible && (
<div
id="potree_sidebar_container"
className="potree-sidebar"
style={{
position: 'absolute',
top: 0,
left: 0,
width: '300px',
height: '100%',
zIndex: 1000,
transition: 'transform 0.3s ease'
}}
>
<PotreeSidebar viewer={viewer} />
</div>
)}
</div>
</div>
);