<?xml version="1.0" encoding="utf-8" ?>
<odoo>

    <record model="ir.ui.view" id="geo_raster_view_form">
        <field name="name">geoengine.raster.layer.form</field>
        <field name="model">geoengine.raster.layer</field>
        <field name="arch" type="xml">
            <form string="Raster Layer View">
                <sheet>
                    <group string="General" col="4">
                        <field name="name" />
                        <field name="view_id" />
                        <field name="raster_type" />
                        <field name="sequence" />
                        <field name="overlay" />
                        <field name="use_to_edit" />
                        <field
                            name="url"
                            colspan="4"
                            widget="url"
                            attrs="{'required': ['|',('is_wmts', '=', True),('is_wms', '=', True)]}"
                        />
                    </group>
                    <field name="is_wmts" invisible="1" />
                    <group
                        string="WMTS options"
                        attrs="{'invisible': [('is_wmts', '=', False)]}"
                        colspan="4"
                    >
                        <field
                            name="matrix_set"
                            attrs="{'required': [('is_wmts', '=', True)]}"
                        />
                        <field
                            name="format_suffix"
                            attrs="{'required': [('is_wmts', '=', True)]}"
                        />
                        <field name="request_encoding" />
                        <field
                            name="projection"
                            attrs="{'required': [('is_wmts', '=', True)]}"
                        />
                        <field name="units" /> <!-- Not used -->
                        <field
                            name="resolutions"
                            attrs="{'required': [('is_wmts', '=', True)]}"
                        />
                        <field name="max_extent" />
                        <field name="dimensions" />
                        <field name="params" />
                    </group>
                    <field name="is_wms" invisible="1" />
                    <group
                        string="WMS options"
                        attrs="{'invisible': [('is_wms', '=', False)]}"
                        colspan="4"
                    >
                        <field
                            name="params_wms"
                            attrs="{'required': [('is_wms', '=', True)]}"
                        />
                        <field
                            name="server_type"
                            attrs="{'required': [('is_wms', '=', True)]}"
                        />
                    </group>
                    <field name="has_type" invisible="1" />
                    <group
                        string="Layer data"
                        attrs="{'invisible': [('has_type', '=', False)]}"
                        colspan="4"
                    >
                        <field
                            name="type_id"
                            widget="selection"
                            attrs="{'required': [('has_type', '=', True)]}"
                        />
                    </group>
                    <group
                        string="Odoo layer data (Not implemented)"
                        attrs="{'invisible': [('raster_type', '!=', 'odoo')]}"
                        colspan="4"
                    >
                        <field name="field_id" />
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record model="ir.ui.view" id="geo_raster_view_tree">
        <field name="name">geoengine.raster.layer.tree</field>
        <field name="model">geoengine.raster.layer</field>
        <field name="arch" type="xml">
            <tree>
                <field name="name" select="1" />
                <field name="raster_type" select="1" />
                <field name="sequence" />
                <field name="overlay" select="1" />
            </tree>
        </field>
    </record>

    <record id="geo_engine_view_rater_action" model="ir.actions.act_window">
        <field name="name">Raster Layer</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">geoengine.raster.layer</field>
        <field name="view_id" ref="geo_raster_view_tree" />
    </record>

    <menuitem
        name="Raster Layer Management"
        id="geoengine_raster_layer_menu"
        parent="geoengine_base_view_menu"
        action="geo_engine_view_rater_action"
        groups="group_geoengine_admin"
    />

</odoo>
