Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/types/processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type EfficientRansacParams = {
epsilon: number;
cluster_epsilon: number;
normal_threshold: number;
primitive: [string];
};

export type RansacResultsDto = {
Expand Down
26 changes: 21 additions & 5 deletions src/components/formModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { SyntheticEvent, useRef, useState } from "react";

/* COMPONENTS */
import FormParameter from "./item";
import { Button, Modal } from "antd";
import { Button, Modal, Checkbox, Col, Row } from "antd";
import Draggable from "react-draggable";
import { CloseOutlined } from "@ant-design/icons";

Expand All @@ -19,7 +19,8 @@ function FormModal<T extends FieldValues>({
submitText,
cancelText,
parameters,
blockCondition = false,
options,
blockCondition = true,
blockDescription = "",
onClose,
onSubmit,
Expand Down Expand Up @@ -104,11 +105,11 @@ function FormModal<T extends FieldValues>({
onSubmit={handleSubmit(onSubmit)}
className="flex flex-col items-center"
>
{blockCondition ? (
{/* {blockCondition ? (
<h2 className="w-full text-center text-base break-words mb-4">
{blockDescription}
</h2>
) : (
) : ( */}
<>
{subtitle && (
<h2 className="w-full text-justify text-xs break-words mb-4">
Expand All @@ -123,8 +124,23 @@ function FormModal<T extends FieldValues>({
{...item}
/>
))}
<Checkbox.Group
style={{
width: "50%",
margin: "20px 0",
}}
onChange={(values) => console.log(values)}
>
<Row defaultChecked={true}>
{options?.map(item => (
<Col span={6}>
<Checkbox value={item.value}>{item.label}</Checkbox>
</Col>
))}
</Row>
</Checkbox.Group>
</>
)}
{/* )} */}
<div className="w-full flex justify-center gap-4 mt-4">
<Button onClick={handleCancel}>{cancelText}</Button>
{!blockCondition && (
Expand Down
8 changes: 8 additions & 0 deletions src/components/formModal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type FormModalProps<T extends FieldValues> = Pick<
blockCondition?: boolean;
blockDescription?: string;
parameters: ParameterItem<T>[];
options?: Option<T>[];
onSubmit: (data: T) => void;
};

Expand All @@ -31,6 +32,13 @@ export type ParameterItem<T> = {
allowNegative?: boolean;
};

export type Option<T> = {
label: string;
value: string;
disabled?: boolean;
}


// Parameters type
export type ParameterProps<T extends FieldValues> = ParameterItem<T> & {
error?: string;
Expand Down
23 changes: 23 additions & 0 deletions src/containers/modals/processing/efficientRansac.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,35 @@ const EfficientRansacModal: FC = () => {
probability: data.probability,
cluster_epsilon: data.clusterEpsilon,
normal_threshold: data.normalThreshold,
primitive: data.primitive
});
closeModal();
};

return (
<FormModal<EfficientRansacFormData>
options={[
{
label: t("common.plane"),
value: "plane",
disabled: true,
},
{
label: t("common.cylinder"),
value: "cylinder",
disabled: true,
},
{
label: t("common.cone"),
value: "cone",
disabled: true,
},
{
label: t("common.sphere"),
value: "sphere",
disabled: true,
},
]}
parameters={[
{
id: "probability",
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/processing/useEfficientRansac.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const EfficientRansacProvider: FC<IEfficientRansacProviderProps> = ({
epsilon: 0,
minPoints: 0,
normalThreshold: 0,
primitive: [""],
});

// Efficient Ransac handlers
Expand All @@ -52,6 +53,7 @@ export const EfficientRansacProvider: FC<IEfficientRansacProviderProps> = ({
epsilon: 0,
minPoints: 0,
normalThreshold: 0,
primitive: [""],
});
const updateSuggestedParams = (strObj: string) => {
setSuggestedParams({
Expand Down
1 change: 1 addition & 0 deletions src/utils/types/processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export type EfficientRansacFormData = {
epsilon: number;
clusterEpsilon: number;
normalThreshold: number;
primitive: [string];
};