|
|
|
@ -80,7 +80,7 @@ bool kmlExport::createDir(TQDir dir)
|
|
|
|
|
bool ok = createDir(parent);
|
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
|
|
|
|
logError(i18n("Could not create '%1").tqarg(parent.path()));
|
|
|
|
|
logError(i18n("Could not create '%1").arg(parent.path()));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return parent.mkdir(dir.dirName());
|
|
|
|
@ -164,14 +164,14 @@ void kmlExport::generateImagesthumb(KIPI::Interface* interface, const KURL& imag
|
|
|
|
|
TQFile imageFile(path);
|
|
|
|
|
if (!imageFile.open(IO_ReadOnly))
|
|
|
|
|
{
|
|
|
|
|
logWarning(i18n("Could not read image '%1'").tqarg(path));
|
|
|
|
|
logWarning(i18n("Could not read image '%1'").arg(path));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString imageFormat = TQImageIO::imageFormat(TQT_TQIODEVICE(&imageFile));
|
|
|
|
|
if (imageFormat.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
logWarning(i18n("Format of image '%1' is unknown").tqarg(path));
|
|
|
|
|
logWarning(i18n("Format of image '%1' is unknown").arg(path));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
imageFile.close();
|
|
|
|
@ -181,7 +181,7 @@ void kmlExport::generateImagesthumb(KIPI::Interface* interface, const KURL& imag
|
|
|
|
|
TQImage image;
|
|
|
|
|
if (!image.loadFromData(imageData) )
|
|
|
|
|
{
|
|
|
|
|
logWarning(i18n("Error loading image '%1'").tqarg(path));
|
|
|
|
|
logWarning(i18n("Error loading image '%1'").arg(path));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -221,11 +221,11 @@ void kmlExport::generateImagesthumb(KIPI::Interface* interface, const KURL& imag
|
|
|
|
|
if (!image.save(destPath, imageFormat.ascii(), 85))
|
|
|
|
|
{
|
|
|
|
|
// if not able to save the image, it's pointless to create a placemark
|
|
|
|
|
logWarning(i18n("Could not save image '%1' to '%2'").tqarg(path).tqarg(destPath));
|
|
|
|
|
logWarning(i18n("Could not save image '%1' to '%2'").arg(path).arg(destPath));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//logInfo(i18n("Creation of picture '%1'").tqarg(fullFileName));
|
|
|
|
|
//logInfo(i18n("Creation of picture '%1'").arg(fullFileName));
|
|
|
|
|
KExiv2Iface::KExiv2 exiv2Iface;
|
|
|
|
|
exiv2Iface.load(imageURL.path());
|
|
|
|
|
double alt, lat, lng;
|
|
|
|
@ -237,11 +237,11 @@ void kmlExport::generateImagesthumb(KIPI::Interface* interface, const KURL& imag
|
|
|
|
|
|
|
|
|
|
if (alt)
|
|
|
|
|
{
|
|
|
|
|
addKmlTextElement(kmlGeometry, "coordinates", TQString("%1,%2,%3").tqarg(lng).tqarg(lat).tqarg(alt));
|
|
|
|
|
addKmlTextElement(kmlGeometry, "coordinates", TQString("%1,%2,%3").arg(lng).arg(lat).arg(alt));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
addKmlTextElement(kmlGeometry, "coordinates", TQString("%1,%2").tqarg(lng).tqarg(lat));
|
|
|
|
|
addKmlTextElement(kmlGeometry, "coordinates", TQString("%1,%2").arg(lng).arg(lat));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_altitudeMode == 2 )
|
|
|
|
@ -301,18 +301,18 @@ void kmlExport::generateImagesthumb(KIPI::Interface* interface, const KURL& imag
|
|
|
|
|
my_description += "<br/>" + info.description() ;
|
|
|
|
|
}
|
|
|
|
|
addKmlTextElement(kmlPlacemark, "description", my_description);
|
|
|
|
|
logInfo(i18n("Creation of placemark '%1'").tqarg(fullFileName));
|
|
|
|
|
logInfo(i18n("Creation of placemark '%1'").arg(fullFileName));
|
|
|
|
|
|
|
|
|
|
// Save icon
|
|
|
|
|
TQString iconFileName = "thumb_" + baseFileName + '.' + imageFormat.lower();
|
|
|
|
|
TQString destPath = m_tempDestDir + m_imageDir + iconFileName;
|
|
|
|
|
if (!icon.save(destPath, imageFormat.ascii(), 85))
|
|
|
|
|
{
|
|
|
|
|
logWarning(i18n("Could not save icon for image '%1' to '%2'").tqarg(path).tqarg(destPath));
|
|
|
|
|
logWarning(i18n("Could not save icon for image '%1' to '%2'").arg(path).arg(destPath));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//logInfo(i18n("Creation of icon '%1'").tqarg(iconFileName));
|
|
|
|
|
//logInfo(i18n("Creation of icon '%1'").arg(iconFileName));
|
|
|
|
|
// style et icon
|
|
|
|
|
TQDomElement kmlStyle = addKmlElement(kmlPlacemark, "Style");
|
|
|
|
|
TQDomElement kmlIconStyle = addKmlElement(kmlStyle, "IconStyle");
|
|
|
|
@ -347,14 +347,14 @@ void kmlExport::addTrack(TQDomElement &kmlAlbum)
|
|
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
|
{
|
|
|
|
|
logError(i18n("Cannot parse %1 GPX file!").tqarg(m_GPXFile));
|
|
|
|
|
logError(i18n("Cannot parse %1 GPX file!").arg(m_GPXFile));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_gpxParser.numPoints() <= 0)
|
|
|
|
|
{
|
|
|
|
|
logError(i18n("The %1 GPX file do not have a date-time track to use!")
|
|
|
|
|
.tqarg(m_GPXFile));
|
|
|
|
|
.arg(m_GPXFile));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -381,12 +381,12 @@ void kmlExport::addTrack(TQDomElement &kmlAlbum)
|
|
|
|
|
TQDomElement kmlLineStyle = addKmlElement(kmlLineTrackStyle, "LineStyle");
|
|
|
|
|
// the KML color is not #RRGGBB but AABBGGRR
|
|
|
|
|
TQString KMLColorValue = TQString("%1%2%3%4")
|
|
|
|
|
.tqarg((int)m_GPXOpacity*256/100, 2, 16)
|
|
|
|
|
.tqarg((&m_GPXColor)->blue(), 2, 16)
|
|
|
|
|
.tqarg((&m_GPXColor)->green(), 2, 16)
|
|
|
|
|
.tqarg((&m_GPXColor)->red(), 2, 16);
|
|
|
|
|
.arg((int)m_GPXOpacity*256/100, 2, 16)
|
|
|
|
|
.arg((&m_GPXColor)->blue(), 2, 16)
|
|
|
|
|
.arg((&m_GPXColor)->green(), 2, 16)
|
|
|
|
|
.arg((&m_GPXColor)->red(), 2, 16);
|
|
|
|
|
addKmlTextElement(kmlLineStyle, "color", KMLColorValue);
|
|
|
|
|
addKmlTextElement(kmlLineStyle, "width", TQString("%1").tqarg(m_LineWidth) );
|
|
|
|
|
addKmlTextElement(kmlLineStyle, "width", TQString("%1").arg(m_LineWidth) );
|
|
|
|
|
|
|
|
|
|
m_gpxParser.CreateTrackLine(kmlAlbum, *kmlDocument, m_GPXAltitudeMode);
|
|
|
|
|
}
|
|
|
|
@ -440,7 +440,7 @@ void kmlExport::generate()
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logWarning(i18n("No position data for '%1'").tqarg(info.title()));
|
|
|
|
|
logWarning(i18n("No position data for '%1'").arg(info.title()));
|
|
|
|
|
defectImage++;
|
|
|
|
|
}
|
|
|
|
|
m_progressDialog->setProgress(pos, count);
|
|
|
|
|