Example #1
0
        private void AddLineSeries(frmBoxPlotResults pfrmBoxplotResults, string strSeriesName, System.Drawing.Color FillColor, int intWidth, ChartDashStyle BorderDash, double dblXMin, double dblXMax, double dblYMin, double dblYMax)
        {
            try
            {
                var pSeries = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name  = strSeriesName,
                    Color = FillColor,
                    //BorderColor = Color.Black,
                    BorderWidth       = intWidth,
                    IsVisibleInLegend = false,
                    IsXValueIndexed   = false,
                    BorderDashStyle   = BorderDash,
                    ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
                };

                pfrmBoxplotResults.pChart.Series.Add(pSeries);

                pSeries.Points.AddXY(dblXMin, dblYMin);
                pSeries.Points.AddXY(dblXMax, dblYMax);
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #2
0
        private void cboSourceLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                clsSnippet pSnippet     = new clsSnippet();
                string     strLayerName = cboSourceLayer.Text;

                int    intLIndex = pSnippet.GetIndexNumberFromLayerName(pActiveView, strLayerName);
                ILayer pLayer    = mForm.axMapControl1.get_Layer(intLIndex);

                pFLayer = pLayer as IFeatureLayer;
                ESRI.ArcGIS.Geodatabase.IFeatureClass pFClass = pFLayer.FeatureClass;

                IFields fields = pFClass.Fields;

                cboValueField.Items.Clear();
                cboUField.Items.Clear();

                for (int i = 0; i < fields.FieldCount; i++)
                {
                    cboValueField.Items.Add(fields.get_Field(i).Name);
                    cboUField.Items.Add(fields.get_Field(i).Name);
                }

                DrawLegend();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #3
0
        private void pChart_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                if (!_canDraw)
                {
                    return;
                }

                int x = Math.Min(_startX, e.X);
                int y = Math.Min(_startY, e.Y);

                int width = Math.Max(_startX, e.X) - Math.Min(_startX, e.X);

                int height = Math.Max(_startY, e.Y) - Math.Min(_startY, e.Y);
                _rect = new Rectangle(x, y, width, height);
                Refresh();

                Pen pen = new Pen(Color.Cyan, 1);
                pGraphics = pChart.CreateGraphics();
                pGraphics.DrawRectangle(pen, _rect);
                pGraphics.Dispose();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #4
0
        private void frmProperties2_Load(object sender, EventArgs e)
        {
            try
            {
                //mForm = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
                //m_mapControl = (IMapControl3)mForm.axMapControl1.Object;
                //mlayer = (ILayer)m_mapControl.CustomProperty;
                //m_pSnippet = new clsSnippet();
                m_fLayer  = (IFeatureLayer)mlayer;
                m_pFClass = (IFeatureClass)m_fLayer.FeatureClass;

                IGeoDataset       GeoDataset             = (IGeoDataset)m_pFClass;
                ISpatialReference pSpatialReference      = GeoDataset.SpatialReference;
                ESRI.ArcGIS.Geodatabase.IDataset dataset = (ESRI.ArcGIS.Geodatabase.IDataset)(m_fLayer);


                this.Text               = mlayer.Name + " Properties";
                lblLayerName.Text       = mlayer.Name;
                lblLayerProjection.Text = pSpatialReference.Name;
                txtFilePath.Text        = dataset.Workspace.PathName;
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #5
0
        public frmBiOutlier()
        {
            try
            {
                InitializeComponent();
                m_pForm       = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
                m_pActiveView = m_pForm.axMapControl1.ActiveView;

                for (int i = 0; i < m_pForm.axMapControl1.LayerCount; i++)
                {
                    IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pActiveView.FocusMap.get_Layer(i);

                    if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) //Only polygon to make spatial weight matrix 10/9/15 HK
                    {
                        cboTargetLayer.Items.Add(m_pForm.axMapControl1.get_Layer(i).Name);
                    }
                }

                m_pSnippet = new clsSnippet();
                MakingSymbols();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #6
0
        public void AddMapLegend(IPageLayout pageLayout, IMap map, System.Double posX, System.Double posY, System.Double legW)
        {
            try
            {
                if (pageLayout == null || map == null)
                {
                    return;
                }
                IGraphicsContainer          graphicsContainer = pageLayout as IGraphicsContainer;              // Dynamic Cast
                IMapFrame                   mapFrame          = graphicsContainer.FindFrame(map) as IMapFrame; // Dynamic Cast
                ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
                uid.Value = "esriCarto.Legend";
                IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame((ESRI.ArcGIS.esriSystem.UID)uid, null); // Explicit Cast

                //Get aspect ratio
                IQuerySize    querySize = mapSurroundFrame.MapSurround as IQuerySize; // Dynamic Cast
                System.Double w         = 0;
                System.Double h         = 0;
                querySize.QuerySize(ref w, ref h);
                System.Double aspectRatio = w / h;

                IEnvelope envelope = new EnvelopeClass();

                envelope.PutCoords(posX, posY, (posX * legW), (posY * legW / aspectRatio));
                IElement element = mapSurroundFrame as IElement; // Dynamic Cast
                element.Geometry = envelope;
                graphicsContainer.AddElement(element, 0);
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #7
0
 private int FindFeatureFID(IPoint pPoint)
 {
     try
     {
         double    Tol      = 4;
         IEnvelope pEnvelop = pPoint.Envelope;
         pEnvelop.Expand(Tol, Tol, false);
         ISpatialFilter pSpatialFilter = new SpatialFilterClass();
         pSpatialFilter.Geometry   = pEnvelop;
         pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
         int           intTLayerIdx   = m_pSnippet.GetIndexNumberFromLayerName(m_mapControl.ActiveView, strTargetLayerName);
         ILayer        pLayer         = m_mapControl.get_Layer(intTLayerIdx);
         IFeatureLayer pFLayer        = (IFeatureLayer)pLayer;
         string        ShapeFieldName = pFLayer.FeatureClass.ShapeFieldName;
         pSpatialFilter.GeometryField = pFLayer.FeatureClass.ShapeFieldName;
         IFeatureClass  pFeatureClass = pFLayer.FeatureClass;
         IFeatureCursor pFCursor      = pFeatureClass.Search(pSpatialFilter, false);
         IFeature       pFeature      = pFCursor.NextFeature();
         //int intFIDIdx = pFeatureClass.FindField("FID");
         int intFID = Convert.ToInt32(pFeature.get_Value(0)); //Get FID Value
         return(intFID);
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return(-1);
     }
 }
Example #8
0
        public frmVariogramCloud()
        {
            try
            {
                InitializeComponent();
                m_pSnippet    = new clsSnippet();
                m_pForm       = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
                m_pActiveView = m_pForm.axMapControl1.ActiveView;

                for (int i = 0; i < m_pForm.axMapControl1.LayerCount; i++)
                {
                    IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pActiveView.FocusMap.get_Layer(i);

                    if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        cboTargetLayer.Items.Add(m_pForm.axMapControl1.get_Layer(i).Name);
                    }
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #9
0
        private void MapContrls_Enter(object sender, EventArgs e)
        {
            try
            {
                AxMapControl FocusedMapCntrl = (AxMapControl)sender;
                IMapControl3 pMapContrl      = (IMapControl3)FocusedMapCntrl.Object;

                object           objBuddy   = axTools.Buddy;
                IToolbarControl2 ptbControl = (IToolbarControl2)axTools.Object;


                ESRI.ArcGIS.SystemUI.ITool pCurrentTool = ptbControl.CurrentTool;

                //int intToolCursor = 0;
                //if (pCurrentTool != null)
                //    intToolCursor = ptbControl.CurrentTool.Cursor;

                IMapControl3 BuddyMapCntrl = (IMapControl3)objBuddy;

                if (pMapContrl != BuddyMapCntrl)
                {
                    axTools.SetBuddyControl(sender);
                    ptbControl.CurrentTool = pCurrentTool;
                    //FocusedMapCntrl.BackColor = Color.LightBlue;
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #10
0
 private void AddFieldNametoExpression()
 {
     try{
         if (radR.Checked)
         {
             if (lstFields.SelectedItems.Count > 0)
             {
                 txtNExpression.Text = txtNExpression.Text + (string)lstFields.Items[lstFields.SelectedIndex];
             }
             else
             {
                 return;
             }
         }
         else
         {
             if (lstFields.SelectedItems.Count > 0)
             {
                 txtNExpression.Text = txtNExpression.Text + "[" + (string)lstFields.Items[lstFields.SelectedIndex] + "]";
             }
             else
             {
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return;
     }
 }
Example #11
0
        private void cboSourceLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string strLayerName = cboSourceLayer.Text;

                int    intLIndex = pSnippet.GetIndexNumberFromLayerName(pActiveView, strLayerName);
                ILayer pLayer    = mForm.axMapControl1.get_Layer(intLIndex);

                pFLayer = pLayer as IFeatureLayer;
                IFields fields = pFLayer.FeatureClass.Fields;

                cboWeight.Items.Clear();

                for (int i = 0; i < fields.FieldCount; i++)
                {
                    cboWeight.Items.Add(fields.get_Field(i).Name);
                }
                cboWeight.Items.Add("None");
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #12
0
 private void lstFields_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (lstFields.SelectedItems.Count > 0)
         {
             if (txtTargetField.Text == "")
             {
                 txtTargetField.Text = (string)lstFields.Items[lstFields.SelectedIndex];
             }
             else
             {
                 AddFieldNametoExpression();
             }
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return;
     }
 }
Example #13
0
        private void frmSaveESFFull_Load(object sender, EventArgs e)
        {
            try
            {
                frmProgress pfrmProgress = new frmProgress();
                pfrmProgress.lblStatus.Text    = "Creating EVs:";
                pfrmProgress.pgbProgress.Style = ProgressBarStyle.Marquee;
                pfrmProgress.Show();

                m_pEngine.Evaluate("sample.n <- length(sample.nb)");
                m_pEngine.Evaluate("sample.listb <- nb2listw(sample.nb, style='B')");
                m_pEngine.Evaluate("B <- listw2mat(sample.listb); M <- diag(sample.n) - matrix(1/sample.n, sample.n, sample.n); MBM <- M%*%B%*%M");
                m_pEngine.Evaluate("eig <- eigen(MBM)");

                nmEVs    = m_pEngine.Evaluate("eig$vectors").AsNumericMatrix();
                cvEVName = m_pEngine.Evaluate("paste('EV', 1:sample.n, sep='')").AsCharacter();
                nvEValue = m_pEngine.Evaluate("eig$values").AsNumeric();

                intNEVs = nmEVs.RowCount;


                for (int i = 0; i < intNEVs; i++)
                {
                    string strItemName = cvEVName[i] + " (" + Math.Round(nvEValue[i], 3).ToString() + ")";
                    clistFields.Items.Add(strItemName);
                }
                //m_pEngine.Evaluate("rm(list = ls(all = TRUE))"); //Remove all items from memory.
                pfrmProgress.Close();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #14
0
        private void cboValueField_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string strTargetLayerName = cboSourceLayer.Text;
                string strValueField      = cboValueField.Text;

                int intTLayerIdx = pSnippet.GetIndexNumberFromLayerName(pActiveView, strTargetLayerName);

                ILayer        pLayer  = mForm.axMapControl1.get_Layer(intTLayerIdx);
                IFeatureLayer pFLayer = (IFeatureLayer)pLayer;
                IFeatureClass pFClass = pFLayer.FeatureClass;
                ICursor       pCursor = (ICursor)pFLayer.Search(null, false);
                IRow          pRow    = pCursor.NextRow();
                arrValue = new double[pFClass.FeatureCount(null)];
                int intValueIdx = pFClass.FindField(strValueField);
                int i           = 0;
                while (pRow != null)
                {
                    arrValue[i] = Convert.ToDouble(pRow.get_Value(intValueIdx));
                    i++;
                    pRow = pCursor.NextRow();
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #15
0
        private void CopyAndOverwriteMap(MainForm mForm)
        {
            try
            {
                //Get IObjectCopy interface
                IObjectCopy objectCopy = new ObjectCopyClass();

                //Get IUnknown interface (map to copy)
                object toCopyMap = mForm.axMapControl1.ActiveView.FocusMap;

                //Get IUnknown interface (copied map)
                object copiedMap = objectCopy.Copy(toCopyMap);

                //Get IUnknown interface (map to overwrite)
                object toOverwriteMap = axPageLayoutControl1.ActiveView.FocusMap;

                //Overwrite the MapControl's map
                objectCopy.Overwrite(copiedMap, ref toOverwriteMap);
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #16
0
        private void UpdateRange(ListView lvSymbol, int intGCBreakeCount, double[] cb, int[,] arrColors, int intRounding)
        {
            try
            {
                lvSymbol.BeginUpdate();
                lvSymbol.Items.Clear();

                for (int j = 0; j < intGCBreakeCount; j++)
                {
                    ListViewItem lvi = new ListViewItem("");
                    lvi.UseItemStyleForSubItems = false;
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi,
                                                                      "", Color.White, Color.FromArgb(arrColors[j, 0], arrColors[j, 1], arrColors[j, 2]), lvi.Font));

                    if (j == 0)
                    {
                        lvi.SubItems.Add(Math.Round(cb[j], intRounding).ToString("N" + intRounding.ToString()) + " - " + Math.Round(cb[j + 1], intRounding).ToString("N" + intRounding.ToString()));
                    }
                    else
                    {
                        double dblAdding = Math.Pow(0.1, intRounding);
                        lvi.SubItems.Add(Math.Round(cb[j] + dblAdding, intRounding).ToString("N" + intRounding.ToString()) + " - " + Math.Round(cb[j + 1], intRounding).ToString("N" + intRounding.ToString()));
                    }
                    lvSymbol.Items.Add(lvi);
                }
                lvSymbol.EndUpdate();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #17
0
        private void printToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            try
            {
                //allow the user to choose the page range to be printed
                printDialog1.AllowSomePages = true;
                //show the help button.
                printDialog1.ShowHelp = true;

                //set the Document property to the PrintDocument for which the PrintPage Event
                //has been handled. To display the dialog, either this property or the
                //PrinterSettings property must be set
                printDialog1.Document = pPrintDoc;

                //show the print dialog and wait for user input
                DialogResult result = printDialog1.ShowDialog();

                // If the result is OK then print the document.
                if (result == DialogResult.OK)
                {
                    pPrintDoc.Print();
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #18
0
        private void cboTargetLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string strLayerName = cboTargetLayer.Text;

                int    intLIndex = m_pSnippet.GetIndexNumberFromLayerName(m_pActiveView, strLayerName);
                ILayer pLayer    = m_pForm.axMapControl1.get_Layer(intLIndex);

                m_pFLayer = pLayer as IFeatureLayer;
                ESRI.ArcGIS.Geodatabase.IFeatureClass pFClass = m_pFLayer.FeatureClass;

                IFields fields = pFClass.Fields;

                cboVariable.Items.Clear();
                cboHorCon.Items.Clear();
                cboVerCon.Items.Clear();

                for (int i = 0; i < fields.FieldCount; i++)
                {
                    if (m_pSnippet.FindNumberFieldType(fields.get_Field(i)))
                    {
                        cboVariable.Items.Add(fields.get_Field(i).Name);
                        cboHorCon.Items.Add(fields.get_Field(i).Name);
                        cboVerCon.Items.Add(fields.get_Field(i).Name);
                    }
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #19
0
 private void btnSubset_Click(object sender, EventArgs e)
 {
     try
     {
         frmSubsetPoly pfrmSubsetPoly = new frmSubsetPoly();
         pfrmSubsetPoly.ShowDialog();
         m_blnSubset = pfrmSubsetPoly.m_blnSubset;
         if (m_blnSubset)
         {
             m_pClippedPolygon   = pfrmSubsetPoly.m_pClipPolygon;;
             chkCumulate.Visible = true;
             chkCumulate.Text    = "Clipped by '" + m_pClippedPolygon.Name + "'";
             chkCumulate.Checked = true;
             chkCumulate.Enabled = true;
         }
         else
         {
             chkCumulate.Visible = false;
         }
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return;
     }
 }
Example #20
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_pFLayer == null)
                {
                    return;
                }
                if (cboVariable.Text == "" || cboHorCon.Text == "" || cboVerCon.Text == "")
                {
                    return;
                }

                frmCCMapsResults pfrmCCMapResults = new frmCCMapsResults();
                pfrmCCMapResults.strHorConFldName = cboHorCon.Text;
                pfrmCCMapResults.strVerConFldName = cboVerCon.Text;
                pfrmCCMapResults.strVarFldName    = cboVariable.Text;
                pfrmCCMapResults.Text             = "C-C maps of " + m_pFLayer.Name;
                pfrmCCMapResults.intHorCnt        = Convert.ToInt32(nudHor.Value);
                pfrmCCMapResults.intVerCnt        = Convert.ToInt32(nudVer.Value);


                pfrmCCMapResults.pFLayer = m_pFLayer;

                pfrmCCMapResults.Show();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #21
0
        private void menuSaveDoc_Click(object sender, EventArgs e)
        {
            try
            {
                //execute Save Document command
                if (m_mapControl.CheckMxFile(m_mapDocumentName))
                {
                    //create a new instance of a MapDocument
                    IMapDocument mapDoc = new MapDocumentClass();
                    mapDoc.Open(m_mapDocumentName, string.Empty);

                    //Make sure that the MapDocument is not readonly
                    if (mapDoc.get_IsReadOnly(m_mapDocumentName))
                    {
                        MessageBox.Show("Map document is read only!");
                        mapDoc.Close();
                        return;
                    }

                    //Replace its contents with the current map
                    mapDoc.ReplaceContents((IMxdContents)m_mapControl.Map);

                    //save the MapDocument in order to persist it
                    mapDoc.Save(mapDoc.UsesRelativePaths, false);

                    //close the MapDocument
                    mapDoc.Close();
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #22
0
        private void FeatureSelectionOnActiveView(string whereClause, IActiveView pActiveView, IFeatureLayer pFLayer)
        {
            try
            {
                ESRI.ArcGIS.Carto.IFeatureSelection featureSelection = pFLayer as ESRI.ArcGIS.Carto.IFeatureSelection; // Dynamic Cast

                // Set up the query
                ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
                queryFilter.WhereClause = whereClause;

                // Invalidate only the selection cache. Flag the original selection
                pActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);

                // Perform the selection
                featureSelection.SelectFeatures(queryFilter, ESRI.ArcGIS.Carto.esriSelectionResultEnum.esriSelectionResultNew, false);

                // Flag the new selection
                pActiveView.Refresh();
                //pActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #23
0
        public frmAttGraduatedSymbols()
        {
            try
            {
                InitializeComponent();

                mForm       = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
                pActiveView = mForm.axMapControl1.ActiveView;

                for (int i = 0; i < mForm.axMapControl1.LayerCount; i++)
                {
                    IFeatureLayer pFeatureLayer = (IFeatureLayer)pActiveView.FocusMap.get_Layer(i);

                    if (pFeatureLayer.FeatureClass.ShapeType != esriGeometryType.esriGeometryPolyline)
                    {
                        cboSourceLayer.Items.Add(mForm.axMapControl1.get_Layer(i).Name);
                    }
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #24
0
        public frmMScatterplot()
        {
            try
            {
                InitializeComponent();
                m_pForm       = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
                m_pActiveView = m_pForm.axMapControl1.ActiveView;

                for (int i = 0; i < m_pForm.axMapControl1.LayerCount; i++)
                {
                    cboTargetLayer.Items.Add(m_pForm.axMapControl1.get_Layer(i).Name);

                    //IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pActiveView.FocusMap.get_Layer(i);

                    //if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    //    cboTargetLayer.Items.Add(m_pForm.axMapControl1.get_Layer(i).Name);
                }

                m_pSnippet = new clsSnippet();
                m_pEngine  = m_pForm.pEngine;
                try
                {
                    m_pEngine.Evaluate("library(spdep); library(maptools)");
                }
                catch
                {
                    MessageBox.Show("Please checked R packages installed in your local computer.");
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #25
0
        public frmSAutoCorr()
        {
            try
            {
                InitializeComponent();
                m_pForm       = System.Windows.Forms.Application.OpenForms["MainForm"] as MainForm;
                m_pActiveView = m_pForm.axMapControl1.ActiveView;

                for (int i = 0; i < m_pForm.axMapControl1.LayerCount; i++)
                {
                    //IFeatureLayer pFeatureLayer = (IFeatureLayer)m_pActiveView.FocusMap.get_Layer(i);
                    //if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    //Deprecated: Updated to accept point and polygon dataset.

                    cboTargetLayer.Items.Add(m_pForm.axMapControl1.get_Layer(i).Name);
                }

                m_pSnippet = new clsSnippet();
                m_pEngine  = m_pForm.pEngine;
                m_pEngine.Evaluate("rm(list=ls(all=TRUE))");
                m_pEngine.Evaluate("library(spdep); library(maptools)");
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #26
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                int intDefault       = 15; // Same with Column Count in the listview
                int intFormColumnCnt = 30;

                arrTotalColors[intRampsCounts, 0] = picSymolfrom.BackColor.R;
                arrTotalColors[intRampsCounts, 1] = picSymolfrom.BackColor.G;
                arrTotalColors[intRampsCounts, 2] = picSymolfrom.BackColor.B;

                arrTotalColors[intRampsCounts, 3] = picSymbolTo.BackColor.R;
                arrTotalColors[intRampsCounts, 4] = picSymbolTo.BackColor.G;
                arrTotalColors[intRampsCounts, 5] = picSymbolTo.BackColor.B;

                CreateAlgorimcColorRamps(cboAlgorithm.Text, intDefault);
                AddRamps(listRamps, intDefault, arrListviewColors);

                CreateMultipartRamps(cboAlgorithm.Text, intFormColumnCnt);
                AddMultiRamps(listFormcolor, intFormColumnCnt, arrFormViewColors);
                intRampsCounts++;
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #27
0
 private void frmBoxPlotResults_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         int intFCnt = m_pBL.RemoveBrushing(mForm, pFLayer);
         if (intFCnt == -1)
         {
             return;
         }
         else if (intFCnt == 0)
         {
             IFeatureSelection featureSelection = (IFeatureSelection)pFLayer;
             pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
             featureSelection.Clear();
             pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return;
     }
 }
Example #28
0
        private void AddRamps(ListView lvSymbol, int intDefault, int[,] arrListviewColors)
        {
            try
            {
                lvSymbol.BeginUpdate();
                int          intItemCnts = lvSymbol.Items.Count;
                ListViewItem lvi         = new ListViewItem(intItemCnts.ToString());

                for (int j = 0; j < intDefault; j++)
                {
                    lvi.UseItemStyleForSubItems = false;
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi,
                                                                      "", Color.White, Color.FromArgb(arrListviewColors[j, 0], arrListviewColors[j, 1], arrListviewColors[j, 2]), lvi.Font));
                }

                lvSymbol.Items.Add(lvi);

                lvSymbol.EndUpdate();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
Example #29
0
 private void frmMScatterResults_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         int intFCnt = m_pBL.RemoveBrushing(m_pForm, m_pFLayer);
         if (intFCnt == -1)
         {
             return;
         }
         else if (intFCnt == 0)
         {
             m_pActiveView.GraphicsContainer.DeleteAllElements();
             IFeatureSelection featureSelection = (IFeatureSelection)m_pFLayer;
             m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
             featureSelection.Clear();
             m_pActiveView.Refresh();
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return;
     }
 }
Example #30
0
        private void btnSubset_Click(object sender, EventArgs e)
        {
            try
            {
                //string strNameR = m_pSnippet.FilePathinRfromLayer(m_pFLayer);

                //m_pEngine.Evaluate("sample.shp <- readShapePoints('" + strNameR + "')");

                frmSubsetPoly pfrmSubsetPoly = new frmSubsetPoly();
                pfrmSubsetPoly.ShowDialog();
                m_blnSubset = pfrmSubsetPoly.m_blnSubset;
                if (m_blnSubset)
                {
                    m_pClippedPolygon   = pfrmSubsetPoly.m_pClipPolygon;;
                    chkCumulate.Visible = true;
                    chkCumulate.Text    = "Clipped by '" + m_pClippedPolygon.Name + "'";
                    chkCumulate.Checked = true;
                    chkCumulate.Enabled = true;
                }
                else
                {
                    chkCumulate.Visible = false;
                }
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }