Introduced edge pairs as valid shapes for db::Shapes

This commit is contained in:
Matthias Koefferlein 2018-11-09 22:59:26 +01:00
parent b9b00a08b5
commit 8e19474095
14 changed files with 287 additions and 2623 deletions

View File

@ -53,7 +53,7 @@ public:
typedef db::coord_traits<C> coord_traits;
typedef typename coord_traits::distance_type distance_type;
typedef typename coord_traits::area_type area_type;
typedef db::object_tag< edge<C> > tag;
typedef db::object_tag< edge_pair<C> > tag;
/**
* @brief The default constructor.
@ -89,6 +89,24 @@ public:
// .. nothing else ..
}
/**
* @brief The (dummy) translation operator
*/
void translate (const edge_pair<C> &d, db::generic_repository<C> &, db::ArrayRepository &)
{
*this = d;
}
/**
* @brief The (dummy) translation operator
*/
template <class T>
void translate (const edge_pair<C> &d, const T &t, db::generic_repository<C> &, db::ArrayRepository &)
{
*this = d;
transform (t);
}
/**
* @brief A less operator to establish a sorting order.
*/

View File

@ -219,7 +219,7 @@ public:
}
/**
* @brief Returns the transformed edge set
* @brief Returns the transformed edge pair set
*/
template <class T>
EdgePairs transformed (const T &trans) const
@ -230,7 +230,7 @@ public:
}
/**
* @brief Swap with the other region
* @brief Swaps with the other edge pair set
*/
void swap (db::EdgePairs &other)
{
@ -240,7 +240,7 @@ public:
}
/**
* @brief Convert to polygons
* @brief Converts to polygons
*
* Note: because of the include hierarchy we can't use a direct return value.
*
@ -263,7 +263,7 @@ public:
*/
void edges (Edges &output) const;
/*
/**
* @brief Returns the first edges
*
* Note: because of the include hierarchy we can't use a direct return value.
@ -273,7 +273,7 @@ public:
*/
void first_edges (Edges &output) const;
/*
/**
* @brief Returns the second edges
*
* Note: because of the include hierarchy we can't use a direct return value.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ void FlatEdges::merged_semantics_changed ()
void FlatEdges::reserve (size_t n)
{
m_edges.reserve (db::Polygon::tag (), n);
m_edges.reserve (db::Edge::tag (), n);
}
void

View File

@ -29,6 +29,7 @@
#include "dbPolygon.h"
#include "dbPath.h"
#include "dbEdge.h"
#include "dbEdgePair.h"
#include "dbText.h"
#include "dbBox.h"
#include "dbArray.h"
@ -196,6 +197,9 @@ typedef object_with_properties<DPathRef> DPathRefWithProperties;
typedef object_with_properties<Edge> EdgeWithProperties;
typedef object_with_properties<DEdge> DEdgeWithProperties;
typedef object_with_properties<EdgePair> EdgePairWithProperties;
typedef object_with_properties<DEdgePair> DEdgePairWithProperties;
typedef object_with_properties<Text> TextWithProperties;
typedef object_with_properties<DText> DTextWithProperties;
typedef object_with_properties<TextRef> TextRefWithProperties;

View File

@ -52,6 +52,8 @@ db::properties_id_type Shape::prop_id () const
return (**((psimple_polygon_ptr_array_iter_type *) m_generic.iter)).properties_id ();
case Edge:
return (**((pedge_iter_type *) m_generic.iter)).properties_id ();
case EdgePair:
return (**((pedge_pair_iter_type *) m_generic.iter)).properties_id ();
case Path:
return (**((ppath_iter_type *) m_generic.iter)).properties_id ();
case PathRef:
@ -99,6 +101,8 @@ db::properties_id_type Shape::prop_id () const
return m_generic.psimple_polygon_aref->properties_id ();
case Edge:
return m_generic.pedge->properties_id ();
case EdgePair:
return m_generic.pedge_pair->properties_id ();
case Path:
return m_generic.ppath->properties_id ();
case PathRef:
@ -701,6 +705,8 @@ Shape::box_type Shape::bbox () const
return basic_ptr (text_ptr_array_type::tag ())->bbox (db::box_convert<text_ptr_type> ());
case Edge:
return box_type (edge ().p1 (), edge ().p2 ());
case EdgePair:
return edge_pair ().bbox ();
case Path:
return path ().box ();
case PathRef:
@ -772,6 +778,9 @@ Shape::to_string () const
case Edge:
r = "edge " + edge ().to_string ();
break;
case EdgePair:
r = "edge_pair " + edge_pair ().to_string ();
break;
case Path:
case PathRef:
case PathPtrArrayMember:
@ -810,6 +819,4 @@ Shape::to_string () const
return r;
}
}

View File

@ -32,6 +32,7 @@
#include "dbPolygon.h"
#include "dbPath.h"
#include "dbEdge.h"
#include "dbEdgePair.h"
#include "dbText.h"
#include "dbBox.h"
#include "dbBoxConvert.h"
@ -616,6 +617,7 @@ public:
typedef db::path_ref<path_type, unit_trans_type> path_ptr_type;
typedef db::array<path_ptr_type, disp_type> path_ptr_array_type;
typedef db::edge<coord_type> edge_type;
typedef db::edge_pair<coord_type> edge_pair_type;
typedef db::text<coord_type> text_type;
typedef db::text_ref<text_type, disp_type> text_ref_type;
typedef db::text_ref<text_type, unit_trans_type> text_ptr_type;
@ -642,6 +644,7 @@ public:
typedef tl::reuse_vector<db::path_ref<path_type, unit_trans_type> >::const_iterator path_ptr_iter_type;
typedef tl::reuse_vector<db::array<path_ptr_type, disp_type> >::const_iterator path_ptr_array_iter_type;
typedef tl::reuse_vector<db::edge<coord_type> >::const_iterator edge_iter_type;
typedef tl::reuse_vector<db::edge_pair<coord_type> >::const_iterator edge_pair_iter_type;
typedef tl::reuse_vector<db::text<coord_type> >::const_iterator text_iter_type;
typedef tl::reuse_vector<db::text_ref<text_type, disp_type> >::const_iterator text_ref_iter_type;
typedef tl::reuse_vector<db::text_ref<text_type, unit_trans_type> >::const_iterator text_ptr_iter_type;
@ -665,6 +668,7 @@ public:
typedef tl::reuse_vector<db::object_with_properties<db::path_ref<path_type, unit_trans_type> > >::const_iterator ppath_ptr_iter_type;
typedef tl::reuse_vector<db::object_with_properties<db::array<path_ptr_type, disp_type> > >::const_iterator ppath_ptr_array_iter_type;
typedef tl::reuse_vector<db::object_with_properties<db::edge<coord_type> > >::const_iterator pedge_iter_type;
typedef tl::reuse_vector<db::object_with_properties<db::edge_pair<coord_type> > >::const_iterator pedge_pair_iter_type;
typedef tl::reuse_vector<db::object_with_properties<db::text<coord_type> > >::const_iterator ptext_iter_type;
typedef tl::reuse_vector<db::object_with_properties<db::text_ref<text_type, disp_type> > >::const_iterator ptext_ref_iter_type;
typedef tl::reuse_vector<db::object_with_properties<db::text_ref<text_type, unit_trans_type> > >::const_iterator ptext_ptr_iter_type;
@ -690,6 +694,7 @@ public:
SimplePolygonPtrArray,
SimplePolygonPtrArrayMember,
Edge,
EdgePair,
Path,
PathRef,
PathPtrArray,
@ -1016,7 +1021,15 @@ public:
m_type = Edge;
}
/**
/**
* @brief Construct a shape proxy as a reference to a edge pair
*/
void init (edge_pair_type::tag)
{
m_type = EdgePair;
}
/**
* @brief Construct a shape proxy as a reference to a box
*/
void init (box_type::tag)
@ -1344,7 +1357,23 @@ public:
}
}
/**
/**
* @brief Return the actual object that this shape reference is pointing to
*
* This is a generalisation of the polygon (), etc. methods using a tag to identify the
* target object.
*/
const edge_pair_type *basic_ptr (edge_pair_type::tag) const
{
tl_assert (m_type == EdgePair);
if (m_stable) {
return m_with_props ? &**(((pedge_pair_iter_type *) m_generic.iter)) : &**(((edge_pair_iter_type *) m_generic.iter));
} else {
return m_with_props ? m_generic.pedge_pair : m_generic.edge_pair;
}
}
/**
* @brief Return the actual object that this shape reference is pointing to
*
* This is a generalisation of the polygon (), etc. methods using a tag to identify the
@ -1636,7 +1665,24 @@ public:
}
}
/**
/**
* @brief Return the actual object that this shape reference is pointing to for objects with properties
*
* This is a generalisation of the polygon (), etc. methods using a tag to identify the
* target object.
*/
const db::object_with_properties<edge_pair_type> *basic_ptr (db::object_with_properties<edge_pair_type>::tag) const
{
tl_assert (m_type == EdgePair);
tl_assert (m_with_props);
if (m_stable) {
return &**(((pedge_pair_iter_type *) m_generic.iter));
} else {
return m_generic.pedge_pair;
}
}
/**
* @brief Return the actual object that this shape reference is pointing to for objects with properties
*
* This is a generalisation of the polygon (), etc. methods using a tag to identify the
@ -1862,7 +1908,16 @@ public:
return *(((edge_iter_type *) m_generic.iter));
}
/**
/**
* @brief Return the iterator (in stable reference mode) by tag
*/
edge_pair_iter_type basic_iter (edge_pair_type::tag) const
{
tl_assert (m_type == EdgePair && ! m_with_props);
return *(((edge_pair_iter_type *) m_generic.iter));
}
/**
* @brief Return the iterator (in stable reference mode) by tag
*/
text_iter_type basic_iter (text_type::tag) const
@ -2024,7 +2079,16 @@ public:
return *(((pedge_iter_type *) m_generic.iter));
}
/**
/**
* @brief Return the iterator (in stable reference mode) by tag for objects with properties
*/
pedge_pair_iter_type basic_iter (db::object_with_properties<edge_pair_type>::tag) const
{
tl_assert (m_type == EdgePair && m_with_props);
return *(((pedge_pair_iter_type *) m_generic.iter));
}
/**
* @brief Return the iterator (in stable reference mode) by tag for objects with properties
*/
ptext_iter_type basic_iter (db::object_with_properties<text_type>::tag) const
@ -2288,7 +2352,50 @@ public:
return edge (p);
}
/**
/**
* @brief Return a reference to the edge pair if one is referenced
*/
const edge_pair_type &edge_pair () const
{
tl_assert (m_type == EdgePair);
return *basic_ptr (edge_pair_type::tag ());
}
/**
* @brief Test if the shape proxy points to a edge pair
*/
bool is_edge_pair () const
{
return (m_type == EdgePair);
}
/**
* @brief Instantiate the edge pair object
*
* If an edge pair is referenced, this object is instantiated
* by this method.
* Returns true, if the conversion was successful.
*/
bool edge_pair (edge_pair_type &e) const
{
if (is_edge_pair ()) {
e = edge_pair ();
return true;
} else {
return false;
}
}
/**
* @brief Alias for polymorphic expansion
* Returns true, if the conversion was successful.
*/
bool instantiate (edge_pair_type &p) const
{
return edge_pair (p);
}
/**
* @brief Return a reference to the text if one is referenced
*/
const text_type &text () const
@ -2567,6 +2674,7 @@ public:
const text_ref_type *text_ref;
const text_ptr_array_type *text_aref;
const edge_type *edge;
const edge_pair_type *edge_pair;
const path_type *path;
const path_ref_type *path_ref;
const path_ptr_array_type *path_aref;
@ -2586,6 +2694,7 @@ public:
const db::object_with_properties<text_ref_type> *ptext_ref;
const db::object_with_properties<text_ptr_array_type> *ptext_aref;
const db::object_with_properties<edge_type> *pedge;
const db::object_with_properties<edge_pair_type> *pedge_pair;
const db::object_with_properties<path_type> *ppath;
const db::object_with_properties<path_ref_type> *ppath_ref;
const db::object_with_properties<path_ptr_array_type> *ppath_aref;

View File

@ -634,6 +634,9 @@ ShapeIterator::advance_generic (int mode)
case Edge:
if (advance_shape<edge_type, StableTag, RegionTag> (mode)) return;
break;
case EdgePair:
if (advance_shape<edge_pair_type, StableTag, RegionTag> (mode)) return;
break;
case Path:
if (advance_shape<path_type, StableTag, RegionTag> (mode)) return;
break;
@ -758,6 +761,8 @@ ShapeIterator::quad_box_generic () const
return (quad_box_by_shape<simple_polygon_ptr_array_type, StableTag> (region_tag));
case Edge:
return (quad_box_by_shape<edge_type, StableTag> (region_tag));
case EdgePair:
return (quad_box_by_shape<edge_pair_type, StableTag> (region_tag));
case Path:
return (quad_box_by_shape<path_type, StableTag> (region_tag));
case PathRef:

View File

@ -295,6 +295,8 @@ Shapes::do_insert (const Shapes::shape_type &shape, const Shapes::unit_trans_typ
return (insert_array_by_tag (shape_type::simple_polygon_ptr_array_type::tag (), shape, shape_repository (), pm));
case shape_type::Edge:
return (insert_by_tag (shape_type::edge_type::tag (), shape, pm));
case shape_type::EdgePair:
return (insert_by_tag (shape_type::edge_pair_type::tag (), shape, pm));
case shape_type::Path:
return (insert_by_tag (shape_type::path_type::tag (), shape, pm));
case shape_type::PathRef:
@ -439,6 +441,16 @@ Shapes::do_insert (const Shapes::shape_type &shape, const Trans &t, tl::func_del
return insert (db::object_with_properties<shape_type::edge_type> (p, pm (shape.prop_id ())));
}
}
case shape_type::EdgePair:
{
shape_type::edge_pair_type p (shape.edge_pair ());
p.transform (t);
if (! shape.has_prop_id ()) {
return insert (p);
} else {
return insert (db::object_with_properties<shape_type::edge_pair_type> (p, pm (shape.prop_id ())));
}
}
case shape_type::Path:
{
shape_type::path_type p (shape.path ());
@ -554,6 +566,8 @@ Shapes::find (const Shapes::shape_type &shape) const
return find_shape_by_tag (shape_type::simple_polygon_ptr_array_type::tag (), shape);
case shape_type::Edge:
return find_shape_by_tag (shape_type::edge_type::tag (), shape);
case shape_type::EdgePair:
return find_shape_by_tag (shape_type::edge_pair_type::tag (), shape);
case shape_type::Path:
return find_shape_by_tag (shape_type::path_type::tag (), shape);
case shape_type::PathRef:
@ -620,6 +634,9 @@ Shapes::replace_prop_id (const Shapes::shape_type &ref, db::properties_id_type p
case shape_type::Edge:
replace_prop_id (ref.basic_ptr (object_with_properties<shape_type::edge_type>::tag ()), prop_id);
break;
case shape_type::EdgePair:
replace_prop_id (ref.basic_ptr (object_with_properties<shape_type::edge_pair_type>::tag ()), prop_id);
break;
case shape_type::Path:
replace_prop_id (ref.basic_ptr (object_with_properties<shape_type::path_type>::tag ()), prop_id);
break;
@ -682,6 +699,8 @@ Shapes::replace_prop_id (const Shapes::shape_type &ref, db::properties_id_type p
return replace_prop_id_iter (shape_type::simple_polygon_ptr_array_type::tag (), ref.basic_iter (shape_type::simple_polygon_ptr_array_type::tag ()), prop_id);
case shape_type::Edge:
return replace_prop_id_iter (shape_type::edge_type::tag (), ref.basic_iter (shape_type::edge_type::tag ()), prop_id);
case shape_type::EdgePair:
return replace_prop_id_iter (shape_type::edge_pair_type::tag (), ref.basic_iter (shape_type::edge_pair_type::tag ()), prop_id);
case shape_type::Path:
return replace_prop_id_iter (shape_type::path_type::tag (), ref.basic_iter (shape_type::path_type::tag ()), prop_id);
case shape_type::PathRef:
@ -759,6 +778,12 @@ Shapes::transform (const Shapes::shape_type &ref, const Trans &t)
p.transform (t);
return replace_member_with_props (shape_type::edge_type::tag (), ref, p);
}
case shape_type::EdgePair:
{
shape_type::edge_pair_type p (ref.edge_pair ());
p.transform (t);
return replace_member_with_props (shape_type::edge_pair_type::tag (), ref, p);
}
case shape_type::Path:
{
shape_type::path_type p (ref.path ());
@ -845,6 +870,8 @@ Shapes::replace (const Shapes::shape_type &ref, const Sh &sh)
return replace_member_with_props (shape_type::simple_polygon_ptr_array_type::tag (), ref, sh);
case shape_type::Edge:
return replace_member_with_props (shape_type::edge_type::tag (), ref, sh);
case shape_type::EdgePair:
return replace_member_with_props (shape_type::edge_pair_type::tag (), ref, sh);
case shape_type::Path:
return replace_member_with_props (shape_type::path_type::tag (), ref, sh);
case shape_type::PathRef:
@ -1212,6 +1239,7 @@ template DB_PUBLIC Shape Shapes::replace<>(const Shape &, const Polygon &);
template DB_PUBLIC Shape Shapes::replace<>(const Shape &, const SimplePolygon &);
template DB_PUBLIC Shape Shapes::replace<>(const Shape &, const Text &);
template DB_PUBLIC Shape Shapes::replace<>(const Shape &, const Edge &);
template DB_PUBLIC Shape Shapes::replace<>(const Shape &, const EdgePair &);
template DB_PUBLIC Shape Shapes::transform<> (const Shape &, const ICplxTrans &);
template DB_PUBLIC Shape Shapes::transform<> (const Shape &, const Trans &);
@ -1239,6 +1267,8 @@ template class DB_PUBLIC layer_op<db::Shape::path_ptr_array_type, db::stable_lay
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::path_ptr_array_type>, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::edge_type, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::edge_type>, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::edge_pair_type, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::edge_pair_type>, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::text_type, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::text_type>, db::stable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::text_ref_type, db::stable_layer_tag>;
@ -1275,6 +1305,8 @@ template class DB_PUBLIC layer_op<db::Shape::path_ptr_array_type, db::unstable_l
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::path_ptr_array_type>, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::edge_type, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::edge_type>, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::edge_pair_type, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::edge_pair_type>, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::text_type, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::object_with_properties<db::Shape::text_type>, db::unstable_layer_tag>;
template class DB_PUBLIC layer_op<db::Shape::text_ref_type, db::unstable_layer_tag>;

View File

@ -83,6 +83,7 @@ public:
typedef db::array<path_ptr_type, disp_type> path_ptr_array_type;
typedef path_ptr_array_type::iterator path_ptr_array_iterator_type;
typedef db::edge<coord_type> edge_type;
typedef db::edge_pair<coord_type> edge_pair_type;
typedef db::text<coord_type> text_type;
typedef db::text_ref<text_type, disp_type> text_ref_type;
typedef db::text_ref<text_type, unit_trans_type> text_ptr_type;
@ -126,18 +127,19 @@ public:
SimplePolygonRef = 4,
SimplePolygonPtrArray = 5,
Edge = 6,
Path = 7,
PathRef = 8,
PathPtrArray = 9,
Box = 10,
BoxArray = 11,
ShortBox = 12,
ShortBoxArray = 13,
Text = 14,
TextRef = 15,
TextPtrArray = 16,
UserObject = 17,
Null = 18 // must be last!
EdgePair = 7,
Path = 8,
PathRef = 9,
PathPtrArray = 10,
Box = 11,
BoxArray = 12,
ShortBox = 13,
ShortBoxArray = 14,
Text = 15,
TextRef = 16,
TextPtrArray = 17,
UserObject = 18,
Null = 19 // must be last!
};
enum flags_type
@ -151,7 +153,8 @@ public:
| (1 << SimplePolygonRef)
| (1 << SimplePolygonPtrArray),
Edges = (1 << Edge),
Paths = (1 << Path)
EdgePairs = (1 << EdgePair),
Paths = (1 << Path)
| (1 << PathRef)
| (1 << PathPtrArray),
Boxes = (1 << Box)
@ -352,14 +355,15 @@ private:
char sz8 [sizeof (per_shape_iter_size <path_ref_type>)];
char sz9 [sizeof (per_shape_iter_size <path_ptr_array_type>)];
char sz10 [sizeof (per_shape_iter_size <edge_type>)];
char sz11 [sizeof (per_shape_iter_size <box_type>)];
char sz12 [sizeof (per_shape_iter_size <box_array_type>)];
char sz13 [sizeof (per_shape_iter_size <short_box_type>)];
char sz14 [sizeof (per_shape_iter_size <short_box_array_type>)];
char sz15 [sizeof (per_shape_iter_size <text_type>)];
char sz16 [sizeof (per_shape_iter_size <text_ref_type>)];
char sz17 [sizeof (per_shape_iter_size <text_ptr_array_type>)];
char sz18 [sizeof (per_shape_iter_size <user_object_type>)];
char sz11 [sizeof (per_shape_iter_size <edge_pair_type>)];
char sz12 [sizeof (per_shape_iter_size <box_type>)];
char sz13 [sizeof (per_shape_iter_size <box_array_type>)];
char sz14 [sizeof (per_shape_iter_size <short_box_type>)];
char sz15 [sizeof (per_shape_iter_size <short_box_array_type>)];
char sz16 [sizeof (per_shape_iter_size <text_type>)];
char sz17 [sizeof (per_shape_iter_size <text_ref_type>)];
char sz18 [sizeof (per_shape_iter_size <text_ptr_array_type>)];
char sz19 [sizeof (per_shape_iter_size <user_object_type>)];
};
// this union is simply there to determine the maximum size required for all

View File

@ -673,6 +673,12 @@ inline unsigned int iterator_type_mask (ShapeIterator::edge_type::tag)
return 1 << ShapeIterator::Edge;
}
/// @brief Internal: ShapeIterator masks per shape type
inline unsigned int iterator_type_mask (ShapeIterator::edge_pair_type::tag)
{
return 1 << ShapeIterator::EdgePair;
}
/// @brief Internal: ShapeIterator masks per shape type
inline unsigned int iterator_type_mask (ShapeIterator::path_type::tag)
{
@ -917,6 +923,8 @@ template class layer_class<db::Shape::path_ptr_array_type, db::stable_layer_tag>
template class layer_class<db::object_with_properties<db::Shape::path_ptr_array_type>, db::stable_layer_tag>;
template class layer_class<db::Shape::edge_type, db::stable_layer_tag>;
template class layer_class<db::object_with_properties<db::Shape::edge_type>, db::stable_layer_tag>;
template class layer_class<db::Shape::edge_pair_type, db::stable_layer_tag>;
template class layer_class<db::object_with_properties<db::Shape::edge_pair_type>, db::stable_layer_tag>;
template class layer_class<db::Shape::text_type, db::stable_layer_tag>;
template class layer_class<db::object_with_properties<db::Shape::text_type>, db::stable_layer_tag>;
template class layer_class<db::Shape::text_ref_type, db::stable_layer_tag>;
@ -953,6 +961,8 @@ template class layer_class<db::Shape::path_ptr_array_type, db::unstable_layer_ta
template class layer_class<db::object_with_properties<db::Shape::path_ptr_array_type>, db::unstable_layer_tag>;
template class layer_class<db::Shape::edge_type, db::unstable_layer_tag>;
template class layer_class<db::object_with_properties<db::Shape::edge_type>, db::unstable_layer_tag>;
template class layer_class<db::Shape::edge_pair_type, db::unstable_layer_tag>;
template class layer_class<db::object_with_properties<db::Shape::edge_pair_type>, db::unstable_layer_tag>;
template class layer_class<db::Shape::text_type, db::unstable_layer_tag>;
template class layer_class<db::object_with_properties<db::Shape::text_type>, db::unstable_layer_tag>;
template class layer_class<db::Shape::text_ref_type, db::unstable_layer_tag>;

View File

@ -117,6 +117,8 @@ template DB_PUBLIC layer<db::Shape::path_ptr_array_type, db::stable_layer_tag> &
template DB_PUBLIC layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::edge_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::edge_type, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::object_with_properties<db::Shape::edge_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_type>, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::edge_pair_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::edge_pair_type, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::object_with_properties<db::Shape::edge_pair_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_pair_type>, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::text_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::text_type, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::object_with_properties<db::Shape::text_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::text_type>, db::stable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::text_ref_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::text_ref_type, db::stable_layer_tag> ();
@ -153,6 +155,8 @@ template DB_PUBLIC layer<db::Shape::path_ptr_array_type, db::unstable_layer_tag>
template DB_PUBLIC layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::edge_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::edge_type, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::object_with_properties<db::Shape::edge_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_type>, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::edge_pair_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::edge_pair_type, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::object_with_properties<db::Shape::edge_pair_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_pair_type>, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::text_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::text_type, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::object_with_properties<db::Shape::text_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::text_type>, db::unstable_layer_tag> ();
template DB_PUBLIC layer<db::Shape::text_ref_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::text_ref_type, db::unstable_layer_tag> ();
@ -190,6 +194,8 @@ template DB_PUBLIC const layer<db::Shape::path_ptr_array_type, db::stable_layer_
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::edge_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::edge_type, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::edge_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_type>, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::edge_pair_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::edge_pair_type, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::edge_pair_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_pair_type>, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::text_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::text_type, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::text_type>, db::stable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::text_type>, db::stable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::text_ref_type, db::stable_layer_tag> &Shapes::get_layer<db::Shape::text_ref_type, db::stable_layer_tag> () const;
@ -226,6 +232,8 @@ template DB_PUBLIC const layer<db::Shape::path_ptr_array_type, db::unstable_laye
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::path_ptr_array_type>, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::edge_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::edge_type, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::edge_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_type>, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::edge_pair_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::edge_pair_type, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::edge_pair_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::edge_pair_type>, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::text_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::text_type, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::object_with_properties<db::Shape::text_type>, db::unstable_layer_tag> &Shapes::get_layer<db::object_with_properties<db::Shape::text_type>, db::unstable_layer_tag> () const;
template DB_PUBLIC const layer<db::Shape::text_ref_type, db::unstable_layer_tag> &Shapes::get_layer<db::Shape::text_ref_type, db::unstable_layer_tag> () const;
@ -282,6 +290,8 @@ Shapes::is_valid (const Shapes::shape_type &shape) const
return is_valid_shape_by_tag (shape_type::simple_polygon_ptr_array_type::tag (), shape);
case shape_type::Edge:
return is_valid_shape_by_tag (shape_type::edge_type::tag (), shape);
case shape_type::EdgePair:
return is_valid_shape_by_tag (shape_type::edge_pair_type::tag (), shape);
case shape_type::Path:
return is_valid_shape_by_tag (shape_type::path_type::tag (), shape);
case shape_type::PathRef:
@ -440,6 +450,9 @@ Shapes::erase_shape (const Shapes::shape_type &shape)
case shape_type::Edge:
erase_shape_by_tag (shape_type::edge_type::tag (), shape);
break;
case shape_type::EdgePair:
erase_shape_by_tag (shape_type::edge_pair_type::tag (), shape);
break;
case shape_type::Path:
erase_shape_by_tag (shape_type::path_type::tag (), shape);
break;
@ -532,6 +545,9 @@ Shapes::erase_shapes (const std::vector<Shapes::shape_type> &shapes)
case shape_type::Edge:
erase_shapes_by_tag (shape_type::edge_type::tag (), s, snext);
break;
case shape_type::EdgePair:
erase_shapes_by_tag (shape_type::edge_pair_type::tag (), s, snext);
break;
case shape_type::Path:
erase_shapes_by_tag (shape_type::path_type::tag (), s, snext);
break;

View File

@ -172,6 +172,16 @@ std::string shapes_to_string_norm (tl::TestBase *_this, const db::Shapes &shapes
r += "path " + p.to_string ();
EXPECT_EQ (p.box ().to_string (), shape->bbox ().to_string ());
EXPECT_EQ (p.area (), shape->area ());
} else if (shape->is_edge ()) {
db::Shape::edge_type p;
shape->edge (p);
r += "edge " + p.to_string ();
EXPECT_EQ (p.bbox ().to_string (), shape->bbox ().to_string ());
} else if (shape->is_edge_pair ()) {
db::Shape::edge_pair_type p;
shape->edge_pair (p);
r += "edge_pair " + p.to_string ();
EXPECT_EQ (p.bbox ().to_string (), shape->bbox ().to_string ());
} else if (shape->is_text ()) {
db::Shape::text_type p;
shape->text (p);
@ -3263,6 +3273,42 @@ TEST(22)
EXPECT_EQ (shapes.find (*s).to_string (), "null");
}
// Edge pairs
TEST(23)
{
db::Manager m;
db::Shapes s (&m, 0, db::default_editable_mode ());
db::Box b_empty;
s.update_bbox ();
EXPECT_EQ (s.bbox (), b_empty);
db::EdgePair ep (db::Edge (-100, -200, 0, 0), db::Edge (0, -100, 100, 100));
s.insert (ep);
s.update_bbox ();
EXPECT_EQ (s.bbox (), db::Box (-100, -200, 100, 100));
db::ShapeIterator si = s.begin (db::ShapeIterator::EdgePairs);
EXPECT_EQ (!si.at_end (), true);
EXPECT_EQ (si->edge_pair ().to_string (), "(-100,-200;0,0)/(0,-100;100,100)");
EXPECT_EQ (si->is_edge_pair (), true);
db::EdgePair ep2;
si->instantiate (ep2);
EXPECT_EQ (ep2.to_string (), "(-100,-200;0,0)/(0,-100;100,100)");
++si;
EXPECT_EQ (si.at_end (), true);
db::Shapes s2 = s;
EXPECT_EQ (shapes_to_string_norm (_this, s2), "edge_pair (-100,-200;0,0)/(0,-100;100,100) #0\n");
s2.clear ();
s2.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (0, 0, 1, 1), db::Edge (10, 10, 11, 11)), 17));
EXPECT_EQ (shapes_to_string_norm (_this, s2), "edge_pair (0,0;1,1)/(10,10;11,11) #17\n");
}
// Bug #107
TEST(100)
{