private void ExperimentalMethod(int objectid, IFeatureLayer newlayer, IFeatureLayer existinglayer) { IFeature newfeature = newlayer.FeatureClass.GetFeature(objectid); IFeature existingfeature = FindNearestAnnotation(newfeature, existinglayer); IGeometry existinggeometry = existingfeature.Shape; IAnnotationFeature annofeat = (IAnnotationFeature)newfeature; IElement element = annofeat.Annotation; element.Activate(ArcMap.Document.ActiveView.ScreenDisplay); element.Geometry = existinggeometry; ITextElement textelement = (ITextElement)element; ITextSymbol symbol = textelement.Symbol; symbol.Angle = (double)existingfeature.get_Value( existingfeature.Fields.FindField("Angle")); symbol.Text = newfeature.get_Value( newfeature.Fields.FindField("TextString")).ToString(); textelement.Symbol = symbol; annofeat.Annotation = (IElement)textelement; newfeature = (IFeature)annofeat; newfeature.Store(); }
// The Selection tracker will �??prep�?? the element�??s geometry for editing (basically smooth it out), // otherwise you can get the geometry right off the element. IAnnotationFeature anno = feature as IAnnotationFeature; IElement element = anno.Annotation; element.Activate(GetDisplay()); IElementEditVertices editVertices = element as IElementEditVertices; ISelectionTracker selectionTracker = editVertices.GetMoveVerticesSelectionTracker(); IGeometry geom = selectionTracker.Geometry; // Modify geometry as you like then reassign back to the element element.Geometry = geom; // Update the feature... editor.StartOperation(); anno.Annotation = element; feature.Store(); editor.StopOperation(�??Some String�?�);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.