1
Surpriseplus
2022-10-14 6d536dea3cec157947947aa075bebde4305f29b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
    <title>截面</title>
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8">-->
    <link rel="StyleSheet" href="Style.css" type="text/css" />
    <link type="text/css" rel="StyleSheet" href="Jquery/slider.css" />
    <link href="Jquery/css/dark-hive/jquery-ui-1.10.4.custom.css" rel="stylesheet" />
    <link href="Jquery/jquery-ui-Override.css" rel="stylesheet" />
    <script src="Jquery/jquery-1.10.2.js" type="text/javascript"></script>
    <script src="Jquery/jquery-ui-1.10.4.custom.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" src="js/ToolsCommon70.js"></script>
    <script type="text/javascript" src="Jquery/slider.js"></script>
    <style>
 
    </style>
</head>
 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="border: 0px" id="Body" class="hideUntillTranslated" onload="Init()" onunload="Exit();">
    <!--oncontextmenu="return false;">  onclick="bHide=true;HideOptionsNow()" > -->
    <table border="0" width="100%" cellspacing="0" cellpadding="10">
        <tr>
            <td align="center">
                <div id="MoveSlider" style="display: block; width: 250px; height: 1px; margin: 3px;">
                </div>
            </td>
        </tr>
    </table>
    <script language="JavaScript" type="text/javascript">
        var gDebug = false;
        var gObjID = "";
        var gBoxObj = null;
        var gOrigPos = null;
        var MoveSlider;
        var gOriginBoxSize = 0;
        var gGeometry;
 
        var SGWorld = new ActiveXObject("TerraExplorerX.SGWorld70");
 
        //--------------
        // Init
        function Init() {
            try {
                //   debugger;
                var name = GetParamValue("name", "0");
                var treename = name.replace(/-/g, "\\");
 
                gObjID = SGWorld.ProjectTree.FindItem(treename);
 
                gBoxObj = SGWorld.ProjectTree.GetObject(gObjID);
                if (gBoxObj.ObjectType != 8) return;
                gOrigPos = gBoxObj.Position.Copy();
                gOriginBoxSize = gBoxObj.Width;
                SGWorld.AttachEvent("OnFrame", showCrossSection);
 
                $("#MoveSlider").slider({
                    value: 0,
                    min: -50,
                    max: 200,
                    slide: function(event, ui) {
                        setMove();
                    },
                    change: function(event, ui) {
                        setMove();
                    }
                });
 
            } catch (err) {}
        }
        //------------------
        function Exit() {
 
            try {
                SGWorld.Analysis.HideCrossSectionBox();
 
                //SGWorld.Window.ShowMessageBarText("隐藏截面:" + gBoxObj.ID);
 
            } catch (err) {}
 
        }
 
        //--------------
        function setMove() {
            try {
                var distanceVal = $("#MoveSlider").slider("value") * gBoxObj.Width / 100;
                if (gBoxObj.Position.Pitch == 90) { // vertical
                    gBoxObj.Position = gOrigPos.Move(-distanceVal.toFixed(2), gBoxObj.Position.Yaw.toFixed(2), 0);
                    gBoxObj.Position.Pitch = 90;
                } else
                    gBoxObj.Position.Altitude = gOrigPos.Altitude - distanceVal;
            } catch (err) {}
        }
        var gLastPos = null;
        //-------------------
        function showCrossSection() {
            setMove();
            try {
                if (gBoxObj == null)
                    return;
 
                if (gLastPos == null || !gLastPos.IsEqual(gBoxObj.Position)) {
                    var vertices = [];
                    var sectionSize = gBoxObj.Width * 5;
                    gLastPos = gBoxObj.Position.Copy();
                    var pos = gBoxObj.Position;
                    var planeTolarance = gOriginBoxSize / 100;
                    if (gBoxObj.Position.Pitch == 90) {
                        var yaw = gBoxObj.Position.Yaw - 180;
                        pos = pos.Move(planeTolarance, yaw - 180, 0); // make sure the cut area doesn't include the box
                        pos = pos.Move(gBoxObj.Width / 2, 0, -90);
                        pos = pos.Move(gBoxObj.Width / 2, yaw + 90, 0);
                        vertices[0] = pos;
                        pos = pos.Move(sectionSize, yaw - 180, 0);
                        vertices[1] = pos;
                        pos = pos.Move(gBoxObj.Width, yaw - 90, 0);
                        vertices[2] = pos;
                        pos = pos.Move(sectionSize, yaw, 0);
                        vertices[3] = pos;
                        vertices[4] = vertices[0].Move(gBoxObj.Width, 0, 90);
                        vertices[5] = vertices[1].Move(gBoxObj.Width, 0, 90);
                        vertices[6] = vertices[2].Move(gBoxObj.Width, 0, 90);
                        vertices[7] = vertices[3].Move(gBoxObj.Width, 0, 90);
                    } else {
                        pos = pos.Move(planeTolarance, 0, 90); // make sure the cut area doesn't include the box
                        pos = pos.Move(gBoxObj.Width / 2, gBoxObj.Position.Yaw, 0);
                        pos = pos.Move(gBoxObj.Width / 2, gBoxObj.Position.Yaw + 90, 0);
                        vertices[0] = pos;
                        pos = pos.Move(gBoxObj.Width, gBoxObj.Position.Yaw - 180, 0);
                        vertices[1] = pos;
                        pos = pos.Move(gBoxObj.Width, gBoxObj.Position.Yaw - 90, 0);
                        vertices[2] = pos;
                        pos = pos.Move(gBoxObj.Width, gBoxObj.Position.Yaw, 0);
                        vertices[3] = pos;
                        vertices[4] = vertices[0].Move(sectionSize, 0, 90);
                        vertices[5] = vertices[1].Move(sectionSize, 0, 90);
                        vertices[6] = vertices[2].Move(sectionSize, 0, 90);
                        vertices[7] = vertices[3].Move(sectionSize, 0, 90);
                    }
 
                    gGeometry = SGWorld.Creator.GeometryCreator.CreateLineStringGeometry(vertices);
                    // tmpBox = SGWorld.Creator.CreatePolyline(geometry, $("#color").val(), 3, "", "dd");        
                    SGWorld.Analysis.ShowCrossSectionBox(gGeometry, false, "#ff" + $("#color").val()); // 
                }
            } catch (err) {}
        }
    </script>
</body>
 
</html>
<!--Sig:00000040YFf3GyOIQX9gzWX9h.sCzs4t#QLO8w2ER9KyGySg4me#3IR4qALzXHLLM#n#WLNrwJDAf4lbvnrGIXMa00s7X8JJ-->