Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-17 Thread Régis Haubourg
Hi,
not sure if this helps, bu you can explore EasyCustomLabeling plugin where I
use a lot those options.. check current version 1.1. 

Cheers,
Régis



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104157.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-17 Thread hubbatov
Where can i get it?
Thanks



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104166.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-17 Thread hubbatov
Here you used label_style.qml, there is the string labeling/displayAll =
false. It is that i needed, but it not worked for me... :(

bool loadedStyle;
m_layer-loadNamedStyle( path_to_style + /label_style.qml, loadedStyle);

m_layer-setCustomProperty(labeling/fieldName,  );
m_layer-setCustomProperty(labeling,pal );
m_layer-setCustomProperty(labeling/fontSize,8 );
m_layer-setCustomProperty(labeling/enabled,true);
m_layer-setCustomProperty(labeling/displayAll, false);

What is wrong? I am at a loss...




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104176.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-17 Thread Régis Haubourg
Mmm. .. 
m_layer-setCustomProperty(labeling/displayAll, false);  that should
work.

Did you also put data defined properties like this?

m_layer-setCustomProperty(labeling/dataDefined/AlwaysShow,
1~~0LblAShow)

Thoses properties overide general placement properties on feature's level... 

I only have experience on PyQT side, maybe you miss something to refresh
that? 



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104195.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-17 Thread hubbatov
I did refreshing... nothing
Also i tried m_layer-setCustomProperty(labeling/dataDefined/AlwaysShow,
1~~0LblAShow) - nothing too...

It`s strange, why this not work.  I looked at QGis sources and tried to do
the same - again nothing... I thing there is something little nuance, but i
don`t know what exactly...



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104207.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-16 Thread hubbatov
Solved, but this way is not good, i think :)

layer-startEditing();
QListQgsField fields;
fields.append(QgsField(XCoordinate, QVariant::Double));
layer-addAttribute(QgsField(XCoordinate, QVariant::Double));
fields.append(QgsField(YCoordinate, QVariant::Double));
layer-addAttribute(QgsField(YCoordinate, QVariant::Double));

layer-dataProvider()-addAttributes(fields);
layer-commitChanges();

QgsFeature feat;
QgsFeatureIterator fit = layer-getFeatures();
while(fit.nextFeature(feat)){
QgsGeometry *geom = feat.geometry();
if(geom){
QgsPoint center = geom-boundingBox().center();
QgsAttributeMap chmap;
chmap[layer-fieldNameIndex(XCoordinate)] = center.x();
chmap[layer-fieldNameIndex(YCoordinate)] = center.y();

QgsChangedAttributesMap map;
map.insert(feat.id(), chmap);

layer-dataProvider()-changeAttributeValues(map);
}
}



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104147.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-16 Thread hubbatov
One more problem: how to disable rendering too many labels (overlapped
labels) ?

I tried this code:

bool inSets = QgsProject::instance()-readBoolEntry(PAL,
/ShowingAllLabels);
QgsPalLabeling* mPal =
(QgsPalLabeling*)m_map-mapCanvas()-mapRenderer()-labelingEngine();
mPal-setShowingAllLabels(false);
mPal-willUseLayer(layer);
qDebug()  IS SHOWING ALL LABELS:  mPal-isShowingAllLabels() 
inSets;

It shows me that label overlapping is off, but it is on! What to do?



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5104148.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-14 Thread hubbatov
Does anybody knows how to solve this?



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5103812.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labeling in vector layer (development on Qt)

2014-02-13 Thread hubbatov
Also i tried this:

  QgsPalLayerSettings lyr;
  lyr.readFromLayer(m_layer);
  lyr.labelPerPart = false;
  lyr.writeToLayer(m_layer);

but it now worked too...What i`m doing wrong?



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Labeling-in-vector-layer-development-on-Qt-tp5103733p5103742.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer