Re: [Shapedotnet-development] Rerendering a used imaplayer
Status: Beta
Brought to you by:
k5jvc
|
From: John C. <k5...@ne...> - 2004-02-05 20:22:27
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
The short fix is in Insert method of Map.cs, add a call to
CalculateExtents(); after the List.Insert line so it looks like this:<br>
<br>
public void Insert( int index, IMapLayer ml )<br>
{<br>
List.Insert( index, ml );<br>
CalculateExtents();<br>
}<br>
<br>
That should fix it. The reasoning for this is convoluted at best, I
need to change things around a bit so that it works a little more
intuitively. Once again, you're off doing things I hadn't considered
doing. :)<br>
<br>
Let me know if that works correctly.<br>
<br>
Rife, Ryan wrote:<br>
<blockquote type="cite" cite="mid...@or...">
<meta http-equiv="Context-Type" content="text/html; charset=US-ASCII">
<div>
<p> <span>So I built an application that loads a shapefile to a map
and then cache’s the imaplayer that was added to the map to a
collection. If I attempt to add the imaplayer to a new map object it
will
render the map properly, however if I attempt to zoomin, the zoomin
function
does the math properly but the screen doesn’t actually draw the
shapefile
zoomed in. Any ideas on how to fix this?? </span> </p>
<p> <span> </span> </p>
<p> <span>Here’s some pseudo code of what I’m doing: </span> </p>
<p> <span> </span> </p>
<p> <span>System.Collections.ArrayList layers = new
System.Collections.ArrayList(); </span> </p>
<p> <span> </span> </p>
<p> <span>System.Drawing.Bitmap mapImg = new
System.Drawing.Bitmap(500,500); </span> </p>
<p> <span>ShapeDotNet.GIS.Map myMap = new ShapeDotNet.GIS.Map(); </span>
</p>
<p> <span>layers.add(myMap[myMap.Add(@”c:\mylayer.shp”)]); </span> </p>
<p> <span>myMap.Draw(mapImg); </span> </p>
<p> <span> </span> </p>
<p> <span>ShapeDotNet.GIS.Map newMap = new ShapeDotNet.GIS.Map(); </span>
</p>
<p> <span>newMap.Insert(0,layers[0]); </span> </p>
<p> <span>newMap.MapMetrics.UpdateMetrics(); //I exposed the
mapmetrics so I can monkey with the numbers </span> </p>
<p> <span>newMap.Draw(mapImg); //this works ok </span> </p>
<p> <span> </span> </p>
<p> <span>newMap.ZoomIn(50,50); //this works internally (viewport is
correct) </span> </p>
<p> <span>newMap.Draw(mapImg); //this doesn’t work, it is not
drawing the viewport, appears to only be the extent </span> </p>
<p> <span> </span> </p>
<p> <span>//finish </span> </p>
<p> <span> </span> </p>
<p> <span> </span> </p>
</div>
</blockquote>
</body>
</html>
|