projects
/
erd-marker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added label objects
[erd-marker.git]
/
lib
/
erd_handler
/
box.rb
diff --git
a/lib/erd_handler/box.rb
b/lib/erd_handler/box.rb
index 7389955d4b58d2927efc70703e9b3e966f799ded..75543eb22674b1dcc92f5734dcc6ea6366a929e3 100644
(file)
--- a/
lib/erd_handler/box.rb
+++ b/
lib/erd_handler/box.rb
@@
-8,7
+8,7
@@
module ErdHandler
def read(box_element)
self.id = box_element.attributes["id"].to_i
def read(box_element)
self.id = box_element.attributes["id"].to_i
- self.name = box_element.attributes["name"]
+ self.name =
Label.new
box_element.attributes["name"]
self.mark = box_element.attributes["mark"].to_f
self.x = box_element.elements["location"].attributes["x"].to_f
self.mark = box_element.attributes["mark"].to_f
self.x = box_element.elements["location"].attributes["x"].to_f
@@
-19,5
+19,14
@@
module ErdHandler
self
end
self
end
+ def contains?(other)
+ self.x < other.x and self.x + self.width > other.x + other.width and
+ self.y < other.y and self.y + self.height > other.y + other.height
+ end
+
+ def within?(other)
+ other.contains?(self)
+ end
+
end
end
end
end