<!DOCTYPE html>
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
<head>
|
<title>ToolTitle</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">
|
<style>
|
</style>
|
</head>
|
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="border: 0px; overflow: hidden;" id="Body" class="hideUntillTranslated ToolButtonsArea" onload="Init()" onunload="OnUnload()">
|
<!--oncontextmenu="return false;"> onclick="bHide=true;HideOptionsNow()" > -->
|
<table border="0" width="100%" class="s8w" cellspacing="0" cellpadding="0">
|
<tr class="s8">
|
<td colspan="2" align="left" class="ToolButtonsArea" style="border-bottom: 2px solid #ffffff;">
|
<button id="deleteMeasure" class="MenuButton2" style="border:none;" onclick="OnDeleteMeasure();"><img src="./img/delete.png" /><br /> <!-- <span class="i18n">Text0</span> --></button>
|
<button id="deleteLastPoint" class="MenuButton2" style="border:none;" onclick="OnDeleteLastPoint()"><img src="./img/delete_last_point.png" /><br /><!-- <span class="i18n">Text1</span> --></button>
|
<button id="snapping" class="MenuButton2" style="border:none;" onclick="OnSnapping()"><img src="./img/snap.png" /><br /><!-- <span class="i18n" style="font:#2A4EA5">Text7</span>--> </button>
|
<button id="onGroundDistance" class="MenuButton2" style="border-left: 2px solid #ffffff;border-right: none;" onclick="OnGroundDistance()"><img src="./img/TerrainProfile.png" /><br /><!-- <span class="i18n" style="font:#2A4EA5">Text5</span>--></button>
|
|
</td>
|
</tr>
|
</table>
|
|
<table border="0" width="100%" class="s8w ToolButtonsArea" cellspacing="0" cellpadding="3pt">
|
|
|
<tr id="createTRId">
|
<td >
|
<span class="i18n s8w" style="vertical-align:top;">Text6</span>
|
<input type="checkbox" align="bottom" id="createMeasurementObject" style="width:25px;" onclick="CreateMeasurementObject();"/>
|
</td>
|
</tr>
|
<tr >
|
<td >
|
<span class="i18n s8w" style="vertical-align:top;color:yellow;">Text24</span>
|
<input type="checkbox" id="showAerialDistance" checked align="bottom" style="width:75px;" onclick="OnShowAerial();"/>
|
</td>
|
|
</tr>
|
<tr >
|
<td >
|
<span class="i18n s8w" style="vertical-align:top;color:white;">Text25</span>
|
<input type="checkbox" id="showHorizontalDistance" align="bottom" style="width:25px;" onclick="OnShowHorizontal();"/>
|
</td>
|
</tr>
|
<tr >
|
<td >
|
<span class="i18n s8w" style="vertical-align:top;color:#FF49E6;">Text26</span>
|
<input type="checkbox" id="showVerticalDistance" align="bottom" style="width:55px;" onclick="OnShowVertical();"/>
|
</td>
|
</tr>
|
<tr >
|
<td class="textarea-container">
|
<style>
|
div.textarea-size{font-size: 12px;}
|
</style>
|
<div class="textarea-size s8w" ></div>
|
</td>
|
</tr>
|
<tr id="unitTRId">
|
<td align="right" >
|
<span id= "changeMeasurementUnits" onclick="OnChangeMeasurementUnits()" class="i18n s9w link">Text17</span>
|
</td>
|
</tr>
|
|
|
</table>
|
|
<object id="SGWorld" style="display:none" classid="CLSID:3a4f919d-65a8-11d5-85c1-0001023952c1"> </object>
|
|
|
|
<script language="javascript" src="../jquery/jquery-3.1.1.min.js"></script>
|
<script language="javascript" src="../ToolsCommon70.js"></script>
|
|
|
|
<script language="JavaScript">
|
|
//** this is a global variables for the polyline/polygon drawings
|
var gPolygonText = SGLang.i18n("Text35");
|
var gPolylineText = SGLang.i18n("Text36");
|
var gDrawPolyClick = null;
|
var gEndDrawPoly = DrawPoly;
|
var gPopupCaption = "";
|
//**
|
|
var _AERIAL_REG_NAME = "DistanceMeasurementShowAerial";
|
var _HORIZONTAL_REG_NAME = "DistanceMeasurementShowHorizontal";
|
var _VERTICAL_REG_NAME = "DistanceMeasurementShowVertical";
|
|
var bInEdit;
|
|
|
|
var gGeometry = null;
|
//----------------
|
function Init()
|
{
|
SGWorld.AttachEvent("OnMeasurementDistanceResult", OnMeasurementResult);
|
SGWorld.AttachEvent("OnInputModeChanged", OnInputModeChanged);
|
SGWorld.AttachEvent("OnEndDrawMeasurement", OnEndDrawMeasurement);
|
SGWorld.AttachEvent("OnLButtonUp", OnLButtonUp);
|
|
var isPM = GetParamValue("pm", "0");
|
if (isPM=="1"){
|
$("#unitTRId").hide();
|
$("#createTRId").hide();
|
$("#onGroundDistance").hide();
|
}
|
document.getElementById("changeMeasurementUnits").value=SGLang.i18n("");
|
document.getElementById("deleteMeasure").title=SGLang.i18n("Text18");
|
document.getElementById("deleteLastPoint").title=SGLang.i18n("Text19");
|
document.getElementById("snapping").title=SGLang.i18n("Text20");
|
document.getElementById("onGroundDistance").title=SGLang.i18n("Text23");
|
|
////Turn off CreateMeasurementObject
|
//SGWorld.Command.Execute(2225,0);
|
|
var bCreateMeasurementObject = (isPM=="1")?false:SGWorld.GetOptionParam("CreateMeasurementObjects");
|
document.getElementById("createMeasurementObject").checked = bCreateMeasurementObject;
|
CreateMeasurementObject();
|
|
Reset(1,0);
|
|
SGWorld.Command.Execute(2356,0);//__TEC_MEASURE_AERIAL_DIST
|
|
SetSnapping();
|
|
document.getElementById("showAerialDistance").checked = SGWorld.GetOptionParam(_AERIAL_REG_NAME);
|
document.getElementById("showHorizontalDistance").checked = SGWorld.GetOptionParam(_HORIZONTAL_REG_NAME);
|
document.getElementById("showVerticalDistance").checked = SGWorld.GetOptionParam(_VERTICAL_REG_NAME);
|
|
//////////////OnShow();
|
|
EnableDisableButtons();
|
|
|
//showVerticalDistance
|
}
|
//----------------
|
function ShowPopup(ProfileType, ObjID)
|
{
|
var CompareStr = "";
|
var CompareMode =0;
|
var Density = 2;
|
|
// Remove previos popup
|
SGWorld.Window.RemovePopupByCaption(gPopupCaption);
|
|
gPopupCaption = SGLang.i18n("Text14") + " " + Date().toString();
|
var url = abspath() + "/../TerrainProfile/TerrainProfilePopup.html?Type=" + ProfileType + "&ObjID=" + ObjID + "&DisableChangeInputMode=1" +"&Density=" + Density + "&Compare=" + CompareMode + CompareStr + "&Caption=" + gPopupCaption + "&lang=" + SGLang.getCode();
|
|
// var popupMsg = SGWorld.Creator.CreatePopupMessage(gPopupCaption, url, 1, SGWorld.Window.Rect.Height * 2 / 3, SGWorld.Window.Rect.Width - 2, SGWorld.Window.Rect.Height / 3 - 55, -1);
|
var popupMsg = SGWorld.Creator.CreatePopupMessage(gPopupCaption, url, 1, -1000, 100, 100, -1);
|
|
popupMsg.Flags = 2 + 32;
|
SGWorld.Window.ShowPopup(popupMsg);
|
|
|
}
|
function OnShowAerial()
|
{
|
SGWorld.SetOptionParam(_AERIAL_REG_NAME,document.getElementById("showAerialDistance").checked);
|
}
|
|
function OnShowHorizontal()
|
{
|
|
SGWorld.SetOptionParam(_HORIZONTAL_REG_NAME,document.getElementById("showHorizontalDistance").checked);
|
}
|
function OnShowVertical()
|
{
|
SGWorld.SetOptionParam(_VERTICAL_REG_NAME,document.getElementById("showVerticalDistance").checked);
|
}
|
|
|
|
|
|
function OnUnload()
|
{
|
var measurementMode = SGWorld.GetParam(9916);
|
if(measurementMode == 33326/*ID_MEASURE_HDIST*/ || measurementMode == 33327/*ID_MEASURE_ADIST*/)
|
SGWorld.Window.SetInputMode(0);
|
|
}
|
|
//-------------
|
// DrawPoly
|
function DrawPoly(geometry, type, altitudeType) {
|
|
// create a polyline, under the hidden group, using this geometry and send the objID to the popup
|
var lineGroup = SGWorld.ProjectTree.CreateGroup(SGLang.i18n("Text28"), SGWorld.ProjectTree.HiddenGroupID); // SGWorld.ProjectTree.RootID
|
var line = SGWorld.Creator.CreatePolyline(geometry, "#FC8220", 3, lineGroup, "ProfileLine");
|
|
//line.LineStyle.Width = -4;
|
//line.SetParam(5440, 1);
|
line.Visibility.Show = false;
|
|
ShowPopup(0, lineGroup);
|
return true;
|
|
}
|
|
function OnDeleteMeasure()
|
{
|
|
//alert("aa");
|
Reset(0,0);
|
|
|
SGWorld.Command.Execute(2356, 0);//__TEC_MEASURE_AERIAL_DIST
|
|
EnableDisableButtons();
|
//alert("bb");
|
}
|
|
function OnInputModeChanged(mode)
|
{
|
if(mode==0)
|
{
|
Reset(0,0);
|
//SGWorld.Window.RemovePopupByCaption("Distance Measurement");
|
}
|
|
|
}
|
|
|
function OnLButtonUp(Flags, X, Y)
|
{
|
|
if((Flags & 0x0400)==0)
|
{
|
gGeometry = null;
|
}
|
return false;
|
}
|
|
function OnEndDrawMeasurement(geometry)
|
{
|
gGeometry = geometry;
|
EnableDisableButtons();
|
}
|
|
function EnableDisableButtons()
|
{
|
var numPoints = SGWorld.GetParam(9915);
|
|
if(numPoints>0)
|
{
|
document.getElementById("deleteMeasure").style.opacity = 1;
|
}
|
else
|
{
|
document.getElementById("deleteMeasure").style.opacity = 0.3;
|
}
|
|
|
|
|
if(gGeometry==null)
|
{
|
document.getElementById("deleteLastPoint").style.opacity = 1;
|
}
|
else
|
{
|
document.getElementById("deleteLastPoint").style.opacity = 0.3;
|
}
|
|
var bEnableTerrainProfile = gGeometry!=null;
|
|
if(bEnableTerrainProfile)
|
{
|
document.getElementById("onGroundDistance").style.opacity = 1;
|
}
|
else
|
{
|
document.getElementById("onGroundDistance").style.opacity = 0.3;
|
}
|
|
}
|
|
function OnMeasurementResult(measurementResult,SounrceID)
|
{
|
measurementResult = measurementResult.replace("Total Aerial Distance:", "总空中距离:")
|
.replace("Total Horizontal Distance:", "总水平距离:")
|
.replace("Total Vertical Distance:", "总垂直距离:")
|
.replace("Total Vertical Distance (First point to last point):", "总垂直距离(从第一点到最后一点):")
|
.replace("Slope:", "坡度:")
|
.replace("Slope (First point to last point):", "坡度(从第一点到最后一点):")
|
.replace(/km/g, " 千米")
|
.replace(/cm/g, " 厘米")
|
.replace(/mm/g, " 毫米")
|
.replace(/m/g, " 米");
|
|
textContainer = document.querySelector('.textarea-container');
|
textareaSize = textContainer.querySelector('.textarea-size');
|
//input = textContainer.querySelector('textarea');
|
//input.value = measurementResult;
|
textareaSize.innerText = measurementResult;
|
|
EnableDisableButtons();
|
return true;
|
|
|
}
|
|
function OnChangeMeasurementUnits()
|
{
|
SGWorld.Command.Execute(1011,3);
|
}
|
|
function CreateMeasurementObject()
|
{
|
var bCreateMeasurementObject = document.getElementById("createMeasurementObject").checked==true;
|
SGWorld.SetOptionParam("CreateMeasurementObjects",bCreateMeasurementObject);
|
}
|
|
function ResetButtons()
|
{
|
//$("#verticalDistance").removeClass("MenuButtonHighlight");
|
$("#onGroundDistance").removeClass("MenuButtonHighlight");
|
}
|
|
//------------------
|
// Reset
|
//------------------
|
function Reset(FirstTime, FromMouseInputMode)
|
{
|
ResetButtons();
|
gGeometry = null;
|
try {
|
if (gPolyObj != null)
|
SGWorld.Creator.DeleteObject(gPolyObj.ID);
|
} catch (e) { }
|
|
gPolyObj = null;
|
GroupID = null;
|
|
bDontAskme = false;
|
|
$("#lineButton").removeClass("MenuButtonHighlight");
|
$("#areaButton").removeClass("MenuButtonHighlight");
|
$("#groupButton").removeClass("MenuButtonHighlight");
|
$("#clipboardButton").removeClass("MenuButtonHighlight");
|
|
SGWorld.ProjectTree.EnableRedraw(1);
|
SGWorld.Window.HideMessageBarText();
|
|
if (bInEdit) {
|
SGWorld.DetachEvent("OnLButtonClicked", DrawPolyLButtonClicked);
|
SGWorld.DetachEvent("OnRButtonUp", DrawPolyRButtonUp);
|
SGWorld.DetachEvent("OnFrame", DrawPolyOnFrame);
|
SGWorld.DetachEvent("OnInputModeChanged", DrawPolyInputModeChanged);
|
}
|
bInEdit = false;
|
|
//if (FirstTime != 1 && FromMouseInputMode == 0)
|
// SGWorld.Window.SetInputMode(0);
|
}
|
|
|
|
function OnEndDrawMeasurement(geometry)
|
{
|
gGeometry = geometry;
|
EnableDisableButtons();
|
}
|
|
//--------------
|
// CreateObjects
|
//--------------
|
function OnGroundDistance()
|
{
|
|
DrawPoly(gGeometry,0,0);
|
return;
|
}
|
|
function SetSnapping()
|
{
|
if( $("#snapping").hasClass("MenuButtonHighlight"))
|
SGWorld.SetParam(9912,1);
|
else
|
SGWorld.SetParam(9912,0);
|
}
|
|
|
|
function OnSnapping()
|
{
|
//$("#snapping").removeClass("MenuButtonHighlight");
|
|
if( $(event.srcElement).hasClass("MenuButtonHighlight"))
|
{
|
$("#snapping").removeClass("MenuButtonHighlight");
|
SGWorld.SetParam(9912,0);
|
}
|
else
|
{
|
SGWorld.SetParam(9912,1);
|
$(event.srcElement).addClass("MenuButtonHighlight");
|
}
|
|
}
|
/*
|
function OnVerticalDistance()
|
{
|
if( $(event.srcElement).hasClass("MenuButtonHighlight"))
|
{
|
Reset(0,0);
|
return;
|
}
|
|
|
Reset(0,0);
|
$(event.srcElement).addClass("MenuButtonHighlight");
|
SGWorld.Command.Execute(1036,0);
|
|
SetSnapping();
|
}
|
*/
|
|
|
|
|
function OnDeleteLastPoint()
|
{
|
SGWorld.SetParam(8335,0);
|
EnableDisableButtons();
|
}
|
|
|
|
</script>
|
|
</body>
|
</html>
|
|
|
<!--Sig:000000408JYdtBwnEhYwKwSHBToL4ROTBsQ92IumwfiHRg2dcUb.aSdjqmR2hWrrJjiq7xBbYr6MVX764LIe8a6004zvXaJJ-->
|