Beispiel #1
0
        # QDesktopServices().openUrl(QUrl(fitxerSortida))

        segonsEmprats = round(time.time() - tInicial, 1)
        layersTemporals = project.mapLayersByName("Capa temporal d'impressió")
        for layer in layersTemporals:
            project.removeMapLayer(layer.id())


with qgisapp() as app:
    canvas = QgsMapCanvas()
    project = QgsProject.instance()
    root = project.layerTreeRoot()
    bridge = QgsLayerTreeMapCanvasBridge(root, canvas)
    bridge.setCanvasLayers()
    project.read(projecteInicial)
    llegenda = QvLlegenda(canvas)

    plantillaMapa = 'plantillaColegisA3.qpt'

    posXY = [430036, 4583163]

    layer = llegenda.capaPerNom('COLELEC_PLOT')
    layerSeccions = llegenda.capaPerNom('GSEC_CENS2')

    # layer = LAYER DE COLEGIS
    for feature in layer.getFeatures():
        colegi = feature.attributes()[layer.fields().lookupField('LOCAL')]
        cole = feature.attributes()[layer.fields().lookupField('CODI_COLE')]
        seccions = feature.attributes()[layer.fields().lookupField('SECCIONS')]
        meses = feature.attributes()[layer.fields().lookupField('MESES')]
        x_min = feature.attributes()[layer.fields().lookupField('XMIN')]
Beispiel #2
0
if __name__ == '__main__':
    from qgis.core.contextmanagers import qgisapp
    from moduls.QvCanvas import QvCanvas
    from moduls.QvLlegenda import QvLlegenda
    from moduls.QvDropFiles import QvDropFiles

    gui = True

    with qgisapp(guienabled=gui) as app:
        with open('style.qss') as f:
            app.setStyleSheet(f.read())
        canvas = QvCanvas(llistaBotons=["panning", "zoomIn", "zoomOut"])
        project = QgsProject.instance()
        projecteInicial = './mapesOffline/qVista default map.qgs'
        project.read(projecteInicial)
        root = project.layerTreeRoot()
        bridge = QgsLayerTreeMapCanvasBridge(root, canvas)

        llegenda = QvLlegenda()
        llegenda.show()
        canvas.show()

        def obreGeocod(files):
            for x in files:
                if not x.lower().endswith('.csv'):
                    continue  #Si no és un csv ens el saltem
                carregador = QvCarregaCsv(x, project, llegenda)
                carregador.show()

        dropCanvas = QvDropFiles(canvas, ['.csv'])
        dropCanvas.arxiusPerProcessar.connect(obreGeocod)
Beispiel #3
0
        # QDesktopServices().openUrl(QUrl(fitxerSortida))

        segonsEmprats = round(time.time() - tInicial, 1)
        layersTemporals = project.mapLayersByName("Capa temporal d'impressió")
        for layer in layersTemporals:
            project.removeMapLayer(layer.id())


with qgisapp() as app:
    canvas = QgsMapCanvas()
    project = QgsProject.instance()
    root = project.layerTreeRoot()
    bridge = QgsLayerTreeMapCanvasBridge(root, canvas)
    bridge.setCanvasLayers()
    project.read(projecteInicial)
    llegenda = QvLlegenda(canvas)
    llegenda.show()

    plantillaMapa = 'plantillaColegisA3.qpt'

    posXY = [430036, 4583163]

    layerCentres = llegenda.capaPerNom('CENTRES')
    layerIlles = llegenda.capaPerNom('ILLES')

    # layer = LAYER DE COLEGIS
    # textFiltre = "CODI_CENTRE = '08077101'"
    # print (textFiltre)
    # layerIlles.setSubsetString(textFiltre)
    # layerCentres.setSubsetString(textFiltre)
Beispiel #4
0
        llegenda.menuAccions.append("Opcions de visualització")
        llegenda.accions.afegirAccio("Opcions de visualització",
                                     actPropietatsLayer)

    def propietatsLayer():
        layer = llegenda.currentLayer()
        opcionsVisuals = QvVisualitzacioCapa(layer)
        opcionsVisuals.show()

    actPropietatsLayer = QAction("Opcions de visualització")
    actPropietatsLayer.setStatusTip("Opcions de visualització")
    actPropietatsLayer.triggered.connect(propietatsLayer)

    with qgisapp() as app:

        canvas = QgsMapCanvas()
        project = QgsProject().instance()
        root = project.layerTreeRoot()
        bridge = QgsLayerTreeMapCanvasBridge(root, canvas)

        llegenda = QvLlegenda(canvas)
        llegenda.clicatMenuContexte.connect(menuLlegenda)
        llegenda.show()

        # llegim un projecte de demo
        project.read(projecteInicial)

        #layer = project.instance().mapLayersByName('BCN_Districte_ETRS89_SHP')[0]

        canvas.show()
Beispiel #5
0
    from qgis.core.contextmanagers import qgisapp
    import qgis.PyQt.QtWidgets as qtWdg
    import qgis.gui as qgGui

    from moduls.QvLlegenda import QvLlegenda
    from moduls.QvAtributs import QvAtributs

    with qgisapp(sysexit=False) as app:

        QvApp().carregaIdioma(app, 'ca')

        canv = qgGui.QgsMapCanvas()

        atrib = QvAtributs(canv)

        leyenda = QvLlegenda(canv, atrib)

        leyenda.project.read('D:/qVista/EjemploSimbolos.qgs')

        canv.setWindowTitle('Canvas')
        canv.show()

        leyenda.setWindowTitle('Llegenda')
        leyenda.show()

        # Acciones personalizadas para menú contextual de la leyenda:
        #
        # - Definición de la acción y del metodo asociado
        # - Se añade la acción a la lista de acciones disponibles (llegenda.accions)
        # - Se redefine la lista de acciones que apareceran en el menú (llegenda.menuAccions)
        #   mediante la señal clicatMenuContexte según el tipo de nodo clicado
Beispiel #6
0
from qgis.core import *
from qgis.gui import *
from qgis.core.contextmanagers import qgisapp
from qgis.PyQt.QtCore import *
from qgis.PyQt.QtGui import *
from moduls.QvLlegenda import QvLlegenda
from moduls.QvAtributs import QvAtributs
# from moduls.QvCanvas import QvCanvas

projecteInicial = 'MapesOffline/qVista default map.qgs'

with qgisapp() as app:
    canvas = QgsMapCanvas()
    canvas.show()
    atributos = QvAtributs(canvas)
    proyecto = QgsProject.instance()
    root = proyecto.layerTreeRoot()
    bridge = QgsLayerTreeMapCanvasBridge(root, canvas)
    proyecto.read(projecteInicial)
    leyenda = QvLlegenda(canvas, atributos)
    leyenda.show()
Beispiel #7
0
        # QDesktopServices().openUrl(QUrl(fitxerSortida))

        segonsEmprats = round(time.time() - tInicial, 1)
        layersTemporals = project.mapLayersByName("Capa temporal d'impressió")
        for layer in layersTemporals:
            project.removeMapLayer(layer.id())


with qgisapp() as app:
    canvas = QgsMapCanvas()
    project = QgsProject.instance()
    root = project.layerTreeRoot()
    bridge = QgsLayerTreeMapCanvasBridge(root, canvas)
    bridge.setCanvasLayers()
    project.read(projecteInicial)
    llegenda = QvLlegenda(canvas)

    plantillaMapa = 'MapaEscolar.qpt'

    posXY = [430036, 4583163]

    layer = llegenda.capaPerNom('CENTRES')
    layerSeccions = llegenda.capaPerNom('ILLES')

    # layer = LAYER DE COLEGIS
    for feature in layer.getFeatures():
        colegi = feature.attributes()[layer.fields().lookupField('LOCAL')]
        cole = feature.attributes()[layer.fields().lookupField('CODI_COLE')]
        seccions = feature.attributes()[layer.fields().lookupField('SECCIONS')]
        meses = feature.attributes()[layer.fields().lookupField('MESES')]
        x_min = feature.attributes()[layer.fields().lookupField('XMIN')]
Beispiel #8
0
    import qgis.gui as qgGui
    import qgis.PyQt.QtWidgets as qtWdg

    from qgis.core.contextmanagers import qgisapp
    from moduls.QvApp import QvApp
    from moduls.QvLlegenda import QvLlegenda
    from moduls.QvAtributs import QvAtributs

    with qgisapp(sysexit=False) as app:

        QvApp().carregaIdioma(app, 'ca')

        canvas = qgGui.QgsMapCanvas()
        atribs = QvAtributs(canvas)
        leyenda = QvLlegenda(canvas, atribs)

        leyenda.project.read('D:/qVista/EjemploMapTestMask.qgs')
        leyenda.mask = QvLlegendaMascara(leyenda, leyenda.capaPerNom("Màscara"), 1)
        leyenda.setMinimumSize(400, 500)
        leyenda.move(0, 0)
        leyenda.show()

        canvas.setWindowTitle('Test Mask Labels')
        canvas.setMinimumSize(1300, 900)
        canvas.move(leyenda.width() + 10, 0)
        canvas.show()

        # Acciones de prueba de máscara para etiquetas

        def testLayerLabels():
Beispiel #9
0
if __name__ == "__main__":

    from qgis.core.contextmanagers import qgisapp
    from qgis.gui import QgsMapCanvas
    from moduls.QvLlegenda import QvLlegenda
    from moduls.QvApp import QvApp

    with qgisapp(sysexit=False) as app:

        qApp = QvApp()
        qApp.carregaIdioma(app, 'ca')

        canvas = QgsMapCanvas()

        llegenda = QvLlegenda(canvas)

        # llegenda.escales.fixe()
        # llegenda.escales.fixe([500, 1000, 5000, 10000, 50000])

        path = "D:/qVista/Mapas/Publicacions/Mapa Topogràfic Municipal/Qgs/"
        llegenda.project.read(path + '00 Mapa TM - Situació rr QPKG.qgs')

        print("Lista de Capas:"******"- Nombre: {capa.name()}, Provider: {capa.providerType()}, OK: {capa.isValid()}"
            )

        llegenda.setWindowTitle('Llegenda')
Beispiel #10
0
    from moduls.QvLlegenda import QvLlegenda
    from moduls.QvAtributs import QvAtributs
    from moduls.QvApp import QvApp
    # from configuracioQvista import projecteInicial

    with qgisapp(sysexit=False) as app:

        QvApp().carregaIdioma(app, 'ca')

        canvas = qgGui.QgsMapCanvas()
        canvas.setWindowTitle('Mapa')

        atribs = QvAtributs(canvas)
        atribs.setWindowTitle('Taules')

        leyenda = QvLlegenda(canvas, atribs, editable=False)
        leyenda.project.read('D:/qVista/EjemploMapTestMask.qgs')
        leyenda.setWindowTitle('Llegenda')
        leyenda.move(0, 0)
        leyenda.show()

        canvas.move(leyenda.width(), 0)
        canvas.show()

        # Generación de botoneras de leyenda
        botonera = None
        clases = None

        def modifBoton(boton):
            boton.setFlat(True)