A factory method for creating objects of the correct OpenGIS type.
346569
def parseGeometry(self, geometry):
        

        

        self.coordinates = []
        self.index = []
        self.position = 0
        self.lastX = 0 
        self.lastY = 0
        self.isPoly = False
        self.isPoint = True;
        self.dropped = 0;
        self.first = True
        # Used for exception strings
        self._current_string = geometry
        
        reader = _ExtendedUnPacker(geometry)
                
        # Start the parsing
        self._dispatchNextType(reader)
735346
def create_opengl_object(gl_gen_function, n=1):
    """"""
    handle = gl.GLuint(1)
    gl_gen_function(n, byref(handle))  # Create n Empty Objects
    if n > 1:
        return [handle.value + el for el in range(n)]  # Return list of handle values
    else:
        return handle.value
635037
private static Shape createShape(SHAPE_TYPE shapeType,
                                     GraphicInfo graphicInfo) {
        if (SHAPE_TYPE.Rectangle.equals(shapeType)) {
            // source is rectangle
            return new Rectangle2D.Double(graphicInfo.getX(),
                                          graphicInfo.getY(),
                                          graphicInfo.getWidth(),
                                          graphicInfo.getHeight());
        } else if (SHAPE_TYPE.Rhombus.equals(shapeType)) {
            // source is rhombus
            Path2D.Double rhombus = new Path2D.Double();
            rhombus.moveTo(graphicInfo.getX(),
                           graphicInfo.getY() + graphicInfo.getHeight() / 2);
            rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth() / 2,
                           graphicInfo.getY() + graphicInfo.getHeight());
            rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth(),
                           graphicInfo.getY() + graphicInfo.getHeight() / 2);
            rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth() / 2,
                           graphicInfo.getY());
            rhombus.lineTo(graphicInfo.getX(),
                           graphicInfo.getY() + graphicInfo.getHeight() / 2);
            rhombus.closePath();
            return rhombus;
        } else if (SHAPE_TYPE.Ellipse.equals(shapeType)) {
            // source is ellipse
            return new Ellipse2D.Double(graphicInfo.getX(),
                                        graphicInfo.getY(),
                                        graphicInfo.getWidth(),
                                        graphicInfo.getHeight());
        }
        // unknown source element, just do not correct coordinates
        return null;
    }
690032
private Multimap<Type, Class<?>> filterProducibleClasses(Map<Key<?>, Class<?>> bindings) {
        Multimap<Type, Class<?>> defaultFactoryToBind = ArrayListMultimap.create();
        bindings.entrySet()
                .stream()
                .filter(entry -> isCandidate(entry.getKey()
                        .getTypeLiteral()
                        .getType()))
                .forEach(entry -> defaultFactoryToBind.put(entry.getKey()
                        .getTypeLiteral()
                        .getType(), entry.getValue()));
        return defaultFactoryToBind;
    }
835140
function buildGeom(item, params) {
    var geom = {},
        attr;

    for(var gtype in params.geom) {
      var val = params.geom[gtype];

      // Geometry parameter specified as: {Point: 'coords'}
      if(typeof val === 'string' && item.hasOwnProperty(val)) {
        if(gtype === 'GeoJSON') {
          geom = item[val];
        } else {
          geom.type = gtype;
          geom.coordinates = item[val];
        }
      }

      /* Handle things like:
      Polygon: {
        northeast: ['lat', 'lng'],
        southwest: ['lat', 'lng']
      }
      */
      else if(typeof val === 'object' && !Array.isArray(val)) {
        /*jshint loopfunc: true */
        var points = Object.keys(val).map(function(key){
          var order = val[key];
          var newItem = item[key];
          return buildGeom(newItem, {geom:{ Point: order}});
        });
        geom.type = gtype;
        /*jshint loopfunc: true */
        geom.coordinates = [].concat(points.map(function(p){
          return p.coordinates;
        }));
      }

      // Geometry parameter specified as: {Point: ['lat', 'lng', 'alt']}
      else if(Array.isArray(val) && item.hasOwnProperty(val[0]) && item.hasOwnProperty(val[1]) && item.hasOwnProperty(val[2])){
        geom.type = gtype;
        geom.coordinates = [Number(item[val[1]]), Number(item[val[0]]),  Number(item[val[2]])];
      }

      // Geometry parameter specified as: {Point: ['lat', 'lng']}
      else if(Array.isArray(val) && item.hasOwnProperty(val[0]) && item.hasOwnProperty(val[1])){
        geom.type = gtype;
        geom.coordinates = [Number(item[val[1]]), Number(item[val[0]])];
      }

      // Geometry parameter specified as: {Point: ['container.lat', 'container.lng', 'container.alt']}
      else if(Array.isArray(val) && isNested(val[0]) && isNested(val[1]) && isNested(val[2])){
        var coordinates = [];
        for (var i = 0; i < val.length; i++) {	// i.e. 0 and 1
          var paths = val[i].split('.');
          var itemClone = item;
          for (var j = 0; j < paths.length; j++) {
            if (!itemClone.hasOwnProperty(paths[j])) {
              return false;
            }
            itemClone = itemClone[paths[j]];	// Iterate deeper into the object
          }
          coordinates[i] = itemClone;
        }
        geom.type = gtype;
        geom.coordinates = [Number(coordinates[1]), Number(coordinates[0]), Number(coordinates[2])];
      }

      // Geometry parameter specified as: {Point: ['container.lat', 'container.lng']}
      else if(Array.isArray(val) && isNested(val[0]) && isNested(val[1])){
        var coordinates = [];
        for (var i = 0; i < val.length; i++) {	// i.e. 0 and 1
          var paths = val[i].split('.');
          var itemClone = item;
          for (var j = 0; j < paths.length; j++) {
            if (!itemClone.hasOwnProperty(paths[j])) {
              return false;
            }
            itemClone = itemClone[paths[j]];	// Iterate deeper into the object
          }
          coordinates[i] = itemClone;
        }
        geom.type = gtype;
        geom.coordinates = [Number(coordinates[1]), Number(coordinates[0])];
      }

      // Geometry parameter specified as: {Point: [{coordinates: [lat, lng]}]}
      else if (Array.isArray(val) && val[0].constructor.name === 'Object' && Object.keys(val[0])[0] === 'coordinates'){
        geom.type = gtype;
        geom.coordinates = [Number(item.coordinates[(val[0].coordinates).indexOf('lng')]), Number(item.coordinates[(val[0].coordinates).indexOf('lat')])];
      }
    }

    if(params.doThrows && params.doThrows.invalidGeometry && !GeoJSON.isGeometryValid(geom)){
      throw new InvalidGeometryError(item, params);
    }

    return geom;
  }
1145166
def geo(self):
        """"""
        import geopandas as gpd
        from shapely.geometry.polygon import BaseGeometry
        from shapely.wkt import loads

        gdf = gpd.GeoDataFrame(self)

        first = next(gdf.iterrows())[1].geometry

        if isinstance(first, str):
            # We have a GeoDataframe, but the geometry column is still strings, so
            # it must be converted
            shapes = [ loads(row['geometry']) for i, row in gdf.iterrows()]

        elif not isinstance(first, BaseGeometry):
            # If we are reading a metatab package, the geometry column's type should be
            # 'geometry' which will give the geometry values class type of
            # rowpipe.valuetype.geo.ShapeValue. However, there are other
            # types of objects that have a 'shape' property.

            shapes = [row['geometry'].shape for i, row in gdf.iterrows()]

        else:
            shapes = gdf['geometry']

        gdf['geometry'] = gpd.GeoSeries(shapes)
        gdf.set_geometry('geometry')
        return gdf
1027529
def _mor_to_pobject(self, mo_ref):
        """"""
        kls = classmapper(mo_ref._type)
        new_object = kls(mo_ref, self)
        return new_object
424530
def factory(raw_data, request):
    """"""
    if ATTR_SHADE in raw_data:
        raw_data = raw_data.get(ATTR_SHADE)

    shade_type = raw_data.get(ATTR_TYPE)

    def find_type(shade):
        for tp in shade.shade_types:
            if tp.shade_type == shade_type:
                return shade(raw_data, tp, request)
        return None

    _shade = find_type(ShadeTdbu)
    if _shade:
        return _shade

    _shade = find_type(ShadeBottomUp)
    if _shade:
        return _shade

    _shade = find_type(ShadeBottomUpTilt)
    if _shade:
        return _shade

    _shade = find_type(ShadeBottomUpTiltAnywhere)
    if _shade:
        return _shade

    _shade = find_type(Silhouette)
    if _shade:
        return _shade

    return BaseShade(raw_data, BaseShade.shade_types[0], request)
168733
public static TypeAdapterFactory create() {

    if (geometryTypeFactory == null) {
      geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
        .registerSubtype(GeometryCollection.class, "GeometryCollection")
        .registerSubtype(Point.class, "Point")
        .registerSubtype(MultiPoint.class, "MultiPoint")
        .registerSubtype(LineString.class, "LineString")
        .registerSubtype(MultiLineString.class, "MultiLineString")
        .registerSubtype(Polygon.class, "Polygon")
         .registerSubtype(MultiPolygon.class, "MultiPolygon");
    }
    return geometryTypeFactory;
  }
1274388
function objectFactory(data) {
    // if we are given an object Object, no-op and return it now.
    if (_.isPlainObject(data)) {
        return data;
    }

    // If we are given a byte Buffer, parse it as utf-8
    if (data instanceof Buffer) {
        data = data.toString('utf-8');
    }

    // If we now have a string, then assume it is a JSON string.
    if (_.isString(data)) {
        data = JSON.parse(data);
    }

    else {
        throw new Error(
            'Could not convert data into an object.  ' +
            'Data must be a utf-8 byte buffer or a JSON string'
        );
    }

    return data;
}
60521
private MapController createVertexController(GeometryEditService editService, GeometryIndex index) {
		CompositeGeometryIndexController controller = new CompositeGeometryIndexController(editService, index,
				editService.getEditingState() == GeometryEditState.DRAGGING);
		for (VertexMapHandlerFactory factory : vertexFactories) {
			controller.addMapHandler(factory.create());
		}
		return controller;
	}
504217
def from_geojson(cls, filename):
        """"""
        with open(filename) as fd:
            geometry = json.load(fd)

        if 'type' not in geometry:
            raise TypeError("%s is not a valid geojson." % (filename,))

        return cls(to_shape(geometry), WGS84_CRS)
612290
private void createShape() {
    if (shape == null) {
      float firstItemMargin = noxConfig.getNoxItemMargin();
      float firstItemSize = noxConfig.getNoxItemSize();
      int viewHeight = getMeasuredHeight();
      int viewWidth = getMeasuredWidth();
      int numberOfElements = noxItemCatalog.size();
      ShapeConfig shapeConfig =
          new ShapeConfig(numberOfElements, viewWidth, viewHeight, firstItemSize, firstItemMargin);
      shape = ShapeFactory.getShapeByKey(defaultShapeKey, shapeConfig);
    } else {
      shape.setNumberOfElements(noxItemCatalog.size());
    }
    shape.calculate();
  }
267462
def _factory(slice_, axis, weighted):
        """"""
        if slice_.dim_types[0] == DT.MR_SUBVAR:
            return _MrXCatPairwiseSignificance(slice_, axis, weighted)
        return _CatXCatPairwiseSignificance(slice_, axis, weighted)
139749
def normalize_feature_objects(feature_objs):
    """"""
    for obj in feature_objs:
        if hasattr(obj, "__geo_interface__") and \
           'type' in obj.__geo_interface__.keys() and \
           obj.__geo_interface__['type'] == 'Feature':
            yield obj.__geo_interface__
        elif isinstance(obj, dict) and 'type' in obj and \
                obj['type'] == 'Feature':
            yield obj
        else:
            raise ValueError("Did not recognize object {0}"
                             "as GeoJSON Feature".format(obj))
542622
@ExportInstanceMethod
	public static GeometryIndex create(GeometryIndexService instance, String type, int[] values) {
		if ("geometry".equalsIgnoreCase(type)) {
			return instance.create(GeometryIndexType.TYPE_GEOMETRY, values);
		} else if ("vertex".equalsIgnoreCase(type)) {
			return instance.create(GeometryIndexType.TYPE_VERTEX, values);
		} else if ("edge".equalsIgnoreCase(type)) {
			return instance.create(GeometryIndexType.TYPE_EDGE, values);
		}
		return null;
	}
1150435
public static <K, V> Map<K, V> createMap(Class<?> mapType) {
		return MapUtil.createMap(mapType);
	}