xiewj 1 year ago
parent
commit
26ef72df33

+ 14 - 3
720yun_fd_consumer/gis_consumer/src/main/java/com/gis/listener/SceneListener.java

@@ -39,6 +39,8 @@ import java.io.StringWriter;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.concurrent.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 消息监听器
@@ -350,9 +352,8 @@ public class SceneListener {
         log.info("tourPath: {}", tourPath);
         BaseRuntimeException.isTrue(!FileUtil.isFile(tourPath), null, code + "_tour.xml文件不存在");
 
-        String tour = FileUtil.readString(tourPath, "utf-8");
-        tour = StrUtil.subAfter(tour, "</action>", true);
-        tour = StrUtil.subBefore(tour, "</krpano>", true);
+        String tour = FileUtil.readUtf8String(tourPath);
+        tour = this.extractSceneTag(tour);
         String trim = StrUtil.trim(tour);
         // log.info("trim: {}", trim);
         BaseRuntimeException.isTrue(StrUtil.isAllBlank(trim), null, code + "_tour.xml文件不存在");
@@ -363,6 +364,16 @@ public class SceneListener {
 
         return trim;
     }
+    public static String extractSceneTag(String xmlString) {
+        Pattern pattern = Pattern.compile("<scene.*?</scene>", Pattern.DOTALL);
+        Matcher matcher = pattern.matcher(xmlString);
+
+        if (matcher.find()) {
+            return matcher.group();
+        }
+
+        return "";
+    }
     private void uploadOss(String sceneCode) {
         long start = System.currentTimeMillis();
         String filePath = "/mnt/720yun_fd_manage_data/" + sceneCode;

+ 13 - 2
720yun_fd_consumer/gis_consumer/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -2,6 +2,7 @@ package com.gis.service.impl;
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.XmlUtil;
 import com.gis.constant.CmdConstant;
 import com.gis.constant.ConfigConstant;
 import com.gis.entity.FodderEntity;
@@ -20,6 +21,8 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Date;
 import java.util.concurrent.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Created by owen on 2022/7/27 0027 16:55
@@ -44,8 +47,7 @@ public class FodderServiceImpl implements FodderService {
         log.info("tourPath: {}", tourPath);
         BaseRuntimeException.isTrue(!FileUtils.checkFileExtend(tourPath, 10), null, code + "_tour.xml文件不存在");
         String tour = FileUtil.readUtf8String(tourPath);
-        tour = StrUtil.subAfter(tour, "</action>", true);
-        tour = StrUtil.subBefore(tour, "</krpano>", true);
+        tour = this.extractSceneTag(tour);
         String trim = StrUtil.trim(tour);
         // log.info("trim: {}", trim);
         BaseRuntimeException.isTrue(StrUtil.isAllBlank(trim), null, code + "_tour.xml文件不存在");
@@ -56,7 +58,16 @@ public class FodderServiceImpl implements FodderService {
 
         return trim;
     }
+    public static String extractSceneTag(String xmlString) {
+        Pattern pattern = Pattern.compile("<scene.*?</scene>", Pattern.DOTALL);
+        Matcher matcher = pattern.matcher(xmlString);
 
+        if (matcher.find()) {
+            return matcher.group();
+        }
+
+        return "";
+    }
     // 上传切图到oss
 //    private void uploadOss(String sceneCode) {
 //        String cmd = CmdConstant.OSSUTIL_UPLOAD_DIR;

+ 19 - 18
720yun_fd_consumer/gis_consumer/src/main/resources/data/tour.xml

@@ -1,6 +1,6 @@
-<krpano version="1.19" title="Virtual Tour">
+<krpano version="1.21" title="Virtual Tour">
 
-    <include url="%SWFPATH%/skin/vtourskin.xml" />
+    <include url="skin/vtourskin.xml" />
 
     <!-- customize skin settings: maps, gyro, webvr, thumbnails, tooltips, layout, design, ... -->
     <skin_settings maps="false"
@@ -8,11 +8,15 @@
                    maps_bing_api_key=""
                    maps_google_api_key=""
                    maps_zoombuttons="false"
+                   maps_loadonfirstuse="true"
                    gyro="true"
+                   gyro_keeplookingdirection="false"
                    webvr="true"
-                   webvr_gyro_keeplookingdirection="false"
+                   webvr_keeplookingdirection="true"
                    webvr_prev_next_hotspots="true"
+                   autotour="false"
                    littleplanetintro="false"
+                   followmousecontrol="false"
                    title="true"
                    thumbs="true"
                    thumbs_width="120" thumbs_height="80" thumbs_padding="10" thumbs_crop="0|40|240|160"
@@ -32,7 +36,7 @@
                    loadscene_blend="OPENBLEND(0.5, 0.0, 0.75, 0.05, linear)"
                    loadscene_blend_prev="SLIDEBLEND(0.5, 180, 0.75, linear)"
                    loadscene_blend_next="SLIDEBLEND(0.5,   0, 0.75, linear)"
-                   loadingtext="loading..."
+                   loadingtext=""
                    layout_width="100%"
                    layout_maxwidth="814"
                    controlbar_width="-24"
@@ -54,18 +58,15 @@
                    design_text_shadow="1"
     />
 
+    <!--
+        For an alternative skin design either change the <skin_settings> values
+        from above or optionally include one of the predefined designs from below.
+    -->
+    <!-- <include url="skin/vtourskin_design_flat_light.xml"  /> -->
+    <!-- <include url="skin/vtourskin_design_glass.xml"       /> -->
+    <!-- <include url="skin/vtourskin_design_ultra_light.xml" /> -->
+    <!-- <include url="skin/vtourskin_design_117.xml"         /> -->
+    <!-- <include url="skin/vtourskin_design_117round.xml"    /> -->
+    <!-- <include url="skin/vtourskin_design_black.xml"       /> -->
 
-
-    <!-- startup action - load the first scene -->
-    <action name="startup" autorun="onstart">
-        if(startscene === null OR !scene[get(startscene)], copy(startscene,scene[0].name); );
-        loadscene(get(startscene), null, MERGE);
-        if(startactions !== null, startactions() );
-    </action>
-
-
-
-
-
-
-</krpano>
+</krpano>