Skip to content

Commit 6257659

Browse files
committed
[Trunk]
- Changed Layer.Style to accept IStyle - Made IStyle implement IDisposable - Applied diegos patch #12145 git-tfs-id: [https://tfs.codeplex.com/tfs/TFS01]$/SharpMap/Trunk;C97690
1 parent 53c6129 commit 6257659

4 files changed

Lines changed: 41 additions & 6 deletions

File tree

SharpMap/Data/Providers/ShapeFile.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ public class ShapeFile : FilterProvider, IProvider
191191
protected DbaseReader DbaseFile;
192192
private Stream _fsShapeFile;
193193

194+
private static readonly object GspLock = new object();
195+
194196
#if USE_MEMORYMAPPED_FILE
195197
private static Dictionary<string,System.IO.MemoryMappedFiles.MemoryMappedFile> _memMappedFiles;
196198
private static Dictionary<string, int> _memMappedFilesRefConter;
@@ -788,7 +790,8 @@ public virtual int SRID
788790
set
789791
{
790792
_srid = value;
791-
Factory = GeometryServiceProvider.Instance.CreateGeometryFactory(value);
793+
lock (GspLock)
794+
Factory = GeometryServiceProvider.Instance.CreateGeometryFactory(value);
792795
}
793796
}
794797

SharpMap/Layers/Layer.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,11 @@ protected virtual void OnLayerNameChanged(EventArgs eventArgs)
8787

8888
#endregion
8989

90-
9190
private ICoordinateTransformation _coordinateTransform;
9291
private ICoordinateTransformation _reverseCoordinateTransform;
9392

9493
private string _layerName;
95-
private Style _style;
94+
private IStyle _style;
9695
private int _srid = -1;
9796
private int? _targetSrid;
9897

@@ -264,9 +263,9 @@ public bool Enabled
264263
}
265264

266265
/// <summary>
267-
/// Gets/sets the Style for this Layer
266+
/// Gets or sets the Style for this Layer
268267
/// </summary>
269-
public virtual Style Style
268+
public virtual IStyle Style
270269
{
271270
get { return _style; }
272271
set

SharpMap/Styles/IStyle.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
// along with SharpMap; if not, write to the Free Software
1616
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717

18+
using System;
19+
1820
namespace SharpMap.Styles
1921
{
2022
/// <summary>
2123
/// Defines an interface for defining layer styles
2224
/// </summary>
23-
public interface IStyle
25+
public interface IStyle : IDisposable
2426
{
2527
/// <summary>
2628
/// Gets or sets the minimum zoom value where the style is applied

SharpMap/Styles/Style.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,36 @@ public bool Enabled
7070
}
7171

7272
#endregion
73+
74+
//#region Equals
75+
//public override bool Equals(object obj)
76+
//{
77+
// if (ReferenceEquals(this, obj))
78+
// return true;
79+
80+
// var styleObj = obj as Style;
81+
// if (styleObj == null)
82+
// return false;
83+
84+
// if (_visible != styleObj._visible)
85+
// return false;
86+
87+
// if (Math.Abs(_minVisible - styleObj._minVisible) < 1e9)
88+
// return false;
89+
// if (Math.Abs(_maxVisible - styleObj._maxVisible) < 1e9)
90+
// return false;
91+
92+
// return true;
93+
//}
94+
95+
//public override int GetHashCode()
96+
//{
97+
// unchecked
98+
// {
99+
// var result = _visible.GetHashCode();
100+
// return (result * 397) ^ (_maxVisible - _minVisible).GetHashCode();
101+
// }
102+
//}
103+
//#endregion
73104
}
74105
}

0 commit comments

Comments
 (0)