How to let the user select a spatial reference using ArcObjects?

المشرف العام

Administrator
طاقم الإدارة
I need to build a tool where the user selects a coordinate system for a given CAD file. What is the easiest way to do this with ArcObjects?

Obviously, I could populate a list with the hundreds of projection constants (i.e. esrSRProjCSType), but what user is going to want to scroll through such a huge list? Must be a better way... any tips?

Update:

Thanks everybody. I went with the SpatialReferenceDialog approach below. Now, anybody know how to use NewGeoTransformationDialog to apply datum trans?

private void btn_getCs_Click(object sender, EventArgs e) { string StatusMsg = ""; bool Status = true; SpatialReferenceDialog oSpatialReferenceDialog = null; ISpatialReference oSpatialReference = null; ISpatialReferenceFactory2 oSpatialReferenceFactory2 = null; IGeographicCoordinateSystem oGCS = null; try { oSpatialReferenceFactory2 = (SpatialReferenceEnvironmentClass)new SpatialReferenceEnvironmentClass(); oGCS = oSpatialReferenceFactory2.CreateGeographicCoordinateSystem(esriSRGeoCSType.esriSRGeoCS_WGS1984.GetHashCode()); oSpatialReferenceDialog = new SpatialReferenceDialogClass(); oSpatialReference = oSpatialReferenceDialog.DoModalEdit(oGCS, false, false, false, false, true, this.Handle.ToInt32()); txtBx_srDwg.Text = oSpatialReference.Name; } catch (System.Runtime.InteropServices.COMException CE) { StatusMsg = CE.ErrorCode.ToString() + ": " + CE.Message; Status = false; } catch (Exception E) { StatusMsg = E.ToString(); Status = false; } finally { }}

أكثر...
 
أعلى