POST
|
Thanks a lot... It was my answer.. can u help me in one more thing.... if i want to select feature on mousedown event---> first,i created a point,then i buffered it. now i need to check whether this point intersects with any other feature(i have a polyline shapefile also) If it does intersect then that line shud be selected.... I used spatial filter but it returns null value can u check the code please: public void OnMouseDown(int button, int shift, int x, int y) { // # region attribute activeView = m_mxDoc.ActiveView; IPoint ppoint = new PointClass(); ppoint = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); ITopologicalOperator topologicalOperator = ppoint as ITopologicalOperator; IGeometry gm = topologicalOperator.Buffer(1); ISpatialFilter spatialFilter = new SpatialFilterClass(); IMap map = activeView.FocusMap; pageLayout = (PageLayout)m_mxDoc.PageLayout; l1 = map.get_Layer(0); l2 = map.get_Layer(1); if (l1.Name == "SSE_Access") { layer_working = l1; } else if (l2.Name == "SSE_Access") { layer_working = l2; } else { layer_working = null; MessageBox.Show("Layer for attribute information does not exists"); } IFeatureLayer pfl = (IFeatureLayer)layer_working; IFeatureClass featureClass = pfl.FeatureClass; spatialFilter.GeometryField = featureClass.ShapeFieldName; spatialFilter.Geometry = gm; spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; IFeatureCursor featureCursor1 = featureClass.Search(spatialFilter, true); IFeature Feat1 = featureCursor1.NextFeature(); while (Feat1 != null) { map.SelectFeature(layer_working, Feat1); Feat1 = featureCursor1.NextFeature(); } thanks in adv.
... View more
12-09-2010
02:03 AM
|
0
|
0
|
521
|
POST
|
Hi, actualy my task is that as we can see in arcmap if we need to include image in the page layout mode then we have inbuilt picturebox to add picture but my task is to implement the same with the code i.e i need to write code in c# to display a picture in pagelayout mode... I have a point shapefile that has a field that contain the path of the picture.I want on mouse down event if i mouse down on a point it should be highlighted and the corresponding picture shud be dispalyed.I want in c# its urgent
... View more
12-08-2010
09:24 PM
|
0
|
0
|
521
|
POST
|
I want the code in c# please help.its urgent Hi I want to implement that on select of a point in the shapefile in the pagelayout mode it should display an image(in graphic container). I got several codes involving vb but i cant understand vb so can any1 provide me a code that can help me. I know it has an inbuilt feature for adding a picture but i want to implement through programming. its urgent
... View more
12-08-2010
01:49 PM
|
0
|
0
|
521
|
POST
|
Hi I want to implement that on select of a point in the shapefile in the pagelayout mode it should display an image(in graphic container). I got several codes involving vb but i cant understand vb so can any1 provide me a code that can help me. I know it has an inbuilt feature for adding a picture but i want to implement through programming. its urgent
... View more
12-08-2010
08:00 AM
|
0
|
6
|
1145
|
POST
|
Done its working now...i didn't set the page layout...
... View more
12-07-2010
09:04 PM
|
0
|
0
|
138
|
POST
|
Hi I want to add a legend to the page layout in arcmap.I got the code as: IMap map = activeView.FocusMap; pageLayout = new PageLayoutClass(); IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer; IFrameElement frameElement = graphicsContainer.FindFrame(map); IMapFrame mapFrame = (IMapFrame)frameElement; IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass(); IMapSurround pMapsurround; UID elementUID = new UIDClass(); //The value determines the type of MapSurroundFrame being added. elementUID.Value = "esriCarto.Legend"; MessageBox.Show(elementUID.Value.ToString()); //The CreateSurroundFrame method takes the UID of the element and an optional style. mapSurroundFrame = mapFrame.CreateSurroundFrame(elementUID,null); //pMapsurround = mapSurroundFrame.MapSurround; mapSurroundFrame.MapSurround.Name = "Legend"; //Cast the MapSurroundFrame as an element so it can be inserted into the page layout. IElement doc_Element = mapSurroundFrame as IElement; IElement mainMap_Element = mapFrame as IElement; IGeometry geometry = mainMap_Element.Geometry; IEnvelope mainMap_Envelope = geometry.Envelope; MessageBox.Show("start3"); IEnvelope envelope = new EnvelopeClass(); double xMin = mainMap_Envelope.XMax + 1.5; double yMin = mainMap_Envelope.YMin + 1.5; double xMax = mainMap_Envelope.XMax - 1.5; double yMax = mainMap_Envelope.YMax - 1.5; envelope.PutCoords(xMin, yMin, xMax, yMax); doc_Element.Geometry = envelope as IGeometry; doc_Element.Activate(activeView.ScreenDisplay); graphicsContainer.AddElement(doc_Element, 0); activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); but while implementing the above code i get error in highlighted line mapSurroundFrame = mapFrame.CreateSurroundFrame(elementUID,null); the code breaks here resulting in no output.Please help! Yashika
... View more
12-07-2010
07:59 PM
|
0
|
2
|
781
|
POST
|
Hi every1, My task is to compare the attributes of two shape files. my code(which is shown below)works fine on small data.no issues but if i have shapefiles of lets say 5000 records it takes a very long time.I want my tool to work on lacs of records with a very fast speed.can any1 help me with the solution. my code is: //using System; //using System.Collections.Generic; //using System.Text; //namespace blobcompare //{ // public class Class1 // { // } //} using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; //using System.Drawing; using System.Text; using System.Windows.Forms; using ESRI.ArcGIS.ArcMapUI; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Framework; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.SystemUI; using System.Runtime.InteropServices; using ESRI.ArcGIS.ADF.CATIDs; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.Controls; using System.IO; namespace blobcompare { [Guid("cc38d134-fe98-41e5-989f-dc36d8d9caba")] [ClassInterface(ClassInterfaceType.None)] [ProgId("blobcompare.Class1")] [ComVisible(true)] public class Class1 : ICommand { //private IHookHelper m_hookHelper = null; [System.Runtime.InteropServices.DllImport("gdi32.dll")] static extern bool DeleteObject(IntPtr hObject); #region "Component Category Registration" [ComRegisterFunction()] static void Reg(string regKey) { MxCommands.Register(regKey); } [ComUnregisterFunction()] static void Unreg(string regKey) { MxCommands.Unregister(regKey); } #endregion public ILayer layer1; public ILayer layer2; public IMxApplication mxApplication; //to create application display object IApplication m_application; private IntPtr m_hBitmap; public IApplication m_app1; public IApplication m_app; public IMxDocument m_mxDoc; public MxDocument m_mxDocument; public Map m_map; public PageLayout m_pageLayout; //private System.Windows.Forms.Button button1; public IFeatureClass featureClass; //public TextWriter txt = new StreamWriter("abc.txt"); private bool m_enabled; #region ICommand Members public string Message { get { // Set the message string that appears in the statusbar of the // application when the mouse passes over the command. return "Compare"; //return null; } } public int HelpContextID { get { return 0; } } public string Name { get { return "Compare"; //return null; } } public void OnClick() { IActiveView activeView = m_mxDoc.ActiveView; int count = 0; layer1 = m_map.get_Layer(0); layer2 = m_map.get_Layer(1); try { IFeatureLayer pfl = (IFeatureLayer)layer1; IFeatureLayer pfl1 = (IFeatureLayer)layer2; IFeatureClass featureClass = pfl.FeatureClass; IFeatureClass featureClass1 = pfl1.FeatureClass; IFeatureCursor featureCursor = featureClass.Search(null, true); IFeature Feat = featureCursor.NextFeature(); int count1 = 0; int feildval1 = featureCursor.FindField("BUILDINGID"); int feildval2 = featureCursor.FindField("BLOCKID"); int feildval3 = featureCursor.FindField("ROOFTYPE"); int feildval4 = featureCursor.FindField("ROOFSUB"); int feildval5 = featureCursor.FindField("ARCHTYPE"); int feildval6 = featureCursor.FindField("RIDGE_HT"); int feildval7 = featureCursor.FindField("EAVE_HT"); int feildval8 = featureCursor.FindField("Area"); int feildval9 = featureCursor.FindField("minZ"); string errvals = "FID="; while (Feat != null) { count = 0; IFeatureCursor featureCursor1 = featureClass1.Search(null, true); IFeature Feat1 = featureCursor1.NextFeature(); string buid = Feat.get_Value(feildval1).ToString(); int blkid = Convert.ToInt16(Feat.get_Value(feildval2)); int rftp = Convert.ToInt32(Feat.get_Value(feildval3)); int rfsub = Convert.ToInt32(Feat.get_Value(feildval4)); string arc = Feat.get_Value(feildval5).ToString(); double ridge = Convert.ToDouble(Feat.get_Value(feildval6)); double eave = Convert.ToDouble(Feat.get_Value(feildval7)); double area = Convert.ToDouble(Feat.get_Value(feildval8)); double minz = Convert.ToDouble(Feat.get_Value(feildval9)); while (Feat1 != null) { string buid1 = Feat1.get_Value(feildval1).ToString(); int blkid1 = Convert.ToInt16(Feat1.get_Value(feildval2)); int rftp1 = Convert.ToInt32(Feat1.get_Value(feildval3)); int rfsub1 = Convert.ToInt32(Feat1.get_Value(feildval4)); string arc1 = Feat1.get_Value(feildval5).ToString(); double ridge1 = Convert.ToDouble(Feat1.get_Value(feildval6)); double eave1 = Convert.ToDouble(Feat1.get_Value(feildval7)); double area1 = Convert.ToDouble(Feat1.get_Value(feildval8)); double minz1 = Convert.ToDouble(Feat1.get_Value(feildval9)); if ((buid == buid1) && (blkid == blkid1) && (rftp == rftp1) && (arc == arc1) && (ridge == ridge1) && (eave == eave1) && (minz == minz1) && (area==area1)) { count++; //MessageBox.Show("Count " + count.ToString()); break; } else { errvals += Feat1.OID.ToString() + " or FID="; } Feat1 = featureCursor1.NextFeature(); } if (count < 1) { //txt.WriteLine("values did not match " + Feat.get_Value(feildval1).ToString()); m_map.SelectFeature(layer1, Feat); //m_map.SelectFeature(layer1, Feat); } Feat = featureCursor.NextFeature(); activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); } activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); } catch { MessageBox.Show("Error"); } MessageBox.Show("done"); } public int Bitmap { get { return m_hBitmap.ToInt32(); } } public void OnCreate(object hook) { m_app = hook as IApplication; m_mxDoc = m_app.Document as IMxDocument; m_mxDocument = m_app.Document as MxDocument; m_map = m_mxDoc.FocusMap as Map; } public string Caption { get { return "Compare"; //return null; } } public string Tooltip { get { // Set the string that appears in the screen tip. return "Compare"; //return null; } } public bool Checked { get { return false; } } public bool Enabled { get { // Add some logic here to specify when the command should // be enabled. In this example, the command is always enabled. return true; } } public string HelpFile { get { return null; } } public string Category { get { // Set the category of this command. This determines where the // command appears in the Commands panel of the Customize dialog. return "Compare"; //return null; } } #endregion } }
... View more
10-18-2010
12:53 AM
|
0
|
2
|
431
|
POST
|
I have another machine of same configuration with vs2005 installed on it.On that machine also i again added the .tlb file in arcmap but still it does not load.although it get loaded on my machine with no problem.can any1 guess wat could be the problem
... View more
10-06-2010
08:19 PM
|
0
|
0
|
265
|
POST
|
but neil i think windows 7 already contain the dot net framework.i need not to install it again.still the tool does not load...it shows no new objects added.can u help in this error
... View more
10-06-2010
07:35 PM
|
0
|
0
|
265
|
POST
|
r u sure...is there no way to test the tool made in c# on other machines which do not contain dot net framework......not even a single way???
... View more
10-05-2010
07:24 PM
|
0
|
0
|
265
|
POST
|
Hi everyone!!! I made a tool using c#.when i add that .tlb file to arcmap on my system,it works perfectly but while testing this tool on other machines with the same arcgis version 9.3.1 it doesn't load the tlb file and shows the message "no new objects added".......i have read several threads n tried all possible measures such as component registry,regasm etc but nothing worked....somewhere it is written that the other machine should also contain the dotnet framework but it is not possible in my case....is there any other way so that i can implement the tool on other machine???its really urgent n important.........
... View more
10-05-2010
04:14 AM
|
0
|
5
|
697
|
POST
|
hi i tried to use the above said methods but unable to get the desired result. Can any1 provide me with the code to add the features to an existing shape file so that i can understand.. thanks in advance. Yashika Sareen:confused:
... View more
08-17-2010
10:18 PM
|
0
|
0
|
639
|
POST
|
Hi everyone, Today I am stuck up with a new problem. I need to develop a tool in which i have to add the features to an existing shapefile and store them.I understand only c#.can any1 help me with the code.
... View more
08-17-2010
02:31 AM
|
0
|
4
|
4853
|
POST
|
thanks Brad and Jam.Igot it.Its working now.Thanks for your help. byee.
... View more
08-12-2010
08:14 PM
|
0
|
0
|
283
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|