CP-075-03
Proportional POL
by SIGC
HTML
<script src="https://sigc.desarrollo.guadaltel.es/mapea5/js/mapea.ol.min.js"></script>
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea5/assets/css/mapea.ol.min.css">
<script src="https://sigc.desarrollo.guadaltel.es/mapea5/js/configuration.js"></script>
<div class="row">
<table id='tableStyle'>
<tr>
<th onclick="ocultarTable('cons')">Constructores</th>
</tr>
<tr>
<td id="cons-td" class="display-hidden">
<button onclick="setStyle(proportional)">Atributo + radios por defecto + estilo por defecto + funcion proporcional por defecto</button>
<button onclick="setStyle(proportional2)">Atributo + radio + estilo por defecto + funcion proporcional por defecto</button>
<button onclick="setStyle(proportional3)">Atributo + radio + estilo simple + funcion proporcional por defecto</button>
<button onclick="setStyle(proportional4)">Atributo + radio + estilo simple con icono + funcion proporcional por defecto</button>
<button onclick="setStyle(proportional5)">Atributo + radio + estilo simple con font symbol + funcion proporcional por defecto</button>
</td>
</tr>
<tr>
<th onclick="ocultarTable('setter')">Setters</th>
</tr>
<tr>
<td id="setter-td" class="display-hidden">
<label>Radio mínimo</label>
<input type="number" min="1" onchange="set(this, 'setMinRadius')" />
<label>Radio máximo</label>
<input type="number" min="1" onchange="set(this, 'setMaxRadius')" />
<button onclick="set(this, 'setStyle')">Set estilo simple</button>
</td>
</tr>
<tr>
<th onclick="ocultarTable('getter')">Getters</th>
</tr>
<tr>
<td id="getter-td" class="display-hidden">
<button onclick="get('getAttributeName')">Get attribute</button>
<button...
CSS
<style rel="stylesheet">
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: auto;
}
#tableStyle {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
table#tableStyle td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
table#tableStyle th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
table#tableStyle tr:nth-child(even) {
background-color: #dddddd;
}
input-group {
margin: 20%;
}
.display-hidden {
display: none;
}
.input-group {
margin-bottom: 1em;
}
button,
input {
display: block;
}
JavaScript
// CP-075-03 - Proportional POL
// ==========================================================================
// =============== Test styleproportional con capa servida ==================
// ==========================================================================
function ocultarTable(elementToManage) {
let element = document.getElementById(elementToManage + "-td");
if (element.classList.contains("display-hidden")) {
element.classList.remove("display-hidden")
}
else {
element.classList.add("display-hidden")
}
}
let mapajs = M.map({
container: "map",
projection: "EPSG:4326*m",
layers: ["OSM"],
center: [
-6.39404296875,
36.99377838872517
],
zoom: 5,
controls: ['layerswitcher', 'overviewmap'],
});
var layer = new M.layer.WFS({
name: "Municipios",
url: "https://clientes.guadaltel.es/desarrollo/geossigc/wfs?",
namespace: "mapea",
name: "da_municipio_pol",
legend: "Municipios - Plantilla Símbolo",
getfeatureinfo: "plain",
geometry: 'POLYGON',
extract: true,
});
mapajs.addLayers([layer]);
let proportional = new M.style.Proportional('gid');
let proportional2 = new M.style.Proportional('gid', 8, 17);
let proportional3 = new M.style.Proportional('gid', 6, 20, new M.style.Point({
fill: {
color: 'black'
},
stroke: {
color: 'white',
width: 2
}
}));
let proportional4 = new M.style.Proportional('gid', 5, 15, new M.style.Point({
icon: {
src: 'https://cdn3.iconfinder.com/data/icons/free-icons-3/128/cat_6.png',
rotation: 0.5,
scale: 0.5,
opacity: 0.8,
anchor: [0.5, 1.9],
rotate: false,
snaptopixel: true,
}
}));
let proportional5 = new M.style.Proportional('gid', 5, 20, new M.style.Point({
icon: {
form: M.style.form.LOZENGE,
gradient: true,
fontsize: 0.8,
radius: 20,
rotation: 0.2,
rotate: false,
offset: [20, 30],
color: 'blue',
fill: '#8A0829',
gradientcolor: '#088A85'
}
}));
function setStyle(style) {
...