mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Don't load all of the point symbols if the layer is not of point
type (saves time) git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@3217 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
1c65ea53b5
commit
12bc020ce8
@ -52,10 +52,17 @@ QgsSiSyDialog::QgsSiSyDialog(QgsVectorLayer * layer):QgsSiSyDialogBase(), mVecto
|
||||
#ifdef QGISDEBUG
|
||||
qWarning("constructor QgsSiSyDialog called WITH a layer");
|
||||
#endif
|
||||
|
||||
//
|
||||
//set point symbol combo box
|
||||
//
|
||||
|
||||
// If this layer doesn't have points, break out of the following
|
||||
// two loops after the first iteration. This gives one point
|
||||
// symbol in the dialog, etc so that other code can rely on such a
|
||||
// fact, but avoids the long time required to load all of the
|
||||
// available symbols when they are not needed.
|
||||
|
||||
QStringList ml = QgsMarkerCatalogue::instance()->list();
|
||||
mMarkers.clear();
|
||||
|
||||
@ -67,29 +74,35 @@ QgsSiSyDialog::QgsSiSyDialog(QgsVectorLayer * layer):QgsSiSyDialogBase(), mVecto
|
||||
// Get maximum symbol width - this is probably slow
|
||||
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it ) {
|
||||
|
||||
QPicture pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
|
||||
pen, brush, QgsSVGCache::instance().getOversampling() );
|
||||
QPicture pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
|
||||
pen, brush, QgsSVGCache::instance().getOversampling() );
|
||||
|
||||
QRect br = pic.boundingRect();
|
||||
QRect br = pic.boundingRect();
|
||||
|
||||
if ( br.width() > maxwidth ) maxwidth = br.width();
|
||||
if ( br.width() > maxwidth ) maxwidth = br.width();
|
||||
|
||||
if (layer->vectorType() != QGis::Point)
|
||||
break;
|
||||
}
|
||||
|
||||
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it ) {
|
||||
mMarkers.push_back ( *it );
|
||||
mMarkers.push_back ( *it );
|
||||
|
||||
QPicture pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
|
||||
pen, brush, QgsSVGCache::instance().getOversampling() );
|
||||
QPicture pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
|
||||
pen, brush, QgsSVGCache::instance().getOversampling() );
|
||||
|
||||
QRect br = pic.boundingRect();
|
||||
QRect br = pic.boundingRect();
|
||||
|
||||
QPixmap pm( 10+maxwidth, 10+br.height() );
|
||||
pm.fill(QColor(255,255,255));
|
||||
QPainter p;
|
||||
p.begin(&pm);
|
||||
p.drawPicture ( 5-br.x()+(maxwidth-br.width())/2 , 5-br.y(), pic);
|
||||
p.end();
|
||||
mPointSymbolComboBox->insertItem ( pm );
|
||||
QPixmap pm( 10+maxwidth, 10+br.height() );
|
||||
pm.fill(QColor(255,255,255));
|
||||
QPainter p;
|
||||
p.begin(&pm);
|
||||
p.drawPicture ( 5-br.x()+(maxwidth-br.width())/2 , 5-br.y(), pic);
|
||||
p.end();
|
||||
mPointSymbolComboBox->insertItem ( pm );
|
||||
|
||||
if (layer->vectorType() != QGis::Point)
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user