14 Object(Object *parent,
const std::string &name);
16 virtual Object *clone(
CloneEnv&)
const {
return 0; }
19 const std::string& name()
const {
return mName; }
20 std::string getFullName()
const;
22 uint id()
const {
return mId; }
23 void setId(uint
id) { mId = id; }
25 bool hasParent()
const {
return !!mParent; }
26 Object *getParent()
const {
return mParent; }
27 Object *getChildAt(
const Point_2&)
const;
29 const std::vector<Object *>& getChildren()
const {
return mChildren; }
30 void addChild(Object&);
31 uint numChildren()
const {
return mChildren.size(); }
32 bool hasChildren()
const {
return !mChildren.empty(); }
33 void removeChild(Object&);
35 const Point_2& getCenter()
const {
return mCenter; }
38 const Bbox_2 getBbox()
const {
return mShape->bbox(); }
40 virtual void addOccludedObject(Object&) { }
42 void translate(
const Vector_2&);
43 void transform(
const Aff_transformation_2&);
44 void rotateAround(
const Point_2 &refPoint, Real angleRadians);
46 bool isOnLayer(
int z)
const {
return mLayerRange[0] <= z && z <= mLayerRange[1]; }
47 int minLayer()
const {
return mLayerRange[0]; }
48 int maxLayer()
const {
return mLayerRange[1]; }
50 void setLayerRange(
int,
int);
51 int getSingleLayer()
const { assert(mLayerRange[0] == mLayerRange[1]);
return mLayerRange[0]; }
52 bool sharesLayer(
const Object&)
const;
54 Real getClearance()
const {
return mClearance; }
55 void setClearance(Real c) { mClearance = c; }
57 AShape *getShape()
const {
return mShape.get(); }
59 void setShape(
const Circle_2&);
60 void setShape(
const Triangle_2&);
61 void setShape(
const Iso_rectangle_2&);
62 void setShape(
const Polygon_2&);
64 void setShape(Polygon_2&&);
66 bool canRouteInside()
const {
return mCanRouteInside; }
67 void setCanRouteInside(
bool b) { mCanRouteInside = b; }
68 bool canPlaceViasInside()
const {
return mCanPlaceViasInside; }
69 void setCanPlaceViasInside(
bool b) { mCanPlaceViasInside = b; }
70 bool isSelected()
const {
return mSelectionFlag; }
71 void setSelected(
bool b) { mSelectionFlag = b; }
72 void setSelected(
bool b, uint recursion);
74 bool violatesClearance(
const Via&, Real clearance,
Point_25 * = 0)
const;
77 Real distanceTo(
const Point_2 &v)
const {
return std::sqrt(mShape->squared_distance(v)); }
78 bool contains2D(
const Point_2 &v)
const {
return mShape->contains(v); }
79 bool contains3D(
const Point_25 &v)
const {
return mShape->contains(v.xy()) && isOnLayer(v.z()); }
80 bool isInsideBbox(
const Point_2 &v)
const;
81 bool isInsideBbox(
const Point_2 &v,
int zmin,
int zmax)
const;
82 bool intersects(
const Bbox_2 &B)
const {
return mShape->intersects(B); }
83 bool intersects(
const WideSegment_25 &s)
const {
return isOnLayer(s.z()) && mShape->intersects(s); }
84 bool intersects(
const Object &A)
const {
return sharesLayer(A) && mShape->intersects(*A.getShape()); }
85 bool bboxTest(
const Bbox_2 &B) {
return CGAL::do_overlap(getBbox(), B); }
86 bool bboxTest(
const Bbox_2 &B,
int z0,
int z1 = -1);
88 bool isContainerOf(
const Object&)
const;
90 void copyFrom(
CloneEnv&,
const Object&);
92 virtual std::string str()
const {
return "?"; }
93 virtual PyObject *getPy(uint depth)
const;
95 template<
typename T>
bool is_a()
const {
return !!
dynamic_cast<const T *
>(
this); }
96 template<
typename T>
const T *as()
const {
return dynamic_cast<const T *
>(
this); }
97 template<
typename T> T *as() {
return dynamic_cast<T *
>(
this); }
100 std::unique_ptr<AShape> mShape;
102 Object *
const mParent;
103 std::vector<Object *> mChildren;
106 uint mChildIndex{std::numeric_limits<uint>::max()};
107 int mLayerRange[2]{-1,-1};
108 Real mClearance{0.0};
109 bool mCanRouteInside{
false};
110 bool mCanPlaceViasInside{
true};
111 bool mSelectionFlag{
false};
114 void update() { mCenter = mShape->centroid(); }
Point_25 getCenter25() const
Layer is set to max(LayerMin, parent.LayerMin) to account for bottom layer thru-hole pins.
Definition Object.hpp:117