Table of Contents | ||||||||
---|---|---|---|---|---|---|---|---|
|
Introduction
This tutorial assumes that you have looked over the Analysis Framework Developer's Guide and have followed the MAEviz development environment tutorial for setting up a development environment. If not, please look at those two documents because this tutorial assumes you have setup your MAEviz development environment and are ready to create a new analysis plug-in so you can begin extending MAEviz.
...
Your BuildingSoilAnalysis.xml file should contain the following codexml statements:
Code Block | ||||
---|---|---|---|---|
| ||||
<analysis-description id ="ncsa.maeviz.building.example.analysis.buildingSoilAnalysis"> <analysis-type type="simpleIteration"> <property name="iteratingDatasetKey" value="buildings"> </property> </analysis-type> <groups> <group-name>Required</group-name> <group-name>Advanced</group-name> </groups> <!-- Analysis Inputs --> <!-- the result name must be prefixed with the tag of the analysis, in this case toxicCloudAnalysisbuildingSoilAnalysis --> <parameter format="resultName" phylum="string" cardinality="single" key="buildingSoilAnalysis.resultName" friendly-name="Result Name"/> <parameter phylum="dataset" cardinality="single" key="buildings" friendly-name="Buildings"> <types> <type>buildingv4</type> <type>buildingv5</type> </types> </parameter> <!-- Analysis Outputs --> <output friendly-name="Building Soil Results" key="buildingSoilAnalysis" phylum="dataset" format="shapefile" geom="buildings" guids="buildings"> <property name="buildings" type="base-dataset-key" value="buildings"/> <property name="schema" type="schema" value="ncsa.maeviz.building.example.schemas.buildingSoilResults.v1.0"/> </output> </analysis-description> |
Analysis Task
...
Code Block | ||
---|---|---|
| ||
@Override protected void handleFeature( IProgressMonitor monitor ) throws ScriptExecutionException{ resultMap.put( "soiltype", isSoftSoil() ); } /** * Generate a number between 0 and 5 (exclusive) * 0 - Soil Type A * 1 - Soil Type B * 2 - Soil Type C * 3 - Soil Type D * 4 - Soil Type E * @return Soil Type */ private int isSoftSoil() { Random rand = new Random(); return rand.nextInt( 15 ); } |
Analysis Result Type
The next step is to create a result type schema to specify the new fields created by our analysis. This tutorial will not go into detail about the schema file since it is behind the scope of this tutorial.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:gml="http://www.opengis.net/gml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ionicsoft.com/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:iwfs="http://www.ionicsoft.com/wfs" targetNamespaceOptionnal="true" xmlns="http://www.ionicsoft.com/wfs" elementFormDefault="qualified"> <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/> <xsd:element name="building-soil-analysis" substitutionGroup="gml:_Feature" type="iwfs:building-soil-analysis"/> <xsd:complexType name="building-soil-analysis"> <xsd:complexContent> <xsd:extension base="gml:AbstractFeatureType"> <xsd:sequence> <xsd:element name="maeviz.soiltype" minOccurs="0" nillable="true" type="xsd:integer"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> </xsd:schema> |
Example Plug-in
You can download the If you have setup your MAEviz development environment, then you should have connected to our Subversion repository. You can find this example plug-in that contains everything in the tutorial by doing the following:by going to the repository at svn://subversion.ncsa.uiuc.edu/ncsa-plugins/ and doing the following:
- Expand trunk
- Find the plug-in ncsa.maeviz.building.example, right click on it and select Checkout.
This will download the plug-in to your workspace. You might need to download this to a new workspace if you already have a plug-in with that project name. Do not overwrite yours unless that is your intent.