Rotation Renderer using Expression

1979
1
06-22-2012 11:35 AM
JeremyFontenault
New Contributor II
I am trying to symbolize some points based on a field using an expression.  I am using the IRotationRenderer2 interface to do this as it has the capability to use an expression.  I have successfully symbolized these points without the expression just using a field value, using IRotationRenderer.  But I just can't get the expression to work.  Any suggestions?

Here's the code I'm using:

IRotationRenderer2 rotationRenderer = (IRotationRenderer2)pRender;
rotationRenderer.SetSymbolRotation3DExpressions("", "", "Direction + 180");
rotationRenderer.SymbolRotation3DRotationTypeZ = esriSymbolRotationType.esriRotateSymbolGeographic;


The data source is a File Geodatabase feature class, that has a "Direction" field of type double.

When I run the code, the layer does not rotate at all.  When I open the rotation settings in ArcMap the expression is loaded correctly, and if I just close the dialog again from there (without changing a thing) it works fine.

I read in the help that I should use the Z rotation since this is a 2D feature class.

Any help would be appreciated.
jeremy
0 Kudos
1 Reply
RobertDriessen
New Contributor
Hi Jeremy

If its not too late, try adding the following line
pRotationRenderer.SetSymbolRotation3DFlags(esriSymbolRotation3DFlags.esriSymbolRotation3DNone, esriSymbolRotation3DFlags.esriSymbolRotation3DNone, esriSymbolRotation3DFlags.esriSymbolRotation3DUseExpressionZ);

that is
IRotationRenderer2 rotationRenderer = (IRotationRenderer2)pRender;
rotationRenderer.SetSymbolRotation3DExpressions("", "", "Direction + 180");
pRotationRenderer.SetSymbolRotation3DFlags(esriSymbolRotation3DFlags.esriSymbolRotation3DNone, esriSymbolRotation3DFlags.esriSymbolRotation3DNone, esriSymbolRotation3DFlags.esriSymbolRotation3DUseExpressionZ);
rotationRenderer.SymbolRotation3DRotationTypeZ = esriSymbolRotationType.esriRotateSymbolGeographic;





I am trying to symbolize some points based on a field using an expression.  I am using the IRotationRenderer2 interface to do this as it has the capability to use an expression.  I have successfully symbolized these points without the expression just using a field value, using IRotationRenderer.  But I just can't get the expression to work.  Any suggestions?

Here's the code I'm using:

IRotationRenderer2 rotationRenderer = (IRotationRenderer2)pRender;
rotationRenderer.SetSymbolRotation3DExpressions("", "", "Direction + 180");
rotationRenderer.SymbolRotation3DRotationTypeZ = esriSymbolRotationType.esriRotateSymbolGeographic;


The data source is a File Geodatabase feature class, that has a "Direction" field of type double.

When I run the code, the layer does not rotate at all.  When I open the rotation settings in ArcMap the expression is loaded correctly, and if I just close the dialog again from there (without changing a thing) it works fine.

I read in the help that I should use the Z rotation since this is a 2D feature class.

Any help would be appreciated.
jeremy
0 Kudos