Skip to content

Commit

Permalink
Merge pull request #11 from sys-bio/fix-bugs-and-add-new-features
Browse files Browse the repository at this point in the history
fix-bugs-and-add-new-features
  • Loading branch information
adelhpour authored Nov 19, 2024
2 parents e49f7f0 + c0b7d5f commit 06fb807
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 112 deletions.
12 changes: 8 additions & 4 deletions src/autolayout/libsbmlnetwork_autolayout_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,17 @@ GraphicalObject* AutoLayoutCentroidNode::getGraphicalObject() {

void AutoLayoutCentroidNode::updateDimensions() {
std::string fixedWidth = LIBSBMLNETWORK_CPP_NAMESPACE::getUserData(getGraphicalObject(), "width");
if (fixedWidth.empty())
setWidth(std::max(calculateWidth(), getWidth()));
if (fixedWidth.empty()) {
if (!isSetCurve())
setWidth(std::max(calculateWidth(), getWidth()));
}
else
setWidth(std::stod(fixedWidth));
std::string fixedHeight = LIBSBMLNETWORK_CPP_NAMESPACE::getUserData(getGraphicalObject(), "height");
if (fixedHeight.empty())
setHeight(std::max(calculateHeight(), getHeight()));
if (fixedHeight.empty()) {
if (!isSetCurve())
setHeight(std::max(calculateHeight(), getHeight()));
}
else
setHeight(std::stod(fixedHeight));
}
Expand Down
90 changes: 68 additions & 22 deletions src/bindings/python/ctypes/libsbmlnetwork.py.cmake

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def draw(self, file_name=""):
:param file_name:
"""
if file_name:
networkinfotranslator.import_sbml_export_figure(self.save(), file_name, self.use_name_as_text_label,
networkinfotranslator.import_sbml_export_figure(self, file_name, self.use_name_as_text_label,
self.display_compartments_text_label,
self.display_species_text_label,
self.display_reactions_text_label)
else:
display(networkinfotranslator.import_sbml_export_pil_image(self.save(), self.use_name_as_text_label,
display(networkinfotranslator.import_sbml_export_pil_image(self, self.use_name_as_text_label,
self.display_compartments_text_label,
self.display_species_text_label,
self.display_reactions_text_label))
Expand Down
52 changes: 30 additions & 22 deletions src/c_api/libsbmlnetwork_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ namespace LIBSBMLNETWORK_CPP_NAMESPACE {
return strdup(getSpeciesReferenceSpeciesGlyphId(document, layoutIndex, reactionId, reactionGlyphIndex, speciesReferenceIndex).c_str());
}

bool c_api_isSetSpeciesReferenceEmptySpeciesGlyph(SBMLDocument* document, const char* reactionId, int reactionGlyphIndex, int speciesReferenceIndex, int layoutIndex) {
return isSetSpeciesReferenceEmptySpeciesGlyph(document, layoutIndex, reactionId, reactionGlyphIndex, speciesReferenceIndex);
}

const char* c_api_getSpeciesReferenceEmptySpeciesGlyphId(SBMLDocument* document, const char* reactionId, int reactionGlyphIndex, int speciesReferenceIndex, int layoutIndex) {
return strdup(getSpeciesReferenceEmptySpeciesGlyphId(document, layoutIndex, reactionId, reactionGlyphIndex, speciesReferenceIndex).c_str());
}

bool c_api_isSetSpeciesReferenceRole(SBMLDocument* document, const char* reactionId, int reactionGlyphIndex, int speciesReferenceIndex, int layoutIndex) {
return isSetSpeciesReferenceRole(document, layoutIndex, reactionId, reactionGlyphIndex, speciesReferenceIndex);
}
Expand Down Expand Up @@ -533,76 +541,76 @@ namespace LIBSBMLNETWORK_CPP_NAMESPACE {
return getPositionX(document, layoutIndex, id, graphicalObjectIndex);
}

int c_api_setX(SBMLDocument* document, const char* id, const double x, const int graphicalObjectIndex, int layoutIndex) {
return setPositionX(document, layoutIndex, id, graphicalObjectIndex, x);
int c_api_setX(SBMLDocument* document, const char* id, const double x, const int graphicalObjectIndex, int layoutIndex, bool updateCurves) {
return setPositionX(document, layoutIndex, id, graphicalObjectIndex, x, updateCurves);
}

const double c_api_getY(SBMLDocument* document, const char* id, const int graphicalObjectIndex, int layoutIndex) {
return getPositionY(document, layoutIndex, id, graphicalObjectIndex);
}

int c_api_setY(SBMLDocument* document, const char* id, const double y, const int graphicalObjectIndex, int layoutIndex) {
return setPositionY(document, layoutIndex, id, graphicalObjectIndex, y);
int c_api_setY(SBMLDocument* document, const char* id, const double y, const int graphicalObjectIndex, int layoutIndex, bool updateCurves) {
return setPositionY(document, layoutIndex, id, graphicalObjectIndex, y, updateCurves);
}

int c_api_setPosition(SBMLDocument* document, const char* id, const double x, const double y, const int graphicalObjectIndex, int layoutIndex) {
return setPosition(document, layoutIndex, id, graphicalObjectIndex, x, y);
int c_api_setPosition(SBMLDocument* document, const char* id, const double x, const double y, const int graphicalObjectIndex, int layoutIndex, bool updateCurves) {
return setPosition(document, layoutIndex, id, graphicalObjectIndex, x, y, updateCurves);
}

const double c_api_getWidth(SBMLDocument* document, const char* id, const int graphicalObjectIndex, int layoutIndex) {
return getDimensionWidth(document, layoutIndex, id, graphicalObjectIndex);
}

int c_api_setWidth(SBMLDocument* document, const char* id, const double width, const int graphicalObjectIndex, int layoutIndex) {
return setDimensionWidth(document, layoutIndex, id, graphicalObjectIndex, width);
int c_api_setWidth(SBMLDocument* document, const char* id, const double width, const int graphicalObjectIndex, int layoutIndex, bool updateCurves) {
return setDimensionWidth(document, layoutIndex, id, graphicalObjectIndex, width, updateCurves);
}

int c_api_setCompartmentsWidth(SBMLDocument* document, const double width, int layoutIndex) {
return setCompartmentDimensionWidth(document, layoutIndex, width);
int c_api_setCompartmentsWidth(SBMLDocument* document, const double width, int layoutIndex, bool updateCurves) {
return setCompartmentDimensionWidth(document, layoutIndex, width, updateCurves);
}

const double c_api_getSpeciesWidth() {
return getSpeciesDimensionWidth();
}

int c_api_setSpeciesWidth(SBMLDocument* document, const double width, int layoutIndex) {
return setSpeciesDimensionWidth(document, layoutIndex, width);
int c_api_setSpeciesWidth(SBMLDocument* document, const double width, int layoutIndex, bool updateCurves) {
return setSpeciesDimensionWidth(document, layoutIndex, width, updateCurves);
}

const double c_api_getReactionsWidth() {
return getReactionDimensionWidth();
}

int c_api_setReactionsWidth(SBMLDocument* document, const double width, int layoutIndex) {
return setReactionDimensionWidth(document, layoutIndex, width);
int c_api_setReactionsWidth(SBMLDocument* document, const double width, int layoutIndex, bool updateCurves) {
return setReactionDimensionWidth(document, layoutIndex, width, updateCurves);
}

const double c_api_getHeight(SBMLDocument* document, const char* id, const int graphicalObjectIndex, int layoutIndex) {
return getDimensionHeight(document, layoutIndex, id, graphicalObjectIndex);
}

int c_api_setHeight(SBMLDocument* document, const char* id, const double height, const int graphicalObjectIndex, int layoutIndex) {
return setDimensionHeight(document, layoutIndex, id, graphicalObjectIndex, height);
int c_api_setHeight(SBMLDocument* document, const char* id, const double height, const int graphicalObjectIndex, int layoutIndex, bool updateCurves) {
return setDimensionHeight(document, layoutIndex, id, graphicalObjectIndex, height, updateCurves);
}

int c_api_setCompartmentsHeight(SBMLDocument* document, const double height, int layoutIndex) {
return setCompartmentDimensionHeight(document, layoutIndex, height);
int c_api_setCompartmentsHeight(SBMLDocument* document, const double height, int layoutIndex, bool updateCurves) {
return setCompartmentDimensionHeight(document, layoutIndex, height, updateCurves);
}

const double c_api_getSpeciesHeight() {
return getSpeciesDimensionHeight();
}

int c_api_setSpeciesHeight(SBMLDocument* document, const double height, int layoutIndex) {
return setSpeciesDimensionHeight(document, layoutIndex, height);
int c_api_setSpeciesHeight(SBMLDocument* document, const double height, int layoutIndex, bool updateCurves) {
return setSpeciesDimensionHeight(document, layoutIndex, height, updateCurves);
}

const double c_api_getReactionsHeight() {
return getReactionDimensionHeight();
}

int c_api_setReactionsHeight(SBMLDocument* document, const double height, int layoutIndex) {
return setReactionDimensionHeight(document, layoutIndex, height);
int c_api_setReactionsHeight(SBMLDocument* document, const double height, int layoutIndex, bool updateCurves) {
return setReactionDimensionHeight(document, layoutIndex, height, updateCurves);
}

const double c_api_getTextX(SBMLDocument* document, const char* id, const int graphicalObjectIndex, const int textGlyphIndex, int layoutIndex) {
Expand Down
Loading

0 comments on commit 06fb807

Please sign in to comment.