QElectroTech  0.70
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ElementPictureFactory Class Reference

The ElementPictureFactory class This class is singleton factory, use to create and get the picture use by elements. More...

#include <elementpicturefactory.h>

Classes

struct  primitives
 

Public Member Functions

void getPictures (const ElementsLocation &location, QPicture &picture, QPicture &low_picture)
 ElementPictureFactory::getPictures Set the picture of the element at location. Note, picture can be null. More...
 
QPixmap pixmap (const ElementsLocation &location)
 ElementPictureFactory::pixmap. More...
 
ElementPictureFactory::primitives getPrimitives (const ElementsLocation &location)
 ElementPictureFactory::getPrimitives. More...
 

Static Public Member Functions

static ElementPictureFactoryinstance ()
 instance More...
 
static void dropInstance ()
 dropInstance Drop the instance of factory More...
 

Private Member Functions

 ElementPictureFactory ()
 
 ElementPictureFactory (const ElementPictureFactory &)
 
ElementPictureFactory operator= (const ElementPictureFactory &)
 
 ~ElementPictureFactory ()
 
bool build (const ElementsLocation &location, QPicture *picture=nullptr, QPicture *low_picture=nullptr)
 ElementPictureFactory::build Build the picture from location. More...
 
void parseElement (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parseLine (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parseRect (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parseEllipse (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parseCircle (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parseArc (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parsePolygon (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void parseText (const QDomElement &dom, QPainter &painter, primitives &prim) const
 
void setPainterStyle (const QDomElement &dom, QPainter &painter) const
 ElementPictureFactory::setPainterStyle apply the style store in dom to painter. More...
 

Private Attributes

QHash< QUuid, QPicture > m_pictures_H
 
QHash< QUuid, QPicture > m_low_pictures_H
 
QHash< QUuid, QPixmap > m_pixmap_H
 
QHash< QUuid, primitivesm_primitives_H
 

Static Private Attributes

static ElementPictureFactorym_factory = nullptr
 

Detailed Description

The ElementPictureFactory class This class is singleton factory, use to create and get the picture use by elements.

Definition at line 37 of file elementpicturefactory.h.

Constructor & Destructor Documentation

◆ ElementPictureFactory() [1/2]

ElementPictureFactory::ElementPictureFactory ( )
inlineprivate

Definition at line 90 of file elementpicturefactory.h.

Referenced by instance().

◆ ElementPictureFactory() [2/2]

ElementPictureFactory::ElementPictureFactory ( const ElementPictureFactory )
private

◆ ~ElementPictureFactory()

ElementPictureFactory::~ElementPictureFactory ( )
private

Definition at line 128 of file elementpicturefactory.cpp.

References m_primitives_H.

Member Function Documentation

◆ build()

bool ElementPictureFactory::build ( const ElementsLocation location,
QPicture *  picture = nullptr,
QPicture *  low_picture = nullptr 
)
private

ElementPictureFactory::build Build the picture from location.

Parameters
location
picture
low_pictureif and/or are not null this function draw on it and don't store it. if null, this function create a QPicture for normal and low zoom, draw on it and store it in m_pictures_H and m_low_pictures_H
Returns

Definition at line 144 of file elementpicturefactory.cpp.

References QET::attributeIsAnInteger(), m_low_pictures_H, m_pictures_H, m_primitives_H, parseElement(), QET::Icons::tr, ElementsLocation::uuid(), QET::version, and ElementsLocation::xml().

Referenced by getPictures(), getPrimitives(), and pixmap().

◆ dropInstance()

static void ElementPictureFactory::dropInstance ( )
inlinestatic

dropInstance Drop the instance of factory

Definition at line 73 of file elementpicturefactory.h.

References m_factory.

Referenced by QETApp::~QETApp().

◆ getPictures()

void ElementPictureFactory::getPictures ( const ElementsLocation location,
QPicture &  picture,
QPicture &  low_picture 
)

ElementPictureFactory::getPictures Set the picture of the element at location. Note, picture can be null.

Parameters
location
picture
low_picture

Definition at line 42 of file elementpicturefactory.cpp.

References build(), ElementsLocation::exist(), m_low_pictures_H, m_pictures_H, and ElementsLocation::uuid().

Referenced by Element::buildFromXml().

◆ getPrimitives()

ElementPictureFactory::primitives ElementPictureFactory::getPrimitives ( const ElementsLocation location)

ElementPictureFactory::getPrimitives.

Parameters
location
Returns
The primtive used to draw the element at

Definition at line 120 of file elementpicturefactory.cpp.

References build(), m_primitives_H, and ElementsLocation::uuid().

Referenced by ExportDialog::generateDxf().

◆ instance()

static ElementPictureFactory* ElementPictureFactory::instance ( )
inlinestatic

instance

Returns
The instance of the factory

Definition at line 55 of file elementpicturefactory.h.

References ElementPictureFactory(), and m_factory.

Referenced by Element::buildFromXml(), ExportDialog::generateDxf(), ElementsLocation::icon(), and Element::pixmap().

◆ operator=()

ElementPictureFactory ElementPictureFactory::operator= ( const ElementPictureFactory )
private

◆ parseArc()

void ElementPictureFactory::parseArc ( const QDomElement &  dom,
QPainter &  painter,
ElementPictureFactory::primitives prim 
) const
private

◆ parseCircle()

void ElementPictureFactory::parseCircle ( const QDomElement &  dom,
QPainter &  painter,
ElementPictureFactory::primitives prim 
) const
private

◆ parseElement()

void ElementPictureFactory::parseElement ( const QDomElement &  dom,
QPainter &  painter,
primitives prim 
) const
private

◆ parseEllipse()

void ElementPictureFactory::parseEllipse ( const QDomElement &  dom,
QPainter &  painter,
ElementPictureFactory::primitives prim 
) const
private

◆ parseLine()

void ElementPictureFactory::parseLine ( const QDomElement &  dom,
QPainter &  painter,
primitives prim 
) const
private

◆ parsePolygon()

void ElementPictureFactory::parsePolygon ( const QDomElement &  dom,
QPainter &  painter,
ElementPictureFactory::primitives prim 
) const
private

◆ parseRect()

void ElementPictureFactory::parseRect ( const QDomElement &  dom,
QPainter &  painter,
ElementPictureFactory::primitives prim 
) const
private

◆ parseText()

void ElementPictureFactory::parseText ( const QDomElement &  dom,
QPainter &  painter,
ElementPictureFactory::primitives prim 
) const
private

◆ pixmap()

QPixmap ElementPictureFactory::pixmap ( const ElementsLocation location)

ElementPictureFactory::pixmap.

Parameters
location
Returns
the pixmap of the element at Note pixmap can be null

Definition at line 76 of file elementpicturefactory.cpp.

References build(), m_pictures_H, m_pixmap_H, ElementsLocation::uuid(), and ElementsLocation::xml().

Referenced by Element::pixmap().

◆ setPainterStyle()

void ElementPictureFactory::setPainterStyle ( const QDomElement &  dom,
QPainter &  painter 
) const
private

ElementPictureFactory::setPainterStyle apply the style store in dom to painter.

Parameters
dom
painter

Definition at line 550 of file elementpicturefactory.cpp.

Referenced by parseArc(), parseCircle(), parseEllipse(), parseLine(), parsePolygon(), parseRect(), and parseText().

Member Data Documentation

◆ m_factory

ElementPictureFactory * ElementPictureFactory::m_factory = nullptr
staticprivate

Definition at line 110 of file elementpicturefactory.h.

Referenced by dropInstance(), and instance().

◆ m_low_pictures_H

QHash<QUuid, QPicture> ElementPictureFactory::m_low_pictures_H
private

Definition at line 107 of file elementpicturefactory.h.

Referenced by build(), and getPictures().

◆ m_pictures_H

QHash<QUuid, QPicture> ElementPictureFactory::m_pictures_H
private

Definition at line 106 of file elementpicturefactory.h.

Referenced by build(), getPictures(), and pixmap().

◆ m_pixmap_H

QHash<QUuid, QPixmap> ElementPictureFactory::m_pixmap_H
private

Definition at line 108 of file elementpicturefactory.h.

Referenced by pixmap().

◆ m_primitives_H

QHash<QUuid, primitives> ElementPictureFactory::m_primitives_H
private

Definition at line 109 of file elementpicturefactory.h.

Referenced by build(), getPrimitives(), and ~ElementPictureFactory().


The documentation for this class was generated from the following files: