@@ -47,13 +47,6 @@ inline namespace v1 {
47
47
Diagonal = 0x02 , // /< The neighbors may be in diagonal
48
48
};
49
49
50
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
51
- }
52
- #endif
53
-
54
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
55
- namespace v1 {
56
- #endif
57
50
58
51
/* *
59
52
* @ingroup core_cells
@@ -265,264 +258,6 @@ namespace v1 {
265
258
266
259
#ifndef DOXYGEN_SHOULD_SKIP_THIS
267
260
}
268
- #endif
269
-
270
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
271
- inline namespace v2 {
272
-
273
- /* *
274
- * @ingroup core_cells
275
- * @brief The properties of cells
276
- *
277
- * These properties depend on the orientation of the cells in the map:
278
- *
279
- * - gf::OrthogonalCells
280
- * - gf::IsometricCells
281
- * - gf::StaggeredCells
282
- * - gf::HexagonalCells
283
- *
284
- * @sa gf::CellOrientation, gf::Grid, gf::TileLayer
285
- */
286
- class GF_CORE_API Cells {
287
- public:
288
- /* *
289
- * @brief Virtual destructor
290
- */
291
- virtual ~Cells ();
292
-
293
- /* *
294
- * @brief Compute the local bounds of the cells
295
- *
296
- * @returns The bounds of the cells
297
- */
298
- virtual RectF computeBounds () const noexcept = 0;
299
-
300
- /* *
301
- * @brief Compute the visible area in terms of coordinates
302
- *
303
- * @param local The visible area
304
- * @returns The visible coordinates
305
- */
306
- virtual RectI computeVisibleArea (const RectF& local) const noexcept = 0;
307
-
308
- /* *
309
- * @brief Compute the cell bounds
310
- *
311
- * @param coords The coordinates of the cell
312
- * @returns The rectangular bounding box of the cell
313
- */
314
- virtual RectF computeCellBounds (Vector2i coords) const noexcept = 0;
315
-
316
- /* *
317
- * @brief Compute the coordinates of a cell
318
- *
319
- * @param position The local position
320
- * @returns The coordinates of the cell
321
- */
322
- virtual Vector2i computeCoordinates (Vector2f position) const noexcept = 0;
323
-
324
- /* *
325
- * @brief Compute the polyline representing a cell
326
- *
327
- * @param coords The coordinates of the cell
328
- * @returns A polyline (loop) that represents the cell
329
- */
330
- virtual Polyline computePolyline (Vector2i coords) const = 0;
331
-
332
- /* *
333
- * @brief Compute the neighbors of a cell
334
- *
335
- * @param coords The coordinates of the cell
336
- * @param flags The parameters of the query
337
- * @returns An array of coordinates of the neighbors
338
- */
339
- virtual std::vector<Vector2i> computeNeighbors (Vector2i coords, Flags<CellNeighborQuery> flags = gf::None) const = 0;
340
- };
341
-
342
- /* *
343
- * @ingroup core_cells
344
- * @brief Orthogonal cells
345
- */
346
- class GF_CORE_API OrthogonalCells final : public Cells {
347
- public:
348
- /* *
349
- * @brief Make orthogonal cells of the specified size
350
- *
351
- * @param layerSize The size of the layer
352
- * @param tileSize The size of a cell
353
- */
354
- OrthogonalCells (Vector2i layerSize, Vector2f tileSize)
355
- : m_layerSize(layerSize)
356
- , m_tileSize(tileSize)
357
- {
358
- }
359
-
360
- RectF computeBounds () const noexcept override ;
361
-
362
- RectI computeVisibleArea (const RectF& local) const noexcept override ;
363
-
364
- RectF computeCellBounds (Vector2i coords) const noexcept override ;
365
-
366
- Vector2i computeCoordinates (Vector2f position) const noexcept override ;
367
-
368
- Polyline computePolyline (Vector2i coords) const override ;
369
-
370
- std::vector<Vector2i> computeNeighbors (Vector2i coords, Flags<CellNeighborQuery> flags = gf::None) const override ;
371
-
372
- private:
373
- Vector2i m_layerSize;
374
- Vector2f m_tileSize;
375
- };
376
-
377
- /* *
378
- * @ingroup core_cells
379
- * @brief Isometric cells
380
- */
381
- class GF_CORE_API IsometricCells final : public Cells {
382
- public:
383
- /* *
384
- * @brief Make orthogonal cells of the specified size
385
- *
386
- * @param layerSize The size of the layer
387
- * @param tileSize The size of a cell
388
- */
389
- IsometricCells (Vector2i layerSize, Vector2f tileSize)
390
- : m_layerSize(layerSize)
391
- , m_tileSize(tileSize)
392
- {
393
- }
394
-
395
- RectF computeBounds () const noexcept override ;
396
-
397
- RectI computeVisibleArea (const RectF& local) const noexcept override ;
398
-
399
- RectF computeCellBounds (Vector2i coords) const noexcept override ;
400
-
401
- Vector2i computeCoordinates (Vector2f position) const noexcept override ;
402
-
403
- Polyline computePolyline (Vector2i coords) const override ;
404
-
405
- std::vector<Vector2i> computeNeighbors (Vector2i coords, Flags<CellNeighborQuery> flags = gf::None) const override ;
406
-
407
- private:
408
- Vector2i m_layerSize;
409
- Vector2f m_tileSize;
410
- };
411
-
412
- /* *
413
- * @ingroup core_cells
414
- * @brief Staggered cells
415
- */
416
- class GF_CORE_API StaggeredCells final : public Cells {
417
- public:
418
- /* *
419
- * @brief Make staggered cells of the specified size
420
- *
421
- * @param layerSize The size of the layer
422
- * @param tileSize The size of a cell
423
- * @param axis The cells axis
424
- * @param index The cells index
425
- */
426
- StaggeredCells (Vector2i layerSize, Vector2f tileSize, CellAxis axis, CellIndex index)
427
- : m_layerSize(layerSize)
428
- , m_tileSize(tileSize)
429
- , m_axis(axis)
430
- , m_index(index)
431
- {
432
- }
433
-
434
- RectF computeBounds () const noexcept override ;
435
-
436
- RectI computeVisibleArea (const RectF& local) const noexcept override ;
437
-
438
- RectF computeCellBounds (Vector2i coords) const noexcept override ;
439
-
440
- Vector2i computeCoordinates (Vector2f position) const noexcept override ;
441
-
442
- Polyline computePolyline (Vector2i coords) const override ;
443
-
444
- std::vector<Vector2i> computeNeighbors (Vector2i coords, Flags<CellNeighborQuery> flags = gf::None) const override ;
445
-
446
- private:
447
- Vector2i m_layerSize;
448
- Vector2f m_tileSize;
449
- CellAxis m_axis;
450
- CellIndex m_index;
451
- };
452
-
453
-
454
- /* *
455
- * @ingroup core_cells
456
- * @brief Hexagonal cells
457
- */
458
- class GF_CORE_API HexagonalCells final : public Cells {
459
- public:
460
- /* *
461
- * @brief Make hexagonal cells of the specified size
462
- *
463
- * @param layerSize The size of the layer
464
- * @param tileSize The size of a cell
465
- * @param sideLength The length of the side
466
- * @param axis The cells axis
467
- * @param index The cells index
468
- */
469
- HexagonalCells (Vector2i layerSize, Vector2f tileSize, float sideLength, CellAxis axis, CellIndex index)
470
- : m_layerSize(layerSize)
471
- , m_tileSize(tileSize)
472
- , m_sideLength(sideLength)
473
- , m_axis(axis)
474
- , m_index(index)
475
- {
476
- }
477
-
478
- /* *
479
- * @brief Make hexagonal cells of the specified size
480
- *
481
- * @param layerSize The size of the layer
482
- * @param radius The radius of the regular hexagon
483
- * @param axis The cells axis
484
- * @param index The cells index
485
- */
486
- HexagonalCells (Vector2i layerSize, float radius, CellAxis axis, CellIndex index)
487
- : m_layerSize(layerSize)
488
- , m_tileSize(computeRegularSize(axis, radius))
489
- , m_sideLength(radius)
490
- , m_axis(axis)
491
- , m_index(index)
492
- {
493
- }
494
-
495
- RectF computeBounds () const noexcept override ;
496
-
497
- RectI computeVisibleArea (const RectF& local) const noexcept override ;
498
-
499
- RectF computeCellBounds (Vector2i coords) const noexcept override ;
500
-
501
- Vector2i computeCoordinates (Vector2f position) const noexcept override ;
502
-
503
- Polyline computePolyline (Vector2i coords) const override ;
504
-
505
- std::vector<Vector2i> computeNeighbors (Vector2i coords, Flags<CellNeighborQuery> flags = gf::None) const override ;
506
-
507
- /* *
508
- * @brief Get the size of a regular hexagon
509
- *
510
- * @param axis The hexagon axis
511
- * @param radius Radius of hexagon
512
- *
513
- * @returns The size of the bounding box of the hexagon
514
- */
515
- static Vector2f computeRegularSize (CellAxis axis, float radius);
516
-
517
- private:
518
- Vector2i m_layerSize;
519
- Vector2f m_tileSize;
520
- float m_sideLength;
521
- CellAxis m_axis;
522
- CellIndex m_index;
523
- };
524
-
525
- }
526
261
527
262
template <>
528
263
struct EnableBitmaskOperators <CellNeighborQuery> {
0 commit comments