// this method is called when the tool is active and the user clicks down on the mouse - it captures the x,y coords and then reprojects them to wgs and opens a browser with streetview public override void OnMouseDown(int Button, int Shift, int X, int Y) { try { //show busy mouse System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; //get access to the document (the current mxd), and the active view (data view or layout view), and the focus map (the data frame with focus, aka: the visible map) IMxDocument pMxDocument = clsGlobals.arcApplication.Document as IMxDocument; IActiveView pActiveView = pMxDocument.ActiveView; IMap pMap = pActiveView.FocusMap; //IScreenDisplay screenDisplay = pActiveView.ScreenDisplay; //IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation; //displayTransformation.ToMapPoint((System.Int32)X, (System.Int32)Y); IEnvelope pEnvelope = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y).Envelope; //the following lines of code are needed to reproject the map units into google maps lat long //Create Spatial Reference Factory ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); IProjectedCoordinateSystem arcProjCoordSysUTM12_North = srFactory.CreateProjectedCoordinateSystem(26912); IGeographicCoordinateSystem arcGeographicCoordSysWgs84 = srFactory.CreateGeographicCoordinateSystem(4326);//esriSRGeoCS_WGS1984 4326 WGS 1984. //get the point on the map that was clicked on IPoint pMapPoint = new ESRI.ArcGIS.Geometry.Point(); pMapPoint.X = Convert.ToDouble(pEnvelope.XMax); pMapPoint.Y = Convert.ToDouble(pEnvelope.YMax); //give the arcmap point a spatial reference pMapPoint.SpatialReference = arcProjCoordSysUTM12_North; //reproject that point to nad83 arizona central state plane pMapPoint.Project(arcGeographicCoordSysWgs84); //MessageBox.Show(pMapPoint.X + ", " + pMapPoint.Y, "caption", MessageBoxButtons.OK, MessageBoxIcon.Information); //open the default internet browser and pass in the apn number to the assessor's gis website, and then zoom to the apn System.Diagnostics.Process.Start("https://maps.google.com/maps?q=&layer=c&cbll=" + pMapPoint.Y + "," + pMapPoint.X + "&cbp=12,0,0,0,0"); //deactivate the tool //this.m_deactivate = true; //this.Deactivate(); //base.Deactivate(); //this.Deactivate(); } catch (Exception ex) { MessageBox.Show("Error Message: " + Environment.NewLine + ex.Message + Environment.NewLine + Environment.NewLine + "Error Source: " + Environment.NewLine + ex.Source + Environment.NewLine + Environment.NewLine + "Error Location:" + Environment.NewLine + ex.StackTrace, "UTRANS Editor tool error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public static IPoint GsToMapPoint(double x, double y, double z) { Config config = Config.Instance; SpatialReference spatRel = config.SpatialReference; ISpatialReference gsSpatialReference = (spatRel == null) ? SpatialReference : spatRel.SpatialRef; IPoint point = new Point { X = x, Y = y, Z = z, SpatialReference = gsSpatialReference }; point.Project(SpatialReference); return(point); }
public static IPoint XY2JWD(double x, double y, int gcsType, int pcsType) { try { IPoint point = new ESRI.ArcGIS.Geometry.Point(); point.PutCoords(x, y); ISpatialReferenceFactory factory = new SpatialReferenceEnvironment(); point.SpatialReference = factory.CreateProjectedCoordinateSystem(pcsType); point.Project(factory.CreateGeographicCoordinateSystem(gcsType)); return(point); } catch { return(null); } }
public static IPoint XY2JYD(ISpatialReference aSR, IPoint pXY) { IPoint point = new ESRI.ArcGIS.Geometry.Point(); point = (pXY as IClone).Clone() as IPoint; if (aSR == null) { return(point); } if (aSR.Name != "Unknown") { point.SpatialReference = aSR; point.SnapToSpatialReference(); if (aSR is IProjectedCoordinateSystem) { IGeographicCoordinateSystem system = (aSR as IProjectedCoordinateSystem).GeographicCoordinateSystem; point.Project(system); } return(point); } return(null); }
protected override void OnMouseUp(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg) { bool abortOperation = false; ESRI.ArcGIS.Schematic.ISchematicOperation schematicOperation = null; try { if (m_dockableDigit == null) { return; } if (arg != null) { m_x = arg.X; m_y = arg.Y; } if (m_dockableWindow == null) { return; } if (m_dockableWindow.IsVisible() == false) { m_dockableWindow.Show(true); } ESRI.ArcGIS.SchematicControls.ISchematicTarget target = (ESRI.ArcGIS.SchematicControls.ISchematicTarget)m_schematicExtension; if (target != null) { m_schematicLayer = target.SchematicTarget; } if (m_schematicLayer == null) { System.Windows.Forms.MessageBox.Show("No target Layer"); return; } ISchematicInMemoryDiagram inMemoryDiagram; ISchematicInMemoryFeatureClass schematicInMemoryFeatureClass; ISchematicInMemoryFeatureClassContainer schematicInMemoryFeatureClassContainer; //Get the point ESRI.ArcGIS.Geometry.Point point = new ESRI.ArcGIS.Geometry.Point(); ESRI.ArcGIS.ArcMapUI.IMxApplication mxApp; ESRI.ArcGIS.Display.IAppDisplay appDisplay; IScreenDisplay screenDisplay; IDisplay display; IDisplayTransformation transform; ISpatialReference spatialReference; inMemoryDiagram = m_schematicLayer.SchematicInMemoryDiagram; schematicInMemoryFeatureClassContainer = (ISchematicInMemoryFeatureClassContainer)inMemoryDiagram; if (schematicInMemoryFeatureClassContainer == null) { return; } mxApp = (ESRI.ArcGIS.ArcMapUI.IMxApplication)m_app; if (mxApp == null) { return; } appDisplay = mxApp.Display; if (appDisplay == null) { return; } screenDisplay = appDisplay.FocusScreen; display = screenDisplay; if (display == null) { return; } transform = display.DisplayTransformation; if (transform == null) { return; } spatialReference = transform.SpatialReference; WKSPoint mapPt = new WKSPoint(); ESRI.ArcGIS.Display.tagPOINT devPoint; devPoint.x = m_x; devPoint.y = m_y; transform.TransformCoords(ref mapPt, ref devPoint, 1, 1); //'esriTransformToMap point.SpatialReference = spatialReference; point.Project(spatialReference); point.X = mapPt.X; point.Y = mapPt.Y; schematicInMemoryFeatureClass = schematicInMemoryFeatureClassContainer.GetSchematicInMemoryFeatureClass(m_dockableDigit.FeatureClass()); if (schematicInMemoryFeatureClass == null) { System.Windows.Forms.MessageBox.Show("Invalid Type."); return; } if (m_dockableDigit.CreateNode()) { //TestMandatoryField m_dockableDigit.btnOKPanel1.Visible = false; if (m_dockableDigit.ValidateFields() == false) { m_dockableDigit.x(m_x); m_dockableDigit.y(m_y); System.Windows.Forms.MessageBox.Show(m_dockableDigit.ErrorProvider1.GetError(m_dockableDigit.btnOKPanel1) + m_messageFromOK); return; } ESRI.ArcGIS.Geometry.IGeometry geometry; ISchematicInMemoryFeature schematicInMemoryFeatureNode; geometry = point; schematicOperation = (ESRI.ArcGIS.Schematic.ISchematicOperation) new ESRI.ArcGIS.SchematicControls.SchematicOperation(); //digit operation is undo(redo)able we add it in the stack IMxDocument doc = (IMxDocument)m_app.Document; ESRI.ArcGIS.SystemUI.IOperationStack operationStack; operationStack = doc.OperationStack; operationStack.Do(schematicOperation); schematicOperation.StartOperation("Digit", m_app, m_schematicLayer, true); //do abort operation abortOperation = true; schematicInMemoryFeatureNode = schematicInMemoryFeatureClass.CreateSchematicInMemoryFeatureNode(geometry, ""); //schematicInMemoryFeatureNode.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusNew; if we want the node deleted after update schematicInMemoryFeatureNode.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusLocked; abortOperation = false; schematicOperation.StopOperation(); ISchematicFeature schematicFeature = schematicInMemoryFeatureNode; m_dockableDigit.FillValue(ref schematicFeature); if (m_dockableDigit.AutoClear()) { m_dockableDigit.SelectionChanged(); } } else { m_dockableDigit.btnOKPanel2.Visible = false; //Get the Tolerance of ArcMap Double tolerance; IMxDocument mxDocument = (ESRI.ArcGIS.ArcMapUI.IMxDocument)m_app.Document; ESRI.ArcGIS.esriSystem.WKSPoint point2 = new WKSPoint(); ESRI.ArcGIS.Display.tagPOINT devPt; tolerance = mxDocument.SearchTolerancePixels; devPt.x = (int)tolerance; devPt.y = (int)tolerance; transform.TransformCoords(ref point2, ref devPt, 1, 2); //2 <-> esriTransformSize 4 <-> esriTransformToMap tolerance = point2.X * 5; //increase the tolerance value IEnumSchematicFeature schematicFeatures = m_schematicLayer.GetSchematicFeaturesAtPoint(point, tolerance, false, true); ISchematicFeature schematicFeatureSelected = null; double distancetmp; double distance = 0; schematicFeatures.Reset(); if (schematicFeatures.Count <= 0) { return; } //pSchematicFeatures may contain several features, we are choosing the closest node. ISchematicFeature schematicFeature2 = schematicFeatures.Next(); double dX; double dY; ISchematicInMemoryFeatureNode schematicInMemoryFeatureNode = null; if (schematicFeature2 != null) { if (schematicFeature2.SchematicElementClass.SchematicElementType == ESRI.ArcGIS.Schematic.esriSchematicElementType.esriSchematicNodeType) { schematicInMemoryFeatureNode = (ISchematicInMemoryFeatureNode)schematicFeature2; } } ISchematicInMemoryFeatureNodeGeometry schematicInMemoryFeatureNodeGeometry = (ISchematicInMemoryFeatureNodeGeometry)schematicInMemoryFeatureNode; dX = schematicInMemoryFeatureNodeGeometry.Position.X; dY = schematicInMemoryFeatureNodeGeometry.Position.Y; schematicFeatureSelected = schematicFeature2; distance = SquareDistance(dX - point.X, dY - point.Y); while (schematicFeature2 != null) { //find the closest featureNode... if (schematicInMemoryFeatureNode != null) { schematicInMemoryFeatureNodeGeometry = (ISchematicInMemoryFeatureNodeGeometry)schematicInMemoryFeatureNode; if (schematicInMemoryFeatureNodeGeometry == null) { continue; } dX = schematicInMemoryFeatureNodeGeometry.Position.X; dY = schematicInMemoryFeatureNodeGeometry.Position.Y; distancetmp = SquareDistance(dX - point.X, dY - point.Y); if (distancetmp < distance) { distance = distancetmp; schematicFeatureSelected = schematicFeature2; } } schematicFeature2 = schematicFeatures.Next(); if (schematicFeature2 != null) { if (schematicFeature2.SchematicElementClass.SchematicElementType == ESRI.ArcGIS.Schematic.esriSchematicElementType.esriSchematicNodeType) { schematicInMemoryFeatureNode = (ISchematicInMemoryFeatureNode)schematicFeature2; } } } if (schematicFeatureSelected == null) { return; } if (schematicFeatureSelected.SchematicElementClass.SchematicElementType != esriSchematicElementType.esriSchematicNodeType) { return; } if (m_schematicFeature1 == null) { m_schematicFeature1 = schematicFeatureSelected; m_dockableDigit.SchematicFeature1(m_schematicFeature1); if (!m_dockableDigit.CheckValidFeature(true)) { m_schematicFeature1 = null; m_dockableDigit.SchematicFeature1(m_schematicFeature1); throw new Exception("Invalid starting node for this link type"); } //Begin Feedback m_linkFbk = new NewLineFeedback(); m_linkFbk.Display = screenDisplay; //symbol ISimpleLineSymbol sLnSym; IRgbColor rGB = new RgbColor(); sLnSym = (ESRI.ArcGIS.Display.ISimpleLineSymbol)m_linkFbk.Symbol; //Make a color rGB.Red = 255; rGB.Green = 0; rGB.Blue = 0; // Setup the symbol with color and style sLnSym.Color = rGB; m_linkFbk.Start(point); //End Feedback //To know if we are in the same diagram. m_schematicLayerForLink = m_schematicLayer; } else { if (m_schematicLayerForLink != m_schematicLayer) { System.Windows.Forms.MessageBox.Show("wrong Target layer"); m_schematicLayerForLink = null; EndFeedBack(); return; } m_schematicFeature2 = schematicFeatureSelected; m_dockableDigit.SchematicFeature2(m_schematicFeature2); //TestMandatoryField if (m_dockableDigit.ValidateFields() == false) { m_dockableDigit.x(m_x); m_dockableDigit.y(m_y); System.Windows.Forms.MessageBox.Show(m_dockableDigit.ErrorProvider1.GetError(m_dockableDigit.btnOKPanel2) + m_messageFromOK); return; } if (!m_dockableDigit.CheckValidFeature(false)) { m_schematicFeature2 = null; m_dockableDigit.SchematicFeature2(m_schematicFeature2); throw new Exception("Invalid End node for this link type"); } //CreateLink ISchematicInMemoryFeature schematicInMemoryFeatureLink; schematicOperation = (ESRI.ArcGIS.Schematic.ISchematicOperation) new ESRI.ArcGIS.SchematicControls.SchematicOperation(); //digit operation is undo(redo)able we add it in the stack IMxDocument doc = (IMxDocument)m_app.Document; ESRI.ArcGIS.SystemUI.IOperationStack operationStack; operationStack = doc.OperationStack; operationStack.Do(schematicOperation); schematicOperation.StartOperation("Digit", m_app, m_schematicLayer, true); //do abort operation abortOperation = true; schematicInMemoryFeatureLink = schematicInMemoryFeatureClass.CreateSchematicInMemoryFeatureLink((ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureNode)m_schematicFeature1, (ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureNode)m_schematicFeature2, ""); //schematicInMemoryFeatureLink.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusNew; if we want the node deleted after update schematicInMemoryFeatureLink.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusLocked; abortOperation = false; schematicOperation.StopOperation(); ISchematicFeature schematicFeature = schematicInMemoryFeatureLink; m_dockableDigit.FillValue(ref schematicFeature); //End Feedback EndFeedBack(); m_schematicLayerForLink = null; if (m_dockableDigit.AutoClear()) { m_dockableDigit.SelectionChanged(); } } } //Refresh the view and viewer windows RefreshView(); } catch (System.Exception e) { if (abortOperation && (schematicOperation != null)) { schematicOperation.AbortOperation(); } EndFeedBack(); System.Windows.Forms.MessageBox.Show(e.Message); } return; }
protected override void OnMouseUp(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg) { bool abortOperation = false; ESRI.ArcGIS.Schematic.ISchematicOperation schematicOperation = null; try { if (m_dockableDigit == null) return; if (arg != null) { m_x = arg.X; m_y = arg.Y; } if (m_dockableWindow == null) return; if (m_dockableWindow.IsVisible() == false) { m_dockableWindow.Show(true); } ESRI.ArcGIS.SchematicControls.ISchematicTarget target = (ESRI.ArcGIS.SchematicControls.ISchematicTarget)m_schematicExtension; if (target != null) m_schematicLayer = target.SchematicTarget; if (m_schematicLayer == null) { System.Windows.Forms.MessageBox.Show("No target Layer"); return; } ISchematicInMemoryDiagram inMemoryDiagram; ISchematicInMemoryFeatureClass schematicInMemoryFeatureClass; ISchematicInMemoryFeatureClassContainer schematicInMemoryFeatureClassContainer; //Get the point ESRI.ArcGIS.Geometry.Point point = new ESRI.ArcGIS.Geometry.Point(); ESRI.ArcGIS.ArcMapUI.IMxApplication mxApp; ESRI.ArcGIS.Display.IAppDisplay appDisplay; IScreenDisplay screenDisplay; IDisplay display; IDisplayTransformation transform; ISpatialReference spatialReference; inMemoryDiagram = m_schematicLayer.SchematicInMemoryDiagram; schematicInMemoryFeatureClassContainer = (ISchematicInMemoryFeatureClassContainer)inMemoryDiagram; if (schematicInMemoryFeatureClassContainer == null) return; mxApp = (ESRI.ArcGIS.ArcMapUI.IMxApplication)m_app; if (mxApp == null) return; appDisplay = mxApp.Display; if (appDisplay == null) return; screenDisplay = appDisplay.FocusScreen; display = screenDisplay; if (display == null) return; transform = display.DisplayTransformation; if (transform == null) return; spatialReference = transform.SpatialReference; WKSPoint mapPt = new WKSPoint(); ESRI.ArcGIS.Display.tagPOINT devPoint; devPoint.x = m_x; devPoint.y = m_y; transform.TransformCoords(ref mapPt, ref devPoint, 1, 1); //'esriTransformToMap point.SpatialReference = spatialReference; point.Project(spatialReference); point.X = mapPt.X; point.Y = mapPt.Y; schematicInMemoryFeatureClass = schematicInMemoryFeatureClassContainer.GetSchematicInMemoryFeatureClass(m_dockableDigit.FeatureClass()); if (schematicInMemoryFeatureClass == null) { System.Windows.Forms.MessageBox.Show("Invalid Type."); return; } if (m_dockableDigit.CreateNode()) { //TestMandatoryField m_dockableDigit.btnOKPanel1.Visible = false; if (m_dockableDigit.ValidateFields() == false) { m_dockableDigit.x(m_x); m_dockableDigit.y(m_y); System.Windows.Forms.MessageBox.Show(m_dockableDigit.ErrorProvider1.GetError(m_dockableDigit.btnOKPanel1) + m_messageFromOK); return; } ESRI.ArcGIS.Geometry.IGeometry geometry; ISchematicInMemoryFeature schematicInMemoryFeatureNode; geometry = point; schematicOperation = (ESRI.ArcGIS.Schematic.ISchematicOperation) new ESRI.ArcGIS.SchematicControls.SchematicOperation(); //digit operation is undo(redo)able we add it in the stack IMxDocument doc = (IMxDocument)m_app.Document; ESRI.ArcGIS.SystemUI.IOperationStack operationStack; operationStack = doc.OperationStack; operationStack.Do(schematicOperation); schematicOperation.StartOperation("Digit", m_app, m_schematicLayer, true); //do abort operation abortOperation = true; schematicInMemoryFeatureNode = schematicInMemoryFeatureClass.CreateSchematicInMemoryFeatureNode(geometry, ""); //schematicInMemoryFeatureNode.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusNew; if we want the node deleted after update schematicInMemoryFeatureNode.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusLocked; abortOperation = false; schematicOperation.StopOperation(); ISchematicFeature schematicFeature = schematicInMemoryFeatureNode; m_dockableDigit.FillValue(ref schematicFeature); if (m_dockableDigit.AutoClear()) m_dockableDigit.SelectionChanged(); } else { m_dockableDigit.btnOKPanel2.Visible = false; //Get the Tolerance of ArcMap Double tolerance; IMxDocument mxDocument = (ESRI.ArcGIS.ArcMapUI.IMxDocument)m_app.Document; ESRI.ArcGIS.esriSystem.WKSPoint point2 = new WKSPoint(); ESRI.ArcGIS.Display.tagPOINT devPt; tolerance = mxDocument.SearchTolerancePixels; devPt.x = (int)tolerance; devPt.y = (int)tolerance; transform.TransformCoords(ref point2, ref devPt, 1, 2);//2 <-> esriTransformSize 4 <-> esriTransformToMap tolerance = point2.X * 5;//increase the tolerance value IEnumSchematicFeature schematicFeatures = m_schematicLayer.GetSchematicFeaturesAtPoint(point, tolerance, false, true); ISchematicFeature schematicFeatureSelected = null; double distancetmp; double distance = 0; schematicFeatures.Reset(); if (schematicFeatures.Count <= 0) return; //pSchematicFeatures may contain several features, we are choosing the closest node. ISchematicFeature schematicFeature2 = schematicFeatures.Next(); double dX; double dY; ISchematicInMemoryFeatureNode schematicInMemoryFeatureNode = null; if (schematicFeature2 != null) { if (schematicFeature2.SchematicElementClass.SchematicElementType == ESRI.ArcGIS.Schematic.esriSchematicElementType.esriSchematicNodeType) schematicInMemoryFeatureNode = (ISchematicInMemoryFeatureNode)schematicFeature2; } ISchematicInMemoryFeatureNodeGeometry schematicInMemoryFeatureNodeGeometry = (ISchematicInMemoryFeatureNodeGeometry)schematicInMemoryFeatureNode; dX = schematicInMemoryFeatureNodeGeometry.Position.X; dY = schematicInMemoryFeatureNodeGeometry.Position.Y; schematicFeatureSelected = schematicFeature2; distance = SquareDistance(dX - point.X, dY - point.Y); while (schematicFeature2 != null) { //find the closest featureNode... if (schematicInMemoryFeatureNode != null) { schematicInMemoryFeatureNodeGeometry = (ISchematicInMemoryFeatureNodeGeometry) schematicInMemoryFeatureNode; if (schematicInMemoryFeatureNodeGeometry == null) continue; dX = schematicInMemoryFeatureNodeGeometry.Position.X; dY = schematicInMemoryFeatureNodeGeometry.Position.Y; distancetmp = SquareDistance(dX - point.X, dY - point.Y); if (distancetmp < distance) { distance = distancetmp; schematicFeatureSelected = schematicFeature2; } } schematicFeature2 = schematicFeatures.Next(); if (schematicFeature2 != null) { if (schematicFeature2.SchematicElementClass.SchematicElementType == ESRI.ArcGIS.Schematic.esriSchematicElementType.esriSchematicNodeType) schematicInMemoryFeatureNode = (ISchematicInMemoryFeatureNode)schematicFeature2; } } if (schematicFeatureSelected == null) return; if (schematicFeatureSelected.SchematicElementClass.SchematicElementType != esriSchematicElementType.esriSchematicNodeType) return; if (m_schematicFeature1 == null) { m_schematicFeature1 = schematicFeatureSelected; m_dockableDigit.SchematicFeature1(m_schematicFeature1); if (!m_dockableDigit.CheckValidFeature(true)) { m_schematicFeature1 = null; m_dockableDigit.SchematicFeature1(m_schematicFeature1); throw new Exception("Invalid starting node for this link type"); } //Begin Feedback m_linkFbk = new NewLineFeedback(); m_linkFbk.Display = screenDisplay; //symbol ISimpleLineSymbol sLnSym; IRgbColor rGB = new RgbColor(); sLnSym = (ESRI.ArcGIS.Display.ISimpleLineSymbol)m_linkFbk.Symbol; //Make a color rGB.Red = 255; rGB.Green = 0; rGB.Blue = 0; // Setup the symbol with color and style sLnSym.Color = rGB; m_linkFbk.Start(point); //End Feedback //To know if we are in the same diagram. m_schematicLayerForLink = m_schematicLayer; } else { if (m_schematicLayerForLink != m_schematicLayer) { System.Windows.Forms.MessageBox.Show("wrong Target layer"); m_schematicLayerForLink = null; EndFeedBack(); return; } m_schematicFeature2 = schematicFeatureSelected; m_dockableDigit.SchematicFeature2(m_schematicFeature2); //TestMandatoryField if (m_dockableDigit.ValidateFields() == false) { m_dockableDigit.x(m_x); m_dockableDigit.y(m_y); System.Windows.Forms.MessageBox.Show(m_dockableDigit.ErrorProvider1.GetError(m_dockableDigit.btnOKPanel2) + m_messageFromOK); return; } if (!m_dockableDigit.CheckValidFeature(false)) { m_schematicFeature2 = null; m_dockableDigit.SchematicFeature2(m_schematicFeature2); throw new Exception("Invalid End node for this link type"); } //CreateLink ISchematicInMemoryFeature schematicInMemoryFeatureLink; schematicOperation = (ESRI.ArcGIS.Schematic.ISchematicOperation) new ESRI.ArcGIS.SchematicControls.SchematicOperation(); //digit operation is undo(redo)able we add it in the stack IMxDocument doc = (IMxDocument)m_app.Document; ESRI.ArcGIS.SystemUI.IOperationStack operationStack; operationStack = doc.OperationStack; operationStack.Do(schematicOperation); schematicOperation.StartOperation("Digit", m_app, m_schematicLayer, true); //do abort operation abortOperation = true; schematicInMemoryFeatureLink = schematicInMemoryFeatureClass.CreateSchematicInMemoryFeatureLink((ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureNode)m_schematicFeature1, (ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureNode)m_schematicFeature2, ""); //schematicInMemoryFeatureLink.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusNew; if we want the node deleted after update schematicInMemoryFeatureLink.UpdateStatus = esriSchematicUpdateStatus.esriSchematicUpdateStatusLocked; abortOperation = false; schematicOperation.StopOperation(); ISchematicFeature schematicFeature = schematicInMemoryFeatureLink; m_dockableDigit.FillValue(ref schematicFeature); //End Feedback EndFeedBack(); m_schematicLayerForLink = null; if (m_dockableDigit.AutoClear()) m_dockableDigit.SelectionChanged(); } } //Refresh the view and viewer windows RefreshView(); } catch (System.Exception e) { if (abortOperation && (schematicOperation != null)) schematicOperation.AbortOperation(); EndFeedBack(); System.Windows.Forms.MessageBox.Show(e.Message); } return; }