MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




deleting shapes

This is a discussion on deleting shapes within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, Using vb5/activexMP2006 In a sub I add a shape based on passed lat and lon parameters. Works fine. private ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 06-25-2008
Junior Member
White Belt
 
Join Date: Jun 2008
Posts: 10
deleting shapes

Hi,

Using vb5/activexMP2006

In a sub I add a shape based on passed lat and lon parameters. Works fine.

private objmap as mappointctl.map
private objloc(1 to 3) as mappointctl.location

sub pasteshape( lat as single, lon as single)

Set objLoc(1) = objmap.getlocation(lat,lon,10)
objmap.shapes.addshape geoShapeOval, objLoc(1), .05
objmap,shapes.item(1).line.forecolor = vbred

end sub

However I am unable to create a sub which will delete this shape as the above subs object references are now out of scope. Does anyone have an alternate method of creating/deleting shapes?

Thanks,
bartj
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 06-26-2008
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 785
Blog Entries: 4
Re: deleting shapes

You need to give the shape a unique name.

Then when you want to delete, it you have to manually search through the shapes until you find the shape with the name you want to delete. Then delete it.


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 06-26-2008
Junior Member
White Belt
 
Join Date: Jun 2008
Posts: 10
Re: deleting shapes

Richard,

Thanks for the suggestion...but how do you add a unique name to an object location?

Thanks,
Bart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 06-27-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: deleting shapes

Hi,

the AddShape method returns a shape object. You can declare a static or global varialbe that holds the object, or an array if you have many. Then you can use Delete method to delete individually.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 07-06-2008
Junior Member
White Belt
 
Join Date: Jun 2008
Posts: 10
Re: deleting shapes

Wilfried,

Finally getting back to this.....am unsure how the AddShape method returns a shape object? I tried:

Public objMapy As MapPointCtl.Map
Public objLocy As MapPointCtl.Location


Sub PlaceShapey(itemnumber As Long, lat As Single, lon As Single, color As Long)
Static z As Object

Set objMapy = frmmap.MappointControl1.ActiveMap
Set objLocy = objMapy.GetLocation(lat, lon, alt)

' draw circle
z = objMapy.Shapes.AddShape(geoShapeOval, objLocy, 0.3, 0.3)

' define shape parameters
objMapy.Shapes.Item(itemnumber).Line.ForeColor = color
objMapy.Shapes.Item(itemnumber).Line.Weight = 4
objMapy.Shapes.Item(itemnumber).Fill.ForeColor = color
objMapy.Shapes.Item(itemnumber).Fill.Visible = True
End Sub

But I get: Object variable not set error. Function works if I remove the "z = ".

Other strange behaviour: If I also use the following delete function:

Sub hideemy(itemnumber As Long)

On Error GoTo eh

objMapy.Shapes.Item(itemnumber).Delete

Exit Sub

eh:

End Sub

All is well if I execute these without adding any other shapes, they work fine. However if I also add some shapes using different references (not objMapy or objLocy) I find that when I call the above placeshape sub, it places a black ring in expected location when adding and does not delete when attempting to do so. I have no "vbblack" anywhere in my code.

Any comments or insights?
Thanks,
Bart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 07-10-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: deleting shapes

Hi Bart,

I think you have to define:
static z as Shape;

For you second question I'm not sure why there is an error generated. Can you check the ItemNumber? Remember that all indexes in Mappoint start at 1 instead of 0.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 07-10-2008
Junior Member
White Belt
 
Join Date: Jun 2008
Posts: 10
Re: deleting shapes

Wilfried,

Thanks for the response. I have solved the "problem". I was initially adding say 99 shapes based on 99 defined locations. If I then added a 100th shape at a 100th location all was fine, but when I attempted to delete the 100th shape the ring would appear. I was using an index of 100 to delete the shape. However I found that if I instead used an index of 1 the ring did not appear. If I then move shape and location 100 to another position(after the shape being deleted) the shape is again shown correctly and again, I need to use index 1 to delete it. I guess the delete is based on a "most recent" basis which is a bit counter intuitive.

Again, thanks for your help and suggestions,
Bart
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/deleting-shapes-7945.html

Posted By For Type Date
Reverse Geocoding, Pt. III - MapPoint Articles - MP2K Magazine This thread Refback 07-02-2008 06:36 AM
The Magazine for MapPoint - MP2K Magazine This thread Refback 07-01-2008 10:14 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Deleting pushpins BobFromBoston MapPoint 2006/2009 Discussion 5 02-20-2008 11:54 AM
Deleting pushpins in bulk brianmcg MapPoint 2006/2009 Discussion 1 06-22-2006 01:08 PM
Deleting all CShape in CShapes discostu MapPoint 2006/2009 Discussion 3 05-17-2005 12:46 PM
Selecting and deleting the push pin Anonymous MapPoint 2006/2009 Discussion 1 02-10-2005 07:01 AM
New map (Deleting) Anonymous MapPoint 2006/2009 Discussion 0 07-21-2004 03:21 AM


All times are GMT -5. The time now is 01:32 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Flights from East Midlands Airport
Book low cost airline flights from East Midlands Airport. Holiday Hypermarket let you search for great deals from top tour operators.

Cruise Travel Agent
Book your cruise with Travel Counsellors. We are an award winning travel agent and can help plan your perfect cruise.

Cheap Holidays to Turkey
If you’re looking for cheap holidays to Turkey then dealchecker.co.uk is the place for you! Our search helps you see real prices from the UK’s top holiday companies all in one go.

Holidays in Dubai
Holidays in Dubai are an eclectic mix of the ancient and the modern. Discover an oasis of luxury amid the Arabian desert. Book here now!

Cheap Cyprus Holidays
Finding cheap Cyprus holidays can be difficult unless you know where to look and where to book. With ulookubook.com you can conduct a simple search to find the latest holiday deals to your particular destination.

Inclusive package holidays
Choose one of the many inclusive package holidays at Travel.co.uk and save a lot of trouble and money too!

Portugal Holidays
We specialise in Portugal holidays. Visit our On The Beach website for more information.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51