/// <summary>
        /// This overload of GetCrossSection launches a dialog to obtain the required parameters from the user.
        /// </summary>
        public static void GetCrossSection()
        {
            MapWinUtility.Logger.Dbg("GetCrossSection()");
            CrossSectionTypes CrossSectionType;

            Dialogs.GeoProcDialog  myDialog  = new MapWinGeoProc.Dialogs.GeoProcDialog();
            Dialogs.FileElement    grid      = myDialog.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.OpenGridFile);
            Dialogs.FileElement    shapefile = myDialog.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.OpenShapefile);
            Dialogs.FileElement    outfile   = myDialog.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.SaveShapefile);
            Dialogs.BooleanElement points    = myDialog.Add_BooleanElement();
            grid.Caption             = "Elevation Grid File name";
            shapefile.Caption        = "Cross-Section Input Polyline Shapefile";
            outfile.Caption          = "Cross-Section Output Shapefile name";
            points.Caption           = "Output cross sections as points";
            myDialog.DialogHelpText  = "This function will use a vector polyline shapefile to determine elevations as cross sections.";
            myDialog.DialogHelpTitle = "Get Cross Section";
            try
            {
                //ResourceManager rm = new ResourceManager("clsHydrology.CrossSection", Assembly.GetExecutingAssembly());
                //System.Drawing.Bitmap b = (System.Drawing.Bitmap)rm.GetObject("CrossSectionHelp");

                //myDialog.DialogHelpImage = (System.Drawing.Image)b;
                //myDialog.HelpImage = (System.Drawing.Image)b;
            }
            catch (Exception ex)
            {
                MapWinUtility.Logger.Message(ex.Message, "Exception Thrown", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.DialogResult.OK);
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            myDialog.ShowDialog();
            if (myDialog.DialogResult != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            CrossSectionType = CrossSectionTypes.PolyLineWithZ;
            if (points.Value == true)
            {
                CrossSectionType = CrossSectionTypes.PointsWithZAndElevField;
            }
            GetCrossSection(grid.Filename, shapefile.Filename, outfile.Filename, CrossSectionType);
            MapWinUtility.Logger.Dbg("Finished GetCrossSection");
        }
Example #2
0
        /// <summary>
        /// Launches a GeoProcDialog with Union Options for a Non-Static instance
        /// </summary>
        public void Union()
        {
            MapWinGeoProc.Dialogs.GeoProcDialog GPD = new MapWinGeoProc.Dialogs.GeoProcDialog();

            string[] LayerNames     = new string[m_Map.NumLayers];
            int      NumShapeLayers = 0;

            for (int lyr = 0; lyr < m_Map.NumLayers; lyr++)
            {
                // Only consider Shapefile Layers for the Union operation
                object ob = m_Map.get_GetObject(lyr);
                if (ob.GetType() != typeof(MapWinGIS.Shapefile))
                {
                    continue;
                }

                string name = m_Map.get_LayerName(lyr);
                if (name != null)
                {
                    LayerNames[lyr] = name;
                }
                else
                {
                    MapWinGIS.Shapefile sf = ob as MapWinGIS.Shapefile;
                    LayerNames[lyr] = sf.Filename;
                }
                NumShapeLayers++;
            }


            // First Input Layer or File
            MapWinGeoProc.Dialogs.LayerFileElement LF1 = GPD.Add_LayerFileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.OpenShapefile);
            LF1.Caption = "Shapefile or Shape Layer Input";
            if (NumShapeLayers > 0)
            {
                // They can't use selected shapes unless this is a layer
                LF1.LayerNames = LayerNames;
                MapWinGeoProc.Dialogs.BooleanElement BE = GPD.Add_BooleanElement();
                // If the name is not a layer name, then this will be disabled
                LF1.LayerOnlyBoolElements.Add(BE);
                BE.Text = "Use Selected Shapes";
            }

            // Second Input Layer or File
            MapWinGeoProc.Dialogs.LayerFileElement LF2 = GPD.Add_LayerFileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.OpenShapefile);
            if (NumShapeLayers > 0)
            {
                // They can't use selected shapes unless this is a layer
                LF2.LayerNames = LayerNames;
                MapWinGeoProc.Dialogs.BooleanElement BE2 = GPD.Add_BooleanElement();
                // If the name is not a layer name, then this will be disabled
                LF2.LayerOnlyBoolElements.Add(BE2);
                BE2.Text = "Use Selected Shapes";
            }

            MapWinGeoProc.Dialogs.FileElement Fout = GPD.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.SaveShapefile);



            GPD.ShowDialog();
        }