ShapeGroupElement.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libmspub project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __SHAPEGROUPELEMENT_H__
00011 #define __SHAPEGROUPELEMENT_H__
00012 #include <boost/optional.hpp>
00013 #include <boost/function.hpp>
00014 #include <vector>
00015 
00016 #include "ShapeInfo.h"
00017 #include "VectorTransformation2D.h"
00018 
00019 namespace libmspub
00020 {
00021 class ShapeGroupElement
00022 {
00023   boost::optional<ShapeInfo> m_shapeInfo;
00024   ShapeGroupElement *m_parent;
00025   std::vector<ShapeGroupElement *> m_children;
00026   unsigned m_seqNum;
00027   ShapeGroupElement &operator=(const ShapeGroupElement &); //not implemented
00028   ShapeGroupElement(const ShapeGroupElement &); //not implemented
00029   VectorTransformation2D m_transform;
00030 public:
00031   ShapeGroupElement(ShapeGroupElement *parent);
00032   ShapeGroupElement(ShapeGroupElement *parent, unsigned seqNum);
00033   ~ShapeGroupElement();
00034   void setShapeInfo(const ShapeInfo &shapeInfo);
00035   void setup(boost::function<void(ShapeGroupElement &self)> visitor);
00036   void visit(boost::function<
00037              boost::function<void(void)>
00038              (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor,
00039              const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform) const;
00040   void visit(boost::function<
00041              boost::function<void(void)>
00042              (const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const;
00043   bool isGroup() const;
00044   ShapeGroupElement *getParent();
00045   const ShapeGroupElement *getParent() const;
00046   void setSeqNum(unsigned seqNum);
00047   void setTransform(const VectorTransformation2D &transform);
00048   unsigned getSeqNum() const;
00049 };
00050 }
00051 
00052 #endif
00053 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */