-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fdiaz
authored and
fdiaz
committed
May 11, 2022
1 parent
bde9fb0
commit d216bb6
Showing
14 changed files
with
446 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.class | ||
.directory |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Script] | ||
enable = true | ||
main = main | ||
Lang = python | ||
|
||
[Unit] | ||
type = Script | ||
name = __init__ | ||
description = | ||
createdBy = | ||
version = | ||
|
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Script] | ||
enable = true | ||
main = main | ||
Lang = python | ||
|
||
[Unit] | ||
type = Script | ||
name = actions | ||
description = | ||
createdBy = | ||
version = | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# encoding: utf-8 | ||
|
||
import gvsig | ||
|
||
import os.path | ||
|
||
from os.path import join, dirname | ||
|
||
from gvsig import currentView | ||
from gvsig import currentLayer | ||
|
||
from java.io import File | ||
|
||
from org.gvsig.app import ApplicationLocator | ||
from org.gvsig.andami import PluginsLocator | ||
from org.gvsig.scripting.app.extension import ScriptingExtension | ||
from org.gvsig.tools.swing.api import ToolsSwingLocator | ||
from org.gvsig.tools import ToolsLocator | ||
from addons.CertificadoCatastralVillaFlorida.certificadoCatastralVillaFloridaPanel import CertificadoCatastralVillaFloridaPanel | ||
|
||
class CertificadoCatastralVillaFloridaExtension(ScriptingExtension): | ||
def __init__(self): | ||
pass | ||
|
||
def canQueryByAction(self): | ||
return True | ||
|
||
def isVisible(self, action): | ||
if currentView()!=None: | ||
return True | ||
return False | ||
|
||
def isLayerValid(self, layer): | ||
return True | ||
|
||
def isEnabled(self, action): | ||
#if not self.isLayerValid(layer): | ||
# return False | ||
if currentView()!=None: | ||
return True | ||
return False | ||
|
||
def execute(self,actionCommand, *args): | ||
actionCommand = actionCommand.lower() | ||
if actionCommand == "settool-CertificadoCatastralVillaFlorida": | ||
certificadoCatastralVillaFlorida = CertificadoCatastralVillaFloridaPanel() | ||
i18n = ToolsLocator.getI18nManager() | ||
certificadoCatastralVillaFlorida.showTool(i18n.getTranslation("_Certificado_Catastral_Villa_Florida")) | ||
|
||
def selfRegisterI18n(): | ||
i18nManager = ToolsLocator.getI18nManager() | ||
i18nManager.addResourceFamily("text",File(gvsig.getResource(__file__,"i18n"))) | ||
|
||
def selfRegister(): | ||
selfRegisterI18n() | ||
i18n = ToolsLocator.getI18nManager() | ||
application = ApplicationLocator.getManager() | ||
actionManager = PluginsLocator.getActionInfoManager() | ||
iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() | ||
|
||
icon = File(gvsig.getResource(__file__,"images","CertificadoCatastral.png")).toURI().toURL() | ||
iconTheme.registerDefault("scripting.CertificadoCatastralVillaFlorida", "action", "tools-CertificadoCatastralVillaFlorida", None, icon) | ||
|
||
CertificadoCatastralVillaFlorida_extension = CertificadoCatastralVillaFloridaExtension() | ||
CertificadoCatastralVillaFlorida_action = actionManager.createAction( | ||
CertificadoCatastralVillaFlorida_extension, | ||
"tools-CertificadoCatastralVillaFlorida", # Action name | ||
"Certificado Catastral Villa Florida", # Text | ||
"settool-CertificadoCatastralVillaFlorida", # Action command | ||
"tools-CertificadoCatastralVillaFlorida", # Icon name | ||
None, # Accelerator | ||
1009000000, # Position | ||
i18n.getTranslation("_Certificado_Catastral_Villa_Florida") # Tooltip | ||
) | ||
CertificadoCatastralVillaFlorida_action = actionManager.registerAction(CertificadoCatastralVillaFlorida_action) | ||
|
||
# Añadimos la entrada "Report by point" en el menu herramientas | ||
application.addMenu(CertificadoCatastralVillaFlorida_action, "tools/"+i18n.getTranslation("_Certificado_Catastral_Villa_Florida")) | ||
# Añadimos el la accion como un boton en la barra de herramientas "Quickinfo". | ||
#application.addSelectableTool(CertificadoCatastralVillaFlorida_action, "CertificadoCatastralVillaFlorida") | ||
application.addTool(CertificadoCatastralVillaFlorida_action, "CertificadoCatastralVillaFlorida") | ||
|
||
def main(*args): | ||
selfRegister() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Script] | ||
enable = true | ||
main = main | ||
Lang = python | ||
|
||
[Unit] | ||
type = Script | ||
name = autorun | ||
description = | ||
createdBy = | ||
version = | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# encoding: utf-8 | ||
|
||
import gvsig | ||
|
||
from addons.CertificadoCatastralVillaFlorida import actions | ||
|
||
def main(*args): | ||
actions.selfRegister() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Script] | ||
enable = true | ||
main = main | ||
Lang = python | ||
|
||
[Unit] | ||
type = Script | ||
name = certificadoCatastralVillaFloridaPanel | ||
description = | ||
createdBy = | ||
version = | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# encoding: utf-8 | ||
|
||
import gvsig | ||
from org.gvsig.tools import ToolsLocator | ||
from java.io import File, FileInputStream | ||
|
||
|
||
class CertificadoCatastralVillaFloridaPanel(FormPanel): | ||
def __init__(self): | ||
FormPanel.__init__(self,getResource(__file__,"certificadoCatastralVillaFloridaPanel.xml")) | ||
i18n = ToolsLocator.getI18nManager() | ||
self.setPreferredSize(320,180) | ||
|
||
def btnGenerarPdf_click(self, event): | ||
layout = self.loadTemplate() | ||
context = layout.getLayoutContext() | ||
feature = None #Coger la feature seleccionada de la vista | ||
# Nos recorremos todos los elementos del mapa buscando los que hemos etiquetado | ||
for elemento in context.getAllFFrames(): | ||
if elemento.getTag() == "Vista": | ||
# Ajustamos el encuadre de la vista al del elemento seleccionado | ||
mapContext = elemento.getMapContext() | ||
mapContext.getViewPort().setEnvelope(encuadre) | ||
mapContext.invalidate() | ||
|
||
elif elemento.getTag() == "Solicitante": | ||
elemento.clearText() | ||
elemento.addText(self.txtSolicitante.getText()) | ||
|
||
elif elemento.getTag() == "atributo": | ||
name = elemento.getText().get(0) | ||
elemento.clearText() | ||
elemento.addText(feature.getString(name)) | ||
|
||
elif elemento.getTag() == "Imagen1":# esto por cada imagen | ||
# Cambiamos la imagen del logotipo | ||
elemento.setImage(self.getImage(1)) | ||
|
||
context.fullRefresh() | ||
|
||
def getImage(self, idx): | ||
#TODO | ||
return None | ||
|
||
def loadTemplate(self): | ||
xmlFile = File(self,getResource(__file__,"plantilla.gvslt")) | ||
inputStream = FileInputStream(xmlFile) | ||
|
||
persistenceManager = ToolsLocator.getPersistenceManager() | ||
persistentState = persistenceManager.loadState(inputStream) | ||
layout = persistenceManager.create(persistentState) | ||
return layout | ||
|
||
|
||
def main(*args): | ||
|
||
#Remove this lines and add here your code | ||
|
||
print "hola mundo" | ||
pass |
Oops, something went wrong.