Ask A Cartographer

Rotating Representation Symbols

January 02 2009 | 1 comment
Categories: Cartographic Representations

I have a point feature class representing geologic structural measurements. There are ~60 unique classifications of these measurements, each with it's own symbol. All of the symbols, however, need to be rotated based on a "Rotation" field in the featureclass. I found that I could rotate symbols by displaying field overrides, and specifying the field in the "Angle" picklist.

My question is, do I need to go through the 60 some representation rules one by one to set the rotation? This would be a big loss, as doing this sort of thing with an old unique value renderer was very quick and easy. Not to mention that I don't get to choose between geographic or arithmetic rotation.

Mapping Center Answer:

Okay, so the problem here is that each representation rule has to have it's rotation angle field individually assigned.  There is no way to automate this in the user interface.  This can be automated using ArcObjects.  If you're trained or inclined to ArcObjects, the help on the resource centers has some examples that will get you started:

http://resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/esriDisplay/IRepresentationRule.htm

In the above topic, the example shows how to iterate over the representation rules in a given represenatation class.  In your case you'd then then get the layer (as a IBasicMarkerSymbol) and then its attributes (IAttributes2), then the GeometricEffectRotate and set its value.  I'd interactively set the first rule to use the database field to see what that value is and then just set the other rules to use that value.

A little ArcObjects help... posted by Ryan Clark on Dec 3 2010 10:58AM
I'm trying to setup a routine to run through a set of ~400 representations and set the angle override to a field in the FeatureClass. I think I'm close, but need a little help.

Right now, I have the routine setup to just try and change one particular Rule's angle override, but when it comes to the point that I'm calling the IFieldOverrides.Add method, I'm a little lost. What is this second parameter (graphicAttributeIndex) that I'm supposed to give it?

private void SetSymbolRotationOverrides(IFeatureClass theFeatureClass)
{
// Get RepresentationClass for another method
IRepresentationClass theRepClass = GetRepClass(theFeatureClass);

// Grab the enumeration of Representation Rules
IRepresentationRules theRepRules = theRepClass.RepresentationRules;

// Setup a couple variables and begin iterating through the enumeration
int ruleId; IRepresentationRule aRepRule;
theRepRules.Reset();
theRepRules.Next(out ruleId, out aRepRule);
while (aRepRule != null)
{
// For one particular Rule, set an angle override
if (ruleId == 339)
{
try
{
IFieldOverrides fieldOverrides = aRepRule as IFieldOverrides;
IGraphicAttributes rotationEffect = new GeometricEffectRotateClass();

fieldOverrides.Add(rotationEffect, 0, "Azimuth");
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
Debug.Write(ex.StackTrace);
}
}
theRepRules.Next(out ruleId, out aRepRule);
}

If you would like to post a comment, please login.

Contact Us | Legal | Privacy |