21 #ifndef __ANTARES_TOOLBOX_MAP_CONTAINER_H__
22 #define __ANTARES_TOOLBOX_MAP_CONTAINER_H__
24 #include <antares/study/study.h>
27 #include "nodes/node.h"
29 namespace Antares::Map
32 using BoundingBox = std::pair<wxPoint, wxPoint>;
38 class BindingConstraint;
84 BoundingBox
boundingBox(
const size_t& layerID)
const;
129 Node*
addNode(
const wxString&
id,
const wxString& caption,
const int x,
const int y);
144 bool remove(
const wxString& text);
170 Item*
find(
const int x,
const int y)
const;
183 Item::Vector*
find(
const int x1,
const int y1,
const int x2,
const int y2)
const;
188 Item*
find(
const wxString& text)
const;
215 void changeItemSelectionState(
Item* item);
219 void selectOnly(
const Data::Area::Vector& areas);
263 return (uint)pSelectedItems.size();
266 uint selectedItemsAsConnectionCount()
const
268 return (uint)pSelectedItemsAsConnection;
271 void getAllSelectedItems(std::vector<Item*>& list);
273 Data::AreaName findNewCaption(Data::AreaName =
"")
const;
282 void draw(DrawingContext& dc);
284 void drawExternalDrawer(DrawingContext& dc);
286 bool hasChanges()
const
291 void setChangesFlag(
bool v)
306 size_t getActiveLayerId();
317 bool mouseSelectionArea;
318 bool mouseSelectionLinks;
319 bool mouseSelectionPlants;
320 bool mouseSelectionConstraints;
323 void internalAddItem(Item* item,
bool takeOwnership =
false);
324 void internalRemoveItem(Item* item);
325 bool removeTheFirstSelectedItem();
327 void deallocationStackAdd(Item* i);
328 void deallocationStackRemove(Item* it);
329 bool deallocationStackExists(Item* it);
331 void deleteAllPendingData();
335 using NodeMap = std::map<Item*, bool>;
336 using NodeByZPosition = std::map<int, NodeMap>;
339 Component& pComponent;
340 Data::Study::Ptr pStudy;
342 NodeByZPosition pAllNodes;
344 Item::Set pStackDeallocation;
346 NodeMap pSelectedItems;
347 int pSelectedItemsAsConnection;
349 std::queue<Item*> pExternalQueue;
357 Data::Area::Vector pAreasToDelete;
360 friend class ::Antares::Map::Item;
361 friend class ::Antares::Map::Node;
362 friend class ::Antares::Map::Connection;
363 friend class ::Antares::Map::BindingConstraint;
369 #include "manager.hxx"
370 #include "nodes/connection.h"
Definition of a link between two areas (Interconnection)
Definition: links.h:58
std::vector< AreaLink * > Vector
Vector of links.
Definition: links.h:61
Definition for a single area.
Definition: area.h:51
Standard study MAP.
Definition: component.h:40
Definition: connection.h:38
A convenient container for nodes on the graph.
Definition: manager.h:44
Manager(Component &component)
Default Constructor.
Definition: manager.cpp:48
uint removeAllSelected()
Remove all selected items.
Definition: manager.cpp:1101
void selectOnly(Item *item)
Select a single item (a node or an interconnection)
Definition: manager.cpp:477
bool remove(const wxString &text)
Remove a node from its id or its caption.
Definition: manager.cpp:203
void selectAllItems(size_t layerID)
Select all items, without any distinction.
Definition: manager.cpp:696
uint areasCount(const size_t &layerID) const
Get how many area we have.
Definition: manager.cpp:1192
BoundingBox boundingBox(const size_t &layerID) const
Get the 2D-Bounding box wich contains all nodes.
Definition: manager.cpp:148
void showAllSelected(size_t id)
Show all selected items from a layer.
Definition: manager.cpp:1137
T * add()
Add a new node in the map.
Definition: manager.hxx:47
Data::Study::Ptr study() const
Get the attached study to this map.
Definition: manager.h:72
void selectAllLinks(size_t layerID)
Select all links.
Definition: manager.cpp:703
void attachStudy(Data::Study::Ptr study)
Attach this map to an existing study.
Definition: manager.cpp:78
void unselectAll()
Unselect all nodes.
Definition: manager.cpp:619
Item * find(const int x, const int y) const
Find a node from its position.
Definition: manager.cpp:219
uint connectionsCount(const size_t &layerID) const
Get how many connections we have.
Definition: manager.cpp:1256
void invalidateAllNodes()
Invalidate all nodes.
Definition: manager.cpp:290
void clear()
Clear (and destroy) all nodes.
Definition: manager.cpp:912
void reverseSelection()
Reverse the selection.
Definition: manager.cpp:731
bool loadFromStudy(Data::Study &study)
Load the layout from an existing study.
Definition: manager.cpp:83
uint selectedItemsCount() const
Get the count of nodes that are selected.
Definition: manager.h:261
void removeLayerVisibility(const size_t &layerID)
remove layer visibility for all nodes
Definition: manager.cpp:1217
void selectAllAreas(size_t layerID)
Select all areas only.
Definition: manager.cpp:667
void refreshCacheForAllNodes(wxDC &dc)
Update the cache for all nodes.
Definition: manager.cpp:332
~Manager()
Destructor.
Definition: manager.cpp:66
void moveAllSelected(const int x, const int y)
Moved all selected nodes.
Definition: manager.cpp:763
BoundingBox boundingBoxOfSelectedNodes(const size_t &layerID) const
Get the 2D-Bounding box wich contains all nodes.
Definition: manager.cpp:168
void draw(DrawingContext &dc)
Draw all items.
Definition: manager.cpp:983
void addConnectionFromEachSelectedItem(Item *to, Item::Vector *results=NULL)
Add a connection for each selected item to a item.
Definition: manager.cpp:1016
Node * addNode(const wxString &id)
Add a new node with a given id.
Definition: manager.cpp:187
void hideAllSelected(size_t id)
Hide all selected items from a layer.
Definition: manager.cpp:1117
static Manager * Instance()
Get the instance of the main window.
Definition: manager.cpp:41
void selectFromBoundingBox(const wxPoint &a, const wxPoint &b, const size_t layerID=0)
Select all nodes which are contained in a bounding box.
Definition: manager.cpp:775
bool loadFromAttachedStudy()
Load the layout from the attached study.
Definition: manager.hxx:41
void selectAllNodes(size_t layerID)
Select all nodes.
Definition: manager.cpp:638
Connection * addConnection(Item *a, Item *b)
Add a connection between two items.
Definition: manager.cpp:1004
A node in a map.
Definition: node.h:39