Compare commits
No commits in common. "main" and "v1.0.1" have entirely different histories.
@ -101,13 +101,6 @@ const FormComponent = <T extends Drone | BaseStation>({ entity, onUpdate }: Form
|
|||||||
onChange={(e) => handleInputChange('signalRadius', +e.target.value)}
|
onChange={(e) => handleInputChange('signalRadius', +e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-4">
|
|
||||||
<label className="block mb-1 text-sm font-medium">Signal power:</label>
|
|
||||||
<input
|
|
||||||
className="w-full p-2 bg-gray-800 border border-gray-600 rounded focus:outline-none focus:border-blue-500"
|
|
||||||
type="number"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{'antennaDirection' in formData && (
|
{'antennaDirection' in formData && (
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<label className="block mb-1 text-sm font-medium">Antenna Direction (x, y, z):</label>
|
<label className="block mb-1 text-sm font-medium">Antenna Direction (x, y, z):</label>
|
||||||
|
@ -163,7 +163,6 @@ const PlayerTsInstance: React.FC<IPlayerTsInstance> = ({
|
|||||||
const [drones, setDrones] = useState<DroneSim[]>([]);
|
const [drones, setDrones] = useState<DroneSim[]>([]);
|
||||||
const [baseStations, setBaseStations] = useState<BaseStation[]>([]);
|
const [baseStations, setBaseStations] = useState<BaseStation[]>([]);
|
||||||
const [isPlaying, setIsPlaying] = useState(false); // Флаг для управления анимацией
|
const [isPlaying, setIsPlaying] = useState(false); // Флаг для управления анимацией
|
||||||
const [droneTrajectories, setDroneTrajectories] = useState<Record<string, [number, number, number][]>>({});
|
|
||||||
|
|
||||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
@ -177,26 +176,13 @@ const PlayerTsInstance: React.FC<IPlayerTsInstance> = ({
|
|||||||
const updateObjects = (timestamp: number) => {
|
const updateObjects = (timestamp: number) => {
|
||||||
if (!Simulations) return;
|
if (!Simulations) return;
|
||||||
|
|
||||||
const timestampKey = timestamp.toString();
|
const simulationStep = Simulations[timestamp];
|
||||||
const simulationStep = Simulations[timestampKey];
|
|
||||||
|
|
||||||
if (simulationStep) {
|
if (simulationStep) {
|
||||||
const updatedDrones = Object.values(simulationStep).map((drone) => ({
|
const updatedDrones = Object.values(simulationStep).map((drone) => ({
|
||||||
...drone,
|
...drone,
|
||||||
}));
|
}));
|
||||||
|
// @ts-ignore
|
||||||
setDrones(updatedDrones);
|
setDrones(updatedDrones);
|
||||||
|
|
||||||
// Обновление траектории для каждого дрона
|
|
||||||
setDroneTrajectories((prevTrajectories) => {
|
|
||||||
const newTrajectories = { ...prevTrajectories };
|
|
||||||
updatedDrones.forEach((drone) => {
|
|
||||||
if (!newTrajectories[drone.name]) {
|
|
||||||
newTrajectories[drone.name] = [];
|
|
||||||
}
|
|
||||||
newTrajectories[drone.name] = [...newTrajectories[drone.name], drone.position];
|
|
||||||
});
|
|
||||||
return newTrajectories;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -245,7 +231,7 @@ const PlayerTsInstance: React.FC<IPlayerTsInstance> = ({
|
|||||||
<BaseStationModel
|
<BaseStationModel
|
||||||
key={baseStation.id}
|
key={baseStation.id}
|
||||||
position={baseStation.position}
|
position={baseStation.position}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
baseStationName={baseStation.name}
|
baseStationName={baseStation.name}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -258,15 +244,6 @@ const PlayerTsInstance: React.FC<IPlayerTsInstance> = ({
|
|||||||
droneName={drone.name}
|
droneName={drone.name}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{Object.entries(droneTrajectories).map(([droneName, positions]) => (
|
|
||||||
<Line
|
|
||||||
key={droneName}
|
|
||||||
points={positions} // массив позиций для линии
|
|
||||||
color="red" // цвет линии
|
|
||||||
lineWidth={2} // ширина линии
|
|
||||||
dashed={false}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -285,6 +262,7 @@ const PlayerTsInstance: React.FC<IPlayerTsInstance> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Модель карты
|
// Модель карты
|
||||||
const MapModel = () => {
|
const MapModel = () => {
|
||||||
const { scene } = useGLTF('/map/map.glb');
|
const { scene } = useGLTF('/map/map.glb');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { Canvas } from '@react-three/fiber';
|
import { Canvas } from '@react-three/fiber';
|
||||||
import { OrbitControls, useGLTF, Line, Text, Box } from '@react-three/drei';
|
import { OrbitControls, useGLTF, Line, Text } from '@react-three/drei';
|
||||||
import { useState, useEffect, useRef } from 'react';
|
import { useState, useEffect, useRef } from 'react';
|
||||||
import { Drone, BaseStation } from './Models';
|
import { Drone, BaseStation } from './Models';
|
||||||
import { PlayCircleIcon } from '@heroicons/react/24/outline';
|
import { PlayCircleIcon } from '@heroicons/react/24/outline';
|
||||||
@ -260,9 +260,6 @@ const DroneModel = ({ position, droneName, onClick, isSelected }: { position: [n
|
|||||||
<meshBasicMaterial color="red" wireframe />
|
<meshBasicMaterial color="red" wireframe />
|
||||||
</mesh>
|
</mesh>
|
||||||
)}
|
)}
|
||||||
<Box position={position}>
|
|
||||||
<meshBasicMaterial color="green" wireframe />
|
|
||||||
</Box>
|
|
||||||
</group>
|
</group>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@ const Simulations: React.FC = () => {
|
|||||||
position: drone.position,
|
position: drone.position,
|
||||||
freq: drone.frequency,
|
freq: drone.frequency,
|
||||||
radius: drone.signalRadius,
|
radius: drone.signalRadius,
|
||||||
endpoints: [drone.position, [7, 5, 2], [9, 5, 2], [10, 5, 1]], // TODO: статические значения
|
endpoints: [[0, 5, 1], [10, 5, 1]], // TODO: статические значения
|
||||||
speed: 1 // TODO: можно изменить при необходимости
|
speed: 1 // TODO: можно изменить при необходимости
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user