__ELIM__V4_2_0_MAPEA-BASE-StyleCategory-Polygon

Base para crear fiddles de mapea 4.2

by SIGC GUADALTEL

HTML

<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/assets/css/mapea.ol.min.css">
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/geosearchbylocation/geosearchbylocation.min.css">
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/wfstcontrols/wfstcontrols.min.css">
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/geosearch/geosearch.min.css">
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/printer/printer.min.css">
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/measurebar/measurebar.min.css">
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/streetview/streetview.min.css">
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/vendor/browser-polyfill.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/js/mapea.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/js/configuration.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/geosearchbylocation/geosearchbylocation.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/wfstcontrols/wfstcontrols.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/geosearch/geosearch.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/printer/printer.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea42/plugins/measurebar/measurebar.ol.min.js"></script>
<div id="mapjs" class="container"></div>
<div id="pruebas" class="container">




      <P>Introduzca el nuevo AttributeName
        <INPUT type="text" name="AttributeName" id="AttributeName"> </P>

      <P>Introduzca la categoria
        <INPUT type="text" name="CategoryStyle" id="CategoryStyle"> </P>


      <P>GetStyleForCategories devolverá el estilo de...

CSS

<style rel="stylesheet">
      html,
      body {
        margin: 0;
        padding: 0;
        height: 100%;
        overflow: hidden;
      }

JavaScript

M.proxy(true);
var mapajs = M.map({
  'container': 'mapjs',
  "controls": ["layerswitcher", "mouse", "scale", "overviewmap", "panzoombar", "scaleline"],
});

let style = new M.style.Polygon({
  fill: {
    color: 'red'
  },
  stroke: {
    color: 'black',
    width: 2
  },

});

let style2 = new M.style.Polygon({
  fill: {
    color: 'yellow'
  },
  stroke: {
    color: 'black',
    width: 2
  },

});

let style3 = new M.style.Polygon({
  fill: {
    color: 'pink'
  },
  stroke: {
    color: 'black',
    width: 2
  },

});




let feature = new M.Feature('feature', {
  "type": "Feature",
  "properties": {
    "styleType": "public"
  },
  "geometry": {
    "type": "Polygon",

    "coordinates": [
      [
        [296961.0613, 4238337.8894],
        [329822.1549, 4054495.9951],
        [279822.1549, 4154495.9951],
      ]
    ]
  }
}, style);

let feature2 = new M.Feature('feature2', {
  "type": "Feature",
  "properties": {
    "styleType": "concertado"
  },
  "geometry": {
    "type": "Polygon",

    "coordinates": [
      [
        [476961.3802, 4190327.0824],
        [439822.1549, 4154495.9951],
        [509448.9020, 4135936.8778],

      ]
    ]
  }
}, style2);

let feature3 = new M.Feature('feature3', {
  "type": "Feature",
  "properties": {
    "styleType": "privado"
  },
  "geometry": {
    "type": "Polygon",

    "coordinates": [
      [
        [349931.1824, 4239373],
        [412710.5852, 4236921.1703],
        [391130.1635, 4173651.3035],

      ]
    ]
  }
}, style3);

let feature5 = new M.Feature('feature5', {
  "type": "Feature",
  "properties": {
    "styleType": "religiosos"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [362192.7844, 4117738.3979],
        [421048.4746, 4117738.3979],
        [397015.7345, 4078501.2712],

      ]
    ]
  }
}, style);

let feature4 = new M.Feature('feature4', {
  "type": "Feature",
  "properties": {
    "styleType": "hibridos"
  },
  "geometry": {
    "type": "Polygon",
   ...