QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
InfoCentroids Class Reference

Base class for all 2D Centroid tools. More...

Inheritance diagram for InfoCentroids:
MiscInformation EAction RActionAdapter RAction InfoAddCustomCentroid InfoAreaCentroid InfoCentroidsListener InfoSumCentroidsWeighted InfoWireCentroid

Public Member Functions

void addCentroidMarker (void doc, void op, void dataC, void radius, void preview)
 Adding 2D Centroid marker to a given operation.
 
void addTextLabel (void doc, void op, void pos, void offset, void text)
 Adding text labels to a given operation.
 
void advanceSelection (void di, void transaction)
 Advance the selection to the added marker (polyline).
 
void beginEvent ()
 Called when the user starts this action by clicking a button, choosing a menu, entering a command, etc.
 
void formatCmdValue (void value, void digits)
 Format a value textual for reporting on the command History.
 
void formatCoordinate (void valueX, void valueY)
 Format a pair of values textual as coordinate.
 
void formatLabelValue (void value, void decPnt, void digits, void trailingZ)
 Format a value textual for a 2D Centroid label.
 
void formatPropValue (void value)
 Format a value textual for storing properties.
 
void getMarkerSize ()
 Defines a 2D Centroid marker size based on overall box and drawing font size.
 
void getRunningSumKBK (void list)
 Sums values in an array by 'A generalized Kahan–Babuška-Summation-Algorithm' proposed by Klein.
 
void getTitle ()
 
void InfoCentroids (void guiAction)
 
void mergeBoxWith (void item)
 Accumulate a given item to an overall box size.
 
- Public Member Functions inherited from MiscInformation
void getTitle ()
 
void MiscInformation (void guiAction)
 
- Public Member Functions inherited from EAction
void applyCommand (void event, void preview)
 High level event triggered when a command line command should be applied or previewed.
 
void applyOperation ()
 Applies the operation returned by this.getOperation().
 
void commandEvent (void event)
 Default implementation.
 
void commandEventPreview (void event)
 Default implementation.
 
void complementOperation (void op)
 Can be reimplemented to complement the operation of an action.
 
void coordinateEvent (void event)
 Default implementation.
 
void coordinateEventPreview (void event)
 Default implementation.
 
void createDialog (void uiFile, void parent)
 Creates a new dialog based on the given UI file with the given parent.
 
void createWidget (void uiFile, void parent)
 Creates a new widget based on the given UI file with the given parent.
 
void EAction (void guiAction)
 
void enterEvent ()
 Called when user presses enter.
 
void entityPickEvent (void event)
 Default implementation.
 
void entityPickEventPreview (void event)
 Default implementation.
 
void escapeEvent ()
 Called when the user presses Escape or clicks the right mouse button.
 
void finishEvent ()
 Called when this action is terminated.
 
void getAuxPreview ()
 Called by updatePreview.
 
void getClassName ()
 
void getDocumentInterface ()
 
void getEntityId (void event, void preview, void selectable)
 
void getGraphicsView ()
 
void getGraphicsViews ()
 
void getHighlightedEntities ()
 Called by updatePreview.
 
void getOperation (void preview)
 Called by updatePreview and applyOperation.
 
void getScales ()
 
void getToolTitle ()
 
void handlePreviewError ()
 Called by updatePreview.
 
void hideOptionsToolBarWidgets (void widgets, void noSyncWidgets)
 Hides all widgets in the options tool bar which are shown in the tool dialog instead.
 
void hideUiOptions (void saveToSettings)
 Hides the UI options of this action.
 
void initDialog (void dialog)
 Called before dialog is shown.
 
void initState ()
 Called to initialize a new state of this action.
 
void initUiOptions (void resume, void optionsToolBar, void forDialog)
 Overwrite to initialize combo boxes and other UI elements of the options tool bar.
 
void isEntityEditable (void e)
 
void isEntitySnappable (void e)
 
void keyPressEvent (void event)
 Called when the user presses a key.
 
void keyReleaseEvent (void event)
 Called when the user releases a key.
 
void mouseDoubleClickEvent (void event)
 
void mousePressEvent (void event)
 Does nothing.
 
void mouseReleaseEvent (void event)
 
void pickCoordinate (void event, void preview)
 High level event triggered when a coordinate was specified by the user of a coordinate specification should be previewed.
 
void pickEntity (void event, void preview)
 High level event triggered when an entity was picked by the user or to preview picking an entity.
 
void postOperation (void transaction)
 Can be reimplemented to work with the transaction returned by the operation.
 
void propertyChangeEvent (void event)
 Allows all actions to handle property change events.
 
void resumeEvent ()
 Called whenever the action resumes its operation, for example after it was temporary suspended for another action.
 
void setArrowCursor ()
 Sets the current cursor of the current document interface (all views attached to it) to the normal arrow cursor.
 
void setCommandPrompt (void prompt)
 
void setCrosshairCursor ()
 Sets the current cursor of the current document interface (all views attached to it) to crosshair cursor.
 
void setCursor (void cursor, void name)
 
void setLeftMouseTip (void tip)
 
void setRightMouseTip (void tip)
 
void setState (void state)
 Set the state of this action.
 
void setUiOptions (void uiFile, void split)
 Sets the UI options toolbar content for this tool.
 
void showDialog ()
 Show dialog to enter some or all of the options.
 
void showUiOptions (void resume, void restoreFromSettings)
 Shows the UI options of this action if this.uiFile is set.
 
void simulateMouseMoveEvent ()
 
void slotReset ()
 Called if the user clicks the reset button of an action.
 
void suspendEvent ()
 Called whenever the action is suspended, for example if another action is started while this action is active.
 
void updatePreview (void clear)
 Updates the preview based on the operation returned by getOperation and the auxiliary construction returned be getAuxPreview.
 
- Public Member Functions inherited from RActionAdapter
virtual void commandEvent (RCommandEvent &)
 Called when a command is entered in the command line.
 
virtual void commandEventPreview (RCommandEvent &)
 Called when a command is being edited in the command line.
 
virtual void coordinateEvent (RCoordinateEvent &)
 Called for every coordinate event.
 
virtual void coordinateEventPreview (RCoordinateEvent &)
 Called if the action is in PickCoordinate mode and the mouse is moved around.
 
virtual void entityPickEvent (REntityPickEvent &)
 
virtual void entityPickEventPreview (REntityPickEvent &)
 
virtual void keyPressEvent (QKeyEvent &)
 
virtual void keyReleaseEvent (QKeyEvent &)
 
virtual void mouseDoubleClickEvent (RMouseEvent &)
 Called on mouse double click events.
 
virtual void mouseMoveEvent (RMouseEvent &)
 Called on mouse move events.
 
virtual void mousePressEvent (RMouseEvent &)
 Called on mouse press events.
 
virtual void mouseReleaseEvent (RMouseEvent &)
 Called on mouse release events.
 
virtual void panGestureEvent (QPanGesture &)
 Called on pan gesture events.
 
virtual void pinchGestureEvent (QPinchGesture &)
 Called on pinch gesture events.
 
virtual void propertyChangeEvent (RPropertyEvent &)
 Called when the value of a property is modified while this action is active.
 
 RActionAdapter (RGuiAction *guiAction=NULL)
 
virtual void setGraphicsView (RGraphicsView *)
 Called if this action is set as a navigation action of a graphics view.
 
virtual void swipeGestureEvent (QSwipeGesture &)
 Called on swipe gesture events.
 
virtual void tabletEvent (RTabletEvent &)
 Called on tablet events.
 
virtual void wheelEvent (RWheelEvent &)
 Called on mouse wheel events.
 
virtual void zoomChangeEvent (RGraphicsView &)
 Called when the zoom factor or offset changed in the given view.
 
virtual ~RActionAdapter ()
 
- Public Member Functions inherited from RAction
RAction::ClickMode getClickMode ()
 
virtual RDocumentgetDocument ()
 
QList< RGraphicsScene * > getGraphicsScenes ()
 
virtual RGuiActiongetGuiAction ()
 
RActiongetOverrideBase ()
 
RStoragegetStorage ()
 
QString getUniqueGroup ()
 
bool hasNoState ()
 
bool isOverride ()
 
bool isTerminated ()
 
 RAction (RGuiAction *guiAction=NULL)
 Copyright (c) 2011-2018 by Andrew Mustun.
 
void setClickMode (RAction::ClickMode m)
 Sets the current click mode.
 
virtual void setDocumentInterface (RDocumentInterface *di)
 
void setGuiAction (RGuiAction *guiAction)
 
void setNoState (bool on=true)
 
void setOverride ()
 
void setOverrideBase (RAction *base)
 
void setUniqueGroup (const QString &ug)
 
virtual RVector snap (RMouseEvent &event, bool preview=false)
 Uses the currently active snap function to snap to the closest object or grid point.
 
void terminate ()
 Terminates the action.
 
virtual ~RAction ()
 

Additional Inherited Members

- Public Types inherited from RAction
enum  ClickMode { PickCoordinate , PickCoordinateNoSnap , PickEntity , PickingDisabled }
 Current mouse click mode. More...
 
- Public Attributes inherited from EAction
int additionalOptionsToolBars
 
int delegate
 
int dialogUiFile
 
int guiAction
 
int includeBasePath
 
int optionsToolBarEnabled
 
int optOutRelativeZeroResume
 
int relativeZeroPos
 
int resuming
 
int settingsGroup
 
int splitUiOptions
 
int state
 
int uiFile
 
int useDialog
 
int waitingForContextMenu
 
- Protected Attributes inherited from RAction
RAction::ClickMode clickMode
 
RDocumentInterfacedocumentInterface
 
RGuiActionguiAction
 
bool noState
 Indicates whether this action is stateless (i.e.
 
bool override
 
RActionoverrideBase
 
bool terminated
 
QString uniqueGroup
 

Detailed Description

Base class for all 2D Centroid tools.

Author
CVH © 2021

Constructor & Destructor Documentation

◆ InfoCentroids()

void InfoCentroids::InfoCentroids ( void guiAction)
inline

Member Function Documentation

◆ addCentroidMarker()

void InfoCentroids::addCentroidMarker ( void doc,
void op,
void dataC,
void radius,
void preview )
inline

Adding 2D Centroid marker to a given operation.

Supports: 2D point mass, 2D area Centroid and 2D wire Centroid Type depends on booleans this.massMode & this.wireMode

Author
CVH © 2021
Parameters
docReference to the current document.
opGiven operation to add the marker entity.
dataCCentroid data [x, y, position, weight] (A value to weigh with, not to be mistaken by its mass for area/wire types)
radiusMarker size.
(preview)Optional: Preview mode, true/=false.
Returns
Nothing, marker is added to the operation.

◆ addTextLabel()

void InfoCentroids::addTextLabel ( void doc,
void op,
void pos,
void offset,
void text )
inline

Adding text labels to a given operation.

Author
CVH © 2021
Parameters
docReference to the current document.
opGiven operation to add the text label entity.
posMarker position.
offsetOffset vector to the marker position.
textLabel text.
Returns
Nothing, text label is added to the operation.

◆ advanceSelection()

void InfoCentroids::advanceSelection ( void di,
void transaction )
inline

Advance the selection to the added marker (polyline).

Author
CVH © 2021
Parameters
diA reference to the document interface.
transactionThe transaction that added entities.
Returns
Nothing. Selection is adapted

◆ beginEvent()

void InfoCentroids::beginEvent ( )
inlinevirtual

Called when the user starts this action by clicking a button, choosing a menu, entering a command, etc.

Shows the GUI elements that refer to this action as checked. Displays GUI options if this.uiFile is set to a valid UI file. Displays tool help in Help Viewer if available.

Reimplemented from EAction.

Reimplemented in InfoCentroidsListener, InfoSumCentroidsWeighted, and InfoWireCentroid.

◆ formatCmdValue()

void InfoCentroids::formatCmdValue ( void value,
void digits )
inline

Format a value textual for reporting on the command History.

Without trailing zeros, defaults to 8 when digits is invalid. With a leading space, without trailing zeros.

Author
CVH © 2021
Parameters
valueValue to format textual.
(digits)Optional: Number of digits. (=Appl.Prec.)
Returns
Textual representation with application decimal point in given or in application precision.

◆ formatCoordinate()

void InfoCentroids::formatCoordinate ( void valueX,
void valueY )
inline

Format a pair of values textual as coordinate.

In full precision with application decimal point. With a leading space.

Author
CVH © 2021
Parameters
valueXX value of coordinate.
valueYX value of coordinate.
Returns
Textual representation coordinate pair.

◆ formatLabelValue()

void InfoCentroids::formatLabelValue ( void value,
void decPnt,
void digits,
void trailingZ )
inline

Format a value textual for a 2D Centroid label.

Without a leading space.

Author
CVH © 2021
Parameters
valueValue to format textual.
decPntDecimal separator.
digitsNumber of digits.
trailingZTrailing zeros, true/false.
Returns
Textual representation governed by given preferences

◆ formatPropValue()

void InfoCentroids::formatPropValue ( void value)
inline

Format a value textual for storing properties.

Without a leading space.

Author
CVH © 2021
Parameters
valueValue to format textual.
Returns
Textual representation in full precision with application decimal point.

◆ getMarkerSize()

void InfoCentroids::getMarkerSize ( )
inline

Defines a 2D Centroid marker size based on overall box and drawing font size.

Depends on this.boxSize & this.fontSize

Author
CVH © 2021
Returns
Radius for marker entity.

◆ getRunningSumKBK()

void InfoCentroids::getRunningSumKBK ( void list)
inline

Sums values in an array by 'A generalized Kahan–Babuška-Summation-Algorithm' proposed by Klein.

Running sums may have a poor accuracy due to loss of significance. Somewhat slower than the naive approach and it requires arrays of many (tiny) values. Advantages here are: Single loop trough and second-order compensation. Usable for long (unsorted) lists of arbitrary values.

Author
CVH © 2021
Parameters
listA list of values.
Returns
The sum of the values or NaN when not an array of all numbers.

◆ getTitle()

void InfoCentroids::getTitle ( )
inline

◆ mergeBoxWith()

void InfoCentroids::mergeBoxWith ( void item)
inline

Accumulate a given item to an overall box size.

Author
CVH © 2021
Parameters
itemAn RBox or an RVector to include.
Returns
Nothing. Overall box in this.boxSize is adapted.

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