|
POST
|
It's not a bug; it is the way it has always worked. The CreateFeature method creates the feature in the feature class immediately and returns the Feature object to you. Any changes to the Feature object that you make will not be written to the feature class until you call the Store method. So, if you call CreateFeature and set the Shape and other attributes but do not call Store then the Feature object in the feature class will have no geometry and the attributes will remain Null. The CreateFeatureBuffer method returns a buffer to you. This buffer is just an in-memory representation of a Feature. No changes will be made to the feature class until you call the InsertFeature method on the feature cursor. The documentation is not very clear on any of this.
... View more
04-04-2012
05:42 AM
|
0
|
0
|
1889
|
|
POST
|
When you say utility, do you mean this is a standalone application or is it running inside ArcMap?
... View more
04-03-2012
01:34 PM
|
0
|
0
|
2917
|
|
POST
|
A spatial query can be performed with a multi-part polygon. Are you getting an error or is your query simply not returning any features? You're specifying esriSpatialRelEnum.esriSpatialRelWithin as the relationship type. This means the query will return only features that wholly contain your multi-part polygon. If you want to query for features that are inside your multi-part polygon then you need to use esriSpatialRelContains.
... View more
04-03-2012
10:50 AM
|
0
|
0
|
992
|
|
POST
|
Yeah, I forgot to mention you're using the wrong symbol type. You're creating a fill symbol and trying to use it to draw a polyline. You need to use a line symbol type instead. In the envelope sample, you're trying to use a line symbol type to draw a polygon (you'd need to create a polygon from the envelope). You should be using a fill symbol. Those changes should be all you need to get it working.
... View more
04-02-2012
07:10 AM
|
0
|
0
|
1946
|
|
POST
|
You can't cast a geometry to a symbol. The first code example you posted is what you should be doing except you create the polyline using the circular arc and then pass the polyline to the Add method instead of the circular arc.
... View more
04-02-2012
06:47 AM
|
0
|
0
|
1946
|
|
POST
|
I've never used this class but from the documentation it looks like the graphics tracker only works on high level geometries. Even though there are many classes that implement IGeometry only those that also implement IPoint, IMultiPoint, IPolyline, or IPolygon are considered high level geometries (at least in the 2d world). So, what you need to do is create a polyline from the circular arc. To do this, you create a new polyline object and add the circular arc to its segment collection. You then pass the polyline to the graphics tracker. Dim polyline As IPolyline = New Polyline DirectCast(polyline, ISegmentCollection).AddSegment(circularArc) This is why your example with the point worked and the other two didn't. A Point is a high level geometry while the circular arc and envelope are not.
... View more
04-02-2012
06:10 AM
|
0
|
0
|
1946
|
|
POST
|
I put together a quick sample that is working for me when I run it. Try
' Open the geodatabase.
Dim workspacePath As String = "C:\Development\ApplicationTest\Data\Gdb\test.mdb"
Dim workspaceFactory As IWorkspaceFactory = DirectCast(Activator.CreateInstance(Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory")), IWorkspaceFactory)
Dim workspace As IWorkspace = workspaceFactory.OpenFromFile(workspacePath, m_application.hWnd)
' Open the feature class.
Dim featureClassName As String = "structure_existing_area"
Dim featureClass As IFeatureClass = DirectCast(workspace, IFeatureWorkspace).OpenFeatureClass(featureClassName)
' Open the table.
Dim tableName As String = "building_types"
Dim table As ITable = DirectCast(workspace, IFeatureWorkspace).OpenTable(tableName)
' Create a layer from the feature class.
Dim featureLayer As IFeatureLayer = New FeatureLayer
featureLayer.Name = "Buildings"
featureLayer.FeatureClass = featureClass
' Get the fields to use in the join.
Dim tableField As IField = table.Fields.Field(table.Fields.FindField("building_type"))
Dim layerField As IField = featureClass.Fields.Field(featureClass.Fields.FindField("buildng_id"))
' Join the table to the layer.
Dim memRelClassFactory As IMemoryRelationshipClassFactory = New MemoryRelationshipClassFactory
Dim relClass As IRelationshipClass = memRelClassFactory.Open("Join", DirectCast(table, IObjectClass), tableField.Name, featureLayer.FeatureClass, layerField.Name, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany)
Dim displayRelClass As IDisplayRelationshipClass = DirectCast(featureLayer, IDisplayRelationshipClass)
displayRelClass.DisplayRelationshipClass(relClass, esriJoinType.esriLeftOuterJoin)
' Create the renderer.
Dim renderer As IUniqueValueRenderer = New UniqueValueRenderer
renderer.FieldCount = 1
renderer.Field(0) = DirectCast(table, IDataset).Name & "." & tableField.Name
' Add values and symbols to the renderer.
Dim featureCursor As IFeatureCursor = DirectCast(featureLayer, IGeoFeatureLayer).SearchDisplayFeatures(Nothing, True)
Dim dataStats As IDataStatistics = New DataStatistics
dataStats.Field = tableField.Name
dataStats.Cursor = DirectCast(featureCursor, ICursor)
Dim values As IEnumerator = dataStats.UniqueValues
values.Reset()
Dim count As Int32 = 0
Do While values.MoveNext
Dim value As String = Convert.ToString(values.Current)
' There are only 3 unique values in the table so I'm just hard-coding some colors for this sample.
Dim symbol As ISimpleFillSymbol = New SimpleFillSymbol
Dim color As IRgbColor = New RgbColor
If count = 0 Then
color.Red = 255
ElseIf count = 1 Then
color.Green = 255
Else
color.Blue = 255
End If
symbol.Color = color
count += 1
renderer.AddValue(value, "Building Type", DirectCast(symbol, ISymbol))
Loop
' Set the default symbol but don't use it.
renderer.DefaultSymbol = New SimpleFillSymbol
renderer.UseDefaultSymbol = False
DirectCast(featureLayer, IGeoFeatureLayer).Renderer = DirectCast(renderer, IFeatureRenderer)
' Add the layer to the map.
DirectCast(m_application.Document, IMxDocument).FocusMap.AddLayer(featureLayer)
DirectCast(m_application.Document, IMxDocument).UpdateContents()
DirectCast(m_application.Document, IMxDocument).ActiveView.Refresh()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
... View more
03-30-2012
09:27 AM
|
0
|
0
|
2066
|
|
POST
|
It's been a while since I've had to write any code that deals with joins but your fully qualified field name doesn't look correct to me. I've looked over some of our code that deals with qualified field names and all it appears to be doing is appending the table name to the field name (table.field). Your field name has the database name and owner name appended as well. Try stripping that off and see what happens.
... View more
03-30-2012
05:50 AM
|
0
|
0
|
2066
|
|
POST
|
The polygon returned by TrackCircle is indeed a circle. A polygon is several things. It's a point collection. The point collection contains all of the points that make up the polygon. In the case of a circle, the polygon is made up of a single circular arc. A circular arc is a type of line segment that defined by the boundary of a true circle. In the case of a complete circle, the circular arc begins and ends at the same point. Therefore, the point collection of a polygon that is a circle will contain two points and these points will have identical coordinates. A polygon is a segment collection. The segment collection contains all of the line segments that make up the polygon. In the case of a circle, the segment collection will contain a single segment that is a circular arc. A polygon is also a geometry collection. The geometry collection contains the collection of rings that make up the polygon. Multi-part polygons or polygons with "holes" (a donut for example) are cases where a polygon's geometry collection will contain more than one ring. So, if you want the center point and radius of a circle polygon then you need to get the circular arc segment from the segment collection. ICircularArc has CenterPoint and Radius properties that you can access. Dim segmentCollection As ISegmentCollection = DirectCast(polygon, ISegmentCollection) Dim circularArc As ICircularArc = DirectCast(segmentCollection.Segment(0), ICircularArc) Dim centerPoint As IPoint = circularArc.CenterPoint Dim radius As Double = circularArc.Radius
... View more
03-29-2012
05:53 AM
|
0
|
0
|
1329
|
|
POST
|
Can you post the code that creates the unique value renderer and applies it to the layer? Also, what is the value of Fields after this line executes: tableSort.Fields = classifyParms.ClassifyField.Qualified;
... View more
03-29-2012
05:33 AM
|
0
|
0
|
2066
|
|
POST
|
Performing a join doesn't change the underlying feature class. If it did, then that means it would be changing your actual data (if you want the join to be permanent then you will need to export the layer out to a new feature class). A feature layer is based on a data source (i.e. a feature class). You can add definition queries, joins, relates, etc. but none of this should be changing the actual data source; it should simply change how the layer is displayed. When you query the layer, you have several options. If you want your query to return results from the feature class then use IFeatureLayer.FeatureClass.Search to execute the query. The query will not be filtered by any definition query and will not contain fields from any joins (because it's querying the actual data in the database, not the visual representation). If you want the query to respect the definition query then use IFeatureLayer.Search to execute the query. The features returned by this query will not contain fields from any joins. If you want the query to respect the definition query and also contain fields from any joins then use IGeoFeatureLayer.SearchDisplayFeatures or IDisplayTable.SearchDisplayTable to execute the query.
... View more
03-28-2012
12:41 PM
|
0
|
0
|
2066
|
|
POST
|
Yours doesn't work the same because the AreaOfInterest property returns the spatially referenced extent of the layer, not the minimum bounding extent of the features within the layer. If you want to do the exact same thing that ArcMap does then you can call the actual ArcMap command. To do this you'll need to set the context item reference on the current contents view. The code below is a VBA macro that shows how to do this. It uses the selected layer in the TOC to set the context item but you can modify it to use any layer reference you want. Sub ZoomToLayer()
Dim mxDoc As IMxDocument
Set mxDoc = ThisDocument
Dim layer As IFeatureLayer
Set layer = mxDoc.SelectedLayer
mxDoc.CurrentContentsView.ContextItem = layer
Dim uid As uid
Set uid = New uid
uid.Value = "{18DF94D9-0F8A-11D2-94B1-080009EEBECB}:7"
Dim commandItem As ICommandItem
Set commandItem = Application.Document.CommandBars.Find(uid)
commandItem.Execute
End Sub
... View more
03-28-2012
05:44 AM
|
0
|
0
|
3653
|
|
POST
|
As already mentioned, a shapefile is not capable of storing field aliases. What you're seeing are the field aliases stored in the mxd. You can set a field alias on any attribute field through the Fields property page but this alias is only stored in the document. If you add that shapefileto another mxd, then it will not have those aliases. You can access these field aliases through IFieldInfo. To do this, get the feature layer from the map, QI over to ILayerFields and call ILayerFields.FieldInfo().
... View more
03-27-2012
10:07 AM
|
0
|
0
|
1652
|
|
POST
|
One way to do this is to query the feature layer (use IFeatureLayer.Search so that it respects the definition query) and add the feature geometries to a geometry bag. Then zoom to the envelope of the geometry bag. You can also use IEnumGeometryBind together with ITopologicalOperator.ConstructUnion to union the features together, after which you would zoom to the envelope of the resulting polygon.
... View more
03-27-2012
07:33 AM
|
0
|
0
|
3653
|
|
POST
|
You check the type of the layer. In C# that's the Is operator. If (layer Is IGroupLayer) then... You can access the layers within a group layer using the ICompositeLayer interface. For your code to be truly robust, you'll need to handle the possibility that group layers can contain other group layers so you can't just simply loop through the layers. You'll need to write a routine that loops through the layers within the group layer and updates the datasources of the feature layers and calls itself recursively for the group layers. As for changing the datasource, that's done the same way you did it for the mxd.
... View more
03-27-2012
05:17 AM
|
0
|
0
|
2517
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-20-2014 05:29 AM | |
| 1 | 02-01-2011 04:18 AM | |
| 1 | 02-04-2011 04:15 AM | |
| 1 | 01-17-2014 03:57 AM | |
| 1 | 10-07-2010 07:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|