MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Pushpin symbol from in memory Bitmap

This is a discussion on Pushpin symbol from in memory Bitmap within the Development forums, part of the MapPoint 2006/2009 Discussion category; How do I set a custom pushpin symbol from a in memory Bitmap image? I know that I can load ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-17-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 3
Pushpin symbol from in memory Bitmap

How do I set a custom pushpin symbol from a in memory Bitmap image?
I know that I can load an image like this:

Code:
Symbol muSymbol = m_MapApp.ActiveMap.Symbols.Add("c:\myImage.bmp");
pin.Symbol = muSymbol.ID;
But is there a way to set the symbol from an bitmap image in the compiled resources? or is there a way to add a bitmap directly like:

Code:
Bitmap myBitmap = new Bitmap("c:\myImage.bmp");
Symbol muSymbol = m_MapApp.ActiveMap.Symbols.Add(myBitmap);
pin.Symbol = muSymbol.ID;
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 03-17-2008
lfdmike's Avatar
Member
Green Belt
 
Join Date: May 2004
Posts: 54
Blog Entries: 7
Re: Pushpin symbol from in memory Bitmap

You may be able to use a memory stream to do this.
__________________
Mike Mueller
Lannon Fire Department
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 03-17-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 3
Re: Pushpin symbol from in memory Bitmap

Do you have any example code when a memory stream is used?

Thanks!
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 03-18-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Pushpin symbol from in memory Bitmap

Hi,

I think it has to be a disk file. Eventually you can speed up using a ram disk.
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 03-19-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 3
Re: Pushpin symbol from in memory Bitmap

So there is no way to compile the image into the projects resources and then fetch it from there into my mappoint object???
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 03-19-2008
lfdmike's Avatar
Member
Green Belt
 
Join Date: May 2004
Posts: 54
Blog Entries: 7
Re: Pushpin symbol from in memory Bitmap

Quote:
Originally Posted by hanneslarsson View Post
Do you have any example code when a memory stream is used?
Unfortunately I do not, I have not done any mapplications that have needed it. Memory Streams are an I/O Class, and can be used for the moving of images to/from databases, and I use them for websites. You may want to look at it over at MSDN

Code:
Bitmap myBitmap = new Bitmap("c:\myImage.bmp");
MemoryStream myStream = new MemoryStream();
myBitmap.Save(myStream, ImageFormat.bmp);
is all good code. now you just need to get that into your symbol variable
__________________
Mike Mueller
Lannon Fire Department
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 03-19-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Pushpin symbol from in memory Bitmap

Hi,

Maybe create a mapped file ? This is a file resident in memory. Normally windows API has same functions for all types of IO, so possible it works with mappoint as well. See http://msdn2.microsoft.com/en-us/lib...51(VS.85).aspx for some example.

On the other hand I think it is much more simple to keep all bitmaps in resource of your application, save them to a real file, import in mappoint, and "I think" you can delete them afterwards (not sure).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 03-20-2008
DNJ DNJ is offline
Junior Member
White Belt
 
Join Date: Jun 2007
Posts: 2
Re: Pushpin symbol from in memory Bitmap

Did this just yesterday.
My problem was that my bitmap was a 32 bit image (Bitmap bm) and the pushpins have to be 24 bit or smaller. I am tracking trailers, hence the notation of TrailerName. You use your own names, of course.

So, that is the code that I have here ....

Bitmapbitdump = newBitmap(bm.Width, bm.Height, PixelFormat.Format24bppRgb);
for (intx = 0; x < bm.Width; x++)
{
for (inty = 0; y < bm.Height; y++)
{
Colorc = bm.GetPixel(x, y);
bitdump.SetPixel(x, y, Color.FromArgb(c.R, c.G, c.B));
}
}
Stringpath = objMap.Parent.DefaultFilePath;
bitdump.Save(path + "/" + TrailerName + ".bmp", ImageFormat.Bmp);
MapPoint.Symbolsym = objMap.Symbols.Add(TrailerName + ".bmp");
MapPoint.Locationloc = objMap.GetLocation(Latitude, Longitude, 0);
MapPoint.Pushpinpin = objMap.AddPushpin(loc, TrailerName);
pin.Symbol = sym.ID;

I create a new 24 bit bitmap and do the easy and long way to copy the bits from the source bitmap to my target. There may be a better way but I wanted to get the show going and didn't feel like reading and researching for something else.

Anyway, having built the new bitmap, I found that it had to be saved in the MapPoint folder structure. That is the need for the path variable.

Save the bitmap and re-read it into a symbol.

Assign the symbol to the pushpin

Dennis
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

Tags
bitmap, memory, pushpin, symbol


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/pushpin-symbol-memory-bitmap-7311.html

Posted By For Type Date
Snap to a Road - MapPoint Articles - MP2K Magazine This thread Refback 03-17-2008 11:51 AM

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
[HELP] How to extract symbol bitmap from mappoint phrozzy MapPoint 2006/2009 Discussion 0 06-21-2006 04:35 AM
[C#] MappointControl - Pushpin symbol suamikim MapPoint 2006/2009 Discussion 4 11-23-2005 03:02 AM
Return Pushpin Symbol Anonymous MapPoint 2006/2009 Discussion 1 04-27-2005 03:12 PM
set pushpin symbol starbuck MapPoint 2006/2009 Discussion 3 10-19-2003 04:27 PM
Is there a way to use a different pushpin symbol w.... Anonymous MapPoint 2006/2009 Discussion 1 08-01-2001 08:59 AM


All times are GMT -5. The time now is 11:19 PM.


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


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 52 53 54