// PolygonFromBytes constructs a Polygon from a GeoJSON byte array
// and returns its pointer
332446
func PolygonFromBytes(bytes []byte) (*Polygon, error) {
	var result Polygon
	err := json.Unmarshal(bytes, &result)
	return &result, err
}
450664
func ConfigModelFromJSONBytes(configBytes []byte) (bitriseData models.BitriseDataModel, warnings []string, err error) {
	if err = json.Unmarshal(configBytes, &bitriseData); err != nil {
		return
	}
	warnings, err = normalizeValidateFillMissingDefaults(&bitriseData)
	if err != nil {
		return
	}

	return
}
1225035
func (p Polygon) Clone() Polygon {
	if p == nil {
		return p
	}

	np := make(Polygon, 0, len(p))
	for _, r := range p {
		np = append(np, r.Clone())
	}

	return np
}
164743
func LineStringFromBytes(bytes []byte) (*LineString, error) {
	var result LineString
	err := json.Unmarshal(bytes, &result)
	return &result, err
}
49888
func MultiPolygon(b orb.Bound, mp orb.MultiPolygon) orb.MultiPolygon {
	var result orb.MultiPolygon
	for _, polygon := range mp {
		p := Polygon(b, polygon)
		if p != nil {
			result = append(result, p)
		}
	}

	return result
}
219331
func GeometryCollectionFromBytes(bytes []byte) (*GeometryCollection, error) {
	var result GeometryCollection
	err := json.Unmarshal(bytes, &result)
	var geometries []interface{}
	for _, curr := range result.Geometries {
		gmap := curr.(map[string]interface{})
		geometry := newGeometry(gmap)
		geometries = append(geometries, geometry)
	}
	result.Geometries = geometries
	return &result, err
}
985619
func Polygon(b orb.Bound, p orb.Polygon) orb.Polygon {
	if len(p) == 0 {
		return nil
	}

	r := Ring(b, p[0])
	if r == nil {
		return nil
	}

	result := orb.Polygon{r}
	for i := 1; i < len(p); i++ {
		r := Ring(b, p[i])
		if r != nil {
			result = append(result, r)
		}
	}

	return result
}
1326614
func (p *parserMixin) HexBytes() (target *[]byte) {
	target = new([]byte)
	p.HexBytesVar(target)
	return
}
241784
func UnJSONBytes(b []byte, v ...interface{}) (interface{}, error) {
	if len(v) == 0 {
		var res interface{}
		err := ffjson.NewDecoder().Decode(b, &res)
		return res, err
	}
	err := ffjson.NewDecoder().Decode(b, &v[0])
	return v[0], err
}
1255799
func StringFromBytes(v []byte) string {
	// In Go 1.3, this string conversion in the map lookup does not allocate
	// to make a new string. We depend on Go 1.3, so this is always free:
	if s, ok := internStr[string(v)]; ok {
		return s
	}
	return string(v)
}
1308558
func deriveClonePolygon(src *Polygon) *Polygon {
	if src == nil {
		return nil
	}
	dst := new(Polygon)
	deriveDeepCopy_7(dst, src)
	return dst
}
725804
func getJsonBytesFromMap(data map[string]interface{}) ([]byte, error) {
	jsonData, err := json.Marshal(data)
	if err != nil {
		fmt.Println("Invalid data object, can't parse to json:")
		fmt.Println("Error:", err)
		fmt.Println("Data:", data)
		return nil, err
	}
	return jsonData, nil
}
1000468
func PolygonColor(renderer *sdl.Renderer, vx, vy []int16, color sdl.Color) bool {
	_len := C.int(min(len(vx), len(vy)))
	if _len == 0 {
		return true
	}
	_vx := (*C.Sint16)(unsafe.Pointer(&vx[0]))
	_vy := (*C.Sint16)(unsafe.Pointer(&vy[0]))
	_color := C.Uint32(gfxColor(color))
	return C.polygonColor((*C.SDL_Renderer)(unsafe.Pointer(renderer)), _vx, _vy, _len, _color) == 0
}
1171924
func (s *VisvalingamSimplifier) MultiPolygon(mp orb.MultiPolygon) orb.MultiPolygon {
	return multiPolygon(s, mp)
}
1179619
func (s *Slice) ReadFrom(r io.Reader) (n int64, err error) {
	const buf_SIZE = 32 * 1024
	buf := make([]byte, buf_SIZE)
	for {
		nRead, err := r.Read(buf)
		if nRead == 0 {
			if err != io.EOF {
				return n, err
			}
			break
		}
		n += int64(nRead)
		*s = append(*s, buf[:nRead]...)
		if err == io.EOF {
			break
		}

		if err != nil {
			return n, err
		}
	}

	return n, nil
}
1138523
func (kf *KunstructuredFactoryImpl) SliceFromBytes(
	in []byte) ([]ifc.Kunstructured, error) {
	decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(in), 1024)
	var result []ifc.Kunstructured
	var err error
	for err == nil || isEmptyYamlError(err) {
		var out unstructured.Unstructured
		err = decoder.Decode(&out)
		if err == nil {
			if len(out.Object) == 0 {
				continue
			}
			err = kf.validate(out)
			if err != nil {
				return nil, err
			}
			result = append(result, &UnstructAdapter{Unstructured: out})
		}
	}
	if err != io.EOF {
		return nil, err
	}
	return result, nil
}
783192
func MultiLineStringFromBytes(bytes []byte) (*MultiLineString, error) {
	var result MultiLineString
	err := json.Unmarshal(bytes, &result)
	return &result, err
}