当前位置: 首页 > news >正文

MapApp 地图应用

1. 简述

  1.1 重点

    1)更好地理解 MVVM 架构

    2)更轻松地使用 SwiftUI 框架、对齐、动画和转换

  1.2 资源下载地址:

Swiftful-Thinking:icon-default.png?t=N7T8https://www.swiftful-thinking.com/downloads

  1.3 项目结构图:

  1.4 图片、颜色资源文件图:

  1.5 启动图片配置图:

2. Model 层

  2.1 创建模拟位置文件 Location.swift

import Foundation
import MapKitstruct Location: Identifiable, Equatable{let name: Stringlet cityName: Stringlet coordinates: CLLocationCoordinate2Dlet description: Stringlet imageNames: [String]let link: String// UUID().uuidString,生产的每个ID都不一样,为了保证有相同可识别的相同模型,使用名称加城市名称var id: String {name + cityName}// Equatable 判断 id 是否一样static func == (lhs: Location, rhs: Location) -> Bool {return lhs.id == rhs.id}
}

3. 数据服务层

  3.1 创建模拟位置数据信息服务 LocationsDataSerVice.swift

import Foundation
import MapKitclass LocationsDataService {static let locations: [Location] = [Location(name: "Colosseum",cityName: "Rome",coordinates: CLLocationCoordinate2D(latitude: 41.8902, longitude: 12.4922),description: "The Colosseum is an oval amphitheatre in the centre of the city of Rome, Italy, just east of the Roman Forum. It is the largest ancient amphitheatre ever built, and is still the largest standing amphitheatre in the world today, despite its age.",imageNames: ["rome-colosseum-1","rome-colosseum-2","rome-colosseum-3",],link: "https://en.wikipedia.org/wiki/Colosseum"),Location(name: "Pantheon",cityName: "Rome",coordinates: CLLocationCoordinate2D(latitude: 41.8986, longitude: 12.4769),description: "The Pantheon is a former Roman temple and since the year 609 a Catholic church, in Rome, Italy, on the site of an earlier temple commissioned by Marcus Agrippa during the reign of Augustus.",imageNames: ["rome-pantheon-1","rome-pantheon-2","rome-pantheon-3",],link: "https://en.wikipedia.org/wiki/Pantheon,_Rome"),Location(name: "Trevi Fountain",cityName: "Rome",coordinates: CLLocationCoordinate2D(latitude: 41.9009, longitude: 12.4833),description: "The Trevi Fountain is a fountain in the Trevi district in Rome, Italy, designed by Italian architect Nicola Salvi and completed by Giuseppe Pannini and several others. Standing 26.3 metres high and 49.15 metres wide, it is the largest Baroque fountain in the city and one of the most famous fountains in the world.",imageNames: ["rome-trevifountain-1","rome-trevifountain-2","rome-trevifountain-3",],link: "https://en.wikipedia.org/wiki/Trevi_Fountain"),Location(name: "Eiffel Tower",cityName: "Paris",coordinates: CLLocationCoordinate2D(latitude: 48.8584, longitude: 2.2945),description: "The Eiffel Tower is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It is named after the engineer Gustave Eiffel, whose company designed and built the tower. Locally nicknamed 'La dame de fer', it was constructed from 1887 to 1889 as the centerpiece of the 1889 World's Fair and was initially criticized by some of France's leading artists and intellectuals for its design, but it has become a global cultural icon of France and one of the most recognizable structures in the world.",imageNames: ["paris-eiffeltower-1","paris-eiffeltower-2",],link: "https://en.wikipedia.org/wiki/Eiffel_Tower"),Location(name: "Louvre Museum",cityName: "Paris",coordinates: CLLocationCoordinate2D(latitude: 48.8606, longitude: 2.3376),description: "The Louvre, or the Louvre Museum, is the world's most-visited museum and a historic monument in Paris, France. It is the home of some of the best-known works of art, including the Mona Lisa and the Venus de Milo. A central landmark of the city, it is located on the Right Bank of the Seine in the city's 1st arrondissement.",imageNames: ["paris-louvre-1","paris-louvre-2","paris-louvre-3",],link: "https://en.wikipedia.org/wiki/Louvre"),]
}

4. ViewModel 层

  4.1 创建位置信息的 ViewModel LocationsViewModel.swift

import Foundation
import MapKit
import SwiftUIclass LocationsViewModel: ObservableObject{/// All loaded locations Published@Published var locationes: [Location] = []/// Current location on map@Published var mapLocation: Location {didSet {// 设置地图位置,然后更新地图区域updateMapRegion(location: mapLocation)}}/// Current region on map :  这是地图上的当前区域@Published var mapRegion: MKCoordinateRegion = MKCoordinateRegion()/// 坐标跨度let mapSpan = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1)/// Show list of locations : 显示位置列表@Published var showLocationsList: Bool = false/// Show location detail via sheet : 显示位置详情信息页面@Published var sheetLocation: Location? = nilinit() {let locations = LocationsDataService.locationsself.locationes = locationsself.mapLocation = locations.first!self.updateMapRegion(location: locations.first!)}/// 更新地图区域private func updateMapRegion(location: Location){withAnimation(.easeInOut) {mapRegion = MKCoordinateRegion(// 中心点: 经纬度 latitude: 纬度  longitude: 经度center: location.coordinates,// 坐标跨度:span: mapSpan)}}/// 位置列表开关func toggleLocationsList(){withAnimation(.easeInOut) {// showLocationsList = !showLocationsListshowLocationsList.toggle()}}/// 显示下一个位置func showNextLocation(location: Location){withAnimation(.easeInOut) {mapLocation = locationshowLocationsList = false}}/// 下一个按钮处理事件func nextButtonPressed(){// Get the current indexguard let currentIndex = locationes.firstIndex(where: { $0 == mapLocation }) else {print("Could not find current index in locations array! Should naver happen.")return}// check if the nextIndex is valid: 检查下一个索引是否有校let nextIndex = currentIndex + 1guard locationes.indices.contains(nextIndex) else {// Next index is NOT avlid// Restart from 0guard let firstLocation = locationes.first else { return }showNextLocation(location: firstLocation)return}// Next index IS validlet nextLocation = locationes[nextIndex]showNextLocation(location: nextLocation)}
}

5. 创建 View 层

  5.1 位置列表 View

    1) 创建实现文件 LocationsListView.swift
import SwiftUI/// 位置列表
struct LocationsListView: View {/// 环境变量中的 ViewModel@EnvironmentObject private var viewMode: LocationsViewModelvar body: some View {List {ForEach(viewMode.locationes) { location inButton {viewMode.showNextLocation(location: location)} label: {listRowView(location: location)}.padding(.vertical, 4).listRowBackground(Color.clear)}}.listStyle(.plain)}
}extension LocationsListView {/// 列表行private func listRowView(location: Location) -> some View{HStack {if let imageName = location.imageNames.first {Image(imageName).resizable().scaledToFill().frame(width: 45, height: 45).cornerRadius(10)}VStack(alignment: .leading) {Text(location.name).font(.headline)Text(location.cityName).font(.headline)}.frame(maxWidth: .infinity, alignment: .leading)}}
}struct LocationsListView_Previews: PreviewProvider {static var previews: some View {LocationsListView().environmentObject(LocationsViewModel())}
}
    2) 效果图:

  5.2 位置预览 View

    1) 创建实现文件 LocationPreviewView.swift
import SwiftUI/// 位置预览视图
struct LocationPreviewView: View {/// 环境变量中配置的 viewModel@EnvironmentObject private var viewModel: LocationsViewModellet location: Locationvar body: some View {HStack(alignment:.bottom, spacing: 0) {VStack(alignment: .leading, spacing: 16) {imageSectiontitleSection}VStack(spacing: 8) {learnMoreButtonnextButton}}.padding(20).background(RoundedRectangle(cornerRadius: 10).fill(.ultraThinMaterial.opacity(0.7)).offset(y: 65)).cornerRadius(10)}
}extension LocationPreviewView {/// 图片部分private var imageSection: some View{ZStack {if let imageImage = location.imageNames.first{Image(imageImage).resizable().scaledToFill().frame(width: 100, height: 100).cornerRadius(10)}}.padding(6).background(Color.white).cornerRadius(10)}/// 标题部分private var titleSection: some View{VStack(alignment: .leading, spacing: 4) {Text(location.name).font(.title2).fontWeight(.bold)Text(location.cityName).font(.subheadline)}.frame(maxWidth: .infinity, alignment: .leading)}/// 了解更多按钮private var learnMoreButton: some View{Button {viewModel.sheetLocation = location} label: {Text("Learn more").font(.headline).frame(width: 125, height: 35)}.buttonStyle(.borderedProminent)}/// 下一个按钮private var nextButton: some View{Button {viewModel.nextButtonPressed()} label: {Text("Next").font(.headline).frame(width: 125, height: 35)}.buttonStyle(.bordered)}
}struct LocationPreviewView_Previews: PreviewProvider {static var previews: some View {ZStack {Color.black.ignoresSafeArea()LocationPreviewView(location: LocationsDataService.locations.first!).padding()}.environmentObject(LocationsViewModel())}
}
    2) 效果图:

  5.3 位置注释 View

    1) 创建实现文件 LocationMapAnnotationView.swift
import SwiftUI/// 位置注释视图
struct LocationMapAnnotationView: View {let accentColor = Color("AccentColor")var body: some View {VStack(spacing: 0) {Image(systemName: "map.circle.fill").resizable().scaledToFill().frame(width: 30, height: 30).font(.headline).foregroundColor(.white).padding(6).background(accentColor)//.cornerRadius(36).clipShape(Circle())Image(systemName: "triangle.fill").resizable().scaledToFill().foregroundColor(accentColor).frame(width: 10, height: 10).rotationEffect(Angle(degrees: 180)).offset(y: -3).padding(.bottom, 35)}}
}#Preview {ZStack{Color.black.ignoresSafeArea()LocationMapAnnotationView()}
}
    2) 效果图:

  5.4 主页 View

    1) 创建实现文件 LocationsView.swift
import SwiftUI
import MapKit/// 主页 View
struct LocationsView: View {@EnvironmentObject private var viewModel: LocationsViewModellet maxWidthForIpad: CGFloat = 700var body: some View {ZStack {mapLayer.ignoresSafeArea()VStack(spacing: 0) {header.padding().frame(maxWidth: maxWidthForIpad)Spacer()locationsPreviewStack}}// .fullScreenCover 全屏显示.sheet(item: $viewModel.sheetLocation) { location inLocationDetailView(location: location)}}
}extension LocationsView {/// 头Viewprivate var header: some View{VStack {Button {viewModel.toggleLocationsList()} label: {Text(viewModel.mapLocation.name + ", " + viewModel.mapLocation.cityName).font(.title2).fontWeight(.black).foregroundColor(.primary).frame(height: 55).frame(maxWidth: .infinity).animation(.none, value: viewModel.mapLocation).overlay(alignment: .leading) {Image(systemName: "arrow.down").font(.headline).foregroundColor(.primary).padding().rotationEffect(Angle(degrees: viewModel.showLocationsList ? 180 : 0))}}// 列表if viewModel.showLocationsList{LocationsListView()}}.background(.thickMaterial.opacity(0.7)).cornerRadius(10).shadow(color: Color.black.opacity(0.3), radius: 20, x: 0, y: 15)}/// 地图 Viewprivate var mapLayer: some View{Map(coordinateRegion: $viewModel.mapRegion,annotationItems: viewModel.locationes,annotationContent: { location in// 地图标识颜色// MapMarker(coordinate: location.coordinates, tint: .blue)// 自定义标识MapAnnotation(coordinate: location.coordinates) {LocationMapAnnotationView().scaleEffect(viewModel.mapLocation == location ? 1 : 0.7).shadow(radius: 10).onTapGesture {viewModel.showNextLocation(location: location)}}})}/// 地址预览堆栈private var locationsPreviewStack: some View{ZStack {ForEach(viewModel.locationes) { location in// 显示当前地址if viewModel.mapLocation == location {LocationPreviewView(location: location).shadow(color: Color.black.opacity(0.3), radius: 20).padding().frame(maxWidth: maxWidthForIpad).frame(maxWidth: .infinity)// .opacity// .transition(AnyTransition.scale.animation(.easeInOut))// 添加动画.transition(.asymmetric(insertion: .move(edge: .trailing),removal: .move(edge: .leading)))}}}}
}struct LocationsView_Previews: PreviewProvider {static var previews: some View {LocationsView().environmentObject(LocationsViewModel())}
}
    2) 效果图:

  5.5 位置详情页 View

    1) 创建实现文件 LocationDetailView.swift
import SwiftUI
import MapKit/// 位置详情页视图
struct LocationDetailView: View {// @Environment(\.presentationMode) var presentationMode// @Environment(\.dismiss) var dismiss@EnvironmentObject private var viewModel: LocationsViewModellet location: Locationvar body: some View {ScrollView {VStack {imageSectionVStack(alignment: .leading, spacing: 16){titleSectionDivider()descriptionSectionDivider()mapLayer}.frame(maxWidth: .infinity, alignment: .leading).padding()}}// 安全区.ignoresSafeArea()// 超薄材质,灰白色.background(.ultraThinMaterial)// 添加返回按钮.overlay(alignment: .topLeading) {backButton}}
}extension LocationDetailView{/// 滑动切换图private var imageSection: some View{TabView {ForEach(location.imageNames, id: \.self) {Image($0).resizable().scaledToFill().frame(width: UIDevice.current.userInterfaceIdiom == .pad  ? nil : UIScreen.main.bounds.width).clipped()}}.frame(height: 500).tabViewStyle(.page).shadow(color: .black.opacity(0.3), radius: 20, y: 10)}/// 标题视图private var titleSection: some View{VStack(alignment: .leading, spacing: 8){Text(location.name).font(.largeTitle).fontWeight(.semibold).foregroundStyle(.primary)Text(location.cityName).font(.title3).foregroundStyle(.secondary)}}/// 描述视图private var descriptionSection: some View{VStack(alignment: .leading, spacing: 16){Text(location.description).font(.subheadline).foregroundStyle(.secondary)if let url = URL(string: location.link) {Link("Read more on Wikipedia", destination: url).font(.headline).tint(.blue)}}}/// 地图 Viewprivate var mapLayer: some View{Map(coordinateRegion: .constant(MKCoordinateRegion(center: location.coordinates,span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01))),annotationItems: [location]) { location inMapAnnotation(coordinate: location.coordinates){// 自定义标识LocationMapAnnotationView().shadow(radius: 10)}}.allowsHitTesting(false) // 禁止点击.aspectRatio(1, contentMode: .fit) // 纵横比.cornerRadius(30)}/// 返回按钮private var backButton: some View{Button{// dismiss.callAsFunction()viewModel.sheetLocation = nil} label: {Image(systemName: "xmark").font(.headline).padding(16).foregroundColor(.primary).background(.thickMaterial).cornerRadius(10).shadow(radius: 4).padding()}}
}#Preview {LocationDetailView(location: LocationsDataService.locations.first!).environmentObject(LocationsViewModel())
}
    2) 效果图:

  5.6 启动结构体文件 SwiftfulMapAppApp.swift

import SwiftUI@main
struct SwiftfulMapAppApp: App {@StateObject private var viewModel = LocationsViewModel()var body: some Scene {WindowGroup {LocationsView().environmentObject(viewModel)}}
}

6. 整体效果:

相关文章:

MapApp 地图应用

1. 简述 1.1 重点 1)更好地理解 MVVM 架构 2)更轻松地使用 SwiftUI 框架、对齐、动画和转换 1.2 资源下载地址: Swiftful-Thinking:https://www.swiftful-thinking.com/downloads 1.3 项目结构图: 1.4 图片、颜色资源文件图: 1.5 启动图片配置图: 2. Mo…...

Java之反射获取和赋值字段

在Java中,反射能够使得代码更加通用,往往用于工具类中。 但常常我们在获取或者赋值反射的属性时,会出现没有赋值成功的结果,往往是由于这个属性在父级中而导致的,这个时候我们就不能用getDeclaredField方法单独获取字段…...

ckplayer自己定义风格播放器的开发记录

CKplayer是一款基于Flash和HTML5技术的开源视频播放器,支持多种格式的音视频播放,并且具有优秀的兼容性和扩展性。 它不仅可以在网页上播放本地或者网络上的视频,还可以通过代码嵌入到网页中,实现更加个性化的播放效果。CKplayer…...

全网最全Django面试题整理(一)

Django 中的 MTV 是什么意思? 在Django中,MTV指的是“Model-Template-View”,而不是常见的MVC(Model-View-Controller)架构。Django的设计理念是基于MTV的 Model(模型) 模型代表数据存取层&am…...

vue统一登录

说明: 统一登录其实就是前端去判断Url地址的token 之后如果有token未过期就直接跳转到首页。 说到浏览器输入url地址,那从浏览器输入地址一共发生了几件事大致如下: DNS解析域名,获取IP地址 --》 建立TCP连接(三次握…...

MVSNet论文笔记

MVSNet论文笔记 摘要1 引言2 相关基础2.1 多视图立体视觉重建(MVS Reconstruction)2.2 基于学习的立体视觉(Learned Stereo)2.3 基于学习的多视图的立体视觉(Learned MVS) 3 MVSNet3.1 网络架构3.2 提取图片…...

大型 APP 的性能优化思路

做客户端开发都基本都做过性能优化,比如提升自己所负责的业务的速度或流畅性,优化内存占用等等。但是大部分开发者所做的性能优化可能都是针对中小型 APP 的,大型 APP 的性能优化经验并不会太多,毕竟大型 APP 就只有那么几个&…...

K8S配置资源管理

这里写目录标题 K8S配置资源管理一.Secret1.介绍2.Secret 有四种类型3.创建 Secret4.使用方式 二.ConfigMap1.介绍2.创建 ConfigMap3.Pod 中使用 ConfigMap4.用 ConfigMap 设置命令行参数5.通过数据卷插件使用ConfigMap6.ConfigMap 的热更新7.ConfigMap 更新后滚动更新 Pod K8S…...

Redis 的集群模式实现高可用

来源:Redis高可用:武林秘籍存在集群里,那稳了~ (qq.com) 1. 引言 前面我们已经聊过 Redis 的主从同步(复制)和哨兵机制,这期我们来聊 Redis 的集群模式。 但是在超大规模的互联网应用中,业务规…...

21、嵌套路由实战操作

1、创建内嵌子路由,你需要添加一个vue文件,同时添加一个与该文件同名的目录用来存放子视图组件。 2、在父组件(.vue)内增加用于显示子视图内容 新建文件 pages\index_id.vue 生成的对应路由 {path: "/",component: _…...

WPF 控件的缩放和移动

WPF 控件的缩放和移动 1.页面代码 <ContentControl ClipToBounds"True" Cursor"SizeAll"><Viewboxx:Name"viewbox"MouseDown"viewbox_MouseDown"MouseMove"viewbox_MouseMove"MouseWheel"Viewbox_MouseWhee…...

Python and和or的优先级实例比较

Python and和or的优先级 and和or都是Python的逻辑运算符&#xff0c;都为保留字。通常情况下&#xff0c;在没有括号影响&#xff0c;and和or的优先级中and在代码的逻辑运算过程中会相对优先一些&#xff0c;及在同一行的Python代码中&#xff0c;and会优先与or执行。下面将通…...

数据结构与算法编程题2

逆置线性表&#xff0c;使空间复杂度为 O(1) #include <iostream> using namespace std;typedef int ElemType; #define Maxsize 100 #define OK 1 #define ERROR 0 typedef struct SqList {ElemType data[Maxsize];int length; }SqList;void Init_SqList(SqList& …...

Java开发者的Python快速进修指南:控制之if-else和循环技巧

简单介绍 在我们今天的学习中&#xff0c;让我们简要了解一下Python的控制流程。考虑到我们作为有着丰富Java开发经验的程序员&#xff0c;我们将跳过一些基础概念&#xff0c;如变量和数据类型。如果遇到不熟悉的内容&#xff0c;可以随时查阅文档。但在编写程序或逻辑时&…...

二进制部署k8s集群-过程中的问题总结(接上篇的部署)

1、kube-apiserver部署过程中的问题 kube-apiserver.conf配置文件更改 2、calico的下载地址 curl https://docs.projectcalico.org/v3.20/manifests/calico.yaml -O 这里如果kubernetes的节点服务器为多网卡配置会产生报错 修改calino.yaml配置文件 解决方法&#xff1a; 调…...

IOS 关于CoreText的笔记

放大 一.CoreText计算attributeString显示所占区域 百度搜索有三种方法&#xff1a; 1.方法 - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options context:(nullable NSStringDrawingContext *)context 2.使用CTFrameRef 的 CTFrameGetLin…...

基础课6——开放领域对话系统架构

开放领域对话系统是指针对非特定领域或行业的对话系统&#xff0c;它可以与用户进行自由的对话&#xff0c;不受特定领域或行业的知识和规则的限制。开放领域对话系统需要具备更广泛的语言理解和生成能力&#xff0c;以便与用户进行自然、流畅的对话。 与垂直领域对话系统相比…...

Hive常见的面试题(十二道)

Hive 1. Hive SQL 的执行流程 ⾸先客户端通过shell或者Beeline等⽅式向Hive提交SQL语句,之后sql在driver中经过 解析器&#xff08;SQL Parser&#xff09;&#xff1a;将 SQL 字符串转换成抽象语法树 AST&#xff0c;这一步一般都用第三方工具库完成&#xff0c;比如 ANTLR&…...

1688商品详情API跨境专用接口php java

一、引言 随着全球电子商务的快速发展&#xff0c;跨境电子商务已经成为一种重要的国际贸易形式。1688作为全球最大的B2B电子商务平台之一&#xff0c;不仅拥有大量的商品资源&#xff0c;还为商家提供了丰富的API接口&#xff0c;以实现更高效、更便捷的电子商务活动。其中&a…...

h264流播放

参考文章&#xff1a; Android MediaCodec硬解码H264文件-CSDN博客...

装饰模式(Decorator Pattern)重构java邮件发奖系统实战

前言 现在我们有个如下的需求&#xff0c;设计一个邮件发奖的小系统&#xff0c; 需求 1.数据验证 → 2. 敏感信息加密 → 3. 日志记录 → 4. 实际发送邮件 装饰器模式&#xff08;Decorator Pattern&#xff09;允许向一个现有的对象添加新的功能&#xff0c;同时又不改变其…...

进程地址空间(比特课总结)

一、进程地址空间 1. 环境变量 1 &#xff09;⽤户级环境变量与系统级环境变量 全局属性&#xff1a;环境变量具有全局属性&#xff0c;会被⼦进程继承。例如当bash启动⼦进程时&#xff0c;环 境变量会⾃动传递给⼦进程。 本地变量限制&#xff1a;本地变量只在当前进程(ba…...

Vue3 + Element Plus + TypeScript中el-transfer穿梭框组件使用详解及示例

使用详解 Element Plus 的 el-transfer 组件是一个强大的穿梭框组件&#xff0c;常用于在两个集合之间进行数据转移&#xff0c;如权限分配、数据选择等场景。下面我将详细介绍其用法并提供一个完整示例。 核心特性与用法 基本属性 v-model&#xff1a;绑定右侧列表的值&…...

解决Ubuntu22.04 VMware失败的问题 ubuntu入门之二十八

现象1 打开VMware失败 Ubuntu升级之后打开VMware上报需要安装vmmon和vmnet&#xff0c;点击确认后如下提示 最终上报fail 解决方法 内核升级导致&#xff0c;需要在新内核下重新下载编译安装 查看版本 $ vmware -v VMware Workstation 17.5.1 build-23298084$ lsb_release…...

涂鸦T5AI手搓语音、emoji、otto机器人从入门到实战

“&#x1f916;手搓TuyaAI语音指令 &#x1f60d;秒变表情包大师&#xff0c;让萌系Otto机器人&#x1f525;玩出智能新花样&#xff01;开整&#xff01;” &#x1f916; Otto机器人 → 直接点明主体 手搓TuyaAI语音 → 强调 自主编程/自定义 语音控制&#xff08;TuyaAI…...

服务器--宝塔命令

一、宝塔面板安装命令 ⚠️ 必须使用 root 用户 或 sudo 权限执行&#xff01; sudo su - 1. CentOS 系统&#xff1a; yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh2. Ubuntu / Debian 系统…...

人工智能--安全大模型训练计划:基于Fine-tuning + LLM Agent

安全大模型训练计划&#xff1a;基于Fine-tuning LLM Agent 1. 构建高质量安全数据集 目标&#xff1a;为安全大模型创建高质量、去偏、符合伦理的训练数据集&#xff0c;涵盖安全相关任务&#xff08;如有害内容检测、隐私保护、道德推理等&#xff09;。 1.1 数据收集 描…...

LangFlow技术架构分析

&#x1f527; LangFlow 的可视化技术栈 前端节点编辑器 底层框架&#xff1a;基于 &#xff08;一个现代化的 React 节点绘图库&#xff09; 功能&#xff1a; 拖拽式构建 LangGraph 状态机 实时连线定义节点依赖关系 可视化调试循环和分支逻辑 与 LangGraph 的深…...

Qt 事件处理中 return 的深入解析

Qt 事件处理中 return 的深入解析 在 Qt 事件处理中&#xff0c;return 语句的使用是另一个关键概念&#xff0c;它与 event->accept()/event->ignore() 密切相关但作用不同。让我们详细分析一下它们之间的关系和工作原理。 核心区别&#xff1a;不同层级的事件处理 方…...

保姆级【快数学会Android端“动画“】+ 实现补间动画和逐帧动画!!!

目录 补间动画 1.创建资源文件夹 2.设置文件夹类型 3.创建.xml文件 4.样式设计 5.动画设置 6.动画的实现 内容拓展 7.在原基础上继续添加.xml文件 8.xml代码编写 (1)rotate_anim (2)scale_anim (3)translate_anim 9.MainActivity.java代码汇总 10.效果展示 逐帧…...