1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM15
.IEC61970
.Informative
.InfGMLSupport
.GmlSymbol
import GmlSymbol
23 class GmlRasterSymbol(GmlSymbol
):
24 """Describes how to render raster/matrix-coverage data (e.g., satellite photos, DEMs).Describes how to render raster/matrix-coverage data (e.g., satellite photos, DEMs).
27 def __init__(self
, graySourcename
='', greenSourceName
='', opacity
=0.0, reliefFactor
='', redSourcename
='', overlapbehaviour
='', brighnessOnly
=False, blueSourcename
='', GmlDiagramObject
=None, *args
, **kw_args
):
28 """Initialises a new 'GmlRasterSymbol' instance.
30 @param graySourcename: A single colour channel may be selected to display in grayscale. Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
31 @param greenSourceName: Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
32 @param opacity: Specifies the level of translucency to use when rendering the Graphic. The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing completely transparent and 1.0 representing completely opaque, with a linear scale of translucency for intermediate values. The default value is 1.0.
33 @param reliefFactor: The ReliefFactor gives the amount of exaggeration to use for the height of the 'hills'. A value of around 55 (times) gives reasonable results for Earth-based DEMs. The default value is system-dependent.
34 @param redSourcename: Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
35 @param overlapbehaviour: Tells a system how to behave when multiple raster images in a layer overlap each other, for example with satellite-image scenes.
36 @param brighnessOnly: If the BrightnessOnly flag is 0 (false, default), the shading is applied to the layer being rendered as the current RasterSymbol. If BrightnessOnly is 1 (true), the shading is applied to the brightness of the colors in the rendering canvas generated so far by other layers, with the effect of relief-shading these other layers.
37 @param blueSourcename: Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
38 @param GmlDiagramObject:
40 #: A single colour channel may be selected to display in grayscale. Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
41 self
.graySourcename
= graySourcename
43 #: Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
44 self
.greenSourceName
= greenSourceName
46 #: Specifies the level of translucency to use when rendering the Graphic. The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing completely transparent and 1.0 representing completely opaque, with a linear scale of translucency for intermediate values. The default value is 1.0.
47 self
.opacity
= opacity
49 #: The ReliefFactor gives the amount of exaggeration to use for the height of the 'hills'. A value of around 55 (times) gives reasonable results for Earth-based DEMs. The default value is system-dependent.
50 self
.reliefFactor
= reliefFactor
52 #: Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
53 self
.redSourcename
= redSourcename
55 #: Tells a system how to behave when multiple raster images in a layer overlap each other, for example with satellite-image scenes.
56 self
.overlapbehaviour
= overlapbehaviour
58 #: If the BrightnessOnly flag is 0 (false, default), the shading is applied to the layer being rendered as the current RasterSymbol. If BrightnessOnly is 1 (true), the shading is applied to the brightness of the colors in the rendering canvas generated so far by other layers, with the effect of relief-shading these other layers.
59 self
.brighnessOnly
= brighnessOnly
61 #: Colour Channels are identified by a system and data-dependent character identifier. Contrast enhancement may be applied to each channel in isolation.
62 self
.blueSourcename
= blueSourcename
64 self
._GmlDiagramObject
= None
65 self
.GmlDiagramObject
= GmlDiagramObject
67 super(GmlRasterSymbol
, self
).__init
__(*args
, **kw_args
)
69 _attrs
= ["graySourcename", "greenSourceName", "opacity", "reliefFactor", "redSourcename", "overlapbehaviour", "brighnessOnly", "blueSourcename"]
70 _attr_types
= {"graySourcename": str, "greenSourceName": str, "opacity": float, "reliefFactor": str, "redSourcename": str, "overlapbehaviour": str, "brighnessOnly": bool, "blueSourcename": str}
71 _defaults
= {"graySourcename": '', "greenSourceName": '', "opacity": 0.0, "reliefFactor": '', "redSourcename": '', "overlapbehaviour": '', "brighnessOnly": False, "blueSourcename": ''}
73 _refs
= ["GmlDiagramObject"]
76 def getGmlDiagramObject(self
):
78 return self
._GmlDiagramObject
80 def setGmlDiagramObject(self
, value
):
81 if self
._GmlDiagramObject
is not None:
82 filtered
= [x
for x
in self
.GmlDiagramObject
.GmlRasterSymbols
if x
!= self
]
83 self
._GmlDiagramObject
._GmlRasterSymbols
= filtered
85 self
._GmlDiagramObject
= value
86 if self
._GmlDiagramObject
is not None:
87 if self
not in self
._GmlDiagramObject
._GmlRasterSymbols
:
88 self
._GmlDiagramObject
._GmlRasterSymbols
.append(self
)
90 GmlDiagramObject
= property(getGmlDiagramObject
, setGmlDiagramObject
)