|
degate 0.1.1
|
An annotation is a descriptive meta object that can be placed on a logic model's layer to mark a region of interest. More...
#include <Annotation.h>

Public Types | |
| enum | ANNOTATION_TYPE { UNDEFINED = 0, SUBPROJECT = 1 } |
| Enums to declare the type of annotation. More... | |
| typedef unsigned int | class_id_t |
| typedef std::map< std::string, std::string > | parameter_set_type |
Public Member Functions | |
| Annotation (int _min_x, int _max_x, int _min_y, int _max_y, class_id_t _class_id=UNDEFINED) | |
| Create a new annotation. | |
| Annotation (BoundingBox const &bbox, class_id_t _class_id=UNDEFINED) | |
| Create a new annotation. | |
| virtual | ~Annotation () |
| The destructor for an annotaion. | |
| virtual class_id_t | get_class_id () const |
| Get the class ID for an annotation. | |
| virtual void | set_class_id (class_id_t _class_id) |
| Set the class ID for an annotation. | |
| virtual const std::string | get_descriptive_identifier () const |
| Get a human readable string that describes the whole logic model object. | |
| virtual const std::string | get_object_type_name () const |
| Get a human readable string that names the object type. | |
| void | print (std::ostream &os=std::cout, int n_tabs=0) const |
| Print annotation. | |
| void | shift_x (int delta_x) |
| Shift the shape vertically. | |
| void | shift_y (int delta_y) |
| Shift the shape horizontally. | |
| virtual bool | in_bounding_box (BoundingBox const &bbox) const |
| Check, if this rectangle is in the bounding box. | |
| virtual BoundingBox const & | get_bounding_box () const |
| Get the bounding box. | |
| virtual bool | in_shape (int x, int y, int max_distance=0) const |
| Check in the Point with coordinates x and y is within the area of the shape. | |
| template<typename NewType > | |
| NewType | get_parameter (std::string parameter_name) const |
| Get a parameter value. | |
| parameter_set_type::const_iterator | parameters_begin () const |
| Get an iterator to iterate over parameters. | |
| parameter_set_type::const_iterator | parameters_end () const |
| Get an end marker for the parameter iteration. | |
Protected Member Functions | |
| void | set_parameter (std::string const ¶meter_name, std::string const ¶meter_value) |
| Set a parameter. | |
Private Attributes | |
| class_id_t | class_id |
| parameter_set_type | parameters |
An annotation is a descriptive meta object that can be placed on a logic model's layer to mark a region of interest.
The semantics of an annotation is user defined. The libdegate does not establish a relationship from an annotaion to another logic model object or to an background image region.
Each annotation should have a class ID. This might be used to classify the kind of annotation. For example you can place an annotation 'above' a distored part of the background image to remember yourself, that this image part should be rephotographed. An image recognition algorithm may auto-annotate, that it is unsure e.g. if there is a via or not due to fuzzy thresholds.
You can set a name and a description for the annotation as well.
This class is designed to be derived for concrete annotations.
Definition at line 61 of file Annotation.h.
| typedef unsigned int degate::Annotation::class_id_t |
Definition at line 65 of file Annotation.h.
| typedef std::map<std::string, std::string > degate::Annotation::parameter_set_type |
Definition at line 77 of file Annotation.h.
Enums to declare the type of annotation.
Definition at line 71 of file Annotation.h.
{
UNDEFINED = 0,
SUBPROJECT = 1
};
| Annotation::Annotation | ( | int | _min_x, |
| int | _max_x, | ||
| int | _min_y, | ||
| int | _max_y, | ||
| class_id_t | _class_id = UNDEFINED |
||
| ) |
Create a new annotation.
Definition at line 28 of file Annotation.cc.
| Annotation::Annotation | ( | BoundingBox const & | bbox, |
| class_id_t | _class_id = UNDEFINED |
||
| ) |
Create a new annotation.
Definition at line 34 of file Annotation.cc.
| Annotation::~Annotation | ( | ) | [virtual] |
| virtual BoundingBox const& degate::Annotation::get_bounding_box | ( | ) | const [inline, virtual] |
Get the bounding box.
Reimplemented from degate::Rectangle.
Definition at line 168 of file Annotation.h.
Referenced by print().
{
return Rectangle::get_bounding_box();
}

| Annotation::class_id_t Annotation::get_class_id | ( | ) | const [virtual] |
Get the class ID for an annotation.
Definition at line 43 of file Annotation.cc.
References class_id.
Referenced by get_descriptive_identifier(), and print().
{
return class_id;
}

| const std::string Annotation::get_descriptive_identifier | ( | ) | const [virtual] |
Get a human readable string that describes the whole logic model object.
The string should be unique in order to let the user identify the concrete object. But that is not a must.
Reimplemented from degate::LogicModelObjectBase.
Definition at line 51 of file Annotation.cc.
References get_class_id(), degate::LogicModelObjectBase::get_name(), and degate::LogicModelObjectBase::get_object_id().
{
boost::format fmter("%1% (id=%2%,class=%3%)");
fmter % get_object_id() % get_name() % get_class_id();
return fmter.str();
}

| const std::string Annotation::get_object_type_name | ( | ) | const [virtual] |
Get a human readable string that names the object type.
Here it is "Annotation".
Reimplemented from degate::LogicModelObjectBase.
Definition at line 57 of file Annotation.cc.
{
return std::string("Annotation");
}
| NewType degate::Annotation::get_parameter | ( | std::string | parameter_name | ) | const [inline] |
Get a parameter value.
| boost::bad_lexical_cast | This exception is thrown if the parameter value cannot be converted to the desired type. |
| CollectionLookupException | This exception is thrown if the parameter is not stored in the lookup table. |
Definition at line 187 of file Annotation.h.
References debug(), parameters, and TM.
{
parameter_set_type::const_iterator iter = parameters.find(parameter_name);
if(iter == parameters.end()) {
boost::format f("Failed to lookup parameter %1%.");
f % parameter_name;
throw CollectionLookupException(f.str());
}
if(typeid(NewType) == typeid(std::string) ||
typeid(NewType) == typeid(boost::filesystem::path)) {
return NewType(iter->second);
}
try {
return boost::lexical_cast<NewType>(iter->second);
}
catch(boost::bad_lexical_cast &) {
debug(TM, "Failed to convert value string '%s'.", iter->second.c_str());
throw;
}
}

| virtual bool degate::Annotation::in_bounding_box | ( | BoundingBox const & | bbox | ) | const [inline, virtual] |
Check, if this rectangle is in the bounding box.
Reimplemented from degate::Rectangle.
Definition at line 164 of file Annotation.h.
{
return in_bounding_box(bbox);
}
| virtual bool degate::Annotation::in_shape | ( | int | x, |
| int | y, | ||
| int | max_distance = 0 |
||
| ) | const [inline, virtual] |
Check in the Point with coordinates x and y is within the area of the shape.
Reimplemented from degate::Rectangle.
Definition at line 172 of file Annotation.h.
{
return Rectangle::in_shape(x, y, max_distance);
}
| Annotation::parameter_set_type::const_iterator Annotation::parameters_begin | ( | ) | const |
Get an iterator to iterate over parameters.
Definition at line 75 of file Annotation.cc.
References parameters.
{
return parameters.begin();
}
| Annotation::parameter_set_type::const_iterator Annotation::parameters_end | ( | ) | const |
Get an end marker for the parameter iteration.
Definition at line 79 of file Annotation.cc.
References parameters.
{
return parameters.end();
}
| void Annotation::print | ( | std::ostream & | os = std::cout, |
| int | n_tabs = 0 |
||
| ) | const [virtual] |
Print annotation.
Implements degate::PlacedLogicModelObject.
Definition at line 61 of file Annotation.cc.
References degate::gen_tabs(), get_bounding_box(), get_class_id(), degate::LogicModelObjectBase::get_description(), degate::LogicModelObjectBase::get_name(), degate::LogicModelObjectBase::get_object_id(), and degate::BoundingBox::to_string().
{
os
<< gen_tabs(n_tabs) << "Annotation name : " << get_name() << std::endl
<< gen_tabs(n_tabs) << "Description : " << get_description() << std::endl
<< gen_tabs(n_tabs) << "Object ID : " << get_object_id() << std::endl
<< gen_tabs(n_tabs) << "Bounding box : " << Rectangle::get_bounding_box().to_string() << std::endl
<< gen_tabs(n_tabs) << "Annotation class : " << get_class_id() << std::endl
<< std::endl;
os << std::endl;
}

| void Annotation::set_class_id | ( | Annotation::class_id_t | _class_id | ) | [virtual] |
Set the class ID for an annotation.
Definition at line 47 of file Annotation.cc.
References class_id.
{
class_id = _class_id;
}
| void degate::Annotation::set_parameter | ( | std::string const & | parameter_name, |
| std::string const & | parameter_value | ||
| ) | [inline, protected] |
Set a parameter.
Definition at line 91 of file Annotation.h.
References parameters.
Referenced by degate::SubProjectAnnotation::set_path().
{
parameters[parameter_name] = parameter_value;
}

| void degate::Annotation::shift_x | ( | int | delta_x | ) | [inline, virtual] |
Shift the shape vertically.
Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.
Reimplemented from degate::Rectangle.
Definition at line 154 of file Annotation.h.
References degate::PlacedLogicModelObject::notify_shape_change().
{
Rectangle::shift_x(delta_x);
notify_shape_change();
}

| void degate::Annotation::shift_y | ( | int | delta_y | ) | [inline, virtual] |
Shift the shape horizontally.
Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.
Reimplemented from degate::Rectangle.
Definition at line 159 of file Annotation.h.
References degate::PlacedLogicModelObject::notify_shape_change().
{
Rectangle::shift_y(delta_y);
notify_shape_change();
}

class_id_t degate::Annotation::class_id [private] |
Definition at line 81 of file Annotation.h.
Referenced by get_class_id(), and set_class_id().
Definition at line 82 of file Annotation.h.
Referenced by get_parameter(), parameters_begin(), parameters_end(), and set_parameter().
1.7.4