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
Showing
8 changed files
with
160 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,36 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:alt: License | ||
|
||
Geoengine Bing | ||
============== | ||
|
||
This module adds Bing raster support. A Bing API key is required to use this features. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/geospatial/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Kerrim Abdelhamed <kerrim.abdelhamed@mukit.at> | ||
* Mathias Markl <mathias.markl@mukit.at> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
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,4 @@ | ||
# Copyright 2019 MuK IT GmbH - Kerrim Abd El-Hamed | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import geo_view |
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,24 @@ | ||
# Copyright 2019 MuK IT GmbH - Kerrim Abd El-Hamed | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "GeoEngine Bing Raster Support", | ||
"version": "12.0.1.0.0", | ||
"author": "MuK IT,Odoo Community Association (OCA)", | ||
"category": "GeoBI", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"base_geoengine", | ||
], | ||
"contributors": [ | ||
"Kerrim Abdelhamed <kerrim.abdelhamed@mukit.at>", | ||
"Mathias Markl <mathias.markl@mukit.at>", | ||
], | ||
"data": [ | ||
"geo_view/geo_raster_layer_view.xml", | ||
"views/geoengine_bing_view.xml", | ||
], | ||
"installable": True, | ||
"auto_install": False, | ||
"application": False, | ||
} |
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,4 @@ | ||
# Copyright 2019 MuK IT GmbH - Kerrim Abd El-Hamed | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import geo_raster_layer |
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,33 @@ | ||
# Copyright 2019 MuK IT GmbH - Kerrim Abd El-Hamed | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
|
||
from odoo import models, api, fields | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
class GeoengineRasterLayer(models.Model): | ||
|
||
|
||
_inherit = "geoengine.raster.layer" | ||
|
||
raster_type = fields.Selection(selection_add=[('bing', 'Bing')]) | ||
is_bing = fields.Boolean(compute='_compute_is_bing') | ||
|
||
bing_imagery_set = fields.Selection([ | ||
('Road', 'Road'), | ||
('RoadOnDemand', 'Road on demand'), | ||
('Aerial', 'Aerial'), | ||
('AerialWithLabels', 'Aerial with labels'), | ||
('collins Bart', 'Collins Bart'), | ||
('ordnanceSurvey', 'Ordnance Survey') | ||
], string="Imagery Set", default="AerialWithLabels") | ||
|
||
bing_key = fields.Char() | ||
|
||
@api.multi | ||
@api.depends('raster_type') | ||
def _compute_is_bing(self): | ||
for rec in self: | ||
rec.is_bing = rec.raster_type == 'bing' |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<odoo> | ||
|
||
<record id="geo_raster_view_form" model="ir.ui.view"> | ||
<field name="name">geoengine.raster.layer.form</field> | ||
<field name="model">geoengine.raster.layer</field> | ||
<field name="inherit_id" ref="base_geoengine.geo_raster_view_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='is_wmts']" position="after"> | ||
<field name="is_bing" invisible="1"/> | ||
</xpath> | ||
<xpath expr="//field[@name='url']" position="after"> | ||
<field name="bing_key" colspan="4" attrs="{'required': [('is_bing', '=', True)], 'invisible': [('is_bing', '=', False)]}"/> | ||
<field name="bing_imagery_set" colspan="4" attrs="{'required': [('is_bing', '=', True)], 'invisible': [('is_bing', '=', False)]}"/> | ||
</xpath> | ||
<xpath expr="//field[@name='url']" position="attributes"> | ||
<attribute name="attrs">{'required': [('is_wmts', '=', True)], 'invisible': [('is_bing', '=', True)]}</attribute> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
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,25 @@ | ||
odoo.define('geoengine_bing.BackgroundLayers', function (require) { | ||
"use strict"; | ||
|
||
var BackgroundLayers = require('base_geoengine.BackgroundLayers'); | ||
|
||
BackgroundLayers.include({ | ||
handleCustomLayers: function (layer) { | ||
var out = this._super.apply(this, arguments); | ||
if (layer.is_bing) { | ||
var layer_opt = { | ||
title: layer.name, | ||
visible: !layer.overlay, | ||
type: 'base', | ||
source: new ol.source.BingMaps({ | ||
layer: layer.name, | ||
key: layer.bing_key, | ||
imagerySet: layer.bing_imagery_set, | ||
}), | ||
}; | ||
out.push(new ol.layer.Tile(layer_opt)); | ||
} | ||
return out; | ||
}, | ||
}); | ||
}); |
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<odoo> | ||
|
||
<template id="assets_backend" inherit_id="web.assets_backend"> | ||
<xpath expr="//script[last()]" position="after"> | ||
<script type="text/javascript" src="/geoengine_bing/static/src/js/geoengine_common.js" /> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |