View gist:ee2e7b43ac20e0df903085f1f99b2234
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************************* | |
* | |
* raylib [core] example - fullscreen toggle | |
* | |
* Welcome to raylib! | |
* | |
* To test examples, just press F6 and execute raylib_compile_execute script | |
* Note that compiled executable is placed in the same folder as .c file | |
* | |
* You can find all basic examples on C:\raylib\raylib\examples folder or |
View costrua_decompress.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import zlib | |
if __name__ == '__main__': | |
if len(sys.argv) != 3: | |
print('USAGE: python costura_decompress.py ' | |
'<IN_FILE> <OUT_FILE>') | |
sys.exit() | |
in_filename = sys.argv[1] | |
out_filename = sys.argv[2] |
View st_extend.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION st_extend ( | |
geom geometry, | |
head_rate double precision, | |
head_constant double precision, | |
tail_rate double precision, | |
tail_constant double precision) | |
RETURNS geometry AS | |
$BODY$ | |
-- Extends a linestring. | |
-- First segment get extended by length * head_rate + head_constant. |
View vispres.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def activate_visibility_preset(preset_name, *, project=None, coll=None): | |
"""Activates a visibility preset by its name. | |
Return a boolean indicating success.""" | |
# https://github.com/qgis/QGIS/blob/f044c95fd8927d86967ce8af3930bdc7523095fa/src/app/qgsmapthemes.cpp#L138 | |
if project is None: | |
project = qgis.core.QgsProject.instance() | |
if coll is None: | |
coll = project.mapThemeCollection() | |
if not coll.hasMapTheme(preset_name): | |
return False |
View gist:e903163d9aa0c706b3b3502ac87232ca
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qgis.utils.iface.mapCanvas().scale() |
View qgis_custom_label_autocentroid.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It is assumed that the layer has both "labelX" and a "labelY" attributes set as real number fields. | |
# Labels / Placement / Data Defined / Coordinate / X: | |
CASE WHEN "labelX" IS NULL THEN toreal(regexp_substr(geom_to_wkt(centroid($geometry)), '(-?\\d+\\.?\\d*) -?\\d+\\.?\\d*')) ELSE "labelX" END | |
# Labels / Placement / Data Defined / Coordinate / Y: | |
CASE WHEN "labelY" IS NULL THEN toreal(regexp_substr(geom_to_wkt(centroid($geometry)), '-?\\d+\\.?\\d* (-?\\d+\\.?\\d*)')) ELSE "labelY" END | |
# Labels / Placement / Data Defined / Alignment / horizontal: | |
'Center' |
View pyqgis_crs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# project | |
project_crs = qgis.utils.iface.mapCanvas().mapRenderer().destinationCrs() | |
qgis.utils.iface.mapCanvas().mapRenderer().setDestinationCrs(new_project_crs) |
View pyqgis_layerfields.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# QgsFields() of QgsVectorLayer() | |
# fields = layer.fields() # from QGIS 1.12+ | |
fields = layer.pendingFields() # and below... | |
# list QgsField() from QgsFields() | |
fieldlist = fields.toList() | |
# list of layer fieldnames | |
[f.name() for f in fieldlist] |
View pyqgis_selectedlayers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iface.legendInterface().selectedLayers() |