[Uml-devel] KDE/kdesdk/umbrello/umbrello

Ralf Habacker ralf.habacker at gmail.com
Tue Mar 6 23:05:47 UTC 2012


SVN commit 1283947 by habacker:

Keep methods location in sync between definition and declaration.

 M  +53 -53    umlviewimageexportermodel.cpp  
 M  +1 -1      umlviewimageexportermodel.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/umlviewimageexportermodel.cpp #1283946:1283947
@@ -414,59 +414,6 @@
 }
 
 /**
- * Fix the file 'fileName' to be a valid EPS containing the
- * specified area (rect) of the diagram.
- * Corrects the bounding box.
- *
- * @return True if the operation was successful,
- *         false if a problem occurred while exporting.
- */
-bool UMLViewImageExporterModel::fixEPS(const QString &fileName, const QRect& rect) const
-{
-    // now open the file and make a correct eps out of it
-    QFile epsfile(fileName);
-    if (! epsfile.open(QIODevice::ReadOnly)) {
-        return false;
-    }
-    // read
-    QTextStream ts(&epsfile);
-    QString fileContent = ts.readAll();
-    epsfile.close();
-
-    // read information
-    QRegExp rx("%%BoundingBox:\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)");
-    const int pos = rx.indexIn(fileContent);
-    if (pos < 0) {
-        uError() << fileName << ": cannot find %%BoundingBox";
-        return false;
-    }
-
-    // write new content to file
-    if (! epsfile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
-        uError() << fileName << ": cannot open file for writing";
-        return false;
-    }
-
-    // be careful when rounding (ceil/floor) the BB, these roundings
-    // were mainly obtained experimentally...
-    const double epsleft = rx.cap(1).toFloat();
-    const double epstop = rx.cap(4).toFloat();
-    const int left = int(floor(epsleft));
-    const int right = int(ceil(epsleft)) + rect.width();
-    const int top = int(ceil(epstop)) + 1;
-    const int bottom = int(floor(epstop)) - rect.height() + 1;
-
-    // modify content
-    fileContent.replace(pos,rx.cap(0).length(),
-                        QString("%%BoundingBox: %1 %2 %3 %4").arg(left).arg(bottom).arg(right).arg(top));
-
-    ts << fileContent;
-    epsfile.close();
-
-    return true;
-}
-
-/**
  * Exports the view to the file 'fileName' as SVG.
  *
  * @param scene    The scene to export.
@@ -539,3 +486,56 @@
     DEBUG(DBG_IEM) << "saving to file " << fileName << " , imageType=" << imageType << " successful=" << exportSuccessful;
     return exportSuccessful;
 }
+
+/**
+ * Fix the file 'fileName' to be a valid EPS containing the
+ * specified area (rect) of the diagram.
+ * Corrects the bounding box.
+ *
+ * @return True if the operation was successful,
+ *         false if a problem occurred while exporting.
+ */
+bool UMLViewImageExporterModel::fixEPS(const QString &fileName, const QRect& rect) const
+{
+    // now open the file and make a correct eps out of it
+    QFile epsfile(fileName);
+    if (! epsfile.open(QIODevice::ReadOnly)) {
+        return false;
+    }
+    // read
+    QTextStream ts(&epsfile);
+    QString fileContent = ts.readAll();
+    epsfile.close();
+    
+    // read information
+    QRegExp rx("%%BoundingBox:\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)\\s*(-?[\\d\\.:]+)");
+    const int pos = rx.indexIn(fileContent);
+    if (pos < 0) {
+        uError() << fileName << ": cannot find %%BoundingBox";
+        return false;
+    }
+    
+    // write new content to file
+    if (! epsfile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+        uError() << fileName << ": cannot open file for writing";
+        return false;
+    }
+    
+    // be careful when rounding (ceil/floor) the BB, these roundings
+    // were mainly obtained experimentally...
+    const double epsleft = rx.cap(1).toFloat();
+    const double epstop = rx.cap(4).toFloat();
+    const int left = int(floor(epsleft));
+    const int right = int(ceil(epsleft)) + rect.width();
+    const int top = int(ceil(epstop)) + 1;
+    const int bottom = int(floor(epstop)) - rect.height() + 1;
+    
+    // modify content
+    fileContent.replace(pos,rx.cap(0).length(),
+                        QString("%%BoundingBox: %1 %2 %3 %4").arg(left).arg(bottom).arg(right).arg(top));
+    
+    ts << fileContent;
+    epsfile.close();
+    
+    return true;
+}
--- trunk/KDE/kdesdk/umbrello/umbrello/umlviewimageexportermodel.h #1283946:1283947
@@ -51,9 +51,9 @@
     bool prepareDirectory(const KUrl &url) const;
 
     bool exportViewTo(UMLScene* scene, const QString &imageType, const QString &fileName) const;
+    bool exportViewToEps(UMLScene* scene, const QString &fileName, bool isEPS) const;
     bool exportViewToSvg(UMLScene* scene, const QString &fileName) const;
     bool exportViewToPixmap(UMLScene* scene, const QString &imageType, const QString &fileName) const;
-    bool exportViewToEps(UMLScene* scene, const QString &fileName, bool isEPS) const;
 
     bool fixEPS(const QString &fileName, const QRect& rect) const;
 




More information about the umbrello-devel mailing list