GLIMSView Source Code Documentation

VectorEditor Class Reference

#include <vectoreditor.h>

Inheritance diagram for VectorEditor:

Inheritance graph
[legend]

List of all members.


Detailed Description

Allows editing of vector data of types point and line.

This captures viewer events produced by users such as mouse click and maps them to actions on the vectors themselves.

Author:
Dan Mingus
History:
2004-12-04 Deborah Lee Soltesz - Improved the highlighting and selection to allow the GlacierIDDlg to highlight glacier ID selected by the VectorEditor, and to display vector objects in the View as selected when selected in the GlacierIDDlg.
History:
2005-07-14 Deborah Lee Soltesz - Modified to use modifications to the undo facility in GLIMSLineData and keep selections and edits synchronized.
History:
2005-07-23 Deborah Lee Soltesz - Added history and actions for Redo facility
What's New:
2004-12-04 Lines and points associated with a glacier ID are displayed as selected in the GlacierIDDlg when selected on screen by the VectorEditor.
What's New:
2005-07-23 Deborah Lee Soltesz Redo!!!

Definition at line 43 of file vectoreditor.h.


Public Slots

void viewMousePress (QMouseEvent *me, View::MouseState &ms)
void viewMouseMove (QMouseEvent *me, View::MouseState &ms)
void viewMouseRelease (QMouseEvent *me, View::MouseState &ms)
void viewKeyPress (QKeyEvent *ke)
void viewKeyRelease (QKeyEvent *ke)
void viewSelChanged (SelectionSet::SelBox &box)
 Sets vector data objects as selected.
void breakLine ()
void joinLine ()
void contLine ()
void delSel ()
void activeLayerChanged (int)

Signals

void repaint (bool)
void selBoxChanged (Rect &)
void selectionChanged ()

Public Member Functions

 VectorEditor (VectorLayerSet *, ViewSet *)
virtual ~VectorEditor ()
void addView (View *view)
void removeView (View *view)
void clearAllLayerSelections ()
 Clear selected vector objects on all layers.

Protected Member Functions

std::vector< SelectionSet::SelObjoverSelNode (double x, double y)
bool hasIntersect (Node p1, Node p2, Node p3, Node p4)
 Answers the Question: do the lines described by p1-p2 and p3-p4 intersect?
int isSelLine (int iline)
 Answer to the question: Is the line represented by iline in the current SelectionSet* mSelSet?
bool isSelPoint (int &iline, int &inode)
 Answer to the question: Is the point (inode) in this line (iline) selected (in the current SelectionSet* mSelSet)?
void init ()
int _int_min (int v1, int v2)
int _int_max (int v1, int v2)

Protected Attributes

VectorLayerSetmLayerSet
ViewSetmViewSet
VectorDatamData
SelectionSetmSelSet
bool mInObject
bool mCtrlDown
bool mShiftDown
bool mMovingNode
std::vector< SelectionSet::SelObjmOverNode

Constructor & Destructor Documentation

VectorEditor::VectorEditor ( VectorLayerSet lyrset,
ViewSet viewset 
)

Definition at line 4 of file vectoreditor.cpp.

References activeLayerChanged(), init(), mData, and mSelSet.

Here is the call graph for this function:

VectorEditor::~VectorEditor (  )  [virtual]

Definition at line 18 of file vectoreditor.cpp.


Member Function Documentation

std::vector< SelectionSet::SelObj > VectorEditor::overSelNode ( double  x,
double  y 
) [protected]

bool VectorEditor::hasIntersect ( Node  p1,
Node  p2,
Node  p3,
Node  p4 
) [protected]

Answers the Question: do the lines described by p1-p2 and p3-p4 intersect?

Definition at line 766 of file vectoreditor.cpp.

References Node::x, and Node::y.

Referenced by viewSelChanged().

int VectorEditor::isSelLine ( int  iline  )  [protected]

Answer to the question: Is the line represented by iline in the current SelectionSet* mSelSet?

Parameters:
iline Value to match to SelObj.obj in SelectionSet* mSelSet
Returns:
if found, index in SelectionSet* mSelSet for line if !found, -1

Definition at line 806 of file vectoreditor.cpp.

References mSelSet, and SelectionSet::size().

Referenced by isSelPoint(), and viewSelChanged().

Here is the call graph for this function:

bool VectorEditor::isSelPoint ( int &  iline,
int &  inode 
) [protected]

Answer to the question: Is the point (inode) in this line (iline) selected (in the current SelectionSet* mSelSet)?

Parameters:
iline Line to check for selected point. Value to match to SelObj.obj in SelectionSet* mSelSet. iline will be changed to either -1 (not found) or index in SelectionSet* mSelect where line is represented.
inode Point to check for selection status. Value to match to a node in SelObj.nodes (for SelObj.obj in SelectionSet* mSelSet matching the given line, iline). inode will be changed to either -1 (not found) or the index in SelObj.nodes where representing the point.
Returns:
if found, true if !found, false

Definition at line 820 of file vectoreditor.cpp.

References isSelLine(), mSelSet, and SelectionSet::size().

Referenced by viewSelChanged().

Here is the call graph for this function:

void VectorEditor::init (  )  [protected]

Definition at line 74 of file vectoreditor.cpp.

References mCtrlDown, mInObject, mMovingNode, mOverNode, and mShiftDown.

Referenced by VectorEditor().

int VectorEditor::_int_min ( int  v1,
int  v2 
) [inline, protected]

Definition at line 124 of file vectoreditor.h.

Referenced by viewMouseMove(), and viewMouseRelease().

int VectorEditor::_int_max ( int  v1,
int  v2 
) [inline, protected]

Definition at line 128 of file vectoreditor.h.

Referenced by viewMouseMove(), and viewMouseRelease().

void VectorEditor::addView ( View view  ) 

void VectorEditor::removeView ( View view  ) 

void VectorEditor::clearAllLayerSelections (  ) 

Clear selected vector objects on all layers.

Definition at line 867 of file vectoreditor.cpp.

References SelectionSet::clear(), VectorLayer::getData(), VectorLayerSet::getLayer(), VectorData::getSelSet(), mLayerSet, VectorLayerSet::numLayers(), selectionChanged(), and SelectionSet::size().

Referenced by delSel(), viewMousePress(), and viewSelChanged().

Here is the call graph for this function:

void VectorEditor::viewMousePress ( QMouseEvent *  me,
View::MouseState ms 
) [slot]

void VectorEditor::viewMouseMove ( QMouseEvent *  me,
View::MouseState ms 
) [slot]

void VectorEditor::viewMouseRelease ( QMouseEvent *  me,
View::MouseState ms 
) [slot]

void VectorEditor::viewKeyPress ( QKeyEvent *  ke  )  [slot]

void VectorEditor::viewKeyRelease ( QKeyEvent *  ke  )  [slot]

Definition at line 443 of file vectoreditor.cpp.

References mCtrlDown, and mShiftDown.

Referenced by addView(), and removeView().

void VectorEditor::viewSelChanged ( SelectionSet::SelBox box  )  [slot]

Sets vector data objects as selected.

Determines which vector data objects (points and/or lines) are inside the selection box (marquis, "dancing ants") the user has drawn, and sets those objects as selected. If the user has depressed the shift-key, the objects are added to the current list of selected objects, otherwise the list of selected objects is cleared before adding the current selection.

Parameters:
box the selection box (marquis, "dancing ants") the user has drawn for the purpose of selecting vector objects on the screen to make them active for moving, deleting, etc.

Definition at line 459 of file vectoreditor.cpp.

References SelectionSet::add(), clearAllLayerSelections(), VectorData::getType(), VectorData::getXYSet(), SelectionSet::SelBox::h, hasIntersect(), isSelLine(), isSelPoint(), mData, mSelSet, mShiftDown, mViewSet, SelectionSet::SelObj::obj, VectorData::POINT, ViewSet::repaintViews(), selectionChanged(), SelectionSet::size(), Line::size(), SelectionSet::SelBox::w, SelectionSet::SelBox::x, Node::x, SelectionSet::SelBox::y, and Node::y.

Referenced by viewMouseRelease().

void VectorEditor::breakLine (  )  [slot]

void VectorEditor::joinLine (  )  [slot]

void VectorEditor::contLine (  )  [slot]

Definition at line 675 of file vectoreditor.cpp.

void VectorEditor::delSel (  )  [slot]

void VectorEditor::activeLayerChanged ( int  ilyr  )  [slot]

void VectorEditor::repaint ( bool   )  [signal]

void VectorEditor::selBoxChanged ( Rect  )  [signal]

void VectorEditor::selectionChanged (  )  [signal]


Member Data Documentation

Set of VectorLayer objects.

For internal use only.

Passed into VectorEditor during instantiation.

Definition at line 46 of file vectoreditor.h.

Referenced by activeLayerChanged(), and clearAllLayerSelections().

Set of View objects.

For internal use only.

Passed into VectorEditor during instantiation.

Definition at line 51 of file vectoreditor.h.

Referenced by breakLine(), delSel(), joinLine(), viewKeyPress(), viewMouseMove(), viewMousePress(), viewMouseRelease(), and viewSelChanged().

VectorData from active layer, consisting of std::vectors of Shapes, a SelectionSet, a Stack of undo's, an Image, and some other info. The VectorData will be GLIMSLineData or GLIMSGIDData, both of which ultimately inherit from the VectorData class.

For internal use only.

mData is retrieved from the active layer in VectorLayerSet mLayerSet using VectorLayer::getData during setActiveLayer call.

Definition at line 56 of file vectoreditor.h.

Referenced by activeLayerChanged(), breakLine(), delSel(), joinLine(), overSelNode(), VectorEditor(), viewKeyPress(), viewMouseMove(), viewMousePress(), viewMouseRelease(), and viewSelChanged().

List of selected vector objects.

For internal use only.

mSelSet is retrieved from mData.

Definition at line 66 of file vectoreditor.h.

Referenced by activeLayerChanged(), breakLine(), delSel(), isSelLine(), isSelPoint(), joinLine(), overSelNode(), VectorEditor(), viewMouseMove(), viewMousePress(), viewMouseRelease(), and viewSelChanged().

bool VectorEditor::mInObject [protected]

Definition at line 72 of file vectoreditor.h.

Referenced by init(), and viewMousePress().

bool VectorEditor::mCtrlDown [protected]

Definition at line 73 of file vectoreditor.h.

Referenced by delSel(), init(), viewKeyPress(), viewKeyRelease(), viewMouseMove(), and viewMousePress().

bool VectorEditor::mShiftDown [protected]

Definition at line 74 of file vectoreditor.h.

Referenced by init(), viewKeyPress(), viewKeyRelease(), and viewSelChanged().

bool VectorEditor::mMovingNode [protected]

Definition at line 75 of file vectoreditor.h.

Referenced by init(), viewMouseMove(), viewMousePress(), and viewMouseRelease().

Definition at line 77 of file vectoreditor.h.

Referenced by init(), viewMouseMove(), and viewMousePress().


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

Home | Search | Disclaimers & Privacy | Contact Us
GLIMSView Maintainer: dsoltesz@usgs.gov