Survei Riset: Ceritakan pengalaman Anda dengan Blockly
Mulai survei
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
blockly > ConnectionDB > searchForClosest
Metode ConnectionDB.searchForClosest()
Temukan koneksi yang kompatibel dan terdekat dengan koneksi ini.
Tanda Tangan:
searchForClosest(conn: RenderedConnection, maxRadius: number, dxy: Coordinate): {
connection: RenderedConnection | null;
radius: number;
};
Parameter
Parameter |
Jenis |
Deskripsi |
conn |
RenderedConnection |
Koneksi yang menelusuri pasangan yang kompatibel. |
maxRadius |
angka |
Radius maksimum ke koneksi lain. |
dxy |
Koordinasi |
Offset antara lokasi koneksi ini di database dan lokasi saat ini (sebagai akibat dari penarikan). |
Hasil:
{ connection: RenderedConnection | null; radius: number; }
Berisi dua properti: 'connection' yang merupakan koneksi atau null, dan 'radius' yang merupakan jarak.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-11-06 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2024-11-06 UTC."],[[["The `searchForClosest` method helps find the nearest compatible connection within a given radius for a provided connection."],["It considers an offset to account for connection dragging and returns the closest connection (or null) along with the distance."]]],["The `searchForClosest()` method in `ConnectionDB` locates the nearest compatible connection. It takes a `RenderedConnection` (`conn`), a `maxRadius` (number), and a `Coordinate` (`dxy`) for location offset as parameters. It returns an object containing two properties: `connection`, which is either a found `RenderedConnection` or `null`, and `radius`, the distance to the found connection. The method identifies the closest matching connection within the defined radius.\n"]]