Re: [Shapedotnet-development] Exposing MapMetrics
Status: Beta
Brought to you by:
k5jvc
From: John C. <jo...@k5...> - 2004-01-18 05:37:48
|
<!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"> Hmm. It's difficult to create an IMapLayer (<font size="2"><span style="font-size: 10pt; font-family: Arial;">Shapefile object)</span></font> outside of the Map object because I didn't design it to work that way. I had intended for the Add method to be used when a new layer needs to be created. The insert method was put in only so that I could move layers up and down easily after they had been created with the Add method. See the MoveLayerUp( int index ) and the MoveLayerDown( int index ) methods in MapControl.cs for an example of this.<br> <br> I think exposing <font size="2"><span style="font-size: 10pt; font-family: Arial;">_mapMetrics as a public property would be dangerous because it holds information read directly from the shapefile and uses calculations made from this information to convert real coordinates into local (pixel) coordinates for the map as a whole (so your #2 would not work, all map layers must have access to these calculations). All layers need access to the *same* World2Pixel(...) and Pixel2World(...) methods. If it were public, it would open up the possibility of corrupting the information from outside the Map class in ways that I haven't considered yet. I had also envisioned the </span></font><font size="2"><span style="font-size: 10pt; font-family: Arial;">_mapMetrics object containing projection, datum, and ellipsiod information in the future.</span></font><br> <font size="2"><span style="font-size: 10pt; font-family: Arial;"><br> The Shapefile class exists only to be a IMapLayer, that's it. As a class that implements IMapLayer, it should only exist within the confines of a Map class collection. My goal with the IMapLayer interface was to make it easy to write new file format readers in the future. I didn't intend for these </span></font><font size="2"><span style="font-size: 10pt; font-family: Arial;">file format readers to be stand alone objects. You can see on line 40 in IMapLayer.cs my master plan:<br> <br> </span></font><font size="2">public enum LayerSubType { Shapefile, Mif, E00, GeoTIFF }</font><br> <br> These are the file formats that I would like SDN to support in the near future. As always, if you see a hole in my strategy, please tell me so we can discuss it. There's always a better way.<br> <br> Rife, Ryan wrote:<br> <blockquote type="cite" cite="mid...@or..."> <meta http-equiv="Content-Type" content="text/html; "> <meta name="Generator" content="Microsoft Word 11 (filtered medium)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1120145861; mso-list-type:hybrid; mso-list-template-ids:-1123529014 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-text:"%1\)"; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> <div class="Section1"> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I found it hard to create a shapefile outside of the Map object’s AddLayer method and later use the Map’s InsertLayer method to add it to the map. This is mostly because of the Shapefile’s contructor requiring a MapMetric object. I think it would be useful to”<o:p></o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><o:p> </o:p></span></font></p> <p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><span style="">1)<font size="1" face="Times New Roman"><span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-stretch: normal; font-size-adjust: none;"> </span></font></span></span></font><!--[endif]--><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">expose the Map’s _mapMetrics variable as a public property so it can be used in the creation of standalone Shapefile objects<o:p></o:p></span></font></p> <p class="MsoNormal" style="margin-left: 0.25in;"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><o:p> </o:p></span></font></p> <p class="MsoNormal" style="margin-left: 0.25in;"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">and/or<o:p></o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><o:p> </o:p></span></font></p> <p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><span style="">2)<font size="1" face="Times New Roman"><span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-stretch: normal; font-size-adjust: none;"> </span></font></span></span></font><!--[endif]--><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">have a Shapefile constructor that does not require a MapMetrics object and have a metrics property on the Shapefile that can be set during the InsertLayer method call on the Map<o:p></o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><o:p> </o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I prefer the 2<sup>nd</sup> approach mostly because it allows for the most flexibility. Later.<o:p></o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><o:p> </o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Ryan Rife<o:p></o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Senior Software Developer<o:p></o:p></span></font></p> <p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Pacific Western Technologies<o:p></o:p></span></font></p> </div> </blockquote> </body> </html> |