Web Analytics Made Easy - Statcounter
Skip to content

Class SAMSON#

ClassList > SAMSON

This class is the main interface. More...

  • #include <SAMSON.hpp>

Public Static Functions#

Type Name
SBGWindow * addDialog (SBGWindowDialog * dialog)
Adds a SAMSON dialog to the user interface.
SBGWindow * addDialog (QDialog * dialog, QString name="", int format=SBGWindow::NoOptions, QPixmap logo=QPixmap(), SBUUID uuid=SBUUID())
Adds a Qt dialog to the user interface.
SBGWindowDock * addDockWidget (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.
void addDocument (SBDDocument * document)
Adds a document to the list of opendocuments .
void addToSelection (const std::string & selectionString)
Adds nodes from the active document to the selection based on a selectionString .
SBGWindow * addWidget (SBGWindowWidget * widget)
Adds a SAMSON widget to the user interface.
SBGWindow * addWidget (QWidget * widget, QString name="", int format=SBGWindow::NoOptions, QPixmap logo=QPixmap(), SBUUID uuid=SBUUID())
Adds a Qt widget to the user interface.
bool appIsInitialized (const SBUUID & appUUID, const SBUUID & elementUUID=SBUUID())
Returns true or false if an app corresponding to a specificappUUID andelementUUID is initialized already.
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.
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.
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.
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.
void beginHolding (const std::string & name)
Begins holding.
bool canImportFromFile (const std::string & fileName)
Returns true when the files can be imported.
QImage captureViewport (int width, int height, bool transparentBackground=false, bool usePathTracing=false, bool showProgressBar=true)
Captures the viewport.
void captureViewport (const std::string & fileName, int width, int height, bool transparentBackground=false, bool usePathTracing=false, bool showProgressBar=true)
Captures the viewport.
void connectDocumentSignalToSlot (SBCReferenceTarget * referenceTarget, void(SBCReferenceTarget::*)(SBDocumentEvent *) functionPointer, SBCReferenceTarget * nextReferenceTarget=0, void(SBCReferenceTarget::*)(SBDocumentEvent *) nextFunctionPointer=0)
Connects the document signal to a slot.
unsigned int countNodes (const std::string & selectionString)
Counts nodes in the active document based on a selectionString .
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 avisitPredicate , with or without dependencies.
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 avisitPredicate , with or without dependencies.
QImage * create2DImage (const std::string & smiles, int widthPx=600, int marginPx=10, double lineWidth=2, QString fontFamily="sans-serif")
Creates a 2D image for the given SMILES code.
QOpenGLContext * createHeadsetViewport ()
Creates a viewport for a virtual reality headset.
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 costfixedCost , hourly costhourlyCost , price currencypriceCurrency , estimated durationestimatedDuration , end pointendPoint , and meta datametadata ; returns the job's UUID.
SBDDocumentRenderPreset * createRenderPreset ()
Creates a render preset based on the current rendering settings; returns the owning pointer.
void deleteTexture (unsigned int textureID)
Deletes an OpenGL texture from its id.
void disableHolding ()
Pauses holding bool transparency = false,.
void disableViewportNodeHighlighting ()
Enables automatic node highlighting in the viewport.
void disconnectDocumentSignalFromSlot (SBCReferenceTarget * referenceTarget, void(SBCReferenceTarget::*)(SBDocumentEvent *) functionPointer)
Disconnects the document signal from a slot.
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, const SBSpatialTransform & transform=SBSpatialTransform::identity, float opacity=1.0f, unsigned int flagModifier=0)
Displays cylinders.
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, const SBSpatialTransform & transform=SBSpatialTransform::identity)
Displays cylinders for selection.
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, const SBSpatialTransform & transform=SBSpatialTransform::identity, float opacity=1.0f, unsigned int flagModifier=0)
Displays line-swept spheres.
void displayLineSweptSpheresSelection (unsigned int nLineSweptSpheres, unsigned int nPositions, const unsigned int * indexData, const float * positionData, const float * radiusData, const unsigned int * nodeIndexData, const SBSpatialTransform & transform=SBSpatialTransform::identity)
Displays line-swept spheres for selection.
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, const SBSpatialTransform & transform=SBSpatialTransform::identity, float opacity=1.0f, unsigned int flagModifier=0)
Displays 3D lines.
void displayLinesOrtho (unsigned int nLinesOrtho, unsigned int nPositions, const unsigned int * indexData, const float * positionData, const float * colorData, bool reverseViewport=true)
Displays 2D lines.
void displayLinesSelection (unsigned int nLines, unsigned int nPositions, const unsigned int * indexData, const float * positionData, const unsigned int * nodeIndexData, const SBSpatialTransform & transform=SBSpatialTransform::identity)
Displays 3D lines for selection.
void displaySpheres (unsigned int nSpheres, const float * positionData, const float * radiusData, const float * colorData, const unsigned int * flagData, bool shadowPassFlag=false, const SBSpatialTransform & transform=SBSpatialTransform::identity, float opacity=1.0f, unsigned int flagModifier=0)
Displays spheres.
void displaySpheresSelection (unsigned int nSpheres, const float * positionData, const float * radiusData, const unsigned int * nodeIndexData, const SBSpatialTransform & transform=SBSpatialTransform::identity)
Displays spheres for selection.
void displayText (const std::string & text, const SBPosition3 & position, const QFont & font, float * color)
Displays text.
void displayTextSelection (const std::string & text, const SBPosition3 & position, const QFont & font, unsigned int nodeIndex)
Displays text for selection.
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, 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.
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, float opacity=1.0f, unsigned int flagModifier=0)
Displays 2D textured triangles.
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)
Displays 2D textured triangles for selection.
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, const SBSpatialTransform & transform=SBSpatialTransform::identity, unsigned int nodeIndexModifier=0)
Displays 3D textured triangles for selection.
void displayTip (int x, int y, const std::string & tip)
Displays a tip.
void displayTip (const QPoint & position, const std::string & tip)
Displays a tip.
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, 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.
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, float opacity=1.0f, unsigned int flagModifier=0)
Displays 2D triangles.
void displayTrianglesOrthoSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int * indexData, const float * positionData, const unsigned int * nodeIndexData, bool reverseViewport=true)
Displays 2D triangles for selection.
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.
void displayTubes (unsigned int nPositions, unsigned int ovalDetail, float * ovalCenter, float * majorAxis, float * minorAxis, float * color, unsigned int * flags, unsigned int triangleReduction, bool shadowPassFlag=false, const SBSpatialTransform & transform=SBSpatialTransform::identity, float opacity=1.0f, unsigned int flagModifier=0)
Displays tubes.
void displayTubesSelection (unsigned int nPositions, unsigned int ovalDetail, float * ovalCenter, float * majorAxis, float * minorAxis, unsigned int * nodeIndex, unsigned int triangleReduction, const SBSpatialTransform & transform=SBSpatialTransform::identity)
Displays tubes for selection.
bool documentSignalIsConnectedToSlot (SBCReferenceTarget * referenceTarget, void(SBCReferenceTarget::*)(SBDocumentEvent *) functionPointer)
Returns true if and only if the document signal is connected to the slot.
void enableHolding ()
Resumes holding.
void enableViewportNodeHighlighting ()
Enables automatic node highlighting in the viewport.
void endHolding ()
Ends holding.
void exportToFile (const SBNodeIndexer & nodeIndexer, const std::string & fileName, const SBValueMap & parameterMap=SBValueMap{}, SBIFileExporter * exporter=nullptr)
Export a selection of nodes to a file.
unsigned int generateTexture (const QImage & textureImage)
Generate an OpenGL texture from a QImage and returns its id.
SBAction * getAction (const SBUUID & actionUUID)
Returns the action with the given actionUUID .
QAction * getAction (const QString & className)
Returns the first found action with the given className .
QAction * getActionByText (const QString & text)
Returns the first found action with the given text .
SBActionWidget * getActionWidget (const SBUUID & actionWidgetUUID)
Returns the action widget with the given actionWidgetUUID .
const SBAsset * getActiveAsset ()
Returns the active asset.
SBDDocumentCamera * getActiveCamera ()
Returns a pointer to the active camera .
SBDDocument * getActiveDocument ()
Returns a pointer to SAMSON's active document .
std::string getActiveDocumentFilter ()
Returns the node filter of the active document.
SBEditor * getActiveEditor ()
Returns a pointer to the current editor.
const SBNodePredicate & getActiveSelectionFilter ()
Returns the active selection filter.
std::string getActiveSelectionFilterNSL ()
Returns the active selection filter NSL string.
std::string getActiveSelectionFilterName ()
Returns the active selection filter name.
SBStructuralModel * getActiveStructuralModel ()
Returns a pointer to the active structural model.
bool getAddWatermarkFlag ()
Returns true when a watermark should be added to presentation movies and frames.
float getAmbientLight ()
Returns the ambient light.
SBApp * getApp (const SBUUID & appUUID, const SBUUID & elementUUID=SBUUID())
Returns the app corresponding to a specific appUUID andelementUUID .
SBAtom * getAtom (int x, int y)
Returns the atom at location ( x ,y ) in the viewport.
SBAtom * getAtom (const QPoint & position)
Returns the atom at location position in the viewport.
const SBQuantity::length & getAtomRadius ()
Returns the radius of atoms in the default representation of structural models (when a constant radius is used)
SBQuantity::mass getAtomicWeight (SBMElement::Type element)
Returns the atomic weight of periodic table element element .
float getBackgroundProgress ()
Returns the progress between the current background (0) and the next background (1)
std::string getBlock (SBMElement::Type element)
Returns the block of periodic table element element .
SBBond * getBond (int x, int y)
Returns the bond at location ( x ,y ) in the viewport.
SBBond * getBond (const QPoint & position)
Returns the bond at location position in the viewport.
const SBQuantity::length & getBondRadius ()
Returns the radius of bonds in the default representation of structural models.
bool getCameraControllerFlag ()
Returns true when the camera controller should be displayed in the viewport.
bool getChoiceFromUser (const QString & dialogTitle, int & resultIndex, const QString & label, const QStringList & choices, const QStringList & toolTips, const QList< QPixmap > & icons, const QPixmap & logo=QPixmap(), int iconSize=60)
Gets a choice from the user in a modal pop-up dialog.
bool getColorFromUser (const QString & dialogTitle, SBColor & result, const QPixmap & logo=QPixmap())
Gets a color from the user in a modal pop-up dialog.
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 .
SBQuantity::length getCovalentRadius (SBMElement::Type element)
Returns the covalent radius of periodic table element element .
SBQuantity::length getCovalentRadius (SBMElement::Type element, int bondType)
Returns the covalent radius of periodic table element element for bond typebondType (1 for single bond, 2 for double bond, 3 for triple bond, for other values it returnsgetCovalentRadius() )
bool getCredentialsFromUser (const QString & dialogTitle, QString & user, QString & password, const QPixmap & logo=QPixmap())
Gets credentials from the user in a modal pop-up dialog.
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.
const float * getCurrentBackgroundBottomColor ()
Returns the top color of the current background.
QString getCurrentBackgroundImageFileName ()
Returns the file name of the current background image.
bool getCurrentBackgroundImageFlag ()
Returns true when the current background should show an image from a file.
int getCurrentBackgroundImageMode ()
Returns the display mode of the current background image (0: contained in the viewport, 1: covering the viewport)
const float * getCurrentBackgroundTopColor ()
Returns the top color of the current background.
QCursor getCursor (const QString & cursorName, const SBUUID & uuid)
Returns the cursor with the given name cursorName , the given element uuiduuid .
bool getDarkModeFlag ()
Returns true when dark mode is on.
QImage getDarkWatermark ()
Returns the dark watermark.
bool getDeepSelectionFlag ()
Returns whether the user wants deep selection.
SBPointerList< SBDDocument > const * getDocumentList ()
Returns the list of open documents .
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.
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.
SBEditor * getEditor (const SBUUID & classUUID, const SBUUID & elementUUID)
Returns the editor corresponding to a specific classUUID andelementUUID .
SBIndexer< SBEditor * > const * getEditorIndexer ()
Returns the editor indexer.
SBQuantity::dimensionless getElectronegativity (SBMElement::Type element)
Returns the electronegativity of periodic table element element .
const SBElement & getElement (SBMElement::Type element)
Returns the periodic table element corresponding to a given type.
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.
std::string getElementName (SBMElement::Type element)
Returns the name of the periodic table element corresponding to a given type.
std::string getElementSymbol (SBMElement::Type element)
Returns the symbol of the periodic table element corresponding to a given type.
SBElement::Type getElementTypeByName (char * elementName)
Returns the periodic table element type corresponding to a given name.
SBElement::Type getElementTypeByName (const std::string & elementName)
Returns the periodic table element type corresponding to a given name.
SBElement::Type getElementTypeBySymbol (char * elementSymbol)
Returns the periodic table element type corresponding to a given symbol.
SBElement::Type getElementTypeBySymbol (const std::string & elementSymbol)
Returns the periodic table element type corresponding to a given symbol.
SBMElement *const * getElementVector ()
Returns the complete periodic table element vector.
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.
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.
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.
bool getFontFromUser (const QString & dialogTitle, QFont & result, const QPixmap & logo=QPixmap())
Gets a font from the user in a modal pop-up dialog.
const float * getFresnelColor ()
Returns the Fresnel color.
float getFresnelIntensity ()
Returns the Fresnel intensity.
float getFresnelPower ()
Returns the Fresnel power.
std::string getGPUInfo ()
Returns a string with the user's GPU name.
SBNodeGUI * getGUI (SBNode * node)
Returns the GUI of a node.
bool getGridFlag ()
Returns true when the grid should be displayed in the viewport.
unsigned int getGroup (SBMElement::Type element)
Returns the group of periodic table element element .
const float * getHighlightingColor ()
Returns the highlighting color.
float getHighlightingOpacity ()
Returns the highlighting opacity.
QIcon getIcon (const QString & iconName, const SBUUID & uuid)
Returns the icon with the given name iconName the given element uuiduuid .
SBPointerIndexer< SBApp > const * getInitializedAppIndexer (bool forceInitialization=false)
Returns the initialized app indexer.
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.
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.
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.
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.
const float * getLightColor (unsigned int lightIndex)
Returns the light color of light lightIndex .
const float * getLightDirection (unsigned int lightIndex)
Returns the light direction of light lightIndex .
float getLightIntensity (unsigned int lightIndex)
Returns the light intensity of light lightIndex .
QImage getLightWatermark ()
Returns the light watermark.
void getLikeFromUser (const SBCContainerUUID & developerUUID, const SBCContainerUUID & extensionUUID)
Asks the user to like an extension.
int getMaximum3DTextureSize ()
Returns the maximum 3D texture size.
int getMaximumRectangleTextureSize ()
Returns the maximum rectangle texture size.
int getMaximumTextureSize ()
Returns the maximum texture size.
bool getMinimizationFlag ()
Returns true when interactive Minimization is on.
QPoint getMousePositionInViewport ()
Returns the current mouse position in viewport coordinates.
unsigned int getMultiSampleFactor ()
Returns the multisampling factor.
bool getMultipleBondDisplayFlag ()
Returns true when bonds are displayed with a variable number of cylinders to represent their order.
const float * getNextBackgroundBottomColor ()
Returns the top color of the next background.
QString getNextBackgroundImageFileName ()
Returns the file name of the next background image.
bool getNextBackgroundImageFlag ()
Returns true when the next background should show an image from a file.
int getNextBackgroundImageMode ()
Returns the display mode of the next background image (0: contained in the viewport, 1: covering the viewport)
const float * getNextBackgroundTopColor ()
Returns the top color of the next background.
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 ending with suffixsuffix for nodes of typetype in parent nodeparentNode or in the active document ifparentNode is null.
SBNode * getNode (int x, int y, const SBNodePredicate & selectionFilter=SBNode::All())
Returns the node at location ( x ,y ) in the viewport according to theselectionFilter .
SBNode * getNode (const QPoint & position, const SBNodePredicate & selectionFilter=SBNode::All())
Returns the node at location position in the viewport according to theselectionFilter .
SBNode * getNode (int x, int y, SBPosition3 & pickedPosition, const SBNodePredicate & selectionFilter=SBNode::All())
Returns the node at location ( x ,y ) in the viewport and thepickedPosition according to theselectionFilter .
SBNode * getNode (const QPoint & position, SBPosition3 & pickedPosition, const SBNodePredicate & selectionFilter=SBNode::All())
Returns the node at location position in the viewport and thepickedPosition according to theselectionFilter .
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 ) intonodeIndexer according to theselectionFilter .
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 ) intonodeIndexer according to theselectionFilter .
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 intonodeIndexer according to theselectionFilter .
void getNodes (SBNodeIndexer & nodeIndexer, const std::string & selectionString)
Collects nodes from the active document into nodeIndexer based on aselectionString .
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 anodeType , a selection status and avisitPredicate , with or without dependencies.
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 aselectionPredicate and avisitPredicate , with or without dependencies.
unsigned int getNumberOfElements ()
Returns the number of defined periodic table elements, including the Unknown element.
SB_OPENGL_FUNCTIONS * getOpenGLFunctions ()
Returns a pointer to the OpenGL functions.
SBPalette * getPaletteFromUser (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.
bool getPathFromUser (const QString & dialogTitle, QString & result, const QPixmap & logo=QPixmap())
Gets a path from the user in a modal pop-up dialog.
std::string getPeriod (SBMElement::Type element)
Returns the period of periodic table element element .
QPixmap getPixmap (const QString & pixmapName, const SBUUID & uuid)
Returns the pixmap with the given name pixmapName , the given element uuiduuid .
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.
SBValue getPreference (const SBCContainerUUID & classUUID, const std::string & preferenceName)
Returns the value of preference preferenceName for the class with UUIDclassUUID .
unsigned int getPreferenceSize (const SBCContainerUUID & classUUID, const std::string & preferenceName)
Returns the size of preference preferenceName in the class with UUIDclassUUID when relevant.
int getProgressBarValue ()
Returns the current value of the progress bar.
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.
SBProxy * getProxy (const SBCContainerUUID & classUUID)
Returns the proxy of a class.
SBProxy * getProxy (const std::string & className, const SBUUID & elementUUID=SBUUID())
Returns the proxy of a class.
SBIndexer< SBProxy * > const * getProxyIndexer (SBCClass::Type classType)
Returns all proxies corresponding to a given class type classType .
std::string getPublicName (bool includeVersion=false, bool includeHashInVersion=false)
Returns the public name of SAMSON.
std::string getPublicVersionNumber ()
Returns the "public version number" of SAMSON.
void getReplyFromUser (const SBCContainerUUID & developerUUID, const SBCContainerUUID & questionUUID)
Asks the user to reply to a question.
std::string getSAMSONElementsPath ()
Returns the path where SAMSON Extensions (previously called SAMSON Elements) are installed.
std::string getSAMSONPath ()
Returns the path where SAMSON is installed.
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.
bool getScaleFlag ()
Returns true when the scale should be displayed in the viewport.
std::string getScratchPath ()
Returns the path to scratch data.
const float * getSelectionColor ()
Returns the selection color.
float getSelectionOpacity ()
Returns the selection opacity.
float getSelectionOutlineOpacity ()
Returns the selection outline opacity.
QString getShortcutString (QKeySequence keySequence)
Returns the shortcut string corresponding to a specific keySequence .
bool getSimulationFlag ()
Returns true when interactive simulation is on.
float getSpecularIntensity (unsigned int lightIndex)
Returns the specular intensity of light lightIndex .
float getSpecularPower (unsigned int lightIndex)
Returns the specular power of light lightIndex .
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.
SBCTime getTime ()
Returns SAMSON's internal time.
bool getTransparentBackgroundFlag ()
Returns true when the background should be transparent.
bool getUserAcademicFlag ()
Returns true when the user is an academic.
std::string getUserDataPath ()
Returns the path where user data is installed.
SBUserPlan getUserPlan ()
Returns the user plan.
std::string getUserPlanString ()
Returns a string containing the user plan.
bool getVanDerWaalsAtomRadiusFlag ()
Returns true when atoms are displayed with a radius proportional to their van der Waals radius.
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)
SBQuantity::length getVanDerWaalsRadius (SBMElement::Type element)
Returns the van der Waals radius of periodic table element element .
SBCContainerVersionNumber getVersionNumber ()
Returns the version number of SAMSON.
QFont getViewportFont ()
Returns the font used for text in the viewport.
int getViewportHeight ()
Returns the viewport height.
double getViewportPixelRatio ()
Returns the viewport pixel ratio.
SBVector3 getViewportPositionFromWorldPosition (const SBPosition3 & position)
Returns the projection in the viewport of a given world position .
int getViewportWidth ()
Returns the viewport width.
SBPosition3 getWorldPositionFromViewportPosition (double x, double y)
Returns the 3D position that corresponds to the viewport location ( x ,y )
SBPosition3 getWorldPositionFromViewportPosition (double x, double y, const SBPosition3 & pointInPlane)
Returns the 3D position that corresponds to the viewport location ( x ,y ) in the plane containingpointInPlane .
SBPosition3 getWorldPositionFromViewportPosition (const QPoint & position)
Returns the 3D position that corresponds to the viewport location ( x ,y )
SBPosition3 getWorldPositionFromViewportPosition (const QPoint & position, const SBPosition3 & pointInPlane)
Returns the 3D position that corresponds to the viewport location ( x ,y ) in the plane containingpointInPlane .
bool hasNode (const std::string & selectionString)
Checks for the presence nodes in the active document based on a selectionString .
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 avisitPredicate , with or without dependencies.
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 avisitPredicate , with or without dependencies.
void hideProgressBar ()
Hides the progress bar.
void hideTip ()
Hides the last tip window.
void hold (void * object)
Holds an object.
void hold (SBNode * node)
Holds a node and its descendants.
void hold (SBUndoCommand * undoCommand)
Holds a command.
void hold (SBPointerTarget * pointerTarget)
Holds a pointer target allocated on the heap.
void holdArray (void * array)
Holds an array allocated on the heap.
void importFromFile (const std::string & fileName, const SBValueMap & parameterMap=SBValueMap{}, SBDDocumentFolder * preferredFolder=nullptr, SBIFileImporter * importer=nullptr)
Import a file from the disk.
void importFromFile (const QStringList & fileNameList, const SBValueMap & parameterMap=SBValueMap{}, SBDDocumentFolder * preferredFolder=nullptr, SBIFileImporter * importer=nullptr)
Import files from the disk.
void informUser (const QString & dialogTitle, const QString & dialogText, const QPixmap & logo=QPixmap())
Informs the user with a message in a modal pop-up dialog.
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.
void informUser (SBGWindowWidget * widget, const QPixmap & logo=QPixmap())
Informs the user with a widget in a modal pop-up dialog.
void informUser (QWidget * widget, const QPixmap & logo=QPixmap())
Informs the user with a widget in a modal pop-up dialog.
bool isGUIThread ()
Returns true if called from the main thread (GUI thread), else return false.
bool isHolding ()
Returns true when SAMSON is holding.
bool isProgressBarStopped ()
Returns true when the progress bar is stopped.
bool isRedoing ()
Returns true while redoing.
bool isShowingTip (const SBUUID & tipUUID=SBUUID())
Returns whether a tip is being shown.
bool isUndoing ()
Returns true while undoing.
SBAnimation * makeAnimation (const std::string & name, const SBNodeIndexer & nodeIndexer, double currentFrame, const std::string & animationClassName, const SBUUID & animationElementUUID=SBUUID(), const SBValueMap & animationParameterMap=SBValueMap{})
Makes an animation.
SBController * makeController (const std::string & controllerClassName, const SBUUID & controllerElementUUID=SBUUID(), const SBValueMap & controllerParameterMap=SBValueMap{})
Makes a controller.
SBInteractionModelParticleSystem * makeInteractionModel (SBParticleSystem * dynamicalModel, const std::string & interactionModelClassName, const SBUUID & interactionModelElementUUID=SBUUID(), const SBValueMap & interactionModelParameterMap=SBValueMap{})
Makes an interaction model.
SBSNeighborSearchParticleSystem * makeNeighborSearch (SBParticleSystem * dynamicalModel, const SBQuantity::length & cutoffDistance, const std::string & neighborSearchClassName, const SBUUID & neighborSearchElementUUID=SBUUID())
Makes a neighbor search algorithm.
SBNodePredicate * makeNodePredicate (const std::string & selectionString)
Make a node predicate based on a selectionString .
SBPropertyModel * makePropertyModel (const SBNodeIndexer & nodeIndexer, const std::string & propertyModelClassName, const SBUUID & propertyModelElementUUID=SBUUID(), const SBValueMap & propertyModelParameterMap=SBValueMap{})
Makes a property model.
SBNodeSelector * makeSelector (const std::string & selectorClassName, const SBUUID & selectorElementUUID=SBUUID(), const SBValueMap & selectorParameterMap=SBValueMap{})
Makes a selector.
SBSimulatorParticleSystem * makeSimulator (const SBNodeIndexer & nodeIndexer, const std::string & interactionModelClassName, const SBUUID & interactionModelElementUUID, const SBValueMap & interactionModelParameterMap, const std::string & stateUpdaterClassName, const SBUUID & stateUpdaterElementUUID=SBUUID(), const SBValueMap & stateUpdaterParameterMap=SBValueMap{})
Makes a simulator.
SBStateUpdaterParticleSystem * makeStateUpdater (SBParticleSystem * dynamicalModel, SBInteractionModelParticleSystem * interactionModel, const std::string & stateUpdaterClassName, const SBUUID & stateUpdaterElementUUID=SBUUID(), const SBValueMap & stateUpdaterParameterMap=SBValueMap{})
Makes a state updater.
QCursor makeViewportCursor (const QString & fileName, int height, int hotX=-1, int hotY=-1)
Makes a viewport cursor.
SBVisualModel * makeVisualModel (const SBNodeIndexer & nodeIndexer, const std::string & visualModelClassName, const SBUUID & visualModelElementUUID=SBUUID(), const SBValueMap & visualModelParameterMap=SBValueMap{})
Makes a visual model.
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.
bool openPreferences (const QString & pageName)
Opens the Preferences at the given page pageName .
bool openPreferences (const SBUUID & uuid)
Opens the Preferences at the page corresponding to the UUID uuid of a class which settings are exposed in Preferences.
void printDataGraphState ()
Prints the data graph state.
void printFullMemoryUsage ()
Prints full memory usage.
void printMemoryUsage ()
Prints memory usage.
void printRendererState ()
Prints the renderer state.
void printUndoStack ()
Prints the undo stack.
void redo ()
Redo one command.
void registerAction (SBAction * action)
Registers a new action visible for all users.
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 uuiduuid , the given descriptiondescription , the given filePathfilePath .
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 uuiduuid , the given descriptiondescription , the given iconicon .
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 uuiduuid , the given descriptiondescription , the given filePathfilePath .
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 uuiduuid , the given descriptiondescription , the given iconicon .
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 uuiduuid , the given descriptiondescription , the given filePathfilePath .
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 uuiduuid , the given descriptiondescription , the given pixmappixmap .
void removeDialog (SBGWindowDialog * dialog)
Removes a SAMSON dialog from the user interface.
void removeDialog (QDialog * dialog)
Removes a Qt dialog from the user interface.
void removeDocument (SBDDocument * document)
Removes a document from the list of opendocuments .
void removeFromSelection (const std::string & selectionString)
Removes nodes from the active document to the selection based on a selectionString .
void removeWidget (SBGWindowWidget * widget)
Removes a SAMSON widget from the user interface.
void removeWidget (QWidget * widget)
Removes a Qt widget from the user interface.
void removeWindow (SBGWindow * window)
Removes a window from the user interface.
void requestViewportFocus ()
Requests a viewport focus.
void requestViewportUpdate ()
Requests a viewport update.
bool runPythonCode (const std::string & codeString, bool raisePythonConsole=false)
Executes Python code codeString in the Python Console. IfraisePythonConsole istrue then it raises the Python Console.
bool runPythonFile (const std::string & fileName, bool raisePythonConsole=false)
Executes Python script file fileName in the Python Console. IfraisePythonConsole istrue then it raises the Python Console.
void select (const std::string & selectionString)
Selects nodes from the active document based on a selectionString .
void setActiveDocument (SBDDocument * document)
Sets the active document .
void setActiveDocumentFilter (const std::string & filter)
Sets the node filter of the active document.
void setActiveEditor (SBEditor * editor)
Sets the current editor.
void setActiveEditor (const SBUUID & classUUID, const SBUUID & elementUUID)
Sets the current editor.
bool setActiveSelectionFilterByName (const std::string & selectionFilterName)
Sets the active selection filter according to the given name selectionFilterName . Returns true in case of the success.
void setActiveStructuralModel (SBStructuralModel * structuralModel)
Sets the active structural model.
void setBusy (bool b)
Notifies the user that SAMSON is busy.
void setCustomViewport (QWidget * widget=0)
Replaces the viewport with a custom widget. When widget is equal to 0, the normal viewport is restored.
bool setHeadsetParameters (int panelWidth, int panelHeight, unsigned int leftFrameBuffer, unsigned int rightFrameBuffer)
Sets the panel size of the headset.
void setMinimizationFlag (bool minimizationFlag)
Sets the interactive Minimization flag.
void setPreference (const SBCContainerUUID & classUUID, const std::string & preferenceName, const SBValue & value, const SBValue & size=0)
Sets the value of preference preferenceName for the class with UUIDclassUUID tovalue .
void setProgressBarValue (int value)
Sets the value of the progress bar.
void setSimulationFlag (bool simulationFlag)
Sets the interactive simulation flag.
void setStatusMessage (const QString & message, int time=0)
Shows a message in the status bar.
void setViewportCursor (const QCursor & cursor)
Sets the viewport cursor.
void setViewportCursor (Qt::CursorShape cursorShape)
Sets the viewport cursor.
void setup ()
Initializes the SAMSON environment.
void showContextMenu (const QPoint & position, SBNode * highlightedNode=0)
Shows the context menu.
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.
bool showProperties (SBNode * node)
Shows the properties widget of a node.
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 texttipText at the positionrelativePosition relative to a widgetwidget .
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 , texttipText , and imagetipPixmap at the positionrelativePosition relative to a widgetwidget .
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 , texttipText , and gif-movietipMovie at the positionrelativePosition relative to a widgetwidget .
void signalPathTracingCompleted ()
Signals a path tracing completion.
void signalPathTracingStarted ()
Signals a path tracing start.
void signalPathTracingUpdated (int progress)
Signals a path tracing update.
QPoint snap (int x, int y)
Returns the snapped mouse viewport displacement ( x ,y )
QPoint snap (int x, int y, const SBPosition3 & pointInPlane)
Returns the snapped mouse viewport displacement ( x ,y ) in the plane containingpointInPlane .
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 .
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 .
SBLength3 snap (const SBLength3 & displacement)
Returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement .
SBMatrix33 snap (const SBMatrix33 & rotationMatrix)
Returns the snapped rotation matrix if the snapping of angular displacements is on, else it returns the unchanged rotationMatrix .
SBSpatialTransform snap (const SBSpatialTransform & transform)
Returns the snapped spatial transform according to the translational and angular snapping parameters.
void startMinimization ()
Starts interactive Minimization.
void startSimulation ()
Starts interactive simulation.
void startTimer ()
Starts a new performance timer.
void stopMinimization ()
Stops interactive Minimization.
void stopSimulation ()
Stops interactive simulation.
void stopTimer (SBQuantity::second & elapsedTime)
Stops the top performance timer.
void stopTimer (SBQuantity::second & elapsedTime, SBQuantity::second & totalTime)
Stops the top performance timer.
void toggleMinimization ()
Toggles interactive Minimization on and off.
void toggleSimulation ()
Toggles interactive simulation on and off.
void undo ()
Undo one command.
void unsetViewportCursor ()
Unsets the viewport cursor.
bool updateHeadsetViewport (bool isLeftEye)
Updates the headset viewport.

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();

Time#

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

SBTime currentTime = SAMSON::getTime();
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

See also: getTime, startTimer, stopTimer(SBQuantity::second&), stopTimer(SBQuantity::second&, SBQuantity::second&)

See also: SAMSON's unit system

Directories#

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

std::string scratchPath = SAMSON::getScratchPath();

Furthermore, the SB_ELEMENT_PATH macro provides an 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"));

See also: getSAMSONPath, getSAMSONElementsPath, getUserDataPath, getScratchPath, SB_ELEMENT_PATH

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

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 (see rendering), 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());

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 (see rendering), which displays a visual representation of the data graph.

The viewport dimensions may be retrieved with:

int width = SAMSON::getViewportWidth();
int height = SAMSON::getViewportHeight();
and the mouse position in viewport coordinates (see rendering) can be obtained with:
QPoint mousePosition = SAMSON::getMousePositionInViewport();

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 (see SAMSON's unit system).

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

SBPosition3 worldPosition;
worldPosition = SAMSON::getWorldPositionFromViewportPosition(mousePosition); 

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); 

Note that the returned viewport position is a dimensionless physical vector (see SAMSON's unit system). 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(double, double) , getWorldPositionFromViewportPosition(double, double, 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 (see rendering). 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);

Global lighting parameters may also be accessed:

float ambientLight = SAMSON::getAmbientLight();
float fresnelPower = SAMSON::getFresnelPower();
float fresnelIntensity = SAMSON::getFresnelIntensity();
const float* fresnelColor = SAMSON::getFresnelColor();

See also: rendering

Version number#

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

SBVersionNumber currentVersion = SAMSON::getVersionNumber();

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

See also: Versioning

See also: SBCContainerVersionNumber

Periodic table#

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

SBQuantity::length r = SAMSON::getCovalentRadius(SBElement::Carbon);

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);

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";
SBGWindow::WindowOption format = SBGWindow::Lockable | SBGWindow::Savable;
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);

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);
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");
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?");
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&, const QPixmap&) , informUser(SBGWindowWidget*, const QPixmap&) , askUser(const QString&, const QString&, QDialogButtonBox*, const QPixmap&) , askUser(SBGWindowWidget*, QDialogButtonBox*, const QPixmap&)

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);
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++) {

    if (SAMSON::isProgressBarStopped()) break;

    SAMSON::setProgressBarValue(i);

    // do something

    ...

}

SAMSON::hideProgressBar();

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

See also: Undo and redo

See also: isHolding, beginHolding, disableHolding, enableHolding, endHolding, hold, undo, redo, isUndoing, isRedoing

Files#

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

SAMSON::importFromFile("1YRF.pdb");
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 (see rendering). 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 indices instead of colors.

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

See also: rendering

See also: 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. 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("SEMyApp");

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

SBProxy* classProxy = SAMSON::getProxy("SEMyApp", "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 MyInteractionModel : public class SBMInteractionModelParticleSystem {

    MyInteractionModel(SBMDynamicalModelParticleSystem* dynamicalModel);    
    ~MyInteractionModel();

    ...

    virtual void updateInteractions();

    ...

};

Then, an instance of this class can be created as follows (you can also provide an UUID of the extension with the interaction model class as the third argument if there is a risk that this class name can be exposed by other SAMSON Extensions):

SBMInteractionModelParticleSystem* interactionModel = 
    SAMSON::makeInteractionModel(dynamicalModel, "MyInteractionModel");
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

See also: makeController , makeInteractionModel , makeNeighborSearch , makeStateUpdater , makeSimulator , makeVisualModel , makePropertyModel , 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);

See also: data graph

See also: showProperties

Public Static Functions Documentation#

function addDialog [1/2]#

Adds a SAMSON dialog to the user interface.

static SBGWindow * SAMSON::addDialog (
    SBGWindowDialog * dialog
) 

Adds a SAMSON dialog to the user interface.

Parameters:

  • dialog Pointer to the dialog to add.

Returns:

Pointer to the created SBGWindow that hosts the dialog.


function addDialog [2/2]#

Adds a Qt dialog to the user interface.

static SBGWindow * SAMSON::addDialog (
    QDialog * dialog,
    QString name="",
    int format=SBGWindow::NoOptions,
    QPixmap logo=QPixmap(),
    SBUUID uuid=SBUUID ()
) 

Parameters:

  • dialog Pointer to the QDialog to add.
  • name Optional window name (default empty).
  • format Window format flags (default SBGWindow::NoOptions).
  • logo Optional logo pixmap (default empty).
  • uuid Optional UUID for the window (default nil).

Returns:

Pointer to the created SBGWindow that hosts the dialog.


function addDockWidget#

Adds a SAMSON widget to the user interface as a dockable window.

static SBGWindowDock * SAMSON::addDockWidget (
    SBGWindowWidget * widget,
    Qt::DockWidgetArea area=Qt::RightDockWidgetArea,
    bool visible=true,
    bool spacer=true
) 

Adds a SAMSON widget as a dockable window in the user interface.

Parameters:

  • widget Pointer to the widget to dock.
  • area Desired dock area (default Qt::RightDockWidgetArea).
  • visible true to make the dock visible initially.
  • spacer true to add a spacer around the widget.

Returns:

Pointer to the created SBGWindowDock that hosts the widget.


function addDocument#

Adds a document to the list of opendocuments .

static void SAMSON::addDocument (
    SBDDocument * document
) 

Adds a document to the open document list.

Registers the given document with SAMSON's document manager.

Parameters:

  • document Pointer to the document to add.

function addToSelection#

Adds nodes from the active document to the selection based on a selectionString .

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

Adds nodes from the active document to the current selection based on a NSL selection string.

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

Parameters:

  • selectionString A NSL expression string describing the selection.

For example:

SAMSON::addToSelection("node.type residue within 4A of S");
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: NSL


function addWidget [1/2]#

Adds a SAMSON widget to the user interface.

static SBGWindow * SAMSON::addWidget (
    SBGWindowWidget * widget
) 

Adds a SAMSON widget to the user interface.

Parameters:

  • widget Pointer to the widget to add.

Returns:

Pointer to the created SBGWindow that hosts the widget.


function addWidget [2/2]#

Adds a Qt widget to the user interface.

static SBGWindow * SAMSON::addWidget (
    QWidget * widget,
    QString name="",
    int format=SBGWindow::NoOptions,
    QPixmap logo=QPixmap(),
    SBUUID uuid=SBUUID ()
) 

Parameters:

  • widget Pointer to the QWidget to add.
  • name Optional window name (default empty).
  • format Window format flags (default SBGWindow::NoOptions).
  • logo Optional logo pixmap (default empty).
  • uuid Optional UUID for the window (default nil).

Returns:

Pointer to the created SBGWindow that hosts the widget.


function appIsInitialized#

Returns true or false if an app corresponding to a specificappUUID andelementUUID is initialized already.

static bool SAMSON::appIsInitialized (
    const SBUUID & appUUID,
    const SBUUID & elementUUID=SBUUID ()
) 

Checks whether an app is already initialized.

This function returns true if an application corresponding to the specified UUIDs has been initialized within SAMSON.

Parameters:

  • appUUID The UUID of the app.
  • elementUUID The UUID of the element associated with the app (optional, may be empty).

Returns:

true if the app is initialized; otherwise false.


function askUser [1/4]#

Asks a question to the user with a message in a modal pop-up dialog.

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

Asks the user a question with a title and message in a modal pop-up dialog, returning true if OK is pressed.

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?");

Parameters:

  • dialogTitle Title of the dialog.
  • dialogText Message text displayed in the dialog.
  • buttonBox Optional custom button box for the dialog.
  • logo Optional logo pixmap displayed in the dialog.

Returns:

true if the user pressed OK, false otherwise.

See also: askUser


function askUser [2/4]#

Asks a question to the user with a message and text in a modal pop-up dialog.

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

Asks the user a question with a title, label, and text in a modal pop-up dialog, returning true if OK is pressed.

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");

Parameters:

  • dialogTitle Title of the dialog.
  • labelText Label text displayed above the main text.
  • text Main text content displayed in the dialog.
  • monospaceFont If true, uses a monospace font for the text.
  • buttonBox Optional custom button box for the dialog.
  • logo Optional logo pixmap displayed in the dialog.

Returns:

true if the user pressed OK, false otherwise.

See also: informUser


function askUser [3/4]#

Asks a question to the user with a widget in a modal pop-up dialog.

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

Asks the user a question using a custom widget in a modal pop-up dialog, returning true if OK is pressed.

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;

Parameters:

  • widget Custom widget to display in the dialog.
  • buttonBox Optional custom button box for the dialog.
  • logo Optional logo pixmap displayed in the dialog.

Returns:

true if the user pressed OK, false otherwise.

See also: informUser


function askUser [4/4]#

Asks a question to the user with a widget in a modal pop-up dialog.

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

Asks the user a question using a custom widget in a modal pop-up dialog, returning true if the user confirmed the dialog.

Shows a modal dialog containing the specified widget, optionally with a buttonBox for custom buttons and a logo displayed in the dialog.

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;

Parameters:

  • widget The widget to display in the dialog.
  • buttonBox Optional pointer to a QDialogButtonBox for custom button configuration; may be nullptr.
  • logo Optional QPixmap displayed as a logo in the dialog.

Returns:

true if the user confirmed the dialog, false otherwise.

See also: informUser Asks the user a question using a custom widget.


function beginHolding#

Begins holding.

static void SAMSON::beginHolding (
    const std::string & name
) 

Begins a holding operation with the given name.

Parameters:

  • n Name of the holding operation.

function canImportFromFile#

Returns true when the files can be imported.

static bool SAMSON::canImportFromFile (
    const std::string & fileName
) 

Checks whether a file can be imported.

Determines if the specified file can be imported by the application.

Parameters:

  • fileName The name of the file to check.

Returns:

true if the file can be imported; false otherwise.


function captureViewport [1/2]#

Captures the viewport.

static QImage SAMSON::captureViewport (
    int width,
    int height,
    bool transparentBackground=false,
    bool usePathTracing=false,
    bool showProgressBar=true
) 

Captures an image of the viewport.

This function captures the current view of the viewport with the specified width and height. The capture can optionally have a transparent background, use path tracing for higher quality, and display a progress bar during the capture process.

Parameters:

  • width The width of the captured image in pixels.
  • height The height of the captured image in pixels.
  • transparentBackground If true, the background of the capture is rendered transparent.
  • usePathTracing If true, path tracing is used to generate the capture.
  • showProgressBar If true, a progress bar is shown during the capture.

Returns:

A QImage containing the captured viewport image.


function captureViewport [2/2]#

Captures the viewport.

static void SAMSON::captureViewport (
    const std::string & fileName,
    int width,
    int height,
    bool transparentBackground=false,
    bool usePathTracing=false,
    bool showProgressBar=true
) 

Captures an image of the viewport and saves it to a file.

This function captures the viewport with the specified dimensions and options, then writes the resulting image to the given file name. The image is saved with a quality setting of 80.

Parameters:

  • fileName The file path where the captured image will be saved.
  • width The width of the captured image in pixels.
  • height The height of the captured image in pixels.
  • transparentBackground If true, the background of the capture is rendered transparent.
  • usePathTracing If true, path tracing is used to generate the capture.
  • showProgressBar If true, a progress bar is shown during the capture.

function connectDocumentSignalToSlot#

Connects the document signal to a slot.

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

Connects a slot to receive document events.

This function allows for listening to document events (SBDDocumentEvent) such as SBDDocumentEvent::Type::ActiveDocumentChanged, SBDDocumentEvent::Type::DocumentAdded, etc.

For example, an application can define a handler method:

void MyApp::onDocumentEvent(SBDocumentEvent* event) {
    switch (event->getType()) {
        case SBDDocumentEvent::Type::ActiveDocumentChanged:
            // handle event
            break;
        default:
            break;
    }
}

The slot can then be connected using:

SAMSON::connectDocumentSignalToSlot(this, SB_SLOT(&MyApp::onDocumentEvent));

Parameters:

  • referenceTarget The object that will receive the document events.
  • functionPointer Pointer to the member function that handles the document event.
  • nextReferenceTarget Optional second target for chaining signals; may be nullptr.
  • nextFunctionPointer Optional second function pointer for chaining signals; may be nullptr.

See also: documentSignalIsConnectedToSlot

See also: disconnectDocumentSignalFromSlot


function countNodes [1/3]#

Counts nodes in the active document based on a selectionString .

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

Returns the number of nodes in the active document that match the given selection string.

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

Parameters:

  • selectionString A NSL 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").

Returns:

Returns the count of nodes matching the selection string.

See also: NSL


function countNodes [2/3]#

Counts nodes in the active document based on a nodeType , a selection status and avisitPredicate , with or without dependencies.

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

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

Parameters:

  • nodeType A type of nodes (SBNode::Type) that should be counted.
  • selectedNodesOnly If set to true, then only nodes that are selected, directly or via their parents, will be traversed.
  • visitPredicate A predicate that describes what nodes should be visited in the active document.
  • includeDependencies Whether 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:

unsigned int n = SAMSON::countNodes(SBNode::Residue);
counts the number of residue nodes in the active document.

Returns:

Returns the count of nodes of the specified type that match the criteria.

See also: SBNode::getNodes , SBNodeIndexer , SBNodePredicate


function countNodes [3/3]#

Counts nodes in the active document based on a selectionPredicate and avisitPredicate , with or without dependencies.

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

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

Parameters:

  • selectionPredicate A predicate that describes what nodes should be counted in the active document.
  • visitPredicate A predicate that describes what nodes should be visited in the active document.
  • includeDependencies Whether 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());
counts all terminal residue nodes in the active document.

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

Returns:

Returns the count of nodes that match the selection predicate.

See also: SBNode::getNodes , SBNodeIndexer , SBNodePredicate


function create2DImage#

Creates a 2D image for the given SMILES code.

static QImage * SAMSON::create2DImage (
    const std::string & smiles,
    int widthPx=600,
    int marginPx=10,
    double lineWidth=2,
    QString fontFamily="sans-serif"
) 

Creates a 2D image representation of a SMILES string.

Parameters:

  • smiles SMILES notation of the molecule.
  • widthPx Desired image width in pixels (default 600).
  • marginPx Margin around the drawing in pixels (default 10).
  • lineWidth Width of the lines used to draw bonds (default 2).
  • fontFamily Font family used for atom labels (default "sans-serif").

Returns:

Pointer to a QImage containing the rendered molecule.


function createHeadsetViewport#

Creates a viewport for a virtual reality headset.

static QOpenGLContext * SAMSON::createHeadsetViewport () 


function createJob#

Creates a job named name with fixed costfixedCost , hourly costhourlyCost , price currencypriceCurrency , estimated durationestimatedDuration , end pointendPoint , and meta datametadata ; returns the job's UUID.

static 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
) 

Creates a job based on the given data.

Returns the job's UUID if it could create the job else returns an invalid UUID.

Parameters:

  • name The name of the job which will be shown in the Job Manager.
  • developerId The developer's UUID (the user UUID of the developer).
  • serviceId The UUID of the service where the job runs.
  • description The user-friendly description of the job.
  • fixedCost The fixed cost of the job (if the job has a fixed cost and not an hourly cost).
  • hourlyCost The hourly cost of the job (if the job has an hourly cost and not a fixed cost).
  • storageCost The cost of the storage.
  • estimatedDuration The estimated duration of the job (-1 if unknown).
  • endpoint The job service end point.
  • metadata The metadata of the job which can be used e.g. in your job service.
  • filePathList The list of paths to job files that should be uploaded from the local machine.
  • destinationFilePathList The list of destination paths for uploaded files on the cloud machine (the size should correspond to the filePathList).

Returns:

The UUID of the created job, or an invalid UUID if the job could not be created.


function createRenderPreset#

Creates a render preset based on the current rendering settings; returns the owning pointer.

static SBDDocumentRenderPreset * SAMSON::createRenderPreset () 

Creates a render preset based on the current rendering settings.

This function creates a new render preset object that captures the current rendering configuration. The returned pointer owns the preset.

Returns:

A pointer to the newly created SBDDocumentRenderPreset.


function deleteTexture#

Deletes an OpenGL texture from its id.

static void SAMSON::deleteTexture (
    unsigned int textureID
) 

Deletes an OpenGL texture.

Removes the texture identified by the given texture ID from OpenGL.

Parameters:

  • textureID The OpenGL texture identifier to delete.

function disableHolding#

Pauses holding bool transparency = false,.

static void SAMSON::disableHolding () 

Disables the holding mechanism temporarily.


function disableViewportNodeHighlighting#

Enables automatic node highlighting in the viewport.

static void SAMSON::disableViewportNodeHighlighting () 

Disables automatic node highlighting in the viewport.

When disabled, nodes under the cursor are not highlighted.


function disconnectDocumentSignalFromSlot#

Disconnects the document signal from a slot.

static void SAMSON::disconnectDocumentSignalFromSlot (
    SBCReferenceTarget * referenceTarget,
    void(SBCReferenceTarget::*)( SBDocumentEvent *) functionPointer
) 

Disconnects a slot from the document signal.

Removes the connection between the given reference target and member function from the document signal.

Parameters:

  • referenceTarget The object that was connected to the signal.
  • functionPointer Pointer to the member function to disconnect.

function displayCylinders#

Displays cylinders.

static 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,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays cylinders in the viewport using ray‑tracing shaders.

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:

Image

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());
    }
    else if (renderingPass == SBNode::RenderingPass::ShadowingGeometry) {
        SAMSON::displayCylinders(nCylinders, nPositions, indexData.data(), 
            positionData.data(), radiusData.data(), capData.data(),
            colorData.data(), flagData.data(), true);
    }

}

Parameters:

  • nCylinders The number of cylinders
  • nPositions The number of positions used to describe cylinders
  • indexData The array of indices of positions (two unsigned ints per cylinder)
  • positionData The array of positions (three floats per position)
  • radiusData The array of radii (one float per position)
  • capData The array of capping flags (one unsigned int per position)
  • colorData The array of colors (four floats per position)
  • flagData The array of flags (one unsigned int per position)
  • shadowPassFlag The boolean to signal a shadow pass
  • transform The spatial transform to apply for rendering
  • opacity The float to specify the opacity
  • flagModifier The flag modifier

See also: rendering


function displayCylindersSelection#

Displays cylinders for selection.

static 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,
    const SBSpatialTransform & transform=SBSpatialTransform::identity
) 

Displays cylinders for selection in the viewport.

This function renders cylinders in the viewport for selection purposes, using the provided geometry data. The rendering is performed by the GUI subsystem.

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

Parameters:

  • nCylinders The number of cylinders.
  • nPositions The number of positions used to describe cylinders.
  • indexData The array of indices of positions (two unsigned ints per cylinder).
  • positionData The array of positions (three floats per position).
  • radiusData The array of radii (one float per position).
  • capData The array describing the caps for each cylinder - the capping flags (one unsigned int per position)
  • nodeIndexData The array of node indices associated with each position (one unsigned int per position, the cylinder uses the index of its first vertex).
  • transform The spatial transform to apply for rendering.

See also: rendering


function displayLineSweptSpheres#

Displays line-swept spheres.

static void SAMSON::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,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays line-swept spheres (cylinders) in the viewport.

Parameters:

  • nCylinders The number of cylinders
  • nPositions The number of positions used to describe cylinders
  • indexData The array of indices of positions (two unsigned ints per cylinder)
  • positionData The array of positions (three floats per position)
  • radiusData The array of radii (one float per position)
  • colorData The array of colors (four floats per position)
  • flagData The array of flags (one unsigned int per position)
  • shadowPassFlag The boolean to signal a shadow pass
  • transform The spatial transform to apply for rendering
  • opacity The float to specify the opacity
  • flagModifier The flag modifier

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.

function displayLineSweptSpheresSelection#

Displays line-swept spheres for selection.

static void SAMSON::displayLineSweptSpheresSelection (
    unsigned int nLineSweptSpheres,
    unsigned int nPositions,
    const unsigned int * indexData,
    const float * positionData,
    const float * radiusData,
    const unsigned int * nodeIndexData,
    const SBSpatialTransform & transform=SBSpatialTransform::identity
) 

Parameters:

  • nCylinders The number of cylinders
  • nPositions The number of positions used to describe cylinders
  • indexData The array of indices of positions (two unsigned ints per cylinder)
  • positionData The array of positions (three floats per position)
  • radiusData The array of radii (one float per position)
  • nodeIndexData The address of the object associated with each position (one unsigned int per position, the cylinder has the index associated with its first vertex)
  • transform The spatial transform to apply for rendering

This function allows to select line-swept spheres with spherical caps, based on their position in the viewport


function displayLines#

Displays 3D lines.

static 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,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays lines in the viewport.

Parameters:

  • nLines The number of lines
  • nPositions The number of positions used to describe lines
  • indexData The array of indices of positions (two unsigned ints per line)
  • positionData The array of positions (three floats per position)
  • colorData The array of colors (four floats per position)
  • flagData The array of flags (one unsigned int per position)
  • shadowPassFlag The boolean to signal a shadow pass
  • transform The spatial transform to apply for rendering
  • opacity The float to specify the opacity
  • flagModifier The flag modifier

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:

Image

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
   }

function displayLinesOrtho#

Displays 2D lines.

static void SAMSON::displayLinesOrtho (
    unsigned int nLinesOrtho,
    unsigned int nPositions,
    const unsigned int * indexData,
    const float * positionData,
    const float * colorData,
    bool reverseViewport=true
) 


function displayLinesSelection#

Displays 3D lines for selection.

static void SAMSON::displayLinesSelection (
    unsigned int nLines,
    unsigned int nPositions,
    const unsigned int * indexData,
    const float * positionData,
    const unsigned int * nodeIndexData,
    const SBSpatialTransform & transform=SBSpatialTransform::identity
) 

Performs selection of lines based on their position in the viewport.

Parameters:

  • nLines The number of lines
  • nPositions The number of positions used to describe lines
  • indexData The array of indices of positions (two unsigned ints per lines)
  • positionData The array of positions (three floats per position)
  • nodeIndexData The address of the object associated with each position (one unsigned int per position, the line has the index associated with its first vertex)
  • transform The spatial transform to apply for rendering

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


function displaySpheres#

Displays spheres.

static void SAMSON::displaySpheres (
    unsigned int nSpheres,
    const float * positionData,
    const float * radiusData,
    const float * colorData,
    const unsigned int * flagData,
    bool shadowPassFlag=false,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays spheres using ray-tracing shaders.

Parameters:

  • nSpheres The number of spheres
  • positionData The array of positions (three floats per sphere)
  • radiusData The array of radii (one float per sphere)
  • colorData The array of colors (four floats per sphere)
  • flagData The array of flags (one unsigned int per sphere)
  • shadowPassFlag The boolean to signal a shadow pass
  • transform The spatial transform to apply for rendering
  • opacity The float to specify the opacity
  • flagModifier The flag modifier

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.

function displaySpheresSelection#

Displays spheres for selection.

static void SAMSON::displaySpheresSelection (
    unsigned int nSpheres,
    const float * positionData,
    const float * radiusData,
    const unsigned int * nodeIndexData,
    const SBSpatialTransform & transform=SBSpatialTransform::identity
) 

Parameters:

  • nSpheres The number of spheres
  • positionData The array of positions (three floats per sphere)
  • radiusData The array of radii (one float per sphere)
  • nodeIndexData The address of the object associated with each sphere (one unsigned int per sphere)
  • transform The spatial transform to apply for rendering

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


function displayText#

Displays text.

static void SAMSON::displayText (
    const std::string & text,
    const SBPosition3 & position,
    const QFont & font,
    float * color
) 

Displays text in the viewport.

Renders the given string at the specified 3D position using the provided font and color.

Parameters:

  • text The text to display.
  • position The 3D position where the text will be placed.
  • font The font used for rendering the text.
  • color A pointer to an array of four floats representing RGBA color components.

function displayTextSelection#

Displays text for selection.

static void SAMSON::displayTextSelection (
    const std::string & text,
    const SBPosition3 & position,
    const QFont & font,
    unsigned int nodeIndex
) 

Displays selectable text in the viewport.

Renders the given string at the specified 3D position and associates it with a node index for selection purposes.

Parameters:

  • text The text to display.
  • position The 3D position where the text will be placed.
  • font The font used for rendering the text.
  • nodeIndex The index of the node associated with the displayed text.

function displayTexturedTriangles#

Displays 3D textured triangles.

static void SAMSON::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,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    const SBColor & diffuseColor=SBColor::black,
    float diffuseColorReplacement=0.0f,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays textured triangles in the viewport.

Renders a set of 3D textured triangles with the given geometry, normals, colors, texture coordinates, and rendering options.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of vertex positions.
  • indexData Indices defining the triangles (three unsigned ints per triangle).
  • positionData Array of vertex positions (three floats per position).
  • normalData Array of vertex normals (three floats per position).
  • colorData Array of vertex colors (four floats per position).
  • flagData Array of flags (one unsigned int per vertex).
  • textureCoordinateData Array of texture coordinates (two floats per vertex).
  • textureID The OpenGL texture identifier to use.
  • shadowPassFlag Indicates whether this is a shadow pass.
  • transform The spatial transform to apply for rendering.
  • diffuseColor The base diffuse color.
  • diffuseColorReplacement Replacement factor for the diffuse color.
  • opacity The opacity of the rendered triangles.
  • flagModifier Modifier applied to flags during rendering.

function displayTexturedTrianglesOrtho#

Displays 2D textured triangles.

static void SAMSON::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,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays orthographic textured triangles.

Renders a set of 2D textured triangles in the viewport, optionally reversing the viewport orientation.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of vertex positions.
  • indexData Indices defining the triangles (three unsigned ints per triangle).
  • positionData Array of vertex positions (three floats per position).
  • colorData Array of vertex colors (four floats per vertex).
  • flagData Array of flags (one unsigned int per vertex).
  • textureCoordinateData Array of texture coordinates (two floats per vertex).
  • textureID The OpenGL texture identifier to use.
  • reverseViewport If true, the viewport is reversed.
  • opacity The opacity of the rendered triangles.
  • flagModifier Modifier applied to flags during rendering.

function displayTexturedTrianglesOrthoSelection#

Displays 2D textured triangles for selection.

static void SAMSON::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
) 

Displays orthographic textured triangles for selection.

Renders a set of 2D textured triangles for selection purposes, associating each vertex with a node index.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of vertex positions.
  • indexData Indices defining the triangles (three unsigned ints per triangle).
  • positionData Array of vertex positions (three floats per position).
  • nodeIndexData Array of node indices (one unsigned int per vertex).
  • textureCoordinateData Array of texture coordinates (two floats per vertex).
  • textureID The OpenGL texture identifier to use.
  • reverseViewport If true, the viewport is reversed.

function displayTexturedTrianglesSelection#

Displays 3D textured triangles for selection.

static void SAMSON::displayTexturedTrianglesSelection (
    unsigned int nTriangles,
    unsigned int nPositions,
    const unsigned int * indexData,
    const float * positionData,
    const unsigned int * nodeIndexData,
    const float * textureCoordinateData,
    unsigned int textureID,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    unsigned int nodeIndexModifier=0
) 

Displays textured triangles for selection.

Renders a set of 3D textured triangles for selection purposes, applying the given spatial transform and node index modifier.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of vertex positions.
  • indexData Indices defining the triangles (three unsigned ints per triangle).
  • positionData Array of vertex positions (three floats per position).
  • nodeIndexData Array of node indices (one unsigned int per vertex).
  • textureCoordinateData Array of texture coordinates (two floats per vertex).
  • textureID The OpenGL texture identifier to use.
  • transform The spatial transform to apply for rendering.
  • nodeIndexModifier Modifier applied to node indices during selection.

function displayTip [1/2]#

Displays a tip.

static void SAMSON::displayTip (
    int x,
    int y,
    const std::string & tip
) 

Displays a tip at the specified viewport coordinates.

Shows a tip string at the given pixel location in the viewport.

Parameters:

  • x The x-coordinate in viewport pixels.
  • y The y-coordinate in viewport pixels.
  • tip The tip text to display.

function displayTip [2/2]#

Displays a tip.

static void SAMSON::displayTip (
    const QPoint & position,
    const std::string & tip
) 

Displays a tip at the specified viewport position.

Shows a tip string at the given QPoint location in the viewport.

Parameters:

  • position The position in viewport pixels where the tip will be displayed.
  • tip The tip text to display.

function displayTriangles#

Displays 3D triangles.

static 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,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    const SBColor & diffuseColor=SBColor::black,
    float diffuseColorReplacement=0.0f,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays triangles in the SAMSON viewport.

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:

Image

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());
    }
    else if (renderingPass == SBNode::RenderingPass::ShadowingGeometry) {
        SAMSON::displayTriangles(nTriangles, nPositions, indexData.data(),
            positionData.data(), normalData.data(), colorData.data(), flagData.data(), true);
    }

}

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of positions used to describe triangles.
  • indexData The array of indices of positions (three unsigned ints per triangle).
  • positionData The array of positions (three floats per position).
  • normalData The array of normal vectors at each position (three floats per position).
  • colorData The array of colors (four floats between 0 and 1 per position, rgba).
  • flagData The array of flags (one unsigned int per position). The first bit corresponds to selection, the second bit corresponds to highlight, and the third bit corresponds to fixed. The flag applied to each triangle is the flag of its first vertex.
  • shadowPassFlag A boolean to signal a shadow pass.
  • transform Spatial transform applied to all positions before display.
  • diffuseColor (currently unused) .
  • diffuseColorReplacement (currently unused) .
  • opacity Opacity of the triangles.
  • flagModifier Modifier applied to flags.

function displayTrianglesOrtho#

Displays 2D triangles.

static void SAMSON::displayTrianglesOrtho (
    unsigned int nTriangles,
    unsigned int nPositions,
    const unsigned int * indexData,
    const float * positionData,
    const float * colorData,
    const unsigned int * flagData,
    bool reverseViewport=true,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays triangles in an orthographic viewport.

This function renders triangles using an orthographic projection, optionally reversing the viewport orientation.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of positions used to describe triangles.
  • indexData The array of indices of positions (three unsigned ints per triangle).
  • positionData The array of positions (three floats per position).
  • colorData The array of colors (four floats between 0 and 1 per position, rgba).
  • flagData The array of flags (one unsigned int per position).
  • reverseViewport If true, the viewport Y axis is reversed.
  • opacity Opacity of the triangles.
  • flagModifier Modifier applied to flags.

function displayTrianglesOrthoSelection#

Displays 2D triangles for selection.

static void SAMSON::displayTrianglesOrthoSelection (
    unsigned int nTriangles,
    unsigned int nPositions,
    const unsigned int * indexData,
    const float * positionData,
    const unsigned int * nodeIndexData,
    bool reverseViewport=true
) 

Displays triangles for selection in an orthographic viewport.

This function draws triangles used for selection in an orthographic view.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of positions used to describe triangles.
  • indexData The array of indices of positions (three unsigned ints per triangle).
  • positionData The array of positions (three floats per position).
  • nodeIndexData The array of node indices for each position.
  • reverseViewport If true, the viewport Y axis is reversed.

function displayTrianglesSelection#

Displays 3D triangles for selection.

static void SAMSON::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 triangles for selection in the viewport.

This function draws triangles used for selection, applying a spatial transform to all positions.

Parameters:

  • nTriangles The number of triangles.
  • nPositions The number of positions used to describe triangles.
  • indexData The array of indices of positions (three unsigned ints per triangle).
  • positionData The array of positions (three floats per position).
  • nodeIndexData The array of node indices for each position.
  • transform Spatial transform applied to all positions before display.
  • nodeIndexModifier Modifier applied to node indices.

function displayTubes#

Displays tubes.

static void SAMSON::displayTubes (
    unsigned int nPositions,
    unsigned int ovalDetail,
    float * ovalCenter,
    float * majorAxis,
    float * minorAxis,
    float * color,
    unsigned int * flags,
    unsigned int triangleReduction,
    bool shadowPassFlag=false,
    const SBSpatialTransform & transform=SBSpatialTransform::identity,
    float opacity=1.0f,
    unsigned int flagModifier=0
) 

Displays tubes in the viewport.

This function draws tubes defined by a series of ovals, useful for representing cylinders with varying radius.

Parameters:

  • nPositions Number of positions (ovals) defining the tube.
  • ovalDetail Detail level of each oval (number of segments).
  • ovalCenter Array of oval center coordinates (three floats per position).
  • majorAxis Array of major axis vectors (three floats per position).
  • minorAxis Array of minor axis vectors (three floats per position).
  • color Array of colors (four floats per position, rgba).
  • flags Array of flags (one unsigned int per position).
  • triangleReduction Reduction factor for triangle count.
  • shadowPassFlag True if this is a shadow pass.
  • transform Spatial transform applied to all positions before display.
  • opacity Opacity of the tubes.
  • flagModifier Modifier applied to flags.

function displayTubesSelection#

Displays tubes for selection.

static void SAMSON::displayTubesSelection (
    unsigned int nPositions,
    unsigned int ovalDetail,
    float * ovalCenter,
    float * majorAxis,
    float * minorAxis,
    unsigned int * nodeIndex,
    unsigned int triangleReduction,
    const SBSpatialTransform & transform=SBSpatialTransform::identity
) 

Displays tubes for selection in the viewport.

This function draws tubes used for selection, applying a spatial transform to all positions.

Parameters:

  • nPositions Number of positions (ovals) defining the tube.
  • ovalDetail Detail level of each oval (number of segments).
  • ovalCenter Array of oval center coordinates (three floats per position).
  • majorAxis Array of major axis vectors (three floats per position).
  • minorAxis Array of minor axis vectors (three floats per position).
  • nodeIndex Array of node indices for each position.
  • triangleReduction Reduction factor for triangle count.
  • transform Spatial transform applied to all positions before display.

function documentSignalIsConnectedToSlot#

Returns true if and only if the document signal is connected to the slot.

static bool SAMSON::documentSignalIsConnectedToSlot (
    SBCReferenceTarget * referenceTarget,
    void(SBCReferenceTarget::*)( SBDocumentEvent *) functionPointer
) 

Checks whether a document signal is connected to a slot.

Determines if the given reference target and member function are currently connected to the document signal.

Parameters:

  • referenceTarget The object that may be connected to the signal.
  • functionPointer Pointer to the member function to check.

Returns:

true if the signal is connected to the slot; otherwise false.


function enableHolding#

Resumes holding.

static void SAMSON::enableHolding () 

Enables the holding mechanism.


function enableViewportNodeHighlighting#

Enables automatic node highlighting in the viewport.

static void SAMSON::enableViewportNodeHighlighting () 

When enabled, nodes under the cursor are highlighted according to the highlighting settings.


function endHolding#

Ends holding.

static void SAMSON::endHolding () 

Ends the current holding operation.


function exportToFile#

Export a selection of nodes to a file.

static void SAMSON::exportToFile (
    const SBNodeIndexer & nodeIndexer,
    const std::string & fileName,
    const SBValueMap & parameterMap=SBValueMap {},
    SBIFileExporter * exporter=nullptr
) 

Exports a selection of nodes to a file.

This function forwards the export request to the main window, which will write the specified nodes to the given file using the appropriate exporter.

Parameters:

  • nodeIndexer Indexer containing the nodes to be exported.
  • fileName Path to the output file.
  • parameterMap Optional map of parameters passed to the exporter.
  • exporter Optional specific file exporter to use. If null, the appropriate exporter is selected automatically.

function generateTexture#

Generate an OpenGL texture from a QImage and returns its id.

static unsigned int SAMSON::generateTexture (
    const QImage & textureImage
) 

Generates an OpenGL texture from a QImage.

Creates a texture from the provided image and returns its OpenGL texture identifier.

Parameters:

  • textureImage The QImage to be converted into an OpenGL texture.

Returns:

The OpenGL texture identifier.


function getAction [1/2]#

Returns the action with the given actionUUID .

static SBAction * SAMSON::getAction (
    const SBUUID & actionUUID
) 

Retrieves an action by its UUID.

Parameters:

  • actionUUID The UUID of the action.

Returns:

Pointer to the SBAction if found, otherwise nullptr.


function getAction [2/2]#

Returns the first found action with the given className .

static QAction * SAMSON::getAction (
    const QString & className
) 

Retrieves an action by its class name.

Parameters:

  • className The name of the action class.

Returns:

Pointer to the QAction if found, otherwise nullptr.


function getActionByText#

Returns the first found action with the given text .

static QAction * SAMSON::getActionByText (
    const QString & text
) 

Retrieves an action by its displayed text.

Parameters:

  • text The displayed text of the action.

Returns:

Pointer to the QAction if found and not locked, otherwise nullptr.


function getActionWidget#

Returns the action widget with the given actionWidgetUUID .

static SBActionWidget * SAMSON::getActionWidget (
    const SBUUID & actionWidgetUUID
) 

Retrieves an action widget by its UUID.

Parameters:

  • actionWidgetUUID The UUID of the action widget.

Returns:

Pointer to the SBActionWidget if found, otherwise nullptr.


function getActiveAsset#

Returns the active asset.

static const SBAsset * SAMSON::getActiveAsset () 

Retrieves the currently active asset.

Returns:

Pointer to the active SBAsset, or nullptr if none.


function getActiveCamera#

Returns a pointer to the active camera .

static SBDDocumentCamera * SAMSON::getActiveCamera () 

Returns the active camera.

Retrieves the camera associated with the currently active document.

Returns:

Pointer to the active SBDDocumentCamera.


function getActiveDocument#

Returns a pointer to SAMSON's active document .

static SBDDocument * SAMSON::getActiveDocument () 

Returns the currently active document.

Retrieves a pointer to the document that is currently active in SAMSON.

Returns:

Pointer to the active SBDDocument.


function getActiveDocumentFilter#

Returns the node filter of the active document.

static std::string SAMSON::getActiveDocumentFilter () 

Returns the node filter string of the active document.

Retrieves the filter text used to display nodes in the active document.

Returns:

The node filter as a std::string.


function getActiveEditor#

Returns a pointer to the current editor.

static SBEditor * SAMSON::getActiveEditor () 

Returns the currently active editor.

This function retrieves a pointer to the editor that is currently active in the SAMSON user interface.

Returns:

A pointer to the active editor, or nullptr if no editor is active.


function getActiveSelectionFilter#

Returns the active selection filter.

static const SBNodePredicate & SAMSON::getActiveSelectionFilter () 

Returns the active selection filter node predicate.

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.

Returns:

Reference to the node predicate corresponding to the active selection filter.


function getActiveSelectionFilterNSL#

Returns the active selection filter NSL string.

static std::string SAMSON::getActiveSelectionFilterNSL () 

Returns the NSL expression of the active selection filter.

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

Returns:

The NSL expression string corresponding to the active selection filter.


function getActiveSelectionFilterName#

Returns the active selection filter name.

static std::string SAMSON::getActiveSelectionFilterName () 

Returns the name of the active selection filter.

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

Returns:

The name of the active selection filter as a string.


function getActiveStructuralModel#

Returns a pointer to the active structural model.

static SBStructuralModel * SAMSON::getActiveStructuralModel () 

Returns the active structural model.

Retrieves the structural model currently selected in SAMSON.

Returns:

Pointer to the active SBStructuralModel.


function getAddWatermarkFlag#

Returns true when a watermark should be added to presentation movies and frames.

static bool SAMSON::getAddWatermarkFlag () 

Returns whether a watermark should be added to presentation movies and frames.

Returns:

true if a watermark is to be added, false otherwise.


function getAmbientLight#

Returns the ambient light.

static float SAMSON::getAmbientLight () 

Returns the ambient light intensity of the current viewport.

Returns:

Ambient light intensity as a float.


function getApp#

Returns the app corresponding to a specific appUUID andelementUUID .

static SBApp * SAMSON::getApp (
    const SBUUID & appUUID,
    const SBUUID & elementUUID=SBUUID ()
) 

Retrieves an app instance.

This function returns a pointer to the app corresponding to the specified UUIDs.

Parameters:

  • appUUID The UUID of the app.
  • elementUUID The UUID of the element associated with the app (optional, may be empty).

Returns:

A pointer to the requested app, or nullptr if not found.


function getAtom [1/2]#

Returns the atom at location ( x ,y ) in the viewport.

static SBAtom * SAMSON::getAtom (
    int x,
    int y
) 

Returns the atom at the given viewport coordinates.

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.

Parameters:

  • x The first viewport coordinate of the picking location.
  • y The second viewport coordinate of the picking location.

Returns:

Pointer to the picked atom, or nullptr if no atom is present at the given coordinates.


function getAtom [2/2]#

Returns the atom at location position in the viewport.

static SBAtom * SAMSON::getAtom (
    const QPoint & position
) 

Returns the atom displayed at a given viewport position.

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());

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

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 nullptr. 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&)

Parameters:

  • position The viewport coordinates of the picking location.

Returns:

Pointer to the picked atom, or nullptr if none.


function getAtomRadius#

Returns the radius of atoms in the default representation of structural models (when a constant radius is used)

static const SBQuantity::length & SAMSON::getAtomRadius () 

Returns the default atom radius used in SAMSON.

This function returns a reference to the default atom radius applied in the default representation of structural models when a constant radius is used.

Returns:

Reference to the atom radius.


function getAtomicWeight#

Returns the atomic weight of periodic table element element .

static SBQuantity::mass SAMSON::getAtomicWeight (
    SBMElement::Type element
) 

Returns the atomic weight of a periodic table element.

This function queries the periodic table database for the atomic weight of the specified element.

Parameters:

  • element The periodic table element type.

Returns:

The atomic weight of the element.


function getBackgroundProgress#

Returns the progress between the current background (0) and the next background (1)

static float SAMSON::getBackgroundProgress () 

Returns the interpolation progress between the current and next background.

Returns:

A value between 0.0 (current background) and 1.0 (next background).


function getBlock#

Returns the block of periodic table element element .

static std::string SAMSON::getBlock (
    SBMElement::Type element
) 

Returns the block (s, p, d, f) of a periodic table element.

This function queries the periodic table database for the block of the specified element.

Parameters:

  • element The periodic table element type.

Returns:

The block name as a string.


function getBond [1/2]#

Returns the bond at location ( x ,y ) in the viewport.

static SBBond * SAMSON::getBond (
    int x,
    int y
) 

Returns the bond displayed at the given viewport coordinates.

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 nullptr.

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 nullptr. 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)

Parameters:

  • x The first viewport coordinate of the picking location.
  • y The second viewport coordinate of the picking location.

Returns:

Pointer to the picked bond, or nullptr if none.


function getBond [2/2]#

Returns the bond at location position in the viewport.

static SBBond * SAMSON::getBond (
    const QPoint & position
) 

Returns the bond displayed at a given viewport position.

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());

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

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 nullptr. 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&)

Parameters:

  • position The viewport coordinates of the picking location.

Returns:

Pointer to the picked bond, or nullptr if none.


function getBondRadius#

Returns the radius of bonds in the default representation of structural models.

static const SBQuantity::length & SAMSON::getBondRadius () 

Returns the default bond radius used in SAMSON.

This function returns a reference to the default bond radius applied in the default representation of structural models.

Returns:

Reference to the bond radius.


function getCameraControllerFlag#

Returns true when the camera controller should be displayed in the viewport.

static bool SAMSON::getCameraControllerFlag () 

Returns whether the camera controller is displayed in the viewport.

Returns:

true if the camera controller is shown, otherwise false.


function getChoiceFromUser#

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

static 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(),
    int iconSize=60
) 

Prompts the user to select one of several choices.

Displays a dialog titled dialogTitle with a list of choices, optionally accompanied by toolTips and icons. The user selects an item, and the index of the selected choice is stored in resultIndex.

Parameters:

  • dialogTitle Title of the dialog.
  • resultIndex Output parameter that receives the index of the selected choice.
  • label Label displayed above the list of choices.
  • choices List of choice strings presented to the user.
  • toolTips List of tooltips for each choice; may be empty.
  • icons List of icons for each choice; may be empty.
  • logo Optional logo displayed in the dialog.
  • iconSize Size of the icons in the dialog.

Returns:

true if the user made a selection, false if the dialog was canceled.


function getColorFromUser#

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

static bool SAMSON::getColorFromUser (
    const QString & dialogTitle,
    SBColor & result,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select a color.

Displays a color picker dialog with title dialogTitle. The selected color is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the selected SBColor.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected a color, false if the dialog was canceled.


function getColorbar#

Returns a pixmap with a colorbar for a given color palette palette .

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

Returns a pixmap with a colorbar for the specified palette.

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

Parameters:

  • palette The color palette for which to generate the colorbar.
  • width Width of the resulting pixmap in pixels.
  • height Height of the resulting pixmap in pixels.
  • nColors Number of discrete colors in the colorbar.
  • isHorizontal true for horizontal orientation, false for vertical.

Returns:

A QPixmap containing the generated colorbar.


function getCovalentRadius [1/2]#

Returns the covalent radius of periodic table element element .

static SBQuantity::length SAMSON::getCovalentRadius (
    SBMElement::Type element
) 

Returns the covalent radius of a periodic table element.

This function queries the periodic table database for the covalent radius of the specified element.

Parameters:

  • element The periodic table element type.

Returns:

The covalent radius of the element.


function getCovalentRadius [2/2]#

Returns the covalent radius of periodic table element element for bond typebondType (1 for single bond, 2 for double bond, 3 for triple bond, for other values it returnsgetCovalentRadius() )

static SBQuantity::length SAMSON::getCovalentRadius (
    SBMElement::Type element,
    int bondType
) 

Returns the covalent radius of a periodic table element for a specific bond type.

This function queries the periodic table database for the covalent radius of the specified element when forming a bond of the given type.

Parameters:

  • element The periodic table element type.
  • bondType The bond type (1 for single bond, 2 for double bond, 3 for triple bond).

Returns:

The covalent radius of the element for the specified bond type.


function getCredentialsFromUser [1/2]#

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

static bool SAMSON::getCredentialsFromUser (
    const QString & dialogTitle,
    QString & user,
    QString & password,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to enter credentials (username and password).

Displays a credentials input dialog with title dialogTitle. The entered username and password are stored in user and password.

Parameters:

  • dialogTitle Title of the dialog.
  • user Output parameter that receives the entered username.
  • password Output parameter that receives the entered password.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered credentials, false if the dialog was canceled.


function getCredentialsFromUser [2/2]#

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

static bool SAMSON::getCredentialsFromUser (
    const QString & dialogTitle,
    QString & host,
    int & port,
    QString & user,
    QString & password,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to enter network credentials (host, port, username, password).

Displays a credentials input dialog with title dialogTitle. The entered host, port, username, and password are stored in the respective parameters.

Parameters:

  • dialogTitle Title of the dialog.
  • host Output parameter that receives the entered host name.
  • port Output parameter that receives the entered port number.
  • user Output parameter that receives the entered username.
  • password Output parameter that receives the entered password.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered credentials, false if the dialog was canceled.


function getCurrentBackgroundBottomColor#

Returns the top color of the current background.

static const float * SAMSON::getCurrentBackgroundBottomColor () 

Returns the bottom color of the current background gradient.

Returns:

Pointer to an array of four floats (RGBA) representing the bottom color.


function getCurrentBackgroundImageFileName#

Returns the file name of the current background image.

static QString SAMSON::getCurrentBackgroundImageFileName () 

Returns the file name of the image used for the current background.

Returns:

File name as a QString.


function getCurrentBackgroundImageFlag#

Returns true when the current background should show an image from a file.

static bool SAMSON::getCurrentBackgroundImageFlag () 

Returns whether an image is used for the current background.

Returns:

true if a background image is displayed, otherwise false.


function getCurrentBackgroundImageMode#

Returns the display mode of the current background image (0: contained in the viewport, 1: covering the viewport)

static int SAMSON::getCurrentBackgroundImageMode () 

Returns the display mode of the current background image.

Returns:

0 if the image is contained within the viewport, 1 if it covers the viewport.


function getCurrentBackgroundTopColor#

Returns the top color of the current background.

static const float * SAMSON::getCurrentBackgroundTopColor () 

Returns the top color of the current background gradient.

Returns:

Pointer to an array of four floats (RGBA) representing the top color.


function getCursor#

Returns the cursor with the given name cursorName , the given element uuiduuid .

static QCursor SAMSON::getCursor (
    const QString & cursorName,
    const SBUUID & uuid
) 

Retrieves a cursor resource.

Parameters:

  • pixmapName Name of the cursor resource.
  • uuid UUID of the requesting element.

Returns:

The QCursor associated with the given name and element.


function getDarkModeFlag#

Returns true when dark mode is on.

static bool SAMSON::getDarkModeFlag () 

Returns whether dark mode is enabled in the UI.

Returns:

true if dark mode is active, otherwise false.


function getDarkWatermark#

Returns the dark watermark.

static QImage SAMSON::getDarkWatermark () 

Returns the dark watermark image used for presentations.

Returns:

A QImage containing the dark watermark.


function getDeepSelectionFlag#

Returns whether the user wants deep selection.

static bool SAMSON::getDeepSelectionFlag () 

Returns whether deep selection is enabled.

Returns true when deep selection is enabled, i.e., nodes hidden by other nodes can also be selected. Returns false otherwise.

Returns:

true if deep selection is enabled; false otherwise.


function getDocumentList#

Returns the list of open documents .

static SBPointerList< SBDDocument > const * SAMSON::getDocumentList () 

Returns the list of open documents.

Provides a pointer to the list of all currently opened SBDDocument objects.

Returns:

Pointer to a constant list of SBDDocument pointers.


function getDoubleFromUser#

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

static bool SAMSON::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()
) 

Prompts the user to input a floating-point value.

Displays a numeric input dialog with title dialogTitle, allowing the user to specify a value between minimum and maximum. The result is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the entered value.
  • minimum Minimum allowable value.
  • maximum Maximum allowable value.
  • singleStep Increment step for the spin box.
  • prefix Prefix string displayed before the numeric value.
  • suffix Suffix string displayed after the numeric value.
  • decimals Number of decimal places displayed.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered a value, false if the dialog was canceled.


function getDoubleIntervalFromUser#

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

static bool SAMSON::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()
) 

Prompts the user to input a double interval.

Displays a dialog with title dialogTitle that allows the user to specify a minimum and maximum floating-point value. The result is stored in result as a pair.

Parameters:

  • dialogTitle Title of the dialog.
  • labelText List of labels for the two input fields (e.g., {"Min", "Max"}).
  • result Output parameter that receives the entered interval as a pair of doubles.
  • minValueInterval Pair specifying the allowed minimum values for the two fields.
  • maxValueInterval Pair specifying the allowed maximum values for the two fields.
  • singleStep Pair specifying the increment step for each field.
  • prefix Prefix string displayed before each numeric value.
  • suffix Suffix string displayed after each numeric value.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered a valid interval, false if the dialog was canceled.


function getEditor#

Returns the editor corresponding to a specific classUUID andelementUUID .

static SBEditor * SAMSON::getEditor (
    const SBUUID & classUUID,
    const SBUUID & elementUUID
) 

Retrieves an editor by its class and element UUIDs.

This function searches the editor indexer for an editor matching the given UUIDs and returns it.

Parameters:

  • classUUID The UUID of the editor class.
  • elementUUID The UUID of the editor element.

Returns:

A pointer to the matching editor, or nullptr if not found.


function getEditorIndexer#

Returns the editor indexer.

static SBIndexer< SBEditor * > const * SAMSON::getEditorIndexer () 

This function provides a constant pointer to the indexer that holds all registered editors.

Returns:

A constant pointer to the editor indexer.


function getElectronegativity#

Returns the electronegativity of periodic table element element .

static SBQuantity::dimensionless SAMSON::getElectronegativity (
    SBMElement::Type element
) 

Returns the electronegativity of a periodic table element.

This function queries the periodic table database for the electronegativity of the specified element.

Parameters:

  • element The periodic table element type.

Returns:

The electronegativity of the element.


function getElement#

Returns the periodic table element corresponding to a given type.

static const SBElement & SAMSON::getElement (
    SBMElement::Type element
) 

Returns the periodic table element for a given type.

Retrieves the SBMElement object representing the specified element type.

Parameters:

  • element The element type identifier.

Returns:

Reference to the SBMElement corresponding to the given type.


function getElementFromUser#

Gets a periodic table element from the user in a modal pop-up dialog.

static bool SAMSON::getElementFromUser (
    const QString & dialogTitle,
    SBMElement::Type & elementType,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select a periodic table element.

Displays a periodic table widget in a dialog with title dialogTitle, allowing the user to pick an element. The selected element type is stored in elementType.

Parameters:

  • dialogTitle Title of the dialog.
  • elementType Output parameter that receives the selected SBMElement::Type.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected an element, false if the dialog was canceled.


function getElementName#

Returns the name of the periodic table element corresponding to a given type.

static std::string SAMSON::getElementName (
    SBMElement::Type element
) 

Returns the name of the specified element.

Retrieves the human-readable name for the given element type.

Parameters:

  • element The element type.

Returns:

The element name as a string.


function getElementSymbol#

Returns the symbol of the periodic table element corresponding to a given type.

static std::string SAMSON::getElementSymbol (
    SBMElement::Type element
) 

Returns the symbol of the specified element.

Retrieves the chemical symbol for the given element type.

Parameters:

  • element The element type.

Returns:

The element symbol as a string.


function getElementTypeByName [1/2]#

Returns the periodic table element type corresponding to a given name.

static SBElement::Type SAMSON::getElementTypeByName (
    char * elementName
) 

Returns the element type corresponding to a given name (C-string).

This function looks up the periodic table for an element whose name matches the provided C-string.

Parameters:

  • elementName The name of the element as a null-terminated C-string.

Returns:

The element type, or an undefined type if not found.


function getElementTypeByName [2/2]#

Returns the periodic table element type corresponding to a given name.

static SBElement::Type SAMSON::getElementTypeByName (
    const std::string & elementName
) 

Returns the element type corresponding to a given name (std::string).

This function looks up the periodic table for an element whose name matches the provided string.

Parameters:

  • elementName The name of the element as an std::string.

Returns:

The element type, or an undefined type if not found.


function getElementTypeBySymbol [1/2]#

Returns the periodic table element type corresponding to a given symbol.

static SBElement::Type SAMSON::getElementTypeBySymbol (
    char * elementSymbol
) 

Returns the element type corresponding to a given chemical symbol (C-string).

This function looks up the periodic table for an element whose chemical symbol matches the provided C-string.

Parameters:

  • elementSymbol The chemical symbol of the element as a null-terminated C-string.

Returns:

The element type, or an undefined type if not found.


function getElementTypeBySymbol [2/2]#

Returns the periodic table element type corresponding to a given symbol.

static SBElement::Type SAMSON::getElementTypeBySymbol (
    const std::string & elementSymbol
) 

Returns the element type corresponding to a given chemical symbol (std::string).

This function looks up the periodic table for an element whose chemical symbol matches the provided string.

Parameters:

  • elementSymbol The chemical symbol of the element as an std::string.

Returns:

The element type, or an undefined type if not found.


function getElementVector#

Returns the complete periodic table element vector.

static SBMElement *const * SAMSON::getElementVector () 

Returns the vector of all periodic table elements.

Provides a pointer to the array of pointers to SBMElement objects representing all elements.

Returns:

Pointer to the array of element pointers.


function getElementsFromUser#

Gets a list of periodic table elements from the user in a modal pop-up dialog.

static bool SAMSON::getElementsFromUser (
    const QString & dialogTitle,
    std::vector< SBMElement::Type > & elementTypes,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select multiple periodic table elements.

Displays a periodic table widget in a dialog with title dialogTitle, allowing the user to select one or more elements. The selected element types are stored in elementTypes.

Parameters:

  • dialogTitle Title of the dialog.
  • elementTypes Output vector that receives the selected element types.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user confirmed the selection, false if the dialog was canceled.


function getFileNameFromUser#

Gets a filename from the user in a modal pop-up dialog with Open button.

static bool SAMSON::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()
) 

Prompts the user to select a file name for opening.

Displays a file open dialog with title dialogTitle. The selected file name is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the selected file name.
  • dir Initial directory shown in the dialog.
  • filter File filter string (e.g., "Images (*.png *.jpg)").
  • selectedFilter Pointer to a string that receives the selected filter; may be nullptr.
  • options QFileDialog options to customize the dialog.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected a file, false if the dialog was canceled.


function getFileNamesFromUser#

Gets a list of filenames from the user in a modal pop-up dialog with Open button.

static bool SAMSON::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()
) 

Prompts the user to select multiple file names for opening.

Displays a file open dialog with title dialogTitle. The selected file names are stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the list of selected file names.
  • dir Initial directory shown in the dialog.
  • filter File filter string.
  • selectedFilter Pointer to a string that receives the selected filter; may be nullptr.
  • options QFileDialog options to customize the dialog.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected at least one file, false if the dialog was canceled.


function getFontFromUser#

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

static bool SAMSON::getFontFromUser (
    const QString & dialogTitle,
    QFont & result,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select a font.

Displays a font selection dialog with title dialogTitle. The chosen font is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the selected QFont.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected a font, false if the dialog was canceled.


function getFresnelColor#

Returns the Fresnel color.

static const float * SAMSON::getFresnelColor () 

Returns the Fresnel effect color used in the viewport.

Returns:

Pointer to an array of three floats representing the Fresnel color.


function getFresnelIntensity#

Returns the Fresnel intensity.

static float SAMSON::getFresnelIntensity () 

Returns the Fresnel effect intensity used in the viewport.

Returns:

Fresnel intensity as a float.


function getFresnelPower#

Returns the Fresnel power.

static float SAMSON::getFresnelPower () 

Returns the Fresnel effect power used in the viewport.

Returns:

Fresnel power as a float.


function getGPUInfo#

Returns a string with the user's GPU name.

static std::string SAMSON::getGPUInfo () 

Retrieves a string describing the user's GPU.

The function queries system information to determine the graphics hardware name. The result is cached in the settings for future calls.

Returns:

GPU description string.


function getGUI#

Returns the GUI of a node.

static SBNodeGUI * SAMSON::getGUI (
    SBNode * node
) 

Retrieves the GUI representation of a node.

Parameters:

  • node The node for which to obtain the GUI.

Returns:

Pointer to the SBNodeGUI associated with the node.


function getGridFlag#

Returns true when the grid should be displayed in the viewport.

static bool SAMSON::getGridFlag () 

Returns whether the grid is displayed in the viewport.

Returns:

true if the grid is shown, otherwise false.


function getGroup#

Returns the group of periodic table element element .

static unsigned int SAMSON::getGroup (
    SBMElement::Type element
) 

Returns the group number of a periodic table element.

This function queries the periodic table database for the group of the specified element.

Parameters:

  • element The periodic table element type.

Returns:

The group number of the element.


function getHighlightingColor#

Returns the highlighting color.

static const float * SAMSON::getHighlightingColor () 

Returns the current highlighting color used in the viewport.

Returns:

A pointer to an array of three floats representing the RGB components of the highlighting color.


function getHighlightingOpacity#

Returns the highlighting opacity.

static float SAMSON::getHighlightingOpacity () 

Returns the opacity of the highlighting effect in the viewport.

Returns:

The highlighting opacity as a float.


function getIcon#

Returns the icon with the given name iconName the given element uuiduuid .

static QIcon SAMSON::getIcon (
    const QString & iconName,
    const SBUUID & uuid
) 

Retrieves an icon resource.

Parameters:

  • iconName Name of the icon resource.
  • uuid UUID of the requesting element.

Returns:

The QIcon associated with the given name and element.


function getInitializedAppIndexer#

Returns the initialized app indexer.

static SBPointerIndexer< SBApp > const * SAMSON::getInitializedAppIndexer (
    bool forceInitialization=false
) 

Returns the indexer of initialized apps.

This function provides access to an indexer containing all apps that have been initialized. Optionally, it can force initialization of apps that have not yet been initialized.

Parameters:

  • forceInitialization If true, forces initialization of apps that are not yet initialized.

Returns:

A constant pointer to the app indexer.


function getIntegerFromUser#

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

static bool SAMSON::getIntegerFromUser (
    const QString & dialogTitle,
    int & result,
    int minimum,
    int maximum,
    int singleStep=1,
    const QString & prefix="",
    const QString & suffix="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to input an integer value.

Displays a numeric input dialog with title dialogTitle, allowing the user to specify an integer between minimum and maximum. The result is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the entered integer.
  • minimum Minimum allowable integer.
  • maximum Maximum allowable integer.
  • singleStep Increment step for the spin box.
  • prefix Prefix string displayed before the numeric value.
  • suffix Suffix string displayed after the numeric value.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered a value, false if the dialog was canceled.


function getIntegerIntervalFromUser#

Gets an integer interval from the user in a modal pop-up dialog.

static bool SAMSON::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()
) 

Prompts the user to input an integer interval.

Displays a dialog with title dialogTitle that allows the user to specify a minimum and maximum integer value. The result is stored in result as a pair.

Parameters:

  • dialogTitle Title of the dialog.
  • labelText List of labels for the two input fields (e.g., {"Min", "Max"}).
  • result Output parameter that receives the entered interval as a pair of integers.
  • minValueInterval Pair specifying the allowed minimum values for the two fields.
  • maxValueInterval Pair specifying the allowed maximum values for the two fields.
  • singleStep Pair specifying the increment step for each field.
  • prefix Prefix string displayed before each numeric value.
  • suffix Suffix string displayed after each numeric value.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered a valid interval, false if the dialog was canceled.


function getItemFromUser [1/2]#

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

static bool SAMSON::getItemFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & label,
    const QStringList & items,
    int current=0,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select an item from a list of strings.

Displays a dialog with title dialogTitle and a list of items. The selected item's text is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the selected item text.
  • label Label displayed above the list.
  • items List of item strings presented to the user.
  • current Index of the initially selected item.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected an item, false if the dialog was canceled.


function getItemFromUser [2/2]#

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

static bool SAMSON::getItemFromUser (
    const QString & dialogTitle,
    int & resultIndex,
    const QString & label,
    const QStringList & items,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select an item from a list of strings, returning its index.

Displays a dialog with title dialogTitle and a list of items. The index of the selected item is stored in resultIndex.

Parameters:

  • dialogTitle Title of the dialog.
  • resultIndex Output parameter that receives the index of the selected item.
  • label Label displayed above the list.
  • items List of item strings presented to the user.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected an item, false if the dialog was canceled.


function getLightColor#

Returns the light color of light lightIndex .

static const float * SAMSON::getLightColor (
    unsigned int lightIndex
) 

Returns the color of a light source.

Parameters:

  • lightIndex Index of the light.

Returns:

Pointer to an array of three floats representing RGB components.


function getLightDirection#

Returns the light direction of light lightIndex .

static const float * SAMSON::getLightDirection (
    unsigned int lightIndex
) 

Returns the direction vector of a light source.

Parameters:

  • lightIndex Index of the light (zero‑based).

Returns:

Pointer to an array of three floats representing the direction vector.


function getLightIntensity#

Returns the light intensity of light lightIndex .

static float SAMSON::getLightIntensity (
    unsigned int lightIndex
) 

Returns the intensity of a light source.

Parameters:

  • lightIndex Index of the light.

Returns:

Light intensity as a float.


function getLightWatermark#

Returns the light watermark.

static QImage SAMSON::getLightWatermark () 

Returns the light watermark image used for presentations.

Returns:

A QImage containing the light watermark.


function getLikeFromUser#

Asks the user to like an extension.

static void SAMSON::getLikeFromUser (
    const SBCContainerUUID & developerUUID,
    const SBCContainerUUID & extensionUUID
) 

Sends a 'like' from the user to the feedback collector service.

Retrieves the current user's UUID and forwards a 'like' for the given developerUUID and extensionUUID to the feedback collector.

Parameters:

  • developerUUID UUID of the developer who created the extension.
  • extensionUUID UUID of the extension being liked.

function getMaximum3DTextureSize#

Returns the maximum 3D texture size.

static int SAMSON::getMaximum3DTextureSize () 

Returns the maximum supported 3D texture size.

Returns:

Maximum 3D texture dimension in pixels.


function getMaximumRectangleTextureSize#

Returns the maximum rectangle texture size.

static int SAMSON::getMaximumRectangleTextureSize () 

Returns the maximum supported rectangle texture size.

Returns:

Maximum rectangle texture dimension in pixels.


function getMaximumTextureSize#

Returns the maximum texture size.

static int SAMSON::getMaximumTextureSize () 

Returns the maximum supported texture size.

Returns:

Maximum texture dimension in pixels.


function getMinimizationFlag#

Returns true when interactive Minimization is on.

static bool SAMSON::getMinimizationFlag () 

Returns true when interactive minimization is on.

When interactive minimization is started, all active simulators in the active document periodically perform a time step.

Returns:

true if interactive minimization is active; false otherwise.

See also: startMinimization, stopMinimization, toggleMinimization, setMinimizationFlag


function getMousePositionInViewport#

Returns the current mouse position in viewport coordinates.

static QPoint SAMSON::getMousePositionInViewport () 

Returns the current mouse cursor position in viewport coordinates.

This function maps the global cursor position to the coordinate system of the active viewport.

Returns:

A QPoint containing the mouse position relative to the viewport.


function getMultiSampleFactor#

Returns the multisampling factor.

static unsigned int SAMSON::getMultiSampleFactor () 

Returns the multisampling factor used for anti‑aliasing.

Returns:

The multisampling factor.


function getMultipleBondDisplayFlag#

Returns true when bonds are displayed with a variable number of cylinders to represent their order.

static bool SAMSON::getMultipleBondDisplayFlag () 

Returns whether multiple bond display is enabled.

This function returns true when bonds are displayed with a variable number of cylinders to represent their order.

Returns:

true if multiple bond display is enabled, false otherwise.


function getNextBackgroundBottomColor#

Returns the top color of the next background.

static const float * SAMSON::getNextBackgroundBottomColor () 

Returns the bottom color of the next background gradient during transition.

Returns:

Pointer to an array of four floats (RGBA) representing the bottom color.


function getNextBackgroundImageFileName#

Returns the file name of the next background image.

static QString SAMSON::getNextBackgroundImageFileName () 

Returns the file name of the image used for the next background.

Returns:

File name as a QString.


function getNextBackgroundImageFlag#

Returns true when the next background should show an image from a file.

static bool SAMSON::getNextBackgroundImageFlag () 

Returns whether an image will be used for the next background.

Returns:

true if a next background image is set, otherwise false.


function getNextBackgroundImageMode#

Returns the display mode of the next background image (0: contained in the viewport, 1: covering the viewport)

static int SAMSON::getNextBackgroundImageMode () 

Returns the display mode of the next background image.

Returns:

0 if the image will be contained within the viewport, 1 if it will cover the viewport.


function getNextBackgroundTopColor#

Returns the top color of the next background.

static const float * SAMSON::getNextBackgroundTopColor () 

Returns the top color of the next background gradient during transition.

Returns:

Pointer to an array of four floats (RGBA) representing the top color.


function getNextNodeName#

Returns a next name starting with prefix prefix and ending with suffixsuffix for nodes of typetype in parent nodeparentNode or in the active document ifparentNode is null.

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

Returns the next consecutive name for nodes of a given type.

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:

std::string newName = SAMSON::getNextNodeName(SBNode::VisualModel);
should return 'Visual model 4'. And calling:
std::string newName = SAMSON::getNextNodeName(SBNode::VisualModel, "Ribbons");
should return 'Ribbons 2'.

Parameters:

  • type The node type for which a name is generated.
  • prefix Optional prefix for the name. If empty, a default prefix based on the node type is used.
  • suffix Optional suffix for the name.
  • parentNode Optional parent node to restrict the search; if null, the active document is used.

Returns:

The next available name for a node of the given type.


function getNode [1/4]#

Returns the node at location ( x ,y ) in the viewport according to theselectionFilter .

static SBNode * SAMSON::getNode (
    int x,
    int y,
    const SBNodePredicate & selectionFilter=SBNode::All()
) 

Returns the node displayed at the specified viewport coordinates.

Parameters:

  • x The first viewport coordinate of the picking location
  • y The second viewport coordinate of the picking location
  • selectionFilter A 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).

Returns:

A pointer to the node at the given coordinates, or nullptr if no node is present.

See also: getNode(int, int, SBPosition3&)


function getNode [2/4]#

Returns the node at location position in the viewport according to theselectionFilter .

static SBNode * SAMSON::getNode (
    const QPoint & position,
    const SBNodePredicate & selectionFilter=SBNode::All()
) 

Returns the node displayed at the specified viewport position.

Parameters:

  • position The viewport coordinates of the picking location
  • selectionFilter A 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).

Returns:

A pointer to the node at the given position, or nullptr if no node is present.

See also: getNode(const QPoint&, SBPosition3&)


function getNode [3/4]#

Returns the node at location ( x ,y ) in the viewport and thepickedPosition according to theselectionFilter .

static SBNode * SAMSON::getNode (
    int x,
    int y,
    SBPosition3 & pickedPosition,
    const SBNodePredicate & selectionFilter=SBNode::All()
) 

Returns the node displayed at the specified viewport coordinates and the picked 3D position.

Parameters:

  • x The first viewport coordinate of the picking location
  • y The second viewport coordinate of the picking location
  • pickedPosition Returns the 3D coordinates of the picked point
  • selectionFilter A 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).

Returns:

A pointer to the node at the given coordinates, or nullptr if no node is present.

See also: getNode(int, int, SBPosition3&)


function getNode [4/4]#

Returns the node at location position in the viewport and thepickedPosition according to theselectionFilter .

static SBNode * SAMSON::getNode (
    const QPoint & position,
    SBPosition3 & pickedPosition,
    const SBNodePredicate & selectionFilter=SBNode::All()
) 

Returns the node displayed at the specified viewport position and the picked 3D position.

Parameters:

  • position The viewport coordinates of the picking location
  • pickedPosition Returns the 3D coordinates of the picked point
  • selectionFilter A 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 the specified position, 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).

Returns:

A pointer to the node at the given position, or nullptr if no node is present.

See also: getNode(const QPoint&, SBPosition3&)


function getNodes [1/6]#

Stores the nodes found inside the viewport rectangle ( x ,y ,width ,height ) intonodeIndexer according to theselectionFilter .

static void SAMSON::getNodes (
    SBNodeIndexer & nodeIndexer,
    int x,
    int y,
    int width,
    int height,
    const SBNodePredicate & selectionFilter=SBNode::All(),
    bool deepSelectionFlag=false
) 

Returns the nodes displayed in the viewport rectangle.

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).

Parameters:

  • nodeIndexer The indexer which stores picked nodes
  • x The first viewport coordinate of the top left corner of the picking rectangle
  • y The second viewport coordinate of the top left corner of the picking rectangle
  • width The width of the picking rectangle
  • height The height of the picking rectangle
  • selectionFilter A node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()
  • deepSelectionFlag Whether to select nodes hidden by other nodes as well; by default, this is set to false

function getNodes [2/6]#

Stores the nodes found inside the viewport rectangle ( topLeftCorner ,width ,height ) intonodeIndexer according to theselectionFilter .

static void SAMSON::getNodes (
    SBNodeIndexer & nodeIndexer,
    const QPoint & topLeftCorner,
    int width,
    int height,
    const SBNodePredicate & selectionFilter=SBNode::All(),
    bool deepSelectionFlag=false
) 

Returns the nodes displayed in the viewport rectangle.

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);

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).

Parameters:

  • nodeIndexer The indexer which stores picked nodes
  • topLeftCorner The viewport coordinates of the top left corner of the picking rectangle
  • width The width of the picking rectangle
  • height The height of the picking rectangle
  • selectionFilter A node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()
  • deepSelectionFlag Whether to select nodes hidden by other nodes as well; by default, this is set to false

function getNodes [3/6]#

Returns the nodes inside the selection lasso with contour selectionLasso intonodeIndexer according to theselectionFilter .

static void SAMSON::getNodes (
    SBNodeIndexer & nodeIndexer,
    const SBVector< QPoint > & selectionLasso,
    const SBNodePredicate & selectionFilter=SBNode::All(),
    bool deepSelectionFlag=false
) 

Returns the nodes displayed in a selection lasso.

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).

Parameters:

  • nodeIndexer The indexer which stores picked nodes
  • selectionLasso The vector of viewport coordinates that form the selection lasso
  • selectionFilter A node predicate for the selection filter; by default, it is equal to SBDDataGraphNode::All()
  • deepSelectionFlag Whether to select nodes hidden by other nodes as well; by default, this is set to false

function getNodes [4/6]#

Collects nodes from the active document into nodeIndexer based on aselectionString .

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

Fills the provided node indexer with nodes from the active document that match a NSL selection string.

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

Parameters:

  • nodeIndexer The node indexer into which the nodes should be added.
  • selectionString A NSL 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: NSL

See also: SBNodeIndexer


function getNodes [5/6]#

Collects nodes from the active document into nodeIndexer , based on anodeType , a selection status and avisitPredicate , with or without dependencies.

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

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

Parameters:

  • nodeIndexer The node indexer into which the nodes should be added.
  • nodeType A type of nodes (SBNode::Type) that should be collected.
  • selectedNodesOnly If set to true, then only nodes that are selected, directly or via their parents, will be traversed.
  • visitPredicate A predicate that describes what nodes should be visited in the active document.
  • includeDependencies Whether 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;
SAMSON::getNodes(nodeIndexer, SBNode::Residue);
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


function getNodes [6/6]#

Collects nodes from the active document into nodeIndexer , based on aselectionPredicate and avisitPredicate , with or without dependencies.

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

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

Parameters:

  • nodeIndexer The node indexer into which the nodes should be added.
  • selectionPredicate A predicate that describes what nodes should be selected from the active document.
  • visitPredicate A predicate that describes what nodes should be visited in the active document.
  • includeDependencies Whether 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


function getNumberOfElements#

Returns the number of defined periodic table elements, including the Unknown element.

static unsigned int SAMSON::getNumberOfElements () 

Returns the total number of defined periodic table elements.

Includes all elements, including the Unknown element.

Returns:

Number of elements.


function getOpenGLFunctions#

Returns a pointer to the OpenGL functions.

static SB_OPENGL_FUNCTIONS * SAMSON::getOpenGLFunctions () 

Returns a pointer to the OpenGL functions used by SAMSON's renderer.

Returns:

Pointer to an SB_OPENGL_FUNCTIONS object providing access to the OpenGL API.


function getPaletteFromUser#

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 SBPalette * SAMSON::getPaletteFromUser (
    const QString & dialogTitle,
    bool & ok,
    const SBPalette * defaultPalette=nullptr,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select a color palette.

Displays a palette selection dialog with title dialogTitle. The user may confirm or cancel. The selected palette is returned, and ok indicates whether the user confirmed.

Parameters:

  • dialogTitle Title of the dialog.
  • ok Output flag set to true if the user confirmed the selection.
  • defaultPalette Optional default palette displayed in the dialog.
  • logo Optional logo displayed in the dialog.

Returns:

Pointer to the selected SBPalette, or nullptr if the user canceled.


function getPathFromUser#

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

static bool SAMSON::getPathFromUser (
    const QString & dialogTitle,
    QString & result,
    const QPixmap & logo=QPixmap()
) 

Prompts the user to select a filesystem path.

Displays a directory selection dialog with title dialogTitle. The selected path is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the selected path.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected a path, false if the dialog was canceled.


function getPeriod#

Returns the period of periodic table element element .

static std::string SAMSON::getPeriod (
    SBMElement::Type element
) 

Returns the period of the specified element.

Retrieves the period (row) in the periodic table for the given element type.

Parameters:

  • element The element type.

Returns:

The period as a string.


function getPixmap#

Returns the pixmap with the given name pixmapName , the given element uuiduuid .

static QPixmap SAMSON::getPixmap (
    const QString & pixmapName,
    const SBUUID & uuid
) 

Retrieves a pixmap resource.

Parameters:

  • pixmapName Name of the pixmap resource.
  • uuid UUID of the requesting element.

Returns:

The QPixmap associated with the given name and element.


function getPlainTextFromUser#

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

static bool SAMSON::getPlainTextFromUser (
    const QString & dialogTitle,
    QString & result,
    int maxSize=0,
    const QString & placeholderText="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to input multi-line plain text.

Displays a plain text input dialog with title dialogTitle. The entered text is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the entered text.
  • maxSize Maximum allowed length of the text; 0 for unlimited.
  • placeholderText Placeholder text shown in the input field when it is empty.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered text, false if the dialog was canceled.


function getPreference#

Returns the value of preference preferenceName for the class with UUIDclassUUID .

static SBValue SAMSON::getPreference (
    const SBCContainerUUID & classUUID,
    const std::string & preferenceName
) 

Retrieves the value of a preference for a given class.

Parameters:

  • classUUID The UUID of the class whose preference is requested.
  • preferenceName The name of the preference to retrieve.

Returns:

The value of the requested preference.


function getPreferenceSize#

Returns the size of preference preferenceName in the class with UUIDclassUUID when relevant.

static unsigned int SAMSON::getPreferenceSize (
    const SBCContainerUUID & classUUID,
    const std::string & preferenceName
) 

Retrieves the size of a preference for a given class.

Parameters:

  • classUUID The UUID of the class whose preference size is requested.
  • preferenceName The name of the preference.

Returns:

The size of the specified preference.


function getProgressBarValue#

Returns the current value of the progress bar.

static int SAMSON::getProgressBarValue () 

Retrieves the current value of the progress bar.

Returns the current progress value as set by the last call to setProgressBarValue.

Returns:

The current progress bar value.


function getPromptFromUser#

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

static bool SAMSON::getPromptFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & placeholderText="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to input a prompt string.

Displays a prompt dialog with title dialogTitle. The entered text is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the entered string.
  • placeholderText Placeholder text shown in the input field when it is empty.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered a string, false if the dialog was canceled.


function getProxy [1/2]#

Returns the proxy of a class.

static SBProxy * SAMSON::getProxy (
    const SBCContainerUUID & classUUID
) 

Retrieves the proxy for a class given its UUID.

Parameters:

  • classUUID UUID of the class.

Returns:

Pointer to the SBProxy, or nullptr if not found.


function getProxy [2/2]#

Returns the proxy of a class.

static SBProxy * SAMSON::getProxy (
    const std::string & className,
    const SBUUID & elementUUID=SBUUID ()
) 

Retrieves the proxy for a class given its name and element UUID.

Parameters:

  • className Name of the class.
  • elementUUID UUID of the element.

Returns:

Pointer to the SBProxy, or nullptr if not found.


function getProxyIndexer#

Returns all proxies corresponding to a given class type classType .

static SBIndexer< SBProxy * > const * SAMSON::getProxyIndexer (
    SBCClass::Type classType
) 

Retrieves the indexer of proxies for a given class type.

Parameters:

  • classType The type of class for which to get the proxy indexer.

Returns:

Pointer to the proxy indexer, or nullptr if none.


function getPublicName#

Returns the public name of SAMSON.

static std::string SAMSON::getPublicName (
    bool includeVersion=false,
    bool includeHashInVersion=false
) 

Returns the public name of SAMSON, optionally including version information.

Parameters:

  • includeVersion true to include the version number in the name.
  • includeHashInVersion true to include the hash in the version string.

Returns:

The public name as a std::string.


function getPublicVersionNumber#

Returns the "public version number" of SAMSON.

static std::string SAMSON::getPublicVersionNumber () 

Returns the public version string of SAMSON.

Returns:

Version string.


function getReplyFromUser#

Asks the user to reply to a question.

static void SAMSON::getReplyFromUser (
    const SBCContainerUUID & developerUUID,
    const SBCContainerUUID & questionUUID
) 

Sends a reply from the user to the feedback collector service.

Retrieves the current user's UUID and forwards the reply associated with the given developerUUID and questionUUID to the feedback collector.

Parameters:

  • developerUUID UUID of the developer who asked the question.
  • questionUUID UUID of the question for which a reply is being provided.

function getSAMSONElementsPath#

Returns the path where SAMSON Extensions (previously called SAMSON Elements) are installed.

static std::string SAMSON::getSAMSONElementsPath () 

Returns the path where SAMSON extensions are installed.

Retrieves the directory containing SAMSON extensions.

Returns:

The SAMSON extensions path as a std::string.


function getSAMSONPath#

Returns the path where SAMSON is installed.

static std::string SAMSON::getSAMSONPath () 

Returns the installation path of SAMSON.

Retrieves the path where the SAMSON application is installed.

Returns:

The SAMSON installation path as a std::string.


function getSaveFileNameFromUser#

Gets a filename from the user in a modal pop-up dialog with Save button.

static bool SAMSON::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()
) 

Prompts the user to select a file name for saving.

Displays a file save dialog with title dialogTitle. The selected file name is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the selected file name.
  • dir Initial directory shown in the dialog.
  • filter File filter string.
  • selectedFilter Pointer to a string that receives the selected filter; may be nullptr.
  • options QFileDialog options to customize the dialog.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user selected a file name, false if the dialog was canceled.


function getScaleFlag#

Returns true when the scale should be displayed in the viewport.

static bool SAMSON::getScaleFlag () 

Returns whether the scale bar is displayed in the viewport.

Returns:

true if the scale bar is shown, otherwise false.


function getScratchPath#

Returns the path to scratch data.

static std::string SAMSON::getScratchPath () 

Returns the scratch data directory path.

Retrieves the directory used for temporary or scratch data.

Returns:

The scratch path as a std::string.


function getSelectionColor#

Returns the selection color.

static const float * SAMSON::getSelectionColor () 

Returns the current selection color used in the viewport.

Returns:

A pointer to an array of three floats representing the RGB components of the selection color.


function getSelectionOpacity#

Returns the selection opacity.

static float SAMSON::getSelectionOpacity () 

Returns the opacity of the selection overlay in the viewport.

Returns:

The selection opacity as a float.


function getSelectionOutlineOpacity#

Returns the selection outline opacity.

static float SAMSON::getSelectionOutlineOpacity () 

Returns the opacity of the selection outline in the viewport.

Returns:

The selection outline opacity as a float.


function getShortcutString#

Returns the shortcut string corresponding to a specific keySequence .

static QString SAMSON::getShortcutString (
    QKeySequence keySequence
) 

Returns a textual representation of a key sequence.

Parameters:

  • keySequence The key sequence to convert.

Returns:

Human‑readable shortcut string.


function getSimulationFlag#

Returns true when interactive simulation is on.

static bool SAMSON::getSimulationFlag () 

Returns true when interactive simulation is on.

When interactive simulation is started, all active simulators in the active document periodically perform a time step.

Returns:

true if interactive simulation is active; false otherwise.

See also: startSimulation, stopSimulation, toggleSimulation, setSimulationFlag


function getSpecularIntensity#

Returns the specular intensity of light lightIndex .

static float SAMSON::getSpecularIntensity (
    unsigned int lightIndex
) 

Returns the specular intensity of a light source.

Parameters:

  • lightIndex Index of the light.

Returns:

Specular intensity as a float.


function getSpecularPower#

Returns the specular power of light lightIndex .

static float SAMSON::getSpecularPower (
    unsigned int lightIndex
) 

Returns the specular power (shininess) of a light source.

Parameters:

  • lightIndex Index of the light.

Returns:

Specular power as a float.


function getStringFromUser#

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

static bool SAMSON::getStringFromUser (
    const QString & dialogTitle,
    QString & result,
    const QString & placeholderText="",
    const QPixmap & logo=QPixmap()
) 

Prompts the user to input a string.

Displays a text input dialog with title dialogTitle. The entered string is stored in result.

Parameters:

  • dialogTitle Title of the dialog.
  • result Output parameter that receives the entered string.
  • placeholderText Placeholder text shown in the input field when it is empty.
  • logo Optional logo displayed in the dialog.

Returns:

true if the user entered a string, false if the dialog was canceled.


function getTime#

Returns SAMSON's internal time.

static SBCTime SAMSON::getTime () 

Returns SAMSON's internal time.

Retrieves the current simulation or system time used by SAMSON.

Returns:

The internal time as an SBCTime object.


function getTransparentBackgroundFlag#

Returns true when the background should be transparent.

static bool SAMSON::getTransparentBackgroundFlag () 

Returns whether the viewport background is transparent when capturing images.

Returns:

true if transparent background is enabled, otherwise false.


function getUserAcademicFlag#

Returns true when the user is an academic.

static bool SAMSON::getUserAcademicFlag () 

Returns whether the user has an academic flag.

Indicates if the current user is flagged as an academic user.

Returns:

true if the user is academic; otherwise false.


function getUserDataPath#

Returns the path where user data is installed.

static std::string SAMSON::getUserDataPath () 

Returns the user data directory path.

Retrieves the directory where user data is stored.

Returns:

The user data path as a std::string.


function getUserPlan#

Returns the user plan.

static SBUserPlan SAMSON::getUserPlan () 

Returns the current user plan.

Retrieves the user plan stored in the kernel.

Returns:

The user plan as an SBUserPlan enumeration value.


function getUserPlanString#

Returns a string containing the user plan.

static std::string SAMSON::getUserPlanString () 

Returns the current user plan as a string.

Retrieves the user plan stored in the kernel and returns it as a std::string.

Returns:

The user plan string.


function getVanDerWaalsAtomRadiusFlag#

Returns true when atoms are displayed with a radius proportional to their van der Waals radius.

static bool SAMSON::getVanDerWaalsAtomRadiusFlag () 

Returns whether atom radii are based on Van der Waals radii.

This function returns true when atoms are displayed with a radius proportional to their Van der Waals radius, rather than a constant radius.

Returns:

true if Van der Waals atom radius is used, false otherwise.


function 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)

static float SAMSON::getVanDerWaalsAtomRadiusRatio () 

Returns the scaling ratio applied to Van der Waals radii.

This function returns the constant factor by which the Van der Waals radius is multiplied to represent atoms in the viewport.

Returns:

Scaling ratio for Van der Waals atom radii.


function getVanDerWaalsRadius#

Returns the van der Waals radius of periodic table element element .

static SBQuantity::length SAMSON::getVanDerWaalsRadius (
    SBMElement::Type element
) 

Returns the van der Waals radius of a periodic table element.

This function queries the periodic table database for the van der Waals radius of the specified element.

Parameters:

  • element The periodic table element type.

Returns:

The van der Waals radius of the element.


function getVersionNumber#

Returns the version number of SAMSON.

static SBCContainerVersionNumber SAMSON::getVersionNumber () 

Returns the internal version number of SAMSON.

Returns:

A SBCContainerVersionNumber representing the version.


function getViewportFont#

Returns the font used for text in the viewport.

static QFont SAMSON::getViewportFont () 

Returns the font used for text rendering in the viewport.

Returns:

A QFont representing the viewport font.


function getViewportHeight#

Returns the viewport height.

static int SAMSON::getViewportHeight () 

Returns the height of the active viewport in pixels.

This function retrieves the current height of the viewport used for rendering and user interaction.

Returns:

The viewport height in pixels.


function getViewportPixelRatio#

Returns the viewport pixel ratio.

static double SAMSON::getViewportPixelRatio () 

Returns the pixel ratio of the active viewport.

The pixel ratio accounts for high‑DPI displays and indicates the factor between device pixels and logical pixels.

Returns:

The viewport pixel ratio as a double.


function getViewportPositionFromWorldPosition#

Returns the projection in the viewport of a given world position .

static SBVector3 SAMSON::getViewportPositionFromWorldPosition (
    const SBPosition3 & position
) 

Returns the viewport coordinates corresponding to a world position.

This function projects the given 3‑D world position onto the 2‑D viewport, returning the viewport coordinates as an SBVector3.

Parameters:

  • position The world position to project.

Returns:

The viewport coordinates as an SBVector3.


function getViewportWidth#

Returns the viewport width.

static int SAMSON::getViewportWidth () 

Returns the width of the active viewport in pixels.

This function retrieves the current width of the viewport used for rendering and user interaction.

Returns:

The viewport width in pixels.


function getWorldPositionFromViewportPosition [1/4]#

Returns the 3D position that corresponds to the viewport location ( x ,y )

static SBPosition3 SAMSON::getWorldPositionFromViewportPosition (
    double x,
    double y
) 

Returns the world position corresponding to viewport coordinates.

This function maps the given viewport coordinates (x, y) to a 3‑D position in world space, assuming a default plane for the conversion.

Parameters:

  • x The x coordinate in the viewport.
  • y The y coordinate in the viewport.

Returns:

The corresponding world position as an SBPosition3.


function getWorldPositionFromViewportPosition [2/4]#

Returns the 3D position that corresponds to the viewport location ( x ,y ) in the plane containingpointInPlane .

static SBPosition3 SAMSON::getWorldPositionFromViewportPosition (
    double x,
    double y,
    const SBPosition3 & pointInPlane
) 

Returns the world position corresponding to viewport coordinates on a specific plane.

This function maps the given viewport coordinates (x, y) to a 3‑D position in world space that lies on the plane containing pointInPlane.

Parameters:

  • x The x coordinate in the viewport.
  • y The y coordinate in the viewport.
  • pointInPlane A point defining the plane on which the world position is computed.

Returns:

The world position on the specified plane as an SBPosition3.


function getWorldPositionFromViewportPosition [3/4]#

Returns the 3D position that corresponds to the viewport location ( x ,y )

static SBPosition3 SAMSON::getWorldPositionFromViewportPosition (
    const QPoint & position
) 

Returns the world position corresponding to a viewport point.

This function maps the given viewport point to a 3‑D world position using the default plane.

Parameters:

  • position The viewport point.

Returns:

The world position as an SBPosition3.


function getWorldPositionFromViewportPosition [4/4]#

Returns the 3D position that corresponds to the viewport location ( x ,y ) in the plane containingpointInPlane .

static SBPosition3 SAMSON::getWorldPositionFromViewportPosition (
    const QPoint & position,
    const SBPosition3 & pointInPlane
) 

Returns the world position corresponding to a viewport point on a specific plane.

This function maps the given viewport point to a 3‑D world position that lies on the plane containing pointInPlane.

Parameters:

  • position The viewport point.
  • pointInPlane A point defining the plane for the conversion.

Returns:

The world position on the specified plane as an SBPosition3.


function hasNode [1/3]#

Checks for the presence nodes in the active document based on a selectionString .

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

Checks whether any nodes match a NSL selection string in the active document.

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

Parameters:

  • selectionString A NSL 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: NSL

Returns:

true if at least one node matches the selection; false otherwise.


function hasNode [2/3]#

Checks for the presence nodes in the active document based on a nodeType , a selection status and avisitPredicate , with or without dependencies.

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

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

Parameters:

  • nodeType A type of nodes (SBNode::Type) that should be checked.
  • selectedNodesOnly If set to true, then only nodes that are selected, directly or via their parents, will be traversed.
  • visitPredicate A predicate that describes what nodes should be visited in the active document.
  • includeDependencies Whether 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:

bool res = SAMSON::hasNode(SBNode::Residue);
checks for residue nodes in the active document.

Returns:

Returns true if at least one matching node exists in the active document; otherwise returns false.

See also: SBNode::getNodes , SBNodeIndexer , SBNodePredicate


function hasNode [3/3]#

Checks for the presence nodes in the active document based on a selectionPredicate and avisitPredicate , with or without dependencies.

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

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

Parameters:

  • selectionPredicate A predicate that describes what nodes should be checked for in the active document.
  • visitPredicate A predicate that describes what nodes should be visited in the active document.
  • includeDependencies Whether 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());
checks for all terminal residue nodes in the active document.

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

Returns:

Returns true if at least one matching node exists in the active document; otherwise returns false.

See also: SBNode::getNodes , SBNodeIndexer , SBNodePredicate


function hideProgressBar#

Hides the progress bar.

static void SAMSON::hideProgressBar () 

Closes the progress bar displayed by showProgressBar.

See also: showProgressBar, isProgressBarStopped, setProgressBarValue


function hideTip#

Hides the last tip window.

static void SAMSON::hideTip () 


function hold [1/4]#

Holds an object.

static void SAMSON::hold (
    void * object
) 

Holds a generic object for later undo/redo.

Parameters:

  • object Pointer to the object to hold.

function hold [2/4]#

Holds a node and its descendants.

static void SAMSON::hold (
    SBNode * node
) 

Holds a node and its descendants for later undo/redo.

Parameters:

  • node The node to hold.

function hold [3/4]#

Holds a command.

static void SAMSON::hold (
    SBUndoCommand * undoCommand
) 

Holds an undo command for later undo/redo.

Parameters:

  • undoCommand The command to hold.

function hold [4/4]#

Holds a pointer target allocated on the heap.

static void SAMSON::hold (
    SBPointerTarget * pointerTarget
) 

Parameters:

  • pointerTarget The pointer target to hold.

function holdArray#

Holds an array allocated on the heap.

static void SAMSON::holdArray (
    void * array
) 

Parameters:

  • array Pointer to the array to hold.

function importFromFile [1/2]#

Import a file from the disk.

static void SAMSON::importFromFile (
    const std::string & fileName,
    const SBValueMap & parameterMap=SBValueMap {},
    SBDDocumentFolder * preferredFolder=nullptr,
    SBIFileImporter * importer=nullptr
) 

Imports a file into SAMSON.

Imports the specified file using the given parameters, preferred folder, and importer.

Parameters:

  • fileName The name of the file to import.
  • parameterMap A map of parameters to pass to the importer.
  • preferredFolder The folder where the imported document should be placed, or nullptr to use the default.
  • importer An optional importer to use; if nullptr, the appropriate importer is selected automatically.

function importFromFile [2/2]#

Import files from the disk.

static void SAMSON::importFromFile (
    const QStringList & fileNameList,
    const SBValueMap & parameterMap=SBValueMap {},
    SBDDocumentFolder * preferredFolder=nullptr,
    SBIFileImporter * importer=nullptr
) 

Imports one or more files into the current SAMSON session.

This function forwards the import request to the main window, which will handle opening the specified files using the appropriate importer.

Parameters:

  • fileNameList List of file names (paths) to import.
  • parameterMap Optional map of parameters passed to the importer.
  • preferredFolder Optional folder in the document hierarchy where the imported content should be placed.
  • importer Optional specific file importer to use. If null, the appropriate importer is selected automatically.

function informUser [1/4]#

Informs the user with a message in a modal pop-up dialog.

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

Shows a modal pop-up dialog informing the user with a title and message.

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.");

Parameters:

  • dialogTitle Title of the dialog.
  • dialogText Message text displayed in the dialog.
  • logo Optional logo pixmap displayed in the dialog.

See also: askUser


function informUser [2/4]#

Informs the user with a message and text in a modal pop-up dialog.

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

Shows a modal pop-up dialog informing the user with a title, label, and text.

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");

Parameters:

  • dialogTitle Title of the dialog.
  • labelText Label text displayed above the main text.
  • text Main text content displayed in the dialog.
  • monospaceFont If true, uses a monospace font for the text.
  • logo Optional logo pixmap displayed in the dialog.

See also: askUser


function informUser [3/4]#

Informs the user with a widget in a modal pop-up dialog.

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

Shows a modal pop-up dialog informing the user with a custom SBGWindowWidget.

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;

Parameters:

  • widget Custom SBGWindowWidget to display in the dialog.
  • logo Optional logo pixmap displayed in the dialog.

See also: askUser


function informUser [4/4]#

Informs the user with a widget in a modal pop-up dialog.

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

Shows a modal pop-up dialog informing the user with a custom widget.

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;

Parameters:

  • widget Custom widget to display in the dialog.
  • logo Optional logo pixmap displayed in the dialog.

See also: askUser


function isGUIThread#

Returns true if called from the main thread (GUI thread), else return false.

static bool SAMSON::isGUIThread () 

Determines whether the calling thread is the GUI thread.

Returns:

true if the current thread is the GUI thread, otherwise false.


function isHolding#

Returns true when SAMSON is holding.

static bool SAMSON::isHolding () 

Checks whether SAMSON is currently holding changes for undo/redo.

Returns:

true if SAMSON is holding, false otherwise.


function isProgressBarStopped#

Returns true when the progress bar is stopped.

static bool SAMSON::isProgressBarStopped () 

Returns whether the progress bar was stopped/canceled by the user.

Checks if the user has canceled the progress bar.

Returns:

true if the progress bar was stopped, false otherwise.


function isRedoing#

Returns true while redoing.

static bool SAMSON::isRedoing () 

Checks whether SAMSON is currently performing a redo operation.

Returns:

true if redoing, false otherwise.


function isShowingTip#

Returns whether a tip is being shown.

static bool SAMSON::isShowingTip (
    const SBUUID & tipUUID=SBUUID ()
) 

Checks whether a tip with the given UUID is currently shown.

Parameters:

  • tipUUID UUID of the tip to query.

Returns:

true if the tip is displayed, otherwise false.


function isUndoing#

Returns true while undoing.

static bool SAMSON::isUndoing () 

Checks whether SAMSON is currently performing an undo operation.

Returns:

true if undoing, false otherwise.


function makeAnimation#

Makes an animation.

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

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

Parameters:

  • name The name of animation object.
  • nodeIndexer The node indexer with nodes the animation should be applied to.
  • currentFrame The frame at which the animation should start.
  • animationClassName The name of the animation class.
  • animationElementUUID The UUID of the extension with the animation class.
  • animationParameterMap The value map with parameters for the animation.

Returns:

A pointer to the created animation object; nullptr if could not create the object.


function makeController#

Makes a controller.

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

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

Parameters:

  • controllerClassName The name of the controller class.
  • controllerElementUUID The UUID of the extension with the controller class.
  • controllerParameterMap The value map with parameters for the controller.

Returns:

A pointer to the created controller object; nullptr if could not create the object.


function makeInteractionModel#

Makes an interaction model.

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

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

Parameters:

  • dynamicalModel A pointer to the dynamical model object.
  • interactionModelClassName The name of the interaction model class.
  • interactionModelElementUUID The UUID of the extension with the interaction model class.
  • interactionModelParameterMap The value map with parameters for the interaction model.

Returns:

A pointer to the created interaction model object; nullptr if could not create the object.


function makeNeighborSearch#

Makes a neighbor search algorithm.

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

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

Parameters:

  • dynamicalModel A pointer to the dynamical model object.
  • cutoffDistance The cutoff distance for the neighbor search algorithm.
  • neighborSearchClassName The name of the neighbor search class.
  • neighborSearchElementUUID The UUID of the extension with the neighbor search class.

Returns:

A pointer to the created neighbor search object; nullptr if could not create the object.

SBSNeighborSearchParticleSystem* neighborSearch = SAMSON::makeNeighborSearch(particleSystem, SBQuantity::nanometers(10.0), "NeighborSearchClass", neighborSearchExtensionUUID);

function makeNodePredicate#

Make a node predicate based on a selectionString .

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

Creates a node predicate based on a selection string.

Makes a node predicate based on a selectionString formulated in SAMSON's NSL.

For example:

SBNodePredicate* nodePredicate = SAMSON::makeNodePredicate("H linking O");
The predicate 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.

Parameters:

  • selectionString The selection string formulated in SAMSON's NSL that defines the predicate.

Returns:

A pointer to a newly created node predicate. The caller owns the returned object and is responsible for deleting it.

See also: NSL


function makePropertyModel#

Makes a property model.

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

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

Parameters:

  • nodeIndexer The node indexer with nodes the property model should be applied to.
  • propertyModelClassName The name of the property model class.
  • propertyModelElementUUID The UUID of the extension with the property model class.
  • propertyModelParameterMap The value map with parameters for the property model.

Returns:

A pointer to the created property model object; nullptr if could not create the object.


function makeSelector#

Makes a selector.

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

Creates a selector of the specified class.

This function creates an instance of a selector based on the provided selector class name, element UUID, and optional parameter map. The created selector can be used to select nodes according to custom criteria.

Parameters:

  • selectorClassName The name of the selector class to instantiate.
  • selectorElementUUID The UUID of the selector element (optional; default is empty).
  • selectorParameterMap A map of parameters to configure the selector (optional).

Returns:

A pointer to the newly created SBNodeSelector object; nullptr if could not create the object.


function makeSimulator#

Makes a simulator.

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

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

Parameters:

  • nodeIndexer The node indexer with nodes the simulator should be applied to.
  • interactionModelClassName The name of the interaction model class.
  • interactionModelElementUUID The UUID of the extension with the interaction model class.
  • interactionModelParameterMap The value map with parameters for the interaction model.
  • stateUpdaterClassName The name of the state updater class.
  • stateUpdaterElementUUID The UUID of the extension with the state updater class.
  • stateUpdaterParameterMap The value map with parameters for the state updater.

Returns:

A pointer to the created simulator object; 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);

function makeStateUpdater#

Makes a state updater.

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

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

Parameters:

  • dynamicalModel A pointer to the dynamical model object.
  • interactionModel A pointer to the interaction model object.
  • stateUpdaterClassName The name of the state updater class.
  • stateUpdaterElementUUID The UUID of the extension with the state updater class.
  • stateUpdaterParameterMap The value map with parameters for the state updater.

Returns:

A pointer to the created state updater object; nullptr if could not create the object.

SBStateUpdaterParticleSystem* stateUpdater = SAMSON::makeStateUpdater(particleSystem, interactionModel, "StateUpdaterClass", stateUpdaterExtensionUUID);

function makeViewportCursor#

Makes a viewport cursor.

static QCursor SAMSON::makeViewportCursor (
    const QString & fileName,
    int height,
    int hotX=-1,
    int hotY=-1
) 

Creates a custom cursor for the viewport from an image file.

This function loads an image from fileName, creates a cursor of the specified height, and optionally sets the hotspot coordinates.

Parameters:

  • fileName The path to the image file used for the cursor.
  • height The height of the cursor in pixels.
  • hotX The x-coordinate of the cursor hotspot (default -1, meaning centered).
  • hotY The y-coordinate of the cursor hotspot (default -1, meaning centered).

Returns:

The created QCursor.


function makeVisualModel#

Makes a visual model.

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

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

Parameters:

  • nodeIndexer The node indexer with nodes the visual model should be applied to.
  • visualModelClassName The name of the visual model class.
  • visualModelElementUUID The UUID of the extension with the visual model class.
  • visualModelParameterMap The value map with parameters for the visual model.

Returns:

A pointer to the created visual model object; nullptr if could not create the object.

SBVisualModel* visualModel = SAMSON::makeVisualModel(nodeIndexer, "VisualModelClass", visualModelExtensionUUID);

function minimize#

Minimize atoms in the nodeIndexer according to the provided criteria.

static bool SAMSON::minimize (
    const SBNodeIndexer & nodeIndexer,
    unsigned int maximumNumberOfSteps,
    unsigned int minimumNumberOfStepsInPlateau,
    const SBQuantity::kJPerMol & energyDifferenceCriteria,
    unsigned int printMinimizationInformationFrequency=100,
    bool askUser=false
) 

Minimizes a set of nodes according to the specified energy criteria.

This function performs an energy minimization on the atoms contained in the provided nodeIndexer. The minimization stops when either the maximum number of steps is reached or the energy change between consecutive steps falls below energyDifferenceCriteria for a given number of plateau steps. The function can optionally print information about the minimization progress and ask the user for confirmation in case of potential issues.

For minimization it uses 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.

Parameters:

  • nodeIndexer The set of nodes to be minimized. Must contain atoms.
  • maximumNumberOfSteps The maximum number of minimization steps to perform.
  • minimumNumberOfStepsInPlateau The number of consecutive steps with energy change below the threshold required to consider the minimization converged.
  • energyDifferenceCriteria The energy difference threshold between two consecutive minimization steps that defines convergence.
  • printMinimizationInformationFrequency The interval (in steps) at which minimization information is printed to the console. Set to 0 to suppress output. Note: printing information too often might decrease the performance. The default value is 100.
  • askUser If true, the user may be prompted for confirmation before proceeding with the minimization. The default value is false.

Returns:

true if the minimization completed successfully or was aborted without error; false if an error occurred during setup.

For example, to minimize the whole system:

SBNodeIndexer nodeIndexer;
SAMSON::getNodes(nodeIndexer, SBNode::Atom);
SAMSON::minimize(nodeIndexer, 1000, 25, SBQuantity::kJPerMol(0.5), 100, 100);


function openPreferences [1/2]#

Opens the Preferences at the given page pageName .

static bool SAMSON::openPreferences (
    const QString & pageName
) 

Parameters:

  • pageName The name of the page at which it should open the Preferences. If it is empty then it will just open the Preferences. If there are multiple pages with the same name, then provide it as a path with '>' as a separator in the following format: "Editors > Add".

Returns:

true if found a page with pageName

Examples:

SAMSON::openPreferences("Anti-aliasing");

SAMSON::openPreferences("Editors > Add");

function openPreferences [2/2]#

Opens the Preferences at the page corresponding to the UUID uuid of a class which settings are exposed in Preferences.

static bool SAMSON::openPreferences (
    const SBUUID & uuid
) 

Parameters:

  • uuid The UUID of an app, editor, or other class that has its settings exposed in Preferences. If the uuid is not valid then it will just open the Preferences.

Returns:

true if found a page with the given uuid


function printDataGraphState#

Prints the data graph state.

static void SAMSON::printDataGraphState () 

Prints the current data graph state.

Calls Data::getDocumentManager().print() to output the state of the data graph.


function printFullMemoryUsage#

Prints full memory usage.

static void SAMSON::printFullMemoryUsage () 

Prints full memory usage information.

Calls Core::printFullMemoryUsage() to display detailed memory usage statistics.


function printMemoryUsage#

Prints memory usage.

static void SAMSON::printMemoryUsage () 

Prints memory usage information.

Calls Core::printMemoryUsage() to display memory usage statistics.


function printRendererState#

Prints the renderer state.

static void SAMSON::printRendererState () 

Prints the current renderer state.

Calls GUI::getRenderer().print() to output the state of the renderer.


function printUndoStack#

Prints the undo stack.

static void SAMSON::printUndoStack () 

Prints the current undo stack.

Calls Core::printUndoStack() to display the undo stack.


function redo#

Redo one command.

static void SAMSON::redo () 

Redoes the last undone command.


function registerAction#

Registers a new action visible for all users.

static void SAMSON::registerAction (
    SBAction * action
) 

Registers a SAMSON action with the UI.

Parameters:

  • action The action to register.

function registerCursor [1/2]#

Register the cursor based on the given name name , the given element uuiduuid , the given descriptiondescription , the given filePathfilePath .

static bool SAMSON::registerCursor (
    const QString & name,
    const SBUUID & uuid,
    const QString & filePath,
    const QString & description=QString()
) 

Registers a cursor resource.

Parameters:

  • name Resource name.
  • uuid UUID of the element registering the resource.
  • filePath File path to the cursor image.
  • description Description of the resource.

Returns:

true if registration succeeded, false otherwise.


function registerCursor [2/2]#

Register the cursor based on the given name name , the given element uuiduuid , the given descriptiondescription , the given iconicon .

static bool SAMSON::registerCursor (
    const QString & name,
    const SBUUID & uuid,
    const QCursor & icon,
    const QString & description=QString()
) 

Registers a cursor resource from an existing QCursor.

Parameters:

  • name Resource name.
  • uuid UUID of the element registering the resource.
  • cursor The QCursor object to register.
  • description Description of the resource.

Returns:

true if registration succeeded, false otherwise.


function registerIcon [1/2]#

Register the icon based on the given name name , the given element uuiduuid , the given descriptiondescription , the given filePathfilePath .

static bool SAMSON::registerIcon (
    const QString & name,
    const SBUUID & uuid,
    const QString & filePath,
    const QString & description=QString()
) 

Registers an icon resource.

Parameters:

  • name Resource name.
  • uuid UUID of the element registering the resource.
  • filePath File path to the icon image.
  • description Description of the resource.

Returns:

true if registration succeeded, false otherwise.


function registerIcon [2/2]#

Register the icon based on the given name name , the given element uuiduuid , the given descriptiondescription , the given iconicon .

static bool SAMSON::registerIcon (
    const QString & name,
    const SBUUID & uuid,
    const QIcon & icon,
    const QString & description=QString()
) 

Registers an icon resource from an existing QIcon.

Parameters:

  • name Resource name.
  • uuid UUID of the element registering the resource.
  • icon The QIcon object to register.
  • description Description of the resource.

Returns:

true if registration succeeded, false otherwise.


function registerPixmap [1/2]#

Register the pixmap based on the given name name , the given element uuiduuid , the given descriptiondescription , the given filePathfilePath .

static bool SAMSON::registerPixmap (
    const QString & name,
    const SBUUID & uuid,
    const QString & filePath,
    const QString & description=QString()
) 

Registers a pixmap resource.

Parameters:

  • name Resource name.
  • uuid UUID of the element registering the resource.
  • filePath File path to the pixmap image.
  • description Description of the resource.

Returns:

true if registration succeeded, false otherwise.


function registerPixmap [2/2]#

Register the pixmap based on the given name name , the given element uuiduuid , the given descriptiondescription , the given pixmappixmap .

static bool SAMSON::registerPixmap (
    const QString & name,
    const SBUUID & uuid,
    const QPixmap & pixmap,
    const QString & description=QString()
) 

Registers a pixmap resource from an existing QPixmap.

Parameters:

  • name Resource name.
  • uuid UUID of the element registering the resource.
  • pixmap The QPixmap object to register.
  • description Description of the resource.

Returns:

true if registration succeeded, false otherwise.


function removeDialog [1/2]#

Removes a SAMSON dialog from the user interface.

static void SAMSON::removeDialog (
    SBGWindowDialog * dialog
) 

Removes a SAMSON dialog from the user interface.

Parameters:

  • dialog Pointer to the dialog to remove.

function removeDialog [2/2]#

Removes a Qt dialog from the user interface.

static void SAMSON::removeDialog (
    QDialog * dialog
) 

Parameters:

  • dialog Pointer to the QDialog to remove.

function removeDocument#

Removes a document from the list of opendocuments .

static void SAMSON::removeDocument (
    SBDDocument * document
) 

Removes a document from the open document list.

Unregisters the given document from SAMSON's document manager.

Parameters:

  • document Pointer to the document to remove.

function removeFromSelection#

Removes nodes from the active document to the selection based on a selectionString .

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

Removes nodes from the current selection based on a NSL selection string.

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

Parameters:

  • selectionString A NSL expression string describing the selection.

For example:

SAMSON::removeFromSelection("node.type residue within 4A of S");
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: NSL


function removeWidget [1/2]#

Removes a SAMSON widget from the user interface.

static void SAMSON::removeWidget (
    SBGWindowWidget * widget
) 

Removes a SAMSON widget from the user interface.

Parameters:

  • widget Pointer to the widget to remove.

function removeWidget [2/2]#

Removes a Qt widget from the user interface.

static void SAMSON::removeWidget (
    QWidget * widget
) 

Parameters:

  • widget Pointer to the QWidget to remove.

function removeWindow#

Removes a window from the user interface.

static void SAMSON::removeWindow (
    SBGWindow * window
) 

Parameters:

  • window Pointer to the window to remove.

function requestViewportFocus#

Requests a viewport focus.

static void SAMSON::requestViewportFocus () 

Requests input focus for the active viewport.

This function sets the focus to the active viewport, ensuring that subsequent keyboard and mouse events are directed to it.


function requestViewportUpdate#

Requests a viewport update.

static void SAMSON::requestViewportUpdate () 

Requests an update of the viewport.

This function allows SAMSON extensions to request an update of the viewport. It is useful when an editor displays an interface (e.g., a rectangle selection editor) or temporary objects (e.g., a transparent nanotube while the user selects 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 extension requests an update.


function runPythonCode#

Executes Python code codeString in the Python Console. IfraisePythonConsole istrue then it raises the Python Console.

static bool SAMSON::runPythonCode (
    const std::string & codeString,
    bool raisePythonConsole=false
) 

Executes a string of Python code.

Parameters:

  • codeString The Python code to execute.
  • raisePythonConsole If true, raises the Python console before execution.

Returns:

true if the code was executed successfully, false otherwise.


function runPythonFile#

Executes Python script file fileName in the Python Console. IfraisePythonConsole istrue then it raises the Python Console.

static bool SAMSON::runPythonFile (
    const std::string & fileName,
    bool raisePythonConsole=false
) 

Executes a Python script file.

Parameters:

  • fileName The path to the Python script file to execute.
  • raisePythonConsole If true, raises the Python console before execution.

Returns:

true if the script was executed successfully, false otherwise.


function select#

Selects nodes from the active document based on a selectionString .

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

Selects nodes from the active document based on a NSL selection string.

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

Parameters:

  • selectionString A NSL expression string describing the selection.

For example:

SAMSON::select("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").

See also: NSL


function setActiveDocument#

Sets the active document .

static void SAMSON::setActiveDocument (
    SBDDocument * document
) 

Sets the active document.

Changes the currently active document to the specified one.

Parameters:

  • document Pointer to the document to set as active.

function setActiveDocumentFilter#

Sets the node filter of the active document.

static void SAMSON::setActiveDocumentFilter (
    const std::string & filter
) 

Sets the node filter for the active document.

Updates the filter text used to display nodes in the active document.

Parameters:

  • filter The filter string to set.

function setActiveEditor [1/2]#

Sets the current editor.

static void SAMSON::setActiveEditor (
    SBEditor * editor
) 

Sets the active editor.

This function sets the specified editor as the currently active editor in the SAMSON user interface.

Parameters:

  • editor A pointer to the editor to be set as active.

function setActiveEditor [2/2]#

Sets the current editor.

static void SAMSON::setActiveEditor (
    const SBUUID & classUUID,
    const SBUUID & elementUUID
) 

Sets the active editor based on class and element UUIDs.

This function sets the active editor by locating an editor with the specified class and element UUIDs and making it active.

Parameters:

  • classUUID The UUID of the editor class.
  • elementUUID The UUID of the editor element.

function setActiveSelectionFilterByName#

Sets the active selection filter according to the given name selectionFilterName . Returns true in case of the success.

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

Sets the active selection filter by name.

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. The selection filter governs the selection level in the Viewport done by the default select editor.

Parameters:

  • selectionFilterName The name of the selection filter to activate.

Returns:

true if the selection filter was successfully set; false otherwise.

SAMSON::setActiveSelectionFilterByName("Residues");

function setActiveStructuralModel#

Sets the active structural model.

static void SAMSON::setActiveStructuralModel (
    SBStructuralModel * structuralModel
) 

Changes the active structural model to the specified one.

Parameters:

  • structuralModel Pointer to the structural model to set as active.

function setBusy#

Notifies the user that SAMSON is busy.

static void SAMSON::setBusy (
    bool b
) 

Sets the busy state of the application, showing a wait cursor.

Parameters:

  • b true to indicate SAMSON is busy, false otherwise.

function setCustomViewport#

Replaces the viewport with a custom widget. When widget is equal to 0, the normal viewport is restored.

static void SAMSON::setCustomViewport (
    QWidget * widget=0
) 

Replaces the viewport with a custom widget.

This function sets a custom widget as the central widget of the main window, effectively replacing the default viewport. Passing a null pointer restores the normal viewport.

Parameters:

  • widget The custom widget to set as the viewport, or nullptr to restore the default viewport.

function setHeadsetParameters#

Sets the panel size of the headset.

static bool SAMSON::setHeadsetParameters (
    int panelWidth,
    int panelHeight,
    unsigned int leftFrameBuffer,
    unsigned int rightFrameBuffer
) 

Sets the parameters of the VR headset viewport.

Parameters:

  • panelWidth The width of a panel (for one eye)
  • panelHeight The height of a panel (for one eye)
  • leftFrameBuffer The index of the external frame buffer for the left eye
  • rightFrameBuffer The 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.

Returns:

true if the parameters were successfully applied, otherwise false.


function setMinimizationFlag#

Sets the interactive Minimization flag.

static void SAMSON::setMinimizationFlag (
    bool minimizationFlag
) 

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.

Parameters:

  • minimizationFlag If true, interactive minimization is started; otherwise it is stopped.

See also: startMinimization, stopMinimization, toggleMinimization, getMinimizationFlag


function setPreference#

Sets the value of preference preferenceName for the class with UUIDclassUUID tovalue .

static void SAMSON::setPreference (
    const SBCContainerUUID & classUUID,
    const std::string & preferenceName,
    const SBValue & value,
    const SBValue & size=0
) 

Sets the value (and optionally size) of a preference for a given class.

Parameters:

  • classUUID The UUID of the class whose preference is being set.
  • preferenceName The name of the preference to set.
  • value The new value for the preference.
  • size The size of the preference value, if applicable.

function setProgressBarValue#

Sets the value of the progress bar.

static void SAMSON::setProgressBarValue (
    int value
) 

Sets the current progress bar value.

Updates the progress bar to the specified value. The update frequency is limited to at most once per second to maintain performance.

Parameters:

  • value The new progress value to set.

See also: showProgressBar, isProgressBarStopped, hideProgressBar


function setSimulationFlag#

Sets the interactive simulation flag.

static void SAMSON::setSimulationFlag (
    bool simulationFlag
) 

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.

Parameters:

  • simulationFlag If true, interactive simulation is started; otherwise it is stopped.

See also: startSimulation, stopSimulation, toggleSimulation, getSimulationFlag


function setStatusMessage#

Shows a message in the status bar.

static void SAMSON::setStatusMessage (
    const QString & message,
    int time=0
) 

Sets a status message in the main window's status bar.

Parameters:

  • str Message text.
  • t Optional display time in milliseconds (0 for default).

function setViewportCursor [1/2]#

Sets the viewport cursor.

static void SAMSON::setViewportCursor (
    const QCursor & cursor
) 

Sets the viewport cursor to a custom cursor.

This function changes the cursor displayed in the viewport to the specified QCursor.

Parameters:

  • cursor The QCursor to set for the viewport.

function setViewportCursor [2/2]#

Sets the viewport cursor.

static void SAMSON::setViewportCursor (
    Qt::CursorShape cursorShape
) 

Sets the viewport cursor to a predefined cursor shape.

This function changes the cursor displayed in the viewport to the specified Qt::CursorShape.

Parameters:

  • cursorShape The shape of the cursor to set.

function setup#

Initializes the SAMSON environment.

static void SAMSON::setup () 

Performs the initial setup of the SAMSON core, including user plan retrieval, kernel initialization, reflection setup, document manager initialization, and rendering configuration. This function is called once at application start.


function showContextMenu#

Shows the context menu.

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

Shows the context menu at a given viewport position.

This function displays the context menu at the specified position. The optional highlightedNode pointer can be provided to show context actions related to a specific node.

Parameters:

  • position The viewport position where the context menu should appear.
  • highlightedNode An optional node for which context actions are displayed; may be nullptr.

function showProgressBar#

Shows the progress bar.

static 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"
) 

Shows a progress bar with the given name.

Displays a progress bar with the title name, ranging from minimum to maximum. The progress bar will remain visible for at least minimumDuration seconds. The user can cancel the progress if isCancellable is true.

Parameters:

  • name Title of the progress bar.
  • minimum Minimum progress value (typically 0).
  • maximum Maximum progress value.
  • minimumDuration Minimum duration for which the progress bar is shown, in seconds.
  • isCancellable Whether the progress bar includes a cancel button.
  • cancelButtonText Text displayed on the cancel button (default "Cancel").

See also: isProgressBarStopped, setProgressBarValue, hideProgressBar


function showProperties#

Shows the properties widget of a node.

static bool SAMSON::showProperties (
    SBNode * node
) 

Shows the properties widget for a given node.

Opens the properties dialog associated with the specified node. If the node does not have a properties widget, the function does nothing.

Parameters:

  • node The node whose properties widget should be shown.

Returns:

true if the properties widget was successfully displayed; false otherwise.


function showTip [1/3]#

Shows a tip window with a title tipTitle and texttipText at the positionrelativePosition relative to a widgetwidget .

static 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
) 

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/\" " LINK_STYLE ">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.

Parameters:

  • tipUUID UUID of the tip to display.
  • tipCategory Category string for the tip (typically the element name).
  • tipTitle Title text of the tip.
  • tipText Body text of the tip (plain or HTML).
  • widget Optional widget to which the tip position is relative; if null, tip appears at the viewport top‑right.
  • relativePosition Position of the tip's top‑left corner relative to the widget.
  • showArrow true to display an arrow pointing to the widget, otherwise false.

function showTip [2/3]#

Shows a tip window with a title tipTitle , texttipText , and imagetipPixmap at the positionrelativePosition relative to a widgetwidget .

static 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
) 

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.

Parameters:

  • tipUUID Unique identifier for the tip.
  • tipCategory Category of the tip.
  • tipTitle Title of the tip window.
  • tipText Text content of the tip.
  • tipPixmap Image to display in the tip window.
  • widget Parent widget for relative positioning (optional).
  • relativePosition Position relative to the widget (optional).
  • showArrow Whether to show an arrow pointing to the widget.
QPixmap tipPixmap(QString::fromStdString(SB_ELEMENT_PATH + "/Resource/tip-1.png"));
SAMSON::showTip(SBUUID("36A92A5A-8049-BDB3-0DD4-755ED7F41E00"), getName(), "Tip", "Information text", tipPixmap);

function showTip [3/3]#

Shows a tip window with a title tipTitle , texttipText , and gif-movietipMovie at the positionrelativePosition relative to a widgetwidget .

static 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
) 

Shows a tip window with a title tipTitle, text tipText, and gif-movie tipMoviePath 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.

Parameters:

  • tipUUID Unique identifier for the tip.
  • tipCategory Category of the tip.
  • tipTitle Title of the tip window.
  • tipText Text content of the tip.
  • tipMoviePath Path to the gif movie to display in the tip window.
  • widget Parent widget for relative positioning (optional).
  • relativePosition Position relative to the widget (optional).
  • showArrow Whether to show an arrow pointing to the widget.
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);

function signalPathTracingCompleted#

Signals a path tracing completion.

static void SAMSON::signalPathTracingCompleted () 

Emits a signal indicating that path tracing has completed.

This function notifies the system that the path tracing rendering process has finished.


function signalPathTracingStarted#

Signals a path tracing start.

static void SAMSON::signalPathTracingStarted () 

Emits a signal indicating that path tracing has started.

This function notifies the system that the path tracing rendering process has begun.


function signalPathTracingUpdated#

Signals a path tracing update.

static void SAMSON::signalPathTracingUpdated (
    int progress
) 

Emits a signal indicating the progress of path tracing.

This function notifies the system of the current progress of the path tracing rendering process.

Parameters:

  • progress An integer representing the current progress percentage.

function snap [1/7]#

Returns the snapped mouse viewport displacement ( x ,y )

static QPoint SAMSON::snap (
    int x,
    int y
) 

Returns the snapped mouse viewport displacement.

Parameters:

  • x The x-coordinate of the mouse
  • y The y-coordinate of the mouse

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

Returns:

The snapped displacement as a QPoint.


function snap [2/7]#

Returns the snapped mouse viewport displacement ( x ,y ) in the plane containingpointInPlane .

static QPoint SAMSON::snap (
    int x,
    int y,
    const SBPosition3 & pointInPlane
) 

Returns the snapped mouse viewport displacement in a specific plane.

Parameters:

  • x The x-coordinate of the mouse
  • y The y-coordinate of the mouse
  • pointInPlane The point in the plane

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

Returns:

The snapped displacement as a QPoint.


function snap [3/7]#

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

static SBQuantity::length SAMSON::snap (
    const SBQuantity::length & displacement
) 

Returns the snapped translational displacement.

Parameters:

  • displacement The translational displacement

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

Returns:

The snapped displacement, or the original displacement if snapping is disabled.


function snap [4/7]#

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

static SBQuantity::degree SAMSON::snap (
    const SBQuantity::degree & displacement
) 

Returns the snapped angular displacement.

Parameters:

  • displacement The angular displacement in degrees

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

Returns:

The snapped angular displacement, or the original displacement if snapping is disabled.


function snap [5/7]#

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

static SBLength3 SAMSON::snap (
    const SBLength3 & displacement
) 

Returns the snapped 3D translational displacement.

Parameters:

  • displacement The 3D translational displacement

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

Returns:

The snapped 3D displacement, or the original displacement if snapping is disabled.


function snap [6/7]#

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

static SBMatrix33 SAMSON::snap (
    const SBMatrix33 & rotationMatrix
) 

Returns the snapped rotation matrix.

Parameters:

  • rotationMatrix The rotation matrix

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

Returns:

The snapped rotation matrix, or the original matrix if snapping is disabled.


function snap [7/7]#

Returns the snapped spatial transform according to the translational and angular snapping parameters.

static SBSpatialTransform SAMSON::snap (
    const SBSpatialTransform & transform
) 

Returns the snapped spatial transform.

Parameters:

  • transform The spatial transform

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

Returns:

The snapped spatial transform.


function startMinimization#

Starts interactive Minimization.

static void SAMSON::startMinimization () 

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:

SAMSON::setMinimizationFlag(true);

See also: stopMinimization, toggleMinimization, getMinimizationFlag, setMinimizationFlag


function startSimulation#

Starts interactive simulation.

static void SAMSON::startSimulation () 

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

SAMSON::setSimulationFlag(true);

See also: stopSimulation, toggleSimulation, getSimulationFlag, setSimulationFlag


function startTimer#

Starts a new performance timer.

static void SAMSON::startTimer () 

Starts a performance timer.

Begins a new timer used for measuring execution time of operations.


function stopMinimization#

Stops interactive Minimization.

static void SAMSON::stopMinimization () 

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:

SAMSON::setMinimizationFlag(false);

See also: startMinimization, toggleMinimization, getMinimizationFlag, setMinimizationFlag


function stopSimulation#

Stops interactive simulation.

static void SAMSON::stopSimulation () 

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

SAMSON::setSimulationFlag(false);

See also: startSimulation, toggleSimulation, getSimulationFlag, setSimulationFlag


function stopTimer [1/2]#

Stops the top performance timer.

static void SAMSON::stopTimer (
    SBQuantity::second & elapsedTime
) 

Stops the most recent performance timer.

Retrieves the elapsed time of the timer started by startTimer.

Parameters:

  • elapsedTime Reference to a SBQuantity::second that will receive the elapsed time.

function stopTimer [2/2]#

Stops the top performance timer.

static void SAMSON::stopTimer (
    SBQuantity::second & elapsedTime,
    SBQuantity::second & totalTime
) 

Stops the most recent performance timer and returns total time.

Retrieves the elapsed time of the timer started by startTimer and also provides the total accumulated time.

Parameters:

  • elapsedTime Reference to a SBQuantity::second that will receive the elapsed time.
  • totalTime Reference to a SBQuantity::second that will receive the total accumulated time.

function toggleMinimization#

Toggles interactive Minimization on and off.

static void SAMSON::toggleMinimization () 

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


function toggleSimulation#

Toggles interactive simulation on and off.

static void SAMSON::toggleSimulation () 

When interactive simulation is started, all active simulators in the active document periodically perform a time step.

See also: startSimulation, stopSimulation, getSimulationFlag, setSimulationFlag


function undo#

Undo one command.

static void SAMSON::undo () 

Undoes the last command.


function unsetViewportCursor#

Unsets the viewport cursor.

static void SAMSON::unsetViewportCursor () 

Restores the default cursor for the viewport.

This function removes any custom cursor set for the viewport, reverting to the default cursor.


function updateHeadsetViewport#

Updates the headset viewport.

static bool SAMSON::updateHeadsetViewport (
    bool isLeftEye
) 

Updates the headset viewport for the specified eye.

Parameters:

  • isLeftEye true to update the left eye viewport, false for the right eye.

Returns:

true if the viewport was successfully updated, otherwise false.