Created
October 21, 2019 15:55
-
-
Save oscar9/b8c6d52718ffbb8e9d7a21698df348f5 to your computer and use it in GitHub Desktop.
Change symbol color por a simple legend #gvsig #scripting
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
# encoding: utf-8 | |
import gvsig | |
from gvsig import geom | |
from java.awt import Color | |
def main(*args): | |
# Creating new layer | |
ft = gvsig.createSchema() | |
ft.append("ID", "INTEGER") | |
ft.append("GEOMETRY", "GEOMETRY") | |
ft.get('GEOMETRY').setGeometryType(geom.MULTIPOLYGON,geom.D2) | |
layer = gvsig.createShape(ft, prefixname="testSymbol") | |
store = layer.getFeatureStore() | |
gvsig.currentView().addLayer(layer) | |
# Change legend | |
legend = layer.getLegend() | |
print "legend: ", legend #SingleSymbolLegend por defecto | |
symbol = legend.getDefaultSymbol() | |
print "symbol:", symbol # SimpleFillSymbol en capas de poligonos | |
#Como es un ISimbol podemos.. | |
#symbol.setColor(Color.GREEN) | |
symbol.setColor(Color(200,100,200)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment