Exemplo n.º 1
0
 /// <summary>
 /// Determine if two surveyed surfaces are equal
 /// </summary>
 public bool Equals(ISurveyedSurface other)
 {
     return(ID == other.ID &&
            DesignDescriptor.Equals(other.DesignDescriptor) &&
            AsAtDate == other.AsAtDate &&
            Extents.Equals(other.Extents));
 }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Get the site model ID
            if (!Guid.TryParse(txtSiteModelID.Text, out Guid ID))
            {
                MessageBox.Show(@"Invalid Site Model ID");
                return;
            }

            // Get the offset
            if (!double.TryParse(txtOffset.Text, out double offset))
            {
                MessageBox.Show(@"Invalid design offset");
                return;
            }

            // Invoke the service to add the surveyed surface
            try
            {
                // Load the file and extract its extents
                TTMDesign        TTM      = new TTMDesign(SubGridTreeConsts.DefaultCellSize);
                string           fileName = Path.Combine(new [] { txtFilePath.Text, txtFileName.Text });
                DesignLoadResult result   = TTM.LoadFromFile(fileName);
                if (result != DesignLoadResult.Success)
                {
                    MessageBox.Show($@"Unable to load '{fileName}, with error = {result}");
                    return;
                }

                BoundingWorldExtent3D extents = new BoundingWorldExtent3D();
                TTM.GetExtents(out extents.MinX, out extents.MinY, out extents.MaxX, out extents.MaxY);
                TTM.GetHeightRange(out extents.MinZ, out extents.MaxZ);

                ISurveyedSurface surveyedSurface =
                    surveyedSurfaceManager.Add(ID,
                                               new DesignDescriptor(Guid.NewGuid(), txtFilePath.Text, txtFileName.Text, offset),
                                               dateTimePicker.Value,
                                               extents);

                // Store the existence map for the surveyed surface for later use
                ExistenceMaps.SetExistenceMap(ID, VSS.TRex.ExistenceMaps.Interfaces.Consts.EXISTENCE_SURVEYED_SURFACE_DESCRIPTOR, surveyedSurface.ID, TTM.SubgridOverlayIndex());
            }
            catch (Exception E)
            {
                MessageBox.Show($@"Exception: {E}");
            }
        }