Abstract class that represents a graphic item. Its coordinate system is the same of scene (millimeters). Knows rotate and resize. Stores a pixmap drawn by model. This is also son of ItemObserver, so it can become observer of a model (Observable). This class will be inherited and will became the view part of the MVC component. Who inherits it is required the implementation of updateObserver(ContextItem context) method. Drawing starting point is llx, lly. Can't add signals and slots in this class because moc(Qt) doesn't support templates. More...
#include <ParentItem.h>
Public Member Functions | |
virtual QRectF | boundingRect () const |
virtual void | changeZoomFactor (double currentZoomFactor) |
It is called immediately by the Scene when the zoom factor is changed in the Context. More... | |
virtual bool | contains (const QPointF &point) const |
virtual ItemController * | getController () |
Returns the "Controller" part of the MVC. More... | |
virtual QImage | getImage () |
Reimplemented from ItemObserver. More... | |
virtual Observable * | getModel () |
Returns the "Model" part of the MVC. More... | |
virtual std::string | getNameClass () |
Method that returns the class name. More... | |
virtual QPixmap | getPixmap () |
virtual te::gm::Coord2D | getPosition () |
Reimplemented from ItemObserver. More... | |
virtual te::color::RGBAColor ** | getRGBAColorImage (int &w, int &h) |
Reimplemented from ItemObserver. More... | |
virtual bool | isCanChangeGraphicOrder () |
Returns whether the graphic component to be or not send to back or bring to front. More... | |
virtual bool | isInvertedMatrix () |
Returns whether the graph component has the inverted matrix, otherwise the matrix scene. More... | |
virtual bool | isPrintable () |
Returns whether the graphic component is printable. More... | |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
Reimplemented from QGraphicsItem. More... | |
ParentItem (ItemController *controller=0, Observable *o=0, bool inverted=false) | |
Constructor. More... | |
virtual void | recalculateBoundingRect () |
The default implementation does nothing. More... | |
virtual void | redraw (bool bRefresh=true) |
Redraws the graphic component. More... | |
virtual void | refresh (bool pos=true) |
Updated model state. More... | |
virtual void | setCanChangeGraphicOrder (bool canChange) |
Change the state of the graphic component to be or not send to back or bring to front. More... | |
virtual void | setPixmap (const QPixmap &pixmap) |
virtual void | setPrintable (bool print) |
Modifies the state of the graphic component to be or not printable. More... | |
virtual void | setRect (QRectF rect) |
void | setZValue (qreal z) |
The Z value decides the stacking order of drawing. More... | |
virtual void | updateObserver (te::layout::ContextItem context) |
Reimplemented from ItemObserver. More... | |
virtual | ~ParentItem () |
Destructor. More... | |
Protected Member Functions | |
virtual void | applyRotation () |
Reimplemented from ItemObserver. More... | |
virtual QPixmap | calculateNewPixmap (const double &x, const double &y) |
virtual bool | checkTouchesCorner (const double &x, const double &y) |
virtual te::gm::Envelope | createNewBoxInCoordScene (const double &x, const double &y) |
virtual void | createResizePixmap () |
virtual void | drawBackground (QPainter *painter) |
virtual void | drawBorder (QPainter *painter) |
virtual void | drawSelection (QPainter *painter) |
virtual void | drawText (QPointF point, QPainter *painter, std::string text) |
Draw a text. Converts boundingRect item coordinates (local coordinates) in pixel coordinates (screen coordinates) of the current device. More... | |
virtual int | getZValueItem () |
Reimplemented from ItemObserver. More... | |
virtual void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) |
Reimplemented from QGraphicsItem. More... | |
virtual void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) |
Reimplemented from QGraphicsItem. More... | |
virtual void | hoverMoveEvent (QGraphicsSceneHoverEvent *event) |
Reimplemented from QGraphicsItem. More... | |
virtual QVariant | itemChange (QGraphicsItem::GraphicsItemChange change, const QVariant &value) |
Reimplemented from QGraphicsItem. More... | |
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
Reimplemented from QGraphicsItem. More... | |
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
Reimplemented from QGraphicsItem. More... | |
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
Reimplemented from QGraphicsItem. More... | |
virtual void | setZValueItem (int z) |
The Z value decides the stacking order of drawing. More... | |
Protected Attributes | |
te::gm::Envelope | m_boxCopy |
box with resize More... | |
bool | m_canChangeGraphicOrder |
Define if item can send to back or bring to front. More... | |
QPixmap | m_clonePixmap |
te::layout::ItemController * | m_controller |
"Controller" part of MVC component. More... | |
LayoutAlign | m_enumSides |
QPointF | m_finalCoord |
QPointF | m_initialCoord |
bool | m_invertedMatrix |
true if inverted, false otherwise the matrix scene More... | |
te::layout::Observable * | m_model |
"Model" part of MVC component. More... | |
bool | m_mousePressedAlt |
mouse and active alt key More... | |
std::string | m_nameClass |
Class name. More... | |
QPixmap | m_pixmap |
bool | m_printable |
State of the graphic component to be or not printable. More... | |
QRectF | m_rect |
bool | m_resizeMode |
pixmap to perform the resize is already built More... | |
bool | m_toResizeItem |
pixmap to perform the resize is not yet built More... | |
Abstract class that represents a graphic item. Its coordinate system is the same of scene (millimeters). Knows rotate and resize. Stores a pixmap drawn by model. This is also son of ItemObserver, so it can become observer of a model (Observable). This class will be inherited and will became the view part of the MVC component. Who inherits it is required the implementation of updateObserver(ContextItem context) method. Drawing starting point is llx, lly. Can't add signals and slots in this class because moc(Qt) doesn't support templates.
Definition at line 86 of file ParentItem.h.
|
inline |
Constructor.
controller | "Controller" part of MVC component |
o | "Model" part of MVC component |
Definition at line 234 of file ParentItem.h.
References te::layout::Observable::getBox(), te::gm::Envelope::getHeight(), te::common::Singleton< Context >::getInstance(), te::gm::Envelope::getWidth(), te::layout::ParentItem< T >::m_boxCopy, te::layout::ItemObserver::m_invertedMatrix, te::layout::ItemObserver::m_model, and te::layout::ParentItem< T >::setRect().
|
inlinevirtual |
Destructor.
Definition at line 263 of file ParentItem.h.
|
inlineprotectedvirtual |
Reimplemented from ItemObserver.
Implements te::layout::ItemObserver.
Definition at line 749 of file ParentItem.h.
References te::layout::ItemModelObservable::getAngle(), and te::layout::ItemModelObservable::getOldAngle().
|
inlinevirtual |
Reimplemented in te::layout::MapItem, te::layout::TextItem, and te::layout::GridMapItem.
Definition at line 489 of file ParentItem.h.
|
inlineprotectedvirtual |
Definition at line 636 of file ParentItem.h.
References te::gm::Envelope::getHeight(), and te::gm::Envelope::getWidth().
|
virtualinherited |
It is called immediately by the Scene when the zoom factor is changed in the Context.
currentZoomFactor | current zoom factor of the layout module |
Reimplemented in te::layout::MapItem.
Definition at line 134 of file ItemObserver.cpp.
Referenced by te::layout::Scene::onChangeZoomFactor().
|
inlineprotectedvirtual |
Definition at line 590 of file ParentItem.h.
References te::layout::TPLowerLeft, te::layout::TPLowerRight, te::layout::TPNoneSide, te::layout::TPTopLeft, and te::layout::TPTopRight.
|
inlinevirtual |
Definition at line 723 of file ParentItem.h.
|
inlineprotectedvirtual |
Definition at line 648 of file ParentItem.h.
References te::layout::TPLowerLeft, te::layout::TPLowerRight, te::layout::TPTopLeft, and te::layout::TPTopRight.
|
inlineprotectedvirtual |
Definition at line 864 of file ParentItem.h.
|
inlineprotectedvirtual |
Definition at line 381 of file ParentItem.h.
References te::color::RGBAColor::getAlpha(), te::layout::ItemModelObservable::getBackgroundColor(), te::color::RGBAColor::getBlue(), te::color::RGBAColor::getGreen(), and te::color::RGBAColor::getRed().
|
inlineprotectedvirtual |
Definition at line 455 of file ParentItem.h.
References te::color::RGBAColor::getAlpha(), te::color::RGBAColor::getBlue(), te::layout::ItemModelObservable::getBorderColor(), te::color::RGBAColor::getGreen(), te::color::RGBAColor::getRed(), te::layout::ItemModelObservable::isBorder(), and te::map::SolidLine.
|
inlineprotectedvirtual |
Definition at line 410 of file ParentItem.h.
References te::map::DashLine, and te::map::SolidLine.
|
inlineprotectedvirtual |
Draw a text. Converts boundingRect item coordinates (local coordinates) in pixel coordinates (screen coordinates) of the current device.
point | initial text coordinate (local coordinates from boundingRect) |
painter | low-level painting on widgets and other paint devices |
text |
Definition at line 321 of file ParentItem.h.
References te::common::Singleton< Context >::getInstance(), and te::layout::Context::getZoomFactor().
|
virtualinherited |
Returns the "Controller" part of the MVC.
Definition at line 99 of file ItemObserver.cpp.
|
virtual |
Reimplemented from ItemObserver.
Definition at line 807 of file ParentItem.h.
|
virtualinherited |
Returns the "Model" part of the MVC.
Definition at line 104 of file ItemObserver.cpp.
Referenced by te::layout::BuildGraphicsItem::addChild(), te::layout::ItemModelObservable::addChildren(), te::layout::VisitorUtils::changeMapVisitable(), te::layout::PropertiesOutside::changeMapVisitable(), te::layout::MenuBuilder::changePropertyValue(), te::layout::ChangePropertyCommand::checkItem(), te::layout::ItemUtils::countType(), te::layout::AddCommand::createCommandString(), te::layout::MoveCommand::createCommandString(), te::layout::ChangePropertyCommand::createCommandString(), te::layout::ItemUtils::createLegendChildAsObject(), te::layout::ObjectInspectorOutside::createProperty(), te::layout::ItemUtils::createTextItemFromObject(), te::layout::ItemUtils::createTextMapAsObject(), te::layout::Scene::deleteItems(), te::layout::PropertiesUtils::equalsHashCode(), te::layout::Scene::exportItemsToImage(), te::layout::PropertiesUtils::getAllProperties(), te::layout::Scene::getItemsProperties(), te::layout::ItemUtils::getMapItem(), te::layout::PropertiesOutside::getMapModel(), te::layout::ObjectInspectorOutside::hasMoveItemGroup(), te::layout::PropertiesUtils::intersection(), te::layout::GridMapItem::itemChange(), te::layout::ParentItem< T >::itemChange(), te::layout::ObjectInspectorOutside::itemsInspector(), te::layout::ItemUtils::mapNameList(), te::layout::ItemUtils::maxTypeId(), te::layout::View::mousePressEvent(), te::layout::Scene::removeSelectedItems(), te::layout::PropertiesUtils::sameProperties(), te::layout::Scene::selectItem(), te::layout::ObjectInspectorOutside::selectItems(), te::layout::PropertiesOutside::sendPropertyToSelectedItem(), and te::layout::PropertiesOutside::sendPropertyToSelectedItems().
|
virtualinherited |
Method that returns the class name.
Definition at line 124 of file ItemObserver.cpp.
Referenced by te::layout::ObjectInspectorOutside::createProperty().
|
inlinevirtual |
Definition at line 730 of file ParentItem.h.
|
inlinevirtual |
Reimplemented from ItemObserver.
Implements te::layout::ItemObserver.
Reimplemented in te::layout::MapItem, and te::layout::TextItem.
Definition at line 343 of file ParentItem.h.
References te::gm::Coord2D::x, and te::gm::Coord2D::y.
|
inlinevirtual |
Reimplemented from ItemObserver.
Implements te::layout::ItemObserver.
Reimplemented in te::layout::TextItem, and te::layout::MapItem.
Definition at line 781 of file ParentItem.h.
References te::qt::widgets::GetImage().
|
inlineprotectedvirtual |
Reimplemented from ItemObserver.
Implements te::layout::ItemObserver.
Definition at line 743 of file ParentItem.h.
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Definition at line 567 of file ParentItem.h.
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Definition at line 573 of file ParentItem.h.
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Definition at line 580 of file ParentItem.h.
|
virtualinherited |
Returns whether the graphic component to be or not send to back or bring to front.
Definition at line 119 of file ItemObserver.cpp.
Referenced by te::layout::AlignItems::bringToFront(), te::layout::Scene::createItem(), and te::layout::AlignItems::sendToBack().
|
virtualinherited |
Returns whether the graph component has the inverted matrix, otherwise the matrix scene.
Definition at line 129 of file ItemObserver.cpp.
Referenced by te::layout::Scene::insertItem(), and te::layout::View::mousePressEvent().
|
virtualinherited |
Returns whether the graphic component is printable.
Definition at line 94 of file ItemObserver.cpp.
Referenced by te::layout::Scene::getItemsProperties(), and te::layout::Scene::redrawItems().
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Reimplemented in te::layout::GridMapItem.
Definition at line 819 of file ParentItem.h.
References te::layout::ItemModelObservable::addChildren(), te::layout::Observable::getHashCode(), te::layout::ItemObserver::getModel(), and te::layout::ItemModelObservable::removeChildren().
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Reimplemented in te::layout::TextItem, te::layout::MapItem, te::layout::LegendItem, and te::layout::BalloonItem.
Definition at line 544 of file ParentItem.h.
Referenced by te::layout::MapItem::mouseMoveEvent().
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Reimplemented in te::layout::TextItem, te::layout::MapItem, and te::layout::BalloonItem.
Definition at line 505 of file ParentItem.h.
Referenced by te::layout::MapItem::mousePressEvent().
|
inlineprotectedvirtual |
Reimplemented from QGraphicsItem.
Reimplemented in te::layout::TextItem, te::layout::MapItem, and te::layout::BalloonItem.
Definition at line 519 of file ParentItem.h.
References te::gm::Envelope::getHeight(), te::gm::Envelope::getWidth(), and te::gm::Envelope::isValid().
Referenced by te::layout::MapItem::mouseReleaseEvent().
|
inlinevirtual |
Reimplemented from QGraphicsItem.
Reimplemented in te::layout::MapItem, te::layout::TextItem, te::layout::LegendItem, te::layout::ImageItem, te::layout::ArrowItem, te::layout::EllipseItem, te::layout::NorthItem, te::layout::PaperItem, te::layout::PointItem, te::layout::RectangleItem, te::layout::ScaleItem, te::layout::GridMapItem, te::layout::LineItem, te::layout::PolygonItem, te::layout::BalloonItem, te::layout::BarCodeItem, and te::layout::LegendChildItem.
Definition at line 291 of file ParentItem.h.
|
virtualinherited |
The default implementation does nothing.
Reimplemented in te::layout::MapItem, and te::layout::GridMapItem.
Definition at line 139 of file ItemObserver.cpp.
|
virtualinherited |
Redraws the graphic component.
Definition at line 54 of file ItemObserver.cpp.
References te::layout::ContextItem::setChangePos(), and te::layout::ContextItem::setPos().
Referenced by te::layout::BuildGraphicsItem::afterBuild(), te::layout::MenuBuilder::changePropertyValue(), te::layout::ChangePropertyCommand::checkItem(), te::layout::View::createItemGroup(), te::layout::ItemUtils::createLegendChildAsObject(), te::layout::VisualizationArea::createPaper(), te::layout::Scene::redrawItems(), te::layout::Scene::redrawSelectionMap(), te::layout::PropertiesOutside::sendPropertyToSelectedItem(), and te::layout::PropertiesOutside::sendPropertyToSelectedItems().
|
virtualinherited |
Updated model state.
true | if refresh the current position, false otherwise |
Definition at line 78 of file ItemObserver.cpp.
References te::gm::Coord2D::x, and te::gm::Coord2D::y.
Referenced by te::layout::ItemController::contains(), te::layout::Scene::insertItem(), and te::layout::Scene::updateSelectedItemsPositions().
|
virtualinherited |
Change the state of the graphic component to be or not send to back or bring to front.
canChange | true if send to back or bring to front, false otherwise |
Definition at line 114 of file ItemObserver.cpp.
|
inlinevirtual |
Reimplemented in te::layout::MapItem.
Definition at line 357 of file ParentItem.h.
References te::gm::Envelope::getHeight(), and te::gm::Envelope::getWidth().
|
virtualinherited |
Modifies the state of the graphic component to be or not printable.
true if printable, false otherwise |
Definition at line 89 of file ItemObserver.cpp.
|
inlinevirtual |
Definition at line 495 of file ParentItem.h.
Referenced by te::layout::ParentItem< T >::ParentItem().
|
inline |
The Z value decides the stacking order of drawing.
drawing | order |
Definition at line 736 of file ParentItem.h.
Referenced by te::layout::VisualizationArea::createPaper().
|
protectedvirtualinherited |
The Z value decides the stacking order of drawing.
drawing | order |
Definition at line 109 of file ItemObserver.cpp.
|
inlinevirtual |
Reimplemented from ItemObserver.
Implements te::layout::ItemObserver.
Reimplemented in te::layout::MapItem, te::layout::TextItem, te::layout::LegendItem, te::layout::TitleItem, and te::layout::LineItem.
Definition at line 269 of file ParentItem.h.
References te::layout::ContextItem::getPos(), te::layout::ContextItem::isChangePos(), te::gm::Coord2D::x, and te::gm::Coord2D::y.
|
protected |
box with resize
Definition at line 223 of file ParentItem.h.
Referenced by te::layout::ParentItem< T >::ParentItem().
|
protectedinherited |
Define if item can send to back or bring to front.
Definition at line 200 of file ItemObserver.h.
Referenced by te::layout::PaperItem::PaperItem().
|
protected |
Definition at line 224 of file ParentItem.h.
|
protectedinherited |
"Controller" part of MVC component.
Definition at line 197 of file ItemObserver.h.
|
protected |
Definition at line 229 of file ParentItem.h.
|
protected |
Definition at line 227 of file ParentItem.h.
|
protected |
Definition at line 226 of file ParentItem.h.
|
protectedinherited |
true if inverted, false otherwise the matrix scene
Definition at line 202 of file ItemObserver.h.
Referenced by te::layout::BarCodeItem::BarCodeItem(), and te::layout::ParentItem< T >::ParentItem().
|
protectedinherited |
"Model" part of MVC component.
Definition at line 198 of file ItemObserver.h.
Referenced by te::layout::BarCodeItem::BarCodeItem(), te::layout::ItemObserver::ItemObserver(), te::layout::MapItem::MapItem(), and te::layout::ParentItem< T >::ParentItem().
|
protected |
mouse and active alt key
Definition at line 225 of file ParentItem.h.
|
protectedinherited |
Class name.
Definition at line 201 of file ItemObserver.h.
Referenced by te::layout::ArrowItem::ArrowItem(), te::layout::BalloonItem::BalloonItem(), te::layout::BarCodeItem::BarCodeItem(), te::layout::EllipseItem::EllipseItem(), te::layout::GridGeodesicItem::GridGeodesicItem(), te::layout::GridMapItem::GridMapItem(), te::layout::GridPlanarItem::GridPlanarItem(), te::layout::ImageItem::ImageItem(), te::layout::ItemGroup::ItemGroup(), te::layout::LegendChildItem::LegendChildItem(), te::layout::LegendItem::LegendItem(), te::layout::LineItem::LineItem(), te::layout::MapItem::MapItem(), te::layout::NorthItem::NorthItem(), te::layout::PaperItem::PaperItem(), te::layout::PointItem::PointItem(), te::layout::PolygonItem::PolygonItem(), te::layout::RectangleItem::RectangleItem(), te::layout::ScaleItem::ScaleItem(), and te::layout::TextItem::TextItem().
|
protected |
Definition at line 219 of file ParentItem.h.
|
protectedinherited |
State of the graphic component to be or not printable.
Definition at line 199 of file ItemObserver.h.
|
protected |
Definition at line 220 of file ParentItem.h.
|
protected |
pixmap to perform the resize is already built
Definition at line 230 of file ParentItem.h.
|
protected |
pixmap to perform the resize is not yet built
Definition at line 228 of file ParentItem.h.