使用适用于 iOS 的谷歌地图 SDK 进行标记聚类?

2024-01-15

我在 iOS 应用程序中使用 Google Maps SDK,并且需要对彼此非常接近的标记进行分组 - 基本上需要使用标记聚类,如所附网址中所示。我可以在 Android 地图 SDK 中获得此功能,但我没有找到任何适用于 iOS Google 地图 SDK 的库。

您能为此推荐任何库吗?Or建议一种为此实现自定义库的方法?

(这张照片的)


要了解此双映射解决方案的基本概念,请查看此2011 年全球开发者大会视频 https://developer.apple.com/videos/play/wwdc2011/111/(从 22 点 30 分开始)。除了我在一些注释中描述的一些内容之外,地图套件代码直接从该视频中提取。 Google Map SDK解决方案只是一个改编。

大意:地图被隐藏并保存每个注释,包括合并的注释(allAnnotationMapView在我的代码中)。另一个是可见的,仅显示集群的注释或注释(如果它是单个注释)(我的代码中的mapView)。

第二个主要思想:我将可见地图(加上边距)划分为正方形,并且特定正方形中的每个注释都合并为一个注释。

我用于 Google Maps SDK 的代码(请注意,我在markers属性在 GMSMapView 类上可用。它不再是了,但您可以跟踪您在自己的数组中添加的所有标记,并使用此数组而不是调用 mapView.markers):

- (void)loadView {
    [super loadView];
    self.mapView =  [[GMSMapView alloc] initWithFrame:self.view.frame];
    self.mapView.delegate = self;
    self.allAnnotationMapView = [[GMSMapView alloc] initWithFrame:self.view.frame]; // can't be zero or you'll have weard results (I don't remember exactly why)
    self.view = self.mapView;
    UIPinchGestureRecognizer* pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(didZoom:)];
    [pinchRecognizer setDelegate:self];
    [self.mapView addGestureRecognizer:pinchRecognizer];
}

- (void)didZoom:(UIGestureRecognizer*)gestureRecognizer {
    if (gestureRecognizer.state == UIGestureRecognizerStateEnded){
        [self updateVisibleAnnotations];
    }
}

- (float)distanceFrom:(CGPoint)point1 to:(CGPoint)point2 {
    CGFloat xDist = (point2.x - point1.x);
    CGFloat yDist = (point2.y - point1.y);
    return sqrt((xDist * xDist) + (yDist * yDist));
}

- (NSSet *)annotationsInRect:(CGRect)rect forMapView:(GMSMapView *)mapView {
    GMSProjection *projection = self.mapView.projection; //always take self.mapView because it is the only one zoomed on screen
    CLLocationCoordinate2D southWestCoordinates = [projection coordinateForPoint:CGPointMake(rect.origin.x, rect.origin.y + rect.size.height)];
    CLLocationCoordinate2D northEastCoordinates = [projection coordinateForPoint:CGPointMake(rect.origin.x + rect.size.width, rect.origin.y)];
    NSMutableSet *annotations = [NSMutableSet set];
    for (GMSMarker *marker in mapView.markers) {
        if (marker.position.latitude < southWestCoordinates.latitude || marker.position.latitude >= northEastCoordinates.latitude) {
            continue;
        }
        if (marker.position.longitude < southWestCoordinates.longitude || marker.position.longitude >= northEastCoordinates.longitude) {
            continue;
        }
        [annotations addObject:marker.userData];
    }
    return annotations;
}

- (GMSMarker *)viewForAnnotation:(PointMapItem *)item forMapView:(GMSMapView *)mapView{
    for (GMSMarker *marker in mapView.markers) {
        if (marker.userData == item) {
            return marker;
        }
    }
    return nil;
}

- (void)updateVisibleAnnotations {
    static float marginFactor = 1.0f;
    static float bucketSize = 100.0f;
    CGRect visibleMapRect = self.view.frame;
    CGRect adjustedVisibleMapRect = CGRectInset(visibleMapRect, -marginFactor * visibleMapRect.size.width, -marginFactor * visibleMapRect.size.height);

    double startX = CGRectGetMinX(adjustedVisibleMapRect);
    double startY = CGRectGetMinY(adjustedVisibleMapRect);
    double endX = CGRectGetMaxX(adjustedVisibleMapRect);
    double endY = CGRectGetMaxY(adjustedVisibleMapRect);
    CGRect gridMapRect = CGRectMake(0, 0, bucketSize, bucketSize);
    gridMapRect.origin.y = startY;
    while(CGRectGetMinY(gridMapRect) <= endY) {
        gridMapRect.origin.x = startX;
        while (CGRectGetMinX(gridMapRect) <= endX) {
            NSSet *allAnnotationsInBucket = [self annotationsInRect:gridMapRect forMapView:self.allAnnotationMapView];
            NSSet *visibleAnnotationsInBucket = [self annotationsInRect:gridMapRect forMapView:self.mapView];
            NSMutableSet *filteredAnnotationsInBucket = [[allAnnotationsInBucket objectsPassingTest:^BOOL(id obj, BOOL *stop) {
                BOOL isPointMapItem = [obj isKindOfClass:[PointMapItem class]];
                BOOL shouldBeMerged = NO;
                if (isPointMapItem) {
                    PointMapItem *pointItem = (PointMapItem *)obj;
                    shouldBeMerged = pointItem.shouldBeMerged;
                }
                return shouldBeMerged;
            }] mutableCopy];
            NSSet *notMergedAnnotationsInBucket = [allAnnotationsInBucket objectsPassingTest:^BOOL(id obj, BOOL *stop) {
                BOOL isPointMapItem = [obj isKindOfClass:[PointMapItem class]];
                BOOL shouldBeMerged = NO;
                if (isPointMapItem) {
                    PointMapItem *pointItem = (PointMapItem *)obj;
                    shouldBeMerged = pointItem.shouldBeMerged;
                }
                return isPointMapItem && !shouldBeMerged;
            }];
            for (PointMapItem *item in notMergedAnnotationsInBucket) {
                [self addAnnotation:item inMapView:self.mapView animated:NO];
            }

            if(filteredAnnotationsInBucket.count > 0) {
                PointMapItem *annotationForGrid = (PointMapItem *)[self annotationInGrid:gridMapRect usingAnnotations:filteredAnnotationsInBucket];
                [filteredAnnotationsInBucket removeObject:annotationForGrid];
                annotationForGrid.containedAnnotations = [filteredAnnotationsInBucket allObjects];
                [self removeAnnotation:annotationForGrid inMapView:self.mapView];
                [self addAnnotation:annotationForGrid inMapView:self.mapView animated:NO];
                if (filteredAnnotationsInBucket.count > 0){
                //                    [self.mapView deselectAnnotation:annotationForGrid animated:NO];
                }
                for (PointMapItem *annotation in filteredAnnotationsInBucket) {
                //                    [self.mapView deselectAnnotation:annotation animated:NO];
                    annotation.clusterAnnotation = annotationForGrid;
                    annotation.containedAnnotations = nil;
                    if ([visibleAnnotationsInBucket containsObject:annotation]) {
                        CLLocationCoordinate2D actualCoordinate = annotation.coordinate;
                        [UIView animateWithDuration:0.3 animations:^{
                            annotation.coordinate = annotation.clusterAnnotation.coordinate;
                        } completion:^(BOOL finished) {
                            annotation.coordinate = actualCoordinate;
                            [self removeAnnotation:annotation inMapView:self.mapView];
                        }];
                    }
                }
            }
            gridMapRect.origin.x += bucketSize;
        }
        gridMapRect.origin.y += bucketSize;
    }
}

- (PointMapItem *)annotationInGrid:(CGRect)gridMapRect usingAnnotations:(NSSet *)annotations {
    NSSet *visibleAnnotationsInBucket = [self annotationsInRect:gridMapRect forMapView:self.mapView];
    NSSet *annotationsForGridSet = [annotations objectsPassingTest:^BOOL(id obj, BOOL *stop) {
        BOOL returnValue = ([visibleAnnotationsInBucket containsObject:obj]);
        if (returnValue) {
            *stop = YES;
        }
        return returnValue;
    }];

    if (annotationsForGridSet.count != 0) {
        return [annotationsForGridSet anyObject];
    }

    CGPoint centerMapPoint = CGPointMake(CGRectGetMidX(gridMapRect), CGRectGetMidY(gridMapRect));
    NSArray *sortedAnnotations = [[annotations allObjects] sortedArrayUsingComparator:^(id obj1, id obj2) {
        CGPoint mapPoint1 = [self.mapView.projection pointForCoordinate:((PointMapItem *)obj1).coordinate];
        CGPoint mapPoint2 = [self.mapView.projection pointForCoordinate:((PointMapItem *)obj2).coordinate];

        CLLocationDistance distance1 = [self distanceFrom:mapPoint1 to:centerMapPoint];
        CLLocationDistance distance2 = [self distanceFrom:mapPoint2 to:centerMapPoint];

        if (distance1 < distance2) {
            return NSOrderedAscending;
        }
        else if (distance1 > distance2) {
            return NSOrderedDescending;
        }
        return NSOrderedSame;
    }];
    return [sortedAnnotations objectAtIndex:0];
    return nil;
}


- (void)addAnnotation:(PointMapItem *)item inMapView:(GMSMapView *)mapView {
    [self addAnnotation:item inMapView:mapView animated:YES];
}

- (void)addAnnotation:(PointMapItem *)item inMapView:(GMSMapView *)mapView animated:(BOOL)animated {
    GMSMarker *marker = [[GMSMarker alloc] init];
    GMSMarkerAnimation animation = kGMSMarkerAnimationNone;
    if (animated) {
        animation = kGMSMarkerAnimationPop;
    }
    marker.appearAnimation = animation;
    marker.title = item.title;
    marker.icon = [[AnnotationsViewUtils getInstance] imageForItem:item];
    marker.position = item.coordinate;
    marker.map = mapView;
    marker.userData = item;
    //    item.associatedMarker = marker;
}

- (void)addAnnotations:(NSArray *)items inMapView:(GMSMapView *)mapView {
    [self addAnnotations:items inMapView:mapView animated:YES];
}

- (void)addAnnotations:(NSArray *)items inMapView:(GMSMapView *)mapView animated:(BOOL)animated {
    for (PointMapItem *item in items) {
        [self addAnnotation:item inMapView:mapView];
    }
}

- (void)removeAnnotation:(PointMapItem *)item inMapView:(GMSMapView *)mapView {
    // Try to make that work because it avoid loopigng through all markers each time we just want to delete one...
    // Plus, your associatedMarker property should be weak to avoid memory cycle because userData hold strongly the item
    //    GMSMarker *marker = item.associatedMarker;
    //    marker.map = nil;
    for (GMSMarker *marker in mapView.markers) {
        if (marker.userData == item) {
            marker.map = nil;
        }
    }
}

- (void)removeAnnotations:(NSArray *)items inMapView:(GMSMapView *)mapView {
    for (PointMapItem *item in items) {
        [self removeAnnotation:item inMapView:mapView];
    }
}

一些注意事项:

  • PointMapItem是我的注释数据类(id<MKAnnotation>如果我们使用地图套件)。
  • 这里我使用一个shouldBeMerged属性于PointMapItem因为有一些注释我不想合并。如果您不需要它,请删除正在使用它的部分或设置shouldBeMerged将所有注释设置为“是”。不过,如果您不想合并用户位置,您可能应该保留类测试!
  • 当你想添加注释时,将它们添加到隐藏allAnnotationMapView并打电话updateVisibleAnnotation. updateVisibleAnnotation方法负责选择要合并哪些注释以及要显示哪些注释。然后它会将注释添加到mapView这是可见的。

对于地图套件,我使用以下代码:

- (void)didZoom:(UIGestureRecognizer*)gestureRecognizer {
    if (gestureRecognizer.state == UIGestureRecognizerStateEnded){
        [self updateVisibleAnnotations];
    }
}
- (void)updateVisibleAnnotations {
    static float marginFactor = 2.0f;
    static float bucketSize = 50.0f;
    MKMapRect visibleMapRect = [self.mapView visibleMapRect];
    MKMapRect adjustedVisibleMapRect = MKMapRectInset(visibleMapRect, -marginFactor * visibleMapRect.size.width, -marginFactor * visibleMapRect.size.height);

    CLLocationCoordinate2D leftCoordinate = [self.mapView convertPoint:CGPointZero toCoordinateFromView:self.view];
    CLLocationCoordinate2D rightCoordinate = [self.mapView convertPoint:CGPointMake(bucketSize, 0) toCoordinateFromView:self.view];
    double gridSize = MKMapPointForCoordinate(rightCoordinate).x - MKMapPointForCoordinate(leftCoordinate).x;
    MKMapRect gridMapRect = MKMapRectMake(0, 0, gridSize, gridSize);

    double startX = floor(MKMapRectGetMinX(adjustedVisibleMapRect) / gridSize) * gridSize;
    double startY = floor(MKMapRectGetMinY(adjustedVisibleMapRect) / gridSize) * gridSize;
    double endX = floor(MKMapRectGetMaxX(adjustedVisibleMapRect) / gridSize) * gridSize;
    double endY = floor(MKMapRectGetMaxY(adjustedVisibleMapRect) / gridSize) * gridSize;

    gridMapRect.origin.y = startY;
    while(MKMapRectGetMinY(gridMapRect) <= endY) {
        gridMapRect.origin.x = startX;
        while (MKMapRectGetMinX(gridMapRect) <= endX) {
            NSSet *allAnnotationsInBucket = [self.allAnnotationMapView annotationsInMapRect:gridMapRect];
            NSSet *visibleAnnotationsInBucket = [self.mapView annotationsInMapRect:gridMapRect];

            NSMutableSet *filteredAnnotationsInBucket = [[allAnnotationsInBucket objectsPassingTest:^BOOL(id obj, BOOL *stop) {
                BOOL isPointMapItem = [obj isKindOfClass:[PointMapItem class]];
                BOOL shouldBeMerged = NO;
                if (isPointMapItem) {
                    PointMapItem *pointItem = (PointMapItem *)obj;
                    shouldBeMerged = pointItem.shouldBeMerged;
                }
                return shouldBeMerged;
            }] mutableCopy];
            NSSet *notMergedAnnotationsInBucket = [allAnnotationsInBucket objectsPassingTest:^BOOL(id obj, BOOL *stop) {
                BOOL isPointMapItem = [obj isKindOfClass:[PointMapItem class]];
                BOOL shouldBeMerged = NO;
                if (isPointMapItem) {
                    PointMapItem *pointItem = (PointMapItem *)obj;
                    shouldBeMerged = pointItem.shouldBeMerged;
                }
                return isPointMapItem && !shouldBeMerged;
            }];
            for (PointMapItem *item in notMergedAnnotationsInBucket) {
                [self.mapView addAnnotation:item];
            }

            if(filteredAnnotationsInBucket.count > 0) {
                PointMapItem *annotationForGrid = (PointMapItem *)[self annotationInGrid:gridMapRect usingAnnotations:filteredAnnotationsInBucket];
                [filteredAnnotationsInBucket removeObject:annotationForGrid];
                annotationForGrid.containedAnnotations = [filteredAnnotationsInBucket allObjects];
                [self.mapView addAnnotation:annotationForGrid];
                //force reload of the image because it's not done if annotationForGrid is already present in the bucket!!
                MKAnnotationView* annotationView = [self.mapView viewForAnnotation:annotationForGrid];
                NSString *imageName = [AnnotationsViewUtils imageNameForItem:annotationForGrid selected:NO];
                UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 2, 8, 8)];
                [countLabel setFont:[UIFont fontWithName:POINT_FONT_NAME size:10]];
                [countLabel setTextColor:[UIColor whiteColor]];
                [annotationView addSubview:countLabel];
                imageName = [AnnotationsViewUtils imageNameForItem:annotationForGrid selected:NO];
                annotationView.image = [UIImage imageNamed:imageName];

                if (filteredAnnotationsInBucket.count > 0){
                    [self.mapView deselectAnnotation:annotationForGrid animated:NO];
                }
                for (PointMapItem *annotation in filteredAnnotationsInBucket) {
                    [self.mapView deselectAnnotation:annotation animated:NO];
                    annotation.clusterAnnotation = annotationForGrid;
                    annotation.containedAnnotations = nil;
                    if ([visibleAnnotationsInBucket containsObject:annotation]) {
                        CLLocationCoordinate2D actualCoordinate = annotation.coordinate;
                        [UIView animateWithDuration:0.3 animations:^{
                            annotation.coordinate = annotation.clusterAnnotation.coordinate;
                        } completion:^(BOOL finished) {
                            annotation.coordinate = actualCoordinate;
                            [self.mapView removeAnnotation:annotation];
                        }];
                    }
                }
            }
            gridMapRect.origin.x += gridSize;
        }
        gridMapRect.origin.y += gridSize;
    }
}

- (id<MKAnnotation>)annotationInGrid:(MKMapRect)gridMapRect usingAnnotations:(NSSet *)annotations {
    NSSet *visibleAnnotationsInBucket = [self.mapView annotationsInMapRect:gridMapRect];
    NSSet *annotationsForGridSet = [annotations objectsPassingTest:^BOOL(id obj, BOOL *stop) {
        BOOL returnValue = ([visibleAnnotationsInBucket containsObject:obj]);
        if (returnValue) {
            *stop = YES;
        }
        return returnValue;
    }];

    if (annotationsForGridSet.count != 0) {
        return [annotationsForGridSet anyObject];
    }
    MKMapPoint centerMapPoint = MKMapPointMake(MKMapRectGetMinX(gridMapRect), MKMapRectGetMidY(gridMapRect));
    NSArray *sortedAnnotations = [[annotations allObjects] sortedArrayUsingComparator:^(id obj1, id obj2) {
        MKMapPoint mapPoint1 = MKMapPointForCoordinate(((id<MKAnnotation>)obj1).coordinate);
        MKMapPoint mapPoint2 = MKMapPointForCoordinate(((id<MKAnnotation>)obj2).coordinate);

        CLLocationDistance distance1 = MKMetersBetweenMapPoints(mapPoint1, centerMapPoint);
        CLLocationDistance distance2 = MKMetersBetweenMapPoints(mapPoint2, centerMapPoint);

        if (distance1 < distance2) {
            return NSOrderedAscending;
        }
        else if (distance1 > distance2) {
            return NSOrderedDescending;
        }
        return NSOrderedSame;
    }];
    return [sortedAnnotations objectAtIndex:0];
}

两者都应该可以正常工作,但如果您有任何问题,请随时询问!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用适用于 iOS 的谷歌地图 SDK 进行标记聚类? 的相关文章

  • 导致链接平移并打开地图中的标记

    JSFiddle http jsfiddle net megatimes NVDLf 7 http jsfiddle net megatimes NVDLf 7 我有一张地图 它从数组创建多个标记 地图下方是一些链接 单击这些链接时 我想让
  • 如何在android中的地图触摸位置上动态绘制形状

    我想绘制一个形状 无论用户在哪里触摸地图 都应该动态绘制 我对绘制这些形状没有任何想法 我怎样才能做到这一点 我可以通过画布完成这个工作吗 我正在使用 MapFragment 请看图片 请给我任何想法 任何帮助表示赞赏 您可以通过添加一个来
  • 将 for 循环中的值传递给事件侦听器 - Javascript [重复]

    这个问题在这里已经有答案了 可能的重复 使用 Google Maps API v3 循环遍历标记问题 https stackoverflow com questions 2670356 looping through markers wit
  • 如何使用地点 ID 获得指向 google 地图上某个地点的直接链接

    我的应用程序中有谷歌地图上某个地点的地点 ID 有没有办法将地点 ID 放入 URL 中并使其直接链接到页面 还是必须通过URL来完成 我似乎在文档中找不到任何详细说明这一点的内容 我在下面尝试过 但它只是让我得到标准的谷歌地图页面 htt
  • 当前位置在 Google 地图中不起作用

    我在 swift 3 中集成了谷歌地图 当地图屏幕出现而不显示当前位置时 我在 plist 文件中添加了两个键 并设置了 CLLocationManager delegate 和 requestAlwaysAuthorization cla
  • 如何在 Google Maps API 中指示语言?

    就像你访问一样maps google com tw or maps google co kr or maps google co jp 您可以看到每个国家 地区都显示自己的语言 我可以在 Google 地图 API 中使用任何属性来动态设置
  • Google Map Android API v2 无法在 Play 商店应用程序中显示地图

    我正在与Google Map Android API v2在 Android 应用程序中 它可以很好地与未签名的应用程序在不同的设备上 但是 当我签署 apk 并将应用程序上传到 Play 商店时 下载的应用程序显示白屏而不是地图 您使用什
  • Google 地图上的自定义路线/路径/道路

    我需要能够使用 V2 或 V3 最好是 3 创建在某种意义上忽略建筑物的路径 我试图创建一个 kml 文件来自己绘制所有路径 然后找到某种方法根据需要打开 关闭它们 例如 用户想要从 A 点前往 B 点 这些点之间有许多建筑物 用户可以实际
  • Google 地图第二次无法加载 - AngularJS

    我正在使用 GoogleMap API angular google maps js 包 并且我有一个非常奇怪的行为 The first time I load it i get the full map loaded like here
  • 谷歌地图从邮政编码获取纬度和经度

    是否可以使用 google api 仅传递邮政编码来获取经度和纬度 感谢您的任何提示 再见 只需创建一个实例google maps Geocoder http code google com apis maps documentation
  • Google 地图 InfoBubble PixelOffset(从标记上方的默认位置移动)

    我正在尝试实现一个自定义 infoBubble 它的框打开到标记的侧面 而不是顶部的默认位置 事实证明这比预期的要困难 使用普通的infoWindow 您可以使用pixelOffset 请参阅此处文档 https developers go
  • 谷歌地图url如何定义圆形标记?

    我想打开默认地图应用程序 但我想要一个圆形标记 而不是默认标记 这就是我所拥有的 case Device Android if string IsNullOrEmpty imovel Endereco Freguesia uri new U
  • 谷歌地图颤动检查点是否在多边形内

    我正在使用 google maps flutter 插件开发 flutter 项目 我想检查用户位置是否位于我在地图上创建的多边形内 有一个简单的方法使用 JavaScript api con tainsLocation 方法 但对于 fl
  • 从 DirectionsRenderer 中获取折线或标记的事件

    我正在使用 DirectionsService 和路线方法来生成 DirectionsResult 我还使用 DirectionsRenderer 对象来显示结果 因为它非常易于使用 我在检测 Directions changed 事件时没
  • Android 如何聚焦当前位置

    您好 我有一个 Android 应用程序 可以在谷歌地图上找到您的位置 但是当我启动该应用程序时 它从非洲开始 而不是在我当前的城市 国家 位置等 我已经在developer android com上检查了信息与位置问题有关 但问题仍然存在
  • 如何在 Google 地图 V3 中创建编号地图标记?

    我正在制作一张上面有多个标记的地图 这些标记使用自定义图标 但我还想在顶部添加数字 我已经了解了如何使用旧版本的 API 来实现这一点 我怎样才能在V3中做到这一点 注意 当您将鼠标悬停在标记上时 标题 属性会创建一个工具提示 但我希望即使
  • Google 将自动完成功能放置在 React 组件中

    我正在尝试构建一个谷歌地图组件 谷歌地图 API v3 一切正常 但自动完成功能不行 这是我正在使用的代码 Google 地图组件 import React Component from react import ReactDOM from
  • 由于iOS6中恢复了谷歌地图,MKMapView会在iOS6中自动使用谷歌地图吗?

    由于苹果已经在iOS6中恢复了谷歌地图 如果我使用MKMapView在我的 iPhone 应用程序中 它会自动使用谷歌地图吗 如果您想在应用程序中使用 Google 地图 则应使用适用于 iOS 的 Google 地图 SDK https
  • 控制 OverlayItem 大小

    我正在构建一个在单个 ItemizedOverlay 中包含几十个 OverlayItems 的地图 我的地图设计为可以非常近距离地查看 大约缩放级别 18 并且 OverlayItems 彼此非常接近 地图放大时看起来不错 但是 如果用户
  • 谷歌地图的地址建议

    有人知道是否有任何方法可以重现 ajax 建议框 例如http maps google com http maps google com 我的网页中有使用 google 地图 api 的吗 例如 如果有人写下 15 Avenue 的建议列表

随机推荐

  • 我这里如何使用锁和条件?

    这里我有一个任务 我必须使用锁和条件 在方法 sum 和 randomSwap 中是我必须完成的任务 所以列举了我必须做的事情 首先是没有我编辑的方法中的类和任务 public class LockedDataObject extends
  • Darwin 10.15 上的自修改代码导致“格式错误的 mach-o 图像”?

    我有一个可以生成自修改代码的程序 请参阅https tigress wtf selfModify html https tigress wtf selfModify html如果你有兴趣的话 它在 x86 Darwin 和 Linux 上运
  • Zend 框架和 Couch DB

    Zend Framework 是否具有本机 Couch DB 支持 我只找到了 Matthew Weier O Phinney 的 Zend Couch http framework zend com wiki display ZFPROP
  • 如何使用 Elixir 生成随机 url 安全字符串

    我需要能够生成随机 url 安全字符串 以便我可以在链接中使用这些字符串 例如发送到用户电子邮件的激活链接 那么如何生成它呢 有没有办法只用 Elixir 来做到这一点 或者我必须使用一些库 您可以做的是生成一个 Base64 编码的字符串
  • 在.NET Core应用程序中可靠地终止通过cmd进程启动的node.js进程

    我想解决什么问题 为了改进我的构建管道 我想添加端到端测试步骤 我计划通过 CLI 工具 NET 控制台应用程序 来实现它 该工具将启动并编排一些npm node命令 进程 更具体地说 将会有 后端流程 前端流程 和一个测试过程 当测试过程
  • java.lang.ClassCastException: someClass 与 someClass 不兼容的含义

    我在 XPage 应用程序中偶尔遇到异常 java lang ClassCastException someClass incompatible with someClass 两个提到的类是相同的 都是用作会话bean的类 我无法用谷歌搜索
  • 如何为 M1 和 Intel 构建 openssl?

    我有一个需要使用 Libcrypto 的项目 我有两个版本的 Libcrypto 为 ARM64 构建的 libcrypto a 来自 OpenSSL 1 1 1 和 针对 Intel 的 lcrypto a 来自 OpenSSL 1 0
  • 修改控制器代码后出现“NameError,未初始化常量”错误

    我最近能够通过将所有内容分组到文件夹中来组织我的代码 我遇到了一个问题 即我的两个控制器组在以下情况下具有相同的 组名称 app 目录和我的模块下lib 目录 但我能够通过以下方式修复 Rails 库模块和一组控制器同名吗 https st
  • 如何在 yii2 中使用复选框删除多行

    如何在 GridView 中使用删除选定的对象 在 Yii 2 Framework 中如下图所示 在此输入图像描述 2 尝试这个
  • 为什么叫BSON?

    那么 BSON 是 JSON 序列化的吗 hello world x16 x00 x00 x00 x02hello x00 x06 x00 x00 x00world x00 x00 但为什么叫Binary Json呢 二进制代表什么 我总是
  • 如何使 echo 解释反斜杠转义而不打印尾随换行符?

    我想用echo在 bash 中打印出一串字符 后跟一个回车符 我浏览了手册页并发现echo e将使echo解释反斜杠转义字符 用它我可以说echo e hello r 它会像这样打印 gt echo e hello r hello gt 所
  • 当键与多个值关联时,在Python中查找值的键

    对于该类型的字典 key1 v1 v2 v3 key2 v2 v4 How do I 查找与值 v 关联的任何键 将 k value set 对打印到新字典中 answer to 1st question keys with value k
  • 将bean注入GraphQL的DataFetcher

    我在用着Spring graphql java graphql java 注释 在我的项目中 为了检索数据部分 我使用 DataFetcher 从服务 从数据库 获取数据 奇怪的是 myService总是null 有人知道原因吗 数据获取器
  • data.table 不计算 NA 组

    这个问题有部分答案here https stackoverflow com questions 47444012 skip na in data table by但问题太具体了 我无法将其应用于我自己的问题 我想在使用时跳过 NA 组的潜在
  • PMD 与 Maven - 如何禁用规则集中的一条规则?

    我通过 Maven 2 运行 PMD 现在我已经准备好所有规则集来查看生成的内容 请参见下面的代码 我正在经历并修复对我来说有意义的事情 但是 在某些情况下 例如在 优化 规则集中 我想保留规则集 但是仅禁用规则集中的规则之一 就我而言 我
  • Redis 安装问题“cc:找不到命令”

    安装redis非常简单 我已经在几个虚拟机上完成了 但在一个例子中 我面临以下问题 root server redis 2 4 2 make cd src make all make 1 Entering directory home us
  • WPF 应用程序中后台工作人员中的图像

    我有以下代码片段 用于创建列表以作为 WPF 应用程序中的绑定添加到滚动查看器 private void LoadThumbs object sender DoWorkEventArgs e ClearScreen int max int
  • Google Maps Android API V2 检查设备上是否安装了 GoogleMaps

    使用 Google Maps Android API V2 时 我遵循Google Play 服务设置文档 https developer android com google play services setup html要进行检查以确
  • 如何在Android中创建半透明的指令页面?

    我是 Android 新手 过去 2 天一直在尝试解决这个问题 但可以找到解决方案 任何帮助将不胜感激 如何创建一个半透明的页面作为Android Market中卡路里计数器应用程序使用的说明页面 创建一个新的 Activity 并将顶级视
  • 使用适用于 iOS 的谷歌地图 SDK 进行标记聚类?

    我在 iOS 应用程序中使用 Google Maps SDK 并且需要对彼此非常接近的标记进行分组 基本上需要使用标记聚类 如所附网址中所示 我可以在 Android 地图 SDK 中获得此功能 但我没有找到任何适用于 iOS Google