Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split graphs #27

Merged
merged 12 commits into from
Nov 6, 2024
Merged

Split graphs #27

merged 12 commits into from
Nov 6, 2024

Conversation

pgallino
Copy link
Collaborator

@pgallino pgallino commented Nov 6, 2024

Split Graphs

This update divides the graph functionality into two distinct components: DataGraph and ViewGraph.

DataGraph is solely responsible for maintaining the entire network’s information, while ViewGraph handles the creation, updating, and removal of device and edge drawings in the view.

Additionally, this update introduces new features:

  • Functionality to delete nodes and edges.
  • Ability to click edges.

Closes #16
Closes #20

Manuel-Pol and others added 9 commits November 1, 2024 15:47
…ed edges

- Add 'eliminar dispositivo' button in the right-bar for user interaction
- Need to review deletion optimization and modularize showInfo method
…ataGraph

- Made `Edge` instances clickable and added `showInfo` method to display edge information in the right bar.
- Implemented an interactive "Delete Edge" button in `showInfo` for each edge to allow users to remove edges individually.
- Added `removeEdge` method in `ViewGraph` to handle the removal of edges, updating connected devices and cleaning up graphical resources.
- Added `removeEdge` method in `DataGraph` to remove connections between two specific devices by their IDs, ensuring mutual disconnection.
- Updated edge drawing to make the lines red and improved precision by limiting decimal points in displayed positions.
- Refactored `drawEdge` method to accept `startPos` and `endPos` as parameters for flexibility in updating edge positions.

TODO: Review and optimize edge deletion and modularize.
- Graphs and drawing entities comunicates with ids.
- Device class extends Sprite.
- DataGraph onnly in charge of maintaining entire network information. ViewGraph in charge of creating, updating and removing device and edge’s drawings in view.
src/types/device.ts Outdated Show resolved Hide resolved
src/types/device.ts Outdated Show resolved Hide resolved
src/types/device.ts Outdated Show resolved Hide resolved
src/types/graphs/viewgraph.ts Outdated Show resolved Hide resolved
src/types/graphs/viewgraph.ts Outdated Show resolved Hide resolved
src/types/device.ts Outdated Show resolved Hide resolved
src/types/graphs/viewgraph.ts Outdated Show resolved Hide resolved
- Moved ViewGraph construction logic to be self-contained, as each layer will have its own view.
- Added a TODO comment in the `constructView` method to indicate a future dependency on the selected layer.
- Set `eventMode` to "static" and `interactive` to `true` for devices, and added `addChild` from the callers, as suggested for consistency.
- Moved logic for edge creation and management into the `Edge` class to centralize functionality and improve modularity.

These changes address code structure improvements and prepare for future layer-based functionality.
@pgallino pgallino merged commit 79fd9b3 into main Nov 6, 2024
3 checks passed
@pgallino pgallino deleted the split-graphs branch November 6, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a way to remove nodes and edges Split "data" graph and "view" graph
3 participants