예제 #1
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                Cursor = Cursors.WaitCursor;

                if (ProfileRoute == null)
                {
                    FileInfo fiMask = ProjectManager.Project.GetAbsolutePath(txtPath.Text);
                    fiMask.Directory.Create();

                    ucPolyline.SelectedItem.Copy(fiMask);

                    string lablField = chkLabel.Checked ? cboLabel.Text : string.Empty;

                    ProfileRoute = new GCDCore.Project.ProfileRoutes.ProfileRoute(txtName.Text, fiMask, cboDistance.Text, lablField, ProfileRouteType);
                    ProjectManager.Project.ProfileRoutes.Add(ProfileRoute);
                    ProjectManager.AddNewProjectItemToMap(ProfileRoute);
                }
                else
                {
                    ProfileRoute.Name = txtName.Text;
                }

                ProjectManager.Project.Save();

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                GCDException.HandleException(ex, "Error creating regular mask.");
            }
        }
예제 #2
0
 public frmProfileRouteProperties(ProfileRoute.ProfileRouteTypes eType, GCDCore.Project.ProfileRoutes.ProfileRoute route)
 {
     InitializeComponent();
     ProfileRoute     = route;
     ProfileRouteType = eType;
 }
예제 #3
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                Cursor = Cursors.WaitCursor;

                if (LinearExtraction == null)
                {
                    GCDCore.Project.ProfileRoutes.ProfileRoute route = cboRoute.SelectedItem as GCDCore.Project.ProfileRoutes.ProfileRoute;

                    ErrorSurface errSurf = null;
                    List <GCDConsoleLib.Raster> rasters = new List <Raster>();


                    if (ElevationSurface is Surface)
                    {
                        rasters.Add(((Surface)ElevationSurface).Raster);
                        if (cboError.SelectedItem is ErrorSurface)
                        {
                            errSurf = cboError.SelectedItem as ErrorSurface;
                            rasters.Add(errSurf.Raster);
                        }
                    }
                    else
                    {
                        DoDBase dod = ElevationSurface as DoDBase;
                        rasters.Add(dod.ThrDoD.Raster);
                        if (dod.ThrErr != null)
                        {
                            rasters.Add(dod.ThrErr.Raster);
                        }
                    }

                    FileInfo fiOutput = ProjectManager.Project.GetAbsolutePath(txtPath.Text);
                    fiOutput.Directory.Create();

                    RasterOperators.LinearExtractor(route.Vector, rasters, fiOutput, valSampleDistance.Value, route.DistanceField, ProjectManager.OnProgressChange);

                    GCDCore.Project.LinearExtraction.LinearExtraction le;
                    if (ElevationSurface is DEMSurvey)
                    {
                        le = new GCDCore.Project.LinearExtraction.LinearExtractionFromDEM(txtName.Text, route, fiOutput, valSampleDistance.Value, ElevationSurface as DEMSurvey, errSurf);
                    }
                    else if (ElevationSurface is Surface)
                    {
                        le = new GCDCore.Project.LinearExtraction.LinearExtractionFromSurface(txtName.Text, route, fiOutput, valSampleDistance.Value, ElevationSurface as Surface, errSurf);
                    }
                    else
                    {
                        le = new GCDCore.Project.LinearExtraction.LinearExtractionFromDoD(txtName.Text, route, fiOutput, valSampleDistance.Value, ElevationSurface as DoDBase);
                    }

                    if (ElevationSurface is Surface)
                    {
                        ((Surface)ElevationSurface).LinearExtractions.Add(le);
                    }
                    else
                    {
                        ((DoDBase)ElevationSurface).LinearExtractions.Add(le);
                    }
                }
                else
                {
                    LinearExtraction.Name = txtName.Text;
                }


                ProjectManager.Project.Save();

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                GCDException.HandleException(ex, "Error performing linear extraction.");
                DialogResult = DialogResult.None;
            }
        }