# Dynamic TrackShapes Display problem

**URL:** <https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280>\
**Category:** WinForms\
**Created:** [June 7, 2010, 8:30am UTC](https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280 "2010-06-07T08:30:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@Andy](https://community.thinkgeo.com/u/Andy)\
**Post date:** [June 7, 2010, 8:30am UTC](https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280/1 "2010-06-07T08:30:34Z")

</div>

Hi,&nbsp;I've&nbsp;been&nbsp;playing&nbsp;around&nbsp;with&nbsp;the&nbsp;Dynamic&nbsp;TrackShapes&nbsp;application&nbsp;from&nbsp;the&nbsp;code&nbsp;community,&nbsp;to&nbsp;try&nbsp;and&nbsp;modify&nbsp;it&nbsp;to&nbsp;do&nbsp;something&nbsp;a&nbsp;little&nbsp;different&nbsp;than&nbsp;what&nbsp;the&nbsp;original&nbsp;one&nbsp;did.

What&nbsp;I&nbsp;am&nbsp;trying&nbsp;to&nbsp;do&nbsp;is&nbsp;dynamically&nbsp;report&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;last&nbsp;line&nbsp;segment&nbsp;being&nbsp;tracked&nbsp;so&nbsp;the&nbsp;distance&nbsp;between&nbsp;the&nbsp;last&nbsp;vertex&nbsp;actually&nbsp;clicked&nbsp;and&nbsp;the&nbsp;tracking&nbsp;of&nbsp;the&nbsp;mouse&nbsp;point.

The&nbsp;way&nbsp;I&nbsp;try&nbsp;to&nbsp;do&nbsp;this&nbsp;is&nbsp;something&nbsp;like&nbsp;this:

`int idx = (areaBaseShape as PolygonShape).OuterRing.Vertices.Count;Vertex v1 = (areaBaseShape as PolygonShape).OuterRing.Vertices[idx-2];Vertex v2 = e.MovedVertex;            LineShape ls = new LineShape(new Vertex[]{v1,v2});Perimeter = ls.GetLength( winformsMap1.MapUnit, DistanceUnit.Kilometer );`

where&nbsp;areaBaseShape&nbsp;is&nbsp;the&nbsp;shape&nbsp;being&nbsp;tracked

but&nbsp;when&nbsp;tracking&nbsp;around&nbsp;i&nbsp;get&nbsp;very&nbsp;strange&nbsp;numbers,&nbsp;ranging&nbsp;from&nbsp;10&nbsp;to&nbsp;upwards&nbsp;of&nbsp;the&nbsp;thousands&nbsp;by&nbsp;only&nbsp;moving&nbsp;the&nbsp;mouse&nbsp;a&nbsp;small&nbsp;bit.&nbsp;&nbsp;Is&nbsp;there&nbsp;something&nbsp;wrong&nbsp;with&nbsp;the&nbsp;way&nbsp;i&nbsp;am&nbsp;calculating&nbsp;this&nbsp;distance?&nbsp;or&nbsp;is&nbsp;there&nbsp;a&nbsp;better&nbsp;way&nbsp;to&nbsp;accomplish&nbsp;what&nbsp;i&nbsp;am&nbsp;attempting&nbsp;to&nbsp;do?

thanks&nbsp;in&nbsp;advance,

--&nbsp;Andy

---

<div class="post-metadata">

**Author:** ![Andy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@Andy](https://community.thinkgeo.com/u/Andy)\
**Post date:** [June 7, 2010, 2:56pm UTC](https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280/2 "2010-06-07T14:56:24Z")

</div>

I&nbsp;believe&nbsp;i&nbsp;found&nbsp;my&nbsp;problem&nbsp;for&nbsp;the&nbsp;strange&nbsp;numbers.&nbsp;&nbsp;using&nbsp;the&nbsp;e.MovedVertex&nbsp;and&nbsp;the&nbsp;vertex&nbsp;at&nbsp;position&nbsp;-2&nbsp;from&nbsp;the&nbsp;end&nbsp;only&nbsp;gives&nbsp;the&nbsp;distance&nbsp;from&nbsp;where&nbsp;the&nbsp;mouse&nbsp;was&nbsp;to&nbsp;where&nbsp;the&nbsp;mouse&nbsp;moved&nbsp;to.

But&nbsp;i&nbsp;do&nbsp;have&nbsp;another&nbsp;question.&nbsp;

How&nbsp;does&nbsp;the&nbsp;GetPerimeter&nbsp;function&nbsp;actually&nbsp;calculate&nbsp;the&nbsp;perimeter.&nbsp;&nbsp;Because&nbsp;when&nbsp;i&nbsp;have&nbsp;a&nbsp;shape&nbsp;that&nbsp;has&nbsp;only&nbsp;2&nbsp;defined&nbsp;vertices&nbsp;i&nbsp;use&nbsp;the&nbsp;GetPerimeter()&nbsp;on&nbsp;the&nbsp;shape.&nbsp;But&nbsp;if&nbsp;there&nbsp;are&nbsp;3&nbsp;or&nbsp;more&nbsp;vertices&nbsp;I&nbsp;Create&nbsp;a&nbsp;new&nbsp;LineShape&nbsp;with&nbsp;the&nbsp;last&nbsp;clicked&nbsp;vertex&nbsp;and&nbsp;the&nbsp;current&nbsp;mouse&nbsp;point.&nbsp;&nbsp;What&nbsp;is&nbsp;strange&nbsp;is&nbsp;that&nbsp;if&nbsp;I&nbsp;make&nbsp;an&nbsp;initial&nbsp;line&nbsp;that&nbsp;is&nbsp;10,000km&nbsp;long&nbsp;on&nbsp;the&nbsp;example&nbsp;application&nbsp;(&nbsp;ie.&nbsp;only&nbsp;clicked&nbsp;2&nbsp;vertex&nbsp;points).&nbsp;And&nbsp;then&nbsp;if&nbsp;i&nbsp;try&nbsp;to&nbsp;measure&nbsp;my&nbsp;accuracy&nbsp;by&nbsp;calculating&nbsp;the&nbsp;last&nbsp;line&nbsp;segment,&nbsp;by&nbsp;moving&nbsp;my&nbsp;mouse&nbsp;over&nbsp;to&nbsp;the&nbsp;original&nbsp;point,&nbsp;i&nbsp;get&nbsp;a&nbsp;value&nbsp;that&nbsp;is&nbsp;almost&nbsp;exactly&nbsp;half&nbsp;of&nbsp;what&nbsp;my&nbsp;original&nbsp;line&nbsp;was.

Does&nbsp;get&nbsp;perimeter&nbsp;just&nbsp;calculate&nbsp;the&nbsp;distance&nbsp;between&nbsp;all&nbsp;of&nbsp;the&nbsp;vertices&nbsp;in&nbsp;a&nbsp;polygon&nbsp;shape&nbsp;and&nbsp;sum&nbsp;them&nbsp;together?

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [June 7, 2010, 7:36pm UTC](https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280/3 "2010-06-07T19:36:04Z")

</div>

Andy,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;sharing.&nbsp;  
&nbsp;&nbsp;  
&nbsp;For&nbsp;the&nbsp;polygon&nbsp;shape,&nbsp;its&nbsp;calculating&nbsp;perimeter&nbsp;logic&nbsp;is&nbsp;to&nbsp;get&nbsp;all&nbsp;the&nbsp;perimeters&nbsp;of&nbsp;Rings&nbsp;contained&nbsp;in&nbsp;the&nbsp;polygon,&nbsp;including&nbsp;the&nbsp;OutRing&nbsp;and&nbsp;InnnerRings&nbsp;if&nbsp;it&nbsp;has.&nbsp;  
&nbsp;&nbsp;  
&nbsp;For&nbsp;each&nbsp;Ring,&nbsp;as&nbsp;you&nbsp;already&nbsp;thought,&nbsp;just&nbsp;get&nbsp;the&nbsp;distance&nbsp;between&nbsp;all&nbsp;of&nbsp;the&nbsp;vertices&nbsp;and&nbsp;sum&nbsp;them&nbsp;together.&nbsp;While&nbsp;one&nbsp;thing&nbsp;I&nbsp;want&nbsp;to&nbsp;point&nbsp;out&nbsp;is&nbsp;that&nbsp;the&nbsp;distance&nbsp;logic&nbsp;between&nbsp;DecimalDegrees&nbsp;and&nbsp;Meter(or&nbsp;Feet)&nbsp;are&nbsp;quite&nbsp;different,&nbsp;so&nbsp;when&nbsp;you&nbsp;verify&nbsp;the&nbsp;result,&nbsp;just&nbsp;pay&nbsp;some&nbsp;attention&nbsp;to&nbsp;the&nbsp;unit&nbsp;you&nbsp;are&nbsp;using&nbsp;.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![Andy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@Andy](https://community.thinkgeo.com/u/Andy)\
**Post date:** [June 8, 2010, 8:22am UTC](https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280/4 "2010-06-08T08:22:48Z")

</div>

Thanks&nbsp;for&nbsp;the&nbsp;response&nbsp;Yale,&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;That&nbsp;clears&nbsp;things&nbsp;up&nbsp;for&nbsp;me&nbsp;quite&nbsp;well.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [June 8, 2010, 7:33pm UTC](https://community.thinkgeo.com/t/dynamic-trackshapes-display-problem/1280/5 "2010-06-08T19:33:10Z")

</div>

Andy,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;feedback.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;
