Java Code Examples for org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind#GeometryLineString

The following examples show how to use org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind#GeometryLineString . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeoUtils.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
/**
 * Get type based on given dimension (Geography / Geometry) and element name.
 *
 * @param dimension either geography or geometry
 * @param elementName Element of return. Can be one of the following constants 
 *        <ul>
 *           <li>{@link Constants#ELEM_POINT}</li>
 *           <li>{@link Constants#ELEM_MULTIPOINT}</li>
 *           <li>{@link Constants#ELEM_LINESTRING}</li>
 *           <li>{@link Constants#ELEM_MULTILINESTRING}</li> 
 *           <li>{@link Constants#ELEM_POLYGON}</li>
 *           <li>{@link Constants#ELEM_MULTIPOLYGON}</li>
 *           <li>{@link Constants#ELEM_GEOCOLLECTION}</li>
 *        </ul>
 * @return elementName name of type
 */
public static EdmPrimitiveTypeKind getType(final Geospatial.Dimension dimension, final String elementName) {
  EdmPrimitiveTypeKind type = null;

  if (Constants.ELEM_POINT.equals(elementName)) {
    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyPoint
            : EdmPrimitiveTypeKind.GeometryPoint;
  } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyMultiPoint
            : EdmPrimitiveTypeKind.GeometryMultiPoint;
  } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyLineString
            : EdmPrimitiveTypeKind.GeometryLineString;
  } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyMultiLineString
            : EdmPrimitiveTypeKind.GeometryMultiLineString;
  } else if (Constants.ELEM_POLYGON.equals(elementName)) {
    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyPolygon
            : EdmPrimitiveTypeKind.GeometryPolygon;
  } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyMultiPolygon
            : EdmPrimitiveTypeKind.GeometryMultiPolygon;
  } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
      || Constants.ELEM_GEOMEMBERS.equals(elementName)) {

    type = dimension == Geospatial.Dimension.GEOGRAPHY
        ? EdmPrimitiveTypeKind.GeographyCollection
            : EdmPrimitiveTypeKind.GeometryCollection;
  }

  return type;
}
 
Example 2
Source File: LineString.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Override
public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
  return dimension == Dimension.GEOGRAPHY ?
      EdmPrimitiveTypeKind.GeographyLineString :
      EdmPrimitiveTypeKind.GeometryLineString;
}