Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agroforestry #405

Merged
merged 3 commits into from
Oct 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Models.Agroforestry
[ViewName("UserInterface.Views.GridView")]
[PresenterName("UserInterface.Presenters.PropertyPresenter")]
[ValidParent(ParentModels = new Type[] { typeof(Simulation), typeof(Zone) })]
public class ForestrySystem : Zone
public class AgroforestrySystem : Zone
{
/// <summary>
/// Return the area of the zone.
Expand Down
2 changes: 1 addition & 1 deletion Models/Core/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Model()
[XmlElement(typeof(ModelCollectionFromResource))]
[XmlElement(typeof(Models.Agroforestry.LocalMicroClimate))]
[XmlElement(typeof(Models.Agroforestry.TreeProxy))]
[XmlElement(typeof(Models.Agroforestry.ForestrySystem))]
[XmlElement(typeof(Models.Agroforestry.AgroforestrySystem))]
[XmlElement(typeof(Models.Graph.Graph))]
[XmlElement(typeof(Models.Graph.Series))]
[XmlElement(typeof(Models.Graph.Regression))]
Expand Down
2 changes: 1 addition & 1 deletion Models/Core/Zone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Models.Core
[ViewName("UserInterface.Views.GridView")]
[PresenterName("UserInterface.Presenters.PropertyPresenter")]
[Serializable]
[ValidParent(ParentModels = new Type[] { typeof(Simulation), typeof(Agroforestry.ForestrySystem) })]
[ValidParent(ParentModels = new Type[] { typeof(Simulation), typeof(Agroforestry.AgroforestrySystem) })]
public class Zone : Model
{
/// <summary>Area of the zone.</summary>
Expand Down
2 changes: 1 addition & 1 deletion Models/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Models
[Serializable]
[ViewName("UserInterface.Views.ManagerView")]
[PresenterName("UserInterface.Presenters.ManagerPresenter")]
[ValidParent(ParentModels=new Type[] { typeof(Simulation), typeof(Zone), typeof(Zones.RectangularZone), typeof(Zones.CircularZone), typeof(Agroforestry.ForestrySystem) })]
[ValidParent(ParentModels=new Type[] { typeof(Simulation), typeof(Zone), typeof(Zones.RectangularZone), typeof(Zones.CircularZone), typeof(Agroforestry.AgroforestrySystem) })]
public class Manager : Model
{
// ----------------- Privates
Expand Down
2 changes: 1 addition & 1 deletion Models/Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<Compile Include="AgPasture.cs" />
<Compile Include="AgPasture\AgPasture1.Sward.cs" />
<Compile Include="AgPasture\AgPasture1.PastureSpecies.cs" />
<Compile Include="Agroforestry\ForestrySystem.cs" />
<Compile Include="Agroforestry\AgroforestrySystem.cs" />
<Compile Include="Agroforestry\LocalMicroClimate.cs" />
<Compile Include="Agroforestry\TreeProxy.cs" />
<Compile Include="Aqua\FoodInPond.cs" />
Expand Down
6 changes: 3 additions & 3 deletions Models/Zones/CircularZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Models.Zones
[Serializable]
[ViewName("UserInterface.Views.GridView")]
[PresenterName("UserInterface.Presenters.PropertyPresenter")]
[ValidParent(ParentModels = new Type[] { typeof(Zone), typeof(Simulation), typeof(Agroforestry.ForestrySystem) })]
[ValidParent(ParentModels = new Type[] { typeof(Zone), typeof(Simulation), typeof(Agroforestry.AgroforestrySystem) })]
public class CircularZone : Zone
{
/// <summary>Radius of the zone.</summary>
Expand All @@ -32,8 +32,8 @@ public double Distance
{
get
{
if (Parent is ForestrySystem)
return (Parent as ForestrySystem).GetDistanceFromTrees(this);
if (Parent is AgroforestrySystem)
return (Parent as AgroforestrySystem).GetDistanceFromTrees(this);
throw new ApsimXException(this, "Not implemented for this system");
}
}
Expand Down
6 changes: 3 additions & 3 deletions Models/Zones/RectangularZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Models.Zones
[Serializable]
[ViewName("UserInterface.Views.GridView")]
[PresenterName("UserInterface.Presenters.PropertyPresenter")]
[ValidParent(ParentModels = new Type[] { typeof(Zone), typeof(Simulation), typeof(Agroforestry.ForestrySystem) })]
[ValidParent(ParentModels = new Type[] { typeof(Zone), typeof(Simulation), typeof(Agroforestry.AgroforestrySystem) })]
public class RectangularZone : Zone
{
/// <summary>Length of the zone.</summary>
Expand All @@ -32,8 +32,8 @@ public double Distance
{
get
{
if (Parent is ForestrySystem)
return (Parent as ForestrySystem).GetDistanceFromTrees(this);
if (Parent is AgroforestrySystem)
return (Parent as AgroforestrySystem).GetDistanceFromTrees(this);
throw new ApsimXException(this, "Not implemented for this system");
}
}
Expand Down
16 changes: 8 additions & 8 deletions Prototypes/Agroforestry/AgroforestryExample.apsimx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SoilArbitrator>
<Name>Soil Arbitrator</Name>
</SoilArbitrator>
<ForestrySystem>
<AgroforestrySystem>
<Name>WindbreakSystem</Name>
<TreeProxy>
<Name>TreeProxy</Name>
Expand Down Expand Up @@ -3363,7 +3363,7 @@ namespace Models
</Graph>
<Area>0.25</Area>
<Slope>0</Slope>
</ForestrySystem>
</AgroforestrySystem>
<Area>0</Area>
<Slope>0</Slope>
</Simulation>
Expand All @@ -3384,7 +3384,7 @@ namespace Models
<SoilArbitrator>
<Name>Soil Arbitrator</Name>
</SoilArbitrator>
<ForestrySystem>
<AgroforestrySystem>
<Name>WindbreakSystem</Name>
<TreeProxy>
<Name>TreeProxy</Name>
Expand Down Expand Up @@ -10877,7 +10877,7 @@ namespace Models
</Graph>
<Area>3.05</Area>
<Slope>0</Slope>
</ForestrySystem>
</AgroforestrySystem>
<Area>0</Area>
<Slope>0</Slope>
</Simulation>
Expand Down Expand Up @@ -10949,7 +10949,7 @@ namespace Models
<SoilArbitrator>
<Name>Soil Arbitrator</Name>
</SoilArbitrator>
<ForestrySystem>
<AgroforestrySystem>
<Name>SingleTreeSystem</Name>
<TreeProxy>
<Name>TreeProxy</Name>
Expand Down Expand Up @@ -13909,7 +13909,7 @@ namespace Models
</Graph>
<Area>0.19634954084936207</Area>
<Slope>0</Slope>
</ForestrySystem>
</AgroforestrySystem>
<Area>0</Area>
<Slope>0</Slope>
</Simulation>
Expand All @@ -13932,7 +13932,7 @@ namespace Models
<SoilArbitrator>
<Name>Soil Arbitrator</Name>
</SoilArbitrator>
<ForestrySystem>
<AgroforestrySystem>
<Name>WindbreakSystem</Name>
<TreeProxy>
<Name>TreeProxy</Name>
Expand Down Expand Up @@ -18455,7 +18455,7 @@ namespace Models
</Graph>
<Area>0.54999999999999993</Area>
<Slope>0</Slope>
</ForestrySystem>
</AgroforestrySystem>
<Area>0</Area>
<Slope>0</Slope>
</Simulation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@
</EventNames>
<ResultsPerPage>0</ResultsPerPage>
</Report>
<Plant15>
<Name>Wheat</Name>
<ResourceName>Wheat</ResourceName>
<AutoHarvest>true</AutoHarvest>
<CropType>Wheat</CropType>
</Plant15>
</Replacements>
<DataStore>
<Name>DataStore</Name>
Expand Down Expand Up @@ -388,7 +394,7 @@
<SoilArbitrator>
<Name>Soil Arbitrator</Name>
</SoilArbitrator>
<ForestrySystem>
<AgroforestrySystem>
<Name>WindbreakSystem</Name>
<Manager>
<Name>SowingRule</Name>
Expand Down Expand Up @@ -4152,9 +4158,49 @@ namespace Models
<DisabledSeries />
<IncludeInDocumentation>false</IncludeInDocumentation>
</Graph>
<Graph>
<Name>SW90cm</Name>
<Series>
<Name>Series1</Name>
<Type>Scatter</Type>
<XAxis>Bottom</XAxis>
<YAxis>Left</YAxis>
<ColourArgb>-16776961</ColourArgb>
<FactorIndexToVaryColours>-1</FactorIndexToVaryColours>
<FactorIndexToVaryMarkers>-1</FactorIndexToVaryMarkers>
<FactorIndexToVaryLines>-1</FactorIndexToVaryLines>
<Marker>FilledCircle</Marker>
<Line>None</Line>
<TableName>PredictedObserved</TableName>
<XFieldName>Observed.SW90cm</XFieldName>
<YFieldName>Predicted.SW90cm</YFieldName>
<ShowInLegend>true</ShowInLegend>
<Cumulative>false</Cumulative>
<CumulativeX>false</CumulativeX>
</Series>
<Axis>
<Type>Bottom</Type>
<Title />
<Inverted>false</Inverted>
<Minimum>NaN</Minimum>
<Maximum>NaN</Maximum>
<Interval>NaN</Interval>
</Axis>
<Axis>
<Type>Left</Type>
<Title />
<Inverted>false</Inverted>
<Minimum>NaN</Minimum>
<Maximum>NaN</Maximum>
<Interval>NaN</Interval>
</Axis>
<LegendPosition>BottomRight</LegendPosition>
<DisabledSeries />
<IncludeInDocumentation>true</IncludeInDocumentation>
</Graph>
<Area>0.55</Area>
<Slope>0</Slope>
</ForestrySystem>
</AgroforestrySystem>
<Graph>
<Name>YieldTransect</Name>
<Series>
Expand Down Expand Up @@ -4454,7 +4500,7 @@ namespace Models
<SoilArbitrator>
<Name>Soil Arbitrator</Name>
</SoilArbitrator>
<ForestrySystem>
<AgroforestrySystem>
<Name>WindbreakSystem</Name>
<Manager>
<Name>SowingRule</Name>
Expand Down Expand Up @@ -9444,7 +9490,7 @@ namespace Models
</RectangularZone>
<Area>2.05</Area>
<Slope>0</Slope>
</ForestrySystem>
</AgroforestrySystem>
<Graph>
<Name>YieldTransect</Name>
<Series>
Expand Down
2 changes: 1 addition & 1 deletion UserInterface/Presenters/TreeProxyPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void OnCellEndEdit(object sender, EventArgs e)

public void AttachData()
{
if (!(ForestryModel.Parent is ForestrySystem))
if (!(ForestryModel.Parent is AgroforestrySystem))
throw new ApsimXException(ForestryModel, "Error: TreeProxy must be a child of ForestrySystem.");

Soil Soil;
Expand Down
10 changes: 7 additions & 3 deletions UserInterface/UserInterface.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="Utility\ColumnXYSeries.cs" />
<Compile Include="Utility\DateTimeCellType.cs" />
<Compile Include="Utility\FindAndReplaceForm.cs" />
<Compile Include="Utility\DateTimeCellType.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Utility\FindAndReplaceForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Utility\FindAndReplaceForm.designer.cs">
<DependentUpon>FindAndReplaceForm.cs</DependentUpon>
</Compile>
Expand Down Expand Up @@ -712,7 +716,7 @@
<EmbeddedResource Include="Resources\TreeViewImages\Regression.png" />
<EmbeddedResource Include="Resources\TreeViewImages\CircularZone.png" />
<EmbeddedResource Include="Resources\TreeViewImages\RectangularZone.png" />
<EmbeddedResource Include="Resources\TreeViewImages\ForestrySystem.png" />
<EmbeddedResource Include="Resources\TreeViewImages\AgroforestrySystem.png" />
<EmbeddedResource Include="Resources\TreeViewImages\FieldPea.png" />
<EmbeddedResource Include="Resources\TreeViewImages\NodeNumberPhase.png" />
<EmbeddedResource Include="Resources\TreeViewImages\SoilArbitrator.png" />
Expand Down