From bcda332352965d7b16eaf3dc01cd2cef40aa2c8c Mon Sep 17 00:00:00 2001 From: adelhpour Date: Wed, 20 Nov 2024 10:33:32 -0800 Subject: [PATCH] functions in the autolayout feature are prefixed with 'autolayout_' --- .../autolayout/libsbmlnetwork_autolayout.cpp | 160 +++++++++--------- .../autolayout/libsbmlnetwork_autolayout.h | 70 ++++---- .../libsbmlnetwork_set_layout_features.cpp | 2 +- .../libsbmlnetwork_update_curves.cpp | 2 +- 4 files changed, 115 insertions(+), 119 deletions(-) diff --git a/src/features/autolayout/libsbmlnetwork_autolayout.cpp b/src/features/autolayout/libsbmlnetwork_autolayout.cpp index 98b8bb8..b28fc9f 100755 --- a/src/features/autolayout/libsbmlnetwork_autolayout.cpp +++ b/src/features/autolayout/libsbmlnetwork_autolayout.cpp @@ -12,13 +12,13 @@ namespace LIBSBMLNETWORK_CPP_NAMESPACE { -void locateGlyphs(Model *model, Layout *layout, const bool &useNameAsTextLabel) { - double stiffness = getStiffness(layout); - double gravity = getGravity(layout); +void autolayout_locateGlyphs(Model *model, Layout *layout, const bool &useNameAsTextLabel) { + double stiffness = autolayout_getStiffness(layout); + double gravity = autolayout_getGravity(layout); bool useMagnetism = false; bool useGrid = false; std::srand(time(0)); - randomizeGlyphsLocations(model, layout); + autolayout_randomizeGlyphsLocations(model, layout); FruchtermanReingoldAlgorithmBase *autoLayoutAlgorithm = new FruchtermanReingoldAutoLayoutAlgorithm(); autoLayoutAlgorithm->setElements(model, layout, useNameAsTextLabel); autoLayoutAlgorithm->setStiffness(stiffness); @@ -30,23 +30,23 @@ void locateGlyphs(Model *model, Layout *layout, const bool &useNameAsTextLabel) autoLayoutAlgorithm->setWidth(layout); autoLayoutAlgorithm->setHeight(layout); autoLayoutAlgorithm->apply(); - updateCompartmentsExtents(model, layout); - updateLayoutDimensions(layout); + autolayout_updateCompartmentsExtents(model, layout); + autolayout_updateLayoutDimensions(layout); delete autoLayoutAlgorithm; - if (!adjustLayoutDimensions(layout)) { - if (autolayoutMayStillConverge(layout)) { - updateGravity(layout); - updateStiffness(layout); - locateGlyphs(model, layout, useNameAsTextLabel); + if (!autolayout_adjustLayoutDimensions(layout)) { + if (autolayout_autolayoutMayStillConverge(layout)) { + autolayout_updateGravity(layout); + autolayout_updateStiffness(layout); + autolayout_locateGlyphs(model, layout, useNameAsTextLabel); } else error_log_addErrorToLog(layout, "Auto-layout fails to converge with the given layout dimensions. Please adjust layout width and height and try again."); } } -void locateReactions(Model *model, Layout *layout, const bool &useNameAsTextLabel) { - double stiffness = getStiffness(layout); - double gravity = getGravity(layout); +void autolayout_locateReactions(Model *model, Layout *layout, const bool &useNameAsTextLabel) { + double stiffness = autolayout_getStiffness(layout); + double gravity = autolayout_getGravity(layout); bool useMagnetism = false; bool useGrid = false; FruchtermanReingoldAlgorithmBase* autoLayoutAlgorithm = new FruchtermanReingoldUpdateCurvesAlgorithm(); @@ -59,58 +59,58 @@ void locateReactions(Model *model, Layout *layout, const bool &useNameAsTextLabe autoLayoutAlgorithm->setWidth(layout); autoLayoutAlgorithm->setHeight(layout); autoLayoutAlgorithm->apply(); - updateCompartmentsExtents(model, layout); - updateLayoutDimensions(layout); + autolayout_updateCompartmentsExtents(model, layout); + autolayout_updateLayoutDimensions(layout); delete autoLayoutAlgorithm; } -const double getStiffness(Layout *layout) { +const double autolayout_getStiffness(Layout *layout) { std::string stiffness = LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(layout, "stiffness"); if (stiffness.empty()) { - setStiffness(layout, 10.0); + autolayout_setStiffness(layout, 10.0); return 10.0; } return std::stod(stiffness); } -void setStiffness(Layout *layout, const double &stiffness) { +void autolayout_setStiffness(Layout *layout, const double &stiffness) { LIBSBMLNETWORK_CPP_NAMESPACE::user_data_setUserData(layout, "stiffness", std::to_string(stiffness)); } -void updateStiffness(Layout *layout) { - setStiffness(layout, getStiffnessAdjustmentFactor(layout) * getStiffness(layout)); +void autolayout_updateStiffness(Layout *layout) { + autolayout_setStiffness(layout, autolayout_getStiffnessAdjustmentFactor(layout) * autolayout_getStiffness(layout)); } -double getStiffnessAdjustmentFactor(Layout *layout) { - return std::max(std::min(getDesiredDimensionToCurrentDimensionRatio(layout), 1.1), 0.9); +double autolayout_getStiffnessAdjustmentFactor(Layout *layout) { + return std::max(std::min(autolayout_getDesiredDimensionToCurrentDimensionRatio(layout), 1.1), 0.9); } -const double getGravity(Layout *layout) { +const double autolayout_getGravity(Layout *layout) { std::string gravity = LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(layout, "gravity"); if (gravity.empty()) { - setGravity(layout, 15.0); + autolayout_setGravity(layout, 15.0); return 15.0; } return std::stod(gravity); } -void setGravity(Layout *layout, const double &gravity) { +void autolayout_setGravity(Layout *layout, const double &gravity) { LIBSBMLNETWORK_CPP_NAMESPACE::user_data_setUserData(layout, "gravity", std::to_string(gravity)); } -void updateGravity(Layout *layout) { - setGravity(layout, getGravityAdjustmentFactor(layout) * getGravity(layout)); +void autolayout_updateGravity(Layout *layout) { + autolayout_setGravity(layout, autolayout_getGravityAdjustmentFactor(layout) * autolayout_getGravity(layout)); } -double getGravityAdjustmentFactor(Layout *layout) { - return std::max(std::min(getCurrentDimensionToDesiredDimensionRatio(layout), 1.05), 0.95); +double autolayout_getGravityAdjustmentFactor(Layout *layout) { + return std::max(std::min(autolayout_getCurrentDimensionToDesiredDimensionRatio(layout), 1.05), 0.95); } -double getCurrentDimensionToDesiredDimensionRatio(Layout *layout) { - double desiredWidth = getLayoutDimensionsDesiredWidth(layout); - double desiredHeight = getLayoutDimensionsDesiredHeight(layout); +double autolayout_getCurrentDimensionToDesiredDimensionRatio(Layout *layout) { + double desiredWidth = autolayout_getLayoutDimensionsDesiredWidth(layout); + double desiredHeight = autolayout_getLayoutDimensionsDesiredHeight(layout); if (layout->getDimensions()->width() < desiredWidth || layout->getDimensions()->height() < desiredHeight) { double widthRatio = layout->getDimensions()->width() / desiredWidth; double heightRatio = layout->getDimensions()->height() / desiredHeight; @@ -125,9 +125,9 @@ double getCurrentDimensionToDesiredDimensionRatio(Layout *layout) { return 1.0; } -double getDesiredDimensionToCurrentDimensionRatio(Layout *layout) { - double desiredWidth = getLayoutDimensionsDesiredWidth(layout); - double desiredHeight = getLayoutDimensionsDesiredHeight(layout); +double autolayout_getDesiredDimensionToCurrentDimensionRatio(Layout *layout) { + double desiredWidth = autolayout_getLayoutDimensionsDesiredWidth(layout); + double desiredHeight = autolayout_getLayoutDimensionsDesiredHeight(layout); if (layout->getDimensions()->width() < desiredWidth || layout->getDimensions()->height() < desiredHeight) { double widthRatio = desiredWidth / layout->getDimensions()->width(); double heightRatio = desiredHeight / layout->getDimensions()->height(); @@ -142,36 +142,34 @@ double getDesiredDimensionToCurrentDimensionRatio(Layout *layout) { return 1.0; } -void randomizeGlyphsLocations(Model *model, Layout *layout) { +void autolayout_randomizeGlyphsLocations(Model *model, Layout *layout) { double canvasWidth = layout->getDimensions()->width(); double canvasHeight = layout->getDimensions()->height(); - randomizeSpeciesGlyphsLocations(model, layout, canvasWidth, canvasHeight); - randomizeReactionGlyphsLocations(model, layout, canvasWidth, canvasHeight); + autolayout_randomizeSpeciesGlyphsLocations(model, layout, canvasWidth, canvasHeight); + autolayout_randomizeReactionGlyphsLocations(model, layout, canvasWidth, canvasHeight); } -void -randomizeSpeciesGlyphsLocations(Model *model, Layout *layout, const double &canvasWidth, const double &canvasHeight) { +void autolayout_randomizeSpeciesGlyphsLocations(Model *model, Layout *layout, const double &canvasWidth, const double &canvasHeight) { for (int i = 0; i < layout->getNumSpeciesGlyphs(); i++) - randomizeBoundingBoxesPosition(layout->getSpeciesGlyph(i)->getBoundingBox(), canvasWidth, canvasHeight); + autolayout_randomizeBoundingBoxesPosition(layout->getSpeciesGlyph(i)->getBoundingBox(), canvasWidth, canvasHeight); } -void randomizeReactionGlyphsLocations(Model *model, Layout *layout, const double &canvasWidth, const double &canvasHeight) { +void autolayout_randomizeReactionGlyphsLocations(Model *model, Layout *layout, const double &canvasWidth, const double &canvasHeight) { for (int i = 0; i < layout->getNumReactionGlyphs(); i++) { if (layout->getReactionGlyph(i)->isSetCurve()) - randomizeCurveCenterPoint(layout->getReactionGlyph(i)->getCurve(), canvasWidth, canvasHeight); + autolayout_randomizeCurveCenterPoint(layout->getReactionGlyph(i)->getCurve(), canvasWidth, canvasHeight); else - randomizeBoundingBoxesPosition(layout->getReactionGlyph(i)->getBoundingBox(), canvasWidth, canvasHeight); + autolayout_randomizeBoundingBoxesPosition(layout->getReactionGlyph(i)->getBoundingBox(), canvasWidth, canvasHeight); } } -void -randomizeBoundingBoxesPosition(BoundingBox *boundingBox, const double &canvasWidth, const double &canvasHeight) { +void autolayout_randomizeBoundingBoxesPosition(BoundingBox *boundingBox, const double &canvasWidth, const double &canvasHeight) { double offset = 30.0; boundingBox->setX(offset + (std::rand() % int(canvasWidth - offset))); boundingBox->setY(offset + (std::rand() % int(canvasHeight - offset))); } -void randomizeCurveCenterPoint(Curve *curve, const double &canvasWidth, const double &canvasHeight) { +void autolayout_randomizeCurveCenterPoint(Curve *curve, const double &canvasWidth, const double &canvasHeight) { double offset = 30.0; double randomPointX = offset + (std::rand() % int(canvasWidth - offset)); double randomPointY = offset + (std::rand() % int(canvasHeight - offset)); @@ -186,8 +184,7 @@ void randomizeCurveCenterPoint(Curve *curve, const double &canvasWidth, const do cubicBezier->getBasePoint2()->setY(randomPointY); } -void -initializeCompartmentGlyphExtents(BoundingBox *compartmentGlyphBoundingBox, BoundingBox *speciesGlyphBoundingBox) { +void autolayout_initializeCompartmentGlyphExtents(BoundingBox *compartmentGlyphBoundingBox, BoundingBox *speciesGlyphBoundingBox) { const double padding = defaults_getDefaultAutoLayoutPadding(); compartmentGlyphBoundingBox->setX(speciesGlyphBoundingBox->x() - padding); compartmentGlyphBoundingBox->setY(speciesGlyphBoundingBox->y() - padding); @@ -195,12 +192,12 @@ initializeCompartmentGlyphExtents(BoundingBox *compartmentGlyphBoundingBox, Boun compartmentGlyphBoundingBox->setHeight(speciesGlyphBoundingBox->height() + 2 * padding); } -void updateCompartmentsExtents(Model *model, Layout *layout) { - updateCompartmentsExtentsUsingTheirElementsExtents(model, layout); - updateCompartmentsExtentsUsingTheirPresetAttributes(layout); +void autolayout_updateCompartmentsExtents(Model *model, Layout *layout) { + autolayout_updateCompartmentsExtentsUsingTheirElementsExtents(model, layout); + autolayout_updateCompartmentsExtentsUsingTheirPresetAttributes(layout); } -void updateCompartmentsExtentsUsingTheirElementsExtents(Model *model, Layout *layout) { +void autolayout_updateCompartmentsExtentsUsingTheirElementsExtents(Model *model, Layout *layout) { std::vector extentsInitializedCompartmentGlyphIds; for (int i = 0; i < layout->getNumSpeciesGlyphs(); i++) { Compartment *compartment = findSpeciesGlyphCompartment(model, layout->getSpeciesGlyph(i)); @@ -212,11 +209,11 @@ void updateCompartmentsExtentsUsingTheirElementsExtents(Model *model, Layout *la if (std::find(extentsInitializedCompartmentGlyphIds.begin(), extentsInitializedCompartmentGlyphIds.end(), compartmentGlyph->getId()) == extentsInitializedCompartmentGlyphIds.end()) { - initializeCompartmentGlyphExtents(compartmentGlyph->getBoundingBox(), + autolayout_initializeCompartmentGlyphExtents(compartmentGlyph->getBoundingBox(), layout->getSpeciesGlyph(i)->getBoundingBox()); extentsInitializedCompartmentGlyphIds.push_back(compartmentGlyph->getId()); } - updateCompartmentExtentsUsingItsElementsExtents(compartmentGlyph->getBoundingBox(), + autolayout_updateCompartmentExtentsUsingItsElementsExtents(compartmentGlyph->getBoundingBox(), layout->getSpeciesGlyph(i)->getBoundingBox()); } } @@ -226,16 +223,16 @@ void updateCompartmentsExtentsUsingTheirElementsExtents(Model *model, Layout *la layout->getReactionGlyph(i)); if (compartmentGlyph) { if (layout->getReactionGlyph(i)->isSetCurve()) - updateCompartmentExtentsUsingItsElementsExtents(compartmentGlyph->getBoundingBox(), + autolayout_updateCompartmentExtentsUsingItsElementsExtents(compartmentGlyph->getBoundingBox(), layout->getReactionGlyph(i)->getCurve()); else - updateCompartmentExtentsUsingItsElementsExtents(compartmentGlyph->getBoundingBox(), + autolayout_updateCompartmentExtentsUsingItsElementsExtents(compartmentGlyph->getBoundingBox(), layout->getReactionGlyph(i)->getBoundingBox()); } } } -void updateCompartmentExtentsUsingItsElementsExtents(BoundingBox *compartmentGlyphBoundingBox, BoundingBox *speciesGlyphBoundingBox) { +void autolayout_updateCompartmentExtentsUsingItsElementsExtents(BoundingBox *compartmentGlyphBoundingBox, BoundingBox *speciesGlyphBoundingBox) { const double padding = defaults_getDefaultAutoLayoutPadding(); if (speciesGlyphBoundingBox->x() - padding < compartmentGlyphBoundingBox->x()) { compartmentGlyphBoundingBox->setWidth(compartmentGlyphBoundingBox->width() + @@ -268,7 +265,7 @@ void updateCompartmentExtentsUsingItsElementsExtents(BoundingBox *compartmentGly } } -void updateCompartmentExtentsUsingItsElementsExtents(BoundingBox *compartmentGlyphBoundingBox, Curve *reactionCurve) { +void autolayout_updateCompartmentExtentsUsingItsElementsExtents(BoundingBox *compartmentGlyphBoundingBox, Curve *reactionCurve) { const double padding = defaults_getDefaultAutoLayoutPadding(); double reactionCenterX = 0.5 * (reactionCurve->getCurveSegment(0)->getStart()->x() + reactionCurve->getCurveSegment(0)->getEnd()->x()); @@ -296,7 +293,7 @@ void updateCompartmentExtentsUsingItsElementsExtents(BoundingBox *compartmentGly } } -void updateCompartmentsExtentsUsingTheirPresetAttributes(Layout *layout) { +void autolayout_updateCompartmentsExtentsUsingTheirPresetAttributes(Layout *layout) { for (int i = 0; i < layout->getNumCompartmentGlyphs(); i++) { CompartmentGlyph *compartmentGlyph = layout->getCompartmentGlyph(i); if (LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(compartmentGlyph, "fixed_position") == "true") { @@ -320,8 +317,7 @@ void updateCompartmentsExtentsUsingTheirPresetAttributes(Layout *layout) { } } -void updateLayoutDimensions(Layout *layout) { - const double padding = defaults_getDefaultAutoLayoutPadding(); +void autolayout_updateLayoutDimensions(Layout *layout) { if (!layoutContainsGlyphs(layout)) { layout->getDimensions()->setWidth(0); layout->getDimensions()->setHeight(0); @@ -329,27 +325,27 @@ void updateLayoutDimensions(Layout *layout) { } else { double maxX; double maxY; - extractExtents(layout, maxX, maxY); + autolayout_extractExtents(layout, maxX, maxY); layout->getDimensions()->setWidth(maxX); layout->getDimensions()->setHeight(maxY); } } -const bool adjustLayoutDimensions(Layout *layout) { - double desiredWidth = getLayoutDimensionsDesiredWidth(layout); +const bool autolayout_adjustLayoutDimensions(Layout *layout) { + double desiredWidth = autolayout_getLayoutDimensionsDesiredWidth(layout); double widthGap = desiredWidth - layout->getDimensions()->width(); - double desiredHeight = getLayoutDimensionsDesiredHeight(layout); + double desiredHeight = autolayout_getLayoutDimensionsDesiredHeight(layout); double heightGap = desiredHeight - layout->getDimensions()->height(); if (widthGap <= 0.1 * desiredWidth && heightGap <= 0.1 * desiredHeight) { - setLayoutDimensionsDesiredWidth(layout, layout->getDimensions()->width()); - setLayoutDimensionsDesiredHeight(layout, layout->getDimensions()->height()); + autolayout_setLayoutDimensionsDesiredWidth(layout, layout->getDimensions()->width()); + autolayout_setLayoutDimensionsDesiredHeight(layout, layout->getDimensions()->height()); return true; } return false; } -const double getLayoutDimensionsDesiredWidth(Layout *layout) {; +const double autolayout_getLayoutDimensionsDesiredWidth(Layout *layout) {; std::string presetWidth = LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(layout->getDimensions(), "width"); if (!presetWidth.empty()) return std::stod(presetWidth); @@ -357,12 +353,12 @@ const double getLayoutDimensionsDesiredWidth(Layout *layout) {; return layout->getDimensions()->width(); } -void setLayoutDimensionsDesiredWidth(Layout *layout, const double &width) { +void autolayout_setLayoutDimensionsDesiredWidth(Layout *layout, const double &width) { if (!LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(layout->getDimensions(), "width").empty()) LIBSBMLNETWORK_CPP_NAMESPACE::user_data_setUserData(layout->getDimensions(), "width", std::to_string(width)); } -const double getLayoutDimensionsDesiredHeight(Layout *layout) { +const double autolayout_getLayoutDimensionsDesiredHeight(Layout *layout) { std::string presetHeight = LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(layout->getDimensions(), "height"); if (!presetHeight.empty()) return std::stod(presetHeight); @@ -370,43 +366,43 @@ const double getLayoutDimensionsDesiredHeight(Layout *layout) { return layout->getDimensions()->height(); } -void setLayoutDimensionsDesiredHeight(Layout *layout, const double &height) { +void autolayout_setLayoutDimensionsDesiredHeight(Layout *layout, const double &height) { if (!LIBSBMLNETWORK_CPP_NAMESPACE::user_data_getUserData(layout->getDimensions(), "height").empty()) LIBSBMLNETWORK_CPP_NAMESPACE::user_data_setUserData(layout->getDimensions(), "height", std::to_string(height)); } -const bool autolayoutMayStillConverge(Layout *layout) { - if (getGravity(layout) > 1.0) +const bool autolayout_autolayoutMayStillConverge(Layout *layout) { + if (autolayout_getGravity(layout) > 1.0) return true; return false; } -void extractExtents(Layout *layout, double &maxX, double &maxY) { +void autolayout_extractExtents(Layout *layout, double &maxX, double &maxY) { double minX = INT_MAX; double minY = INT_MAX; maxX = INT_MIN; maxY = INT_MIN; for (int i = 0; i < layout->getNumCompartmentGlyphs(); i++) - extractExtents(layout->getCompartmentGlyph(i)->getBoundingBox(), minX, minY, maxX, maxY); + autolayout_extractExtents(layout->getCompartmentGlyph(i)->getBoundingBox(), minX, minY, maxX, maxY); for (int i = 0; i < layout->getNumSpeciesGlyphs(); i++) - extractExtents(layout->getSpeciesGlyph(i)->getBoundingBox(), minX, minY, maxX, maxY); + autolayout_extractExtents(layout->getSpeciesGlyph(i)->getBoundingBox(), minX, minY, maxX, maxY); for (int i = 0; i < layout->getNumReactionGlyphs(); i++) { if (layout->getReactionGlyph(i)->isSetCurve()) - extractExtents(layout->getReactionGlyph(i)->getCurve(), minX, minY, maxX, maxY); + autolayout_extractExtents(layout->getReactionGlyph(i)->getCurve(), minX, minY, maxX, maxY); else - extractExtents(layout->getReactionGlyph(i)->getBoundingBox(), minX, minY, maxX, maxY); + autolayout_extractExtents(layout->getReactionGlyph(i)->getBoundingBox(), minX, minY, maxX, maxY); } } -void extractExtents(BoundingBox *boundingBox, double &minX, double &minY, double &maxX, double &maxY) { +void autolayout_extractExtents(BoundingBox *boundingBox, double &minX, double &minY, double &maxX, double &maxY) { minX = std::min(minX, boundingBox->x()); minY = std::min(minY, boundingBox->y()); maxX = std::max(maxX, boundingBox->x() + boundingBox->width()); maxY = std::max(maxY, boundingBox->y() + boundingBox->height()); } -void extractExtents(Curve *reactionCurve, double &minX, double &minY, double &maxX, double &maxY) { +void autolayout_extractExtents(Curve *reactionCurve, double &minX, double &minY, double &maxX, double &maxY) { double reactionCenterX = 0.5 * (reactionCurve->getCurveSegment(0)->getStart()->x() + reactionCurve->getCurveSegment(0)->getEnd()->x()); double reactionCenterY = 0.5 * (reactionCurve->getCurveSegment(0)->getStart()->y() + diff --git a/src/features/autolayout/libsbmlnetwork_autolayout.h b/src/features/autolayout/libsbmlnetwork_autolayout.h index 01c39b2..100096a 100755 --- a/src/features/autolayout/libsbmlnetwork_autolayout.h +++ b/src/features/autolayout/libsbmlnetwork_autolayout.h @@ -10,75 +10,75 @@ using namespace libsbml; namespace LIBSBMLNETWORK_CPP_NAMESPACE { -void locateGlyphs(Model* model, Layout* layout, const bool& useNameAsTextLabel = true); +void autolayout_locateGlyphs(Model* model, Layout* layout, const bool& useNameAsTextLabel = true); -void locateReactions(Model *model, Layout *layout, const bool& useNameAsTextLabel = false); +void autolayout_locateReactions(Model *model, Layout *layout, const bool& useNameAsTextLabel = false); -const double getStiffness(Layout *layout); +const double autolayout_getStiffness(Layout *layout); -void setStiffness(Layout *layout, const double& stiffness); +void autolayout_setStiffness(Layout *layout, const double& stiffness); -void updateStiffness(Layout *layout); +void autolayout_updateStiffness(Layout *layout); -double getStiffnessAdjustmentFactor(Layout *layout); +double autolayout_getStiffnessAdjustmentFactor(Layout *layout); -const double getGravity(Layout *layout); +const double autolayout_getGravity(Layout *layout); -void setGravity(Layout *layout, const double& gravity); +void autolayout_setGravity(Layout *layout, const double& gravity); -void updateGravity(Layout *layout); +void autolayout_updateGravity(Layout *layout); -double getGravityAdjustmentFactor(Layout *layout); +double autolayout_getGravityAdjustmentFactor(Layout *layout); -double getCurrentDimensionToDesiredDimensionRatio(Layout *layout); +double autolayout_getCurrentDimensionToDesiredDimensionRatio(Layout *layout); -double getDesiredDimensionToCurrentDimensionRatio(Layout *layout); +double autolayout_getDesiredDimensionToCurrentDimensionRatio(Layout *layout); -void randomizeGlyphsLocations(Model* model, Layout* layout); +void autolayout_randomizeGlyphsLocations(Model* model, Layout* layout); -void randomizeSpeciesGlyphsLocations(Model* model, Layout* layout, const double& canvasWidth, const double& canvasHeight); +void autolayout_randomizeSpeciesGlyphsLocations(Model* model, Layout* layout, const double& canvasWidth, const double& canvasHeight); -void randomizeReactionGlyphsLocations(Model* model, Layout* layout, const double& canvasWidth, const double& canvasHeight); +void autolayout_randomizeReactionGlyphsLocations(Model* model, Layout* layout, const double& canvasWidth, const double& canvasHeight); -void randomizeBoundingBoxesPosition(BoundingBox* boundingBox, const double& canvasWidth, const double& canvasHeight); +void autolayout_randomizeBoundingBoxesPosition(BoundingBox* boundingBox, const double& canvasWidth, const double& canvasHeight); -void randomizeCurveCenterPoint(Curve* curve, const double& canvasWidth, const double& canvasHeight); +void autolayout_randomizeCurveCenterPoint(Curve* curve, const double& canvasWidth, const double& canvasHeight); -void setGlyphsDimensions(Model *model, Layout *layout); +void autolayout_setGlyphsDimensions(Model *model, Layout *layout); -void setSpeciesGlyphDimensions(Model *model, SpeciesGlyph* speciesGlyph); +void autolayout_setSpeciesGlyphDimensions(Model *model, SpeciesGlyph* speciesGlyph); -void initializeCompartmentGlyphExtents(BoundingBox* compartmentGlyphBoundingBox, BoundingBox* speciesGlyphBoundingBox); +void autolayout_initializeCompartmentGlyphExtents(BoundingBox* compartmentGlyphBoundingBox, BoundingBox* speciesGlyphBoundingBox); -void updateCompartmentsExtents(Model *model, Layout *layout); +void autolayout_updateCompartmentsExtents(Model *model, Layout *layout); -void updateCompartmentsExtentsUsingTheirElementsExtents(Model *model, Layout *layout); +void autolayout_updateCompartmentsExtentsUsingTheirElementsExtents(Model *model, Layout *layout); -void updateCompartmentExtentsUsingItsElementsExtents(BoundingBox* compartmentGlyphBoundingBox, BoundingBox* speciesGlyphBoundingBox); +void autolayout_updateCompartmentExtentsUsingItsElementsExtents(BoundingBox* compartmentGlyphBoundingBox, BoundingBox* speciesGlyphBoundingBox); -void updateCompartmentExtentsUsingItsElementsExtents(BoundingBox* compartmentGlyphBoundingBox, Curve* reactionCurve); +void autolayout_updateCompartmentExtentsUsingItsElementsExtents(BoundingBox* compartmentGlyphBoundingBox, Curve* reactionCurve); -void updateCompartmentsExtentsUsingTheirPresetAttributes(Layout *layout); +void autolayout_updateCompartmentsExtentsUsingTheirPresetAttributes(Layout *layout); -void updateLayoutDimensions(Layout* layout); +void autolayout_updateLayoutDimensions(Layout* layout); -const bool adjustLayoutDimensions(Layout *layout); +const bool autolayout_adjustLayoutDimensions(Layout *layout); -const double getLayoutDimensionsDesiredWidth(Layout *layout); +const double autolayout_getLayoutDimensionsDesiredWidth(Layout *layout); -void setLayoutDimensionsDesiredWidth(Layout *layout, const double& width); +void autolayout_setLayoutDimensionsDesiredWidth(Layout *layout, const double& width); -const double getLayoutDimensionsDesiredHeight(Layout *layout); +const double autolayout_getLayoutDimensionsDesiredHeight(Layout *layout); -void setLayoutDimensionsDesiredHeight(Layout *layout, const double& height); +void autolayout_setLayoutDimensionsDesiredHeight(Layout *layout, const double& height); -const bool autolayoutMayStillConverge(Layout *layout); +const bool autolayout_autolayoutMayStillConverge(Layout *layout); -void extractExtents(Layout* layout, double &maxX, double &maxY); +void autolayout_extractExtents(Layout* layout, double &maxX, double &maxY); -void extractExtents(BoundingBox* boundingBox, double &minX, double &minY, double &maxX, double &maxY); +void autolayout_extractExtents(BoundingBox* boundingBox, double &minX, double &minY, double &maxX, double &maxY); -void extractExtents(Curve* reactionCurve, double &minX, double &minY, double &maxX, double &maxY); +void autolayout_extractExtents(Curve* reactionCurve, double &minX, double &minY, double &maxX, double &maxY); } diff --git a/src/features/set_layout_features/libsbmlnetwork_set_layout_features.cpp b/src/features/set_layout_features/libsbmlnetwork_set_layout_features.cpp index 0ea7caa..ed4b3d0 100644 --- a/src/features/set_layout_features/libsbmlnetwork_set_layout_features.cpp +++ b/src/features/set_layout_features/libsbmlnetwork_set_layout_features.cpp @@ -38,7 +38,7 @@ int set_layout_features_setDefaultLayoutLocations(SBMLDocument* document, Layout set_layout_features_clearGraphicalObjects(layout); set_layout_features_setCompartmentGlyphs(model, layout, userData); set_layout_features_setReactionGlyphs(model, layout, maxNumConnectedEdges, userData); - locateGlyphs(model, layout, useNameAsTextLabel); + autolayout_locateGlyphs(model, layout, useNameAsTextLabel); set_layout_features_setTextGlyphs(layout); return 0; } diff --git a/src/features/update_curves/libsbmlnetwork_update_curves.cpp b/src/features/update_curves/libsbmlnetwork_update_curves.cpp index 0fa12bb..ffc0730 100644 --- a/src/features/update_curves/libsbmlnetwork_update_curves.cpp +++ b/src/features/update_curves/libsbmlnetwork_update_curves.cpp @@ -9,7 +9,7 @@ namespace LIBSBMLNETWORK_CPP_NAMESPACE { Model* model = document->getModel(); if (model) { set_layout_features_clearReactionTextGlyphs(layout); - locateReactions(model, layout, true); + autolayout_locateReactions(model, layout, true); set_layout_features_setReactionTextGlyphs(layout); return 0; }