umbrello: UMLViewImageExporterModel Class Reference

umbrello 2.38.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
UMLViewImageExporterModel Class Reference

`#include <umlviewimageexportermodel.h>`

## Public Member Functions
| UMLViewImageExporterModel (float resolution=0.0)
virtual | ~UMLViewImageExporterModel ()
QString | exportView (UMLScene *scene, const QString &imageType, const QUrl &url) const
QStringList | exportViews (const UMLViewList &views, const QString &imageType, const QUrl &directory, bool useFolders) const

## Static Public Member Functions
static QStringList | supportedImageTypes ()
static QStringList | supportedMimeTypes ()
static QString | imageTypeToMimeType (const QString &imageType)
static QString | mimeTypeToImageType (const QString &mimeType)

## Private Member Functions
QString | getDiagramFileName (UMLScene *scene, const QString &imageType, bool useFolders=false) const
bool | prepareDirectory (const QUrl &url) const
bool | exportViewTo (UMLScene *scene, const QString &imageType, const QString &fileName) const
bool | exportViewToDot (UMLScene *scene, const QString &fileName) const
bool | exportViewToEps (UMLScene *scene, const QString &fileName) const
bool | exportViewToSvg (UMLScene *scene, const QString &fileName) const
bool | exportViewToPixmap (UMLScene *scene, const QString &imageType, const QString &fileName) const

## Private Attributes
float | m_resolution

## Static Private Attributes
static QStringList * | s_supportedImageTypesList
static QStringList * | s_supportedMimeTypesList

## Detailed Description

Exports a UMLView in various image formats. It can also export all the views in the current document.

The methods in this class don't communicate with the user, so asking the format to save the images in, checking if the target file exists and so on must be done before calling those methods, if needed. The only exception is asking passwords for example when KIO slaves are used, as this operation is made automatically by the KIO classes.

## Constructor & Destructor Documentation

## ◆ UMLViewImageExporterModel()

UMLViewImageExporterModel::UMLViewImageExporterModel | ( | float | resolution = `0.0` | ) |
| explicit

Constructor for UMLViewImageExporterModel.

Parameters

  resolution | resolution of export in DPI (default 0.0 means export type related default)

## ◆ ~UMLViewImageExporterModel()

UMLViewImageExporterModel::~UMLViewImageExporterModel | ( |  | ) |
| virtual

Destructor for UMLViewImageExporterModel.

## Member Function Documentation

## ◆ exportView()

QString UMLViewImageExporterModel::exportView | ( | UMLScene * | scene,
|  | const QString & | imageType,
|  | const QUrl & | url
| ) |  | const

Exports the view to the url using the 'imageType' for the image.

This method creates the needed directories, if any. If there was an existing file in the specified url overwrites it without asking. The url used can be local or remote, using supported KIO slaves.

If some problem occurs when exporting, an error message is returned.

Parameters

  scene | The UMLScene to export.
  imageType | The type of the image the view will be exported to.
  url | The url where the image will be saved.

Returns
  The error message if some problem occurred when exporting, or QString() if all went fine.

## ◆ exportViews()

QStringList UMLViewImageExporterModel::exportViews | ( | const UMLViewList & | views,
|  | const QString & | imageType,
|  | const QUrl & | directory,
|  | bool | useFolders
| ) |  | const

Exports views in the document to the directory specified in the url using the 'imageType' for the images. The name of the exported images will be like their view's name and using the 'imageType' as extension.

The views are stored in folders in the document. The same tree structure used in the document to store the views can be created in the target directory with 'useFolders'. Only the folders made by the user are created in the target directory (Logical view, use case view and so on aren't created).

This method creates the specified target directory if needed. If there was an existing file with the same path as one to be created overwrites it without asking. The url used can be local or remote, using supported KIO slaves.

Parameters

  views | The list of views to export.
  imageType | The type of the images the views will be exported to.
  directory | The url of the directory where the images will be saved.
  useFolders | If the tree structure of the views in the document must be created in the target directory.

Returns
  A QStringList with all the error messages that occurred during export. If the list is empty, all the views were exported successfully.

## ◆ exportViewTo()

bool UMLViewImageExporterModel::exportViewTo | ( | UMLScene * | scene,
|  | const QString & | imageType,
|  | const QString & | fileName
| ) |  | const
| private

Exports the scene to the file 'fileName' as the specified type.

Parameters

  scene | The scene to export.
  imageType | The type of the image the scene will be exported to.
  fileName | The name of the file where the image will be saved.

Returns
  True if the operation was successful, false if a problem occurred while exporting.

## ◆ exportViewToDot()

bool UMLViewImageExporterModel::exportViewToDot | ( | UMLScene * | scene,
|  | const QString & | fileName
| ) |  | const
| private

Exports the view to the file 'fileName' as a dot file.

Parameters

  scene | The scene to export.
  fileName | The name of the file where the image will be saved.

Returns
  True if the operation was successful, false if a problem occurred while exporting.

## ◆ exportViewToEps()

bool UMLViewImageExporterModel::exportViewToEps | ( | UMLScene * | scene,
|  | const QString & | fileName
| ) |  | const
| private

Exports the view to the file 'fileName' as EPS.

Parameters

  scene | The scene to export.
  fileName | The name of the file where the image will be saved.

Returns
  True if the operation was successful, false if a problem occurred while exporting.

## ◆ exportViewToPixmap()

bool UMLViewImageExporterModel::exportViewToPixmap | ( | UMLScene * | scene,
|  | const QString & | imageType,
|  | const QString & | fileName
| ) |  | const
| private

Exports the view to the file 'fileName' as a pixmap of the specified type. The valid types are those supported by QPixmap save method.

Parameters

  scene | The scene to export.
  imageType | The type of the image the view will be exported to.
  fileName | The name of the file where the image will be saved.

Returns
  True if the operation was successful, false if a problem occurred while exporting.

## ◆ exportViewToSvg()

bool UMLViewImageExporterModel::exportViewToSvg | ( | UMLScene * | scene,
|  | const QString & | fileName
| ) |  | const
| private

Exports the view to the file 'fileName' as SVG.

Parameters

  scene | The scene to export.
  fileName | The name of the file where the image will be saved.

Returns
  True if the operation was successful, false if a problem occurred while exporting.

## ◆ getDiagramFileName()

QString UMLViewImageExporterModel::getDiagramFileName | ( | UMLScene * | scene,
|  | const QString & | imageType,
|  | bool | useFolders = `false`
| ) |  | const
| private

Returns the diagram file name.

Parameters

  scene | the diagram
  imageType | the image type as file name extension
  useFolders | flag whether to add folder to the file name

Returns
  the file name with extension

## ◆ imageTypeToMimeType()

QString UMLViewImageExporterModel::imageTypeToMimeType | ( | const QString & | imageType | ) |
| static

Returns the mime type for an image type. The supported image types are those that the diagrams can be exported to.

Parameters

  imageType | The type of the image.

Returns
  A QString with the equivalent mime type, or QString() if it's unknown.

## ◆ mimeTypeToImageType()

QString UMLViewImageExporterModel::mimeTypeToImageType | ( | const QString & | mimeType | ) |
| static

Returns the image type for a mime type. The supported image types are those that the diagrams can be exported to.

Parameters

  mimeType | The mime type.

Returns
  A lowercase QString with the equivalent image type, or QString() if it's unknown.

## ◆ prepareDirectory()

bool UMLViewImageExporterModel::prepareDirectory | ( | const QUrl & | url | ) | const
| private

Creates, if it doesn't exist, the directory to save the file. It also creates all the needed parent directories.

Parameters

  url | The url where the image will be saved.

Returns
  True if the operation was successful, false if the directory didn't exist and couldn't be created.

## ◆ supportedImageTypes()

QStringList UMLViewImageExporterModel::supportedImageTypes | ( |  | ) |
| static

Returns a QStringList containing all the supported image types to use when exporting. All the types will be lower case.

Returns
  A QStringList containing all the supported image types to use when exporting.

## ◆ supportedMimeTypes()

QStringList UMLViewImageExporterModel::supportedMimeTypes | ( |  | ) |
| static

Returns a QStringList containing all the supported mime types to use when exporting. All the types will be lower case.

Returns
  A QStringList containing all the supported mime types to use when exporting.

## Member Data Documentation

## ◆ m_resolution

float UMLViewImageExporterModel::m_resolution
| private

## ◆ s_supportedImageTypesList

QStringList * UMLViewImageExporterModel::s_supportedImageTypesList
| staticprivate

## ◆ s_supportedMimeTypesList

QStringList * UMLViewImageExporterModel::s_supportedMimeTypesList
| staticprivate

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

- umbrello/umlviewimageexportermodel.h
- umbrello/umlviewimageexportermodel.cpp