diff --git a/packages/DynamoGIS/pkg.json b/packages/DynamoGIS/pkg.json new file mode 100644 index 0000000..153b100 --- /dev/null +++ b/packages/DynamoGIS/pkg.json @@ -0,0 +1,18 @@ +{ + "license":"", + "file_hash":null, + "name":"DynamoGIS", + "version":"0.2.2", + "description":"Shape file reader for Dyanmo", + "group":"GIS", + "keywords":["gis","shapefile"], + "dependencies":[], + "contents":"", + "engine_version":"0.8.3.2491", + "engine":"dynamo", + "engine_metadata":"", + "site_url":"", + "repository_url":"", + "contains_binaries":true, + "node_libraries":["EGIS.DynamoLib, Version=0.2.0.0, Culture=neutral, PublicKeyToken=null"] +} \ No newline at end of file diff --git a/src/EGIS.DynamoLib/EGIS.DynamoLib.csproj b/src/EGIS.DynamoLib/EGIS.DynamoLib.csproj index 8697d61..430e05a 100644 --- a/src/EGIS.DynamoLib/EGIS.DynamoLib.csproj +++ b/src/EGIS.DynamoLib/EGIS.DynamoLib.csproj @@ -66,7 +66,19 @@ Other similar extension points exist, see Microsoft.Common.targets. + --> + + + + + + + + + + + + - --> \ No newline at end of file diff --git a/src/EGIS.DynamoLib/ShapeFileReader.cs b/src/EGIS.DynamoLib/ShapeFileReader.cs index 5978a36..f049638 100644 --- a/src/EGIS.DynamoLib/ShapeFileReader.cs +++ b/src/EGIS.DynamoLib/ShapeFileReader.cs @@ -3,6 +3,7 @@ using Autodesk.DesignScript.Geometry; using EGIS.ShapeFileLib; using System.IO; +using System; namespace EGIS.DynamoLib { @@ -16,7 +17,7 @@ internal struct PointXYZ /// /// Represents the shape read from ShapeFile /// - public class Shape + public class Shape : IDisposable { /// /// Represents raw shape data @@ -48,6 +49,17 @@ private Shape(string shapeFilePath) Database = new DbfReader(dbfFilePath); } + /// + /// Closes the Database at the end of the execution + /// + public void Dispose() + { + if (Database != null) + { + Database.Close(); + } + } + /// /// Loads the shape file(*.shp) from the given path /// @@ -81,7 +93,7 @@ public IEnumerable GetShapeAtRecord(int index) { item.Dispose(); } - + return polygon; }); }