Loading...
Searching...
No Matches
SAMSON Class Reference

This class is the main interface. More...

User plan

static SBUserPlan getUserPlan ()
 Returns the user plan.
 
static std::string getUserPlanString ()
 Returns a string containing the user plan.
 

Time

static SBCTime getTime ()
 Returns SAMSON's internal time.
 
static void startTimer ()
 Starts a new performance timer.
 
static void stopTimer (SBQuantity::second &elapsedTime)
 Stops the top performance timer.
 
static void stopTimer (SBQuantity::second &elapsedTime, SBQuantity::second &totalTime)
 Stops the top performance timer.
 

Directories

static std::string getSAMSONPath ()
 Returns the path where SAMSON is installed.
 
static std::string getSAMSONElementsPath ()
 Returns the path where SAMSON Extensions (previously called SAMSON Elements) are installed.
 
static std::string getUserDataPath ()
 Returns the path where user data is installed.
 
static std::string getScratchPath ()
 Returns the path to scratch data.
 

Documents

static SBPointerList< SBDDocument > const * getDocumentList ()
 Returns the list of open documents.
 
static SBDDocumentgetActiveDocument ()
 Returns a pointer to SAMSON's active document.
 
static void setActiveDocument (SBDDocument *document)
 Sets the active document.
 
static SBDDocumentCameragetActiveCamera ()
 Returns a pointer to the active camera.
 
static SBStructuralModelgetActiveStructuralModel ()
 Returns a pointer to the active structural model.
 
static void setActiveStructuralModel (SBStructuralModel *structuralModel)
 Sets the active structural model.
 
static std::string getActiveDocumentFilter ()
 Returns the node filter of the active document.
 
static void setActiveDocumentFilter (const std::string &filter)
 Sets the node filter of the active document.
 
static std::string getNextNodeName (SBNode::Type type, std::string prefix=std::string(), std::string suffix=std::string(), SBNode *parentNode=nullptr)
 Returns a next name starting with prefix prefix and suffix suffix for nodes of type type in parent node parentNode or in the active document of parentNode is null.
 
static void connectDocumentSignalToSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *), SBCReferenceTarget *nextReferenceTarget=0, void(SBCReferenceTarget::*nextFunctionPointer)(SBDocumentEvent *)=0)
 Connects the document signal to a slot.
 
static bool documentSignalIsConnectedToSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *))
 Returns true if and only if the document signal is connected to the slot.
 
static void disconnectDocumentSignalFromSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *))
 Disconnects the document signal from a slot.
 

Apps

static bool isAppInitialized (const SBUUID &appUUID, const SBUUID &elementUUID=SBUUID())
 Returns true or false if an app corresponding to a specific appUUID and elementUUID is initialized already.
 
static SBAppgetApp (const SBUUID &appUUID, const SBUUID &elementUUID=SBUUID())
 Returns the app corresponding to a specific appUUID and elementUUID.
 
static SBPointerIndexer< SBApp > const * getAppIndexer ()
 Returns the app indexer.
 

Editors

static SBEditorgetActiveEditor ()
 Returns a pointer to the current editor.
 
static void setActiveEditor (SBEditor *editor)
 Sets the current editor.
 
static void setActiveEditor (const SBUUID &classUUID, const SBUUID &elementUUID)
 Sets the current editor.
 
static SBEditorgetEditor (const SBUUID &classUUID, const SBUUID &elementUUID)
 Returns the editor corresponding to a specific classUUID and elementUUID.
 
static SBIndexer< SBEditor * > const * getEditorIndexer ()
 Returns the editor indexer.
 

Snapping

static QPoint snap (int x, int y)
 Returns the snapped mouse viewport displacement (x,y)
 
static QPoint snap (int x, int y, const SBPosition3 &pointInPlane)
 Returns the snapped mouse viewport displacement (x,y) in the plane containing pointInPlane.
 
static SBQuantity::length snap (const SBQuantity::length &displacement)
 Returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement.
 
static SBQuantity::degree snap (const SBQuantity::degree &displacement)
 Returns the snapped displacement if the snapping of angular displacements is on, else it returns the unchanged displacement.
 
static SBLength3 snap (const SBLength3 &displacement)
 Returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement.
 
static SBMatrix33 snap (const SBMatrix33 &rotationMatrix)
 Returns the snapped rotation matrix if the snapping of angular displacements is on, else it returns the unchanged rotationMatrix.
 
static SBSpatialTransform snap (const SBSpatialTransform &transform)
 Returns the snapped spatial transform according to the translational and angular snapping parameters.
 

Picking

static SBAtomgetAtom (int x, int y)
 Returns the atom at location (x,y) in the viewport.
 
static SBAtomgetAtom (const QPoint &position)
 Returns the atom at location position in the viewport.
 
static SBBondgetBond (int x, int y)
 Returns the bond at location (x,y) in the viewport.
 
static SBBondgetBond (const QPoint &position)
 Returns the bond at location position in the viewport.
 
static SBNodegetNode (int x, int y, const SBNodePredicate &selectionFilter=SBNode::All())
 Returns the node at location (x,y) in the viewport according to the selectionFilter.
 
static SBNodegetNode (const QPoint &position, const SBNodePredicate &selectionFilter=SBNode::All())
 Returns the node at location position in the viewport according to the selectionFilter.
 
static SBNodegetNode (int x, int y, SBPosition3 &pickedPosition, const SBNodePredicate &selectionFilter=SBNode::All())
 Returns the node at location (x,y) in the viewport and the pickedPosition according to the selectionFilter.
 
static SBNodegetNode (const QPoint &position, SBPosition3 &pickedPosition, const SBNodePredicate &selectionFilter=SBNode::All())
 Returns the node at location position in the viewport and the pickedPosition according to the selectionFilter.
 
static void getNodes (SBNodeIndexer &nodeIndexer, int x, int y, int width, int height, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false)
 Stores the nodes found inside the viewport rectangle (x,y,width,height) into nodeIndexer according to the selectionFilter.
 
static void getNodes (SBNodeIndexer &nodeIndexer, const QPoint &topLeftCorner, int width, int height, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false)
 Stores the nodes found inside the viewport rectangle (topLeftCorner,width,height) into nodeIndexer according to the selectionFilter.
 
static void getNodes (SBNodeIndexer &nodeIndexer, const SBVector< QPoint > &selectionLasso, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false)
 Returns the nodes inside the selection lasso with contour selectionLasso into nodeIndexer according to the selectionFilter.
 
static const SBNodePredicategetActiveSelectionFilter ()
 Returns the active selection filter.
 
static std::string getActiveSelectionFilterName ()
 Returns the active selection filter name.
 
static std::string getActiveSelectionFilterNSL ()
 Returns the active selection filter NSL string.
 
static bool setActiveSelectionFilterByName (const std::string &selectionFilterName)
 Sets the active selection filter according to the given name selectionFilterName. Returns true in case of the success.
 
static bool getDeepSelectionFlag ()
 Returns whether the user wants deep selection.
 

Viewport

static int getViewportWidth ()
 Returns the viewport width.
 
static int getViewportHeight ()
 Returns the viewport height.
 
static double getViewportPixelRatio ()
 Returns the viewport pixel ratio.
 
static QPoint getMousePositionInViewport ()
 Returns the current mouse position in viewport coordinates.
 
static SBVector3 getViewportPositionFromWorldPosition (const SBPosition3 &position)
 Returns the projection in the viewport of a given world position.
 
static SBPosition3 getWorldPositionFromViewportPosition (double x, double y)
 Returns the 3D position that corresponds to the viewport location (x,y)

 
static SBPosition3 getWorldPositionFromViewportPosition (double x, double y, const SBPosition3 &pointInPlane)
 Returns the 3D position that corresponds to the viewport location (x,y) in the plane containing pointInPlane.
 
static SBPosition3 getWorldPositionFromViewportPosition (const QPoint &position)
 Returns the 3D position that corresponds to the viewport location (x,y)

 
static SBPosition3 getWorldPositionFromViewportPosition (const QPoint &position, const SBPosition3 &pointInPlane)
 Returns the 3D position that corresponds to the viewport location (x,y) in the plane containing pointInPlane.
 
static QImage captureViewport (int width, int height, bool transparentBackground=false, bool usePathTracing=false, bool showProgressBar=true)
 Captures the viewport.
 
static void captureViewport (const std::string &fileName, int width, int height, bool transparentBackground=false, bool usePathTracing=false, bool showProgressBar=true)
 Captures the viewport.
 
static QImage renderViewport (int width, int height, int samples=1024, bool useDenoise=true, int denoiseStartSample=100, float adaptiveThreshold=0.01f, bool transparentBackground=false)
 Renders the viewport using a path tracer.
 
static void renderViewport (const std::string &fileName, int width, int height, int samples=1024, bool useDenoise=true, int denoiseStartSample=100, float adaptiveThreshold=0.01f, bool transparentBackground=false)
 Renders the viewport using a path tracer.
 
static bool getAddWatermarkFlag ()
 Returns true when a watermark should be added to presentation movies and frames.
 
static QImage getDarkWatermark ()
 Returns the dark watermark.
 
static QImage getLightWatermark ()
 Returns the light watermark.
 
static void requestViewportFocus ()
 Requests a viewport focus.
 
static void requestViewportUpdate ()
 Requests a viewport update.
 
static void signalPathTracingStarted ()
 Signals a path tracing start.
 
static void signalPathTracingUpdated (int progress)
 Signals a path tracing update.
 
static void signalPathTracingCompleted ()
 Signals a path tracing completion.
 
static void setViewportCursor (const QCursor &cursor)
 Sets the viewport cursor.
 
static void setViewportCursor (Qt::CursorShape cursorShape)
 Sets the viewport cursor.
 
static void unsetViewportCursor ()
 Unsets the viewport cursor.
 
static QCursor makeViewportCursor (const QString &fileName, int height, int hotX=-1, int hotY=-1)
 Makes a viewport cursor.
 
static void enableViewportNodeHighlighting ()
 Enables automatic node highlighting in the viewport.
 
static void disableViewportNodeHighlighting ()
 Enables automatic node highlighting in the viewport.
 
static void showContextMenu (const QPoint &position, SBNode *highlightedNode=0)
 Shows the context menu.
 
static const float * getHighlightingColor ()
 Returns the highlighting color.
 
static float getHighlightingOpacity ()
 Returns the highlighting opacity.
 
static const float * getSelectionColor ()
 Returns the selection color.
 
static float getSelectionOpacity ()
 Returns the selection opacity.
 
static float getSelectionOutlineOpacity ()
 Returns the selection outline opacity.
 
static QFont getViewportFont ()
 Returns the font used for text in the viewport.
 
static void setCustomViewport (QWidget *widget=0)
 Replaces the viewport with a custom widget. When widget is equal to 0, the normal viewport is restored.
 
static SBDDocumentRenderPresetcreateRenderPreset ()
 Creates a render preset based on the current rendering settings; returns the owning pointer.
 
static bool getCameraControllerFlag ()
 Returns true when the camera controller should be displayed in the viewport.
 
static bool getGridFlag ()
 Returns true when the grid should be displayed in the viewport.
 
static bool getScaleFlag ()
 Returns true when the scale should be displayed in the viewport.
 
static unsigned int getMultiSampleFactor ()
 Returns the multisampling factor.
 
static int getMaximumTextureSize ()
 Returns the maximum texture size.
 
static int getMaximum3DTextureSize ()
 Returns the maximum 3D texture size.
 
static int getMaximumRectangleTextureSize ()
 Returns the maximum rectangle texture size.
 
static bool getTransparentBackgroundFlag ()
 Returns true when the background should be transparent.
 
static const float * getCurrentBackgroundTopColor ()
 Returns the top color of the current background.
 
static const float * getCurrentBackgroundBottomColor ()
 Returns the top color of the current background.
 
static bool getCurrentBackgroundImageFlag ()
 Returns true when the current background should show an image from a file.
 
static QString getCurrentBackgroundImageFileName ()
 Returns the file name of the current background image.
 
static int getCurrentBackgroundImageMode ()
 Returns the display mode of the current background image (0: contained in the viewport, 1: covering the viewport)
 
static const float * getNextBackgroundTopColor ()
 Returns the top color of the next background

 
static const float * getNextBackgroundBottomColor ()
 Returns the top color of the next background

 
static bool getNextBackgroundImageFlag ()
 Returns true when the next background should show an image from a file.
 
static QString getNextBackgroundImageFileName ()
 Returns the file name of the next background image.
 
static int getNextBackgroundImageMode ()
 Returns the display mode of the next background image (0: contained in the viewport, 1: covering the viewport)
 
static float getBackgroundProgress ()
 Returns the progress between the current background (0) and the next background (1)

 
static bool getFogFlag ()
 Returns true when fog is active in the viewport.
 
static const SBQuantity::lengthgetFogBegin ()
 Returns the distance at which the fog begins.
 
static const SBQuantity::lengthgetFogEnd ()
 Returns the distance beyond which fog is maximal.
 
static float getFogStrength ()
 Returns the fog strength.
 

Headset

static QOpenGLContext * createHeadsetViewport ()
 Creates a viewport for a virtual reality headset.
 
static bool setHeadsetParameters (int panelWidth, int panelHeight, unsigned int leftFrameBuffer, unsigned int rightFrameBuffer)
 Sets the panel size of the headset.
 
static bool updateHeadsetViewport (bool isLeftEye)
 Updates the headset viewport.
 

Light

static const float * getLightDirection (unsigned int lightIndex)
 Returns the light direction of light lightIndex.
 
static float getLightIntensity (unsigned int lightIndex)
 Returns the light intensity of light lightIndex.
 
static const float * getLightColor (unsigned int lightIndex)
 Returns the light color of light lightIndex.
 
static float getSpecularIntensity (unsigned int lightIndex)
 Returns the specular intensity of light lightIndex.
 
static float getSpecularPower (unsigned int lightIndex)
 Returns the specular power of light lightIndex.
 
static float getAmbientLight ()
 Returns the ambient light.
 
static const float * getFresnelColor ()
 Returns the Fresnel color.
 
static float getFresnelPower ()
 Returns the Fresnel power.
 
static float getFresnelIntensity ()
 Returns the Fresnel intensity.
 

Version number

static SBCContainerVersionNumber getVersionNumber ()
 Returns the version number of SAMSON.
 
static std::string getPublicVersionNumber ()
 Returns the "public version number" of SAMSON.
 
static std::string getPublicName (bool includeVersion=false, bool includeHashInVersion=false)
 Returns the public name of SAMSON.
 

Periodic table

static const SBElementgetElement (SBMElement::Type element)
 Returns the periodic table element corresponding to a given type.
 
static SBMElement *const * getElementVector ()
 Returns the complete periodic table element vector.
 
static unsigned int getNumberOfElements ()
 Returns the number of defined periodic table elements, including the Unknown element.
 
static std::string getElementName (SBMElement::Type element)
 Returns the name of the periodic table element corresponding to a given type.
 
static std::string getElementSymbol (SBMElement::Type element)
 Returns the symbol of the periodic table element corresponding to a given type.
 
static std::string getPeriod (SBMElement::Type element)
 Returns the period of periodic table element element.
 
static unsigned int getGroup (SBMElement::Type element)
 Returns the group of periodic table element element.
 
static std::string getBlock (SBMElement::Type element)
 Returns the block of periodic table element element.
 
static SBQuantity::mass getAtomicWeight (SBMElement::Type element)
 Returns the atomic weight of periodic table element element.
 
static SBQuantity::length getCovalentRadius (SBMElement::Type element)
 Returns the covalent radius of periodic table element element.
 
static SBQuantity::length getCovalentRadius (SBMElement::Type element, int bondType)
 Returns the covalent radius of periodic table element element for bond type bondType (1 for single bond, 2 for double bond, 3 for triple bond, for other values it returns getCovalentRadius())
 
static SBQuantity::length getVanDerWaalsRadius (SBMElement::Type element)
 Returns the van der Waals radius of periodic table element element.
 
static SBQuantity::dimensionless getElectronegativity (SBMElement::Type element)
 Returns the electronegativity of periodic table element element.
 
static SBElement::Type getElementTypeByName (char *elementName)
 Returns the periodic table element type corresponding to a given name

 
static SBElement::Type getElementTypeByName (const std::string &elementName)
 Returns the periodic table element type corresponding to a given name

 
static SBElement::Type getElementTypeBySymbol (char *elementSymbol)
 Returns the periodic table element type corresponding to a given symbol

 
static SBElement::Type getElementTypeBySymbol (const std::string &elementSymbol)
 Returns the periodic table element type corresponding to a given symbol.
 

GUI

static bool isGUIThread ()
 Returns true if called from the main thread (GUI thread), else return false.
 
static SBGWindowaddDialog (SBGWindowDialog *dialog)
 Adds a SAMSON dialog to the user interface.
 
static SBGWindowaddDialog (QDialog *dialog, QString name="", int format=SBGWindow::NoOptions, QPixmap logo=QPixmap(), SBUUID uuid=SBUUID(""))
 Adds a Qt dialog to the user interface.
 
static SBGWindowaddWidget (SBGWindowWidget *widget)
 Adds a SAMSON widget to the user interface.
 
static SBGWindowaddWidget (QWidget *widget, QString name="", int format=SBGWindow::NoOptions, QPixmap logo=QPixmap(), SBUUID uuid=SBUUID(""))
 Adds a Qt widget to the user interface.
 
static SBGWindowDockaddDockWidget (SBGWindowWidget *widget, Qt::DockWidgetArea area=Qt::RightDockWidgetArea, bool visible=true, bool spacer=true)
 Adds a SAMSON widget to the user interface as a dockable window.
 
static void removeDialog (SBGWindowDialog *dialog)
 Removes a SAMSON dialog from the user interface.
 
static void removeDialog (QDialog *dialog)
 Removes a Qt dialog from the user interface.
 
static void removeWidget (SBGWindowWidget *widget)
 Removes a SAMSON widget from the user interface.
 
static void removeWidget (QWidget *widget)
 Removes a Qt widget from the user interface.
 
static void removeWindow (SBGWindow *window)
 Removes a window from the user interface.
 
static void setBusy (bool b)
 Notifies the user that SAMSON is busy.
 
static void setStatusMessage (const QString &message, int time=0)
 Shows a message in the status bar.
 
static bool isShowingTip (const SBUUID &tipUUID=SBUUID())
 Returns whether a tip is being shown.
 
static void showTip (const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false)
 Shows a tip window with a title tipTitle and text tipText at the position relativePosition relative to a widget widget.
 
static void showTip (const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, const QPixmap &tipPixmap, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false)
 Shows a tip window with a title tipTitle, text tipText, and image tipPixmap at the position relativePosition relative to a widget widget.
 
static void showTip (const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, const QString &tipMoviePath, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false)
 Shows a tip window with a title tipTitle, text tipText, and gif-movie tipMovie at the position relativePosition relative to a widget widget.
 
static void hideTip ()
 Hides the last tip window.
 
static void informUser (const QString &dialogTitle, const QString &dialogText, const QPixmap &logo=QPixmap())
 Informs the user with a message in a modal pop-up dialog.
 
static void informUser (const QString &dialogTitle, const QString &labelText, const QString &text, bool monospaceFont=false, const QPixmap &logo=QPixmap())
 Informs the user with a message and text in a modal pop-up dialog.
 
static void informUser (SBGWindowWidget *widget, const QPixmap &logo=QPixmap())
 Informs the user with a widget in a modal pop-up dialog.
 
static void informUser (QWidget *widget, const QPixmap &logo=QPixmap())
 Informs the user with a widget in a modal pop-up dialog.
 
static bool askUser (const QString &dialogTitle, const QString &dialogText, QDialogButtonBox *buttonBox=0, const QPixmap &logo=QPixmap())
 Asks a question to the user with a message in a modal pop-up dialog.
 
static bool askUser (const QString &dialogTitle, const QString &labelText, const QString &text, bool monospaceFont=false, QDialogButtonBox *buttonBox=0, const QPixmap &logo=QPixmap())
 Asks a question to the user with a message and text in a modal pop-up dialog.
 
static bool askUser (SBGWindowWidget *widget, QDialogButtonBox *buttonBox=0, const QPixmap &logo=QPixmap())
 Asks a question to the user with a widget in a modal pop-up dialog.
 
static bool askUser (QWidget *widget, QDialogButtonBox *buttonBox=0, const QPixmap &logo=QPixmap())
 Asks a question to the user with a widget in a modal pop-up dialog.
 
static bool getChoiceFromUser (const QString &dialogTitle, int &resultIndex, const QString &label, const QStringList &choices, const QStringList &toolTips, const QList< QPixmap > &icons, const QPixmap &logo=QPixmap())
 Gets a choice from the user in a modal pop-up dialog.
 
static bool getColorFromUser (const QString &dialogTitle, SBColor &result, const QPixmap &logo=QPixmap())
 Gets a color from the user in a modal pop-up dialog.
 
static bool getDoubleFromUser (const QString &dialogTitle, double &result, double minimum, double maximum, double singleStep=1.0, const QString &prefix="", const QString &suffix="", int decimals=2, const QPixmap &logo=QPixmap())
 Gets a number from the user in a modal pop-up dialog.
 
static bool getFontFromUser (const QString &dialogTitle, QFont &result, const QPixmap &logo=QPixmap())
 Gets a font from the user in a modal pop-up dialog.
 
static bool getIntegerFromUser (const QString &dialogTitle, int &result, int minimum, int maximum, int singleStep=1, const QString &prefix="", const QString &suffix="", const QPixmap &logo=QPixmap())
 Gets a number from the user in a modal pop-up dialog.
 
static bool getIntegerIntervalFromUser (const QString &dialogTitle, const QStringList &labelText, std::pair< int, int > &result, const std::pair< int, int > &minValueInterval, const std::pair< int, int > &maxValueInterval, const std::pair< int, int > &singleStep=std::pair< int, int >(1, 1), const QString &prefix="", const QString &suffix="", const QPixmap &logo=QPixmap())
 Gets an integer interval from the user in a modal pop-up dialog.
 
static bool getDoubleIntervalFromUser (const QString &dialogTitle, const QStringList &labelText, std::pair< double, double > &result, const std::pair< double, double > &minValueInterval, const std::pair< double, double > &maxValueInterval, const std::pair< double, double > &singleStep=std::pair< double, double >(1.0, 1.0), const QString &prefix="", const QString &suffix="", const QPixmap &logo=QPixmap())
 Gets a double interval from the user in a modal pop-up dialog.
 
static bool getStringFromUser (const QString &dialogTitle, QString &result, const QString &placeholderText="", const QPixmap &logo=QPixmap())
 Gets a string from the user in a modal pop-up dialog.
 
static bool getPlainTextFromUser (const QString &dialogTitle, QString &result, int maxSize=0, const QString &placeholderText="", const QPixmap &logo=QPixmap())
 Gets a text from the user in a modal pop-up dialog.
 
static bool getItemFromUser (const QString &dialogTitle, QString &result, const QString &label, const QStringList &items, int current=0, const QPixmap &logo=QPixmap())
 Gets an item from the user in a modal pop-up dialog.
 
static bool getItemFromUser (const QString &dialogTitle, int &resultIndex, const QString &label, const QStringList &items, const QPixmap &logo=QPixmap())
 Gets an item from the user in a modal pop-up dialog.
 
static bool getElementFromUser (const QString &dialogTitle, SBMElement::Type &elementType, const QPixmap &logo=QPixmap())
 Gets a periodic table element from the user in a modal pop-up dialog.
 
static bool getElementsFromUser (const QString &dialogTitle, std::vector< SBMElement::Type > &elementTypes, const QPixmap &logo=QPixmap())
 Gets a list of periodic table elements from the user in a modal pop-up dialog.
 
static SBPalettegetPaletteFromUser (const QString &dialogTitle, bool &ok, const SBPalette *defaultPalette=nullptr, const QPixmap &logo=QPixmap())
 Gets a color palette from the user in a modal pop-up dialog. If the defaultPalette is provided it is set as a default one in the color palette dialog.
 
static bool getPromptFromUser (const QString &dialogTitle, QString &result, const QString &placeholderText="", const QPixmap &logo=QPixmap())
 Gets a string from the user in a modal pop-up dialog.
 
static bool getPathFromUser (const QString &dialogTitle, QString &result, const QPixmap &logo=QPixmap())
 Gets a path from the user in a modal pop-up dialog.
 
static bool getFileNameFromUser (const QString &dialogTitle, QString &result, const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options(), const QPixmap &logo=QPixmap())
 Gets a filename from the user in a modal pop-up dialog with Open button.
 
static bool getFileNamesFromUser (const QString &dialogTitle, QStringList &result, const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options(), const QPixmap &logo=QPixmap())
 Gets a list of filenames from the user in a modal pop-up dialog with Open button.
 
static bool getSaveFileNameFromUser (const QString &dialogTitle, QString &result, const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options(), const QPixmap &logo=QPixmap())
 Gets a filename from the user in a modal pop-up dialog with Save button.
 
static bool getCredentialsFromUser (const QString &dialogTitle, QString &user, QString &password, const QPixmap &logo=QPixmap())
 Gets credentials from the user in a modal pop-up dialog.
 
static bool getCredentialsFromUser (const QString &dialogTitle, QString &host, int &port, QString &user, QString &password, const QPixmap &logo=QPixmap())
 Gets credentials from the user in a modal pop-up dialog.
 
static void getReplyFromUser (const SBCContainerUUID &developerUUID, const SBCContainerUUID &questionUUID)
 Asks the user to reply to a question.
 
static void getLikeFromUser (const SBCContainerUUID &developerUUID, const SBCContainerUUID &extensionUUID)
 Asks the user to like an extension.
 
static void showProgressBar (const QString &name="", int minimum=0, int maximum=0, const SBQuantity::second &minimumDuration=SBQuantity::second(2.0), bool isCancellable=true, const QString &cancelButtonText="Cancel")
 Shows the progress bar

 
static int getProgressBarValue ()
 Returns the current value of the progress bar.
 
static void setProgressBarValue (int value)
 Sets the value of the progress bar.
 
static void hideProgressBar ()
 Hides the progress bar.
 
static bool isProgressBarStopped ()
 Returns true when the progress bar is stopped.
 
static void registerAction (SBAction *action)
 Registers a new action visible for all users.
 
static SBActiongetAction (const SBUUID &actionUUID)
 Returns the action with the given actionUUID.
 
static QAction * getAction (const QString &className)
 Returns the first found action with the given className.
 
static QAction * getActionByText (const QString &text)
 Returns the first found action with the given text.
 
static SBActionWidgetgetActionWidget (const SBUUID &actionWidgetUUID)
 Returns the action widget with the given actionWidgetUUID.
 
static SBNodeGUIgetGUI (SBNode *node)
 Returns the GUI of a node.
 
static QPixmap getColorbar (const SBDPalette *palette, unsigned int width, unsigned int height, unsigned int nColors=10, bool isHorizontal=true)
 Returns a pixmap with a colorbar for a given color palette palette.
 
static bool getDarkModeFlag ()
 Returns true when dark mode is on.
 

Python Scripting

static bool runPythonFile (const std::string &fileName, bool raisePythonConsole=false)
 Executes Python script file fileName in the Python Console. If raisePythonConsole is true then it raises the Python Console.
 
static bool runPythonCode (const std::string &codeString, bool raisePythonConsole=false)
 Executes Python code codeString in the Python Console. If raisePythonConsole is true then it raises the Python Console.
 

Resources

static QIcon getIcon (const QString &iconName, const SBUUID &uuid)
 Returns the icon with the given name iconName the given element uuid uuid.
 
static QPixmap getPixmap (const QString &pixmapName, const SBUUID &uuid)
 Returns the pixmap with the given name pixmapName, the given element uuid uuid.
 
static QCursor getCursor (const QString &cursorName, const SBUUID &uuid)
 Returns the cursor with the given name cursorName, the given element uuid uuid.
 
static bool registerPixmap (const QString &name, const SBUUID &uuid, const QString &filePath, const QString &description=QString())
 Register the pixmap based on the given name name, the given element uuid uuid, the given description description, the given filePath filePath.
 
static bool registerPixmap (const QString &name, const SBUUID &uuid, const QPixmap &pixmap, const QString &description=QString())
 Register the pixmap based on the given name name, the given element uuid uuid, the given description description, the given pixmap pixmap.
 
static bool registerIcon (const QString &name, const SBUUID &uuid, const QString &filePath, const QString &description=QString())
 Register the icon based on the given name name, the given element uuid uuid, the given description description, the given filePath filePath.
 
static bool registerIcon (const QString &name, const SBUUID &uuid, const QIcon &icon, const QString &description=QString())
 Register the icon based on the given name name, the given element uuid uuid, the given description description, the given icon icon.
 
static bool registerCursor (const QString &name, const SBUUID &uuid, const QString &filePath, const QString &description=QString())
 Register the cursor based on the given name name, the given element uuid uuid, the given description description, the given filePath filePath.
 
static bool registerCursor (const QString &name, const SBUUID &uuid, const QCursor &icon, const QString &description=QString())
 Register the cursor based on the given name name, the given element uuid uuid, the given description description, the given icon icon.
 

Undo

static bool isHolding ()
 Returns true when SAMSON is holding.
 
static void beginHolding (const std::string &name)
 Begins holding.
 
static void disableHolding ()
 Pauses holding.
 
static void enableHolding ()
 Resumes holding.
 
static void endHolding ()
 Ends holding.
 
static void hold (void *object)
 Holds an object.
 
static void hold (SBNode *node)
 Holds a node and its descendants.
 
static void hold (SBUndoCommand *undoCommand)
 Holds a command.
 
static void hold (SBPointerTarget *pointerTarget)
 Holds a pointer target allocated on the heap.
 
static void holdArray (void *array)
 Holds an array allocated on the heap.
 
static void undo ()
 Undo one command.
 
static void redo ()
 Redo one command.
 
static bool isUndoing ()
 Returns true while undoing.
 
static bool isRedoing ()
 Returns true while redoing.
 

Files

static bool canImportFromFile (const std::string &fileName)
 Returns true when the files can be imported.
 
static void importFromFile (const std::string &fileName, const std::unordered_map< std::string, SBValue > *parameters=nullptr, SBDDocumentFolder *preferredFolder=nullptr, SBIFileImporter *importer=nullptr)
 Import a file from the disk.
 
static void importFromFile (const QStringList &fileNameList, const std::unordered_map< std::string, SBValue > *parameters=nullptr, SBDDocumentFolder *preferredFolder=nullptr, SBIFileImporter *importer=nullptr)
 Import files from the disk.
 
static void exportToFile (const SBNodeIndexer &nodeIndexer, const std::string &fileName, const std::unordered_map< std::string, SBValue > *parameters=nullptr, SBIFileExporter *exporter=nullptr)
 Export a selection of nodes to a file.
 

Display

static SB_OPENGL_FUNCTIONS * getOpenGLFunctions ()
 Returns a pointer to the OpenGL functions.
 
static void displayCylinders (unsigned int nCylinders, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *capData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
 Displays cylinders.
 
static void displayCylindersSelection (unsigned int nCylinders, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *capData, const unsigned int *nodeIndexData)
 Displays cylinders for selection.
 
static void displayLines (unsigned int nLines, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
 Displays 3D lines.
 
static void displayLinesOrtho (unsigned int nLinesOrtho, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, bool reverseViewport=true, bool transparency=false)
 Displays 2D lines.
 
static void displayLinesSelection (unsigned int nLines, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData)
 Displays 3D lines for selection.
 
static void displayLineSweptSpheres (unsigned int nLineSweptSpheres, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const float *colorData, unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
 Displays line-swept spheres.
 
static void displayLineSweptSpheresSelection (unsigned int nLineSweptSpheres, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *nodeIndexData)
 Displays line-swept spheres for selection.
 
static void displaySpheres (unsigned int nSpheres, const float *positionData, const float *radiusData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
 Displays spheres.
 
static void displaySpheresSelection (unsigned int nSpheres, const float *positionData, const float *radiusData, const unsigned int *nodeIndexData)
 Displays spheres for selection.
 
static void displayTip (int x, int y, const std::string &tip)
 Displays a tip.
 
static void displayTip (const QPoint &position, const std::string &tip)
 Displays a tip.
 
static void displayText (const std::string &text, const SBPosition3 &position, const QFont &font, float *color)
 Displays text.
 
static void displayTextSelection (const std::string &text, const SBPosition3 &position, const QFont &font, unsigned int nodeIndex)
 Displays text for selection.
 
static void displayTexturedTriangles (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *normalData, const float *colorData, const unsigned int *flagData, const float *textureCoordinateData, unsigned int textureID, bool shadowPassFlag=false, bool transparency=false, const SBSpatialTransform &transform=SBSpatialTransform::identity, const SBColor &diffuseColor=SBColor::black, float diffuseColorReplacement=0.0f, float opacity=1.0f, unsigned int flagModifier=0)
 Displays 3D textured triangles.
 
static void displayTexturedTrianglesOrtho (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, const float *textureCoordinateData, unsigned int textureID, bool reverseViewport=true, bool transparency=false)
 Displays 2D textured triangles.
 
static void displayTexturedTrianglesOrthoSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, const float *textureCoordinateData, unsigned int textureID, bool reverseViewport=true, bool transparency=false)
 Displays 2D textured triangles for selection.
 
static void displayTexturedTrianglesSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, const float *textureCoordinateData, unsigned int textureID, bool transparency=false, const SBSpatialTransform &transform=SBSpatialTransform::identity, unsigned int nodeIndexModifier=0)
 Displays 3D textured triangles for selection.
 
static void displayTriangles (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *normalData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, const SBSpatialTransform &transform=SBSpatialTransform::identity, const SBColor &diffuseColor=SBColor::black, float diffuseColorReplacement=0.0f, float opacity=1.0f, unsigned int flagModifier=0)
 Displays 3D triangles.
 
static void displayTrianglesOrtho (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, bool reverseViewport=true, bool transparency=false)
 Displays 2D triangles.
 
static void displayTrianglesOrthoSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, bool reverseViewport=true, bool transparency=false)
 Displays 2D triangles for selection.
 
static void displayTrianglesSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, const SBSpatialTransform &transform=SBSpatialTransform::identity, unsigned int nodeIndexModifier=0)
 Displays 3D triangles for selection.
 
static void displayTubes (float *ovalCenter, float *normal, float *binormal, float *width, float *height, unsigned int *nodeIndex, unsigned int *sectionIndex, unsigned int *detailIndex, unsigned int *flags, unsigned int sectionsNumber, unsigned int sectionsDetail, unsigned int ovalDetail, unsigned int triangleReduction, float *color, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
 Displays tubes.
 
static void displayTubesSelection (float *ovalCenter, float *normal, float *binormal, float *width, float *height, unsigned int *nodeIndex, unsigned int *sectionIndex, unsigned int *detailIndex, unsigned int sectionsNumber, unsigned int sectionsDetail, unsigned int ovalDetail, unsigned int triangleReduction, float *color)
 Displays tubes for selection.
 
static unsigned int generateTexture (const QImage &textureImage)
 Generate an OpenGL texture from a QImage and returns its id.
 
static void deleteTexture (unsigned int textureID)
 Deletes an OpenGL texture from its id.
 
static const SBQuantity::lengthgetAtomRadius ()
 Returns the radius of atoms in the default representation of structural models (when a constant radius is used)
 
static const SBQuantity::lengthgetBondRadius ()
 Returns the radius of bonds in the default representation of structural models.
 
static bool getMultipleBondDisplayFlag ()
 Returns true when bonds are displayed with a variable number of cylinders to represent their order.
 
static bool getVanDerWaalsAtomRadiusFlag ()
 Returns true when atoms are displayed with a radius proportional to their van der Waals radius.
 
static float getVanDerWaalsAtomRadiusRatio ()
 Returns the constant by which the atoms van der Waals radius is multiplied to represent atoms in the viewport (when a constant radius is not used)
 

Introspection

Access proxies of registered classes

static SBProxygetProxy (const std::string &className, const SBUUID &elementUUID=SBUUID())
 Returns the proxy of a class.
 
static SBIndexer< SBProxy * > const * getProxyIndexer (SBCClass::Type classType)
 Returns all proxies corresponding to a given class type classType.
 

Factory

static SBNodePredicatemakeNodePredicate (const std::string &selectionString)
 Make a node predicate based on a selectionString.
 
static SBControllermakeController (const std::string &controllerClassName, const SBUUID &controllerElementUUID=SBUUID())
 Makes a controller.
 
static SBInteractionModelParticleSystemmakeInteractionModel (SBParticleSystem *dynamicalModel, const std::string &interactionModelClassName, const SBUUID &interactionModelElementUUID=SBUUID())
 Makes an interaction model.
 
static SBSNeighborSearchParticleSystemmakeNeighborSearch (SBParticleSystem *dynamicalModel, const SBQuantity::length &cutoffDistance, const std::string &neighborSearchClassName, const SBUUID &neighborSearchElementUUID=SBUUID())
 Makes a neighbor search algorithm.
 
static SBStateUpdaterParticleSystemmakeStateUpdater (SBParticleSystem *dynamicalModel, SBInteractionModelParticleSystem *interactionModel, const std::string &stateUpdaterClassName, const SBUUID &stateUpdaterElementUUID=SBUUID())
 Makes a state updater.
 
static SBSimulatorParticleSystemmakeSimulator (const SBNodeIndexer &nodeIndexer, const std::string &interactionModelClassName, const SBUUID &interactionModelElementUUID, const std::string &stateUpdaterClassName, const SBUUID &stateUpdaterElementUUID=SBUUID())
 Makes a simulator.
 
static SBVisualModelmakeVisualModel (const SBNodeIndexer &nodeIndexer, const std::string &visualModelClassName, const SBUUID &visualModelElementUUID=SBUUID())
 Makes a visual model.
 
static SBPropertyModelmakePropertyModel (const SBNodeIndexer &nodeIndexer, const std::string &propertyModelClassName, const SBUUID &propertyModelElementUUID=SBUUID())
 Makes a property model.
 
static SBAnimationmakeAnimation (const std::string &name, const SBNodeIndexer &nodeIndexer, double currentFrame, const std::string &animationClassName, const SBUUID &animationElementUUID=SBUUID())
 Makes an animation.
 
static SBNodeSelectormakeSelector (const std::string &selectorClassName, const SBUUID &selectorElementUUID=SBUUID())
 Makes a selector.
 

Selection

static void select (const std::string &selectionString)
 Selects nodes from the active document based on a selectionString.
 
static void addToSelection (const std::string &selectionString)
 Adds nodes from the active document to the selection based on a selectionString.
 
static void removeFromSelection (const std::string &selectionString)
 Removes nodes from the active document to the selection based on a selectionString.
 
static void getNodes (SBNodeIndexer &nodeIndexer, const std::string &selectionString)
 Collects nodes from the active document into nodeIndexer based on a selectionString.
 
static void getNodes (SBNodeIndexer &nodeIndexer, SBDDataGraphNode::Type nodeType, bool selectedNodesOnly=false, const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false)
 Collects nodes from the active document into nodeIndexer, based on a nodeType, a selection status and a visitPredicate, with or without dependencies.
 
static void getNodes (SBNodeIndexer &nodeIndexer, const SBNodePredicate &selectionPredicate=SBDDataGraphNode::All(), const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false)
 Collects nodes from the active document into nodeIndexer, based on a selectionPredicate and a visitPredicate, with or without dependencies.
 
static bool hasNode (const std::string &selectionString)
 Checks for the presence nodes in the active document based on a selectionString.
 
static bool hasNode (SBDDataGraphNode::Type nodeType, bool selectedNodesOnly=false, const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false)
 Checks for the presence nodes in the active document based on a nodeType, a selection status and a visitPredicate, with or without dependencies.
 
static bool hasNode (const SBNodePredicate &selectionPredicate=SBDDataGraphNode::All(), const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false)
 Checks for the presence nodes in the active document based on a selectionPredicate and a visitPredicate, with or without dependencies.
 
static unsigned int countNodes (const std::string &selectionString)
 Counts nodes in the active document based on a selectionString.
 
static unsigned int countNodes (SBDDataGraphNode::Type nodeType, bool selectedNodesOnly=false, const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false)
 Counts nodes in the active document based on a nodeType, a selection status and a visitPredicate, with or without dependencies.
 
static unsigned int countNodes (const SBNodePredicate &selectionPredicate=SBDDataGraphNode::All(), const SBNodePredicate &visitPredicate=SBDDataGraphNode::All(), bool includeDependencies=false)
 Counts nodes in the active document based on a selectionPredicate and a visitPredicate, with or without dependencies.
 

Minimization

static void startMinimization ()
 Starts interactive Minimization.
 
static void stopMinimization ()
 Stops interactive Minimization.
 
static void toggleMinimization ()
 Toggles interactive Minimization on and off.
 
static bool getMinimizationFlag ()
 Returns true when interactive Minimization is on.
 
static void setMinimizationFlag (bool minimizationFlag)
 Sets the interactive Minimization flag.
 
static bool minimize (const SBNodeIndexer &nodeIndexer, unsigned int maximumNumberOfSteps, unsigned int minimumNumberOfStepsInPlateau, const SBQuantity::kJPerMol &energyDifferenceCriteria, unsigned int printMinimizationInformationFrequency=100, bool askUser=false)
 Minimize atoms in the nodeIndexer according to the provided criteria.
 

Simulation

static void startSimulation ()
 Starts interactive simulation.
 
static void stopSimulation ()
 Stops interactive simulation.
 
static void toggleSimulation ()
 Toggles interactive simulation on and off.
 
static bool getSimulationFlag ()
 Returns true when interactive simulation is on.
 
static void setSimulationFlag (bool simulationFlag)
 Sets the interactive simulation flag.
 

Properties

static bool showProperties (SBNode *node)
 Shows the properties widget of a node.
 

Jobs

static SBUUID createJob (const QString &name, const SBCContainerUUID &developerUUID, const SBCContainerUUID &extensionUUID, const QString &description, double fixedCost, double hourlyCost, double storageCost, long estimatedDuration, const QString &endpoint, const QJsonObject &metadata, const QList< QString > &filePathList, const QList< QString > &destinationFilePathList)
 Creates a job named name with fixed cost fixedCost, hourly cost hourlyCost, price currency priceCurrency, estimated duration estimatedDuration, end point endPoint, and meta data metadata; returns the job's UUID.
 

Debugging

static void printMemoryUsage ()
 Prints memory usage.
 
static void printFullMemoryUsage ()
 Prints full memory usage.
 
static void printDataGraphState ()
 Prints the data graph state.
 
static void printRendererState ()
 Prints the renderer state.
 
static void printUndoStack ()
 Prints the undo stack.
 
static void setup ()
 
virtual ~SAMSON ()
 Destructor.
 

Detailed Description

This class is the main interface of SAMSON. It acts as a facade that centralizes and exposes other functions from the SAMSON API to make it easy for developers to interact with SAMSON, the data graph, etc. All functions in this class are static, e.g:

SBPointer<SBDocument> activeDocument = SAMSON::getActiveDocument();
static SBDDocument * getActiveDocument()
Returns a pointer to SAMSON's active document.
Definition: SAMSON.cpp:738

Time

SAMSON may be used to get the current internal time (in ticks)

SBTime currentTime = SAMSON::getTime();
SBCTime SBTime
The short name of SBCTime.
Definition: SBCTimeClock.hpp:128
static SBCTime getTime()
Returns SAMSON's internal time.
Definition: SAMSON.cpp:713

as well as analyze the performance of algorithms using timers. Internally, SAMSON uses a stack of timers, so that calling SAMSON::stopTimer stops the timer that was started last :

SAMSON::startTimer(); // Starts the first timer
... // Do task 1
SAMSON::startTimer(); // Starts the second timer (the first is still running)
... // Do task 2
SBQuantity::second timeTask2(0.0);
SAMSON::stopTimer(timeTask2); // timeTask2 contains the time taken by task 2
SBQuantity::second totalTime(0.0);
SAMSON::stopTimer(totalTime); // totalTime contains the time taken by both tasks
static void startTimer()
Starts a new performance timer.
Definition: SAMSON.cpp:714
static void stopTimer(SBQuantity::second &elapsedTime)
Stops the top performance timer.
Definition: SAMSON.cpp:716
This template class defines physical quantity types.
Definition: SBDQuantityType.hpp:43
See also
getTime
startTimer
stopTimer(SBQuantity::second&)
stopTimer(SBQuantity::second&, SBQuantity::second&)
Units

Directories

A few functions are provided to easily access key file locations from within a SAMSON Extension. For example, the path to the scratch folder, where SAMSON Extensions may write temporary data, may be obtained with:

std::string scratchPath = SAMSON::getScratchPath();
static std::string getScratchPath()
Returns the path to scratch data.
Definition: SAMSON.cpp:711

Furthermore, the SB_ELEMENT_PATH macro provides a std::string containing the installation path of the specific SAMSON Extension whose code is being executed. This may be used for example to access the resources associated to the SAMSON Extension:

return QPixmap(QString::fromStdString(SB_ELEMENT_PATH + "/Resource/icons/logo.png"));
#define SB_ELEMENT_PATH
Provides a std::string containing the path where the SAMSON Extension is installed.
Definition: SAMSON.hpp:686
See also
getSAMSONPath
getSAMSONElementsPath
getUserDataPath
getScratchPath
The SB_ELEMENT_PATH macro

Documents

The SAMSON interface is the main entry point to documents. In particular, the active document is retrieved with:

SBPointer<SBDocument> activeDocument = SAMSON::getActiveDocument();

For example, a new structural model may be added to the active document with:

SAMSON::beginHolding("Add structural model"); // turn the undo system on
SBPointer<SBStructuralModel> newStructuralModel = new SBStructuralModel();
SAMSON::hold(newStructuralModel()); // hold the model in memory
newStructuralModel->create();
SAMSON::getActiveDocument()->addChild(newStructuralModel());
SAMSON::endHolding(); // turn the undo system off
SBMStructuralModel SBStructuralModel
The short name of SBMStructuralModel.
Definition: SBMStructuralModel.hpp:326
static void endHolding()
Ends holding.
Definition: SAMSON.cpp:2141
static void beginHolding(const std::string &name)
Begins holding.
Definition: SAMSON.cpp:2138
static void hold(void *object)
Holds an object.
Definition: SAMSON.cpp:2143
virtual bool addChild(SBNode *node, SBNode *nextNode=nullptr) override
Adds a child to the folder.
Definition: SBDDocumentFolder.cpp:406
See also
getActiveDocument
getActiveCamera
getActiveStructuralModel

Editors

In SAMSON, editors are used to modify the data graph. There is always one (and only one) active editor at any given time. Two functions control the active editor.

See also
Editors
getActiveEditor
setActiveEditor

Picking

When editors, for example, want to select data graph nodes based on the display viewport, they may perform picking operations.

For example, if an editor needs to determine which node was under the mouse cursor when the mouse button was pressed, the getNode(int, int, const SBNodePredicate&) function may be used:

SBNode* pickedNode = SAMSON::getNode(event->pos().x(), event->pos().y());
static SBNode * getNode(int x, int y, const SBNodePredicate &selectionFilter=SBNode::All())
Returns the node at location (x,y) in the viewport according to the selectionFilter.
Definition: SAMSON.cpp:960
This class is the base class to describe a node in the data graph.
Definition: SBDDataGraphNode.hpp:33

Some picking functions are convenience functions that attempt to pick specific node types, e.g. getAtom(int, int) and getBond(int, int).

Furthermore, two functions pick nodes in regions of the viewport, instead of at a specific location (x, y):

Note that picking in SAMSON is performed through rendering. As a result, picking functions cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getAtom(int, int)
getAtom(const QPoint&)
getBond(int, int)
getBond(const QPoint&)
getNode(int, int, const SBNodePredicate&)
getNode(const QPoint&, const SBNodePredicate&)
getNode(int, int, SBPosition3&, const SBNodePredicate&)
getNode(const QPoint&, SBPosition3&, const SBNodePredicate&)
getNodes(SBNodeIndexer&, int, int, int, int, const SBNodePredicate&, bool)
getNodes(SBNodeIndexer&, const QPoint&, int, int, const SBNodePredicate&, bool)
getNodes(SBNodeIndexer&, const SBVector<QPoint>&, const SBNodePredicate&, bool)

Viewport

The SAMSON class is also the main entry point to the viewport, which displays a visual representation of the data graph.

The viewport dimensions may be retrieved with:

static int getViewportWidth()
Returns the viewport width.
Definition: SAMSON.cpp:1317
static int getViewportHeight()
Returns the viewport height.
Definition: SAMSON.cpp:1318

and the mouse position in viewport coordinates can be obtained with:

QPoint mousePosition = SAMSON::getMousePositionInViewport();
static QPoint getMousePositionInViewport()
Returns the current mouse position in viewport coordinates.
Definition: SAMSON.cpp:1321

Typically, editors that allow users to visually interact with the data graph need to convert back and forth between two-dimensional viewport coordinates (integers) and three-dimensional world coordinates (lengths).

For example, the getWorldPositionFromViewportPosition(const QPoint&) function returns a 3D world position that corresponds to a given viewport position:

SBPosition3 worldPosition;
worldPosition = SAMSON::getWorldPositionFromViewportPosition(mousePosition);
static SBPosition3 getWorldPositionFromViewportPosition(double x, double y)
Returns the 3D position that corresponds to the viewport location (x,y)
Definition: SAMSON.cpp:1329

Note that, since a given viewport position actually corresponds to an infinite line of world positions (all positions that would project to the same pixel), functions that return a world position based on a viewport position typically return the point that belongs to the plane containing the camera target. If another plane should be used, then a variant should be used:

worldPosition =
SAMSON::getWorldPositionFromViewportPosition(mousePosition, pointInPlane);

Conversely, projecting a world position in the viewport may be achieved with:

SBVector3 viewportPosition;
viewportPosition = SAMSON::getViewportPositionFromWorldPosition(worldPosition);
static SBVector3 getViewportPositionFromWorldPosition(const SBPosition3 &position)
Returns the projection in the viewport of a given world position.
Definition: SAMSON.cpp:1327

Note that the returned viewport position is a dimensionless physical vector. The first two components are the viewport coordinates with subpixel accuracy, and the third component is the depth in the camera frustum.

See also
getViewportWidth
getViewportHeight
getMousePositionInViewport
getViewportPositionFromWorldPosition
getWorldPositionFromViewportPosition(int, int)
getWorldPositionFromViewportPosition(int, int, const SBPosition3&)
getWorldPositionFromViewportPosition(const QPoint&)
getWorldPositionFromViewportPosition(const QPoint&, const SBPosition3&)

Lights

Developers of SAMSON Extensions who need to develop their own shaders can retrieve the parameters of the lighting model used by SAMSON's internal renderer. In particular, two directional lights are used:

// get parameters of directional light 0
const float* lightDirection0 = SAMSON::getLightDirection(0);
const float* lightColor0 = SAMSON::getLightColor(0);
float lightIntensity0 = SAMSON::getLightIntensity(0);
float lightSpecularIntensity0 = SAMSON::getSpecularIntensity(0);
float lightSpecularPower0 = SAMSON::getSpecularPower(0);
// get parameters of directional light 1
const float* lightDirection1 = SAMSON::getLightDirection(1);
const float* lightColor1 = SAMSON::getLightColor(1);
float lightIntensity1 = SAMSON::getLightIntensity(1);
float lightSpecularIntensity1 = SAMSON::getSpecularIntensity(1);
float lightSpecularPower1 = SAMSON::getSpecularPower(1);
static const float * getLightDirection(unsigned int lightIndex)
Returns the light direction of light lightIndex.
Definition: SAMSON.cpp:1521
static float getLightIntensity(unsigned int lightIndex)
Returns the light intensity of light lightIndex.
Definition: SAMSON.cpp:1527
static float getSpecularPower(unsigned int lightIndex)
Returns the specular power of light lightIndex.
Definition: SAMSON.cpp:1545
static const float * getLightColor(unsigned int lightIndex)
Returns the light color of light lightIndex.
Definition: SAMSON.cpp:1533
static float getSpecularIntensity(unsigned int lightIndex)
Returns the specular intensity of light lightIndex.
Definition: SAMSON.cpp:1539

Global lighting parameters may also be accessed:

float ambientLight = SAMSON::getAmbientLight();
float fresnelPower = SAMSON::getFresnelPower();
float fresnelIntensity = SAMSON::getFresnelIntensity();
const float* fresnelColor = SAMSON::getFresnelColor();
static float getFresnelIntensity()
Returns the Fresnel intensity.
Definition: SAMSON.cpp:1563
static const float * getFresnelColor()
Returns the Fresnel color.
Definition: SAMSON.cpp:1551
static float getFresnelPower()
Returns the Fresnel power.
Definition: SAMSON.cpp:1557
static float getAmbientLight()
Returns the ambient light.
Definition: SAMSON.cpp:1515
See also
Rendering

Version number

The version number of SAMSON may be retrieved from the SAMSON class:

static SBCContainerVersionNumber getVersionNumber()
Returns the version number of SAMSON.
Definition: SAMSON.cpp:1570
This class describes a version number.
Definition: SBCContainerVersionNumber.hpp:14

Please refer to the versioning chapter for more information about the versioning scheme used for SAMSON and SAMSON Extensions.

See also
SBVersionNumber
Versioning

Periodic table

The SAMSON class also exposes functions from the periodic table, which collects periodic table elements:

static SBQuantity::length getCovalentRadius(SBMElement::Type element)
Returns the covalent radius of periodic table element element.
Definition: SAMSON.cpp:838
@ Carbon
The type of the Carbon element.
Definition: SBMElement.hpp:48

Note that convenience functions exist in atoms to access the properties of their element:

SBQuantity::length r = atom->getCovalentRadius();
See also
getElement
getElementVector
getNumberOfElements
getElementName
getElementSymbol
getPeriod
getGroup
getBlock
getAtomicWeight
getCovalentRadius
getVanDerWaalsRadius
getElectronegativity
getElementTypeByName(char*)
getElementTypeByName(const std::string&)
getElementTypeBySymbol(char*)
getElementTypeBySymbol(const std::string&)

GUI

Dialogs and windows

The SAMSON class gives access to the Graphical User Interface (GUI) of SAMSON, and makes it possible for SAMSON Extensions to add SAMSON widgets to the interface:

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
SBGWindow* window = SAMSON::addWidget(myCustomWidget);
static SBGWindow * addWidget(SBGWindowWidget *widget)
Adds a SAMSON widget to the user interface.
Definition: SAMSON.cpp:1598
This class describes a window.
Definition: SBGWindow.hpp:24

The function returns a pointer to the embedding SAMSON window which gives the SAMSON style to the SAMSON widget.

Note that Qt widgets may also be added to the SAMSON GUI (and given the SAMSON style), provided the information normally held in a SAMSON widget is supplied:

// MyCustomWidget derives from QWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
std::string title = "My widget";
QPixmap logo(QString::fromStdString(SB_ELEMENT_PATH + "/Resource/logo.png"));
SBUUID UUID("7EC7B88F-A357-C32A-1FD2-FEE401F6CC61");
SBGWindow* window = SAMSON::addWidget(myCustomWidget, title, format, logo, UUID);
This class describes a universally unique identifier (UUID).
Definition: SBCContainerUUID.hpp:45
WindowOption
Window options.
Definition: SBGWindow.hpp:32
@ Savable
Savable window.
Definition: SBGWindow.hpp:39
@ Lockable
Lockable window.
Definition: SBGWindow.hpp:37

SAMSON dialogs may be added in a similar fashion with the addDialog functions.

See also
addDialog(SBGWindowDialog*)
addDialog(QDialog*, QString, int, QPixmap, SBUUID)
addWidget(SBGWindowWidget*)
addWidget(QWidget*, QString, int, QPixmap, SBUUID)
removeDialog(SBGWindowDialog*)
removeDialog(QDialog*)
removeWidget(SBGWindowWidget*)
removeWidget(QWidget*)
removeWindow(SBGWindow*)

Notifications

The SAMSON class may be used to set the message in the status bar:

SAMSON::setStatusMessage("Operation complete", 0);
static void setStatusMessage(const QString &message, int time=0)
Shows a message in the status bar.
Definition: SAMSON.cpp:1647

as well as inform the user through modal dialogs, either via a simple string:

SAMSON::informUser("Information", "This operation will be applied to all atoms");
static void informUser(const QString &dialogTitle, const QString &dialogText, const QPixmap &logo=QPixmap())
Informs the user with a message in a modal pop-up dialog.
Definition: SAMSON.cpp:1748

or via a SAMSON widget:

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
SAMSON::informUser(myCustomWidget);

When a question should be asked to the user, the askUser function may be used, either with a string:

bool result = SAMSON::askUser("Mutate all", "Do you want to proceed?");
static bool askUser(const QString &dialogTitle, const QString &dialogText, QDialogButtonBox *buttonBox=0, const QPixmap &logo=QPixmap())
Asks a question to the user with a message in a modal pop-up dialog.
Definition: SAMSON.cpp:1800

or with a SAMSON widget:

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
bool result = SAMSON::askUser(myCustomWidget);
See also
setStatusMessage
informUser(const QString&, const QString&)
informUser(SBGWindowWidget*)
askUser(const QString&, const QString&)
askUser(SBGWindowWidget*)

Asking for strings and numbers

Some convenience functions make it easy to request a string or a number from the user:

std::string groupName;
bool result = SAMSON::getStringFromUser("Enter group name", groupName);
static bool getStringFromUser(const QString &dialogTitle, QString &result, const QString &placeholderText="", const QPixmap &logo=QPixmap())
Gets a string from the user in a modal pop-up dialog.
Definition: SAMSON.cpp:1864

where result is true if the user did not cancel the request and actually provided a string.

See also
getDoubleFromUser
getIntegerFromUser
getStringFromUser

Progress bar

When SAMSON Extensions need to lock the user interface for a long period of time, they may communicate the progress made through a progress bar:

SAMSON::showProgressBar("Updating atoms", 0, numberOfAtoms);
for (unsigned int i = 0; i < numberOfAtoms; i++) {
// do something
...
}
static void showProgressBar(const QString &name="", int minimum=0, int maximum=0, const SBQuantity::second &minimumDuration=SBQuantity::second(2.0), bool isCancellable=true, const QString &cancelButtonText="Cancel")
Shows the progress bar
Definition: SAMSON.cpp:1927
static void setProgressBarValue(int value)
Sets the value of the progress bar.
Definition: SAMSON.cpp:1936
static bool isProgressBarStopped()
Returns true when the progress bar is stopped.
Definition: SAMSON.cpp:1950
static void hideProgressBar()
Hides the progress bar.
Definition: SAMSON.cpp:1944
See also
showProgressBar
isProgressBarStopped
setProgressBarValue
hideProgressBar

Undo and redo

SAMSON Extensions may turn the undo and redo mechanism via the SAMSON class:

SBCamera* camera = SAMSON::getActiveCamera(); // get the active camera
SAMSON::beginHolding("Change camera name"); // turn the Undo system on
camera->setName("New camera name"); // change the camera name
SAMSON::endHolding(); // turn the Undo system off
SAMSON::undo(); // undo the name change
static SBDDocumentCamera * getActiveCamera()
Returns a pointer to the active camera.
Definition: SAMSON.cpp:741
static void undo()
Undo one command.
Definition: SAMSON.cpp:2147
virtual void setName(const std::string &name)
Sets the name of the node.
Definition: SBDDataGraphNode.cpp:480
This class describes a camera.
Definition: SBDDocumentCamera.hpp:17
See also
Undo and redo
isHolding
beginHolding
disableHolding
enableHolding
endHolding
hold
undo
redo
isUndoing
isRedoing

Files

SAMSON may be used to import and export files. For example, the instruction:

static void importFromFile(const std::string &fileName, const std::unordered_map< std::string, SBValue > *parameters=nullptr, SBDDocumentFolder *preferredFolder=nullptr, SBIFileImporter *importer=nullptr)
Import a file from the disk.
Definition: SAMSON.cpp:3365

requests SAMSON to look into the importers loaded at startup to see if one of them matches the extension of the file. If this is the case, the file is imported.

See also
importFromFile
exportToFile

Display

Several types of SAMSON classes have virtual display functions that may be overloaded to render objects in the viewport. For example, a visual model has a display function called at each frame by SAMSON's internal renderer. Furthermore, rendering is also used to perform node picking, by rendering unique indices instead of colors (see the chapter about rendering in SAMSON). To perform rendering, SAMSON uses, and requires from developers of SAMSON Extensions to use, core-profile OpenGL functionality. For example, shaders are used to display e.g.atoms, bonds, etc. This implies that legacy OpenGL function calls(e.g. glBegin, glEnd, etc.) are not supported and should not be used in SAMSON Extensions.

Because using core OpenGL functionality is sometimes cumbersome, especially when rendering simple objects, SAMSON provides several utility functions to render geometric primitives in batches, especially when implementing display functions of data graph nodes. For example, the displayTriangles function makes it easy to display triangles in a SAMSON viewport.

Some utility functions also facilitate the use of the renderer to perform node selection. For example, the displayTrianglesSelection makes it easy to render triangles for selection purposes, by passing to SAMSON indices instead of colors.

Please refer to the chapter about rendering in SAMSON for more information, as well as the documentations of the specific display functions listed below.

See also
Rendering
displayCylinders
displayCylindersSelection
displayLines
displayLinesOrtho
displayLineSweptSpheres
displayLineSweptSpheresSelection
displaySpheres
displaySpheresSelection
displayText
displayTextSelection
displayTexturedTriangles
displayTexturedTrianglesOrtho
displayTriangles
displayTrianglesOrtho
displayTrianglesSelection
displayTubes
displayTubesSelection

Introspection

SAMSON Extensions expose their functionality to SAMSON and to other SAMSON Extensions thanks to an introspection mechanism. Exposition is achieved thanks to descriptor files that contain the list of exposed classes and functions, and that are compiled along with the SAMSON Extension. One of the major benefits of the introspection mechanism is the ability to share and combine functionality without the need for providing any type of source code or header code. It is thanks to this introspection mechanism that SAMSON Extensions form more than a collection of independent modules.

The functionality of an exposed class is accessible through its class proxy, which gathers the class factory (its collection of constructors) and the class interface (its collection of member functions).

The class proxy of an exposed class is retrieved using SAMSON:

SBProxy* classProxy = SAMSON::getProxy("SEElementMyApp");
static SBProxy * getProxy(const std::string &className, const SBUUID &elementUUID=SBUUID())
Returns the proxy of a class.
Definition: SAMSON.cpp:2153
This class describes a class proxy.
Definition: SBCClassProxy.hpp:27

In case there is a risk that several SAMSON Extensions might provide a class called SEElementMyApp, it is possible to specify the name and the UUID of the SAMSON Extension:

SBProxy* classProxy = SAMSON::getProxy("SEElementMyApp", "SEElement",
"C8EC88EA-38CE-70F4-2A74-C71F2C86A692");

The SAMSON Extension UUID is guaranteed to be unique if the SAMSON Extension has been installed from SAMSON Connect.

In general, creating instances of exposed classes, and calling their functions, is performed through class proxies.

For exposed classes that derive from some classes from the SDK, SAMSON provides convenience factory functions to create instances.

Assume for example a SAMSON Extension provides a particle interaction model:

class InteractionModel : public class SBMInteractionModelParticleSystem {
InteractionModel(SBMDynamicalModelParticleSystem* dynamicalModel);
~InteractionModel();
...
virtual void updateInteractions();
...
};
This class describes a dynamical particle system.
Definition: SBMDynamicalModelParticleSystem.hpp:19
This class is the base class of particle interaction models.
Definition: SBMInteractionModelParticleSystem.hpp:18

Then, an instance of this class can be created as follows:

SAMSON::makeInteractionModel(dynamicalModel, "InteractionModel");
static SBInteractionModelParticleSystem * makeInteractionModel(SBParticleSystem *dynamicalModel, const std::string &interactionModelClassName, const SBUUID &interactionModelElementUUID=SBUUID())
Makes an interaction model.
Definition: SAMSON.cpp:2173

where dynamicalModel is the argument that would be passed to the constructor of the interaction model.

If only the reimplemented virtual functions of the interaction model should be used (e.g. updateInteractions), then the interactionModel pointer is sufficient, even though interactionModel is a pointer to a SBMInteractionModelParticleSystem and not a pointer to an InteractionModel.

For more information, please refer to the chapter about introspection.

See also
Introspection
makeNeighborSearch
makeStateUpdater
makeVisualModel
makePropertyModel
makeInteractionModel
makeController
makeAnimation
makeSelector

Properties

If a data graph node has an associated property window, it is possible to make it appear with:

bool shown = SAMSON::showProperties(dataGraphNode);
static bool showProperties(SBNode *node)
Shows the properties widget of a node.
Definition: SAMSON.cpp:3299
See also
Data Graph
showProperties

Member Function Documentation

◆ addToSelection()

void SAMSON::addToSelection ( const std::string &  selectionString)
static

This function adds nodes from the active document to the current selection, based on a selectionString formulated in SAMSON's Node Specification Language.

Parameters
selectionStringA Node Specification Language expression string describing the selection.

For example:

SAMSON::addToSelection("node.type residue within 4A of S");
static void addToSelection(const std::string &selectionString)
Adds nodes from the active document to the selection based on a selectionString.
Definition: SAMSON.cpp:2330

Adds to the selection all residue nodes from the active document that are within 4 angstrom of any sulfur atom (note that the selection string may be abbreviated to "n.t r w 4A of S").

See also
Node Specification Language

◆ askUser() [1/4]

bool SAMSON::askUser ( const QString &  dialogTitle,
const QString &  dialogText,
QDialogButtonBox *  buttonBox = 0,
const QPixmap &  logo = QPixmap() 
)
static

This static function asks the user a question with a message in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog. This function exposes the function with the same name in SBGWindowDialog.

bool userReply = SAMSON::askUser("Information", "This operation will be applied to
all atoms in the document. Would you like to continue?");
See also
askUser

◆ askUser() [2/4]

bool SAMSON::askUser ( const QString &  dialogTitle,
const QString &  labelText,
const QString &  text,
bool  monospaceFont = false,
QDialogButtonBox *  buttonBox = 0,
const QPixmap &  logo = QPixmap() 
)
static

This static function asks the user a question with a message in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog. This function exposes the function with the same name in SBGWindowDialog.

bool userReply = SAMSON::askUser("Information", "This operation produced the following warnings. Would you like to continue?", "Log text here");
See also
informUser

◆ askUser() [3/4]

bool SAMSON::askUser ( QWidget *  widget,
QDialogButtonBox *  buttonBox = 0,
const QPixmap &  logo = QPixmap() 
)
static

This static function asks the user a question with a widget in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog. The dialog title and icon are taken from the widget. Note that the OK button and the Cancel button are created by this function, and the widget does not have to contain some. This function exposes the function with the same name in SBGWindowDialog.

// MyCustomWidget derives from QWidget
QWidget* myCustomWidget = new QWidget();
bool userReply = SAMSON::askUser(myCustomWidget);
// do something based on the user reply
...
delete myCustomWidget;
See also
informUser

◆ askUser() [4/4]

bool SAMSON::askUser ( SBGWindowWidget widget,
QDialogButtonBox *  buttonBox = 0,
const QPixmap &  logo = QPixmap() 
)
static

This static function asks the user a question with a widget in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true if the user presses the OK button, or false if the user presses the Cancel button or closes the dialog. The dialog title and icon are taken from the widget. Note that the OK button and the Cancel button are created by this function, and the widget does not have to contain some. This function exposes the function with the same name in SBGWindowDialog.

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
bool userReply = SAMSON::askUser(myCustomWidget);
// do something based on the user reply
...
delete myCustomWidget;
See also
informUser

◆ connectDocumentSignalToSlot()

void SAMSON::connectDocumentSignalToSlot ( SBCReferenceTarget referenceTarget,
void(SBCReferenceTarget::*)(SBDocumentEvent *)  functionPointer,
SBCReferenceTarget nextReferenceTarget = 0,
void(SBCReferenceTarget::*)(SBDocumentEvent *)  nextFunctionPointer = 0 
)
static

This function allows for listening to document events (SBDocumentEvent) e.g. SBDocumentEvent::ActiveDocumentChanged, SBDocumentEvent::DocumentAdded, etc. Let's assume that we want to listen to SBDocumentEvent in an App (SBDApp), then this App needs to have a function that receives a pointer to SBDocumentEvent, e.g.:

void SEMyApp::onDocumentEvent(SBDocumentEvent* event) {
switch (event->getType()) {
// do something
break;
default:
break;
}
}
This class describes a document event.
Definition: SBDDocumentEvent.hpp:15
Type getType() const
Returns the document event type.
Definition: SBDDocumentEvent.cpp:20
@ ActiveDocumentChanged
An active document was changed.
Definition: SBDDocumentEvent.hpp:32

Then in this App we can connect to a document signal as follows:

SAMSON::connectDocumentSignalToSlot(this, SB_SLOT(&SEMyApp::onDocumentEvent));
static void connectDocumentSignalToSlot(SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *), SBCReferenceTarget *nextReferenceTarget=0, void(SBCReferenceTarget::*nextFunctionPointer)(SBDocumentEvent *)=0)
Connects the document signal to a slot.
Definition: SAMSON.cpp:805
See also
documentSignalIsConnectedToSlot
disconnectDocumentSignalFromSlot

◆ countNodes() [1/3]

unsigned int SAMSON::countNodes ( const SBNodePredicate selectionPredicate = SBDDataGraphNode::All(),
const SBNodePredicate visitPredicate = SBDDataGraphNode::All(),
bool  includeDependencies = false 
)
static

This function counts the number of nodes in the active document, based on a selectionPredicate, and other parameters.

Parameters
selectionPredicateA predicate that describes what nodes should be counted in the active document.
visitPredicateA predicate that describes what nodes should be visited in the active document.
includeDependenciesWhether to include node dependencies or not.

This function traverses the active document's sub-tree for which visitPredicate is true (depth-first), and counts the number of nodes for which the selectionPredicate is true. Precisely, if the visitPredicate returns false, the node is not visited, and neither are its descendants. If the visitPredicate returns true, the node is visited, and the visitPredicate will be used to decide whether its children are visited or not. Note that the node itself must satisfy the visitPredicate else nothing is visited.

When includeDependencies is true, the function also counts nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the selectionPredicate and visitPredicate, they are counted if includeDependencies is true.

For example:

unsigned int n = SAMSON::countNodes(SBNode::IsType(SBNode::Residue) && SBResidue::IsTerminal());
static unsigned int countNodes(const std::string &selectionString)
Counts nodes in the active document based on a selectionString.
Definition: SAMSON.cpp:2561
This node predicate compares the node type with a given type.
Definition: SBDDataGraphNode.hpp:512
@ Residue
Residue.
Definition: SBDDataGraphNode.hpp:79

counts all terminal residue nodes in the active document.

Note that the nodeIndexer is not cleared when entering this function.

See also
SBNode::getNodes
SBNodeIndexer
SBNodePredicate

◆ countNodes() [2/3]

unsigned int SAMSON::countNodes ( const std::string &  selectionString)
static

This function returns the number of nodes from the active document, based on a selectionString formulated in SAMSON's Node Specification Language.

Parameters
selectionStringA Node Specification Language expression string describing the selection.

For example:

unsigned int n = SAMSON::countNodes("node.type residue within 4A of S");

counts the number of all residue nodes in the active document that are within 4 angstrom of any sulfur atom (note that the selection string may be abbreviated to "n.t r w 4A of S").

See also
Node Specification Language

◆ countNodes() [3/3]

unsigned int SAMSON::countNodes ( SBDDataGraphNode::Type  nodeType,
bool  selectedNodesOnly = false,
const SBNodePredicate visitPredicate = SBDDataGraphNode::All(),
bool  includeDependencies = false 
)
static

This function returns the number of nodes in the active document, based on a nodeType, and other parameters.

Parameters
nodeTypeA type of nodes (SBNode::Type) that should be counted.
selectedNodesOnlyIf set to true, then only nodes that are selected, directly or via their parents, will be traversed.
visitPredicateA predicate that describes what nodes should be visited in the active document.
includeDependenciesWhether to include node dependencies or not.

This function traverses the active document's sub-tree for which visitPredicate is true (depth-first), and counts the number of nodes whose type is nodeType. Precisely, if the visitPredicate returns false, the node is not visited, and neither are its descendants. If the visitPredicate returns true, the node is visited, and the visitPredicate will be used to decide whether its children are visited or not. Note that the node itself must satisfy the visitPredicate else nothing is visited.

When includeDependencies is true, the function also counts nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the nodeType, selectedNodesOnly, and visitPredicate, they are counted if includeDependencies is true.

For example:

counts the number of residue nodes in the active document.

See also
SBNode::getNodes
SBNodeIndexer
SBNodePredicate

◆ createHeadsetViewport()

QOpenGLContext * SAMSON::createHeadsetViewport ( )
static

This function creates a viewport for a virtual reality headset.

◆ createJob()

SBUUID SAMSON::createJob ( const QString &  name,
const SBCContainerUUID developerUUID,
const SBCContainerUUID extensionUUID,
const QString &  description,
double  fixedCost,
double  hourlyCost,
double  storageCost,
long  estimatedDuration,
const QString &  endpoint,
const QJsonObject &  metadata,
const QList< QString > &  filePathList,
const QList< QString > &  destinationFilePathList 
)
static

This function returns the credits that the user has on his or her account. The function returns -1 if the service could not be contacted.

◆ displayCylinders()

void SAMSON::displayCylinders ( unsigned int  nCylinders,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const float *  radiusData,
const unsigned int *  capData,
const float *  colorData,
const unsigned int *  flagData,
bool  shadowPassFlag = false,
bool  transparency = false,
float  opacity = 1.0f 
)
static
Parameters
nCylindersThe number of cylinders
nPositionsThe number of positions used to describe cylinders
indexDataThe array of indices of positions (two unsigned ints per cylinder)
positionDataThe array of positions (three floats per position)
radiusDataThe array of radii (one float per position)
capDataThe array of capping flags (one unsigned int per position)
colorDataThe array of colors (four floats per position)
flagDataThe array of flags (one unsigned int per position)
shadowPassFlagA boolean to signal a shadow pass
transparencyA boolean to enable/disable the transparency
opacityA float to specify the opacity

This function displays cylinders in the viewport thanks to ray-tracing shaders that avoid the use of triangles. For increased efficiency, cylinders are described by providing an array of vertex positions and an array of pairs of indices of vertices. As a result, the number of vertex positions passed to the graphics hardware is often much smaller than twice the number of cylinders. Furthermore, all passed properties are vertex-based and not cylinder-based, and properties are interpolated along the cylinder. For example, if a cylinder connects two vertices which have different associated radii, then the shader renders a cone. Similarly, if the two vertices have different colors, then the cylinder color is a gradient that interpolates the two colors. Each vertex has the following properties:

  • a position: three floats with units of length
  • a radius: one float with units of length
  • a capping flag: one unsigned int which determines if the cylinder is capped at the vertex (0 for no capping)
  • a color: four floats between 0 and 1 (the red, green, blue and alpha channels)
  • a flag: one unsigned int representing a node flag. The flag applied to each cylinder is the flag of its first vertex.

In a display overridden function, this code snippet produces this 3D shape:

The 3D shape produced by the example code
void display(SBNode::RenderingPass renderingPass) {
unsigned int nCylinders = 12;
unsigned int nPositions = 9;
std::vector<unsigned int> indexData;
std::vector<float> positionData;
std::vector<float> radiusData;
std::vector<unsigned int> capData;
std::vector<float> colorData;
std::vector<unsigned int> flagData;
// center of star
positionData.push_back(5.f); positionData.push_back(0.f); positionData.push_back(0.f);
radiusData.push_back(4.f);
// inside points
positionData.push_back(0.f); positionData.push_back(10.f); positionData.push_back(10.f);
radiusData.push_back(2.f);
positionData.push_back(0.f); positionData.push_back(10.f); positionData.push_back(-10.f);
radiusData.push_back(2.f);
positionData.push_back(0.f); positionData.push_back(-10.f); positionData.push_back(-10.f);
radiusData.push_back(2.f);
positionData.push_back(0.f); positionData.push_back(-10.f); positionData.push_back(10.f);
radiusData.push_back(2.f);
//outside points
positionData.push_back(0.f); positionData.push_back(0.f); positionData.push_back(40.f);
radiusData.push_back(1.f);
positionData.push_back(0.f); positionData.push_back(40.f); positionData.push_back(0.f);
radiusData.push_back(1.f);
positionData.push_back(0.f); positionData.push_back(0.f); positionData.push_back(-40.f);
radiusData.push_back(1.f);
positionData.push_back(0.f); positionData.push_back(-40.f); positionData.push_back(0.f);
radiusData.push_back(1.f);
// for each triangles, gives the index of the three points involved
indexData.push_back(1); indexData.push_back(0);
indexData.push_back(2); indexData.push_back(0);
indexData.push_back(3); indexData.push_back(0);
indexData.push_back(4); indexData.push_back(0);
indexData.push_back(1); indexData.push_back(5);
indexData.push_back(1); indexData.push_back(6);
indexData.push_back(2); indexData.push_back(6);
indexData.push_back(2); indexData.push_back(7);
indexData.push_back(3); indexData.push_back(7);
indexData.push_back(3); indexData.push_back(8);
indexData.push_back(4); indexData.push_back(8);
indexData.push_back(4); indexData.push_back(5);
for (unsigned int i = 0; i < 9; i++) {
flagData.push_back(0); // replace by 1 for selected, 2 for highlighted
}
for (unsigned int i = 0; i < 9; i++) {
capData.push_back(1);
}
for (unsigned int i = 0; i < 5; i++) {
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f);
}
colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(0.f); colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(0.f); colorData.push_back(0.f); colorData.push_back(1.f); colorData.push_back(1.f);
// Checks that the sizes of data correspond to the expected ones
assert(indexData.size() == 2 * nCylinders);
assert(positionData.size() == 3 * nPositions);
assert(capData.size() == nPositions);
assert(colorData.size() == 4 * nPositions);
assert(radiusData.size() == nPositions);
if (renderingPass == SBNode::RenderingPass::OpaqueGeometry) {
SAMSON::displayCylinders(nCylinders, nPositions, indexData.data(), positionData.data(), radiusData.data(), capData.data(), colorData.data(), flagData.data());
}
SAMSON::displayCylinders(nCylinders, nPositions, indexData.data(), positionData.data(), radiusData.data(), capData.data(), nullptr, flagData.data(), true);
}
}
static void displayCylinders(unsigned int nCylinders, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *capData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
Displays cylinders.
Definition: SAMSON.cpp:3506
RenderingPass
The rendering pass.
Definition: SBDDataGraphNode.hpp:193
@ ShadowingGeometry
The pass where shadowing geometry is rendered.
@ OpaqueGeometry
The pass where opaque geometry is rendered.
See also
Rendering

◆ displayCylindersSelection()

void SAMSON::displayCylindersSelection ( unsigned int  nCylinders,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const float *  radiusData,
const unsigned int *  capData,
const unsigned int *  nodeIndexData 
)
static
Parameters
nCylindersThe number of cylinders
nPositionsThe number of positions used to describe cylinders
indexDataThe array of indices of positions (two unsigned ints per cylinder)
positionDataThe array of positions (three floats per position)
radiusDataThe array of radii (one float per position)
capDataThe array of capping flags (one unsigned int per position)
nodeIndexDataThe address of the object associated with each position (one unsigned int per position, the cylinder has the index associated with its first vertex)

This functions allows to select cylinders based on their position in the viewport

◆ displayLines()

void SAMSON::displayLines ( unsigned int  nLines,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const float *  colorData,
const unsigned int *  flagData,
bool  shadowPassFlag = false,
bool  transparency = false,
float  opacity = 1.0f 
)
static
Parameters
nLinesThe number of lines
nPositionsThe number of positions used to describe lines
indexDataThe array of indices of positions (two unsigned ints per line)
positionDataThe array of positions (three floats per position)
colorDataThe array of colors (four floats per position)
flagDataThe array of flags (one unsigned int per position)
shadowPassFlagA boolean to signal a shadow pass
transparencyA boolean to enable/disable the transparency
opacityA float to specify the opacity

This function displays lines in the viewport. For increased efficiency, lines are described by providing an array of vertex positions and an array of pairs of indices of vertices. As a result, the number of vertex positions passed to the graphics hardware is often much smaller than twice the number of lines. Furthermore, all passed properties are vertex-based and not line-based, and properties are interpolated along the cylinder. For example, if a line connects two vertices which have different colors, then the line color is a gradient that interpolates the two colors. Each vertex has the following properties:

  • a position: three floats with units of length
  • a color: four floats between 0 and 1 (the red, green, blue and alpha channels)
  • a flag: one unsigned int representing a node flag. The flag applied to each line is the flag of its first vertex.

In a display overridden function, this code snippet produces this 3D shape:

The 3D shape produced by the example code
void display(SBNode::RenderingPass renderingPass) {
unsigned int nLines = 12;
unsigned int nPositions = 9;
std::vector<unsigned int> indexData;
std::vector<float> positionData;
std::vector<float> colorData;
std::vector<unsigned int> flagData;
// center of star
positionData.push_back(5.f); positionData.push_back(0.f); positionData.push_back(0.f);
// inside points
positionData.push_back(0.f); positionData.push_back(10.f); positionData.push_back(10.f);
positionData.push_back(0.f); positionData.push_back(10.f); positionData.push_back(-10.f);
positionData.push_back(0.f); positionData.push_back(-10.f); positionData.push_back(-10.f);
positionData.push_back(0.f); positionData.push_back(-10.f); positionData.push_back(10.f);
//outside points
positionData.push_back(0.f); positionData.push_back(0.f); positionData.push_back(40.f);
positionData.push_back(0.f); positionData.push_back(40.f); positionData.push_back(0.f);
positionData.push_back(0.f); positionData.push_back(0.f); positionData.push_back(-40.f);
positionData.push_back(0.f); positionData.push_back(-40.f); positionData.push_back(0.f);
// for each triangles, gives the index of the three points involved
indexData.push_back(1); indexData.push_back(0);
indexData.push_back(2); indexData.push_back(0);
indexData.push_back(3); indexData.push_back(0);
indexData.push_back(4); indexData.push_back(0);
indexData.push_back(1); indexData.push_back(5);
indexData.push_back(1); indexData.push_back(6);
indexData.push_back(2); indexData.push_back(6);
indexData.push_back(2); indexData.push_back(7);
indexData.push_back(3); indexData.push_back(7);
indexData.push_back(3); indexData.push_back(8);
indexData.push_back(4); indexData.push_back(8);
indexData.push_back(4); indexData.push_back(5);
for (unsigned int i = 0; i < 9; i++) {
flagData.push_back(0); // replace by 1 for selected, 2 for highlighted
}
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f);
for (unsigned int i = 0; i < 4; i++) {
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f);
}
colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(0.f); colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(0.f); colorData.push_back(0.f); colorData.push_back(1.f); colorData.push_back(1.f);
// Checks that the sizes of data correspond to the expected ones
assert(indexData.size() == 2 * nLines);
assert(positionData.size() == 3 * nPositions);
assert(colorData.size() == 4 * nPositions);
if (renderingPass == SBNode::RenderingPass::OpaqueGeometry) {
SAMSON::displayLines(nLines, nPositions, indexData.data(), positionData.data(),colorData.data(), flagData.data());
}
SAMSON::displayLines(nLines, nPositions, indexData.data(), positionData.data(), nullptr, flagData.data(), true);
}
}
static void displayLines(unsigned int nLines, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, float opacity=1.0f)
Displays 3D lines.
Definition: SAMSON.cpp:3626
See also
Rendering

◆ displayLinesSelection()

void SAMSON::displayLinesSelection ( unsigned int  nLines,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const unsigned int *  nodeIndexData 
)
static
Parameters
nLinesThe number of lines
nPositionsThe number of positions used to describe lines
indexDataThe array of indices of positions (two unsigned ints per lines)
positionDataThe array of positions (three floats per position)
nodeIndexDataThe address of the object associated with each position (one unsigned int per position, the line has the index associated with its first vertex)

This functions allows to select lines based on their position in the viewport

◆ displayLineSweptSpheres()

void SAMSON::displayLineSweptSpheres ( unsigned int  nCylinders,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const float *  radiusData,
const float *  colorData,
unsigned int *  flagData,
bool  shadowPassFlag = false,
bool  transparency = false,
float  opacity = 1.0f 
)
static
Parameters
nCylindersThe number of cylinders
nPositionsThe number of positions used to describe cylinders
indexDataThe array of indices of positions (two unsigned ints per cylinder)
positionDataThe array of positions (three floats per position)
radiusDataThe array of radii (one float per position)
colorDataThe array of colors (four floats per position)
flagDataThe array of flags (one unsigned int per position)
shadowPassFlagA boolean to signal a shadow pass
transparencyA boolean to enable/disable the transparency
opacityA float to specify the opacity

Similar to displayCylinders ''displayCylinders'', with spherical caps. This function displays cylinders in the viewport thanks to ray-tracing shaders that avoid the use of triangles. For increased efficiency, cylinders are described by providing an array of vertex positions and an array of pairs of indices of vertices. As a result, the number of vertex positions passed to the graphics hardware is often much smaller than twice the number of cylinders. Furthermore, all passed properties are vertex-based and not cylinder-based, and properties are interpolated along the cylinder. For example, if a cylinder connects two vertices which have different associated radii, then the shader renders a cone. Similarly, if the two vertices have different colors, then the cylinder color is a gradient that interpolates the two colors. Each vertex has the following properties:

  • a position: three floats with units of length
  • a radius: one float with units of length
  • a color: four floats between 0 and 1 (the red, green, blue and alpha channels)
  • a flag: one unsigned int representing a node flag. The flag applied to each cylinder is the flag of its first vertex.

◆ displayLineSweptSpheresSelection()

void SAMSON::displayLineSweptSpheresSelection ( unsigned int  nCylinders,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const float *  radiusData,
const unsigned int *  nodeIndexData 
)
static
Parameters
nCylindersThe number of cylinders
nPositionsThe number of positions used to describe cylinders
indexDataThe array of indices of positions (two unsigned ints per cylinder)
positionDataThe array of positions (three floats per position)
radiusDataThe array of radii (one float per position)
nodeIndexDataThe address of the object associated with each position (one unsigned int per position, the cylinder has the index associated with its first vertex)

This functions allows to select cylinders with spherical caps, based on their position in the viewport

◆ displaySpheres()

void SAMSON::displaySpheres ( unsigned int  nSpheres,
const float *  positionData,
const float *  radiusData,
const float *  colorData,
const unsigned int *  flagData,
bool  shadowPassFlag = false,
bool  transparency = false,
float  opacity = 1.0f 
)
static
Parameters
nSpheresThe number of spheres
positionDataThe array of positions (three floats per sphere)
radiusDataThe array of radii (one float per sphere)
colorDataThe array of colors (four floats per sphere)
flagDataThe array of flags (one unsigned int per sphere)
shadowPassFlagA boolean to signal a shadow pass
transparencyA boolean to enable/disable the transparency
opacityA float to specify the opacity

This function displays spheres in the viewport thanks to ray-tracing shaders that avoid the use of triangles. Each sphere has the following properties:

  • a position: three floats with units of length
  • a radius: one float with units of length
  • a color: four floats between 0 and 1 (the red, green, blue and alpha channels)
  • a flag: one unsigned int representing a node flag.

◆ displaySpheresSelection()

void SAMSON::displaySpheresSelection ( unsigned int  nSpheres,
const float *  positionData,
const float *  radiusData,
const unsigned int *  nodeIndexData 
)
static
Parameters
nSpheresThe number of spheres
positionDataThe array of positions (three floats per sphere)
radiusDataThe array of radii (one float per sphere)
nodeIndexDataThe address of the object associated with each sphere (one unsigned int per sphere)

This functions allows to select spheres, based on their position in the viewport

◆ displayTriangles()

void SAMSON::displayTriangles ( unsigned int  nTriangles,
unsigned int  nPositions,
const unsigned int *  indexData,
const float *  positionData,
const float *  normalData,
const float *  colorData,
const unsigned int *  flagData,
bool  shadowPassFlag = false,
bool  transparency = false,
const SBSpatialTransform transform = SBSpatialTransform::identity,
const SBColor diffuseColor = SBColor::black,
float  diffuseColorReplacement = 0.0f,
float  opacity = 1.0f,
unsigned int  flagModifier = 0 
)
static

This function displays triangles in the SAMSON viewport.

Parameters
nTrianglesThe number of triangles
nPositionsThe number of positions used to describe triangles
indexDataThe array of indices of positions (three unsigned ints per triangle)
positionDataThe array of positions (three floats per position)
normalDataThe array of the normal vector at each position (three floats per position)
colorDataThe array of colors (four floats between 0 and 1 per position, rgba)
flagDataThe array of flags (one unsigned int per position)
  • the first bit corresponds to selection
  • the second bit correspond to highlight
  • the third bit correspond to fixed The flag applied to each triangle is the flag of its first vertex.
shadowPassFlagA boolean to signal a shadow pass
transparencyA boolean to enable/disable the transparency
transformSpatial transform applied to all positions before display
diffuseColor
diffuseColorReplacement
opacity
flagModifier

This function displays triangles in the viewport. For increased efficiency, triangles are described by providing an array of vertex positions and an array of triplets of indices of vertices. As a result, the number of vertex positions passed to the graphics hardware is often much smaller than three times the number of triangles. Furthermore, all passed properties are vertex-based and not triangle-based, and properties are interpolated along the triangle. For example, if a triangle connects three vertices which have different associated colors, then the triangle color is a gradient that interpolates the three colors. It should also be used to cast shadows. In a display overridden function, this code snippet produces this 3D shape:

The 3D shape produced by the example code
void display(SBNode::RenderingPass renderingPass) {
unsigned int nTriangles = 8;
unsigned int nPositions = 9;
std::vector<unsigned int> indexData;
std::vector<float> positionData;
std::vector<float> normalData;
std::vector<float> colorData;
std::vector<unsigned int> flagData;
// center of star
positionData.push_back(5.f); positionData.push_back(0.f); positionData.push_back(0.f);
// inside points
positionData.push_back(0.f); positionData.push_back(10.f); positionData.push_back(10.f);
positionData.push_back(0.f); positionData.push_back(10.f); positionData.push_back(-10.f);
positionData.push_back(0.f); positionData.push_back(-10.f); positionData.push_back(-10.f);
positionData.push_back(0.f); positionData.push_back(-10.f); positionData.push_back(10.f);
//outside points
positionData.push_back(0.f); positionData.push_back(0.f); positionData.push_back(40.f);
positionData.push_back(0.f); positionData.push_back(40.f); positionData.push_back(0.f);
positionData.push_back(0.f); positionData.push_back(0.f); positionData.push_back(-40.f);
positionData.push_back(0.f); positionData.push_back(-40.f); positionData.push_back(0.f);
// for each triangles, gives the index of the three points involved
indexData.push_back(0); indexData.push_back(1); indexData.push_back(5);
indexData.push_back(0); indexData.push_back(1); indexData.push_back(6);
indexData.push_back(0); indexData.push_back(2); indexData.push_back(6);
indexData.push_back(0); indexData.push_back(2); indexData.push_back(7);
indexData.push_back(0); indexData.push_back(3); indexData.push_back(7);
indexData.push_back(0); indexData.push_back(3); indexData.push_back(8);
indexData.push_back(0); indexData.push_back(4); indexData.push_back(8);
indexData.push_back(0); indexData.push_back(4); indexData.push_back(5);
for (unsigned int i = 0; i < 8; i++) {
flagData.push_back(0); // replace by 1 for selected, 2 for highlighted
}
for (unsigned int i = 0; i < 5; i++) {
normalData.push_back(1.f); normalData.push_back(0.f); normalData.push_back(0.f);
}
normalData.push_back(0.8f); normalData.push_back(0.f); normalData.push_back(0.6f);
normalData.push_back(0.8f); normalData.push_back(0.6f); normalData.push_back(0.f);
normalData.push_back(0.8f); normalData.push_back(0.f); normalData.push_back(-0.6f);
normalData.push_back(0.8f); normalData.push_back(-0.6f); normalData.push_back(0.f);
for (unsigned int i = 0; i < 5; i++) {
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(1.f);
}
colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(1.f); colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(0.f); colorData.push_back(1.f); colorData.push_back(0.f); colorData.push_back(1.f);
colorData.push_back(0.f); colorData.push_back(0.f); colorData.push_back(1.f); colorData.push_back(1.f);
// Checks that the sizes of data correspond to the expected ones
assert(indexData.size() == 3 * nTriangles);
assert(positionData.size() == 3 * nPositions);
assert(normalData.size() == 3 * nPositions);
assert(colorData.size() == 4 * nPositions);
assert(flagData.size() == nPositions);
if (renderingPass == SBNode::RenderingPass::OpaqueGeometry) {
SAMSON::displayTriangles(nTriangles, nPositions, indexData.data(), positionData.data(), normalData.data(), colorData.data(), flagData.data());
}
SAMSON::displayTriangles(nTriangles, nPositions, indexData.data(), positionData.data(), nullptr, nullptr, nullptr, true);
}
}
static void displayTriangles(unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *normalData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, const SBSpatialTransform &transform=SBSpatialTransform::identity, const SBColor &diffuseColor=SBColor::black, float diffuseColorReplacement=0.0f, float opacity=1.0f, unsigned int flagModifier=0)
Displays 3D triangles.
Definition: SAMSON.cpp:3902

◆ getActiveSelectionFilter()

const SBNodePredicate & SAMSON::getActiveSelectionFilter ( )
static

Returns a pointer to a node predicate corresponding to the active selection filter. The node predicate is still owned by SAMSON and will be destroyed by SAMSON once the selection filter is changed. So, depending on the use, you might need to clone it.

◆ getActiveSelectionFilterName()

std::string SAMSON::getActiveSelectionFilterName ( )
static

Returns the active selection filter name. The selection filter governs the selection level in the Viewport done by the default select editor.

◆ getActiveSelectionFilterNSL()

std::string SAMSON::getActiveSelectionFilterNSL ( )
static

Returns the Node Specification Language expression string corresponding to the active selection filter. The selection filter governs the selection level in the Viewport done by the default select editor.

◆ getAtom() [1/2]

SBAtom * SAMSON::getAtom ( const QPoint &  position)
static
Parameters
positionThe viewport coordinates of the picking location

This function returns the atom displayed at a given position in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which atom was under the mouse cursor when the mouse button was pressed:

SBAtom* pickedAtom = SAMSON::getAtom(event->pos());
static SBAtom * getAtom(int x, int y)
Returns the atom at location (x,y) in the viewport.
Definition: SAMSON.cpp:1241
This class describes an atom in a structural model.
Definition: SBMStructuralModelNodeAtom.hpp:34

If no atom is present at the specified position, the function returns 0.

This function is a convenience function that calls getNode(const QPoint&, const SBNodePredicate&) and checks whether the picked node, if any, is an atom. If it is the case, the function returns a pointer to the picked atom. If a node of another type (e.g. a bond) is present at the specified position, the function returns 0. If picking should be able to return any type of node, the function getNode(const QPoint&, const SBNodePredicate&) should be used instead.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(const QPoint&)

◆ getAtom() [2/2]

SBAtom * SAMSON::getAtom ( int  x,
int  y 
)
static
Parameters
xThe first viewport coordinate of the picking location
yThe second viewport coordinate of the picking location

This function returns the atom displayed at coordinates x and y in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which atom was under the mouse cursor when the mouse button was pressed:

SBAtom* pickedAtom = SAMSON::getAtom(event->pos().x(), event->pos().y());

If no atom is present at coordinates x and y, the function returns 0.

This function is a convenience function that calls getNode(int, int, const SBNodePredicate&) and checks whether the picked node, if any, is an atom. If it is the case, the function returns a pointer to the picked atom. If a node of another type (e.g. a bond) is present at coordinates x and y, the function returns 0. If picking should be able to return any type of node, the function getNode(int, int, const SBNodePredicate&) should be used instead.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(int, int)

◆ getBond() [1/2]

SBBond * SAMSON::getBond ( const QPoint &  position)
static
Parameters
positionThe viewport coordinates of the picking location

This function returns the bond displayed at a given position in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which bond was under the mouse cursor when the mouse button was pressed:

SBBond* pickedBond = SAMSON::getBond(event->pos());
static SBBond * getBond(int x, int y)
Returns the bond at location (x,y) in the viewport.
Definition: SAMSON.cpp:1290
This class describes a bond in a structural model.
Definition: SBMStructuralModelNodeBond.hpp:20

If no bond is present at the specified position, the function returns 0.

This function is a convenience function that calls getNode(const QPoint&, const SBNodePredicate&) and checks whether the picked node, if any, is a bond. If it is the case, the function returns a pointer to the picked bond. If a node of another type (e.g. an atom) is present at the specified position, the function returns 0. If picking should be able to return any type of node, the function getNode(const QPoint&, const SBNodePredicate&) should be used instead.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(const QPoint&)

◆ getBond() [2/2]

SBBond * SAMSON::getBond ( int  x,
int  y 
)
static
Parameters
xThe first viewport coordinate of the picking location
yThe second viewport coordinate of the picking location

This function returns the bond displayed at coordinates x and y in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which bond was under the mouse cursor when the mouse button was pressed:

SBBond* pickedBond = SAMSON::getBond(event->pos().x(), event->pos().y());

If no bond is present at coordinates x and y, the function returns 0.

This function is a convenience function that calls getNode(int, int, const SBNodePredicate&) and checks whether the picked node, if any, is a bond. If it is the case, the function returns a pointer to the picked bond. If a node of another type (e.g. an atom) is present at coordinates x and y, the function returns 0. If picking should be able to return any type of node, the function getNode(int, int, const SBNodePredicate&) should be used instead.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(int, int)

◆ getChoiceFromUser()

bool SAMSON::getChoiceFromUser ( const QString &  dialogTitle,
int &  resultIndex,
const QString &  label,
const QStringList &  choices,
const QStringList &  toolTips,
const QList< QPixmap > &  icons,
const QPixmap &  logo = QPixmap() 
)
static

Gets a color from the user in a modal pop-up dialog.

◆ getColorbar()

QPixmap SAMSON::getColorbar ( const SBDPalette palette,
unsigned int  width,
unsigned int  height,
unsigned int  nColors = 10,
bool  isHorizontal = true 
)
static

This static function return a pixmap with a colorbar for the given color palette palette with the size width x height and the number of colors nColors. The direction of the colorbar is governed by isHorizontal: true - horizontal, false - vertical

◆ getMinimizationFlag()

bool SAMSON::getMinimizationFlag ( )
static

This function returns true when interactive minimization is on. When interactive minimization is started, all active simulators in the active document periodically perform a time step.

See also
startMinimization
stopMinimization
toggleMinimization
setMinimizationFlag

◆ getNextNodeName()

std::string SAMSON::getNextNodeName ( SBNode::Type  type,
std::string  prefix = std::string(),
std::string  suffix = std::string(),
SBNode parentNode = nullptr 
)
static

This function checks the parent node parentNode or the active document if parentNode is NULL for all the nodes of type type with names starting with the prefix prefix (with an additional space after the prefix) and returns the next consecutive name. If the prefix is empty then the human-readable name of the node type type is used as the prefix.

For example, this function can be used to get a placeholder name for a newly added visual model. Let's say the active document has several visual models called as follows: 'Visual model 1', 'Ribbons 1', 'Visual model 3'. Then calling this function:

static std::string getNextNodeName(SBNode::Type type, std::string prefix=std::string(), std::string suffix=std::string(), SBNode *parentNode=nullptr)
Returns a next name starting with prefix prefix and suffix suffix for nodes of type type in parent no...
Definition: SAMSON.cpp:773
@ VisualModel
Visual model.
Definition: SBDDataGraphNode.hpp:98

should return 'Visual model 4'. And calling:

std::string newName = SAMSON::getNextNodeName(SBNode::VisualModel, "Ribbons");

should return 'Ribbons 2'.

◆ getNode() [1/4]

SBNode * SAMSON::getNode ( const QPoint &  position,
const SBNodePredicate selectionFilter = SBNode::All() 
)
static
Parameters
positionThe viewport coordinates of the picking location
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()

This function returns the node displayed at a given position in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which node was under the mouse cursor when the mouse button was pressed:

SBNode* node = SAMSON::getNode(event->pos());

If no node is present at the specified position, the function returns 0.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(const QPoint&, SBPosition3&)

◆ getNode() [2/4]

SBNode * SAMSON::getNode ( const QPoint &  position,
SBPosition3 pickedPosition,
const SBNodePredicate selectionFilter = SBNode::All() 
)
static
Parameters
positionThe viewport coordinates of the picking location
pickedPositionReturns the 3D coordinates of the picked point
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()

This function returns the node displayed at a given position in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which node was under the mouse cursor when the mouse button was pressed:

SBPosition3 pickedPosition;
SBNode* node = SAMSON::getNode(event->pos(), pickedPosition);

If no node is present at coordinates x and y, the function returns 0.

When the function returns, and if node is not 0, pickedPosition contains the 3D coordinates of the picked point.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(const QPoint&)

◆ getNode() [3/4]

SBNode * SAMSON::getNode ( int  x,
int  y,
const SBNodePredicate selectionFilter = SBNode::All() 
)
static
Parameters
xThe first viewport coordinate of the picking location
yThe second viewport coordinate of the picking location
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()

This function returns the node displayed at coordinates x and y in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which node was under the mouse cursor when the mouse button was pressed:

SBNode* node = SAMSON::getNode(event->pos().x(), event->pos().y());

If no node is present at coordinates x and y, the function returns 0.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(int, int, SBPosition3&)

◆ getNode() [4/4]

SBNode * SAMSON::getNode ( int  x,
int  y,
SBPosition3 pickedPosition,
const SBNodePredicate selectionFilter = SBNode::All() 
)
static
Parameters
xThe first viewport coordinate of the picking location
yThe second viewport coordinate of the picking location
pickedPositionReturns the 3D coordinates of the picked point
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()

This function returns the node displayed at coordinates x and y in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which node was under the mouse cursor when the mouse button was pressed:

SBPosition3 pickedPosition;
SBNode* node = SAMSON::getNode(event->pos().x(), event->pos().y(), pickedPosition);

If no node is present at coordinates x and y, the function returns 0.

When the function returns, and if node is not 0, pickedPosition contains the 3D coordinates of the picked point.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(int, int)

◆ getNodes() [1/6]

void SAMSON::getNodes ( SBNodeIndexer nodeIndexer,
const QPoint &  topLeftCorner,
int  width,
int  height,
const SBNodePredicate selectionFilter = SBNode::All(),
bool  deepSelectionFlag = false 
)
static
Parameters
nodeIndexerThe indexer which stores picked nodes
topLeftCornerThe viewport coordinates of the top left corner of the picking rectangle
widthThe width of the picking rectangle
heightThe height of the picking rectangle
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()
deepSelectionFlagWhether to select nodes hidden by other nodes as well; by default, this is set to false

This function returns the nodes displayed in the viewport rectangle (x,y,width,height). It is typically used by editors when reacting to mouse events:

SBNodeIndexer nodeIndexer;
SAMSON::getNodes(nodeIndexer, topLeftCorner, width, height);
static void getNodes(SBNodeIndexer &nodeIndexer, int x, int y, int width, int height, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false)
Stores the nodes found inside the viewport rectangle (x,y,width,height) into nodeIndexer according to...
Definition: SAMSON.cpp:1052
This class describes a node indexer.
Definition: SBDDataGraphNodeIndexer.hpp:21

Picked nodes are appended to the vector nodeVector.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(SBNodeIndexer&, int, int, int, int)
getDeepSelectionFlag()

◆ getNodes() [2/6]

void SAMSON::getNodes ( SBNodeIndexer nodeIndexer,
const SBNodePredicate selectionPredicate = SBDDataGraphNode::All(),
const SBNodePredicate visitPredicate = SBDDataGraphNode::All(),
bool  includeDependencies = false 
)
static

This function fills the nodeIndexer passed in reference with nodes from the active document, based on a selectionPredicate, and other parameters.

Parameters
nodeIndexerThe node indexer into which the nodes should be added.
selectionPredicateA predicate that describes what nodes should be selected from the active document.
visitPredicateA predicate that describes what nodes should be visited in the active document.
includeDependenciesWhether to include node dependencies or not.

This function traverses the active document's sub-tree for which visitPredicate is true (depth-first), and stores in nodeIndexer the nodes for which the selectionPredicate is true. Precisely, if the visitPredicate returns false, the node is not visited, and neither are its descendants. If the visitPredicate returns true, the node is visited, and the visitPredicate will be used to decide whether its children are visited or not. Note that the node itself must satisfy the visitPredicate else nothing is visited.

When includeDependencies is true, the function also adds to nodeIndexer nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the selectionPredicate and visitPredicate, they are added to the nodeIndexer if includeDependencies is true.

For example:

SBNodeIndexer nodeIndexer;
SAMSON::getNodes(nodeIndexer, SBNode::IsType(SBNode::Residue) && SBResidue::IsTerminal());

selects all terminal residue nodes from the active document.

Note that the nodeIndexer is not cleared when entering this function.

See also
SBNode::getNodes
SBNodeIndexer
SBNodePredicate

◆ getNodes() [3/6]

void SAMSON::getNodes ( SBNodeIndexer nodeIndexer,
const SBVector< QPoint > &  selectionLasso,
const SBNodePredicate selectionFilter = SBNode::All(),
bool  deepSelectionFlag = false 
)
static
Parameters
nodeIndexerThe indexer which stores picked nodes
selectionLassoThe vector of viewport coordinates that form the selection lasso
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()
deepSelectionFlagWhether to select nodes hidden by other nodes as well; by default, this is set to false

This function returns the nodes displayed in a given selection lasso. It is typically used by editors when reacting to mouse events:

SBNodeIndexer nodeIndexer;
SAMSON::getNodes(nodeIndexer, selectionLasso);

Picked nodes are appended to the vector nodeVector.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getDeepSelectionFlag()

◆ getNodes() [4/6]

void SAMSON::getNodes ( SBNodeIndexer nodeIndexer,
const std::string &  selectionString 
)
static

This function fills the nodeIndexer passed in reference with nodes from the active document, based on a selectionString formulated in SAMSON's Node Specification Language.

Parameters
nodeIndexerThe node indexer into which the nodes should be added.
selectionStringA Node Specification Language expression string describing the selection.

For example:

SBNodeIndexer nodeIndexer;
SAMSON::getNodes(nodeIndexer, "node.type residue within 4A of S");

selects all residue nodes from the active document that are within 4 angstrom of any sulfur atom (note that the selection string may be abbreviated to "n.t r w 4A of S").

Note that the nodeIndexer is not cleared when entering this function.

See also
Node Specification Language
SBNodeIndexer

◆ getNodes() [5/6]

void SAMSON::getNodes ( SBNodeIndexer nodeIndexer,
int  x,
int  y,
int  width,
int  height,
const SBNodePredicate selectionFilter = SBNode::All(),
bool  deepSelectionFlag = false 
)
static
Parameters
nodeIndexerThe indexer which stores picked nodes
xThe first viewport coordinate of the top left corner of the picking rectangle
yThe second viewport coordinate of the top left corner of the picking rectangle
widthThe width of the picking rectangle
heightThe height of the picking rectangle
selectionFilterA node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()
deepSelectionFlagWhether to select nodes hidden by other nodes as well; by default, this is set to false

This function returns the nodes displayed in the viewport rectangle (x,y,width,height). It is typically used by editors when reacting to mouse events:

SBNodeIndexer nodeIndexer;
SAMSON::getNodes(nodeIndexer, x, y, width, height);

Picked nodes are appended to the vector nodeVector.

Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).

See also
getNode(SBNodeIndexer&, const QPoint&, int, int)
getDeepSelectionFlag()

◆ getNodes() [6/6]

void SAMSON::getNodes ( SBNodeIndexer nodeIndexer,
SBDDataGraphNode::Type  nodeType,
bool  selectedNodesOnly = false,
const SBNodePredicate visitPredicate = SBDDataGraphNode::All(),
bool  includeDependencies = false 
)
static

This function fills the nodeIndexer passed in reference with nodes from the active document, based on a nodeType, and other parameters.

Parameters
nodeIndexerThe node indexer into which the nodes should be added.
nodeTypeA type of nodes (SBNode::Type) that should be collected.
selectedNodesOnlyIf set to true, then only nodes that are selected, directly or via their parents, will be traversed.
visitPredicateA predicate that describes what nodes should be visited in the active document.
includeDependenciesWhether to include node dependencies or not.

This function traverses the active document's sub-tree for which visitPredicate is true (depth-first), and stores in nodeIndexer the nodes whose type is nodeType. Precisely, if the visitPredicate returns false, the node is not visited, and neither are its descendants. If the visitPredicate returns true, the node is visited, and the visitPredicate will be used to decide whether its children are visited or not. Note that the node itself must satisfy the visitPredicate else nothing is visited.

When includeDependencies is true, the function also adds to nodeIndexer nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided the node type is nodeType and they satisfy they satisfy visitPredicate, they are added to the nodeIndexer if includeDependencies is true.

For example:

SBNodeIndexer nodeIndexer;

selects all residue nodes from the active document.

Note that the nodeIndexer is not cleared when entering this function.

See also
SBNode::getNodes
SBNodeIndexer
SBNodePredicate

◆ getSimulationFlag()

bool SAMSON::getSimulationFlag ( )
static

This function returns true when interactive simulation is on. When interactive simulation is started, all active simulators in the active document periodically perform a time step.

See also
startSimulation
stopSimulation
toggleSimulation
setSimulationFlag

◆ hasNode() [1/3]

bool SAMSON::hasNode ( const SBNodePredicate selectionPredicate = SBDDataGraphNode::All(),
const SBNodePredicate visitPredicate = SBDDataGraphNode::All(),
bool  includeDependencies = false 
)
static

This function returns whether the active document has nodes based on a selectionPredicate, and other parameters.

Parameters
selectionPredicateA predicate that describes what nodes should be checked for in the active document.
visitPredicateA predicate that describes what nodes should be visited in the active document.
includeDependenciesWhether to include node dependencies or not.

This function traverses the active document's sub-tree for which visitPredicate is true (depth-first), and checks for nodes for which the selectionPredicate is true. Precisely, if the visitPredicate returns false, the node is not visited, and neither are its descendants. If the visitPredicate returns true, the node is visited, and the visitPredicate will be used to decide whether its children are visited or not. Note that the node itself must satisfy the visitPredicate else nothing is visited.

When includeDependencies is true, the function also checks nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the selectionPredicate and visitPredicate, they are checked for if includeDependencies is true.

For example:

bool res = SAMSON::hasNode(SBNode::IsType(SBNode::Residue) && SBResidue::IsTerminal());
static bool hasNode(const std::string &selectionString)
Checks for the presence nodes in the active document based on a selectionString.
Definition: SAMSON.cpp:2480

checks for all terminal residue nodes in the active document.

Note that the nodeIndexer is not cleared when entering this function.

See also
SBNode::getNodes
SBNodeIndexer
SBNodePredicate

◆ hasNode() [2/3]

bool SAMSON::hasNode ( const std::string &  selectionString)
static

This function returns whether the active document has nodes based on a selectionString formulated in SAMSON's Node Specification Language.

Parameters
selectionStringA Node Specification Language expression string describing the selection.

For example:

bool res = SAMSON::hasNode("node.type residue within 4A of S");

checks for the presence of all residue nodes in the active document that are within 4 angstrom of any sulfur atom (note that the selection string may be abbreviated to "n.t r w 4A of S").

See also
Node Specification Language

◆ hasNode() [3/3]

bool SAMSON::hasNode ( SBDDataGraphNode::Type  nodeType,
bool  selectedNodesOnly = false,
const SBNodePredicate visitPredicate = SBDDataGraphNode::All(),
bool  includeDependencies = false 
)
static

This function returns whether the active document has nodes based on a nodeType, and other parameters.

Parameters
nodeTypeA type of nodes (SBNode::Type) that should be checked.
selectedNodesOnlyIf set to true, then only nodes that are selected, directly or via their parents, will be traversed.
visitPredicateA predicate that describes what nodes should be visited in the active document.
includeDependenciesWhether to include node dependencies or not.

This function traverses the active document's sub-tree for which visitPredicate is true (depth-first), and checks for nodes whose type is nodeType. Precisely, if the visitPredicate returns false, the node is not visited, and neither are its descendants. If the visitPredicate returns true, the node is visited, and the visitPredicate will be used to decide whether its children are visited or not. Note that the node itself must satisfy the visitPredicate else nothing is visited.

When includeDependencies is true, the function also checks for nodes that are not descendants of this node, but are dependencies nonetheless. For example, in a bond, the two atoms connected by the bond are not children of the bond, but are still dependencies of the bond. Hence, provided they satisfy the nodeType, selectedNodesOnly, and visitPredicate, they are checked for if includeDependencies is true.

For example:

checks for residue nodes in the active document.

See also
SBNode::getNodes
SBNodeIndexer
SBNodePredicate

◆ hideProgressBar()

void SAMSON::hideProgressBar ( )
static

This function hides the progress bar.

See also
showProgressBar, isProgressBarStopped, setProgressBarValue, hideProgressBar

◆ hideTip()

void SAMSON::hideTip ( )
static

This static function hides the last tip window.

◆ informUser() [1/4]

void SAMSON::informUser ( const QString &  dialogTitle,
const QString &  dialogText,
const QPixmap &  logo = QPixmap() 
)
static

This static function informs the user with a message in a modal pop-up dialog. This is a convenience function which makes it easy to program messages to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button. This function exposes the function with the same name in SBGWindowDialog.

SAMSON::informUser("Information", "This operation will be applied to all atoms.");
See also
askUser

◆ informUser() [2/4]

void SAMSON::informUser ( const QString &  dialogTitle,
const QString &  labelText,
const QString &  text,
bool  monospaceFont = false,
const QPixmap &  logo = QPixmap() 
)
static

This static function informs the user with a message and text in a modal pop-up dialog. This is a convenience function which makes it easy to program messages with logs to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button. This function exposes the function with the same name in SBGWindowDialog.

SAMSON::informUser("Information", "This operation produced the following log:", "Log text here");
See also
askUser

◆ informUser() [3/4]

void SAMSON::informUser ( QWidget *  widget,
const QPixmap &  logo = QPixmap() 
)
static

This static function informs the user with a widget in a modal pop-up dialog. This is a convenience function which makes it easy to program messages to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button. The dialog title and icon are taken from the widget. Note that the OK button is created by this function, and the widget does not have to contain one. This function exposes the function with the same name in SBGWindowDialog.

// MyCustomWidget derives from SBGWindowWidget
MyCustomWidget* myCustomWidget = new MyCustomWidget();
SAMSON::informUser(myCustomWidget);
delete myCustomWidget;
See also
askUser

◆ informUser() [4/4]

void SAMSON::informUser ( SBGWindowWidget widget,
const QPixmap &  logo = QPixmap() 
)
static

This static function informs the user with a widget in a modal pop-up dialog. This is a convenience function which makes it easy to program messages to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button. The dialog title and icon are taken from the widget. Note that the OK button is created by this function, and the widget does not have to contain one. This function exposes the function with the same name in SBGWindowDialog.

// MyCustomWidget derives from SBGWindowWidget
QWidget* myCustomWidget = new QWidget();
SAMSON::informUser(myCustomWidget);
delete myCustomWidget;
See also
askUser

◆ isProgressBarStopped()

bool SAMSON::isProgressBarStopped ( )
static

This function returns whether the progress bar was stopped/canceled by the user.

See also
showProgressBar, isProgressBarStopped, setProgressBarValue, hideProgressBar

◆ makeAnimation()

SBAnimation * SAMSON::makeAnimation ( const std::string &  name,
const SBNodeIndexer nodeIndexer,
double  currentFrame,
const std::string &  animationClassName,
const SBUUID animationElementUUID = SBUUID() 
)
static

Creates an instance of an animation with the given class name and extension UUID for the specified node indexer at the specified frame.

Parameters
nameThe name of animation object.
nodeIndexerThe node indexer with nodes the animation should be applied to.
currentFrameThe frame at which the animation should start.
animationClassNameThe name of the animation class.
animationElementUUIDThe UUID of the extension with the animation class.
Returns
A pointer to the created animation object or nullptr if could not create the object.

◆ makeController()

SBController * SAMSON::makeController ( const std::string &  controllerClassName,
const SBUUID controllerElementUUID = SBUUID() 
)
static

Creates an instance of a controller with the specified class name and extension UUID.

Parameters
controllerClassNameThe name of the controller class.
controllerElementUUIDThe UUID of the extension with the controller class.
Returns
A pointer to the created controller object or nullptr if could not create the object.

◆ makeInteractionModel()

SBInteractionModelParticleSystem * SAMSON::makeInteractionModel ( SBParticleSystem dynamicalModel,
const std::string &  interactionModelClassName,
const SBUUID interactionModelElementUUID = SBUUID() 
)
static

Creates an instance of an interaction model with the given class name and extension UUID for the specified dynamical model.

Parameters
dynamicalModelA pointer to the dynamical model object.
interactionModelClassNameThe name of the interaction model class.
interactionModelElementUUIDThe UUID of the extension with the interaction model class.
Returns
A pointer to the created interaction model object or nullptr if could not create the object.

◆ makeNeighborSearch()

SBSNeighborSearchParticleSystem * SAMSON::makeNeighborSearch ( SBParticleSystem dynamicalModel,
const SBQuantity::length cutoffDistance,
const std::string &  neighborSearchClassName,
const SBUUID neighborSearchElementUUID = SBUUID() 
)
static

Creates an instance of a neighbor search with the given class name and extension UUID for the specified dynamical model and cutoff distance.

Parameters
dynamicalModelA pointer to the dynamical model object.
cutoffDistanceThe cutoff distance for the neighbor search algorithm.
neighborSearchClassNameThe name of the neighbor search class.
neighborSearchElementUUIDThe UUID of the extension with the neighbor search class.
Returns
A pointer to the created neighbor search object or nullptr if could not create the object.
SBSNeighborSearchParticleSystem* neighborSearch = SAMSON::makeNeighborSearch(particleSystem, SBQuantity::nanometers(10.0), "NeighborSearchClass", neighborSearchExtensionUUID);
static SBSNeighborSearchParticleSystem * makeNeighborSearch(SBParticleSystem *dynamicalModel, const SBQuantity::length &cutoffDistance, const std::string &neighborSearchClassName, const SBUUID &neighborSearchElementUUID=SBUUID())
Makes a neighbor search algorithm.
Definition: SAMSON.cpp:2190
This class is the base class of neighbor search algorithms that can be applied to particle systems.
Definition: SBSNeighborSearchParticleSystem.hpp:14

◆ makeNodePredicate()

SBNodePredicate * SAMSON::makeNodePredicate ( const std::string &  selectionString)
static

This function makes a node predicate based on a selectionString formulated in SAMSON's node specification language. For example:

SBNodePredicate* nodePredicate = SAMSON::makeNodePredicate("H linking O");
SBDDataGraphNodePredicate SBNodePredicate
The short name of SBDDataGraphNodePredicate.
Definition: SBDDataGraphNodePredicate.hpp:27
static SBNodePredicate * makeNodePredicate(const std::string &selectionString)
Make a node predicate based on a selectionString.
Definition: SAMSON.cpp:3293

makes a predicate that is true if and only if the node is a hydrogen atom bonded to an oxygen atom. This function may be used when a predicate should be stored. Ownership is passed to the caller, who should delete the predicate when it's done using it.

See also
Node Specification Language

◆ makePropertyModel()

SBPropertyModel * SAMSON::makePropertyModel ( const SBNodeIndexer nodeIndexer,
const std::string &  propertyModelClassName,
const SBUUID propertyModelElementUUID = SBUUID() 
)
static

Creates an instance of a property model with the given class name and extension UUID for the specified node indexer.

Parameters
nodeIndexerThe node indexer with nodes the property model should be applied to.
propertyModelClassNameThe name of the property model class.
propertyModelElementUUIDThe UUID of the extension with the property model class.
Returns
A pointer to the created property model object or nullptr if could not create the object.

◆ makeSelector()

SBNodeSelector * SAMSON::makeSelector ( const std::string &  selectorClassName,
const SBUUID selectorElementUUID = SBUUID() 
)
static

Creates an instance of a selector with the given class name and extension UUID.

Parameters
selectorClassNameThe name of the selector class.
selectorElementUUIDThe UUID of the extension with the selector class.
Returns
A pointer to the created selector object or nullptr if could not create the object.

◆ makeSimulator()

SBSimulatorParticleSystem * SAMSON::makeSimulator ( const SBNodeIndexer nodeIndexer,
const std::string &  interactionModelClassName,
const SBUUID interactionModelElementUUID,
const std::string &  stateUpdaterClassName,
const SBUUID stateUpdaterElementUUID = SBUUID() 
)
static

Creates an instance of a simulator for the specified nodes, interaction model, and state updater.

Parameters
nodeIndexerThe node indexer with nodes the simulator should be applied to.
interactionModelClassNameThe name of the interaction model class.
interactionModelElementUUIDThe UUID of the extension with the interaction model class.
stateUpdaterClassNameThe name of the state updater class.
stateUpdaterElementUUIDThe UUID of the extension with the state updater class.
Returns
A pointer to the created simulator object or nullptr if could not create the object.

This will also create the corresponding dynamical model particle system for the nodes in the nodeIndexer, and corresponding interaction model and state updater.

SBSimulatorParticleSystem* simulator = SAMSON::makeSimulator(nodeIndexer, "InteractionModelClass", interactionModelExtensionUUID, "StateUpdaterClass", stateUpdaterExtensionUUID);
static SBSimulatorParticleSystem * makeSimulator(const SBNodeIndexer &nodeIndexer, const std::string &interactionModelClassName, const SBUUID &interactionModelElementUUID, const std::string &stateUpdaterClassName, const SBUUID &stateUpdaterElementUUID=SBUUID())
Makes a simulator.
Definition: SAMSON.cpp:2227
This class describes a particle simulator.
Definition: SBSSimulatorParticleSystem.hpp:15

◆ makeStateUpdater()

SBStateUpdaterParticleSystem * SAMSON::makeStateUpdater ( SBParticleSystem dynamicalModel,
SBInteractionModelParticleSystem interactionModel,
const std::string &  stateUpdaterClassName,
const SBUUID stateUpdaterElementUUID = SBUUID() 
)
static

Creates an instance of a state updater with the given class name and extension UUID for the specified dynamical model and interaction model.

Parameters
dynamicalModelA pointer to the dynamical model object.
interactionModelA pointer to the interaction model object.
stateUpdaterClassNameThe name of the state updater class.
stateUpdaterElementUUIDThe UUID of the extension with the state updater class.
Returns
A pointer to the created state updater object or nullptr if could not create the object.
SBStateUpdaterParticleSystem* stateUpdater = SAMSON::makeStateUpdater(particleSystem, interactionModel, "StateUpdaterClass", stateUpdaterExtensionUUID);
static SBStateUpdaterParticleSystem * makeStateUpdater(SBParticleSystem *dynamicalModel, SBInteractionModelParticleSystem *interactionModel, const std::string &stateUpdaterClassName, const SBUUID &stateUpdaterElementUUID=SBUUID())
Makes a state updater.
Definition: SAMSON.cpp:2207
This class is the base class for state updaters of particle systems simulators.
Definition: SBSStateUpdaterParticleSystem.hpp:21

◆ makeVisualModel()

SBVisualModel * SAMSON::makeVisualModel ( const SBNodeIndexer nodeIndexer,
const std::string &  visualModelClassName,
const SBUUID visualModelElementUUID = SBUUID() 
)
static

Creates an instance of a visual model with the given class name and extension UUID for the specified node indexer.

Parameters
nodeIndexerThe node indexer with nodes the visual model should be applied to.
visualModelClassNameThe name of the visual model class.
visualModelElementUUIDThe UUID of the extension with the visual model class.
Returns
A pointer to the created visual model object or nullptr if could not create the object.
SBVisualModel* visualModel = SAMSON::makeVisualModel(nodeIndexer, "VisualModelClass", visualModelExtensionUUID);
static SBVisualModel * makeVisualModel(const SBNodeIndexer &nodeIndexer, const std::string &visualModelClassName, const SBUUID &visualModelElementUUID=SBUUID())
Makes a visual model.
Definition: SAMSON.cpp:2243
This class is the base class to describe a visual model.
Definition: SBMVisualModel.hpp:29

◆ minimize()

bool SAMSON::minimize ( const SBNodeIndexer nodeIndexer,
unsigned int  maximumNumberOfSteps,
unsigned int  minimumNumberOfStepsInPlateau,
const SBQuantity::kJPerMol energyDifferenceCriteria,
unsigned int  printMinimizationInformationFrequency = 100,
bool  askUser = false 
)
static
Parameters
nodeIndexerAn indexer of nodes (atoms or nodes that have atoms in them) to which minimization should be applied.
maximumNumberOfStepsThe maximum number of minimization steps.
minimumNumberOfStepsInPlateauThe minimum number of consecutive steps sufficing the energy difference criteria.
energyDifferenceCriteriaThe energy difference threshold between two consecutive minimization steps.
printMinimizationInformationFrequencyThe frequency at which the minimization information should be printed. Set to 0 to disable. Note: printing information too often might decrease the performance. The default value is 100.
askUserSet to true to ask user. The default value is false.

This function performs minimization of atoms in the nodeIndexer using the Universal Force Field (UFF) and the Interactive modeling state updater. Note that for this function to work the user needs to have these two SAMSON Extensions installed. For UFF to properly determine the bond order, the system shouldn't have missing hydrogen atoms. Note that the minimization is also applied to all atoms connected to atoms in the nodeIndexer.

The following parameters are used as the stopping criteria: maximumNumberOfSteps, minimumNumberOfStepsInPlateau, energyDifferenceCriteria.

For example, to minimize the whole system:

SBNodeIndexer nodeIndexer;
SAMSON::minimize(nodeIndexer, 1000, 25, SBQuantity::kJPerMol(0.5), 100, 100);
static bool minimize(const SBNodeIndexer &nodeIndexer, unsigned int maximumNumberOfSteps, unsigned int minimumNumberOfStepsInPlateau, const SBQuantity::kJPerMol &energyDifferenceCriteria, unsigned int printMinimizationInformationFrequency=100, bool askUser=false)
Minimize atoms in the nodeIndexer according to the provided criteria.
Definition: SAMSON.cpp:2650
@ Atom
Atom.
Definition: SBDDataGraphNode.hpp:67

numberOfStateUpdaterStepsBetweenViewportUpdate - the number of the state updater steps between the update of atoms positions in the viewport. It is applicable only if atoms to which minimization is applied are displayed in the viewport. Note: setting too small value might decrease the performance. The default value is 100. Set to 0 to update when the minimization is finished.

◆ removeFromSelection()

void SAMSON::removeFromSelection ( const std::string &  selectionString)
static

This function removes nodes from the active document to the current selection, based on a selectionString formulated in SAMSON's Node Specification Language.

Parameters
selectionStringA Node Specification Language expression string describing the selection.

For example:

SAMSON::removeFromSelection("node.type residue within 4A of S");
static void removeFromSelection(const std::string &selectionString)
Removes nodes from the active document to the selection based on a selectionString.
Definition: SAMSON.cpp:2358

Removes to the selection all residue nodes from the active document that are within 4 angstrom of any sulfur atom (note that the selection string may be abbreviated to "n.t r w 4A of S").

See also
Node Specification Language

◆ requestViewportUpdate()

void SAMSON::requestViewportUpdate ( )
static

This function allows SAMSON Extensions to request an update of the viewport. This may be useful, for example, when an editor is displaying an interface (e.g. a rectangle selection editor draws a rectangle on top of the viewport), or temporary objects in the viewport (e.g. a carbon nanotube editor renders a transparent nanotube while the user is choosing its endpoints and radius). Requesting a viewport update ensures that SAMSON will call the appropriate display functions of the editor even when the camera is not moving and no other SAMSON Extension is requesting a viewport update.

◆ select()

void SAMSON::select ( const std::string &  selectionString)
static

This function selects nodes from the active document, based on a selectionString formulated in SAMSON's Node Specification Language.

Parameters
selectionStringA Node Specification Language expression string describing the selection.

For example:

SAMSON::select("node.type residue within 4A of S");
static void select(const std::string &selectionString)
Selects nodes from the active document based on a selectionString.
Definition: SAMSON.cpp:2301

selects all residue nodes from the active document that are within 4 angstrom of any sulfur atom (note that the selection string may be abbreviated to "n.t r w 4A of S").

See also
Node Specification Language

◆ setActiveSelectionFilterByName()

bool SAMSON::setActiveSelectionFilterByName ( const std::string &  selectionFilterName)
static

This function sets the active selection filter according to the given name selectionFilterName. It is purely based on the name of the selection filter which can be seen in the selection filter itself. Returns true in case of the success and false if it couldn't find a selection filter with such name. The selection filter governs the selection level in the Viewport done by the default select editor.

static bool setActiveSelectionFilterByName(const std::string &selectionFilterName)
Sets the active selection filter according to the given name selectionFilterName. Returns true in cas...
Definition: SAMSON.cpp:1188

◆ setHeadsetParameters()

bool SAMSON::setHeadsetParameters ( int  panelWidth,
int  panelHeight,
unsigned int  leftFrameBuffer,
unsigned int  rightFrameBuffer 
)
static
Parameters
panelWidthThe width of a panel (for one eye)
panelHeightThe height of a panel (for one eye)
leftFrameBufferThe index of the external frame buffer for the left eye
rightFrameBufferThe index of the external frame buffer for the right eye leftFrameBuffer and rightFrameBuffer are the indices of the OpenGL frame buffers in which SAMSON will render the document using its own renderer. This should be called after SAMSON::createHeadsetViewport.

◆ setMinimizationFlag()

void SAMSON::setMinimizationFlag ( bool  minimizationFlag)
static

This function sets the interactive minimization flag. Set the flag to true to start interactive minimization. When interactive minimization is started, all active simulators in the active document periodically perform a time step.

See also
startMinimization
stopMinimization
toggleMinimization
getMinimizationFlag

◆ setProgressBarValue()

void SAMSON::setProgressBarValue ( int  value)
static

This function sets the current progress bar value to value.

Since the update of the progress bar requires processing of Qt events this function updates the progress bar no more frequently than once per second in order to maintain performance. So, even if this function is invoked e.g. each 1ms, the value will be updated only each second to reduce the number of calls to process events.

See also
showProgressBar, isProgressBarStopped, setProgressBarValue, hideProgressBar

◆ setSimulationFlag()

void SAMSON::setSimulationFlag ( bool  simulationFlag)
static

This function sets the interactive simulation flag. Set the flag to true to start interactive simulation. When interactive simulation is started, all active simulators in the active document periodically perform a time step.

See also
startSimulation
stopSimulation
toggleSimulation
getSimulationFlag

◆ showContextMenu()

void SAMSON::showContextMenu ( const QPoint &  position,
SBNode highlightedNode = 0 
)
static

Shows the context menu at a given position. The highlightedNode pointer can be used to show context actions about a specific node.

◆ showProgressBar()

void SAMSON::showProgressBar ( const QString &  name = "",
int  minimum = 0,
int  maximum = 0,
const SBQuantity::second minimumDuration = SBQuantity::second(2.0),
bool  isCancellable = true,
const QString &  cancelButtonText = "Cancel" 
)
static

This function shows a progress bar with the given name name going from the minimum value to the maximum value for at least the minimumDuration of seconds.

When SAMSON Extensions need to lock the user interface for a long period of time, they may communicate the progress made through a progress bar:

SAMSON::showProgressBar("Updating atoms", 0, numberOfAtoms);
for (unsigned int i = 0; i < numberOfAtoms; i++) {
// do something
...
}
See also
showProgressBar, isProgressBarStopped, setProgressBarValue, hideProgressBar

◆ showTip() [1/3]

void SAMSON::showTip ( const SBUUID tipUUID,
const QString &  tipCategory,
const QString &  tipTitle,
const QString &  tipText,
const QPixmap &  tipPixmap,
QWidget *  widget = nullptr,
const QPoint &  relativePosition = QPoint(),
bool  showArrow = false 
)
static

This static function shows a tip window with a title tipTitle, text tipText, and image tipPixmap at the position relativePosition relative to a widget widget.

This function is an extension of the SAMSON::showTip function described above and it allows you to provide an image in a tipPixmap. The image will appear above of the text. Note that it will be scaled to fit the tip window.

QPixmap tipPixmap(QString::fromStdString(SB_ELEMENT_PATH + "/Resource/tip-1.png"));
SAMSON::showTip(SBUUID("36A92A5A-8049-BDB3-0DD4-755ED7F41E00"), getName(), "Tip", "Information text", tipPixmap);
SBCContainerUUID SBUUID
The short name of SBCContainerUUID.
Definition: SBCContainerUUID.hpp:100
static void showTip(const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false)
Shows a tip window with a title tipTitle and text tipText at the position relativePosition relative t...
Definition: SAMSON.cpp:1691

◆ showTip() [2/3]

void SAMSON::showTip ( const SBUUID tipUUID,
const QString &  tipCategory,
const QString &  tipTitle,
const QString &  tipText,
const QString &  tipMoviePath,
QWidget *  widget = nullptr,
const QPoint &  relativePosition = QPoint(),
bool  showArrow = false 
)
static

This static function shows a tip window with a title tipTitle, text tipText, and gif-movie tipMovie at the position relativePosition relative to a widget widget.

This function is an extension of the SAMSON::showTip function described above and it allows you to provide a gif movie path in a tipMovie. The movie will appear above of the text. Note that the movie will be scaled to fit the tip window.

QString tipMoviePath(QString::fromStdString(SB_ELEMENT_PATH + "/Resource/tip-movie-1.gif"));
SAMSON::showTip(SBUUID("186F89EE-75A7-119F-94BC-8CD449925DE2"), getName(), "Tip", "Information text", tipMoviePath);

◆ showTip() [3/3]

void SAMSON::showTip ( const SBUUID tipUUID,
const QString &  tipCategory,
const QString &  tipTitle,
const QString &  tipText,
QWidget *  widget = nullptr,
const QPoint &  relativePosition = QPoint(),
bool  showArrow = false 
)
static

This static function shows a tip window with a title tipTitle and text tipText at the position relativePosition relative to a widget widget. If a widget widget is not provided, the tip window will appear in the top-right corner of the viewport.

The tip's UUID tipUUID is used internally to store tip's info e.g. whether the tip was shown or not.

The category string tipCategory is used internally - please, provide the name of your Element.

You can create a tip with just a text as follows:

SAMSON::showTip(SBUUID("A22BD30D-64A0-3B28-A9AD-7F7A3663115A"), getName(), "Tip", "Information text");

You can also use rich text (with html) in a tip:

SAMSON::showTip(SBUUID("004CEE25-78B1-2D61-7EE9-3C7B39105029"), getName(), "Tip", "<html><head/><body><p>To learn more how to use SAMSON visit <a href=\"https://documentation.samson-connect.net/\" style=\"color:#9cbfe2\">Documentation Center</a>.</p></body></html>", QPixmap());

You can show a tip window at an arbitrary position relativePosition relative to a widget widget. You can provide both positive and negative coordinates in the relative position. The positive coordinates start from the widget's top-left corner, the negative coordinates start from the widget's bottom-right corner. The relative position is a position of the top-left corner of the tip window.

In the following code example, the tip window is placed around the top-right corner of a widget widget: with a shift equal to -10 in the x-direction to the left from the widget's right side, and a shift of 10 in the y-direction to the bottom from the widget's top side.

SAMSON::showTip(SBUUID("99CF88F8-3692-6F47-4788-2DF502BDFEC7"), getName(), "Tip", "This tip is placed in the vicinity of the widget's top-right corner", widget, QPoint(-10, 10));

To show an arrow in the tip's corner (the corner is detected based on the relative position) set the showArrow to true.

◆ snap() [1/7]

SBLength3 SAMSON::snap ( const SBLength3 displacement)
static
Parameters
displacementThe 3D translational displacement

This function returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement.

◆ snap() [2/7]

SBMatrix33 SAMSON::snap ( const SBMatrix33 rotationMatrix)
static
Parameters
rotationMatrixThe rotation matrix

This function returns the snapped rotation matrix if the snapping of angular displacements is on, else it returns the unchanged rotation matrix.

◆ snap() [3/7]

SBQuantity::degree SAMSON::snap ( const SBQuantity::degree displacement)
static
Parameters
displacementThe angular displacement in degrees

This function returns the snapped displacement if the snapping of angular displacements is on, else it returns the unchanged displacement.

◆ snap() [4/7]

SBQuantity::length SAMSON::snap ( const SBQuantity::length displacement)
static
Parameters
displacementThe translational displacement

This function returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement.

◆ snap() [5/7]

SBSpatialTransform SAMSON::snap ( const SBSpatialTransform transform)
static
Parameters
transformThe spatial transform

This function returns the snapped spatial transform according to the translational and angular snapping parameters.

◆ snap() [6/7]

QPoint SAMSON::snap ( int  x,
int  y 
)
static
Parameters
xThe x-coordinate of the mouse
yThe y-coordinate of the mouse

This function returns the snapped mouse viewport displacement (x,y)

◆ snap() [7/7]

QPoint SAMSON::snap ( int  x,
int  y,
const SBPosition3 pointInPlane 
)
static
Parameters
xThe x-coordinate of the mouse
yThe y-coordinate of the mouse
pointInPlaneThe point in the plane

This function returns the snapped mouse viewport displacement (x,y) in the plane containing pointInPlane

◆ startMinimization()

void SAMSON::startMinimization ( )
static

This function starts interactive minimization. When interactive minimization is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:

static void setMinimizationFlag(bool minimizationFlag)
Sets the interactive Minimization flag.
Definition: SAMSON.cpp:3200
See also
stopMinimization
toggleMinimization
getMinimizationFlag
setMinimizationFlag

◆ startSimulation()

void SAMSON::startSimulation ( )
static

This function starts interactive simulation. When interactive simulation is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:

static void setSimulationFlag(bool simulationFlag)
Sets the interactive simulation flag.
Definition: SAMSON.cpp:3275
See also
stopSimulation
toggleSimulation
getSimulationFlag
setSimulationFlag

◆ stopMinimization()

void SAMSON::stopMinimization ( )
static

This function stops interactive minimization. When interactive minimization is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:

See also
startMinimization
toggleMinimization
getMinimizationFlag
setMinimizationFlag

◆ stopSimulation()

void SAMSON::stopSimulation ( )
static

This function stops interactive simulation. When interactive simulation is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:

See also
startSimulation
toggleSimulation
getSimulationFlag
setSimulationFlag

◆ toggleMinimization()

void SAMSON::toggleMinimization ( )
static

This function toggles interactive minimization on and off. When interactive minimization is started, all active simulators in the active document periodically perform a time step.

See also
startMinimization
stopMinimization
getMinimizationFlag
setMinimizationFlag

◆ toggleSimulation()

void SAMSON::toggleSimulation ( )
static

This function toggles interactive simulation on and off. When interactive simulation is started, all active simulators in the active document periodically perform a time step.

See also
startSimulation
stopSimulation
getSimulationFlag
setSimulationFlag