Esempio n. 1
0
        public void CalcGridStatsAndExposures_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\Findlay.cfm";

            thisInst.Open(Filename);
            thisInst.topo.GetElevsAndSRDH_ForCalcs(thisInst, null, false);

            Nodes newNode = new Nodes();

            newNode.gridStats = new Grid_Info();
            newNode.UTMX      = 280000;
            newNode.UTMY      = 4550000;

            Check_class check = new Check_class();
            int         isOk  = check.NewNodeCheck(thisInst.topo, newNode.UTMX, newNode.UTMY, 10000, "Calcs");

            newNode.CalcGridStatsAndExposures(thisInst);

            Assert.AreNotSame(newNode.expo, null, "Didn't calculate exposures");
            Assert.AreNotSame(newNode.gridStats, null, "Didn't calculate grid stats");
            Assert.AreNotSame(newNode.expo[0].expo, null, "Didn't calculate exposures");
            Assert.AreNotSame(newNode.expo[0].SR, null, "Didn't calculate roughness");
            Assert.AreNotSame(newNode.expo[0].dispH, null, "Didn't calculate displacement height");
            Assert.AreNotSame(newNode.gridStats.stats, null, "Didn't calculate grid stats");

            thisInst.Close();
        }
Esempio n. 2
0
        public void ExportNodesInSector(Continuum thisInst, Nodes startNode, int reso, double minDir, double maxDir, int minRadius, int maxRadius, string exportFile)
        {
            NodeCollection nodeList = new NodeCollection();
            Nodes          thisNode = new Nodes();
            Check_class    check    = new Check_class();

            StreamWriter sw = new StreamWriter(exportFile);

            // Adjust maxDir if it is less than minDir (i.e. if it crosses over 0 degs)
            if (maxDir < minDir)
            {
                maxDir = maxDir + 360;
            }

            // Do polar coordinate sweep and find node at each angle and radius. Find node with highest elevation
            for (double i = minDir; i <= maxDir; i++)
            {
                for (double j = minRadius; j <= maxRadius; j = j + reso)
                {
                    thisNode.UTMX = startNode.UTMX + j * Math.Cos((90 - i) * Math.PI / 180);
                    thisNode.UTMY = startNode.UTMY + j * Math.Sin((90 - i) * Math.PI / 180);

                    // Find closest nodes on fixed grid
                    TopoInfo.TopoGrid closestNode = thisInst.topo.GetClosestNodeFixedGrid(thisNode.UTMX, thisNode.UTMY, 250, 12000);
                    thisNode.UTMX = closestNode.UTMX;
                    thisNode.UTMY = closestNode.UTMY;

                    int newOk = check.NewNodeCheck(thisInst.topo, thisNode.UTMX, thisNode.UTMY, 10000, "Calcs");

                    if (newOk == 100)
                    {
                        thisNode.elev = thisInst.topo.CalcElevs(thisNode.UTMX, thisNode.UTMY);
                        sw.WriteLine(thisNode.UTMX + "," + thisNode.UTMY + "," + thisNode.elev);
                    }
                }
            }

            sw.Close();
        }