Select to view content in your preferred language

How do you trap for an invalid create feature template item?

1524
4
09-28-2011 09:59 AM
GregRieck
Frequent Contributor
Hello,

I'm trying to trap for an invalid create feature template item. I've attached a screen shot of a create feature template that has an invalid drawing symbol.

You get this by doing the following:
Create a unique value renderer on a feature layer and then create the feature templates using the renderer. Next, delete one value from the previously created unique value renderer. The create feature template will then remove the symbology for the deleted value. When you right click on the template without a symbol you get the attached screen shot showing the "Drawing Symbol Will not draw!" message.

So, how do I check if a template is valid for drawing? I already have events in place for capturing a template when it is clicked.

G
0 Kudos
4 Replies
by Anonymous User
Not applicable
You can do this by creating a temporary feature for the template then get its symbol from the renderer. If the symbol is null then you have the the 'symbol will not draw' case.

          //get the template symbol
          IFeatureClass featClass = featLayer.FeatureClass;
          IFeatureBuffer featBuffer = featClass.CreateFeatureBuffer();
          IFeature feature = featBuffer as IFeature;
          editTemplate.SetDefaultValues(feature);
          IGeoFeatureLayer geoFeatLayer = featLayer as IGeoFeatureLayer;
          ISymbol symbol = geoFeatLayer.Renderer.get_SymbolByFeature(feature);
0 Kudos
GregRieck
Frequent Contributor
Thank You Sean, works great!
0 Kudos
OlamideOlasupo-Omole
New Contributor
You can do this by creating a temporary feature for the template then get its symbol from the renderer. If the symbol is null then you have the the 'symbol will not draw' case.

          //get the template symbol
          IFeatureClass featClass = featLayer.FeatureClass;
          IFeatureBuffer featBuffer = featClass.CreateFeatureBuffer();
          IFeature feature = featBuffer as IFeature;
          editTemplate.SetDefaultValues(feature);
          IGeoFeatureLayer geoFeatLayer = featLayer as IGeoFeatureLayer;
          ISymbol symbol = geoFeatLayer.Renderer.get_SymbolByFeature(feature);


I tried to run this code on the Python but it didn't run. I also have the "Drawing Symbol will not draw" error message.
Would appreciate your response.
Thanks.
0 Kudos
GregRieck
Frequent Contributor
Hello Olamide.Omole,

The code is c# and works fine in .Net. I'm sorry I don't use Python. You'll need to convert the code for use in Python. Perhaps copy the code and present it in a Python forum.

http://forums.arcgis.com/forums/117-Python

Greg
0 Kudos