Пример #1
0
        private IAlgorithm GetClusterAlgorithm()
        {
            IAlgorithm algorithm;

            switch (ClusteredMap.ClusterOptions.Algorithm)
            {
            case ClusterAlgorithm.GridBased:
                algorithm = new GridBasedAlgorithm();
                break;

            case ClusterAlgorithm.VisibleNonHierarchicalDistanceBased:
                algorithm =
                    new NonHierarchicalViewBasedAlgorithm(
                        context.Resources.DisplayMetrics.WidthPixels,
                        context.Resources.DisplayMetrics.HeightPixels);
                break;

            default:
                algorithm =
                    new NonHierarchicalDistanceBasedAlgorithm();
                break;
            }

            return(algorithm);
        }
Пример #2
0
        private void InitClustering()
        {
            var iconGenerator = new DefaultClusterIconGenerator();
            var algorithm     = new NonHierarchicalDistanceBasedAlgorithm();
            var renderer      = new DefaultClusterRenderer(mapView, iconGenerator);

            clusterManager = new ClusterManager(mapView, algorithm, renderer);
        }
Пример #3
0
        protected override void StartMap()
        {
            googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(51.503186, -0.126446), 10));
            clusterManager = new ClusterManager(this, googleMap);
            var algorithm = new NonHierarchicalDistanceBasedAlgorithm();

            clusterManager.Algorithm = algorithm;
            googleMap.SetOnCameraIdleListener(clusterManager);

            try
            {
                ReadJson();
            }
            catch (Exception)
            {
                Toast.MakeText(this, "Problem reading list of markers.", ToastLength.Long).Show();
            }
        }
        private static IClusterAlgorithm GetClusterAlgorithm(ClusteredMap clusteredNewMap)
        {
            IClusterAlgorithm algorithm;

            switch (clusteredNewMap.ClusterOptions.Algorithm)
            {
            case ClusterAlgorithm.GridBased:
                algorithm = new GridBasedClusterAlgorithm();
                break;

            case ClusterAlgorithm.VisibleNonHierarchicalDistanceBased:
                throw new NotSupportedException("VisibleNonHierarchicalDistanceBased is only supported on Android");

            default:
                algorithm = new NonHierarchicalDistanceBasedAlgorithm();
                break;
            }

            return(algorithm);
        }