<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — [SOLVED] Drawing a square from top left and bottom right coords?]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1832&amp;type=atom" />
	<updated>2021-09-13T18:26:42Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1832</id>
		<entry>
			<title type="html"><![CDATA[Re: [SOLVED] Drawing a square from top left and bottom right coords?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7692#p7692" />
			<content type="html"><![CDATA[<p>I wasn&#039;t able to figure out how to use what you referenced for my need, but this was my solution:</p><div class="codebox"><pre><code>List&lt;Vector2&gt; squareCorners = new List&lt;Vector2&gt;();

//grab the 2 I know of
Vector2 NWcorner = new Vector2( (float)NW.longitude, (float)NW.latitude);
Vector2 SEcorner = new Vector2( (float)SE.longitude, (float)SE.latitude);

// now get the other 2
Vector2 NEcorner = new Vector2( Math.Max(NWcorner.x, SEcorner.x), Math.Max(NWcorner.y, SEcorner.y );
Vector2 SWcorner = new Vector2( Math.Min(NWcorner.x, SEcorner.x), Math.Min(NWcorner.y, SEcorner.y );

// add them all to the list
squareCorners.Add(NWcorner);
squareCorners.Add(NEcorner);
squareCorners.Add(SEcorner);
squareCorners.Add(SWcorner);

// create the poly
OnlineMapsDrawingPoly mySquare = new OnlineMapsDrawingPoly(squareCorners, Color.gree, 1.0f, Color.cyan);
// add it to the map
OnlineMapsDrawingElementManager.AddItem(mySquare);</code></pre></div><p>This does work.</p><p>Now I&#039;m on to making it clickable, which I think I can handle</p>]]></content>
			<author>
				<name><![CDATA[mcb]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1341</uri>
			</author>
			<updated>2021-09-13T18:26:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7692#p7692</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: [SOLVED] Drawing a square from top left and bottom right coords?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7691#p7691" />
			<content type="html"><![CDATA[<p>Thanks for the response.</p><p>Basically, I&#039;m going to draw a square and make it clickable, and allow the user to easily jump to this location.&nbsp; <br />There could be several of these squares drawn at once.</p><p>I have a simple 2d map that will serve as a context map of sorts, and it will have these &quot;buttons&quot; on it representing all of the important areas.</p><p>I&#039;m using data provided to me from a 3rd party and all they give are the TL and BR coords for each area.</p><p>A 2nd 3D map will display the zoomed in version of these selected areas</p>]]></content>
			<author>
				<name><![CDATA[mcb]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1341</uri>
			</author>
			<updated>2021-09-13T15:09:34Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7691#p7691</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: [SOLVED] Drawing a square from top left and bottom right coords?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7688#p7688" />
			<content type="html"><![CDATA[<p>Hello.</p><p>There are many ways to do this for example OnlineMapsDrawingRect + OnlineMaps.GetCorners.<br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsDrawingRect.html">https://infinity-code.com/doxygen/onlin … gRect.html</a><br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMaps.html#acd05d23678cd37919b32b5d91edd9f1c">https://infinity-code.com/doxygen/onlin … d91edd9f1c</a></p><p>The best way depends a lot on what this square is for.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2021-09-11T20:35:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7688#p7688</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[SOLVED] Drawing a square from top left and bottom right coords?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7684#p7684" />
			<content type="html"><![CDATA[<p>I just wanted to see if there was a method I was missing, or maybe if you knew of a good way that I could draw a square on the map based on top left and bottom right coordinates?</p><p>I figured I could try to find the center point between them and draw a square, but then how do I figure out the scale so the square stops are the coordinates?</p><p>or maybe you have a better approach?</p><p>Thanks in advance</p>]]></content>
			<author>
				<name><![CDATA[mcb]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1341</uri>
			</author>
			<updated>2021-09-10T17:53:53Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7684#p7684</id>
		</entry>
</feed>
