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
2008-02-13 21:06:01 +00:00

61 lines
1.4 KiB
C++

#ifndef LEVELVERTEX_H_
#define LEVELVERTEX_H_
#include "LevelObject.h"
#include "VertexProvider.h"
class LevelVertex : public LevelObject, public VertexProvider {
private:
VertexProvider *provider;
size_t id;
public:
LevelVertex(VertexProvider *p, size_t i)
: provider(p), id(i) {}
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 void move(float x, float y) {
provider->moveVertex(id, x, y);
}
virtual void rotate(float a) {
provider->rotateVertex(id, a);
}
virtual Vertex getCenter() const {
return *provider->getVertex(id);
}
virtual const Vertex* getVertex(size_t id) const {
return provider->getVertex(this->id);
}
virtual size_t getVertexCount() const {
return 1;
}
virtual void moveVertex(size_t id, float x, float y) {
provider->moveVertex(this->id, x, y);
}
virtual void rotateVertex(size_t id, float a) {
provider->rotateVertex(this->id, a);
}
const Vertex* operator->() const {return provider->getVertex(id);}
const Vertex& operator*() const {return *provider->getVertex(id);}
};
#endif /*LEVELVERTEX_H_*/