Skip to content

Commit

Permalink
set layout features and update curves are extracted as features
Browse files Browse the repository at this point in the history
  • Loading branch information
adelhpour committed Nov 20, 2024
1 parent b290301 commit c371fe5
Show file tree
Hide file tree
Showing 10 changed files with 604 additions and 523 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ set(SOURCES
features/align_elements/libsbmlnetwork_align_species.cpp
features/fix_elements/libsbmlnetwork_fix_element_position.cpp
features/fix_elements/libsbmlnetwork_fix_element_dimensions.cpp
features/set_layout_features/libsbmlnetwork_set_layout_features.cpp
features/update_curves/libsbmlnetwork_update_curves.cpp
c_api/libsbmlnetwork_c_api.cpp)

## headers
Expand Down Expand Up @@ -66,6 +68,8 @@ set(HEADERS
features/align_elements/libsbmlnetwork_align_species.h
features/fix_elements/libsbmlnetwork_fix_element_position.h
features/fix_elements/libsbmlnetwork_fix_element_dimensions.h
features/set_layout_features/libsbmlnetwork_set_layout_features.h
features/update_curves/libsbmlnetwork_update_curves.h
c_api/libsbmlnetwork_c_api.h)

#### dependencies
Expand Down
7 changes: 4 additions & 3 deletions src/features/alias_elements/libsbmlnetwork_alias_reaction.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "libsbmlnetwork_alias_reaction.h"
#include "../../libsbmlnetwork_layout.h"
#include "../../libsbmlnetwork_layout_helpers.h"
#include "../../features/set_layout_features/libsbmlnetwork_set_layout_features.h"
#include "../../features/alias_elements/libsbmlnetwork_alias_element.h"
#include "../../features/alias_elements/libsbmlnetwork_alias_species.h"
#include "../../features/defaults/libsbmlnetwork_defaults_layout.h"
Expand All @@ -19,7 +20,7 @@ namespace LIBSBMLNETWORK_CPP_NAMESPACE {
ReactionGlyph* alias_element_createAliasReactionGlyph(Layout* layout, ReactionGlyph* reactionGlyph) {
ReactionGlyph* aliasReactionGlyph = NULL;
if (reactionGlyph) {
aliasReactionGlyph = createReactionGlyph(layout, reactionGlyph->getReactionId());
aliasReactionGlyph = set_layout_features_createReactionGlyph(layout, reactionGlyph->getReactionId());
alias_element_setAliasGraphicalObjectPosition(aliasReactionGlyph, reactionGlyph, defaults_getAliasReactionGlyphPadding());
alias_element_setAliasReactionGlyphTextGlyph(layout, aliasReactionGlyph, reactionGlyph);
}
Expand Down Expand Up @@ -62,9 +63,9 @@ namespace LIBSBMLNETWORK_CPP_NAMESPACE {
}

SpeciesReferenceGlyph* alias_element_createAliasSpeciesReferenceGlyph(ReactionGlyph* reactionGlyph, SpeciesReferenceGlyph* referenceSpeciesReferenceGlyph, const std::string& speciesGlyphId, unsigned int stoichiometryIndex) {
SpeciesReferenceGlyph* aliasSpeciesReferenceGlyph = createSpeciesReferenceGlyph(reactionGlyph, speciesGlyphId, stoichiometryIndex);
SpeciesReferenceGlyph* aliasSpeciesReferenceGlyph = set_layout_features_createSpeciesReferenceGlyph(reactionGlyph, speciesGlyphId, stoichiometryIndex);
aliasSpeciesReferenceGlyph->setRole(referenceSpeciesReferenceGlyph->getRole());
setSpeciesReferenceGlyphCurve(aliasSpeciesReferenceGlyph, referenceSpeciesReferenceGlyph);
set_layout_features_setSpeciesReferenceGlyphCurve(aliasSpeciesReferenceGlyph, referenceSpeciesReferenceGlyph);
return aliasSpeciesReferenceGlyph;
}

Expand Down
7 changes: 4 additions & 3 deletions src/features/alias_elements/libsbmlnetwork_alias_species.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "libsbmlnetwork_alias_species.h"
#include "../../libsbmlnetwork_layout.h"
#include "../../libsbmlnetwork_layout_helpers.h"
#include "../../features/set_layout_features/libsbmlnetwork_set_layout_features.h"
#include "../../features/alias_elements/libsbmlnetwork_alias_element.h"
#include "../../features/defaults/libsbmlnetwork_defaults_layout.h"

Expand All @@ -26,7 +27,7 @@ int alias_element_createAliasSpeciesGlyph(Layout* layout, const std::string spec
SpeciesGlyph* alias_element_createAliasSpeciesGlyph(Layout* layout, SpeciesGlyph* speciesGlyph) {
SpeciesGlyph* aliasSpeciesGlyph = NULL;
if (speciesGlyph) {
aliasSpeciesGlyph = createSpeciesGlyph(layout, speciesGlyph->getSpeciesId());
aliasSpeciesGlyph = set_layout_features_createSpeciesGlyph(layout, speciesGlyph->getSpeciesId());
alias_element_setAliasGraphicalObjectPosition(aliasSpeciesGlyph, speciesGlyph, defaults_getAliasSpeciesGlyphPadding());
alias_element_setAliasSpeciesGlyphDimensions(aliasSpeciesGlyph, speciesGlyph);
alias_element_setAliasSpeciesGlyphTextGlyph(layout, aliasSpeciesGlyph);
Expand All @@ -38,7 +39,7 @@ SpeciesGlyph* alias_element_createAliasSpeciesGlyph(Layout* layout, SpeciesGlyph
SpeciesGlyph* alias_element_createAliasSpeciesGlyph(Layout* layout, const std::string& speciesId, std::vector<SpeciesReferenceGlyph*> speciesGlyphReferences) {
SpeciesGlyph* aliasSpeciesGlyph = NULL;
if (speciesGlyphReferences.size()) {
aliasSpeciesGlyph = createSpeciesGlyph(layout, speciesId);
aliasSpeciesGlyph = set_layout_features_createSpeciesGlyph(layout, speciesId);
while (speciesGlyphReferences.size()) {
SpeciesReferenceGlyph* speciesReferenceGlyph = speciesGlyphReferences.back();
speciesReferenceGlyph->setId(getIdOfSpeciesReferenceGlyphConnectedToNewSpeciesGlyph(speciesReferenceGlyph->getId(), speciesReferenceGlyph->getSpeciesGlyphId(), aliasSpeciesGlyph->getId()));
Expand All @@ -53,7 +54,7 @@ SpeciesGlyph* alias_element_createAliasSpeciesGlyph(Layout* layout, const std::s
const bool alias_element_canHaveAlias(Layout* layout, std::vector<SpeciesReferenceGlyph*> connectedSpeciesGlyphReferencesOfReactionGlyph) {
if (connectedSpeciesGlyphReferencesOfReactionGlyph.size()) {
SpeciesGlyph* speciesGlyph = layout->getSpeciesGlyph(connectedSpeciesGlyphReferencesOfReactionGlyph.at(0)->getSpeciesGlyphId());
std::vector<SpeciesReferenceGlyph*> connectedSpeciesGlyphReferencesOfSpeciesGlyph = getConnectedSpeciesGlyphReferences(layout, speciesGlyph);
std::vector<SpeciesReferenceGlyph*> connectedSpeciesGlyphReferencesOfSpeciesGlyph = set_layout_features_getConnectedSpeciesGlyphReferences(layout, speciesGlyph);
if (connectedSpeciesGlyphReferencesOfSpeciesGlyph.size() > connectedSpeciesGlyphReferencesOfReactionGlyph.size())
return true;
}
Expand Down
Loading

0 comments on commit c371fe5

Please sign in to comment.