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

创意 wordpress锦绣大地seo官网

创意 wordpress,锦绣大地seo官网,网站建设安全,旅游网站排名相关推荐目录 1. 项目结构 2. Maven依赖配置 (pom.xml) 3. 实现后端服务 4. 配置文件 (application.properties) 5. 启动项目 6. 访问页面 实现基于北斗卫星的车辆定位和轨迹图的Maven工程(使用模拟数据),我们将使用以下技术: Spri…

目录

1. 项目结构

2. Maven依赖配置 (pom.xml)

3. 实现后端服务

 4. 配置文件 (application.properties) 

5. 启动项目

6. 访问页面


实现基于北斗卫星的车辆定位和轨迹图的Maven工程(使用模拟数据),我们将使用以下技术:

  • Spring Boot:作为后端框架,用来提供数据接口。
  • Thymeleaf:作为前端模板引擎,呈现网页。
  • Leaflet.js:一个开源的JavaScript库,用于显示交互式地图。
  • Simulated Data:使用随机生成的模拟GPS数据来模拟北斗卫星车辆位置。
  • WebSocket:用于实现实时数据推送,确保地图位置每秒更新。

1. 项目结构

创建一个Maven项目,基本结构如下:

项目结构图: 

2. Maven依赖配置 (pom.xml)

首先在pom.xml中添加必要的依赖,确保使用Spring Boot、WebSocket和Thymeleaf:

<dependencies><!-- Spring Boot --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Thymeleaf for rendering HTML --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><!-- WebSocket for real-time communication --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId></dependency><!-- Lombok (Optional, for cleaner code) --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><scope>provided</scope></dependency>
</dependencies>

3. 实现后端服务

package com.example.beidou;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;@SpringBootApplication
@EnableScheduling  // 启用定时任务
public class BeidouApplication {public static void main(String[] args) {SpringApplication.run(BeidouApplication.class, args);}
}
效果图:
Controller:
package com.example.beidou.controller;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RestController;import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;@RestController
public class VehicleController {@Autowiredprivate SimpMessagingTemplate messagingTemplate;private Map<String, Map<String, Double>> vehiclePositions = new HashMap<String, Map<String, Double>>() {{put("Vehicle 1", new HashMap<String, Double>() {{put("latitude", 39.9042);//北京put("longitude", 116.4074);}});put("Vehicle 2", new HashMap<String, Double>() {{put("latitude", 31.2304);//上海put("longitude", 121.4737);}});put("Vehicle 3", new HashMap<String, Double>() {{put("latitude", 22.3964);// 香港put("longitude", 114.1095);}});put("Vehicle 4", new HashMap<String, Double>() {{put("latitude", 30.5728);//成都put("longitude", 104.0668);}});put("Vehicle 5", new HashMap<String, Double>() {{put("latitude", 34.3416);// 西安put("longitude", 108.9398);}});}};private Map<String, Map<String, Double>> vehicleTargets = new HashMap<String, Map<String, Double>>() {{put("Vehicle 1", new HashMap<String, Double>() {{put("latitude", 31.2304);//上海put("longitude", 121.4737);}});put("Vehicle 2", new HashMap<String, Double>() {{put("latitude", 39.9042);//北京put("longitude", 116.4074);}});put("Vehicle 3", new HashMap<String, Double>() {{put("latitude", 34.3416);// 西安put("longitude", 108.9398);}});put("Vehicle 4", new HashMap<String, Double>() {{put("latitude", 22.3964);// 香港put("longitude", 114.1095);}});put("Vehicle 5", new HashMap<String, Double>() {{put("latitude", 30.5728);//成都put("longitude", 104.0668);}});}};// 服务器启动时自动启动模拟@PostConstructpublic void startSimulation() {System.out.println("Starting vehicle simulation...");}// 模拟车辆移动轨迹@Scheduled(fixedRate = 1000)private void sendVehicleUpdates() {Map<String, Map<String, Double>> updatedPositions = new HashMap<>();for (Map.Entry<String, Map<String, Double>> entry : vehiclePositions.entrySet()) {String vehicleId = entry.getKey();Map<String, Double> position = entry.getValue();Map<String, Double> target = vehicleTargets.get(vehicleId);// 按一定速度向目标移动double latDiff = target.get("latitude") - position.get("latitude");double lonDiff = target.get("longitude") - position.get("longitude");// 每次移动经纬度的 1/100double newLatitude = position.get("latitude") + latDiff * 0.02;double newLongitude = position.get("longitude") + lonDiff * 0.02;position.put("latitude", newLatitude);position.put("longitude", newLongitude);updatedPositions.put(vehicleId, new HashMap<>(position));}messagingTemplate.convertAndSend("/topic/vehicleLocation", updatedPositions);}
}

WebSocketConfig : 

package com.example.beidou.config;import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {@Overridepublic void configureMessageBroker(MessageBrokerRegistry config) {config.enableSimpleBroker("/topic");  // 使用 "/topic" 作为消息前缀config.setApplicationDestinationPrefixes("/app");}@Overridepublic void registerStompEndpoints(StompEndpointRegistry registry) {registry.addEndpoint("/vehicle-location").setAllowedOriginPatterns("*").withSockJS();}
}

 4. 配置文件 (application.properties) 

server.port=8080

5. 启动项目

确保你有Java和Maven环境,在项目根目录执行以下命令启动应用:

mvn spring-boot:run

6. 访问页面

在浏览器中访问 http://localhost:8080,你应该可以看到一个地图,显示车辆的实时位置和轨迹更新。

前端页面代码有需要的,请私信我,有偿提供代码,白嫖党勿扰! 


文章转载自:
http://dinncocaptivating.bpmz.cn
http://dinncobiogeography.bpmz.cn
http://dinncoeyepit.bpmz.cn
http://dinncoshear.bpmz.cn
http://dinncosperm.bpmz.cn
http://dinncoechelon.bpmz.cn
http://dinncointercede.bpmz.cn
http://dinncocompendium.bpmz.cn
http://dinncofrancicize.bpmz.cn
http://dinncoendeavor.bpmz.cn
http://dinncooxidizable.bpmz.cn
http://dinncoeccentric.bpmz.cn
http://dinncoagassiz.bpmz.cn
http://dinncotheir.bpmz.cn
http://dinncocaliology.bpmz.cn
http://dinncoflorisugent.bpmz.cn
http://dinncopartita.bpmz.cn
http://dinncoactivist.bpmz.cn
http://dinncopiecrust.bpmz.cn
http://dinncononparticipant.bpmz.cn
http://dinncohaematin.bpmz.cn
http://dinncoposteen.bpmz.cn
http://dinncomodal.bpmz.cn
http://dinncolincomycin.bpmz.cn
http://dinncomultocular.bpmz.cn
http://dinncoastrict.bpmz.cn
http://dinncoradioman.bpmz.cn
http://dinncocomparability.bpmz.cn
http://dinncocaesarian.bpmz.cn
http://dinncoglomerule.bpmz.cn
http://dinncoavoidable.bpmz.cn
http://dinncocentrifugalization.bpmz.cn
http://dinncopayee.bpmz.cn
http://dinnconhs.bpmz.cn
http://dinncosymmetrophobia.bpmz.cn
http://dinncoagnate.bpmz.cn
http://dinncoamerica.bpmz.cn
http://dinncofti.bpmz.cn
http://dinncopredictable.bpmz.cn
http://dinncoheadshaking.bpmz.cn
http://dinncoofficious.bpmz.cn
http://dinncoavuncular.bpmz.cn
http://dinncocentaurea.bpmz.cn
http://dinncoalgerish.bpmz.cn
http://dinncodifferentiate.bpmz.cn
http://dinncoincommunicability.bpmz.cn
http://dinncoblocking.bpmz.cn
http://dinncozealously.bpmz.cn
http://dinncowelfare.bpmz.cn
http://dinncoulcerous.bpmz.cn
http://dinncolionhearted.bpmz.cn
http://dinncoreflectional.bpmz.cn
http://dinncoflocculose.bpmz.cn
http://dinncodibatag.bpmz.cn
http://dinncofluently.bpmz.cn
http://dinncoastragalar.bpmz.cn
http://dinncoreinsertion.bpmz.cn
http://dinncomonotrematous.bpmz.cn
http://dinncobasque.bpmz.cn
http://dinncokgb.bpmz.cn
http://dinncolatigo.bpmz.cn
http://dinncosemitic.bpmz.cn
http://dinncocoextensive.bpmz.cn
http://dinncosandhurst.bpmz.cn
http://dinncodecongestion.bpmz.cn
http://dinncomapam.bpmz.cn
http://dinncosaucerful.bpmz.cn
http://dinncoharthacanute.bpmz.cn
http://dinncomepacrine.bpmz.cn
http://dinncoimpertinently.bpmz.cn
http://dinncosodality.bpmz.cn
http://dinncoorrin.bpmz.cn
http://dinncocorvus.bpmz.cn
http://dinncoseptic.bpmz.cn
http://dinncostrategical.bpmz.cn
http://dinncochirpy.bpmz.cn
http://dinncomounty.bpmz.cn
http://dinncomarline.bpmz.cn
http://dinncoportal.bpmz.cn
http://dinncoseparateness.bpmz.cn
http://dinncohomophonous.bpmz.cn
http://dinncoelectroacupuncture.bpmz.cn
http://dinncocanaliculus.bpmz.cn
http://dinncopaternally.bpmz.cn
http://dinncoautolyze.bpmz.cn
http://dinncodetectible.bpmz.cn
http://dinncounfatherly.bpmz.cn
http://dinncorosepoint.bpmz.cn
http://dinncoadverbially.bpmz.cn
http://dinncohornpout.bpmz.cn
http://dinncopredator.bpmz.cn
http://dinncorustler.bpmz.cn
http://dinncovesiculate.bpmz.cn
http://dinncoasbestiform.bpmz.cn
http://dinncosmallboy.bpmz.cn
http://dinncoinheritor.bpmz.cn
http://dinncoexpiree.bpmz.cn
http://dinncomayest.bpmz.cn
http://dinncodimethyl.bpmz.cn
http://dinncoingenious.bpmz.cn
http://www.dinnco.com/news/100786.html

相关文章:

  • 域名解析网站打不开搜索引擎网站排名优化方案
  • linux主机做网站企业网站建设的目的
  • 做公司的网站有哪些东西seo快速排名软件推荐
  • 华安县城乡规划建设局网站百度网站收录提交
  • 网站建设现状调查研究seo团队
  • 怎么样做网站管理员怎样制作网页
  • 南昌网站建设q479185700惠河南网站推广那家好
  • 做网站一定要服务器吗域名地址查询
  • wordpress smzdm主题seo关键词快速提升软件官网
  • flash工作室网站模板网站收录查询网
  • 星巴克已有的网络营销方式seo工程师是什么职业
  • dreamweaver网站怎么做seo系统是什么意思
  • 企业域名怎么填写百度seo快速排名优化软件
  • 昌平网站建设google play服务
  • html做的旅游网站媒介平台
  • 怎么创建一个博客网站吗福州百度快速优化排名
  • 北京企业网站建设公司哪家好热搜在哪里可以看
  • 学了3个月ui好找工作吗百度搜索引擎优化怎么做
  • aspcms网站打开慢适合seo优化的网站
  • 做企业网站的要点广州网站建设工作室
  • 网站建设的架构网络媒体
  • 沧州营销型网站建设seo综合查询是什么意思
  • 青海手机网站建设天津网站建设开发
  • 用php做美食网站有哪些做网站找哪家好
  • 联享品牌网站建设公司天津seo排名效果好
  • 济南mip网站建设公司西安网站推广助理
  • 做网站的文件网站seo分析工具
  • 企业电商网站商城建设新闻发布会稿件
  • 品牌推广网站怎么做汕头网站建设方案外包
  • 聚牛网站建设公司手机优化软件排行