repr:parentStyle
Diagram
Description
Contained by:
repr:parentStyle
A YMapsML document demonstrating style inheritance.
In this example, the example#style2 style uses styles inherited from the parent style example#style1 for displaying placemark icons (i.e. repr:iconStyle), while the repr:lineStyle tag will not be inherited, because it is defined in the example#style2 style.
The other style tags (repr:iconContentStyle, repr:hintContentStyle and so on) are not defined in the parent style, so they will be assigned the default value.
<?xml version="1.0" encoding="utf-8"?> <ymaps:ymaps xmlns:ymaps="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" xmlns:repr="http://maps.yandex.ru/representation/1.x" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maps.yandex.ru/schemas/ymaps/1.x/ymaps.xsd"> <repr:Representation> <repr:Style gml:id="example#style1"> <repr:iconStyle> <repr:href>http://info.maps.yandex.net/api/i/steelblue/dot.png</repr:href> <repr:size x="26" y="46"/> <repr:offset x="-22" y="-46"/> </repr:iconStyle> <repr:lineStyle> <repr:strokeColor>12345688</repr:strokeColor> <repr:strokeWidth>2</repr:strokeWidth> </repr:lineStyle> </repr:Style> <repr:Style gml:id="example#style2"> <repr:parentStyle>example#style1</repr:parentStyle> <repr:lineStyle> <repr:strokeColor>77382250</repr:strokeColor> <repr:strokeWidth>4</repr:strokeWidth> </repr:lineStyle> </repr:Style> </repr:Representation> </ymaps:ymaps>
Copied to clipboard