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"
34using BoundingBox = std::pair<wxPoint, wxPoint>;
40class BindingConstraint;
85 BoundingBox
boundingBox(
const size_t& layerID)
const;
130 Node*
addNode(
const wxString&
id,
const wxString& caption,
const int x,
const int y);
145 bool remove(
const wxString& text);
171 Item*
find(
const int x,
const int y)
const;
184 Item::Vector*
find(
const int x1,
const int y1,
const int x2,
const int y2)
const;
189 Item*
find(
const wxString& text)
const;
216 void changeItemSelectionState(
Item* item);
220 void selectOnly(
const Data::Area::Vector& areas);
264 return (uint)pSelectedItems.size();
267 uint selectedItemsAsConnectionCount()
const
269 return (uint)pSelectedItemsAsConnection;
272 void getAllSelectedItems(std::vector<Item*>& list);
274 Data::AreaName findNewCaption(Data::AreaName =
"")
const;
283 void draw(DrawingContext& dc);
285 void drawExternalDrawer(DrawingContext& dc);
287 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;
370#include "nodes/connection.h"
371#include "manager.hxx"
Definition of a link between two areas (Interconnection)
Definition links.h:50
std::vector< AreaLink * > Vector
Vector of links.
Definition links.h:53
Definition for a single area.
Definition area.h:52
Standard study MAP.
Definition component.h:42
Definition connection.h:40
A convenient container for nodes on the graph.
Definition manager.h:46
Manager(Component &component)
Default Constructor.
Definition manager.cpp:50
uint removeAllSelected()
Remove all selected items.
Definition manager.cpp:1005
void selectOnly(Item *item)
Select a single item (a node or an interconnection)
Definition manager.cpp:447
bool remove(const wxString &text)
Remove a node from its id or its caption.
Definition manager.cpp:189
void selectAllItems(size_t layerID)
Select all items, without any distinction.
Definition manager.cpp:650
uint areasCount(const size_t &layerID) const
Get how many area we have.
Definition manager.cpp:1086
BoundingBox boundingBox(const size_t &layerID) const
Get the 2D-Bounding box wich contains all nodes.
Definition manager.cpp:140
void showAllSelected(size_t id)
Show all selected items from a layer.
Definition manager.cpp:1035
T * add()
Add a new node in the map.
Definition manager.hxx:49
Data::Study::Ptr study() const
Get the attached study to this map.
Definition manager.h:74
void selectAllLinks(size_t layerID)
Select all links.
Definition manager.cpp:657
void attachStudy(Data::Study::Ptr study)
Attach this map to an existing study.
Definition manager.cpp:80
void unselectAll()
Unselect all nodes.
Definition manager.cpp:579
Item * find(const int x, const int y) const
Find a node from its position.
Definition manager.cpp:205
uint connectionsCount(const size_t &layerID) const
Get how many connections we have.
Definition manager.cpp:1142
void invalidateAllNodes()
Invalidate all nodes.
Definition manager.cpp:272
void clear()
Clear (and destroy) all nodes.
Definition manager.cpp:842
void reverseSelection()
Reverse the selection.
Definition manager.cpp:685
bool loadFromStudy(Data::Study &study)
Load the layout from an existing study.
Definition manager.cpp:85
uint selectedItemsCount() const
Get the count of nodes that are selected.
Definition manager.h:262
void removeLayerVisibility(const size_t &layerID)
remove layer visibility for all nodes
Definition manager.cpp:1107
void selectAllAreas(size_t layerID)
Select all areas only.
Definition manager.cpp:623
void refreshCacheForAllNodes(wxDC &dc)
Update the cache for all nodes.
Definition manager.cpp:312
~Manager()
Destructor.
Definition manager.cpp:68
void moveAllSelected(const int x, const int y)
Moved all selected nodes.
Definition manager.cpp:713
BoundingBox boundingBoxOfSelectedNodes(const size_t &layerID) const
Get the 2D-Bounding box wich contains all nodes.
Definition manager.cpp:156
void draw(DrawingContext &dc)
Draw all items.
Definition manager.cpp:907
void addConnectionFromEachSelectedItem(Item *to, Item::Vector *results=NULL)
Add a connection for each selected item to a item.
Definition manager.cpp:934
Node * addNode(const wxString &id)
Add a new node with a given id.
Definition manager.cpp:173
void hideAllSelected(size_t id)
Hide all selected items from a layer.
Definition manager.cpp:1019
static Manager * Instance()
Get the instance of the main window.
Definition manager.cpp:43
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:723
bool loadFromAttachedStudy()
Load the layout from the attached study.
Definition manager.hxx:43
void selectAllNodes(size_t layerID)
Select all nodes.
Definition manager.cpp:596
Connection * addConnection(Item *a, Item *b)
Add a connection between two items.
Definition manager.cpp:924
A node in a map.
Definition node.h:41