Some weeks ago I showed you how to develop a DocumentAdminPage. This time I would like to take the same example and extend it a little bit.
The new plug-in does a pretty simple job. It goes through the TB_UFID table and analyzes when a feature has been modified the last time. The result of this analysis will be shown in the list view at the bottom. The plug-in also lets you decide if you want to analyze all or just some of the feature classes in the document.
Compared to the first version of the sample I have added a list of feature classes, an "Analyze" button and a list containing the results in the UI.
The main logic is implemented in the Analyze() method (called from btnAnalyze_Click()).
/// <summary>
/// Analyzes the TB_UFID table for the selected feature classes.
/// </summary>
/// <returns>The number of features grouped by <see cref="Age"/>. </returns>
private HashMap<Age, int> Analyze(IEnumerable<FeatureClass> featureClasses)
{
// create the result hashmap
HashMap<Age, int> results = new HashMap<Age, int>();
...
}
The method itself is pretty simple. It executes the following SQL statement:
select touch_ts from TB_UFID where f_class_id = {0}
for each feature class and then it categorizes the features by age (older than...).
You have now two choices, try to develop it by yourself (~200 lines of code) or download the project file from here:
Topobase.Insiders.FeatureHistory.zip (10.9K)
Of course this sample plug-in is not yet finished! Still a lot of important stuff is missing. For instance the Analyze method is working in the GUI thread which prevents the user from interacting with the Administrator. There is also no progress of the Analyze method visible to the user. The user just has to wait until the method finished. We'll see if we can fix that for the next week :-)
AUTODESK DOES NOT GUARANTEE THAT YOU WILL BE ABLE TO SUCCESSFULLY DOWNLOAD OR IMPLEMENT ANY SAMPLE CODE. SAMPLE CODE IS SUBJECT TO CHANGE WITHOUT NOTICE TO YOU. AUTODESK PROVIDES SAMPLE CODE "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL AUTODESK OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF DATA, OR LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, THAT MAY OCCUR AS A RESULT OF IMPLEMENTING OR USING ANY SAMPLE CODE, EVEN IF AUTODESK OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Comments