惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - 依尔根觉罗天赫

2024年上半年实景三维相关项目建设内容 智慧城市基础设施与智能网联汽车协同发展试点城市 城市CIM基础平台需求调查结果 新城建试点城市 住建部第一批城市更新试点名单 不动产测绘包含哪些内容 CIM基础平台性能指标 日照的那片海 Cesium地下模式应用示例 nginx-1.12.2解决跨域问题nginx.conf设置参考记录 遥望北戴河 SkylineGlobe 7 版本TerraExplorer Pro二次开发快速入门 SkylineGlobe 7.0.1 & 7.0.2版本Web开发 如何实现对三维模型和地形的剖切展示 SkylineGlobe 7.0.1 & 7.0.2版本Web开发 如何正确使用三维地图控件和工程树控件 SkylineGlobe TerraExplorer for Web 7.1.0版本 接口示例 如何解决一个从SkylineGlobe5版本升级到7版本遇到的小问题 Cesium如何通过addImageryProvider方法加载SkylineGlobe Server发布的WMS服务 SkylineGlobe7.0.1版本 支持SQLite(*.sqlite;*.db)数据库 SkylineGlobe7.0.1版本 通过鼠标左右平移模型对象
SkylineGlobe 7.0.1 & 7.0.2版本Web开发 如何实现土方量计算
依尔根觉罗天赫 · 2018-09-04 · via 博客园 - 依尔根觉罗天赫
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>剖切指定位置的三维模型</title>
    <script type="text/javascript">
        // ------------------------------------------------------
        // 若加载其他工程文件,可以修改下面一行中fly文件地址
        var flyurl = "E:\\2018\\DEMO\\Default0726.fly";
        // ------------------------------------------------------
        function LoadFly() {
            var sg = CreateSGObj();
            sg.Open(flyurl);
        }
        window.setTimeout("LoadFly()", 1000);

        function StartCal() {
            var SGWorld = CreateSGObj();
            var oid = SGWorld.ProjectTree.FindItem("New Modify Terrain ##5175551");
            CalculateList(oid, null);
        }

        function CalculateList(value, geometry) {
            var SGWorld = CreateSGObj();
            var volumeGeometry;
            var ModifyObj = SGWorld.ProjectTree.GetObject(value);
            if (geometry == null)
                volumeGeometry = ModifyObj.Geometry;
            else
                volumeGeometry = geometry;

            var origVisability = SGWorld.ProjectTree.GetVisibility(value);

            SGWorld.ProjectTree.SetVisibility(value, false);
            calculateVolume(volumeGeometry, 2, 3, 0, ModifyObj.TreeItem.Name);

            SGWorld.ProjectTree.SetVisibility(value, true);
            calculateVolume(volumeGeometry, 2, 3, 1, ModifyObj.TreeItem.Name);

            SGWorld.ProjectTree.SetVisibility(value, origVisability);
        }

        var gAreaUnitFactor = 1;
        var gVolumeUnitFactor = 1;
        var gAreaUnit = "";
        var gVolumeUnit = "";
        var gQuaryResolution = 1024;
        var gVolumeResultHTML = "";
        //-------------
        // calculateVolume
        function calculateVolume(geometry, type, altitudeType, phase, ObjName) {
            var SGWorld = CreateSGObj();
            //debugger
            //var htmlStr;
            //htmlStr = SGLang.i18n("PrepareClaculation");
            //SGWorld.Window.ShowMessageBarText(htmlStr, 1, -1);

            //var qualityStep = ResolutionsArray[$("#DensityID").val()];
            var qualityStep = 10;

            var polygonGeometry = geometry.Clone(); // to enable edit geometry (ref) when geometry type is RelativeToPivot. Navon.
            var envelope = polygonGeometry.Envelope; // Multi polygon evnelope (min/max)
            var MinX = Math.min(envelope.Rings(0).Points(0).x, envelope.Rings(0).Points(2).x);
            var MaxX = Math.max(envelope.Rings(0).Points(0).x, envelope.Rings(0).Points(2).x);
            var MinY = Math.min(envelope.Rings(0).Points(0).y, envelope.Rings(0).Points(2).y);
            var MaxY = Math.max(envelope.Rings(0).Points(0).y, envelope.Rings(0).Points(2).y);

            var stepX = Math.abs(MaxX - MinX) / gQuaryResolution;
            var stepY = Math.abs(MaxY - MinY) / gQuaryResolution;

            // calculate cell 2D size
            var cellPos0 = SGWorld.Creator.CreatePosition(MinX, MaxY, 0, 3, 0, 0, 0, 1);
            var cellPos1 = SGWorld.Creator.CreatePosition(MinX, MaxY - stepY, 0, 3, 0, 0, 0, 1);
            var cellPos2 = SGWorld.Creator.CreatePosition(MinX + stepX, MaxY, 0, 3, 0, 0, 0, 1);
            var cellWidth = cellPos0.DistanceTo(cellPos1) * qualityStep;
            var cellArea = cellPos0.DistanceTo(cellPos1) * cellPos0.DistanceTo(cellPos2) * qualityStep * qualityStep * gAreaUnitFactor;

            if (phase == 0) {
                // For now we call this query several times because of an engine bug!!!
                gElevationBufferBefore = SGWorld.Analysis.QueryElevationBuffer(MinX, MaxY, stepX, stepY, gQuaryResolution, gQuaryResolution).toArray();  // MaxX - MinX, MaxY - MinY);
                gElevationBufferBefore = SGWorld.Analysis.QueryElevationBuffer(MinX, MaxY, stepX, stepY, gQuaryResolution, gQuaryResolution).toArray();  // MaxX - MinX, MaxY - MinY);
                gElevationBufferBefore = SGWorld.Analysis.QueryElevationBuffer(MinX, MaxY, stepX, stepY, gQuaryResolution, gQuaryResolution).toArray();  // MaxX - MinX, MaxY - MinY);
            }
            else {
                // For now we call this query several times because of an engine bug!!!
                gElevationBufferAfter = SGWorld.Analysis.QueryElevationBuffer(MinX, MaxY, stepX, stepY, gQuaryResolution, gQuaryResolution).toArray();  // MaxX - MinX, MaxY - MinY);
                gElevationBufferAfter = SGWorld.Analysis.QueryElevationBuffer(MinX, MaxY, stepX, stepY, gQuaryResolution, gQuaryResolution).toArray();  // MaxX - MinX, MaxY - MinY);
                gElevationBufferAfter = SGWorld.Analysis.QueryElevationBuffer(MinX, MaxY, stepX, stepY, gQuaryResolution, gQuaryResolution).toArray();  // MaxX - MinX, MaxY - MinY);

                //// var group;
                //var drawObjects = $("#showObjectsID").is(':checked') ? true : false;
                //if (drawObjects) {
                //    CreateLayer(cellWidth * 100, ObjName);
                //    var result = featureLayerStyles["ImageLabel"](cellWidth / 40, abspath() + "/img/point.png"); // ,"[Color]");
                //}
                //group = SGWorld.ProjectTree.CreateGroup( SGLang.i18n("ToolName"), "");

                var VolumeAdded = 0;
                var VolumeRemoved = 0;
                for (i = qualityStep / 2; i < gQuaryResolution; i = i + qualityStep) {
                    for (j = qualityStep / 2; j < gQuaryResolution; j = j + qualityStep) {
                        var x = MinX + i * stepX;
                        var y = MaxY - j * stepY;
                        var objColor = "#000000";
                        var volumeType = 0;
                        var pointGeometry = SGWorld.Creator.GeometryCreator.CreatePointGeometry([x, y, 0]);
                        if (polygonGeometry.SpatialRelation.Intersects(pointGeometry)) {
                            var elevationDiff = gElevationBufferAfter[j * gQuaryResolution + i] - gElevationBufferBefore[j * gQuaryResolution + i];
                            var volumeDiff = cellArea * elevationDiff * gVolumeUnitFactor;
                            if (elevationDiff > 0) { // Added
                                volumeType = 1;
                                VolumeAdded += Math.abs(volumeDiff);
                                objColor = 65280; //  "#00ff00"; // green
                            }
                            else if (elevationDiff < 0) { // Removed
                                volumeType = 2;
                                VolumeRemoved += Math.abs(volumeDiff);
                                objColor = 255; //  "#ff0000";    // red
                            }
                            else {
                                volumeType = 0;
                                objColor = 0; //  "#000000"; // black
                            }
                            //if (drawObjects) { // && i % ObjInterval == 0 && j % ObjInterval == 0) {
                            //    var pos = SGWorld.Creator.CreatePosition(x, y, gElevationBufferAfter[j * gQuaryResolution + i], 3, 0, 0, 0, 1);
                            //    gLayer.FeatureGroups.Point.CreateFeature([pos.X, pos.Y, pos.Altitude], volumeType + ";" + cellArea.toFixed(3) + ";" + volumeDiff.toFixed(3) + ";" + objColor);
                            //    //SGWorld.Creator.CreateSphere(pos, 2, 0, objColor, objColor, 2, group, "sphere");
                            //}
                        } // if intersect
                    } // for j
                    if (i % 10 == 0) {
                        var progress = (i / gQuaryResolution) * 100;
                        htmlStr = SGLang.i18n("calculatingVolume") + ObjName + ": " + progress.toFixed(0) + "%";
                        SGWorld.Window.ShowMessageBarText(htmlStr, 1, -1);
                    }
                } // for i
                SGWorld.Window.HideMessageBarText();
                gVolumeResultHTML += "<br/><u>" + ObjName + ":</u><br/>" + "objectVolumeAdded" + "<b>" + VolumeAdded.toFixed(3) + "</b> " + gVolumeUnit + "  <br/> " + "objectVolumeRemoved" + "<b>" + VolumeRemoved.toFixed(3) + "</b> " + gVolumeUnit + "<br/>";
                //gTotalVolumeAdded += VolumeAdded;
                //gTotalVolumeRemoved += VolumeRemoved;
                alert(gVolumeResultHTML);
                //if (drawObjects)
                //    gLayer.Save();
            } // phase

            return true;
        }

        // SGWorld70
        function CreateSGObj() {
            try {
                var obj = document.getElementById("SGWorld");
                if (obj == null) {
                    obj = document.createElement('object');
                    obj.setAttribute("name", "SGWorld");
                    obj.setAttribute("id", "SGWorld");
                    obj.style.height = "1px";
                    obj.style.width = "1px";
                    obj.setAttribute("classid", "CLSID:3A4F919C-65A8-11D5-85C1-0001023952C1");
                    document.body.appendChild(obj);
                }
                return obj;
            }
            catch (e) {
                alert(e);
            }
        }

    </script>
</head>
<body style="margin: 0px; border: 0px;">
    <div id="top">
        <div>
            <input id="Button1" type="button" value="分析" style="position:absolute;top:6px;right:100px;" onclick="StartCal()" />

        </div>
    </div>
    <div style="position: absolute; top: 50px; bottom: 0px; width: 100%; background-color: black; margin: 0px; border: 0px; margin-top: 3px;">
        <object id="TerraExplorerInformationWindow" classid="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" style="margin-left: 3px; width: 19%; height: 99%;"></object>
        <object id="TerraExplorer3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" style="width: 80%; height: 99%;"></object>
    </div>
</body>

</html>