1
13693261870
2024-04-03 412022ac7410aa48a675d08c9e0fa2f57e74dab7
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<html>
    <head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
        <title>Image Comparison Tool</title>
<script type="text/javascript" src="range.js"></script>
<script type="text/javascript" src="timer.js"></script>
<script type="text/javascript" src="slider.js"></script>     
 
<link type="text/css" rel="StyleSheet" href="slider.css" />  
<link rel="StyleSheet" href="../Style.css" type="text/css">
<style>
    </style> 
    </head>
    <body onload="Init();" onunload="exitTool();" style="overflow:hidden; border:0;background-color: #151515"  leftmargin='0' topmargin="0" marginwidth="0" marginheight="0"> <!-- oncontextmenu="return false;" >-->
 
        <div id="mainDiv"  style="position:absolute; left:0px; top:0px; overflow:hidden; height:100%;">
    
            <table  cellpadding ="2" cellspacing = "1" border="0" width="100%" height="100%" >
            <tr >
            <td colspan="4"  >
                <span class="i18n NormalText s8w" >Text17</span>
                <span class="i18n LayerHeader s8w" id="LayerNameSpan"></span>
            </td>
            </tr>       
           
            <tr>
            <td style="width:140px;" align="center">
                <!-- <span class="i18n NormalText" >Text22</span> -->
                <select class="directionSelect NormalText SelectDark" style="vertical-align:middle; width:120px;" id="clipDirectionID" onchange="SetClipTrans(gLastLevel,true);">
                    <option value="0" class="i18n">Text23</option>
                    <option value="1" class="i18n">Text24</option>
                    <option value="2" class="i18n">Text25</option>
                    <option value="3" class="i18n">Text26</option>
                    <option value="4" class="i18n">Text21</option>
                </select>
            </td>
            <td style=" width:250px;" align="left"><span id="gSliderClip" style="display:inline-block;width: 250px;"><input type="text" id="gSliderClipID" /></span></td>
    
            <td style="width:35px;" align="left"> <span id="clipSpan" class="NormalText s8w" >100%</span></td>
    
            <td style="width:35px;" align="center"  class="SectionText"  onclick="autoPlay(true);" style="cursor:pointer;"><img id="clipIcon" src="Images/autoOff.png" alt="" align="absmiddle"/> </td>
    
            </tr>
            </table>
        </div>
        
         <div id="alertDiv"  style="position:absolute; left:0px; top:0px; overflow:hidden; height:100%; width: 100%">
                 <table cellpadding ="2" cellspacing = "1" border="0" width="100%" style="height:100%;" >
            <tr >
            <td valign="middle" align="center" class="s10b" style="width: 100%">
                    <span class="i18n s9w" >Text_CouldNotDetect</span><br/>
                    <span class="i18n s9w" style="text-decoration: underline; cursor: pointer;" onclick="DetectLayer();" >Text_TryAgain</span>
                </td>
            </tr>       
            </table>
         </div>
         <object id="SGWorld" classid="CLSID:3a4f9197-65a8-11d5-85c1-0001023952c1">
            </object>
        
 
<script src="../jquery/jquery-1.10.2.js"  type="text/javascript"></script>
<script language="javascript" src="../ToolsCommon71.js"></script>
<script language="jscript">
 
//var SGWorld = new ActiveXObject("TerraExplorerX.SGWorld70");
 
var gDebug = true;
         
var gLastLevel = 100;
var gLayerObj = null;
var gImageryLayerGeometry;
var gAutoOnOff = false;
var gClipTimeout;
var gClipUpdatetimeout;
var gclipPosition;
var gSliderClip;
var gImageryLayerAlpha;
 
 
//--------------
// Init
function Init() {
    DetectLayer();
 
}
//--------------
// DetectLayer
function DetectLayer(){
    try {
        $("#alertDiv").hide();
        $("#mainDiv").hide();
 
        var ObjectID = "";
        ObjectID = FindImageryLayer();
        if (ObjectID == "") {
            $("#alertDiv").show();
            return;
        }
 
        $("#mainDiv").show();
        gLayerObj = SGWorld.Creator.GetObject(ObjectID);
        document.getElementById("LayerNameSpan").innerHTML = gLayerObj.TreeItem.Name + " " + gLayerObj.ID;
 
        gImageryLayerGeometry = gLayerObj.Geometry.Clone();
        gImageryLayerAlpha = gLayerObj.FillStyle.Color.GetAlpha();
 
        gSliderClip = new Slider(document.getElementById("gSliderClip"), document.getElementById("gSliderClipID"));
        gSliderClip.setValue(100);
        gSliderClip.setMinimum(0);
        gSliderClip.setMaximum(100);
        gSliderClip.onchange = function () {
            SetClipTrans(gSliderClip.getValue(), false);
        };
 
        SGWorld.SetParam(450, 1);
    }
        catch (e) { alert(SGLang.i18n("Text20") + e.message); }
}
 
//------------
// FindImageryLayer
function FindImageryLayer() {
 
    var ObjectID = "";
    var TEObj;
    try {
        // Try to detect if center of the screen points to a valid imagery layer
        for (var i=0; i<200; i++){
            ObjectID = DetectImageryLayer((SGWorld.Window.Rect.Width-1) * Math.random(), (SGWorld.Window.Rect.Height-1) * Math.random());
            if (ObjectID != "")
                return ObjectID;
        }
    }
    catch (e) {alert(e.message); }
    return "";
}
//--------------
// DetectImageryLayer
function DetectImageryLayer(x, y) 
{
 
    var ObjectType =26
    var filter = 4;
    
    var WorldPoint = SGWorld.Window.PixelToWorld(x,y, filter);
    if (WorldPoint.Type == filter) {
        try {
            var TEObj = SGWorld.Creator.GetObject(WorldPoint.ObjectID);
            if (TEObj.ObjectType == ObjectType) {
                return TEObj.ID;
            }
         }
        catch (e) { }
    }
    return "";
}
 
//--------------
// 
function SetClipTrans(level, force) {
    if (level == gLastLevel && force == false)
        return;
    gLastLevel = level;
 
    try {
 
            // Transparency
            if (document.getElementById("clipDirectionID").value == "4") {
                gLayerObj.Geometry = gImageryLayerGeometry;
                gLayerObj.FillStyle.Color.SetAlpha(level / 100.0);
                document.getElementById("clipSpan").innerHTML = level + "%";
                return;
            }
 
            // Clipping
            gLayerObj.FillStyle.Color.SetAlpha(gImageryLayerAlpha);
 
            if (level == 100) {
                gLayerObj.Geometry = gImageryLayerGeometry;
                document.getElementById("clipSpan").innerHTML = level + "%";
                return;
            }
            var RightSide = SGWorld.Window.Rect.Width - 1;
            if (document.getElementById("clipDirectionID").value == "0")  // Right 2 Left
                RightSide = RightSide * (level) / 100.0;
            var LeftSide = 0;
            if (document.getElementById("clipDirectionID").value == "1")  // Left 2 Right
                LeftSide = RightSide * (100-level) / 100.0;
            var BottomSide = SGWorld.Window.Rect.Height - 1;
            if (document.getElementById("clipDirectionID").value == "3")  // Bottom 2 Top
                BottomSide = BottomSide * (level) / 100.0;
            var TopSide = 0;
            if (document.getElementById("clipDirectionID").value == "2")  // Top 2 botton
                TopSide = BottomSide * (100 - level) / 100.0;
 
            //Try to find the corners of the current terrain view
            var UppLeft = SGWorld.Window.PixelToWorld(LeftSide, TopSide, 0);
            var UppRight = SGWorld.Window.PixelToWorld(RightSide, TopSide, 0);
            var LowerLeft = SGWorld.Window.PixelToWorld(LeftSide, BottomSide, 0);
            var LowerRight = SGWorld.Window.PixelToWorld(RightSide, BottomSide, 0);
 
            while ((UppLeft.Type & 32) > 0 || (UppRight.Type & 32) > 0) {
                TopSide += SGWorld.Window.Rect.Height / 20;
                if (TopSide > (SGWorld.Window.Rect.Height * 0.9))
                    return;
                UppLeft = SGWorld.Window.PixelToWorld(LeftSide, TopSide, 0);
                UppRight = SGWorld.Window.PixelToWorld(RightSide, TopSide, 0);
            }
 
            var exteriorRing = SGWorld.Creator.GeometryCreator.CreateLinearRingGeometry(Array(UppLeft.Position.X, UppLeft.Position.Y, 0, UppRight.Position.X, UppRight.Position.Y, 0, LowerRight.Position.X, LowerRight.Position.Y, 0, LowerLeft.Position.X, LowerLeft.Position.Y, 0));
            var PolyGeometry = SGWorld.Creator.GeometryCreator.CreatePolygonGeometry(exteriorRing, null);
 
            gLayerObj.Geometry = PolyGeometry;
        document.getElementById("clipSpan").innerHTML = level + "%";
 
        gclipPosition = SGWorld.Navigate.GetPosition();
        clearTimeout(gClipUpdatetimeout);
        gClipUpdatetimeout = setTimeout("checkClipUpdate()", 1000);
 
      
    }
    catch (e) { alert(SGLang.i18n("Text3") + e.message); }
 
 
}
//--------------
// 
function checkClipUpdate() {
    var currPosition = SGWorld.Navigate.GetPosition()
    if (currPosition.IsEqual(gclipPosition) == false) {
        SetClipTrans(gLastLevel, true);
    }
    else {
        clearTimeout(gClipUpdatetimeout);
        gClipUpdatetimeout = setTimeout("checkClipUpdate()", 1000);
    }
}
//--------------
// 
function autoPlay(fromClick) {
    //debugger
    if (fromClick) {
        gAutoOnOff = !gAutoOnOff;
    }
 
    if (gAutoOnOff) {
        document.getElementById("clipIcon").src = "Images/autoOn.png";
        var a = gSliderClip.getValue();
        a = (a + 2) % 101;
        gSliderClip.setValue(a);
 
        gClipTimeout = setTimeout("autoPlay(false)", 200);
 
    }
    else {
        document.getElementById("clipIcon").src = "Images/autoOff.png";
        clearTimeout(gClipTimeout);
    }
}
 
//--------------
// 
function exitTool() {
    try {
 
        SGWorld.SetParam(450, 0);
        if (gLayerObj != null) {
            gLayerObj.FillStyle.Color.SetAlpha(gImageryLayerAlpha);
            gLayerObj.Geometry = gImageryLayerGeometry;
        }
        SGWorld.Window.RemovePopupByCaption(SGLang.i18n("Text15"));
    }
    catch (e) { }
 
}
      
    </script>
    
    
    </body>
</html>
 
 
 
 
<!--Sig:00000040nlV4pRL0Hjcw1jnciBO0s1hTbWsuZjgttu4jOBCjdKg#gkLueGnlnTpKt0gKigfxQWdgGcozixR9mCDSEs5WJ3JJ-->