Ipelib
|
#include <ipesnap.h>
Public Types | |
enum | TSnapModes { ESnapNone = 0, ESnapVtx = 1, ESnapCtl = 2, ESnapBd = 4, ESnapInt = 8, ESnapGrid = 0x10, ESnapAngle = 0x20, ESnapAuto = 0x40 } |
Public Member Functions | |
void | intersectionSnap (const Vector &pos, Vector &fifi, const Page *page, double &snapDist) const |
bool | snapAngularIntersection (Vector &pos, const Line &l, const Page *page, double snapDist) const |
TSnapModes | simpleSnap (Vector &pos, const Page *page, double snapDist, Tool *tool=0) const |
TSnapModes | snap (Vector &pos, const Page *page, double snapDist, Tool *tool=0, 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 |
Performs snapping operations, and stores snapping state.
void Snap::intersectionSnap | ( | const Vector & | pos, |
Vector & | fifi, | ||
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().
Snap::TSnapModes Snap::simpleSnap | ( | Vector & | pos, |
const Page * | page, | ||
double | snapDist, | ||
Tool * | tool = 0 |
||
) | 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, ESnapCtl, ESnapGrid, ESnapInt, ESnapNone, ESnapVtx, ipe::Page::hasSnapping(), iGridSize, intersectionSnap(), iSnap, ipe::Page::layerOf(), ipe::Page::snapBnd(), ipe::Page::snapCtl(), ipe::Tool::snapVtx(), ipe::Page::snapVtx(), ipe::Vector::x, and ipe::Vector::y.
Referenced by ipe::CanvasBase::simpleSnapPos(), and snap().
Snap::TSnapModes Snap::snap | ( | Vector & | pos, |
const Page * | page, | ||
double | snapDist, | ||
Tool * | tool = 0 , |
||
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(), snapAngularIntersection(), and ipe::Vector::sqLen().
Referenced by ipe::CanvasBase::computeFifi().
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().
Set axis origin and direction from edge near mouse.
Returns true
if successful.
References ipe::Vector::angle(), ipe::Line::dir(), ipe::Arc::distance(), iDir, ipe::Arc::iM, iOrigin, ipe::Segment::iP, ipe::Segment::iQ, ipe::Segment::line(), ipe::Matrix::linear(), ipe::Line::project(), ipe::Bezier::snap(), and ipe::Bezier::tangent().
int ipe::Snap::iSnap |
Activated snapping modes (TSnapModes)
Referenced by ipe::CanvasBase::computeFifi(), simpleSnap(), snap(), and ipe::CanvasBase::snapToPaperAndFrame().
bool ipe::Snap::iGridVisible |
Is the grid visible?
Referenced by ipe::CanvasBase::refreshSurface().
int ipe::Snap::iGridSize |
Snap grid spacing.
Referenced by ipe::CanvasBase::drawGrid(), and simpleSnap().
double ipe::Snap::iAngleSize |
Angle for angular snapping.
Referenced by ipe::CanvasBase::drawAxes(), and getLine().
int ipe::Snap::iSnapDistance |
Snap distance (in pixels).
Referenced by ipe::CanvasBase::computeFifi(), ipe::CanvasBase::simpleSnapPos(), and ipe::CanvasBase::snapToPaperAndFrame().
bool ipe::Snap::iWithAxes |
Show coordinate system?
Referenced by ipe::CanvasBase::refreshSurface(), and ipe::TransformTool::TransformTool().
Vector ipe::Snap::iOrigin |
Origin of coordinate system.
Referenced by ipe::CanvasBase::drawAxes(), setEdge(), snap(), and ipe::TransformTool::TransformTool().
Angle ipe::Snap::iDir |
Direction of x-axis.
Referenced by ipe::CanvasBase::drawAxes(), getLine(), and setEdge().