|
|
@ -20,9 +20,10 @@ export default function MeasureRecord() { |
|
|
|
const [measure, setMeasure] = useState<Measurement | undefined>(undefined); |
|
|
|
const canvasRef = useRef<MeasurementCanvasRef>(null); |
|
|
|
const back = () => navigate(-1); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
Bridge.getMeasurementDetail({ id: +(params.recordId || '') }).then((res) => { |
|
|
|
setshowCalibration(false) |
|
|
|
if (res.success) { |
|
|
|
setMeasure({ ...res.data, extraDescObj: JSON.parse(res.data.extraDesc) }); |
|
|
|
} else { |
|
|
@ -44,14 +45,20 @@ export default function MeasureRecord() { |
|
|
|
canvasRef.current.setMeasurementDataRight(JSON.parse(rightPoints)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const [showCalibration, setshowCalibration] = useState(false) |
|
|
|
useEffect(() => { |
|
|
|
if (measure) { |
|
|
|
const r = baseState.railTypes.find((rail) => rail.code === measure.railSize); |
|
|
|
if (!r) return; |
|
|
|
if (!!r.points) { |
|
|
|
drawRailBaseLine(r.points); |
|
|
|
drawMeasurePoints(measure.leftPoints, measure.rightPoints); |
|
|
|
// drawMeasurePoints(measure.leftPoints, measure.rightPoints);
|
|
|
|
setshowCalibration(true) |
|
|
|
if(measure.alignPoints){ |
|
|
|
let alignPoints = JSON.parse(measure.alignPoints) |
|
|
|
canvasRef.current?.setMeasurementCalibrationData(alignPoints) |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
Bridge.getTrackPoint({ code: r.code }).then((res) => { |
|
|
@ -97,6 +104,7 @@ export default function MeasureRecord() { |
|
|
|
showScale={false} |
|
|
|
scaleInterval={1} |
|
|
|
showCoordinates={false} |
|
|
|
showCalibration={showCalibration} |
|
|
|
ref={canvasRef} |
|
|
|
/> |
|
|
|
</div> |
|
|
|