This class is the main interface. More...
User plan types | |
enum | UserPlan { UserPlan::None, UserPlan::Starter, UserPlan::Standard, UserPlan::Professional, UserPlan::Enterprise } |
The type of the user plan. More... | |
User plan | |
static UserPlan | getUserPlan () |
Returns the user plan. | |
static std::string | getUserPlanString () |
Returns a string containing the user plan. | |
Time | |
static SBCTime | getTime () |
Returns SAMSON's internal time. | |
static void | startTimer () |
Starts a new performance timer. | |
static void | stopTimer (SBQuantity::second &elapsedTime) |
Stops the top performance timer. | |
static void | stopTimer (SBQuantity::second &elapsedTime, SBQuantity::second &totalTime) |
Stops the top performance timer. | |
Directories | |
static std::string | getSAMSONPath () |
Returns the path where SAMSON is installed. | |
static std::string | getSAMSONElementsPath () |
Returns the path where SAMSON Elements are installed. | |
static std::string | getUserDataPath () |
Returns the path where user data is installed. | |
static std::string | getScratchPath () |
Returns the path to scratch data. | |
Documents | |
static SBDDocument * | getActiveDocument () |
Returns a pointer to SAMSON's active document. | |
static SBDDocumentCamera * | getActiveCamera () |
Returns a pointer to the active camera. | |
static SBStructuralModel * | getActiveStructuralModel () |
Returns a pointer to the active structural model. | |
static void | setActiveStructuralModel (SBStructuralModel *structuralModel) |
Sets the active structural model. | |
static void | connectDocumentSignalToSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *), SBCReferenceTarget *nextReferenceTarget=0, void(SBCReferenceTarget::*nextFunctionPointer)(SBDocumentEvent *)=0) |
Connects the document signal to a slot. More... | |
static bool | documentSignalIsConnectedToSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *)) |
Returns true if and only if the document signal is connected to the slot. | |
static void | disconnectDocumentSignalFromSlot (SBCReferenceTarget *referenceTarget, void(SBCReferenceTarget::*functionPointer)(SBDocumentEvent *)) |
Disconnects the document signal from a slot. | |
Apps | |
static SBApp * | getApp (const SBUUID &appUUID, const SBUUID &elementUUID=SBUUID()) |
Returns the app corresponding to a specific appUUID and elementUUID . | |
static SBPointerIndexer< SBApp > const * | getAppIndexer () |
Returns the app indexer. | |
Editors | |
static SBEditor * | getActiveEditor () |
Returns a pointer to the current editor. | |
static void | setActiveEditor (SBEditor *editor) |
Sets the current editor. | |
static void | setActiveEditor (const SBUUID &classUUID, const SBUUID &elementUUID) |
Sets the current editor. | |
static SBEditor * | getEditor (const SBUUID &classUUID, const SBUUID &elementUUID) |
Returns the editor corresponding to a specific classUUID and elementUUID . | |
static SBIndexer< SBEditor * > const * | getEditorIndexer () |
Returns the editor indexer. | |
Snapping | |
static QPoint | snap (int x, int y) |
Returns the snapped mouse viewport displacement (x ,y ) More... | |
static QPoint | snap (int x, int y, const SBPosition3 &pointInPlane) |
Returns the snapped mouse viewport displacement (x ,y ) in the plane containing pointInPlane . More... | |
static SBQuantity::length | snap (const SBQuantity::length &displacement) |
Returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement . More... | |
static SBQuantity::degree | snap (const SBQuantity::degree &displacement) |
Returns the snapped displacement if the snapping of angular displacements is on, else it returns the unchanged displacement . More... | |
static SBLength3 | snap (const SBLength3 &displacement) |
Returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement . More... | |
static SBMatrix33 | snap (const SBMatrix33 &rotationMatrix) |
Returns the snapped rotation matrix if the snapping of angular displacements is on, else it returns the unchanged rotationMatrix . More... | |
static SBSpatialTransform | snap (const SBSpatialTransform &transform) |
Returns the snapped spatial transform according to the translational and angular snapping parameters. More... | |
Picking | |
static SBAtom * | getAtom (int x, int y) |
Returns the atom at location (x ,y ) in the viewport. More... | |
static SBAtom * | getAtom (const QPoint &position) |
Returns the atom at location position in the viewport. More... | |
static SBBond * | getBond (int x, int y) |
Returns the bond at location (x ,y ) in the viewport. More... | |
static SBBond * | getBond (const QPoint &position) |
Returns the bond at location position in the viewport. More... | |
static SBNode * | getNode (int x, int y, const SBNodePredicate &selectionFilter=SBNode::All()) |
Returns the node at location (x ,y ) in the viewport according to the selectionFilter . More... | |
static SBNode * | getNode (const QPoint &position, const SBNodePredicate &selectionFilter=SBNode::All()) |
Returns the node at location position in the viewport according to the selectionFilter . More... | |
static SBNode * | getNode (int x, int y, SBPosition3 &pickedPosition, const SBNodePredicate &selectionFilter=SBNode::All()) |
Returns the node at location (x ,y ) in the viewport and the pickedPosition according to the selectionFilter . More... | |
static SBNode * | getNode (const QPoint &position, SBPosition3 &pickedPosition, const SBNodePredicate &selectionFilter=SBNode::All()) |
Returns the node at location position in the viewport and the pickedPosition according to the selectionFilter . More... | |
static void | getNodes (SBNodeIndexer &nodeIndexer, int x, int y, int width, int height, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false) |
Stores the nodes found inside the viewport rectangle (x ,y ,width ,height ) into nodeIndexer according to the selectionFilter . More... | |
static void | getNodes (SBNodeIndexer &nodeIndexer, const QPoint &topLeftCorner, int width, int height, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false) |
Stores the nodes found inside the viewport rectangle (topLeftCorner ,width ,height ) into nodeIndexer according to the selectionFilter . More... | |
static void | getNodes (SBNodeIndexer &nodeIndexer, const SBVector< QPoint > &selectionLasso, const SBNodePredicate &selectionFilter=SBNode::All(), bool deepSelectionFlag=false) |
Returns the nodes insde the selection lasso with contour selectionLasso into nodeIndexer according to the selectionFilter . More... | |
static const SBNodePredicate & | getActiveSelectionFilter () |
Returns the active selection filter. | |
static bool | getDeepSelectionFlag () |
Returns whether the user wants deep selection. | |
Viewport | |
static int | getViewportWidth () |
Returns the viewport width. | |
static int | getViewportHeight () |
Returns the viewport height. | |
static QPoint | getMousePositionInViewport () |
Returns the current mouse position in viewport coordinates. | |
static SBVector3 | getViewportPositionFromWorldPosition (const SBPosition3 &position) |
Returns the projection in the viewport of a given world position . | |
static SBPosition3 | getWorldPositionFromViewportPosition (int x, int y) |
Returns the 3D position that corresponds to the viewport location (x ,y ) | |
static SBPosition3 | getWorldPositionFromViewportPosition (int x, int y, const SBPosition3 &pointInPlane) |
Returns the 3D position that corresponds to the viewport location (x ,y ) in the plane containing pointInPlane . | |
static SBPosition3 | getWorldPositionFromViewportPosition (const QPoint &position) |
Returns the 3D position that corresponds to the viewport location (x ,y ) | |
static SBPosition3 | getWorldPositionFromViewportPosition (const QPoint &position, const SBPosition3 &pointInPlane) |
Returns the 3D position that corresponds to the viewport location (x ,y ) in the plane containing pointInPlane . | |
static QImage | captureViewport (int width, int height, bool transparentBackground=false) |
Captures the viewport. | |
static void | captureViewport (const std::string &fileName, int width, int height, bool transparentBackground=false) |
Captures the viewport. | |
static void | requestViewportUpdate () |
Requests a viewport update. More... | |
static void | setViewportCursor (const QCursor &cursor) |
Sets the viewport cursor. | |
static void | setViewportCursor (Qt::CursorShape cursorShape) |
Sets the viewport cursor. | |
static void | unsetViewportCursor () |
Unsets the viewport cursor. | |
static void | enableViewportNodeHighlighting () |
Enables automatic node highlighting in the viewport. | |
static void | disableViewportNodeHighlighting () |
Enables automatic node highlighting in the viewport. | |
static void | showContextMenu (const QPoint &position, SBNode *highlightedNode=0) |
Shows the context menu. More... | |
static const float * | getHighlightingColor () |
Returns the highlighting color. | |
static float | getHighlightingOpacity () |
Returns the highlighting opacity. | |
static const float * | getSelectionColor () |
Returns the selection color. | |
static float | getSelectionOpacity () |
Returns the selection opacity. | |
static const float * | getSelectionOutlineColor () |
Returns the selection outline color. | |
static float | getSelectionOutlineOpacity () |
Returns the selection outline opacity. | |
static QFont | getViewportFont () |
Returns the font used for text in the viewport. | |
Headset | |
static QOpenGLContext * | createHeadsetViewport () |
Creates a viewport for a virtual reality headset. More... | |
static bool | setHeadsetParameters (int panelWidth, int panelHeight, unsigned int leftFrameBuffer, unsigned int rightFrameBuffer) |
Sets the panel size of the headset. More... | |
static bool | updateHeadsetViewport (bool isLeftEye) |
Updates the headset viewport. | |
Light | |
static const float * | getLightDirection (unsigned int lightIndex) |
Returns the light direction of light lightIndex . | |
static float | getLightIntensity (unsigned int lightIndex) |
Returns the light intensity of light lightIndex . | |
static const float * | getLightColor (unsigned int lightIndex) |
Returns the light color of light lightIndex . | |
static float | getSpecularIntensity (unsigned int lightIndex) |
Returns the specular intensity of light lightIndex . | |
static float | getSpecularPower (unsigned int lightIndex) |
Returns the specular power of light lightIndex . | |
static float | getAmbientLight () |
Returns the ambient light. | |
static const float * | getFresnelColor () |
Returns the fresnel color. | |
static float | getFresnelPower () |
Returns the fresnel power. | |
static float | getFresnelIntensity () |
Returns the fresnel power. | |
Version number | |
static SBCContainerVersionNumber | getVersionNumber () |
Returns the version number of SAMSON. | |
static std::string | getPublicVersionNumber () |
Returns the "public version number" of SAMSON. | |
static std::string | getPublicName (bool includeVersion=false, bool includeHashInVersion=false) |
Periodic table | |
static const SBElement & | getElement (SBMElement::Type element) |
Returns the periodic table element corresponding to a given type. | |
static SBMElement *const * | getElementVector () |
Returns the complete periodic table element vector. | |
static unsigned int | getNumberOfElements () |
Returns the number of defined periodic table elements, including the Unknown element. | |
static std::string | getElementName (SBMElement::Type element) |
Returns the name of the periodic table element corresponding to a given type. | |
static std::string | getElementSymbol (SBMElement::Type element) |
Returns the symbol of the periodic table element corresponding to a given type. | |
static std::string | getPeriod (SBMElement::Type element) |
Returns the period of periodic table element element . | |
static unsigned int | getGroup (SBMElement::Type element) |
Returns the group of periodic table element element . | |
static std::string | getBlock (SBMElement::Type element) |
Returns the block of periodic table element element . | |
static SBQuantity::mass | getAtomicWeight (SBMElement::Type element) |
Returns the atomic weight of periodic table element element . | |
static SBQuantity::length | getCovalentRadius (SBMElement::Type element) |
Returns the covalent radius of periodic table element element . | |
static SBQuantity::length | getVanDerWaalsRadius (SBMElement::Type element) |
Returns the van der Waals radius of periodic table element element . | |
static SBQuantity::dimensionless | getElectronegativity (SBMElement::Type element) |
Returns the electronegativity of periodic table element element . | |
static SBElement::Type | getElementTypeByName (char *elementName) |
Returns the periodic table element type corresponding to a given name. | |
static SBElement::Type | getElementTypeByName (const std::string &elementName) |
Returns the periodic table element type corresponding to a given name. | |
static SBElement::Type | getElementTypeBySymbol (char *elementSymbol) |
Returns the periodic table element type corresponding to a given symbol. | |
static SBElement::Type | getElementTypeBySymbol (const std::string &elementSymbol) |
Returns the periodic table element type corresponding to a given symbol. | |
GUI | |
static SBGWindow * | addDialog (SBGWindowDialog *dialog) |
Adds a SAMSON dialog to the user interface. | |
static SBGWindow * | addDialog (QDialog *dialog, QString name="", int format=SBGWindow::NoOptions, QPixmap logo=QPixmap(), SBUUID uuid=SBUUID("")) |
Adds a Qt dialog to the user interface. | |
static SBGWindow * | addWidget (SBGWindowWidget *widget) |
Adds a SAMSON widget to the user interface. | |
static SBGWindow * | addWidget (QWidget *widget, QString name="", int format=SBGWindow::NoOptions, QPixmap logo=QPixmap(), SBUUID uuid=SBUUID("")) |
Adds a Qt widget to the user interface. | |
static void | removeDialog (SBGWindowDialog *dialog) |
Removes a SAMSON dialog from the user interface. | |
static void | removeDialog (QDialog *dialog) |
Removes a Qt dialog from the user interface. | |
static void | removeWidget (SBGWindowWidget *widget) |
Removes a SAMSON widget from the user interface. | |
static void | removeWidget (QWidget *widget) |
Removes a Qt widget from the user interface. | |
static void | removeWindow (SBGWindow *window) |
Removes a window from the user interface. | |
static void | setBusy (bool b) |
Notifies the user that SAMSON is busy. | |
static void | setStatusMessage (const QString &message, int time=0) |
Shows a message in the status bar. | |
static bool | isShowingTip () |
Returns whether a tip is being shown. | |
static void | showTip (const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false) |
Shows a tip window with a title tipTitle and text tipText at the position relativePosition relative to a widget widget . More... | |
static void | showTip (const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, const QPixmap &tipPixmap, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false) |
Shows a tip window with a title tipTitle , text tipText , and image tipPixmap at the position relativePosition relative to a widget widget . More... | |
static void | showTip (const SBUUID &tipUUID, const QString &tipCategory, const QString &tipTitle, const QString &tipText, const QString &tipMoviePath, QWidget *widget=nullptr, const QPoint &relativePosition=QPoint(), bool showArrow=false) |
Shows a tip window with a title tipTitle , text tipText , and gif-movie tipMovie at the position relativePosition relative to a widget widget . More... | |
static void | hideTip () |
Hides the last tip window. More... | |
static void | informUser (const QString &dialogTitle, const QString &dialogText) |
Informs the user with a message in a modal pop-up dialog. More... | |
static void | informUser (SBGWindowWidget *widget) |
Informs the user with a widget in a modal pop-up dialog. More... | |
static bool | askUser (const QString &dialogTitle, const QString &dialogText, QDialogButtonBox *buttonBox=0) |
Asks a question to the user with a message in a modal pop-up dialog. More... | |
static bool | askUser (SBGWindowWidget *widget, QDialogButtonBox *buttonBox=0) |
Asks a question to the user with a widget in a modal pop-up dialog. More... | |
static bool | askUser (QWidget *widget, QDialogButtonBox *buttonBox=0) |
Asks a question to the user with a widget in a modal pop-up dialog. More... | |
static bool | getColorFromUser (const QString &dialogTitle, SBColor &result) |
Gets a color from the user in a modal pop-up dialog. | |
static bool | getDoubleFromUser (const QString &dialogTitle, double &result, double minimum, double maximum, double singleStep=1.0, const QString &prefix="", const QString &suffix="", int decimals=2) |
Gets a number from the user in a modal pop-up dialog. | |
static bool | getFontFromUser (const QString &dialogTitle, QFont &result) |
Gets a font from the user in a modal pop-up dialog. | |
static bool | getIntegerFromUser (const QString &dialogTitle, int &result, int minimum, int maximum, int singleStep=1, const QString &prefix="", const QString &suffix="") |
Gets a number from the user in a modal pop-up dialog. | |
static bool | getPathFromUser (const QString &dialogTitle, QString &result) |
Gets a path from the user in a modal pop-up dialog. | |
static bool | getFileNameFromUser (const QString &dialogTitle, QString &result, const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options()) |
Gets a filename from the user in a modal pop-up dialog. | |
static bool | getFileNamesFromUser (const QString &dialogTitle, QStringList &result, const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=Q_NULLPTR, QFileDialog::Options options=QFileDialog::Options()) |
Gets a filename from the user in a modal pop-up dialog. | |
static bool | getStringFromUser (const QString &dialogTitle, QString &result) |
Gets a string from the user in a modal pop-up dialog. | |
static bool | getElementFromUser (const QString &dialogTitle, SBMElement::Type &elementType) |
Gets a periodic table element from the user in a modal pop-up dialog. | |
static bool | getElementsFromUser (const QString &dialogTitle, std::vector< SBMElement::Type > &elementTypes) |
Gets a list of periodic table elements from the user in a modal pop-up dialog. | |
static bool | getItemFromUser (const QString &dialogTitle, QString &result, const QString &label, const QStringList &items, int current=0) |
Gets an item from the user in a modal pop-up dialog. | |
static SBColorPalette * | getColorPaletteFromUser (const QString &dialogTitle, bool &ok, const SBColorPalette *defaultColorPalette=nullptr) |
Gets a color palette from the user in a modal pop-up dialog. If the defaultColorPalette is provided it is set as a default one in the color palette dialog. | |
static void | showProgressBar (const QString &name="", int minimum=0, int maximum=0, const SBQuantity::second &minimumDuration=SBQuantity::second(2.0), bool isCancellable=true, const QString &cancelButtonText="Cancel") |
Shows the progress bar. | |
static void | setProgressBarValue (int value) |
Sets the value of the progress bar. | |
static void | hideProgressBar () |
Hides the progress bar. | |
static bool | isProgressBarStopped () |
Returns true when the progress bar is stopped. | |
static SBAction * | getAction (const SBUUID &actionUUID) |
Returns the action with the given actionUUID . | |
static SBActionWidget * | getActionWidget (const SBUUID &actionWidgetUUID) |
Returns the action widget with the given actionWidgetUUID . | |
static SBNodeGUI * | getGUI (SBNode *node) |
Returns the GUI of a node. | |
static QPixmap | getColorbar (const SBDColorPalette *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 . More... | |
Undo | |
static bool | isHolding () |
Returns true when SAMSON is holding. | |
static void | beginHolding (const std::string &name) |
Begins holding. | |
static void | disableHolding () |
Pauses holding. | |
static void | enableHolding () |
Resumes holding. | |
static void | endHolding () |
Ends holding. | |
static void | hold (void *object) |
Holds an object. | |
static void | hold (SBNode *node) |
Holds a node and its descendants. | |
static void | hold (SBUndoCommand *undoCommand) |
Holds a command. | |
static void | hold (SBPointerTarget *pointerTarget) |
Holds a pointer target allocated on the heap. | |
static void | holdArray (void *array) |
Holds an array allocated on the heap. | |
static void | undo () |
Undo one command. | |
static void | redo () |
Redo one command. | |
static bool | isUndoing () |
Returns true while undoing. | |
static bool | isRedoing () |
Returns true while redoing. | |
Files | |
static void | importFromFile (const std::string &fileName, const SBList< std::string > *parameters=0, SBDDocumentFolder *preferredFolder=0, SBIFileImporter *importer=0) |
Import a file from the disk. | |
static void | exportToFile (const SBNodeIndexer &nodeIndexer, const std::string &fileName, const SBList< std::string > *parameters=0, SBIFileExporter *exporter=0) |
Export a selection of nodes to a file. | |
Display | |
static void | displayCylinders (unsigned int nCylinders, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *capData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false) |
Displays cylinders. More... | |
static void | displayCylindersSelection (unsigned int nCylinders, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *capData, const unsigned int *nodeIndexData) |
Displays cylinders for selection. | |
static void | displayLines (unsigned int nLines, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false) |
Displays 3D lines. | |
static void | displayLinesOrtho (unsigned int nLinesOrtho, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, bool reverseViewport=true, bool transparency=false) |
Displays 2D lines. | |
static void | displayLinesSelection (unsigned int nLines, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData) |
Displays 3D lines for selection. | |
static void | displayLineSweptSpheres (unsigned int nLineSweptSpheres, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const float *colorData, unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false) |
Displays line-swept spheres. | |
static void | displayLineSweptSpheresSelection (unsigned int nLineSweptSpheres, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *radiusData, const unsigned int *nodeIndexData) |
Displays line-swept spheres for selection. | |
static void | displaySpheres (unsigned int nSpheres, const float *positionData, const float *radiusData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false) |
Displays spheres. | |
static void | displaySpheresSelection (unsigned int nSpheres, const float *positionData, const float *radiusData, const unsigned int *nodeIndexData) |
Displays spheres for selection. | |
static void | displayTip (int x, int y, const std::string &tip) |
Displays a tip. | |
static void | displayText (const std::string &text, const SBPosition3 &position, const QFont &font, float *color) |
Displays text. | |
static void | displayTextSelection (const std::string &text, const SBPosition3 &position, const QFont &font, unsigned int nodeIndex) |
Displays text for selection. | |
static void | displayTexturedTriangles (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *normalData, const float *colorData, const unsigned int *flagData, const float *textureCoordinateData, unsigned int textureID, bool shadowPassFlag=false, bool transparency=false, const SBLength3 &scale=SBLength3(SBQuantity::length::one, SBQuantity::length::one, SBQuantity::length::one), const SBSpatialTransform &transform=SBSpatialTransform::identity, const SBColor &diffuseColor=SBColor::black, float diffuseColorReplacement=0.0f, float opacity=1.0f, unsigned int flagModifier=0) |
Displays 3D textured triangles. | |
static void | displayTexturedTrianglesOrtho (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, const float *textureCoordinateData, unsigned int textureID, bool reverseViewport=true, bool transparency=false) |
Displays 2D textured triangles. | |
static void | displayTexturedTrianglesOrthoSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, const float *textureCoordinateData, unsigned int textureID, bool reverseViewport=true, bool transparency=false) |
Displays 2D textured triangles for selection. | |
static void | displayTexturedTrianglesSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, const float *textureCoordinateData, unsigned int textureID, bool transparency=false, const SBLength3 &scale=SBLength3(SBQuantity::length::one, SBQuantity::length::one, SBQuantity::length::one), const SBSpatialTransform &transform=SBSpatialTransform::identity, unsigned int nodeIndexModifier=0) |
Displays 3D textured triangles for selection. | |
static void | displayTriangles (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *normalData, const float *colorData, const unsigned int *flagData, bool shadowPassFlag=false, bool transparency=false, const SBLength3 &scale=SBLength3(SBQuantity::length::one, SBQuantity::length::one, SBQuantity::length::one), const SBSpatialTransform &transform=SBSpatialTransform::identity, const SBColor &diffuseColor=SBColor::black, float diffuseColorReplacement=0.0f, float opacity=1.0f, unsigned int flagModifier=0) |
Displays 3D triangles. | |
static void | displayTrianglesOrtho (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const float *colorData, const unsigned int *flagData, bool reverseViewport=true, bool transparency=false) |
Displays 2D triangles. | |
static void | displayTrianglesOrthoSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, bool reverseViewport=true, bool transparency=false) |
Displays 2D triangles for selection. | |
static void | displayTrianglesSelection (unsigned int nTriangles, unsigned int nPositions, const unsigned int *indexData, const float *positionData, const unsigned int *nodeIndexData, const SBLength3 &scale=SBLength3(SBQuantity::length::one, SBQuantity::length::one, SBQuantity::length::one), const SBSpatialTransform &transform=SBSpatialTransform::identity, unsigned int nodeIndexModifier=0) |
Displays 3D triangles for selection. | |
static void | displayTubes (float *ovalCenter, float *normal, float *binormal, float *width, float *height, unsigned int *nodeIndex, unsigned int *sectionIndex, unsigned int *detailIndex, unsigned int *flags, unsigned int sectionsNumber, unsigned int sectionsDetail, unsigned int ovalDetail, unsigned int triangleReduction, float *color, bool shadowPassFlag=false, bool transparency=false) |
Displays tubes. | |
static void | displayTubesSelection (float *ovalCenter, float *normal, float *binormal, float *width, float *height, unsigned int *nodeIndex, unsigned int *sectionIndex, unsigned int *detailIndex, unsigned int sectionsNumber, unsigned int sectionsDetail, unsigned int ovalDetail, unsigned int triangleReduction, float *color) |
Displays tubes for selection. | |
static const SBQuantity::length & | getAtomRadius () |
Returns the radius of atoms in the default representation of structural models (when a constant radius is used) | |
static const SBQuantity::length & | getBondRadius () |
Returns the radius of bonds in the default representation of structural models. | |
static bool | getMultipleBondDisplayFlag () |
Returns true when bonds are displayed with a variable number of cylinders to represent their order. | |
static bool | getVanDerWaalsAtomRadiusFlag () |
Returns true when atoms are displayed with a radius proportional to their van der Waals radius. | |
static float | getVanDerWaalsAtomRadiusRatio () |
Returns the constant by which the atoms van der Waals radius is multiplied to represent atoms in the viewport (when a constant radius is not used) | |
Introspection | |
static SBProxy * | getProxy (const std::string &className, const SBUUID &elementUUID=SBUUID()) |
Returns the proxy of a class. | |
static SBIndexer< SBProxy * > const * | getProxyIndexer (SBCClass::Type classType) |
Returns all proxies corresponding to a given class type classType . | |
Factory | |
static SBNodePredicate * | makeNodePredicate (const std::string &selectionString) |
Make a node predicate based on a selectionString . More... | |
static SBController * | makeController (const std::string &controllerClassName, const SBUUID &controllerElementUUID=SBUUID()) |
Make a controller. | |
static SBInteractionModelParticleSystem * | makeInteractionModel (SBParticleSystem *dynamicalModel, const std::string &interactionModelClassName, const SBUUID &interactionModelElementUUID=SBUUID()) |
Make an interaction model. | |
static SBSNeighborSearchParticleSystem * | makeNeigborSearch (SBParticleSystem *dynamicalModel, const SBQuantity::length &cutoffDistance, const std::string &neighborSearchClassName, const SBUUID &neighborSearchElementUUID=SBUUID()) |
Make a neighbor search algorithm. | |
static SBStateUpdaterParticleSystem * | makeStateUpdater (SBParticleSystem *dynamicalModel, SBInteractionModelParticleSystem *interactionModel, const std::string &stateUpdaterClassName, const SBUUID &stateUpdaterElementUUID=SBUUID()) |
Make a state updater. | |
static SBSimulatorParticleSystem * | makeSimulator (const SBNodeIndexer &nodeIndexer, const std::string &interactionModelClassName, const SBUUID &interactionModelElementUUID, const std::string &stateUpdaterClassName, const SBUUID &stateUpdaterElementUUID=SBUUID()) |
Make a simulator. | |
static SBVisualModel * | makeVisualModel (const SBNodeIndexer &nodeIndexer, const std::string &visualModelClassName, const SBUUID &visualModelElementUUID=SBUUID()) |
Make a visual model. | |
static SBPropertyModel * | makePropertyModel (const SBNodeIndexer &nodeIndexer, const std::string &propertyModelClassName, const SBUUID &propertyModelElementUUID=SBUUID()) |
Make a property model. | |
Selection | |
static void | getNodes (SBNodeIndexer &nodeIndexer, const std::string &selectionString) |
Returns some nodes based on a selectionString . More... | |
static std::string | getCurrentSelectionFilter () |
Returns the current selection filter name. More... | |
static bool | setCurrentSelectionFilter (const std::string &selectionFilterName) |
Sets the current selection filter according to the given name selectionFilterName . Returns true in case of the success. More... | |
Minimization | |
static void | startMinimization () |
Starts interactive Minimization. More... | |
static void | stopMinimization () |
Stops interactive Minimization. More... | |
static void | toggleMinimization () |
Toggles interactive Minimization on and off. More... | |
static bool | getMinimizationFlag () |
Returns true when interactive Minimization is on. More... | |
static void | setMinimizationFlag (bool minimizationFlag) |
Sets the interactive Minimization flag. More... | |
static bool | minimize (const SBNodeIndexer &nodeIndexer, unsigned int maximumNumberOfSteps, unsigned int minimumNumberOfStepsInPlateau, const SBQuantity::kJPerMol &energyDifferenceCriteria, unsigned int printMinimizationInformationFrequency=100, bool askUser=false) |
Minimize atoms in the nodeIndexer according to the provided criteria. More... | |
Simulation | |
static void | startSimulation () |
Starts interactive simulation. More... | |
static void | stopSimulation () |
Stops interactive simulation. More... | |
static void | toggleSimulation () |
Toggles interactive simulation on and off. More... | |
static bool | getSimulationFlag () |
Returns true when interactive simulation is on. More... | |
static void | setSimulationFlag (bool simulationFlag) |
Sets the interactive simulation flag. More... | |
Properties | |
static bool | showProperties (SBNode *node) |
Shows the properties widget of a node. | |
Jobs | |
static SBUUID | createJob (const QString &name, const SBCContainerUUID &developerId, const SBCContainerUUID &elementId, const QString &description, double fixedCost, double hourlyCost, double storageCost, long estimatedDuration, const QString &endpoint, const QJsonObject &metadata) |
Creates a job named name with fixed cost fixedCost , hourly cost hourlyCost , price currency priceCurrency , estimated duration estimatedDuration , end point endPoint , and meta data metadata ; returns the job's UUID. More... | |
Debugging | |
static void | printMemoryUsage () |
Prints memory usage. | |
static void | printFullMemoryUsage () |
Prints full memory usage. | |
static void | printDataGraphState () |
Prints the data graph state. | |
static void | printRendererState () |
Prints the renderer state. | |
static void | printUndoStack () |
Prints the undo stack. | |
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:
SAMSON may be used to get the current internal time (in ticks)
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 :
A few functions are provided to easily access key file locations from within a SAMSON Element. For example, the path to the scratch folder, where SAMSON Elements may write temporary data, may be obtained with:
Furthermore, the SB_ELEMENT_PATH macro provides a std::string containing the installation path of the specific SAMSON Element whose code is being executed. This may be used for example to access the resources associated to the SAMSON Element:
The SAMSON interface is the main entry point to documents. In particular, the active document is retrieved with:
For example, a new structural model may be added to the active document with:
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.
When editors, for example, want to select data graph nodes based on the display viewport, they may perform picking operations.
For example, if an editor needs to determine which node was under the mouse cursor when the mouse button was pressed, the getNode(int, int, const SBNodePredicate&) function may be used:
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).
The SAMSON class is also the main entry point to the viewport, which displays a visual representation of the data graph.
The viewport dimensions may be retrieved with:
and the mouse position in viewport coordinates can be obtained with:
Typically, editors that allow users to visually interact with the data graph need to convert back and forth between two-dimensional viewport coordinates (integers) and three-dimensional world coordinates (lengths).
For example, the getWorldPositionFromViewportPosition(const QPoint&) function returns a 3D world position that corresponds to a given viewport position:
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:
Conversely, projecting a world position in the viewport may be achieved with:
Note that the returned viewport position is a dimensionless physical vector. The first two components are the viewport coordinates with subpixel accuracy, and the third component is the depth in the camera frustum.
Developers of SAMSON Elements who need to develop their own shaders can retrieve the parameters of the lighting model used by SAMSON's internal renderer. In particular, two directional lights are used:
Global lighting parameters may also be accessed:
The version number of SAMSON may be retrieved from the SAMSON class:
Please refer to the versioning chapter for more information about the versioning scheme used for SAMSON and SAMSON Elements.
The SAMSON class also exposes functions from the periodic table, which collects periodic table elements:
Note that convenience functions exist in atoms to access the properties of their element:
The SAMSON class gives access to the Graphical User Interface (GUI) of SAMSON, and makes it possible for SAMSON Elements to add SAMSON widgets to the interface:
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:
SAMSON dialogs may be added in a similar fashion with the addDialog functions.
The SAMSON class may be used to set the message in the status bar:
as well as inform the user through modal dialogs, either via a simple string:
or via a SAMSON widget:
When a question should be asked to the user, the askUser function may be used, either with a string:
or with a SAMSON widget:
Some convenience functions make it easy to request a string or a number from the user:
where result
is true if the user did not cancel the request and actually provided a string.
When SAMSON Elements need to lock the user interface for a long period of time, they may communicate the progress made through a progress bar:
SAMSON Elements may turn the undo and redo mechanism via the SAMSON class:
SAMSON may be used to import and export files. For example, the instruction:
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.
Several types of SAMSON classes have virtual display functions that may be overloaded to render objects in the viewport. For example, a visual model has a display function called at each frame by SAMSON's internal renderer. Furthermore, rendering is also used to perform node picking, by rendering unique indices instead of colors (see the chapter about rendering in SAMSON). To perform rendering, SAMSON uses, and requires from developers of SAMSON Elements 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 Elements.
Because using core OpenGL functionality is sometimes cumbersome, especially when rendering simple objects, SAMSON provides several utility functions to render geometric primitives in batches, especially when implementing display
functions of data graph nodes. For example, the displayTriangles function makes it easy to display triangles in a SAMSON viewport.
Some utility functions also facilitate the use of the renderer to perform node selection. For example, the displayTrianglesSelection makes it easy to render triangles for selection purposes, by passing to SAMSON indices instead of colors.
Please refer to the chapter about rendering in SAMSON for more information, as well as the documentations of the specific display functions listed below.
SAMSON Elements expose their functionality to SAMSON and to other SAMSON Elements thanks to an introspection mechanism. Exposition is achieved thanks to descriptor files that contain the list of exposed classes and functions, and that are compiled along with the SAMSON Element. 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 Elements 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:
In case there is a risk that several SAMSON Elements might provide a class called SEElementMyApp
, it is possible to specify the name and the UUID of the SAMSON Element:
The SAMSON Element UUID is guaranteed to be unique if the SAMSON Element 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 Element provides a particle interaction model:
Then, an instance of this class can be created as follows:
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.
If a data graph node has an associated property window, it is possible to make it appear with:
|
strong |
|
static |
This static function asks the user a question with a message in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true
if the user presses the OK button, or false
if the user presses the Cancel button or closes the dialog. This function exposes the function with the same name in SBGWindowDialog.
|
static |
This static function asks the user a question with a widget
in a modal pop-up dialog. This is a convenience function which makes it easy to program questions to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the Cancel button or the OK button. The function returns true
if the user presses the OK button, or false
if the user presses the Cancel button or closes the dialog. The dialog title and icon are taken from the widget. Note that the OK button and the Cancel button are created by this function, and the widget does not have to contain some. This function exposes the function with the same name in SBGWindowDialog.
|
static |
This static function asks the user a question with a widget
in a modal pop-up dialog. This is a convenience function which makes it easy to progam 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.
|
static |
This function allows for listening to document events (SBDocumentEvent) e.g. SBDocumentEvent::ActiveDocumentChanged, SBDocumentEvent::DocumentAdded, etc. Let's assume that we want to listen to SBDocumentEvent in an App (SBDApp), then this App needs to have a function that receives a pointer to SBDocumentEvent, e.g.:
Then in this App we can connect to a document signal as follows:
|
static |
This function creates a viewport for a virtual reality headset.
|
static |
This function returns the credits that the user has on his or her account. The function returns -1 if the service could not be contacted.
|
static |
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 radiuses (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 | A boolean to signal a shadow pass |
transparency | A boolean to enable/disable the transparency |
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 radiuses, 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:
|
static |
x | The first viewport coordinate of the picking location |
y | The second viewport coordinate of the picking location |
This function returns the atom displayed at coordinates x
and y
in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which atom was under the mouse cursor when the mouse button was pressed:
If no atom is present at coordinates x
and y
, the function returns 0.
This function is a convenience function that calls getNode(int, int, const SBNodePredicate&) and checks whether the picked node, if any, is an atom. If it is the case, the function returns a pointer to the picked atom. If a node of another type (e.g. a bond) is present at coordinates x
and y
, the function returns 0. If picking should be able to return any type of node, the function getNode(int, int, const SBNodePredicate&) should be used instead.
Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).
|
static |
position | The viewport coordinates of the picking location |
This function returns the atom displayed at a given position
in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which atom was under the mouse cursor when the mouse button was pressed:
If no atom is present at the specified position
, the function returns 0.
This function is a convenience function that calls getNode(const QPoint&, const SBNodePredicate&) and checks whether the picked node, if any, is an atom. If it is the case, the function returns a pointer to the picked atom. If a node of another type (e.g. a bond) is present at the specified position
, the function returns 0. If picking should be able to return any type of node, the function getNode(const QPoint&, const SBNodePredicate&) should be used instead.
Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).
|
static |
x | The first viewport coordinate of the picking location |
y | The second viewport coordinate of the picking location |
This function returns the bond displayed at coordinates x
and y
in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which bond was under the mouse cursor when the mouse button was pressed:
If no bond is present at coordinates x
and y
, the function returns 0.
This function is a convenience function that calls getNode(int, int, const SBNodePredicate&) and checks whether the picked node, if any, is a bond. If it is the case, the function returns a pointer to the picked bond. If a node of another type (e.g. an atom) is present at coordinates x
and y
, the function returns 0. If picking should be able to return any type of node, the function getNode(int, int, const SBNodePredicate&) should be used instead.
Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).
|
static |
position | The viewport coordinates of the picking location |
This function returns the bond displayed at a given position
in the viewport. It is typically used by editors when reacting to mouse press events, in order to determine which bond was under the mouse cursor when the mouse button was pressed:
If no bond is present at the specified position
, the function returns 0.
This function is a convenience function that calls getNode(const QPoint&, const SBNodePredicate&) and checks whether the picked node, if any, is a bond. If it is the case, the function returns a pointer to the picked bond. If a node of another type (e.g. an atom) is present at the specified position
, the function returns 0. If picking should be able to return any type of node, the function getNode(const QPoint&, const SBNodePredicate&) should be used instead.
Note that picking in SAMSON is performed through rendering. As a result, this function cannot be called from within a display function (e.g. from a SBMVisualModel::display function).
|
static |
This static function return a pixmap with a colorbar for the given color palette palette
with the size width
x height
and the number of colors nColors
. The direction of the colorbar is governed by isHorizontal:
true - horizontal, false - vertical
|
static |
Returns the current selection filter name. The selection filter governs the selection level in the Viewport done by the default select editor.
|
static |
This function returns true
when interactive minimization is on. When interactive minimization is started, all active simulators in the active document periodically perform a time step.
|
static |
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:
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).
|
static |
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:
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).
|
static |
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:
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).
|
static |
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:
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).
|
static |
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 |
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:
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).
|
static |
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 |
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:
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).
|
static |
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 |
This function returns the nodes displayed in a given selection lasso. It is typically used by editors when reacting to mouse events:
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).
|
static |
This function fills the nodeIndexer
passed in reference with nodes from the active document, based on a selectionString
formulated in SAMSON's node specification language. For example:
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").
|
static |
This function returns true
when interactive simulation is on. When interactive simulation is started, all active simulators in the active document periodically perform a time step.
|
static |
This static function hides the last tip window.
|
static |
This static function informs the user with a message in a modal pop-up dialog. This is a convenience function which makes it easy to program messages to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button. This function exposes the function with the same name in SBGWindowDialog.
|
static |
This static function informs the user with a widget
in a modal pop-up dialog. This is a convenience function which makes it easy to program messages to the user with the SAMSON style. The function creates a modal pop-up dialog that blocks all other user interaction until the user pushes the OK button. The dialog title and icon are taken from the widget. Note that the OK button is created by this function, and the widget does not have to contain one. This function exposes the function with the same name in SBGWindowDialog.
|
static |
This function makes a node predicate based on a selectionString
formulated in SAMSON's node specification language. For example:
makes a predicate that is true if and only if the node is a hydrogen atom bonded to an oxygen atom. This function may be used when a predicate should be stored. Ownership is passed to the caller, who should delete the predicate when it's done using it.
|
static |
nodeIndexer | An indexer of nodes from atoms in which the minimization should be applied. |
maximumNumberOfSteps | The maximum number of minimization steps. |
minimumNumberOfStepsInPlateau | The minimum number of consecutive steps sufficing the energy difference criteria. |
energyDifferenceCriteria | The energy difference threshold between two consecutive minimization steps. |
printMinimizationInformationFrequency | The frequency at which the minimization information should be printed. Set to 0 to disable. Note: printing information too often might decrease the performance. The default value is 100. |
askUser | Set to true to ask user. The default value is false . |
This function performs minimization of atoms in the nodeIndexer
using the Universal Force Field (UFF) and the Interactive modeling state updater. Note, that for this function to work the user needs to have these two SAMSON Elements installed. For UFF to properly determine the bond order, the system shouldn't have missing hydrogen atoms. Note that the minimization is also applied to all atoms connected to atoms in the nodeIndexer
.
The following parameters are used as the stopping criteria: maximumNumberOfSteps
, minimumNumberOfStepsInPlateau
, energyDifferenceCriteria
.
For example, to minimize the whole system:
numberOfStateUpdaterStepsBetweenViewportUpdate - the number of the state updater steps between the update of atoms positions in the viewport. It is applicable only if atoms to which minimization is applied are displayed in the viewport. Note: setting too small value might decrease the performance. The default value is 100. Set to 0 to update when the minimization is finished.
|
static |
This function allows SAMSON Elements to request an update of the viewport. This may be useful, for example, when an editor is displaying an interface (e.g. a rectangle selection editor draws a rectangle on top of the viewport), or temporary objects in the viewport (e.g. a carbon nanotube editor renders a transparent nanotube while the user is choosing its endpoints and radius). Requesting a viewport update ensures that SAMSON will call the appropriate display functions of the editor even when the camera is not moving and no other SAMSON Element is requesting a viewport update.
|
static |
This function sets the current selection filter according to the given name selectionFilterName
. It is purely based on the name of the selection filter which can be seen in the selection filter itself. Returns true in case of the success and false if it couldn't find a selection filter with such name. The selection filter governs the selection level in the Viewport done by the default select editor.
|
static |
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. |
|
static |
This function sets the interactive minimization flag. Set the flag to true
to start interactive minimization. When interactive minimization is started, all active simulators in the active document periodically perform a time step.
|
static |
This function sets the interactive simulation flag. Set the flag to true
to start interactive simulation. When interactive simulation is started, all active simulators in the active document periodically perform a time step.
|
static |
Shows the context menu at a given position
. The highlightedNode
pointer can be used to show context actions about a specific node.
|
static |
This static function shows a tip window with a title tipTitle
and text tipText
at the position relativePosition
relative to a widget widget
. If a widget widget
is not provided, the tip window will appear in the top-right corner of the viewport.
The tip's UUID tipUUID
is used internaly to store tip's info e.g. whether the tip was shown or not.
The category string tipCategory
is used internaly - please, provide the name of your Element.
You can create a tip with just a text as follows:
You can also use rich text (with html) in a tip:
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.
To show an arrow in the tip's corner (the corner is detected based on the relative position) set the showArrow
to true
.
|
static |
This static function shows a tip window with a title tipTitle
, text tipText
, and image tipPixmap
at the position relativePosition
relative to a widget widget
.
This function is an extension of the SAMSON::showTip function described above and it allows you to provide an image in a tipPixmap
. The image will appear above of the text. Note, that it will be scaled to fit the tip window.
|
static |
This static function shows a tip window with a title tipTitle
, text tipText
, and gif-movie tipMovie
at the position relativePosition
relative to a widget widget
.
This function is an extension of the SAMSON::showTip function described above and it allows you to provide a gif movie path in a tipMovie
. The movie will appear above of the text. Note, that the movie will be scaled to fit the tip window.
|
static |
x | The x-coordinate of the mouse |
y | The y-coordinate of the mouse |
This function returns the snapped mouse viewport displacement (x
,y
)
|
static |
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
|
static |
displacement | The translational displacement |
This function returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement
.
|
static |
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
.
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
.
|
static |
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.
|
static |
transform | The spatial transform |
This function returns the snapped spatial transform according to the translational and angular snapping parameters.
|
static |
This function starts interactive minimization. When interactive minimization is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:
|
static |
This function starts interactive simulation. When interactive simulation is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:
|
static |
This function stops interactive minimization. When interactive minimization is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:
|
static |
This function stops interactive simulation. When interactive simulation is started, all active simulators in the active document periodically perform a time step. Calling this function is equivalent to:
|
static |
This function toggles interactive minimization on and off. When interactive minimization is started, all active simulators in the active document periodically perform a time step.
|
static |
This function toggles interactive simulation on and off. When interactive simulation is started, all active simulators in the active document periodically perform a time step.