Ipelib
Public Types | Public Member Functions | Public Attributes | List of all members
ipe::Snap Class Reference

#include <ipesnap.h>

Public Types

enum  TSnapModes {
  ESnapNone = 0, ESnapVtx = 1, ESnapBd = 2, ESnapInt = 4,
  ESnapGrid = 8, ESnapAngle = 0x10, ESnapAuto = 0x20
}
 

Public Member Functions

bool intersectionSnap (Vector &pos, const Page *page, double snapDist) const
 
bool snapAngularIntersection (Vector &pos, const Line &l, const Page *page, double snapDist) const
 
bool simpleSnap (Vector &pos, const Page *page, double snapDist) const
 
bool snap (Vector &pos, const Page *page, double snapDist, Vector *autoOrg=0) const
 
Line getLine (const Vector &mouse, const Vector &base) const
 
bool setEdge (const Vector &pos, const Page *page)
 

Public Attributes

int iSnap
 
bool iGridVisible
 
int iGridSize
 
double iAngleSize
 
int iSnapDistance
 
bool iWithAxes
 
Vector iOrigin
 
Angle iDir
 

Detailed Description

Performs snapping operations, and stores snapping state.

Member Enumeration Documentation

The different snap modes as bitmasks.

Enumerator
ESnapNone 
ESnapVtx 
ESnapBd 
ESnapInt 
ESnapGrid 
ESnapAngle 
ESnapAuto 

Member Function Documentation

bool Snap::intersectionSnap ( Vector pos,
const Page page,
double  snapDist 
) const

Perform intersection snapping.

Referenced by simpleSnap().

bool Snap::snapAngularIntersection ( Vector pos,
const Line l,
const Page page,
double  snapDist 
) const

Perform snapping to intersection of angular line and pos.

Referenced by snap().

bool Snap::simpleSnap ( Vector pos,
const Page page,
double  snapDist 
) const

Tries vertex, intersection, boundary, and grid snapping.

If snapping occurred, pos is set to the new user space position.

References ipe::Page::count(), ESnapBd, ESnapGrid, ESnapInt, ESnapVtx, ipe::Page::hasSnapping(), iGridSize, intersectionSnap(), iSnap, ipe::Page::layerOf(), ipe::Page::snapBnd(), ipe::Page::snapVtx(), ipe::Vector::x, and ipe::Vector::y.

Referenced by ipe::CanvasBase::simpleSnapPos(), and snap().

bool Snap::snap ( Vector pos,
const Page page,
double  snapDist,
Vector autoOrg = 0 
) const

Performs snapping of position pos.

Returns true if snapping occurred. In that case pos is set to the new user space position.

Automatic angular snapping occurs if autoOrg is not null — the value is then used as the origin for automatic angular snapping.

References ESnapAngle, ESnapAuto, ESnapBd, getLine(), ipe::Line::intersects(), iOrigin, iSnap, ipe::Line::project(), simpleSnap(), and snapAngularIntersection().

Referenced by ipe::CanvasBase::computeFifi().

Line Snap::getLine ( const Vector mouse,
const Vector base 
) const

Find line through base with slope determined by angular snap size and direction.

References ipe::Vector::angle(), iAngleSize, iDir, ipe::Vector::len(), and ipe::Angle::normalize().

Referenced by snap().

bool Snap::setEdge ( const Vector pos,
const Page page 
)

Member Data Documentation

int ipe::Snap::iSnap
bool ipe::Snap::iGridVisible

Is the grid visible?

Referenced by ipe::CanvasBase::CanvasBase(), and ipe::CanvasBase::refreshSurface().

int ipe::Snap::iGridSize
double ipe::Snap::iAngleSize

Angle for angular snapping.

Referenced by ipe::CanvasBase::CanvasBase(), ipe::CanvasBase::drawAxes(), and getLine().

int ipe::Snap::iSnapDistance
bool ipe::Snap::iWithAxes
Vector ipe::Snap::iOrigin
Angle ipe::Snap::iDir

The documentation for this class was generated from the following files: