Skip to content

Commit 6623327

Browse files
committed
Make ToGraphicsCanvas static
1 parent 12c93dd commit 6623327

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

SharpMap.SqlServerSpatialObjects/SharpMap.SqlServerSpatialObjects.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageTags>SharpMap GIS Map GeoSpatial SqlServer</PackageTags>
99
<Description>SharpMap components for interaction with SqlServer spatial objects</Description>
1010
<!--<EnableApiCompat>true</EnableApiCompat>-->
11-
<NoWarn>1701;1702;2100;2235</NoWarn>
11+
<NoWarn>1701;1702;2100;2235;5100</NoWarn>
1212
<RootNamespace>SharpMap</RootNamespace>
1313
</PropertyGroup>
1414

@@ -20,9 +20,6 @@
2020
<ProjectReference Include="..\SharpMap\SharpMap.csproj" />
2121
</ItemGroup>
2222

23-
<ItemGroup>
24-
<Compile Include="SqlServerTypes\Loader.cs"/>
25-
</ItemGroup>
2623
<ItemGroup>
2724
<Content Include="SqlServerTypes\readme.htm" />
2825
<Content Include="SqlServerTypes\x64\msvcr120.dll">

SharpMap/Layers/Layer.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ protected virtual void Render(Graphics g, MapViewport mvp, out Rectangle affecte
393393
}
394394
else
395395
{
396-
affectedArea = ToGraphicsCanvas(g.Transform);
396+
affectedArea = ToGraphicsCanvas(CanvasArea, g.Transform);
397397

398398
// clip to graphics canvas
399399
affectedArea.Intersect(mapRect);
@@ -404,18 +404,24 @@ protected virtual void Render(Graphics g, MapViewport mvp, out Rectangle affecte
404404
OnLayerRendered(g);
405405
}
406406

407-
protected Rectangle ToGraphicsCanvas(System.Drawing.Drawing2D.Matrix matrix)
407+
/// <summary>
408+
/// Transforms cavas area to untransformed graphics canvas
409+
/// </summary>
410+
/// <param name="area"></param>
411+
/// <param name="matrix"></param>
412+
/// <returns></returns>
413+
protected static Rectangle ToGraphicsCanvas(RectangleF area, System.Drawing.Drawing2D.Matrix matrix)
408414
{
409415
if (!matrix.IsIdentity)
410416
{
411-
var pts = CanvasArea.ToPointArray();
417+
var pts = area.ToPointArray();
412418
matrix.TransformPoints(pts);
413419
// Enclosing rectangle aligned with graphics canvas and inflated to nearest integer values.
414-
CanvasArea = pts.ToRectangleF();
420+
area = pts.ToRectangleF();
415421
}
416422

417423
// This is the area of the graphics canvas that needs to be refreshed when invalidating the image.
418-
var affectedArea = CanvasArea.ToRectangle();
424+
var affectedArea = area.ToRectangle();
419425

420426
// // proof of concept: draw affected area to screen aligned with graphics canvas
421427
// using (var orig = g.Transform.Clone())

0 commit comments

Comments
 (0)