Skip to content

Instantly share code, notes, and snippets.

View NathanW2's full-sized avatar

Nathan Woodrow NathanW2

View GitHub Profile
@NathanW2
NathanW2 / C# with brackets
Created August 31, 2010 06:53
Comparing C# with and with the {. Using indention like Python. Just for fun
public class Outlook
{
private Application outlook;
private Outlook(Application outlookInstance)
{
this.outlook = outlookInstance;
this.DBYDEmailFolderName = "DBYD";
}
public static Outlook ConnectToOutlook()
@NathanW2
NathanW2 / pyqgis.py
Created December 23, 2010 06:38
pyqgis
import qgis.core
import qgis.gui
def TestWrite(iface):
can = iface.mapCanvas()
layer = can.currentLayer()
geom = layer.selectedFeatures()[1].geometry()
return geom.length()
def run():
layer = qgis.utils.iface.mapCanvas().currentLayer()
for feature in layer.selectedFeatures():
geom = feature.geometry()
nodes = geom.asPolyline()
print nodes
nodes.reverse()
print nodes
newgeom = QgsGeometry.fromPolyline(nodes)
print newgeom
@NathanW2
NathanW2 / QGIS log
Created August 18, 2011 00:33
QGIS log
00000000 0.00000000 [1764] d:\src\qgis\src\app\qgscustomization.cpp(857) : (QgsCustomization::preNotify) click
00000001 0.21278715 [1764] d:\src\qgis\src\core\qgsdistancearea.cpp(160) : (QgsDistanceArea::setEllipsoid) setEllipsoid: a=6.37814e+06, b=6.37814e+06, 1/f=298.257
00000002 0.21283579 [1764] d:\src\qgis\src\core\qgscoordinatereferencesystem.cpp(351) : (QgsCoordinateReferenceSystem::createFromProj4) proj4: +proj=longlat +ellps=WGS84 +no_defs
00000003 0.21290582 [1764] d:\src\qgis\src\core\qgscoordinatereferencesystem.cpp(380) : (QgsCoordinateReferenceSystem::createFromProj4) proj string supplied has no +a argument
00000004 0.21295685 [1764] d:\src\qgis\src\core\qgscoordinatereferencesystem.cpp(542) : (QgsCoordinateReferenceSystem::getRecord) running query: select * from tbl_srs where parameters='+proj=longlat +ellps=WGS84 +no_defs'
00000005 0.35062841 [1764] d:\src\qgis\src\core\qgscoordinatereferencesystem.cpp(564) : (QgsCoordinateReferenceSystem::getRecord) trying system srs.db
00000006 0.35112
mapC = qgis.utils.iface.mapCanvas()
layer = mapC.currentLayer()
provider = layer.dataProvider()
feat = QgsFeature()
provider.nextFeature(feat)
myGeom = QgsGeometry( feat.geometry() )
layer.startEditing()
git checkout -b {your local branch name} release/1.2.3
EDIT EDIT EDIT
git commit -a -m "blah
git checkout master
git merge {your local branch name}
git tag release/1.2.3 -f
it push --tags
for f in *.shp
do
ogr2ogr -f "GeoJSON" $f.json $f layer
done
void QgsCompassPlugin::run()
{
QDockWidget* dock = new QDockWidget("Compass", qGisInterface->mainWindow() );
QgsCompassPluginGui *myQgsCompassPluginGui =
new QgsCompassPluginGui( dock );
dock->setWidget( myQgsCompassPluginGui );
dock->setAttribute( Qt::WA_DeleteOnClose );
dock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
qGisInterface->addDockWidget( Qt::LeftDockWidgetArea, dock );
dock->show();
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp
index bf22859..6e471d3 100644
--- a/src/app/qgisapp.cpp
+++ b/src/app/qgisapp.cpp
@@ -6246,6 +6246,8 @@ void QgisApp::projectProperties()
// It is needed to refresh scale bar after changing display units.
connect( pp, SIGNAL( refresh() ), mMapCanvas, SLOT( refresh() ) );
+ connect( pp, SIGNAL( userScalesChanged() ) , mScaleEdit, SLOT( updateScales() ) );
+
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 3253a34..b202b46 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -315,6 +315,7 @@ int main( int argc, char *argv[] )
}
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
{
+ QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, argv[++i] );