Hi everyone,

Looks like nobody has had any experience of this, so I've searched
elsewhere and found the answer.

The key to this problem is that I was looking at it in terms of
points.  If you change the way that you are looking at the problem to
be in terms of segments, it becomes A LOT easier.  All you need to do
is identify all of the segments in all of the different shapes, and
remove the duplicates.  Then, you can work your way through the
segment list drawing each of the lines in turn, finding the next
segment that hasn't been drawn which starts at the end co-ordinates
for the last segment.

Therefore, the order of processing is:
1)  Load co-ordinates
2)  Create segments
3)  Merge segment lists
4)  Remove duplicate segments
5)  Draw first segment
6)  Find first undrawn segment which starts at the point that the last
segment finished
Repeat 6 until all segments drawn.

This algorithm works for shapes which do not overlap (if they do over
lap, the code is quite a bit more complex) and align exactly onto each
other.  It also needs a bit of adapting if there are multiple areas
that are completely separate in the shapes that you want to combine ,
but that's not that difficult.

Cheers


On Sep 2, 9:55 am, Ian Drake <nogroupspamfo...@gmail.com> wrote:
> I have a set of data which haas co-ordinates for different geographic
> areas (e.g.counties).  This data takes the form:
>
> County:   Shropshire         Shropshire
> Point #:     1                          2
> X:              43.5                    43.5
> Y:             5.6                      5.65
>
> And so on.....
>
> I have written a program that draws thecounties, so I have a nice
> little map of the UK that I can colour based on different attributes
> (e.g. the weather).
>
> What I now want to do is figure out a way of combining thecounties
> together in an arbitrary way so that they can be coloured together.  I
> can see two different ways of doing this:
>
> 1)  Just group them
>
> The problem with this is that there will then be lines through the
> middle of the shape where thecountiesmeet.  I don't want these
> lines, and it is this that is causing the issue.
>
> 2)  Put all of the co-ordinates together and remove those that are
> duplicated prior to drawing.
>
> What I don't understand is how to go about doing this.  It would be
> very simple to do if it was as easy as deleting duplicates, but the
> ordering of the points is really important so I can't just UNION the
> vector arrays and delete those that appear in there twice (and
> actually the corner nodes will need one of them to be kept, it's just
> the interior vectors that need deleting).
>
> Does anyone have an example of something they have done in the past
> they can share.  I'm usingExcelVBA.
>
> Thanks

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to