private void startHourGlass(string title) { hourGlass = new IsdutHourGlass(this.app,5); hourGlass.start(title); }
private void endHourGlass() { if(hourGlass!=null) { hourGlass.end(); hourGlass = null; } }
/** * Loads a collection of the available OperationalDatasetNames (TANT, FADM). * Returns the collection of names. Null indicates an error. */ internal dao.OperationalDatasetCollection LoadOperationalDatasetNames() { OperationalDatasetCollection theNameColl = null; string path = Extension.get_SystemValue(DAOUtils.ISDUT_SEE_TEMP); IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass(); IWorkspace theIsdutWorkspace = workspaceFactory.OpenFromFile(path, 0); if (theIsdutWorkspace != null) { util.IsdutHourGlass theHourGlass = new ISDUTLib.util.IsdutHourGlass(this._app); try { theHourGlass.start("Loading Operational Dataset information"); theNameColl = new OperationalDatasetCollection(theIsdutWorkspace); } catch (util.PermissionsException pex) { util.Logger.Write("qa.QAManager::LoadOperationalDatasetNames - Exception thrown reading permissions on QA config tables." + Environment.NewLine + pex.Message + Environment.NewLine + pex.ToString(), util.Logger.LogLevel.Warn); } catch (Exception ex) { util.Logger.Write("qa.QAManager::LoadOperationalDatasetNames - Failed to open database connection to QA config tables." + Environment.NewLine + ex.Message + Environment.NewLine + ex.ToString(), util.Logger.LogLevel.Warn); } finally { theHourGlass.end(); } } return theNameColl; }
/** * Loads a collection the QA test objects. Returns the collection of tests. Null indicates an error. * Passing an empty or null operationalArea will return all QA tests */ private QATestCollection LoadTests(string operationalArea) { QATestCollection theTestColl = null; // no longer stored in the DB. Need to store either in local PGDB, or hard-code try { string path = Extension.get_SystemValue(DAOUtils.ISDUT_SEE_TEMP); IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass(); IWorkspace theIsdutWorkspace = workspaceFactory.OpenFromFile(path, 0); if (theIsdutWorkspace != null) { util.IsdutHourGlass theHourGlass = new ISDUTLib.util.IsdutHourGlass(this._app); try { theHourGlass.start("Loading QA test information"); theTestColl = new QATestCollection(theIsdutWorkspace, operationalArea); } catch (util.PermissionsException pex) { util.Logger.Write("qa.QAManager::LoadTests - Exception thrown reading permissions on QA config tables." + Environment.NewLine + pex.Message + Environment.NewLine + pex.ToString(), util.Logger.LogLevel.Warn); } catch (Exception ex) { util.Logger.Write("qa.QAManager::LoadTests - Failed to open database connection to QA config tables." + Environment.NewLine + ex.Message + Environment.NewLine + ex.ToString(), util.Logger.LogLevel.Warn); } finally { theHourGlass.end(); } } } catch (Exception e) { MessageBox.Show("An error has occured loading the QA tests and defaults. " + e.Message); Logger.Write(e); } return theTestColl; }
private void BuildDisplacementLinks() { try { if (_App == null) { // Get the actual underlying COM type Type t = Type.GetTypeFromCLSID(typeof(AppRefClass).GUID); System.Object obj = Activator.CreateInstance(t); _App = obj as IApplication; } string masterText = this._form.cbMaster.SelectedItem.ToString(); string secondaryText = this._form.cbSecondLayer.SelectedItem.ToString(); DataTable mainTbl = MainErrorTable("MainTable", ""); string filter = "fClass = '" + masterText + "'"; DataRow[] foundRowsTo; foundRowsTo = mainTbl.Select(filter); int rowsCount = foundRowsTo.Length; string msg = "You have selected to process '" + rowsCount.ToString() + "' coordinates. Depending on your hardware configuration this process may take several minutes.\n Click on the 'OK' button to continue or the 'Cancel' button to terminate the process."; if (MessageBox.Show(msg, "Warning", MessageBoxButtons.OKCancel) == DialogResult.OK) { IsdutHourGlass theHourGlass = new IsdutHourGlass(this._App); theHourGlass.start("Processing " + rowsCount.ToString() + " Coordinates..."); double _fromX = 0; double _fromY = 0; double _toX = 0; double _toY = 0; string _toFClass = ""; int _objId = 0; IMxDocument mxDocument = _App.Document as IMxDocument; IMap map = mxDocument.FocusMap; IGraphicsContainer graphicsContainer = util.GraphicsHelper.get_GraphicsContainer(map); graphicsContainer.Reset(); graphicsContainer.DeleteAllElements(); //Get the link symbol from the adjustment extension IAdjustment adjustment = _App.FindExtensionByName("ESRI Adjustment Tools") as IAdjustment; IAdjustProperties adjustmentProperties = adjustment as IAdjustProperties; ILineSymbol linkSymbol = adjustmentProperties.DisplacementLinkSymbol; IElementCollection elements = new ElementCollectionClass(); for (int i = 0; i < adjustment.TransformationMethodCount; i++) { if (adjustment.get_TransformationMethod(i).Name == "Edge Snap") { adjustment.CurrentTransformationMethod = adjustment.get_TransformationMethod(i); break; } } foreach (DataRow dRowTo in foundRowsTo) { _objId = Convert.ToInt32(dRowTo[mainTbl.Columns.IndexOf("objId")]); _f1_id = Convert.ToInt32(dRowTo[mainTbl.Columns.IndexOf("fId")]); _toFClass = Convert.ToString(dRowTo[mainTbl.Columns.IndexOf("fClass")]); _toX = Convert.ToDouble(dRowTo[mainTbl.Columns.IndexOf("x")]); _toY = Convert.ToDouble(dRowTo[mainTbl.Columns.IndexOf("y")]); filter = "objId = " + _objId; filter = filter + " AND fClass = '" + secondaryText + "'"; DataRow[] foundRowsFrom; foundRowsFrom = mainTbl.Select(filter); foreach (DataRow dRowFrom in foundRowsFrom) { _fromX = Convert.ToDouble(dRowFrom[mainTbl.Columns.IndexOf("x")]); _fromY = Convert.ToDouble(dRowFrom[mainTbl.Columns.IndexOf("y")]); } //Create the polyline from two points IPoint fromPoint = new PointClass(); IPoint toPoint = new PointClass(); IPolyline polyLine = new PolylineClass(); IDisplacementLinkElement link = new DisplacementLinkElementClass(); fromPoint.ID = toPoint.ID = _objId; fromPoint.PutCoords(_fromX, _fromY); polyLine.FromPoint = fromPoint; toPoint.PutCoords(_toX, _toY); polyLine.ToPoint = toPoint; //Instantiate a new displacement link and set symbology link.Symbol = linkSymbol; IElement element = link as IElement; //Set the geometry and add to the elements collections element.Geometry = polyLine; elements.Add(element, 0); /* #region DELETE this - for testing only string line = ""; line = _objId.ToString() + "\t" + secondaryText + "\t" + _fromX.ToString() + "\t" + _fromY.ToString() + "\t" + this.cbMaster.SelectedItem.ToString() + "\t" + _toX.ToString() + "\t" + _toY.ToString(); tw.WriteLine(line); #endregion */ } this.CreateErrorLayer(masterText, secondaryText); graphicsContainer.AddElements(elements, 0); mxDocument.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); theHourGlass.end(); this._form.Close(); } } catch (Exception ex) { if (this._form != null) { this._form.Dispose(); this._form = null; } string msg = "Exception caught building the spacial adjustment links layer: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace; MessageBox.Show(msg,"Build Links Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); util.Logger.Write(msg); } }