Blame src/lib/ShapeGroupElement.h

Packit Service 7605e7
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Packit Service 7605e7
/*
Packit Service 7605e7
 * This file is part of the libmspub project.
Packit Service 7605e7
 *
Packit Service 7605e7
 * This Source Code Form is subject to the terms of the Mozilla Public
Packit Service 7605e7
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Packit Service 7605e7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
Packit Service 7605e7
 */
Packit Service 7605e7
Packit Service 7605e7
#ifndef INCLUDED_SHAPEGROUPELEMENT_H
Packit Service 7605e7
#define INCLUDED_SHAPEGROUPELEMENT_H
Packit Service 7605e7
Packit Service 7605e7
#include <functional>
Packit Service 7605e7
#include <memory>
Packit Service 7605e7
#include <vector>
Packit Service 7605e7
Packit Service 7605e7
#include <boost/optional.hpp>
Packit Service 7605e7
Packit Service 7605e7
#include "ShapeInfo.h"
Packit Service 7605e7
#include "VectorTransformation2D.h"
Packit Service 7605e7
Packit Service 7605e7
namespace libmspub
Packit Service 7605e7
{
Packit Service 7605e7
Packit Service 7605e7
struct Coordinate;
Packit Service 7605e7
Packit Service 7605e7
class ShapeGroupElement
Packit Service 7605e7
{
Packit Service 7605e7
  boost::optional<ShapeInfo> m_shapeInfo;
Packit Service 7605e7
  std::weak_ptr<ShapeGroupElement> m_parent;
Packit Service 7605e7
  std::vector<std::shared_ptr<ShapeGroupElement>> m_children;
Packit Service 7605e7
  unsigned m_seqNum;
Packit Service 7605e7
  ShapeGroupElement &operator=(const ShapeGroupElement &) = delete;
Packit Service 7605e7
  ShapeGroupElement(const ShapeGroupElement &) = delete;
Packit Service 7605e7
  VectorTransformation2D m_transform;
Packit Service 7605e7
  ShapeGroupElement(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum);
Packit Service 7605e7
Packit Service 7605e7
public:
Packit Service 7605e7
  ~ShapeGroupElement();
Packit Service 7605e7
  static std::shared_ptr<ShapeGroupElement> create(const std::shared_ptr<ShapeGroupElement> &parent, unsigned seqNum = 0);
Packit Service 7605e7
Packit Service 7605e7
  void setShapeInfo(const ShapeInfo &shapeInfo);
Packit Service 7605e7
  void setup(std::function<void(ShapeGroupElement &self)> visitor);
Packit Service 7605e7
  void visit(std::function<
Packit Service 7605e7
             std::function<void(void)>
Packit Service 7605e7
             (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor,
Packit Service 7605e7
             const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform) const;
Packit Service 7605e7
  void visit(std::function<
Packit Service 7605e7
             std::function<void(void)>
Packit Service 7605e7
             (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const;
Packit Service 7605e7
  bool isGroup() const;
Packit Service 7605e7
  std::shared_ptr<ShapeGroupElement> getParent() const;
Packit Service 7605e7
  void setSeqNum(unsigned seqNum);
Packit Service 7605e7
  void setTransform(const VectorTransformation2D &transform);
Packit Service 7605e7
  unsigned getSeqNum() const;
Packit Service 7605e7
};
Packit Service 7605e7
}
Packit Service 7605e7
Packit Service 7605e7
#endif
Packit Service 7605e7
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */