]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/polygon/doc/tutorial/layout_database.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / polygon / doc / tutorial / layout_database.hpp
CommitLineData
7c673cae
FG
1/*
2Copyright 2010 Intel Corporation
3
4Use, modification and distribution are subject to the Boost Software License,
5Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6http://www.boost.org/LICENSE_1_0.txt).
7*/
8
9//layout_database.hpp
10#ifndef BOOST_POLYGON_TUTORIAL_LAYOUT_DATABASE_HPP
11#define BOOST_POLYGON_TUTORIAL_LAYOUT_DATABASE_HPP
12#include <boost/polygon/polygon.hpp>
13#include <map>
14#include "layout_rectangle.hpp"
15
16typedef std::map<std::string, boost::polygon::polygon_90_set_data<int> > layout_database;
17
18//map the layout rectangle data type to the boost::polygon::rectangle_concept
19namespace boost { namespace polygon{
20 template <>
21 struct rectangle_traits<layout_rectangle> {
22 typedef int coordinate_type;
23 typedef interval_data<int> interval_type;
24 static inline interval_type get(const layout_rectangle& rectangle, orientation_2d orient) {
25 if(orient == HORIZONTAL)
26 return interval_type(rectangle.xl, rectangle.xh);
27 return interval_type(rectangle.yl, rectangle.yh);
28 }
29 };
30
31 template <>
32 struct geometry_concept<layout_rectangle> { typedef rectangle_concept type; };
33}}
34
35//insert layout rectangles into a layout database
36inline void populate_layout_database(layout_database& layout, std::vector<layout_rectangle>& rects) {
37 for(std::size_t i = 0; i < rects.size(); ++i) {
38 layout[rects[i].layer].insert(rects[i]);
39 }
40}
41#endif