POST
|
For ExportBMPClass cannot be embedded: Find ESRI.ArcGIS.Output Reference and view the properties. Set Embed Interop Types to false. You can remove the VerifyFile type call and just enter the path name and file name of your output BMP into the variable initializers. Then just run a File.Exists on the file name to see if you need to delete it.
... View more
07-20-2021
10:55 AM
|
0
|
0
|
2279
|
POST
|
An ICommand is something that starts and runs until it is done. If this is your constraint, you may need a second ICommand object to do the stopping. There is also an ITool interface which has a Deactivate function, if you can change your design. Good Luck Brent Hoskisson
... View more
06-24-2021
07:59 AM
|
0
|
0
|
639
|
POST
|
Here is what I use to export to a BMP. There is also an ExportPDFClass() for line 8 with similar functions. Uses ESRI.ArcGIS.Output and VerifyFile merely checks if a file is already there and deletes it if it is. Should be fairly easy to reproduce. Good Luck Brent Hoskisson public static bool ExportActiveView(IMap map, string bmpFile)
{
string pathName = "";
string fileName = "";
if (AOUtilities.VerifyFile(bmpFile, "bmp", out pathName, out fileName))
File.Delete(bmpFile);
IActiveView av = (IActiveView)map;
IExport pExport = new ExportBMPClass();
pExport.ExportFileName = bmpFile;
//pExport.Resolution = 96;
tagRECT eRect = av.ExportFrame;
IEnvelope pPBE = new EnvelopeClass();
pPBE.PutCoords(eRect.left, eRect.top, eRect.right, eRect.bottom);
pExport.PixelBounds = pPBE;
try
{
int hDC = pExport.StartExporting();
av.Output(hDC, Convert.ToInt32(pExport.Resolution), ref eRect, null, null);
pExport.FinishExporting();
return true;
}
catch
{
return false;
}
finally
{
pExport.Cleanup();
}
}
... View more
06-24-2021
07:29 AM
|
1
|
2
|
2480
|
POST
|
You need to spend more time constructing your question so it will be understood. It appears you are trying to to search polygons with a point feature. If this is so you want to start by creating a spatial filter Here is a sample that is set up to intersect: public static ISpatialFilter CreateSpatialFilter(IFeatureClass fc, IGeometry shape)
{
if (fc == null) return null;
ISpatialFilter sf = new SpatialFilterClass();
sf.GeometryField = fc.ShapeFieldName;
sf.Geometry = shape;
sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
return sf;
} Then you can use this directly on your feature class using the Search function.. IFeatureCursor fcursor = fc.Search(CreateSpatialFilter(fc, shape), true); Now index through the cursor to get the polygon id's. Good Luck Brent Hoskisson
... View more
04-23-2021
07:39 AM
|
1
|
1
|
1014
|
POST
|
At the very end of all of my projects in "Dispose" of my form with the map I always include ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown(); This is in the ESRI.ArcGIS.ADF.Local resource. I have never had an issue and I don't need to do the garbage collecting and marshalling. Brent Hoskisson
... View more
04-05-2021
08:08 AM
|
0
|
1
|
1570
|
POST
|
Here is a sample that gets you from an IFeature (from a cursor) to a List of all the points (type PointF)... Hope it helps. Brent Hoskisson private void GetVertices(IFeature f)
{
IPolygon4 parcel = f.Shape as IPolygon4;
if (parcel != null)
{
List<List<System.Drawing.PointF>> polycoll = new List<List<System.Drawing.PointF>>();
if (parcel.ExteriorRingCount > 0)
{
IGeometryBag exteriorRings = parcel.ExteriorRingBag;
IEnumGeometry exteriorRingsEnum = exteriorRings as IEnumGeometry;
exteriorRingsEnum.Reset();
int ering = 0;
IRing currentExteriorRing = exteriorRingsEnum.Next() as IRing;
int extrings = parcel.ExteriorRingCount;
while (extrings > 0 && currentExteriorRing != null)
{
ering++;
ISegmentCollection segments = currentExteriorRing as ISegmentCollection;
List<System.Drawing.PointF> spc = ProcessRing(segments);
if (spc != null)
polycoll.Add(spc);
IGeometryBag interiorRings = parcel.InteriorRingBag[currentExteriorRing];
IEnumGeometry interiorRingsEnum = exteriorRings as IEnumGeometry;
interiorRingsEnum.Reset();
int iring = 0;
IRing currentInteriorRing = exteriorRingsEnum.Next() as IRing;
int intrings = parcel.InteriorRingCount[currentExteriorRing];
while (intrings > 0 && currentInteriorRing != null)
{
iring++;
ISegmentCollection insegments = currentInteriorRing as ISegmentCollection;
List<System.Drawing.PointF> inspc = ProcessRing(insegments);
if (inspc != null)
polycoll.Add(inspc);
currentInteriorRing = interiorRingsEnum.Next() as IRing;
if (iring >= intrings)
break;
}
currentExteriorRing = exteriorRingsEnum.Next() as IRing;
if (ering >= extrings)
break;
}
}
}
//do something with polycoll...
}
private List<System.Drawing.PointF> ProcessRing(ISegmentCollection segments)
{
int segcount = segments.SegmentCount;
IEnumSegment enumsegment = segments.EnumSegments as IEnumSegment;
if (enumsegment == null)
{
return null;
}
enumsegment.Reset();
int partIndex = 0;
int segIndex = 0;
ISegment querySeg;
enumsegment.Next(out querySeg, ref partIndex, ref segIndex);
List<System.Drawing.PointF> spc = new List<System.Drawing.PointF>();
while (querySeg != null && !querySeg.IsEmpty)
{
if (querySeg is Line)
{
//no additional information.
}
else
{
//Circle, Ellipse, Bezier...
//get additional information to store about the line.
}
System.Drawing.PointF labpt = new System.Drawing.PointF((float)Math.Round(querySeg.FromPoint.X, 2, MidpointRounding.AwayFromZero),
(float)Math.Round(querySeg.FromPoint.Y, 2, MidpointRounding.AwayFromZero));
spc.Add(labpt);
enumsegment.Next(out querySeg, ref partIndex, ref segIndex);
if (segIndex == 0)
break;
}
if (spc != null)
{
spc.Add(spc[0]); //close the loop by adding the first point to the end...
return spc;
}
else
{
return null;
}
}
... View more
03-01-2021
07:42 AM
|
0
|
1
|
1425
|
POST
|
How does Navigation.zoomToFullExtent() know the Full Extent? Because it is figuring it out wrong and only zooming to the upper half of my full extent. Is there a way to set it to specific coordinates? Thanks Brent
... View more
03-06-2020
08:16 AM
|
0
|
0
|
355
|
POST
|
I have a map with graphics on it (progammatically added). However the map annotations are coming in on top of the graphics. I would like the graphics to be on top of the annotation. What do I need to do to change this drawing order? The solution doesn't have to be in ArcObjects. If you can show me how to fix it in ArcMap, I will be happy. Thanks
... View more
02-27-2020
08:39 AM
|
0
|
0
|
388
|
POST
|
I am trying to add a Server Object Extension in ArcGIS Server Manager. When I do it adds Garbage at the bottom of the Add Extension popup and does not dismiss the popup or Add the Extension. What does the message mean? and What can I do to Add an extension? Thanks Brent Hoskisson
... View more
02-20-2020
11:18 AM
|
0
|
1
|
429
|
POST
|
Hi and welcome back to programming. In the last 10 years a lot has changed in customizing ArcMap. Since you put this into the ArcObject SDK section, here are the answers if you decide to use ArcObjects: #1 I suggest looking at ArcMap add-ins. ArcObjects Help for .NET developers This should have more than enough information to get you going. #2 Really depends on how you want to proceed, you will probably create an IQueryFilter and then use that to select your features into an ISelectionSet with the FeatureClass.Select function. #3 To zoom to your objects, you will want to find the greatest extent around the objects and use the Extent function in the IActiveView interface in Carto. #4 A clarification, you don't save it to the MXD, you save it to some layer (Shapefile, etc.) and then load that layer into the MXD. You will want to look at the IFeatureDataConverter2 interface in the Geodatabase section. Specifically you will use the ConvertFeatureClass function with a SelectionSet option. To add the layer to a map, just get the IMap interface and run the AddLayer function. I am sure someone else will reply with information for Python scripting. Good Luck Brent
... View more
03-23-2017
11:37 AM
|
0
|
0
|
1178
|
POST
|
My Javascript API website works great up until version 3.14 and then 3.15 and on it stops loading the layers. The layers come from ArcGIS Rest services. Can anyone direct me to the changes for 3.15? Or does anyone remember what new constraints were added in this version?
... View more
03-06-2017
12:45 PM
|
0
|
4
|
2984
|
POST
|
I think ESRI is just following the market. Python scripting in ESRI products was intended to replace VBA, which was a steeper learning curve for non-programmers and locked ESRI into needing Microsoft since VBA is a Microsoft product. The API will not go away. There are still way too many people who want to integrate ESRI products into their programs and Python can't really do that (yet). As long as there is Windows, Unix and IOS, the API will be necessary, so it will exist and need to be supported. I'm not totally sure I agree with your observation that the documentation is disappearing. I think the documentation hasn't always been exceptional to begin with, but it has always been there and it is maintained. Once you get used to how ESRI does things, it always ends up so that not much trial and error is necessary to get things working. And occasionaly the forums will find you someone who has worked with the interface before and has a suggestion.
... View more
01-04-2017
07:59 AM
|
0
|
0
|
1233
|
POST
|
What have you tried so far? What does your code look like? What issues have you run into? Have you looked at this page? FeatureLayer | API Reference | ArcGIS API for JavaScript 4.1 We need more info about your problem if you would like help.
... View more
11-23-2016
08:11 AM
|
0
|
1
|
633
|
POST
|
TFS is merely a database (albeit an intelligent one). It doesn't care what your file formats are. I think it just loads your file as an object into the database. We have used TFS for years with no issues. I have stored scripts and mxd's in TFS. I've never used it with FGDB because we use SDE. And we have tried to store entire SDE database scripts, but found it much more trouble than it was worth. Incremental database backups work just as well. If you are a Microsoft shop, TFS is Microsoft and it plays nicely with everything Microsoft. Good Luck Brent Hoskisson
... View more
11-10-2016
08:34 AM
|
1
|
1
|
449
|
POST
|
It is nearly impossible to diagnose this without looking at your code. Usually you get this if the COM objects (i.e. arcobjects) do not shutdown in the proper order. And with how .NET does garbage collection you cannot guarantee the order that the COM object will be shut down. A way to circumvent this is to place the following code when you don't need an object any more: System.Runtime.InteropServices.Marshal.ReleaseComObject(<object>); I usually put this in a finally block wherever I create and use Cursor objects. Just setting them to null is not enough. Note that there are other objects that use cursors in a hidden manor, like IFeatureClass and any IEnum... classes that could benefit from the ReleaseComObject function. ESRI has also created a function: ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown(); which you can put as one of the last statements in your close scripts and it does reasonably well - but not perfect - at preventing this error. I hope this helps. Good Luck, Brent Hoskisson
... View more
11-10-2016
08:05 AM
|
1
|
0
|
395
|
Title | Kudos | Posted |
---|---|---|
1 | 01-18-2024 05:44 AM | |
1 | 01-12-2024 06:31 AM | |
1 | 01-31-2023 07:55 AM | |
1 | 09-21-2022 12:30 PM | |
2 | 03-01-2022 08:04 AM |
Online Status |
Offline
|
Date Last Visited |
03-05-2024
02:09 PM
|