1
我對ArcObjects非常陌生。任何人都可以幫助我找到「複製並行」的命名空間,它位於ArcGIS Desktop 10中的編輯器下?如果您可以提供有關如何在Visual Studio 2010中使用它的示例,我將非常感激。如何使用ESRI命名空間「複製並行」所屬的ArcObjects「複製並行」?
我對ArcObjects非常陌生。任何人都可以幫助我找到「複製並行」的命名空間,它位於ArcGIS Desktop 10中的編輯器下?如果您可以提供有關如何在Visual Studio 2010中使用它的示例,我將非常感激。如何使用ESRI命名空間「複製並行」所屬的ArcObjects「複製並行」?
如果您實際上只是試圖執行「Copy Parallel ...」命令...您可以這樣做這
IDocument d = ArcMap.Document as IDocument;
IUID ud = new UIDClass();
ud.Value = "esriEditor.CopyParallelCommand";
ICommandItem c = d.CommandBars.Find(ud);
c.Execute();
如果你想以編程方式複製平行副本,只有我發現是使用IConstructCurve3來模擬天生的操作。這種方法似乎幾乎有相同的參數。
//Get the selection
UID uid = new UIDClass();
uid.Value = "esriEditor.Editor";
IEditor editor;
editor = (IEditor)ArcMap.Application.FindExtensionByCLSID(uid);
//Get Selection
IEnumFeature enumfeature = editor.EditSelection;
IFeature f = enumfeature.Next();
//For adding new features
IFeatureClass fc = f.Class as IFeatureClass;
//Start an operation for undo/redo
editor.StartOperation();
while (f != null)
{
//Interface to do a "copy parallel"
IConstructCurve3 construct = new PolylineClass();
//Rounded, Mitered, etc
object offset = esriConstructOffsetEnum.esriConstructOffsetRounded;
IPolyline source = f.Shape as IPolyline;
//Method call (0.001 or -0.001 determines left/right)
construct.ConstructOffset(source, 0.001, ref offset);
//Storing output shape
IFeature newFeature = fc.CreateFeature();
newFeature.Shape = (IGeometry)construct;
newFeature.Store();
f = enumfeature.Next();
}
editor.StopOperation("Copy Parallel");
//refresh
ArcMap.Document.ActiveView.Refresh();
我只砍死了IConstructCurve3相關的部分,確保你做你的支票,如果慾望,複製源要素屬性了。
如果你有VS2010,如果你只是通過使用ESRI ArcMap Addin項目模板和一個按鈕創建一個Button Addin,這段代碼就會運行。然後將代碼複製並粘貼到OnClick()事件中。 (當然,不要忘記設置必要的esri參考)
我必須先說「謝謝」,然後再進入它。我稍後可能會有更多的問題。非常感謝。 – user1293655 2012-03-27 14:14:46
你的代碼工作得很好。我非常感謝你的幫助。我一直在閱讀ArcObjects SDK 10 Microsoft .NET Framework三週。仍然不確定如何開始編寫代碼。你能指點我從哪裏開始的正確方向嗎?比如我可以在任何書籍或任何指令中找到像「esriEditor.CopyParallelCommand」這樣的命令?我一直在使用ArcGIS桌面,可以編寫python代碼。但我對使用c#的ArcObjects相當陌生。再次感謝。等待你的回覆。 – user1293655 2012-03-27 14:59:59
如果您對ArcObjects完全陌生......我仍然相信ESRI有一些相當不錯的開發文檔。這個網站。 http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html可能是最好的開始。在「演練:」這個詞的內容列表中查找任何內容,並且它幾乎可以逐步擴展。因此,只需打開VS2010,並隨時隨地進行演練,您就會明白。祝你好運。 – JTran 2012-03-28 05:54:45