예제 #1
0
int CChartTable::parseQVCT( const QDomElement& _rqDomElement )
{
  // Chart table
  QDomElement __qDomElementChartTable = _rqDomElement.firstChildElement( "ChartTable" );
  if( __qDomElementChartTable.isNull() ) return 0;
  if( __qDomElementChartTable.hasAttribute( "longitude" ) && __qDomElementChartTable.hasAttribute( "longitude" ) )
  {
    oGeoPositionReference.setPosition( __qDomElementChartTable.attribute( "longitude" ).toDouble(),
                                       __qDomElementChartTable.attribute( "latitude" ).toDouble() );
  }
  if( __qDomElementChartTable.hasAttribute( "scale" ) )
    fdScaleReference = __qDomElementChartTable.attribute( "scale" ).toDouble();
  // ... charts
  int __iCount = 0;
  for( QDomElement __qDomElementChart = __qDomElementChartTable.firstChildElement( "Chart" );
       !__qDomElementChart.isNull();
       __qDomElementChart = __qDomElementChart.nextSiblingElement( "Chart" ) )
  {
    QString __qsFilename = __qDomElementChart.hasAttribute( "file" ) ? __qDomElementChart.attribute( "file" ) : __qDomElementChart.attribute( "raster" );
    CChart* __poChart = loadChart( __qsFilename );
    if( !__poChart )
    {
      QVCTRuntime::useMainWindow()->fileError( QVCT::OPEN, __qsFilename );
      continue;
    }
    __poChart->parseQVCT( __qDomElementChart );
    __iCount++;
  }
  return __iCount;
}
예제 #2
0
void CChartTable::slotLoadChart()
{
  QString __qsFilename = QVCTRuntime::useMainWindow()->fileDialog( QVCT::OPEN, tr("Load Chart"), tr("GeoTIFF Files")+" (*.tif *.tiff)" );
  if( __qsFilename.isEmpty() ) return;
  if( !QVCTRuntime::useMainWindow()->fileCheck( QVCT::OPEN, __qsFilename ) ) return;
  QMutex* __pqMutexDataChange = QVCTRuntime::useMutexDataChange();
  __pqMutexDataChange->lock();
  CChart* __poChart = loadChart( __qsFilename );
  __pqMutexDataChange->unlock();
  if( !__poChart )
  {
    QVCTRuntime::useMainWindow()->fileError( QVCT::OPEN, __qsFilename );
    return;
  }
  bProjectModified = true;
}
예제 #3
0
FileFactory::FileError File_v1::load(QDataStream *stream)
{

    mInternalStitchSet = new StitchSet();
    mInternalStitchSet->isTemporary = true;
    mInternalStitchSet->stitchSetFileName = StitchLibrary::inst()->nextSetSaveFile();
    QString dest = mInternalStitchSet->stitchSetFileName;
    QFileInfo info(dest);
    QDir(info.path()).mkpath(info.path() + "/" + info.baseName());

    mInternalStitchSet->loadIcons(stream);

    QByteArray docData;
    *stream >> docData;

    QXmlStreamReader xmlStream(docData);

    if(xmlStream.hasError()) {
        qWarning() << "Error loading saved file: " << xmlStream.errorString();
        return FileFactory::Err_GettingFileContents;
    }

    while (!xmlStream.atEnd() && !xmlStream.hasError()) {

        xmlStream.readNext();
        if (xmlStream.isStartElement()) {
            QString name = xmlStream.name().toString();

            if(name == "colors") {
                loadColors(&xmlStream);

            } else if(name == "chart") {
                loadChart(&xmlStream);

            } else if(name == "stitch_set") {
                mInternalStitchSet->loadXmlStitchSet(&xmlStream, true);

            }
        }
    }

    StitchLibrary::inst()->addStitchSet(mInternalStitchSet);

    return FileFactory::No_Error;
}