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 array
Array.<Object> Array of {Object}
obj
Object Object
Returns:
array result
-
staticcercalia.Util.areaMetricToImperial(area){number}
-
Name Type Description area
number 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_isPolygon
istrue
it returns a circular polygon. Default opt_isPolygon value isfalse
.Name Type Description center
cercalia.LonLat Center.
radius
number Radius in meters.
isPolygon
boolean 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 distance
number Returns:
distanceImp Distance imperial format string.
-
staticcercalia.Util.distanceTo(coordA, coordB)
-
Name Type Description coordA
cercalia.LonLat coordB
cercalia.LonLat Returns:
distance between two cordenates
-
staticcercalia.Util.downloadXmlToFile(strXML, filename)
-
Name Type Description strXML
string XML in string format
filename
string -
staticcercalia.Util.geofencing(polygon, lonLat){boolean}
-
Returns
true
if the coordinate is inside polygon. Polygon must be in WKT format.Name Type Description polygon
string WKT String de un poligono
lonLat
cercalia.LonLat Punto
-
staticcercalia.Util.geometryToWKT(geometry, projectionCode){string}
-
Name Type Description geometry
ol.geom.Geometry Object geometry
ol.Geometry
.projectionCode
string Projection code
-
staticcercalia.Util.getCircleData(feature){cercalia.CircleData}
-
Obtains circle radius and circle center. {center:
cercalia.LonLat
, radius:number
}Name Type Description feature
cercalia.Feature Feature.
Returns:
data Circle data
-
staticcercalia.Util.getClosestLonLatOfFeature(position, feature){cercalia.LonLat}
-
Función para obtener la coordenada más cercana de
cercalia.Feature
respectocercalia.LonLat
. Puede ser una feature del tipoPoint
,LineString
,Polygon
.Name Type Description position
cercalia.LonLat feature
cercalia.Feature Returns:
Coordenada de la feature más cercana.
-
staticcercalia.Util.getDistanceFromFeature(position, feature){number}
-
Obtiene la distancia en metro de una
cercalia.LonLat
respecto el punto más cercano decercalia.Feature
. Puede ser una feature del tipoPoint
,LineString
,Polygon
.Name Type Description position
cercalia.LonLat Coordenada de referencia
feature
cercalia.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 meters
number Returns:
kilometers
-
staticcercalia.Util.positionOfFeature(arrayFeatures, feature){Number}
-
Name Type Description arrayFeatures
Array.<cercalia.Feature, ol.Feature> Array of {cercalia.Feature|ol.Feature}
feature
cercalia.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 wktGeomCollection
Array.<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 hexcolor
string Color in hexadecimal. P.e:
#ff0001
opacity
number Opacity. Decimal value
0
to1
.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 wkt
string WKT http://es.wikipedia.org/wiki/Well_Known_Text
projectionSrc
string Projection WKT origin
projectionDst
string Projection WKT destination
-
staticcercalia.Util.transformWktToKML(wkt, srs){string}
-
Name Type Description wkt
string WKT geometry.
srs
string coords system, default: 'EPSG:4326'
Returns:
KML of wkt
-
staticcercalia.Util.wktToGeometry(wkt){ol.geom.Geometry}
-
Name Type Description wkt
string WKT http://es.wikipedia.org/wiki/Well_Known_Text
Returns:
Geometry OL3ol.geom.Geometry