30 #include "../../core/pattern/mvc/ItemModelObservable.h"
31 #include "../../core/pattern/singleton/Context.h"
32 #include "../../core/enum/Enums.h"
33 #include "../item/MapItem.h"
34 #include "../item/LegendItem.h"
35 #include "../../item/LegendModel.h"
36 #include "../../item/MapModel.h"
37 #include "../item/TextItem.h"
38 #include "../../item/TextModel.h"
39 #include "../item/LegendChildItem.h"
40 #include "../../item/LegendChildModel.h"
41 #include "../../core/pattern/derivativevisitor/VisitorUtils.h"
42 #include "../../item/GridGeodesicModel.h"
43 #include "../../item/GridPlanarModel.h"
45 #include "../item/GridMapItem.h"
52 #include <QGraphicsItem>
53 #include <QGraphicsScene>
54 #include <QTextDocument>
70 std::vector<te::layout::MapItem*> list;
72 QList<QGraphicsItem*> graphicsItems = getItems(selected);
73 foreach( QGraphicsItem *item, graphicsItems)
96 QList<QGraphicsItem*> graphicsItems = getItems(
false);
97 foreach( QGraphicsItem *item, graphicsItems)
124 std::vector<std::string> strList;
126 QList<QGraphicsItem*> graphicsItems = getItems(selected);
127 foreach( QGraphicsItem *item, graphicsItems)
144 strList.push_back(name);
154 QList<QGraphicsItem*> graphicsItems = getItems();
155 foreach( QGraphicsItem *item, graphicsItems)
177 QList<QGraphicsItem*> graphicsItems = getItems();
178 foreach( QGraphicsItem *item, graphicsItems)
199 if(model->
getId() > id)
234 QList<QGraphicsItem*> graphicsItems;
238 graphicsItems = m_scene->selectedItems();
242 graphicsItems = m_scene->items();
245 return graphicsItems;
258 if(!isCurrentMapTools())
261 QList<QGraphicsItem*> graphicsItems = getItems(
true);
262 foreach(QGraphicsItem *item, graphicsItems)
286 QGraphicsItem *item = m_scene->selectedItems().first();
297 createTextItemFromObject(map);
305 QGraphicsItem *item = m_scene->selectedItems().first();
318 createLegendChildItemFromLegend(coord, visitable);
334 std::map<te::gm::Point*, std::string>::iterator it;
336 for (it = map.begin(); it != map.end(); ++it)
339 std::string text = it->second;
343 QGraphicsItem* item = 0;
358 txtItem->setFont(*ft);
360 fnt.
setFamily(ft->family().toStdString());
365 txtItem->document()->setPlainText(text.c_str());
385 std::map<te::gm::Point*, std::string>::iterator it;
387 for (it = map.begin(); it != map.end(); ++it)
390 std::string text = it->second;
394 QGraphicsItem* item = 0;
403 QList<QGraphicsItem*> legends;
404 legends.push_back(lgItem);
414 std::vector<te::layout::Properties*> props;
416 std::vector<te::layout::GridMapItem*> gridMapItems = getMapChildren();
418 std::vector<te::layout::GridMapItem*>::iterator it = gridMapItems.begin();
419 for( ; it != gridMapItems.end() ; ++it)
426 if(!(*it)->getModel())
432 props.push_back(prop);
440 std::vector<te::layout::GridMapItem*> gridMapItems;
442 QGraphicsItem *item = m_scene->selectedItems().first();
454 QList<QGraphicsItem*> graphicsItems = map->childItems();
455 foreach(QGraphicsItem *item, graphicsItems)
466 gridMapItems.push_back(grid);
474 QGraphicsItem* intersectionItem = 0;
480 return intersectionItem;
486 return intersectionItem;
489 QList<QGraphicsItem*> items = sc->selectedItems();
493 bool intersection =
false;
495 foreach (QGraphicsItem *item, items)
499 bool intersection = item->contains(pt);
502 intersectionItem = item;
508 return intersectionItem;
virtual std::map< te::gm::Point *, std::string > getTextMapAsObjectInfo()
virtual void setText(std::string txt)
Class that represents a "Model" part of Legend MVC component. Its coordinate system is the same of sc...
virtual void createTextMapAsObject()
Vectorizes inside text of selected MapItem. (generates te::layout::TextItem objects) ...
virtual std::vector< Properties * > getGridMapProperties()
Get properties of all GridMapItem, children of a MapItem.
virtual EnumModeType * getEnumModeType()
Returns mode type enumeration.
virtual EnumType * getModeMapZoomIn() const
Returns value that represents map zoom in mode type belonging to enumeration.
virtual EnumType * getModeCreateText() const
Returns value that represents create text mode type belonging to enumeration.
virtual std::vector< GridMapItem * > getMapChildren()
Get all GridMapItem, children of a MapItem.
Utility class for manipulating items in the scene and vectorization of text and legend.
virtual EnumType * getModeCreateLegendChild() const
Returns value that represents create legend child mode type belonging to enumeration.
Abstract class to represent an observable. "Model" part of MVC component. All classes representing th...
Class representing the scene. This scene is child of QGraphicsScene, part of Graphics View Framework...
virtual bool isCurrentMapTools()
Indicates whether there is a tool active for object te::layout::MapItem.
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
void setPointSize(int point)
Sets point size of the font.
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
virtual std::vector< Property > getProperties()
Returns set of all properties.
virtual std::map< te::gm::Point *, std::string > getCoordChildren()
An utility struct for representing 2D coordinates.
virtual void createLegendChildItemFromLegend(std::map< te::gm::Point *, std::string > map, MapModel *visitable)
Vectorizes grid text of selected MapItem. (generates te::layout::TextItem objects) ...
ItemUtils(QGraphicsScene *scene)
Constructor.
Class that represents a "Model" part of Text MVC component. Its coordinate system is the same of scen...
virtual void redraw(bool bRefresh=true)
Redraws the graphic component.
Class that represents a graphic legend of a map. Its coordinate system is the same of scene (millimet...
virtual QGraphicsItem * intersectionSelectionItem(int x, int y)
Checks whether the coordinated intersects an item and returns.
virtual EnumType * getType()=0
Returns the type of component Reimplement this function in a Observable subclass to provide the model...
const double & getY() const
It returns the Point y-coordinate value.
static Context & getInstance()
It returns a reference to the singleton instance.
Class to represent a mode type enumeration. Ex.: select, pan, create text, etc. The type of mode is u...
A point with x and y coordinate values.
virtual std::vector< MapItem * > getMapItemList(bool selected=false)
MVC components list of type te::layout::MapItem.
virtual void createTextItemFromObject(std::map< te::gm::Point *, std::string > map, QFont *ft=0)
Vectorizes grid text of selected MapItem. (generates te::layout::TextItem objects) ...
virtual int getId()
Reimplemented from Observable.
virtual EnumType * getModeNone() const
Returns value that represents none mode type belonging to enumeration.
void setFamily(std::string family)
Returns font family name.
virtual EnumType * getModeMapPan() const
Returns value that represents map pan mode type belonging to enumeration.
EnumType * getMode()
Returns value of the enumeration of mode type.
virtual ~ItemUtils()
Destructor.
Class representing the scene. This scene is child of QGraphicsScene, part of Graphics View Framework...
Class that represents a "Model" part of Map MVC component. Its coordinate system is the same of scene...
Abstract scene for Scene, a QGraphicsScene class, part of Graphics View Framework.
virtual MapItem * getMapItem(std::string name)
Search for te::layout::MapItem by name.
Class that represents a graphic GridMap. Its coordinate system is the same of scene (millimeters)...
virtual void createTextGridAsObject()
Vectorizes grid text of selected MapItem. (generates te::layout::TextItem objects) ...
virtual QGraphicsItem * createItem(const te::gm::Coord2D &coord)
Method that create a graphic object and place it in the scene. A name and a position is added...
virtual EnumType * getModeMapZoomOut() const
Returns value that represents map zoom out mode type belonging to enumeration.
virtual void changeCurrentTool(EnumType *mode)
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
virtual Visitable * getVisitable()
Return the object to be visited.
virtual Observable * getModel()
Returns the "Model" part of the MVC.
virtual void setCurrentToolInSelectedMapItems(EnumType *mode)
Changes the active tool of te::layout::MapItem.
void setMode(EnumType *mode)
Change value of the enumeration of mode type. Ex.: select, pan, create text, etc. The type of mode is...
virtual QList< QGraphicsItem * > getItems(bool selected=false)
Returns the list of items added to a scene.
AbstractScene * getScene()
Returns abstract scene for QGraphicsScene class, part of Graphics View Framework. ...
virtual int countType(te::layout::EnumType *type)
Returns the number of items added to the scene with the type.
virtual std::string getName()=0
Method that returns the name of the MVC component. Reimplement this function in a Observable subclass...
virtual std::vector< std::string > mapNameList(bool selected=false)
List of names te::layout::MapItem.
virtual void createLegendChildAsObject()
Vectorizes selected LegendItem. (generates te::layout::TextItem objects)
const double & getX() const
It returns the Point x-coordinate value.
virtual void setFont(Font ft)
This class is a proxy MapDisplay. This makes it possible to add a MapDisplay as item of a scene...
virtual int maxTypeId(te::layout::EnumType *type)
Search max id for a type.
Class that represents text. This object is of type QGraphicsTextItem. He is directly editable via use...