This namespace contains definitions of static functions for common CesiumJS operations wih geometries.
- Source:
- mapspace/util/cesium/util.jsdoc
Members
-
<static, constant> GEOMETRY_TO_ENTITY_CONVERTERS :Object.<string, function(ol.geom.Geometry, Mapspace.MaterialDefinition, string, Cesium.Entity=): (Cesium.Entity|Array.<Cesium.Entity>|null)>
-
- Source:
- mapspace/util/cesium/util.js
-
<static, constant> GEOMETRY_TO_PRIMITIVE_CONVERTERS :Object.<string, function(ol.geom.Geometry, Mapspace.MaterialDefinition): Cesium.Primitive>
-
- Source:
- mapspace/util/cesium/util.js
Methods
-
<static> applyHeightRef(coords, heightRef, inverse)
-
Converts an array of Cartesian coords to a new Cartesian coords but with height reference applied.
Parameters:
Name Type Argument Description coordsArray.<Cesium.Cartesian3> Cartesian coords.
heightRefnumber Height reference to apply.
inverseboolean <nullable>
Height reference is removed, not added. By default is false.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Array.<Cesium.Cartesian3>
-
<static> convertCircleToEntity(geom, materialDef, id)
-
Converts a
ol.geom.Circleto aCesium.Entity.Parameters:
Name Type Description geomol.geom.Circle The geometry.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertCircleToPrimitive(geom, material)
-
Converts a
ol.geom.Circleto aCesium.Primitive.Parameters:
Name Type Description geomol.geom.Circle The geometry.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertColor(color)
-
Converts an OpenLayers
colororol.ColorLiketo Cesium.Parameters:
Name Type Description colorol.color | ol.ColorLike OpenLayers color.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Color
-
<static> convertColorInverse(color, asRGBA)
-
Converts a Cesium color (
Cesium.Color) to an OpenLayersol.ColorLikefollowing the patternrba(0-255, 0-255, 0-255, 0-1).Parameters:
Name Type Argument Description colorCesium.Color Cesium color.
asRGBAboolean <nullable>
If return RGBA (true) or RGB (false). By default is true.
ol.ColorLike - Source:
- mapspace/util/cesium/util.js
-
<static> convertCoordinates(coordinates, heightRef)
-
Convert one or several 2D or 3D
Mapspace.CoordinateinEPSG:4326projection to one or severalCesium.Cartesian3.Parameters:
Name Type Argument Description coordinatesMapspace.Coordinate | Array.<Mapspace.Coordinate> Coordinates.
heightRefMapspace.HeightReference <nullable>
Optional point height reference. By default is set as NONE = 0, that means the height is not altered.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Cartesian3 | Array.<Cesium.Cartesian>
-
<static> convertGeometryCollectionToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.GeometryCollectioninEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.GeometryCollection GeometryCollection.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertGeometryCollectionToPrimitive(geom, material)
-
Converts a
ol.geom.GeometryCollectionin aCesium.Primitive.Parameters:
Name Type Description geomol.geom.GeometryCollection GeometryCollection.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertGeometryToEntity(geometry, materialDef, ignoreHoles, id [, projection])
-
Converts a
ol.geom.Geometryto aCesium.Entity. It returns null if geometry is undefined.Parameters:
Name Type Argument Description geometryol.geom.Geometry OpenLayers geometry.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
ignoreHolesboolean If ignore interior rings for Polygon objects. This is because certain formats as Shapefile can give problems reading them.
idstring The unique id for the entity.
projectionol.ProjectionLike <optional>
Optional projection. If not exist then by default the geometry is supposed to be in
EPSG:4326.- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertGeometryToPrimitive(geometry, material, ignoreHoles [, projection])
-
Converts a
ol.geom.Geometryto aCesium.Primitive. It returns null if geometry is undefined.Parameters:
Name Type Argument Description geometryol.geom.Geometry OpenLayers geometry.
materialObject.<string, Object> Material for the output object.
ignoreHolesboolean If ignore interior rings for Polygon objects. This is because certain formats as Shapefile can give problems reading them.
projectionol.ProjectionLike <optional>
Optional projection. If not exist then by default the geometry is supposed to be in EPSG:4326.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertLineStringToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.LineStringinEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.LineString | ol.geom.LinearRing LineString or LinearRing.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertLineStringToPrimitive(geom, material)
-
Converts a
ol.geom.LineStringin aCesium.Primitive.Parameters:
Name Type Description geomol.geom.LineString | ol.geom.LinearRing LineString or LinearRing.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertMultiLineStringToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.MultiLineStringinEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.MultiLineString MultiLineString.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertMultiLineStringToPrimitive(geom, material)
-
Converts a
ol.geom.MultiLineStringin aCesium.Primitive.Parameters:
Name Type Description geomol.geom.MultiLineString MultiLineString.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertMultiPointToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.MultiPointinEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.MultiPoint MultiPoint.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertMultiPointToPrimitive(geom, material)
-
Converts a
ol.geom.MultiPointin aCesium.Primitive.Parameters:
Name Type Description geomol.geom.MultiPoint MultiPoint.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertMultiPolygonToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.MultiPolygoninEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.MultiPolygon MultiPolygon.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertMultiPolygonToPrimitive(geom, material)
-
Converts a
ol.geom.MultiPolygonin aCesium.Primitive.Parameters:
Name Type Description geomol.geom.MultiPolygon MultiPolygon.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertPointToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.PointinEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.Point Point.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertPointToPrimitive(geom, material)
-
Converts a
ol.geom.Pointin EPSG:4326 projection in aCesium.Primitive.Parameters:
Name Type Description geomol.geom.Point Point.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertPolygonToEntity(geom, materialDef, id [, parent])
-
Converts a
ol.geom.PolygoninEPSG:4326projection in aCesium.Entity.Parameters:
Name Type Argument Description geomol.geom.Polygon Polygon.
materialDefMapspace.MaterialDefinition The material definition to apply to the resulting 3D object.
idstring The unique id for the entity.
parentCesium.Entity <optional>
Optional parent for the resulting entity.
- Source:
- mapspace/util/cesium/util.js
Returns:
One or several Cesium entities, or null if the conversion could not be done. When several entities are returned the first is an empty one that should be used as parent for the rest. This is useful for multi-geometries.
- Type
- Cesium.Entity | Array.<Cesium.Entity> | null
-
<static> convertPolygonToOptions(geom, pointHeight)
-
Converts a polygon to an options object used by Cesium. If polygon has no external ring returns null.
Parameters:
Name Type Description geomol.geom.Polygon Polygon.
pointHeightMapspace.PointReference Point height style.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Object
-
<static> convertPolygonToPrimitive(geom, material)
-
Converts a
ol.geom.Polygonin aCesium.Primitive.Parameters:
Name Type Description geomol.geom.Polygon Polygon.
materialObject.<string, Object> Material for the output object.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Primitive
-
<static> convertStyleToMaterialDefinition(style, heightStyle)
-
Converts a
ol.style.Styleto aMapspace.MaterialDefinition.Parameters:
Name Type Argument Description styleol.style.Style OpenLayers style.
heightStyleMapspace.HeightReference <nullable>
Optional point height style. By default is set as NONE = 0, that means the height is not altered.
- Source:
- mapspace/util/cesium/util.js
Returns:
-
<static> coplanarizeCoordinates(coords, coplanarity, ring)
-
Returns a new array of coordinates in
EPSG:4326projection from given ones ensuring that coplanarity constraints are followed in the returned array, stopping the array in the first coordinate that cannot be forced to comply with, excluding it and above from the result.Parameters:
Name Type Description coordsArray.<Mapspace.Coordinate> The input coordinates in
EPSG:4326projection.coplanarityMapspace.CoplanarityType If points must be enforced to be coplanar and what type of coplanarity to enforce. To ignore this use
NONE. To enforce that all points are in a vertical plane, useVERTICAL. In this case the first two coordinates that are not vertically overlapped will be used to define a plane. To enforce that all points are in a horizontal plane, useHORIZONTAL. In this case the first point will define a plane using its height. To enforce any other coplanarity, useANY. In this case the first three not-coincident points will be used to define a plane.ringboolean If the coordinates are a linear ring, so last vertex must be ensured to be the same as first one.
- Source:
- mapspace/util/cesium/util.js
Returns:
A new coordinates but modified, in
EPSG:4326projection.- Type
- Array.<Mapspace.Coordinate>
-
<static> createLabelEntity(coord, label, showLabel)
-
Creates a label entity.
Parameters:
Name Type Description coordMapspace.Coordinate The coordinates for the label in
EPSG:4326.labelstring String with the text in the label.
showLabelboolean If show the label or not.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- Cesium.Entity
-
<static> fromCartesianToMercator(coordinate)
-
Converts coordinate from cartesian to mercator.
Parameters:
Name Type Description coordinateMapspace.Coordinate Cartesian coordinate.
- Source:
- mapspace/util/cesium/util.js
Returns:
Mercator coordinate.
- Type
- Mapspace.Coordinate
-
<static> fromIconTypeToSVG(pointType, fillColor, fillOpacity, outlineColor, outlineOpacity, outlineWidth)
-
Returns a SVG string to be used in a billboard given the icon type.
Parameters:
Name Type Description pointTypeMapspace.PointIconType Icon type.
fillColorol.ColorLike Fill color.
fillOpacitynumber Fill opacity from 0 (transparent) to 1 (opaque).
outlineColorol.ColorLike Outline color.
outlineOpacitynumber Outline opacity from 0 (transparent) to 1 (opaque).
outlineWidthnumber Outline width in pixels.
- Source:
- mapspace/util/cesium/util.js
Returns:
- Type
- string
-
<static> fromMercatorToCartesian(coordinate)
-
Converts coordinate from mercator to cartesian.
Parameters:
Name Type Description coordinateMapspace.Coordinate Mercator coordinate.
- Source:
- mapspace/util/cesium/util.js
Returns:
Cartesian coordinate.
- Type
- Mapspace.Coordinate
-
<static> getMixedMaterialDefinition(matDef, matDef2)
-
Returns a new
Mapspace.MaterialDefinitionthat has colors from matDef2 and the rest of the properties from matDef. This is useful to set a material definition that makes any object as selected or interacted.Parameters:
Name Type Description matDefMapspace.MaterialDefinition Current material definition applied.
matDef2Mapspace.MaterialDefinition Material definition that contains the colors to be used instead of colors from matDef.
- Source:
- mapspace/util/cesium/util.js
Returns:
-
<static> toLocalGeometry(feature, heightRef, localCoords)
-
Returns a new geometry but transformed from Mercator Spheric coordinates to local cartesian coordinates (these are the coordinates that can be drawn in a Cesium viewer).
Parameters:
Name Type Argument Description featureol.Feature Feature with geometry in Mercator Spheric coordinates.
heightRefnumber <nullable>
Optional height reference to apply.
localCoordsArray.<ol.Coordinate> <nullable>
An optional array where store the coordinates of the geometry in local cartesian coordinates.
- Source:
- mapspace/util/cesium/util.js
Returns:
The geometry in local cartesian coordinates.
- Type
- ol.geom.Geometry
-
<static> updateEntity(entity, materialDef, geom)
-
Updates a
Cesium.Entityto use new properties in the given material definition and geometry.Parameters:
Name Type Description entityCesium.Entity The entity to modify.
materialDefMapspace.MaterialDefinition The material definition to apply to the entity.
geomol.geom.Geometry The geometry to apply to the entity.
- Source:
- mapspace/util/cesium/util.js
-
<static> updateFeatureEntities(feature, entities, materialDef, opt_geom)
-
Updates the entities related to a given feature to use the new properties in the given material definition.
Parameters:
Name Type Description featureol.Feature Feature.
entitiesArray.<Cesium.Entity> All the entities available in the layer that contains the feature.
materialDefMapspace.MaterialDefinition The material definition to apply to the entity.
opt_geomol.geom.Geometry Optional geometry to use instead of the geometry in the feature.
- Source:
- mapspace/util/cesium/util.js