36#include <wx/cmdproc.h>
61 parent_(NULL), figure_(NULL), model_(NULL), selectable_(
88 for (
unsigned i = 0; i <
children_.size(); i++) {
91 trashbag.insert(
this);
107 for (
unsigned int i = 0; i <
children_.size(); i++) {
115#if wxCHECK_VERSION(2, 8, 0)
143 for (
unsigned int i = 0; i <
children_.size(); i++) {
165 int lastDist = std::numeric_limits<int>::max();
167 for (
unsigned int i = 0; i <
children_.size(); i++) {
172#if wxCHECK_VERSION(2, 8, 0)
173 if (foundRect.Contains(point)) {
175 if (foundRect.Inside(point)) {
181 if (
distance(point, foundRect) < lastDist) {
183 lastDist =
distance(point, foundRect);
194#if wxCHECK_VERSION(2, 8, 0)
220 std::vector<EditPart*>& found) {
223 for (
unsigned int i = 0; i <
children_.size(); i++) {
232 found.push_back(
this);
233 return totalFound + 1;
248 if (editpolicy->
host() == NULL) {
279 for (
unsigned int i = 0; i <
children_.size(); i++) {
280 if (
children_.at(i)->hasEditPartRecursive(part)) {
298 vector<EditPolicy*>::const_iterator i =
editPolicies_.begin();
301 if (command != NULL) {
317 vector<EditPolicy*>::const_iterator i =
editPolicies_.begin();
319 if ((*i)->canHandle(request)) {
338 float xp =
static_cast<float>(p.x);
339 float yp =
static_cast<float>(p.y);
341 xr =
static_cast<float>(max(min(p.x, r.GetRight()), r.GetLeft()));
342 yr =
static_cast<float>(max(min(p.y, r.GetBottom()), r.GetTop()));
344 float dist = sqrt((xr - xp) * (xr - xp) + (yr - yp) * (yr - yp));
#define assert(condition)
find Finds info of the inner loops in the false
int findInRange(wxPoint point, float radius, std::vector< EditPart * > &found)
EditPart * findNearest(wxPoint point, const EditPart *exclude=NULL)
std::vector< EditPolicy * > editPolicies_
List of supported EditPolicies.
TTAMachine::MachinePart * model_
Machine component corresponding to this EditPart.
static float distance(wxPoint p, wxRect r)
Figure * figure_
Figure of this EditPart.
void installEditPolicy(EditPolicy *editpolicy)
std::vector< EditPart * > children_
List of children EditParts.
bool hasEditPartRecursive(const EditPart *part) const
bool canHandle(Request *request) const
ComponentCommand * performRequest(Request *request) const
bool garbageCollected_
Helper member to prevent improper deletion.
EditPart * child(unsigned int index) const
void addChild(EditPart *child)
EditPart * find(wxPoint point)
TTAMachine::MachinePart * model() const
void putGarbage(std::set< EditPart * > &trashbag)
bool selectable_
Tells whether the EditPart is selectable or not.
void setHost(EditPart *host)