|
POST
|
Shrey, You could also create an IGeoProcessor object and call the create pGDB tool. Have a look at this for execute existing tools. Duncan
... View more
07-10-2012
08:08 AM
|
0
|
0
|
1301
|
|
POST
|
Sui, You want to be using the IDataStatistics Interface. Duncan
... View more
07-10-2012
08:00 AM
|
0
|
0
|
1326
|
|
POST
|
Fred, It was an interesting problem and something I have never done before so I was interested in finding out how to extract the information. All I've shown is how sad I am for knowing ArcObjects well enough to be able to answer the problem! 🙂 I am glad to have helped. Duncan
... View more
07-10-2012
07:54 AM
|
0
|
0
|
2383
|
|
POST
|
Fred, OK this is how I did it in VBA. I added a layer and set a simple expression, see attached image. Then the code below will will print out all the labels as you would see them on the map. Duncan Public Sub printLabels() ' Get layer Dim pMXD As IMxDocument Set pMXD = ThisDocument Dim pMap As IMap Set pMap = pMXD.FocusMap Dim pLayer As ILayer Set pLayer = pMap.Layer(0) Dim pGeoFeaturelayer As IGeoFeatureLayer Set pGeoFeaturelayer = pLayer ' Get annotation collection Dim pAnnotateLayerPropertiesCollection As IAnnotateLayerPropertiesCollection Set pAnnotateLayerPropertiesCollection = pGeoFeaturelayer.AnnotationProperties ' Assumes 1 item in collection Dim pAnnotateLayerProperties As IAnnotateLayerProperties pAnnotateLayerPropertiesCollection.QueryItem 0, pAnnotateLayerProperties, Nothing, Nothing ' Get label engine and then the expression Dim pLabelEngineLayerProps As ILabelEngineLayerProperties Set pLabelEngineLayerProps = pAnnotateLayerProperties Dim simpleExpression As String Let simpleExpression = pLabelEngineLayerProps.Expression ' Get expression engine and create parser Dim pAnnotationExpressionEngine As IAnnotationExpressionEngine Set pAnnotationExpressionEngine = pLabelEngineLayerProps.ExpressionParser Dim pAnnotationExpressionParser As IAnnotationExpressionParser Set pAnnotationExpressionParser = pAnnotationExpressionEngine.SetExpression("", simpleExpression) ' Loop through featurelayer printing to VBA immediate window the label as seen on map Dim pFeatureCursor As IFeatureCursor Set pFeatureCursor = pGeoFeaturelayer.Search(Nothing, True) Dim pFeature As IFeature Set pFeature = pFeatureCursor.NextFeature Do While Not pFeature Is Nothing Debug.Print pAnnotationExpressionParser.FindLabel(pFeature) Set pFeature = pFeatureCursor.NextFeature Loop End Sub
... View more
07-10-2012
04:08 AM
|
0
|
0
|
2383
|
|
POST
|
Fred, Have a look at the interfaces IGeoFeatureLayer and ILabelEngineLayerProperties2 this will get you started. Duncan
... View more
07-09-2012
08:19 AM
|
0
|
0
|
2383
|
|
POST
|
Is the error occurring because you are running out of memory? Open Task Manager and see memory usage this is creeping up to the point it crashes. If it is then I'm guessing you need to release your cursors correctly to release the memory. I now use the ComReleaser in just about all code I write now. See example code below:
' For ArcGIS 10 using VS 2010 you need to import the following
Imports ESRI.ArcGIS.ADF.Connection.Local
Imports ESRI.ArcGIS.ADF
Dim pQueryFilter As IQueryFilter
pQueryFilter= New QueryFilterClass
pQueryFilter.WhereClause = "ID = 1"
Using releaser As New ComReleaser
Dim pFeatureCursor As IFeatureCursor
pFeatureCursor = pFeatureclass.Update(pQueryFilter, True)
releaser.ManageLifetime(pFeatureCursor)
Dim pFeature As IFeature
pFeature = pFeatureCursor.NextFeature
While pFeature IsNot Nothing
' Do something with pFeature
pFeatureCursor.UpdateFeature(pFeature)
pFeature = pFeatureCursor.NextFeature
End While
End Using Duncan
... View more
07-09-2012
08:13 AM
|
0
|
0
|
728
|
|
POST
|
Dan, Personally I would have used the IConstructCircularArc interface and the method ConstructCircle but as always there are several ways to do things. You can then Cut the circle with ITopologicalOperator using the Cut method. You will need to create a pointer of type IPolyline to the circle geometry. Duncan
... View more
07-09-2012
08:07 AM
|
0
|
0
|
465
|