iOS 蓝牙开发实现文件传输

article/2025/10/15 14:42:29

  这是一篇旧文,三年前就写过了,一直没有时间分享出来,最近简单整理了下,希望能帮到有需要的人。
  由于我这里没有相关的蓝牙设备,主要用了两个手机,一个作为主设备,一个做为从设备。另外进行蓝牙开发有一个调试利器。
在这里插入图片描述
主设备和从设备我分别创建了一个管理类。
主设备主要进行的操作如下:

  • 开始扫描设备
  • 停止扫描设备
  • 连接设备
  • 断开连接设备
  • 发送数据

具体源码如下:

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>NS_ASSUME_NONNULL_BEGIN@interface JKBlueToothCenterHelper : NSObject
/// 设备管理者状态block
@property (nonatomic, copy) void(^btStatusBlock)(NSInteger status,NSString *message);
/// 设备连接状态的block
@property (nonatomic, copy) void(^btConnectStatusBlock)(CBPeripheral *peripheral, NSError * _Nullable error);
/// 断开链接block
@property (nonatomic, copy) void(^btDisconnectStatusBlock)(CBPeripheral *peripheral, NSError * _Nullable error);
/// 扫描到的设备列表block
@property (nonatomic,copy) void(^btScanDevicesBlock)(NSMutableArray <CBPeripheral *>*devices);/// 接收到数据的block
@property (nonatomic,copy) void(^receivedDataBlock)(NSData *data, NSError *error);/**开始扫描设备@param services 扫描的服务@param options 扫描的选项配置@param containDefaultService 是否包含默认的服务@return JKBlueToothCenterHelper 对象*/
- (instancetype)initWithScanServices:(nullable NSArray<CBUUID *> *)services options:(nullable NSDictionary <NSString *, id> *)options containDefaultService:(BOOL)containDefaultService;/**
扫描设备*/
- (void)scanDevice;/**停止扫描设备*/
- (void)stopScanDevice;/**连接设备@param peripheral 设备@param options 配置信息*/
- (void)connectToDevice:(CBPeripheral *)peripheral options:(NSDictionary <NSString *, id> *)options;/**断开连接设备@param peripheral 设备*/
- (void)disconnectToDevice:(CBPeripheral *)peripheral;/**设备管理者向设备发送数据@param data 二进制数据@param peripheral 接受数据的设备@param CBCharacteristic 特征@param type 请求类型*/
- (void)sendData:(NSData *)data toPeripheral:(CBPeripheral *)peripheral forCharacteristic:(CBCharacteristic *)CBCharacteristic type:(CBCharacteristicWriteType)type complete:(void(^)(NSError *error))completeBlock;@endNS_ASSUME_NONNULL_END
typedef void(^JKBTCenterSendCompleteBlock)(NSError *error);@interface JKBlueToothCenterHelper()<CBCentralManagerDelegate,CBPeripheralDelegate>@property (nonatomic, strong) CBCentralManager  *centerManager; ///< 管理者
@property (nonatomic, strong) NSMutableArray *scanServices;            ///< 扫描的服务
@property (nonatomic, strong) NSDictionary <NSString *, id>      *scanOptions; ///< 扫描的配置
@property (nonatomic,strong) NSMutableArray *scannedDevices; ///< s扫描到的设备
@property (strong , nonatomic) CBPeripheral * discoveredPeripheral;//周边设备
@property (nonatomic,copy) JKBTCenterSendCompleteBlock sendCompleteBlock;@end@implementation JKBlueToothCenterHelper
- (instancetype)initWithScanServices:(nullable NSArray<CBUUID *> *)services options:(nullable NSDictionary <NSString *, id> *)options containDefaultService:(BOOL)containDefaultService{self = [super init];if (self) {[self.scanServices addObjectsFromArray:services];if (containDefaultService) {[self setupDefalutScanService];}self.scanOptions = options;[self centerManager];}return self;
}- (void)setupDefalutScanService{CBUUID *uuid = [CBUUID UUIDWithString:DEFAULT_SERVICE_UUID];[self.scanServices addObject:uuid];}- (void)scanDevice{[self.scannedDevices removeAllObjects];[self.centerManager scanForPeripheralsWithServices:self.scanServices options:self.scanOptions];
}- (void)stopScanDevice{[self.centerManager stopScan];
}- (void)connectToDevice:(CBPeripheral *)peripheral options:(NSDictionary <NSString *, id> *)options{self.discoveredPeripheral = peripheral;self.discoveredPeripheral.delegate = self;[self.centerManager connectPeripheral:peripheral options:options];
}- (void)disconnectToDevice:(CBPeripheral *)peripheral{[self.centerManager cancelPeripheralConnection:peripheral];
}- (void)sendData:(NSData *)data toPeripheral:(CBPeripheral *)peripheral forCharacteristic:(CBCharacteristic *)CBCharacteristic type:(CBCharacteristicWriteType)type complete:(void(^)(NSError *error))completeBlock{self.sendCompleteBlock = completeBlock;[peripheral writeValue:data forCharacteristic:CBCharacteristic type:type];
}#pragma mark - - - - CBCentralManagerDelegate - - - -
- (void)centralManagerDidUpdateState:(CBCentralManager *)central{if (@available(iOS 10.0, *)) {switch (central.state) {case CBManagerStatePoweredOn://蓝牙打开{[self.centerManager scanForPeripheralsWithServices:self.scanServices options:self.scanOptions];}break;case CBManagerStatePoweredOff://蓝牙关闭了{if (self.btStatusBlock) {self.btStatusBlock(CBManagerStatePoweredOff, @"蓝牙已关闭,请打开蓝牙");}}break;case CBManagerStateUnsupported://不支持{if (self.btStatusBlock) {self.btStatusBlock(CBManagerStatePoweredOff, @"蓝牙设备不支持!");}}break;default:break;}} else {// Fallback on earlier versionsswitch (central.state) {case 5://蓝牙打开{[self.centerManager scanForPeripheralsWithServices:self.scanServices options:self.scanOptions];}break;case 4://蓝牙关闭了{if (self.btStatusBlock) {self.btStatusBlock(4, @"蓝牙已关闭,请打开蓝牙");}}break;case 2://不支持{if (self.btStatusBlock) {self.btStatusBlock(2, @"蓝牙设备不支持!");}}break;default:break;}}}- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary<NSString *,id> *)advertisementData RSSI:(NSNumber *)RSSI{if (!peripheral) {return;}[peripheral discoverServices:self.scanServices];if (![self.scannedDevices containsObject:peripheral]) {[self.scannedDevices addObject:peripheral];if (self.btScanDevicesBlock) {self.btScanDevicesBlock(self.scannedDevices);}}}- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(nonnull CBPeripheral *)peripheral error:(nullable NSError *)error{if (self.btConnectStatusBlock) {self.btConnectStatusBlock(peripheral, error);}
}- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral{if (@available(iOS 9.0, *)) {if (self.centerManager.isScanning) {[self stopScanDevice];}} else {// Fallback on earlier versions[self stopScanDevice];}self.discoveredPeripheral = peripheral;[peripheral setDelegate:self];[peripheral discoverServices:nil];if (self.btConnectStatusBlock) {self.btConnectStatusBlock(peripheral, nil);}
}- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(nonnull CBPeripheral *)peripheral error:(nullable NSError *)error{if (self.btDisconnectStatusBlock) {self.btDisconnectStatusBlock(peripheral, error);}
}//- (void)centralManager:(CBCentralManager *)central willRestoreState:(NSDictionary<NSString *, id> *)dict{
//    
//}#pragma mark - - - - CBPeripheralDelegate - - - -
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(nullable NSError *)error{peripheral.delegate = self;NSArray *services = peripheral.services;for (CBService *service in services) {[peripheral discoverCharacteristics:nil forService:service];}
}- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(nullable NSError *)error{for (CBCharacteristic *characteristic in service.characteristics) {if ([[NSString stringWithFormat:@"%@",characteristic.UUID] isEqualToString: DEFAULT_CHARACTERISTIC_UUID]) {[self.discoveredPeripheral setNotifyValue:YES forCharacteristic:characteristic];}}}// 写入成功
- (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(nullable NSError *)error {if (self.sendCompleteBlock) {self.sendCompleteBlock(error);}
}-(void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {if (error) {//NSLog(@"订阅失败");//NSLog(@"%@",error);}if (characteristic.isNotifying) {//NSLog(@"订阅成功");} else {//NSLog(@"取消订阅");}
}- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error{[peripheral readValueForCharacteristic:characteristic];NSData *data = characteristic.value;if (self.receivedDataBlock) {self.receivedDataBlock(data,error);}
}#pragma mark - - - - lazyLoad - - - -
- (CBCentralManager *)centerManager{if (!_centerManager) {dispatch_queue_t queue = dispatch_queue_create("com.btCenterManager.queue", 0);CBCentralManager *centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:queue options:nil];centralManager.delegate = self;_centerManager = centralManager;}return _centerManager;
}- (NSMutableArray *)scannedDevices{if (!_scannedDevices) {_scannedDevices = [NSMutableArray new];}return _scannedDevices;
}- (NSMutableArray *)scanServices{if (!_scanServices) {_scanServices = [NSMutableArray new];}return _scanServices;
}@end

从设备进行的操作如下:

  • 添加服务
  • 开始广播
  • 停止广播
  • 发送数据
    具体源码如下:
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>typedef void(^JKBTPeripheralStatusBlock)(NSInteger status,NSString *message);
typedef void(^JKBTPeripheralRecievedDataBlock)(NSData *data,NSError *error);@interface JKBlueToothPeripheralHelper : NSObject@property (nonatomic,copy) JKBTPeripheralStatusBlock btStatusBlock;///< 蓝牙状态的block
@property (nonatomic,copy) JKBTPeripheralRecievedDataBlock receivedDataBlock;/**初始化JKBlueToothPeripheralHelper 对象@param services 提供的服务数组@param adContent 广播内容*/
- (void)addServices:(NSArray <CBMutableService *>*)services adContent:(NSDictionary *)adContent;/**添加默认的服务*/
- (void)addDefaultService;/**开始广播*/
- (void)startAdvertising;/**停止广播*/
- (void)stopAdvertising;/**
发送数据到设备管理器@param data 二进制数据@param centerDevices 主设备@param characteristic 特征*/
- (void)sendData:(NSData *)data toCenterManagers:(NSArray <CBCentral*>*)centerDevices forCharacteristic:(CBMutableCharacteristic *)characteristic;@end
#import "JKBlueToothPeripheralHelper.h"
#import <CoreBluetooth/CoreBluetooth.h>
#import <UIKit/UIKit.h>
#import "JKBlueToothMacro.h"
@interface JKBlueToothPeripheralHelper()<CBPeripheralManagerDelegate>
@property (nonatomic,strong)CBPeripheralManager *peripheralManager;
@property (nonatomic,strong) NSDictionary *adContent;        ///< 广播内容
@property (nonatomic,strong) CBMutableService *defaultService; ///< 默认提供的服务
@property (nonatomic,strong) CBMutableCharacteristic *defaultCharacteristic; ///< 默认具有的特征
@property (nonatomic,strong) NSMutableArray <CBMutableService *>*services;
@property (nonatomic,strong) NSMutableArray <CBCentral *>*centrals;
@end@implementation JKBlueToothPeripheralHelper- (void)addServices:(NSArray <CBMutableService *>*)services adContent:(NSDictionary *)adContent{if (!self.peripheralManager) {dispatch_queue_t queue = dispatch_queue_create("com.btPeripheralManager.queue", 0);self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:queue];}if (services.count>0) {[self.services addObjectsFromArray:services];}self.adContent = adContent;}- (void)addDefaultService{CBUUID *serviceID = [CBUUID UUIDWithString:DEFAULT_SERVICE_UUID];CBMutableService *service = [[CBMutableService alloc] initWithType:serviceID primary:YES];// 创建服务中的特征CBUUID *characteristicID = [CBUUID UUIDWithString:DEFAULT_CHARACTERISTIC_UUID];CBMutableCharacteristic *characteristic = [[CBMutableCharacteristic alloc]initWithType:characteristicIDproperties:CBCharacteristicPropertyRead |CBCharacteristicPropertyWrite |CBCharacteristicPropertyNotifyvalue:nilpermissions:CBAttributePermissionsReadable |CBAttributePermissionsWriteable];// 特征添加进服务[JKBlueToothModule service:service addCharacteristic:characteristic];self.defaultCharacteristic = characteristic;self.defaultService = service;[self.services addObject:self.defaultService];
}- (void)startAdvertising{[self.peripheralManager startAdvertising:self.adContent];
}- (void)stopAdvertising{[self.peripheralManager stopAdvertising];
}- (void)sendData:(NSData *)data toCenterManagers:(NSArray <CBCentral*>*)centerDevices forCharacteristic:(CBMutableCharacteristic *)characteristic{characteristic = characteristic?:self.defaultCharacteristic;if (!centerDevices || centerDevices.count == 0) {centerDevices = self.centrals;}[self.peripheralManager updateValue:data forCharacteristic:characteristic onSubscribedCentrals:centerDevices];
}#pragma mark - - - - CBPeripheralManagerDelegate - - - -
- (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral{if (@available(iOS 10.0, *)) {switch (peripheral.state) {case CBManagerStatePoweredOn://蓝牙打开{for (CBMutableService *service in self.services) {[self.peripheralManager addService:service];}[self startAdvertising];}break;case CBManagerStatePoweredOff://蓝牙关闭了{if (self.btStatusBlock) {self.btStatusBlock(CBManagerStatePoweredOff, @"蓝牙已关闭,请打开蓝牙");}}break;case CBManagerStateUnsupported://不支持{if (self.btStatusBlock) {self.btStatusBlock(CBManagerStatePoweredOff, @"蓝牙设备不支持!");}}break;default:break;}} else {// Fallback on earlier versionsswitch (peripheral.state) {case 5://蓝牙打开{for (CBMutableService *service in self.services) {[self.peripheralManager addService:service];}[self startAdvertising];}break;case 4://蓝牙关闭了{if (self.btStatusBlock) {self.btStatusBlock(4, @"蓝牙已关闭,请打开蓝牙");}}break;case 2://不支持{if (self.btStatusBlock) {self.btStatusBlock(2, @"蓝牙设备不支持!");}}break;default:break;}}
}-(void)peripheralManager:(CBPeripheralManager *)peripheral didAddService:(CBService *)service error:(NSError *)error{}- (void)peripheralManager:(CBPeripheralManager *)peripheral didReceiveReadRequest:(CBATTRequest *)request{
//    if (request.characteristic.properties & CBCharacteristicPropertyRead) {
//        NSData *data = request.characteristic.value;
//       // [request setValue:data];
//        //[self.peripheralManager respondToRequest:request withResult:CBATTErrorSuccess];
//    } else {
//        [self.peripheralManager respondToRequest:request withResult:CBATTErrorReadNotPermitted];
//    }}- (void)peripheralManager:(CBPeripheralManager *)peripheral didReceiveWriteRequests:(NSArray<CBATTRequest *> *)requests {CBATTRequest *request = requests.lastObject;if (request.characteristic.properties & CBCharacteristicPropertyWrite) {CBMutableCharacteristic *characteristic = (CBMutableCharacteristic *)request.characteristic;characteristic.value = request.value;if (self.receivedDataBlock) {self.receivedDataBlock(request.value,nil);}[self.peripheralManager respondToRequest:request withResult:CBATTErrorSuccess];} else {if (self.receivedDataBlock) {NSError *error = [[NSError alloc] initWithDomain:@"JKBlueToothModule" code:CBATTErrorWriteNotPermitted userInfo:@{@"msg":@"CBATTErrorWriteNotPermitted error"}];self.receivedDataBlock(nil,error);}[self.peripheralManager respondToRequest:request withResult:CBATTErrorWriteNotPermitted];}
}//订阅characteristics
-(void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central didSubscribeToCharacteristic:(CBCharacteristic *)characteristic{//NSLog(@"订阅了 %@的数据",characteristic.UUID);[self.centrals addObject:central];}//取消订阅characteristics
-(void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central didUnsubscribeFromCharacteristic:(CBCharacteristic *)characteristic{//NSLog(@"取消订阅 %@的数据",characteristic.UUID);[self.centrals removeObject:central];}#pragma mark - - - - lazyLoad - - - -
- (NSMutableArray *)services{if (!_services) {_services  = [NSMutableArray new];}return _services;
}- (NSMutableArray *)centrals{if (!_centrals) {_centrals = [NSMutableArray new];}return _centrals;
}@end

代码可以直接复制直接使用。由于我这边是私有库,就不开放给大家了。另外文件传输时,参考我之前写的一篇文章《iOS蓝牙开发之数据传输精华篇》
里面有讲到数据拼接的一个工具 ,pod集成如下:

pod 'JKTransferDataHelper'

这里写图片描述


http://chatgpt.dhexx.cn/article/u8TIwlEU.shtml

相关文章

Android经典蓝牙开发全流程

一、基本介绍 所谓蓝牙(Bluetooth)技术&#xff0c;实际上是一种短距离无线电技术&#xff0c;最初是由爱立信公司公司发明的。技术始于爱立信公司 1994 方案&#xff0c;它是研究在移动电话和其他配件间进行低功耗、低成本无线通信连接的方法。发明者希望为设备间的通讯创造一…

Android - 蓝牙开发

文章目录 科普SIG类型制式选择逻辑链路控制适配协议 (L2CAP)L2CAP的功能 蓝牙框架和 RFCOMM 协议蓝牙安全白名单机制 编程蓝牙权限Classic BluetoothBluetooth Low Energy术语角色 & 职能查找 BLE 设备连接设备上的 GATT 服务器绑定服务蓝牙设置连接到设备连接到 GATT 服务…

Android 蓝牙开发 uuid,Android蓝牙开发之 UUID

UUID&#xff1a;全球唯一标识符 在蓝牙中&#xff0c;每个Service和Characteristic都唯一地由"全球唯一标识符" (UUID)来校验&#xff0c;主要是保证他们的唯一性。 UUID可分为&#xff1a;16位、32位、128 位UUID Bluetooth_Base_UUID&#xff1a;蓝牙UUID基数 UUI…

Android 低功耗蓝牙开发简述

低功耗蓝牙简述 一、什么是低功耗蓝牙&#xff1f;二、怎么做低功耗蓝牙应用&#xff1f;① 之前有没有接触Android蓝牙开发&#xff1f;② 蓝牙设备固件是公司自己的吗&#xff1f;③ 有没有蓝牙固件和蓝牙应用的文档和Demo&#xff1f;④ 具体的业务功能需求明确吗&#xff1…

Android蓝牙开发

题引&#xff1a; 最近项目上涉及与硬件相关的功能&#xff0c;需要通过蓝牙进行消息收发。项目已完成&#xff0c;这里做下记录。 通信步骤&#xff1a; 1.初始化BluetoothAdapter.getDefaultAdapter()获取BluetoothAdapter对象 2.判断蓝牙是否开启bluetoothAdapter.isEnab…

【Android】蓝牙开发——BLE(低功耗蓝牙)(附完整Demo)

目录 目录 前言 一、相关概念介绍 二、实战开发 三、项目演示 四、Demo案例源码地址 五、更新记录 1、2020/12/29 &#xff1a;修改 setupService()中错误 2、2021/05/14 &#xff1a;更新连接方法&#xff08;解决部分蓝牙设备连接失败的问题&#xff09; 3、2022/1…

【Bluetooth开发】蓝牙开发入门

BLE 蓝牙设备在生活中无处不在&#xff0c;但是我们也只是将其作为蓝牙模块进行使用&#xff0c;发送简单的AT命令实现数据收发。 那么&#xff0c;像对于一些复杂的使用场合&#xff1a;“车载蓝牙”、"智能手表"、“蓝牙音箱”等&#xff0c;我们不得不去了解底层…

【Bluetooth蓝牙开发】一、蓝牙开发入门

一、蓝牙开发入门 文章目录 一、蓝牙开发入门 1、蓝牙概念2、蓝牙发展历程3、蓝牙技术概述 3.1 Basic Rate(BR)3.2 Low Energy&#xff08;LE&#xff09; 4、常见蓝牙架构 4.1 SOC蓝牙单芯片方案4.2 SOC蓝牙MCU方案4.3 蓝牙host controller分开方案4.4 使用场景 5、参考文档 …

vs2012做ArcGIS二次开发前期准备

解压ArcGIS 1.双击ESRI 2.点击 一路next&#xff0c;自己选择安装路径&#xff0c;建议放在非系统盘 3.开始菜单-ArcGIS-License Server Administrator 4.点击“stop/停止"&#xff0c;再点击确定 5.将破解文件中的两个文件拷到D:\Program Files (x86)\ArcGIS\License10.…

arcgis 二次开发学习笔记(一):了解二次开发有关的软件及其之间的关系

【废话篇】今天是大三开学的第一天课&#xff0c;终于意识到我口中念念不忘却没付出实际行动的“考研”来了。考研目标现在为止还没有很明确&#xff0c;只是不甘屈于人后。周围太多生活得很辛苦的人&#xff0c;只是不愿意我这一辈子也为了有关qian的小事斤斤计较&#xff0c;…

Arcobjects for java:Arcgis二次开发入门,开发一个基本地图组件

一、目的 因学习需要&#xff0c;使用Java进行Arcgis二次开发。当前对arcgis进行二次开发使用的语言基本是C#&#xff0c;使用Java对Arcgis进行二次开发的很少。于是使用java在idea上进行Arcgis二次开发&#xff0c;给入门的同学做参考&#xff0c;我自己也处于入门阶段&#…

ArcGIS二次开发基础教程(00):基础界面设计

ArcGIS二次开发基础教程(00) : 基础界面设计 (开发环境&#xff1a;VS2010ArcEngine10.2C# &#xff1b;鉴于学习ArcGIS二次开发的同学都有一定的WinForm开发和ArcGIS软件使用基础&#xff0c;故此教程不再对一些基础内容作详细阐述&#xff09; 首先新建一个Windows窗体应用程…

【ArcGIS二次开发】TOCControl右键菜单功能实现

1、添加现有项 ①右击解决方案中的项目&#xff0c;添加TOCControlContextMenu中的LayerSelectable、LayerVisibility、RemoveLayer、ZoomToLayer ②点击菜单栏中的项目&#xff0c;添加引用ESRI.ArcGIS.ADF.Local ③修改RemoveLayer中的命名空间为项目名称EngineMapTest&#…

arcgis python实例_arcgis二次开发_arcgis二次开发python_arcgis二次开发实例

[1.rar] - QQ连连看的源码.单消秒杀挂机等功能喜欢的朋友请拿去研究 [qqCHAR.rar] - qq 验证码识别程序 可以叫准确的识别出qq登陆前的验证码 [1.rar] - 本书以Visualc作为开发语言&#xff0c;结合大量实例&#xff0c;详细介绍了利用Arcobjects组件进行GIS二次开发的方法和…

【ArcGIS二次开发】Engine界面搭建

1、新建窗体项目Windows Appplication(Engine) 2、添加menuStrip、statusStrip和ToolbarControl控件&#xff0c;并设置相应的Dock属性为Top和Right 3、用SplitContainer控件把显示区域分成三部分&#xff0c;并设置splitContatiner1的Orientation属性为Horizontal 4、添加TabC…

ArcGIS二次开发基础教程(02):地图导航和鹰眼

ArcGIS二次开发基础教程(02)&#xff1a;地图导航和鹰眼 地图导航&#xff08;主要是调用命令和工具&#xff09; 地图的放缩和漫游 if(axMapControl1.CurrentTool null) {ICommand icc;//地图放大ITool tool new ControlsMapZoomInToolClass();//地图缩小//ITool tool n…

arcgis java 二次开发_arcgis二次开发_cad二次开发_java arcgis二次开发

属性查询是GIS应用不可缺少的重要功能&#xff0c;尤其是在各种业务系统中&#xff0c;根据用户输入相应的查询条件&#xff0c;从属性要素中快速定位到用户感兴趣的要素&#xff0c;为业务应用提供了便利。本文就来聊一聊QGis二次开发中如何实现属性查询功能。 其实这个功能我…

AE+ArcGIS二次开发课程设计(基于C#)

AEArcGIS二次开发课程设计&#xff08;基于C#&#xff09; 1.工作内容2.程序功能介绍3.功能模块介绍3.1 实现【创建TIN】说明3.1.1 功能说明3.1.2 代码实现&#xff08;包含了所有主要的代码&#xff0c;库引用自行导入&#xff09; 3.2 实现【TIN坡度坡向分析】说明3.2.1 功能…

ArcGIS二次开发前言

ArcGIS二次开发前言 前言环境常见bug解决方案 前言 自毕业成为GIS开发工程师已有一年多的时间&#xff0c;时间很短&#xff0c;短到不过人一生中工作时限的3.75%&#xff0c;时间很长&#xff0c;长到收藏夹已经从零攒到了一千四百多条记录&#xff0c;OneNote上也记录了几十…

ArcGIS Engine二次开发

目录 1 前言 2 准备工作 2.1 License的加入 2.2 ToolStrip控件 2.3 MenuStrip控件 2.4 帮助文档的查看 3 数据加载 3.1 矢量数据的加载 3.2 栅格数据的加载 4 地图浏览功能 1 前言 这是一份关于ArcGIS Engine二次开发的一份报告总结&#xff0c;在这份报告中包含了简单的…