00001 #include "vectordata.h" 00002 #include <iostream> 00003 #include <qapplication.h> 00004 #include <qlabel.h> 00005 00006 VectorData::VectorData( ShapeType type, Image *img ) : 00007 mType( type ), mImg( img ) { 00008 00009 } 00010 00011 void VectorData::transformDataset( ) { 00012 QWidget *pdlg = new QWidget( NULL, NULL, true ); 00013 QVBoxLayout *vbl = new QVBoxLayout( pdlg, 10, 10 ); 00014 vbl->setAutoAdd( true ); 00015 new QLabel( "Converting dataset. Please Wait.", pdlg ); 00016 QProgressBar *pbar = new QProgressBar( pdlg ); 00017 float pcnt = 0.0f; 00018 pdlg->show(); 00019 qApp->processEvents(); 00020 00021 int i = 0 ; 00022 int szdata = size(); 00023 for ( i=0; i < szdata; i++ ) { 00024 pcnt = (1.0f / (float)szdata) * (float)i; 00025 pbar->setProgress( (int)(pcnt * 100.0f) ); 00026 qApp->processEvents(); 00027 00028 Shape &lls = *mLLSet[i]; 00029 Shape &xys = *mXYSet[i]; 00030 if ( mType == POINT ) { 00031 Node &xynode = dynamic_cast<Node&>( xys ); 00032 Node &llnode = dynamic_cast<Node&>( lls ); 00033 xynode = llnode; 00034 mImg->getXY( xynode.x, xynode.y ); 00035 } 00036 else { 00037 Line &llline = dynamic_cast<Line&>( lls ); 00038 Line &xyline = dynamic_cast<Line&>( xys ); 00039 unsigned int in; 00040 for ( in=0; in < llline.size(); in++ ) { 00041 Node &llnode = llline[in]; 00042 Node &xynode = xyline[in]; 00043 xynode = llnode; 00044 mImg->getXY( xynode.x, xynode.y ); 00045 if ( xynode.x == -999999.0 && xynode.y == -999999.0 ) { 00046 llline.delNode( in ); 00047 xyline.delNode( in ); 00048 in--; 00049 } 00050 } 00051 } 00052 } 00053 delete pdlg; 00054 } 00055 00056 00057 00058
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |