Calculates the size of a .shp geometry record.
325331
def __recordFmt(self):
        """"""
        if not self.numRecords:
            self.__dbfHeader()
        fmt = ''.join(['%ds' % fieldinfo[2] for fieldinfo in self.fields])
        fmtSize = calcsize(fmt)
        return (fmt, fmtSize)
117788
def size(self):
        
        if self._size is None:
            self._size = sum(s.len for s in self.statements if type(s) is stmt.IMark)
        return self._size
669337
def size(self):
        ''''''
        c = self.database.cursor()
        r = c.execute("SELECT sum(size) FROM files")

        try:
            size = int(r.fetchone()[0])
        except TypeError:
            size = 0

        return size
1341196
def get_flat_size(self):
        
        return sum(
            np.prod(v.get_shape().as_list()) for v in self.variables.values())
84259
def record_padding(self, iso_size):
        # type: (int) -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('This IsoHybrid object is not yet initialized')

        return b'\x00' * self._calc_cc(iso_size)[1]
60121
def length(self):
        """"""
        length = self.parse['attributes'].get('Shape_Length')
        if length:
            return round(float(length))
585860
def calculate_size(name, value, timeout_millis):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += calculate_size_data(value)
    data_size += LONG_SIZE_IN_BYTES
    return data_size
296073
def estimate_size_in_bytes(cls, key, value, headers):
        
        return (
            cls.HEADER_STRUCT.size + cls.MAX_RECORD_OVERHEAD +
            cls.size_of(key, value, headers)
        )
258401
def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
    """"""
    if data_shape is None:
        return None, None
    if image_canvas_mode == "fill":
        data_shape = data_shape
        scale_h = float(data_shape[1]) / canvas_size[1]
        scale_v = float(data_shape[0]) / canvas_size[0]
        if scale_v < scale_h:
            image_canvas_size = (canvas_size[0], canvas_size[0] * data_shape[1] / data_shape[0])
        else:
            image_canvas_size = (canvas_size[1] * data_shape[0] / data_shape[1], canvas_size[1])
        image_canvas_origin = (canvas_size[0] * 0.5 - image_canvas_size[0] * 0.5, canvas_size[1] * 0.5 - image_canvas_size[1] * 0.5)
    elif image_canvas_mode == "fit":
        image_canvas_size = canvas_size
        image_canvas_origin = (0, 0)
    elif image_canvas_mode == "1:1":
        image_canvas_size = data_shape
        image_canvas_origin = (canvas_size[0] * 0.5 - image_canvas_size[0] * 0.5, canvas_size[1] * 0.5 - image_canvas_size[1] * 0.5)
    elif image_canvas_mode == "2:1":
        image_canvas_size = (data_shape[0] * 0.5, data_shape[1] * 0.5)
        image_canvas_origin = (canvas_size[0] * 0.5 - image_canvas_size[0] * 0.5, canvas_size[1] * 0.5 - image_canvas_size[1] * 0.5)
    else:
        image_canvas_size = (canvas_size[0] * image_zoom, canvas_size[1] * image_zoom)
        canvas_rect = Geometry.fit_to_size(((0, 0), image_canvas_size), data_shape)
        image_canvas_origin_y = (canvas_size[0] * 0.5) - image_position[0] * canvas_rect[1][0] - canvas_rect[0][0]
        image_canvas_origin_x = (canvas_size[1] * 0.5) - image_position[1] * canvas_rect[1][1] - canvas_rect[0][1]
        image_canvas_origin = (image_canvas_origin_y, image_canvas_origin_x)
    return image_canvas_origin, image_canvas_size
161446
def measure(self, geometry):
        
        message = 'Size with NaN value : geometry valid={valid}, WKT={wkt}'
        feature_size = 0
        if geometry.isMultipart():
            # Be careful, the size calculator is not working well on a
            # multipart.
            # So we compute the size part per part. See ticket #3812
            for single in geometry.asGeometryCollection():
                if self.geometry_type == QgsWkbTypes.LineGeometry:
                    geometry_size = self.calculator.measureLength(single)
                else:
                    geometry_size = self.calculator.measureArea(single)
                if not isnan(geometry_size):
                    feature_size += geometry_size
                else:
                    LOGGER.debug(message.format(
                        valid=single.isGeosValid(),
                        wkt=single.asWkt()))
        else:
            if self.geometry_type == QgsWkbTypes.LineGeometry:
                geometry_size = self.calculator.measureLength(geometry)
            else:
                geometry_size = self.calculator.measureArea(geometry)
            if not isnan(geometry_size):
                feature_size = geometry_size
            else:
                LOGGER.debug(message.format(
                    valid=geometry.isGeosValid(),
                    wkt=geometry.asWkt()))

        feature_size = round(feature_size)

        if self.output_unit:
            if self.output_unit != self.default_unit:
                feature_size = convert_unit(
                    feature_size, self.default_unit, self.output_unit)

        return feature_size
1117461
def _calcsize(fmt):
    '''
    '''
     # sizeof(long) != sizeof(ssize_t) on LLP64
    if _sizeof_Clong < _sizeof_Cvoidp: # pragma: no coverage
        z = 'P'
    else:
        z = 'L'
    return calcsize(fmt.replace('z', z))
203171
def calculate_size(name, listener_flags, local_only):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += INT_SIZE_IN_BYTES
    data_size += BOOLEAN_SIZE_IN_BYTES
    return data_size
1153687
public int size() {
        switch(getType()) {
            case POINT: return 1;
            case CIRCLE: return 1;
            case BOX: return 2;
            case POLYGON: return coordinates[0].length;
            default: throw new IllegalStateException("Unrecognized type: " + getType());
        }
    }
191362
def get_size(cls):
        
        return sum([getattr(cls, name).length
                    for name in cls.get_fields_names()])
477356
public Geometry geomAt(int offset) throws IOException {

                // need to update position
                buffer.position(offset);

                // record header
                buffer.skip(8);

                // shape record is all little endian
                buffer.order(ByteOrder.LITTLE_ENDIAN);

                // read the type, handlers don't need it
                ShapeType recordType = ShapeType.forID(buffer.getInt());

                // this usually happens if the handler logic is bunk,
                // but bad files could exist as well...
                if (recordType != ShapeType.NULL && recordType != fileShapeType) {
                        throw new IllegalStateException("ShapeType changed illegally from "
                                + fileShapeType + " to " + recordType);
                }

                return handler.read(buffer, recordType);
        }
890327
def record(self, iso_size):
        # type: (int) -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('This IsoHybrid object is not yet initialized')

        outlist = [struct.pack('=32s400sLLLH', self.header, self.mbr, self.rba,
                               0, self.mbr_id, 0)]

        for i in range(1, 5):
            if i == self.part_entry:
                cc, padding_unused = self._calc_cc(iso_size)
                esect = self.geometry_sectors + (((cc - 1) & 0x300) >> 2)
                ecyle = (cc - 1) & 0xff
                psize = cc * self.geometry_heads * self.geometry_sectors - self.part_offset
                outlist.append(struct.pack('=BBBBBBBBLL', 0x80, self.bhead,
                                           self.bsect, self.bcyle, self.ptype,
                                           self.ehead, esect, ecyle,
                                           self.part_offset, psize))
            else:
                outlist.append(b'\x00' * 16)
        outlist.append(b'\x55\xaa')

        return b''.join(outlist)
706024
def calculate_size(name, timeout_millis):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += LONG_SIZE_IN_BYTES
    return data_size