// Copyright (c) 2012-2013, IGN France.
// Copyright (c) 2012-2024, Oslandia.
// Copyright (c) 2024-2026, SFCGAL team.
// SPDX-License-Identifier: LGPL-2.0-or-later

#ifndef SFCGAL_TRANSFORM_FORCEZ_ORDER_POINTS_H_
#define SFCGAL_TRANSFORM_FORCEZ_ORDER_POINTS_H_

#include "SFCGAL/config.h"

#include "SFCGAL/Kernel.h"
#include "SFCGAL/Transform.h"

namespace SFCGAL::transform {

/**
 * Force Z. If the 2D surface is pointing down, reverse its points
 *
 * @todo unittest
 * @todo move outside (it's not a coordinate transform)?
 */
class SFCGAL_API ForceZOrderPoints : public Transform {
public:
  /**
   * @brief Constructor with a default Z value
   * @param defaultZ The default Z coordinate value (default 0)
   */
  ForceZOrderPoints(Kernel::FT defaultZ = 0);

  /**
   * @brief Transform a point to force Z coordinates
   * @param point The point to transform
   */
  void
  transform(Point &point) override;

  /**
   * @brief Visit and force point order for a triangle with Z coordinates
   * @param triangle The triangle to visit
   */
  void
  visit(Triangle &triangle) override;
  /**
   * @brief Visit and force point order for a polygon with Z coordinates
   * @param polygon The polygon to visit
   */
  void
  visit(Polygon &polygon) override;

private:
  Kernel::FT _defaultZ;
};

} // namespace SFCGAL::transform

#endif
