POST
|
Ok didnt know that. You dont know how to fix existing featureclass data that now shows in the data view.
... View more
06-01-2017
11:19 AM
|
0
|
0
|
484
|
POST
|
I have this wierd problem i guess. I have made some code that creates an shapefile with pointdata but when the layer is added the points are not visible but the layer contains data. Are I missing something: public void addDataToMap(string folder, string shapefilename) { pMap = mDoc.FocusMap; string strFolder = folder; string strName = shapefilename; string strShapeFileName = "Shape"; string strLatitude = "Latitude"; string strLongitude = "Longitude"; string strLocationName = "Name"; IFeatureWorkspace pFWS; IWorkspaceFactory pWorkspaceFactory; pWorkspaceFactory = new ShapefileWorkspaceFactory(); pFWS = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(strFolder, 0); //FIELDS SETUP IFields pFields; IFieldsEdit pFieldsEdit; pFields = new Fields(); pFieldsEdit = (IFieldsEdit)pFields; //FIELD 0 IField pField; IFieldEdit pFieldEdit; pField = new Field(); pFieldEdit = (IFieldEdit)pField; pFieldEdit.Name_2 = strShapeFileName; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; pFieldsEdit.AddField(pField); //FIELD 1 IField pField1; IFieldEdit pFieldEdit1; pField1 = new Field(); pFieldEdit1 = (IFieldEdit)pField1; pFieldEdit1.Name_2 = strLatitude; pFieldEdit1.Type_2 = esriFieldType.esriFieldTypeDouble; pFieldsEdit.AddField(pField1); //FIELD 2 IField pField2; IFieldEdit pFieldEdit2; pField2 = new Field(); pFieldEdit2 = (IFieldEdit)pField2; pFieldEdit2.Name_2 = strLongitude; pFieldEdit2.Type_2 = esriFieldType.esriFieldTypeDouble; pFieldsEdit.AddField(pField2); //FIELD 3 IField pField3; IFieldEdit pFieldEdit3; pField3 = new Field(); pFieldEdit3 = (IFieldEdit)pField3; pFieldEdit3.Name_2 = strLocationName; pFieldEdit3.Type_2 = esriFieldType.esriFieldTypeString; pFieldsEdit.AddField(pField3); IGeometryDef pGeomDef; IGeometryDefEdit pGeomDefEdit; pGeomDef = new GeometryDef(); pGeomDefEdit = (IGeometryDefEdit)pGeomDef; pGeomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint; //Spatialreference setup ISpatialReferenceFactory SRF = new SpatialReferenceEnvironmentClass(); ISpatialReference SR = SRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_World_Mercator); ISpatialReferenceResolution SRR = (ISpatialReferenceResolution)SR; SRR.ConstructFromHorizon(); ISpatialReferenceTolerance SRT = (ISpatialReferenceTolerance)SR; SRT.SetDefaultXYTolerance(); pGeomDefEdit.SpatialReference_2 = SR; pFieldEdit.GeometryDef_2 = pGeomDef; IFeatureClass pFeatClass; pFeatClass = pFWS.CreateFeatureClass(strName, pFields, null, null, esriFeatureType.esriFTSimple, strShapeFileName, ""); IFeatureLayer pFeaturelayer = new FeatureLayerClass(); pFeaturelayer.FeatureClass = pFeatClass; pFeaturelayer.Name = pFeatClass.AliasName; data = handler.getPointData(); for (int i = 1; i < data.Count; i++) { IFeature pNewFeature; pNewFeature = pFeatClass.CreateFeature(); pNewFeature.Value[2] = data.getLatgAsDouble(); pNewFeature.Value[3] = data.getLngAsDouble(); pNewFeature.Value[4] = data.getName(); pNewFeature.Store(); } pMap.AddLayer(pFeaturelayer); mDoc.UpdateContents(); mDoc.ActiveView.Refresh(); }
... View more
06-01-2017
03:35 AM
|
0
|
0
|
494
|
POST
|
Hey. I solved it by doing this: ICommandItem deepARCTool = ArcMap.Application.Document.CommandBars.Find("deepARC_GDLM_Root"); ArcMap.Application.CurrentTool = deepARCTool; But I have another problem. I am using this to also open a dockable window. So how can I toggle the dockable window as when using a button? Now I press my tool in the toolbar and my dockable window opens. If I close the dockable windows and press the tool again in the toolbar the dockable windows wont open. Must I set the dockable windows to null or how is this made?
... View more
06-01-2017
02:51 AM
|
0
|
2
|
484
|
POST
|
Hey everybody. I have a little question. I know that what I want to do this can be done with just adding a Tool Add-in but I want to do this from my Docked window. I have a checkbox and when it is checked I override the OnMouseDown for the docked window but I want to listen to the OnMouseDown in the IMxDocument. Here is my code so far: protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (mapLocation.Checked) { System.Windows.Forms.Cursor.Current = Cursors.Arrow; IMxDocument mDoc = ArcMap.Application.Document as IMxDocument; IPoint mPoint; mPoint = mDoc.CurrentLocation; double lng, lat; lng = mPoint.X; lat = mPoint.Y; MessageBox.Show(lng+", "+lat,"Retrived Map Data"); } } So I would like this code to fire when I pressing in the Data View and not in the Dockable Window as it does now. Thankful for answers.
... View more
05-21-2017
11:42 AM
|
0
|
4
|
1243
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|