Buscar pacotes, repositórios e categorias de apps

Capa de fluster
Detalhes do pacotev1.2.0

fluster

Uma biblioteca de agrupamento de pontos geoespaciais para Dart, ajudando a fornecer espaçamento entre marcadores em soluções de mapeamento.

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
14,3 mil
Curtidas
134
Pontos Pub
150

Instalar pacote

flutter pub add fluster

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Fluster é uma biblioteca de agrupamento de pontos geoespaciais para Dart, projetada para agrupar e gerenciar eficientemente marcadores em aplicativos de mapas. Ela ajuda a evitar o congestionamento de marcadores dinamicamente agrupando pontos com base no nível de zoom e proximidade espacial. Ideal para otimização de desempenho em mapas com grandes conjuntos de dados, o Fluster garante experiências suaves em múltiplas plataformas. A biblioteca se integra perfeitamente em aplicativos Flutter e oferece suporte a múltiplas plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux.

Casos de uso

  • Visualização de marcadores de mapa em grande escala
  • Rastreamento de localização em tempo real com dados densos
  • Otimização de desempenho em interfaces de mapeamento
  • agrupamento dinâmico com base no nível de zoom
  • Painéis de análise baseados em mapas

Principais recursos

  • Algoritmo eficiente de agrupamento espacial
  • aglomerado adaptativo ao nível de zoom
  • Suporte multiplataforma (Android, iOS, Web, macOS, Windows, Linux)
  • Leve e processamento rápido
  • Integração fácil com widgets de mapa do Flutter

Indicado para

  • Desenvolvedores construindo mapas interativos
  • Aplicativos com dados de localização de alta densidade
  • Serviços baseados em localização que exigem desempenho
  • Desenvolvedores Flutter usando o Google Maps ou plug-ins semelhantes
  • Projetos que precisam de gerenciamento escalonável de marcadores

Considerações

  • Mais adequado para conjuntos de dados estáticos ou semiestáticos
  • Pode exigir ajustes para atualizações de muito alta frequência
  • Limitado ao agrupamento de pontos (não polígonos ou linhas)
  • Depende de entrada de coordenadas precisa
  • Não otimizado para cenários de agrupamento off-line

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

Build Status Pub

Fluster = Flutter + Cluster

A geospatial point clustering library for Dart (Flutter not actually required). The algorithm is a Dart port of supercluster.

Image

Usage

Implement Clusterable

Fluster will cluster a List of objects that conform to the Clusterable abstract class, which includes necessary information such as latitude and longitude:

class MapMarker extends Clusterable {
  String locationName;
  String thumbnailSrc;

  MapMarker(
      {this.locationName,
      latitude,
      longitude,
      this.thumbnailSrc,
      isCluster = false,
      clusterId,
      pointsSize,
      markerId,
      childMarkerId})
      : super(
            latitude: latitude,
            longitude: longitude,
            isCluster: isCluster,
            clusterId: clusterId,
            pointsSize: pointsSize,
            markerId: markerId,
            childMarkerId: childMarkerId);
}
Set up Fluster

Create a Fluster instance once you have a set of points you'd like to cluster:

List<MapMarker> markers = getMarkers();

Fluster<MapMarker> fluster = Fluster<MapMarker>(
      minZoom: 0,
      maxZoom: 20,
      radius: 150,
      extent: 2048,
      nodeSize: 64,
      points: markers,
      createCluster: (BaseCluster cluster, double longitude, double latitude) {
        return MapMarker(
            markerId: cluster.id.toString(),
            latitude: latitude,
            longitude: longitude);
      });

Parameters:

/// Any zoom value below minZoom will not generate clusters.
int minZoom;

/// Any zoom value above maxZoom will not generate clusters.
int maxZoom;

/// Cluster radius in pixels.
int radius;

/// Adjust the extent by powers of 2 (e.g. 512. 1024, ... max 8192) to get the
/// desired distance between markers where they start to cluster.
int extent;

/// The size of the KD-tree leaf node, which affects performance.
int nodeSize;

/// The List to be clustered.
List<T> points;

/// A callback to generate clusters of the given input type.
T Function(BaseCluster, double, double) createCluster;
Get the clusters

You can then get the clusters for a given bounding box and zoom value, where the bounding box = [southwestLng, southwestLat, northeastLng, northeastLat]:

List<MapMarker> clusters = fluster.clusters([-180, -85, 180, 85], _currentZoom);
Get the cluster children

You can also get the children (points and sub-clusters inside a cluster at the next zoom level, given the cluster id:

List<MapMarker> chilren = fluster.children(int clusterId);
Get the cluster points

Get only the child points (not sub-clusters) of a cluster in all the remaining zoom levels, given the cluster id:

List<MapMarker> points = fluster.points(clusterId);

Categorias

Repositório-fonte

Projetos que usam este pacote