This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
neofx-zoomedit/LevelVertex.h

57 lines
1.4 KiB
C
Raw Normal View History

2008-02-13 21:06:01 +00:00
#ifndef LEVELVERTEX_H_
#define LEVELVERTEX_H_
#include "LevelObject.h"
#include "VertexProvider.h"
2008-02-15 11:01:04 +00:00
class LevelVertex : public LevelObject {
2008-02-13 21:06:01 +00:00
private:
VertexProvider *provider;
size_t id;
public:
2008-02-15 11:01:04 +00:00
LevelVertex(VertexProvider *p, size_t i, LevelObject *parent)
: LevelObject(parent), provider(p), id(i) {}
2008-02-13 21:06:01 +00:00
virtual const char* getType() const {
return "LevelVertex";
}
virtual bool hit(const Vertex &v, float scale) const {
return (provider->getVertex(id)->distanceSq(v) < (3.5f*3.5f)/(scale*scale));
}
virtual int getPriority() const {
return 1000;
}
virtual bool canMove() const {return true;}
2008-02-13 21:06:01 +00:00
virtual void move(float x, float y) {
provider->moveVertex(id, x, y);
}
virtual bool canRotate() const {return true;}
virtual void rotate(Vertex m, float a) {
provider->rotateVertex(id, m, a);
2008-02-13 21:06:01 +00:00
}
virtual bool canConnect() const {return provider->canConnectVertex(id);}
virtual size_t connect() {return provider->connectVertex(id);}
VertexProvider* getProvider() const {
2008-02-19 20:56:04 +00:00
return provider;
}
size_t getId() const {
return id;
}
2008-02-13 21:06:01 +00:00
const Vertex* operator->() const {return provider->getVertex(id);}
const Vertex& operator*() const {return *provider->getVertex(id);}
};
#endif /*LEVELVERTEX_H_*/