105 lines
3.0 KiB
Dart
105 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:segmentation_douglas_peucker_flutter/douglas.dart';
|
|
|
|
void main() {
|
|
runApp(const MainApp());
|
|
}
|
|
|
|
class MainApp extends StatelessWidget {
|
|
const MainApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const MaterialApp(
|
|
home: Scaffold(
|
|
body: Center(
|
|
child: Main(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Main extends StatefulWidget {
|
|
const Main({super.key});
|
|
|
|
@override
|
|
State<Main> createState() => _MainState();
|
|
}
|
|
|
|
class _MainState extends State<Main> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// MyLib.runExample();
|
|
Douglas.runExample();
|
|
|
|
return const Text('Hello World!');
|
|
|
|
// final int sum = nativeLibrary.MathLib_Math_Sum(mathLib, list, outException)
|
|
|
|
// final System_Object_t point1 =
|
|
// nativeLibrary.System_Drawing_Point_Create(200, 400, nullptr);
|
|
// final System_Object_t point2 =
|
|
// nativeLibrary.System_Drawing_Point_Create(200, 500, nullptr);
|
|
// final System_Object_t point3 =
|
|
// nativeLibrary.System_Drawing_Point_Create(200, 600, nullptr);
|
|
// final System_Object_t point4 =
|
|
// nativeLibrary.System_Drawing_Point_Create(200, 700, nullptr);
|
|
// final System_Type_t type = nativeLibrary.System_Drawing_Point_TypeOf();
|
|
|
|
// print(DaliPoint.fromPointer(point1));
|
|
|
|
// final correctType = nativeLibrary.DNObjectIs(point1, type);
|
|
|
|
// print('Correct type: $correctType');
|
|
|
|
// final points = nativeLibrary.System_Collections_Generic_List_A1_Create_1(
|
|
// type,
|
|
// 4,
|
|
// exception,
|
|
// );
|
|
|
|
// DotNetException.handle(exception);
|
|
|
|
// final count = nativeLibrary.System_Collections_Generic_List_A1_Count_Get(
|
|
// points,
|
|
// type,
|
|
// exception,
|
|
// );
|
|
|
|
// print('Count: $count');
|
|
|
|
// DotNetException.handle(exception);
|
|
|
|
// return const Text('Hello World!');
|
|
|
|
// nativeLibrary.System_Collections_Generic_List_A1_Add(
|
|
// points, pointType, point1, nullptr);
|
|
// nativeLibrary.System_Collections_Generic_List_A1_Add(
|
|
// points, nullptr, point2, nullptr);
|
|
// nativeLibrary.System_Collections_Generic_List_A1_Add(
|
|
// points, nullptr, point3, nullptr);
|
|
// nativeLibrary.System_Collections_Generic_List_A1_Add(
|
|
// points, nullptr, point4, nullptr);
|
|
|
|
// final reduction = nativeLibrary
|
|
// .DALI_Segmentation_SegmentationDouglasPeucker_DouglasPeuckerReduction(
|
|
// points.cast(), 1, nullptr);
|
|
|
|
// final reducted = <DaliPoint>[];
|
|
|
|
// for (var i = 0; i < count; i++) {
|
|
// final item = nativeLibrary.System_Collections_Generic_List_A1_Item_Get(
|
|
// reduction, nullptr, i, nullptr);
|
|
// reducted.add(DaliPoint.fromPointer(item));
|
|
// }
|
|
|
|
// nativeLibrary.System_Collections_Generic_List_A1_Destroy(reduction);
|
|
// nativeLibrary.System_Collections_Generic_List_A1_Destroy(points);
|
|
|
|
// print(reducted);
|
|
|
|
// return Text('Hello World! ${reducted.length}');
|
|
}
|
|
}
|