Blame src/lib/ShapeGroupElement.h

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