new cercalia.Util()
Methods
-
staticcercalia.Util.addObjectInArray(array, obj){Array.<Object>}
-
add object in array to especific position, and move other objects
Name Type Description arrayArray.<Object> Array of {Object}
objObject Object
Returns:
array result
-
staticcercalia.Util.areaMetricToImperial(area){number}
-
Name Type Description areanumber Area in ha
Returns:
areaImp Area in acrees.
-
staticcercalia.Util.createCircleGeometry(center, radius, opt_isPolygon){ol.geom.Polygon|ol.geom.Circle}
-
Create geometry circle giving a center and radius. If optional parameter
opt_isPolygonistrueit returns a circular polygon. Default opt_isPolygon value isfalse.Name Type Description centercercalia.LonLat Center.
radiusnumber Radius in meters.
isPolygonboolean optional If
true, it creates a circular polygonol.geom.Polygon, else creates a Circleol.geom.Circle. Defaultfalse.Returns:
Obtains Circle geometry or Circular polygon geometry.
-
staticcercalia.Util.distanceMetricToImperial(distance){string}
-
Name Type Description distancenumber Returns:
distanceImp Distance imperial format string.
-
staticcercalia.Util.distanceTo(coordA, coordB)
-
Name Type Description coordAcercalia.LonLat coordBcercalia.LonLat Returns:
distance between two cordenates
-
staticcercalia.Util.downloadXmlToFile(strXML, filename)
-
Name Type Description strXMLstring XML in string format
filenamestring -
staticcercalia.Util.geofencing(polygon, lonLat){boolean}
-
Returns
trueif the coordinate is inside polygon. Polygon must be in WKT format.Name Type Description polygonstring WKT String de un poligono
lonLatcercalia.LonLat Punto
-
staticcercalia.Util.geometryToWKT(geometry, projectionCode){string}
-
Name Type Description geometryol.geom.Geometry Object geometry
ol.Geometry.projectionCodestring Projection code
-
staticcercalia.Util.getCircleData(feature){cercalia.CircleData}
-
Obtains circle radius and circle center. {center:
cercalia.LonLat, radius:number}Name Type Description featurecercalia.Feature Feature.
Returns:
data Circle data
-
staticcercalia.Util.getClosestLonLatOfFeature(position, feature){cercalia.LonLat}
-
Función para obtener la coordenada más cercana de
cercalia.Featurerespectocercalia.LonLat. Puede ser una feature del tipoPoint,LineString,Polygon.Name Type Description positioncercalia.LonLat featurecercalia.Feature Returns:
Coordenada de la feature más cercana.
-
staticcercalia.Util.getDistanceFromFeature(position, feature){number}
-
Obtiene la distancia en metro de una
cercalia.LonLatrespecto el punto más cercano decercalia.Feature. Puede ser una feature del tipoPoint,LineString,Polygon.Name Type Description positioncercalia.LonLat Coordenada de referencia
featurecercalia.Feature Feature. No hace falta que esté pintada en el mapa para hacer este cálculo.
Returns:
Distancia en metros
-
staticcercalia.Util.getOpacityFromRgb(){number}
-
Get opacity from RGB froamt
Returns:
opacity
-
staticcercalia.Util.isIEUnderTen()
-
Returns:
true if browser is IE8 or IE9.
-
staticcercalia.Util.metersToKm(meters){number}
-
Name Type Description metersnumber Returns:
kilometers
-
staticcercalia.Util.positionOfFeature(arrayFeatures, feature){Number}
-
Name Type Description arrayFeaturesArray.<cercalia.Feature, ol.Feature> Array of {cercalia.Feature|ol.Feature}
featurecercalia.Feature | ol.Feature Feature to compare
Returns:
Feature position in array, if array not contains feature return -1
-
staticcercalia.Util.splitWktGeomCollection(wktGeomCollection){Array.<string>}
-
Name Type Description wktGeomCollectionArray.<string> wkt og geomCollection
Returns:
array of wkts in geomcollection
-
staticcercalia.Util.transformColor2rgba(hexcolor, opacity){string}
-
Convierte color y opacidad en formato rgba
Name Type Description hexcolorstring Color in hexadecimal. P.e:
#ff0001opacitynumber Opacity. Decimal value
0to1.Returns:
color p.e:rgba(0, 0, 255, 0.1)
-
staticcercalia.Util.transformWKT(wkt, projectionSrc, projectionDst)
-
Transform WKT string to another projection.
Name Type Description wktstring WKT http://es.wikipedia.org/wiki/Well_Known_Text
projectionSrcstring Projection WKT origin
projectionDststring Projection WKT destination
-
staticcercalia.Util.transformWktToKML(wkt, srs){string}
-
Name Type Description wktstring WKT geometry.
srsstring coords system, default: 'EPSG:4326'
Returns:
KML of wkt
-
staticcercalia.Util.wktToGeometry(wkt){ol.geom.Geometry}
-
Name Type Description wktstring WKT http://es.wikipedia.org/wiki/Well_Known_Text
Returns:
Geometry OL3ol.geom.Geometry