|
@@ -2100,14 +2100,13 @@ ImageLabeler::loadInfo(QString filename)
|
|
return false;
|
|
return false;
|
|
/* NOTREACHED */
|
|
/* NOTREACHED */
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ QString sImageStr = string;
|
|
if( QFileInfo(string).isRelative() )
|
|
if( QFileInfo(string).isRelative() )
|
|
{
|
|
{
|
|
- string = QFileInfo(filename).path() + "/" + string;
|
|
|
|
- string = QFileInfo(string).absoluteFilePath();
|
|
|
|
|
|
+ sImageStr = QFileInfo(filename).path() + "/" + string;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!image_->load( string )) {
|
|
|
|
|
|
+ if (!image_->load( sImageStr )) {
|
|
return false;
|
|
return false;
|
|
/* NOTREACHED */
|
|
/* NOTREACHED */
|
|
}
|
|
}
|
|
@@ -3338,8 +3337,30 @@ ImageLabeler::polyFromData(
|
|
/* indicates whether coordinate x or y */
|
|
/* indicates whether coordinate x or y */
|
|
bool evenFlag = 0;
|
|
bool evenFlag = 0;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ ///jojo
|
|
|
|
+ QStringList coordsList = aPolyData->split(";", QString::SkipEmptyParts);
|
|
|
|
+ Polygon newPoly;
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ if( coordsList.size() % 2 == 0)
|
|
|
|
+ {
|
|
|
|
+ for( int i = 0; i < coordsList.size(); i += 2)
|
|
|
|
+ {
|
|
|
|
+ newPoly.poly.append( QPoint( QVariant(coordsList[i]).toInt(),
|
|
|
|
+ QVariant(coordsList[i+1]).toInt() ) );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(std::exception &e)
|
|
|
|
+ {
|
|
|
|
+ newPoly.poly.clear();
|
|
|
|
+ }
|
|
|
|
+ return newPoly;
|
|
|
|
+ ///#jojo
|
|
|
|
+/*
|
|
for (int i = 0; i < aPolyData->size(); i++) {
|
|
for (int i = 0; i < aPolyData->size(); i++) {
|
|
- /* ";" is a separator */
|
|
|
|
|
|
+ // ";" is a separator
|
|
if (';' != aPolyData->at(i))
|
|
if (';' != aPolyData->at(i))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
@@ -3365,19 +3386,20 @@ ImageLabeler::polyFromData(
|
|
startPos = i + 1;
|
|
startPos = i + 1;
|
|
}
|
|
}
|
|
|
|
|
|
- /* last coordinate was Xi what means an error */
|
|
|
|
|
|
+ // last coordinate was Xi what means an error
|
|
if (evenFlag) {
|
|
if (evenFlag) {
|
|
qDebug() <<
|
|
qDebug() <<
|
|
"polyFromData: "
|
|
"polyFromData: "
|
|
"poly format is corrupted";
|
|
"poly format is corrupted";
|
|
poly.poly.clear();
|
|
poly.poly.clear();
|
|
}
|
|
}
|
|
- /* last converting from string was not successful */
|
|
|
|
|
|
+ // last converting from string was not successful
|
|
else if (!ok) {
|
|
else if (!ok) {
|
|
poly.poly.clear();
|
|
poly.poly.clear();
|
|
}
|
|
}
|
|
|
|
|
|
return poly;
|
|
return poly;
|
|
|
|
+ */
|
|
}
|
|
}
|
|
|
|
|
|
//! A protected member getting a Polygon from text of the list_areas_ item
|
|
//! A protected member getting a Polygon from text of the list_areas_ item
|