X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fsnapper.h;fp=src%2Fbase%2Fsnapper.h;h=0000000000000000000000000000000000000000;hb=bfd926cd5fd98e95b8b172fabd5340c9b1957e01;hp=a37cf3305313d1e43355d815465d8b50904d282b;hpb=92c8661cef41f1109908bf645c0a171e34680183;p=architektonas diff --git a/src/base/snapper.h b/src/base/snapper.h deleted file mode 100644 index a37cf33..0000000 --- a/src/base/snapper.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef __SNAPPER_H__ -#define __SNAPPER_H__ - -#include -#include "enums.h" -#include "vector.h" - -class Entity; -class EntityContainer; -class GraphicView; -class PaintInterface; - -/** - * This class is used for snapping functions in a graphic view. - * Actions are usually derrived from this base class if they need - * to catch entities or snap to coordinates. Use the methods to - * retrieve a graphic coordinate from a mouse coordinate. - * - * Possible snapping functions are described in RS_SnapMode. - * - * @author Andrew Mustun - */ -class Snapper -{ - public: - Snapper(EntityContainer & container, GraphicView & graphicView); - Snapper(); - virtual ~Snapper(); - - void init(); - void finish(); - - void SetContainer(EntityContainer *); - void SetGraphicView(GraphicView *); - Entity * getKeyEntity(); - void setSnapMode(RS2::SnapMode snapMode); - void setSnapRestriction(RS2::SnapRestriction snapRes); - RS2::SnapMode getSnapMode(void); - RS2::SnapRestriction getSnapRestriction(void); - void setSnapRange(int r); - - Vector snapPoint(QMouseEvent * e); - Vector snapFree(Vector coord); - Vector snapEndpoint(Vector coord); - Vector snapGrid(Vector coord); - Vector snapOnEntity(Vector coord); - Vector snapCenter(Vector coord); - Vector snapMiddle(Vector coord); - Vector snapDist(Vector coord); - Vector snapIntersection(Vector coord); - - Vector restrictOrthogonal(Vector coord); - Vector restrictHorizontal(Vector coord); - Vector restrictVertical(Vector coord); - - Entity * catchEntity(const Vector & pos, RS2::ResolveLevel level = RS2::ResolveNone); - Entity * catchEntity(QMouseEvent * e, RS2::ResolveLevel level = RS2::ResolveNone); - - virtual void suspend(); - virtual void resume(); - virtual void hideOptions(); - virtual void showOptions(); - -// void drawSnapper(); -// void deleteSnapper(); - -/* -How should we handle this? All rendering goes through the GraphicView (QG_GraphicView to be -precise, soon to be merged in) as it should. So shouldn't we control the snapper through -that class as well? Unfortunately, all actions derive from this class... - -Should they? - -Not 100% sure. It does seem to make more sense to have them be a part of the GraphicView, -since snapping is a function of the grid and the entities contained in the view. (This would -also hold for the preview as well.) - -On to the interface: - -For allowing the crosshairs to be drawn, we'd have -void ShowSnapper(void) - -and -void HideSnapper(void) - -to hide it. Maybe -void SetSnapperCoords(Vector, Vector) - -for setting the coordinates? -*/ - public://for now - void SetVisible(bool visibility = true); - bool Visible(void); - void Draw(GraphicView *, PaintInterface *); - -// private: -// void xorSnapper(); - - protected: - EntityContainer * container; - GraphicView * graphicView; - Entity * keyEntity; - Vector snapCoord; - Vector snapSpot; - RS2::SnapMode snapMode; - RS2::SnapRestriction snapRes; - /** - * Snap distance for snaping to points with a - * given distance from endpoints. - */ - double distance; - /** - * Keeps track of the drawings in XOR mode. - */ - bool visible; - /** - * Snap range for catching entities. - */ - int snapRange; - /** - * Show large cross hairs. - */ - bool showCrosshairs; - bool finished; -}; - -#endif