Custom location markers MapField will not Center

Hi all

I am facing a problem where the location for my custom MapField (OS 5.0) markers are not perfectly centered on the map. Instead, they always appear in the same place, which is a little lower and more to the right of the Center.

I use the method object of my MapField custom to draw markers.  Can we see what might be the culprit?  Thank you!

protected void paint(Graphics graphics) {
    super.paint(graphics);

    if (vector != null) {
        for (int i = 0; i < vector.size(); i++) {

            LocationsObject loc = (LocationsObject) vector.elementAt(i);

            Coordinates coords = getCoordinates();
            coords.setLatitude(Double.parseDouble(loc.getStrLocationLatitude()));
            coords.setLongitude(Double.parseDouble(loc.getStrLocationLongitude());

            XYPoint point = new XYPoint();
            convertWorldToField(coords, point);

            Bitmap bitmap = Bitmap.getBitmapResource("location_marker.png");

            graphics.drawBitmap(point.x, point.y, bitmap.getWidth(),bitmap.getHeight(), bitmap, 0, 0);

        }
    }
}

I think I know what is happening here. Will do my best to explain.

Assume that your brand image is of size 10 x 10. And the size of your device screen 480 x 360. Now, you want to put the marker in the center of the screen that will be (240 180) in our case. Now, when you call the drawbitmap, you will be probably development of marker (0,0) to (240 160) screen image. Method of painting will start shooting your bitmap of this point.

To center the image of marker perfectly on (240 160), it must be placed on (235 155). Here I subtracted (marker.width/2, marker.height/2) from the center point. In our example, the marker is 10 x 10. So you get (240 160) - (5.5) = (235, 155)

In the code you prob you have to do something like that.

int markerX = point.x - bitmap.getWidth () / 2;
int markerY = point.y - bitmap.getHeight () / 2;
graphics.drawBitmap (markerX, markerY, bitmap.getWidth (), bitmap.getHeight (), bitmap, 0, 0);

I hope that this is the only problem.

Tags: BlackBerry Developers

Similar Questions

  • Photos Office will not be centered or tiled.

    I can't have the JPEG files from a digital camera to my computer to display correctly in the form of wallpaper.  They will not Center or tile and vertical photos stretch in a distorted way.  They see very well in all programs, such as windows and photoshop images.  I right click on desktop, personalize, then destop backgrounds, but photo display options will appear not all photo.  I use the basic theme of Vista on a laptop old of one year of Dell (Inspiron 1721) and using Vista Home premium.

    You should not adjust the resolution of your screen in order to adapt a background image. It's very bad advice. Your resolution on your laptop is on its native resolution (or should be) and it's good resolution for optimal viewing.

    You need to right-click on the desktop and choose personalize.

    Then choose backgrounds.

    Now choose photos

    Now click Browse and navigate to the image you want to use.

    There are three radial buttons below, stretch, tile and Center. Choose whatever you want to use.

    Keep in mind that if you try to stretch a normal screenshot for a widescreen resolution, he could seem horrible.

    I despair at some of the advice given by engineers at Microsoft support responses on this forum! MCDST
    A founding member MCITP - technician Support Enterprise-
    MCTS - Configuration Vista - Charter Member
    MCTS - specialist licenses in Volume, small and medium-sized organizations - Charter Member
    MCITP - Consumer Support Technician
    MCTS - Windows Server 2008, Active Directory Configuration
    MCTS: Windows Server 2008 Network Infrastructure configuration

  • Changing resolution of 7 Media Center "will not stick.

    I use Windows 7 Ultimate connected to a pioneer of 1018 (via HDMI) and then connected to a TV Samsung DLP's (also via HDMI).

    Everything works; However, every time I start media center. Media Center change the resolution (1440 X 900, IIRC).  I then go in "TV settings" and reset the 1920 X 1080 resolution.  Then, all right; I can use 7MC without any problem.  When I leave 7MC, my office will look fine (also set at 1920 X 1080).  However, as soon as I restart 7MC, resolution (inside the library) is recovering at 1440 X 900.  It just doesn't "stick", no matter what I change the resolution to (within 7MC), it will not remain persistent between execution of the program.

    The graphics card is an ATI 4850, running the latest Catalyst drivers.

    If I go to:

    HKLM/SW/Microsoft/Windows/Current Version / Media Center / settings / display settings

    I can see the resolution. I have change the resolution (inside the MC) and then exit the program. When I look in the key (see above), I see the change in resolution (that I just put in) and the correct settings.

    When I then (after closing media library) reboot MC, the resolution changes (inside MC). I immediately see the change of this registry key as well. It's like, when I start Media Center, it goes in and changes automatically of this registry key?

    I made a custom resolution (and tried another stock) in order to ensure; nothing seems to have no effect on her; as soon as I pulled out and re - open MC resolution is changed (from everything I put the last time I was there). Also, I tried "re - run the Installer" in Media Center without success. I am connected to the machine on an account with administrator privileges.

    It's the BEGINNING of Media Center, that changes the resolution (and registry keys). MC output has no effect on the keys (they maintain the correct values).

    Hello

    I spent the last month trying to solve this problem, and "youemailme" (another thread here) had the correct solution for me! And so Simple!

    With me, what worked were 2 things:

    (1) perform the 'clean boot process' as advised by many to determine which granted software was causing the problem... and then.

    (2) right click on the name of the program (as discovered in above) 'problem' in the Start Menu > properties > compatibility.  For some reason, there is an option to "run in 640 x 480 screen resolution", which has been verified.  This program was in the startup folder and the cause of the problem.  Then unchecked the resolution box. No problem.

    In my view, there are a large number of people dealing with this exact problem. I hope that this process of step 2 could solve their problems.

    See you soon

    Stephen

  • My Muse site will not display the customized html images that work in chrome?

    My Muse site will not display the customized html images that work in chrome? Here's my url www.simplesites.com.au.

    Works fine here on Linux.

    Note that the uploads has 'ads' in name and come from simplesites.net.au, so be sure that content blockers not get triggered.

  • DeskJet F2480: 10 Windows upgrade now solution Center will not launch

    Since the upgrade to win 10, the F2480 prints and scans by using the built-in windows scan software. The printer is USB connected. The HP Solution Center software will not start. Uninstalled and reinstalled with software downloaded from AIO_CDB_Net_Full_Win_WW_140_408 - 5.exe HP.

    Is it installed then when check USB it does not find the printer. Device Manager sees and scan OK. Where to go from here. ?

    Hello

    Appears from the description that the full features software is not installed.

    Can you download from this link and try to install again?

    http://support.HP.com/us-en/drivers/selfservice/HP-DeskJet-F2400-all-in-one-series/3811093/model/3811136#Z7_3054ICK0K8UDA0AQC11TA930O2

    Hope that helps.

    Please click the "accept as solution" if it helped to solve your problem and "Bravo Thumbs up" as an encouragement.

  • Trying to get into my email account but the customer service will not recognize me as owner, have no cell phone, have the right password and have used it several times.

    , customer service will not recognize me as owner, have no cell phone, have the rite pass it used several times

    original title: How can I get my email account

    Hello

    Which email service provider?

    If you use hotmail or Windows Live account, you can post your request in the Forum Windows Live for other assistance or contact offer your e-mail service.

    In the Windows Live Forum

  • Windows 7 Media Center will not download the new guide listings

    Hello

    I am really frustrated. WMC will not download the new guide listings and I tried all the patches that are supposed to be that I found in this forum. I also tried the system restore, which did not fix the problem. Obviously the problem is not affected by the restore program.

    I was able to determine that there is some kind of corruption of the WMC files that Windows 7 can not solve (according to the event log).

    I'm a bit exasperated at the tenacity of this problem. Y at - it a reliable fix or I need to reinstall Windows 7?

    Thank you

    Hello Long777,

    You have the update for Windows Media Center installed?

    Click on the article below:
    KB Article ID: 2284742 -October 2010 Cumulative Update for Windows Media Center in Windows 7

    You may be able to force a manual update. Do an update (weekly) to TV Guide through the menu system.

    If this does not help, you might want to ask your specific question to http://.www.thegreenbutton.com \forums

    I hope this helps.

    Thank you

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Netflix will not load up to in Windows Media Center more.

    I've had Netflix service for about two months now. Up to two days, I was able to stream movies through Netflix and Windows Media Center option. Now it will not load anything. It will allow me to connect to Netflix, but I can't get something and my instant queue will not charge.

    I get a message stating:

    NO INTERNET CONNECTION:

    The internet connection has been lost. Make sure that your computer is connected to the internet, and then try again.

    Problem is that I'm connected to the internet. (If I was not logged in, they would not connect to Netflix in the first place.)

    I had even gone to the Media Center General settings to test the internet connection and it says that the internet actually works.

    What is going on? I missed something?

    KC

    You can try a system restore on the eve of the update has been installed and see if
    the problem is resolved. Nothing in the update that fell from Netflix,
    but you can certainly try a restore. A restore is a good troubleshooting step
    for beginners.
     
    The game, November 4, 2010 23:28:10 + 0000, KEC86 wrote:
     
    >
    >
    > I can spread through my web browser, but I would like to know why all of the sudden I can't disseminate via the Media Center. I would like to know what happened and how to fix it. I also appreciate the link provided, but I tried why they suggested, and it did not work. I noticed that there is an update for the Media Center a few days ago. Could this be very probably why Netflix doesn't work anymore?
    >
    >
     

    Barb Bowman

    http://www.digitalmediaphile.com

  • Windows Media Center/player or my Acer arcade deluxe will not play DVDs

    Original title: WINDOWS MEDIA CENTER/PLAYER or MY ACER ARCADE DELUXE WILL NOT PLAY DVD CANT GET IT to PLAY anything for NOW

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem
    you're not giving us enough information. When did it stop working? If it worked
    previously, I would recommend first trying to run Windows Media Player AND Windows
    Media Center, and then again. Control Panel, programs and features, tour
    Windows feature turn on or off. Uncheck the two programs, restart. Go back and turn them
    both on reboot. This solve your problem? Otherwise, you should try a system
    Restore to a point where everything worked normally, maybe early August? By
    wait, you have only made it more difficult to triage and solve your problem.
     
    On kills, 21 Sep 2010 21:47:03 + 0000, LEEGYPO wrote:
     
    > Sorry took so long to reply, but still in the same boat so im using windows 7 when I bought the computer (acer), it came with windows media player and acer arcade deluxw (what music parts but usually rip songs for me) that now only acer arcade works but media player that is customary there, she moves for a fraction of a second , but usually begin!
     

    Barb Bowman

    http://www.digitalmediaphile.com

  • MSN will not turn on it just says: upgrading, but the upgrade entirely custom install it... GETS about 58% then freezes

    MSN will not turn on it just says: upgrading, but the upgrade entirely custom install it... GETS about 58% then freezes

    Quote your full version of Windows (for example, WinXP SP3;) Vista 64 - bit SP2; Win7 RC. Win7) when you post in a forum or a newsgroup. Please do it in your next reply.

    Your problem has nothing to do with the Windows Update feature. Contact MSN Support. ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • XP SP3 Security Center will not suddenly Norton Internet Security recognize?

    Windows XP SP3 Security Center won't recognize all of a sudden of Norton Internet Security. It has been fine for years. I don't have a virus.

    How to fix problem?

    Hi Chris,

    Thanks for posting your question in the Microsoft Community forum. I understand that XP SP3 Security Center will not recognize Norton Internet Security. I would like to help solve you the problem.

    This problem may occur if there is an inconsistency in the system files or folders associated with XP Security Center. Follow these methods:

    Method 1.

    Disable the firewall and check if that helps.

    How can I turn on or turn off the firewall in Windows XP Service Pack 2 or later versions? : http://support.microsoft.com/kb/283673

    Note: you should not disable Windows Firewall, unless you have another firewall is activated. Turning off Windows Firewall may make your computer (and your network, if you have one) more vulnerable to damage caused by worms or hackers.

    Method 2.

    Rename the storage folder.

    1 - Go to control panel, and then open administrative tools.

    2 - click on Services.

    3-go down to Windows Management Instrumentation and stop this service.

    4. stop the Security Center service.

    5-exit and close all windows.

    6. right click on start and select explore.

    7. go down to C:\windows or Winnt\system32\wbem\repository.

    8 remove only the storage folder

    9-go Back To Services and restart the WMI and the Security Center service.

    10. close all windows and restart the computer.

    Let us know if you need assistance with any windows problem. We will be happy to help you.

  • Windows media center picture library is corrupted with thousands of photos? They will not delete

    Windows media center picture library is corrupted with thousands of photos? They will not delete what I can do?

    Windows media center picture library is corrupted with thousands of photos? They will not delete what I can do?

    WMC uses the same library of WMP. If you need to restore library WMP to solve the problem.

    Can not delete the songs from Windows Media Player

    Very same thing applies for photos too. Just follow the step by step procedures.

  • Cannot complete installation of Live TV. Media Center will not identify Directv remote. Is there a solution?

    I have a Dell PC with Vista Home Premium.  Until recently, when the operating system had to be reloaded, I watched decoder of live TV on Media Center for the past two years, using a Directv.  I have tried to re install the TV, but cannot complete the process, as my Directv remotes are not recognized.  The signal is fine (as of the previous steps shows the appropriate image and the signal, but the installation process cannot be performed due to the problem of distance not recognized. (The remote functions of the Directv box very well). How can I find use of the tv, Setup finish signal?

    Hello

    You won't get HDTV without a Digital Cable Ready tuner and a cable card. How about you
    will have need a HDCP compatible graphics card and a TV/monitor taking support this
    as well.
    The kit Hauppage offers is substantially the same as I told you.

    clear QAM availability varies according to the cable company. most begin to encrypt
    everything.

    > The same can be done through Windows Media Center, by clicking the video image by clicking on Zoom. But in MCE when you have a cable box, you will also need an approved Microsoft IR blaster to control the cable box. If you n? not have this part, you will get the IR hardware not found error. The HVR - 950 Q does not come with this, but if you really want to use Media Center, you can buy a kit from our online store here http://store.hauppauge.com/hardware2.asp?product=mce_remote remote"

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-pictures/Media-Center-cant-detect-dvrset-top-box-but-finds/43a9685d-d093-4cfa-88ac-17132a1e5b53

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-pictures/cannot-complete-Windows-Media-Center-Setup-IR/6db1ada7-3380-44a2-A369-268e5cd7c013

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-pictures/cannot-complete-Windows-Media-Center-Setup-IR/6db1ada7-3380-44a2-A369-268e5cd7c013

    http://Windows.Microsoft.com/VI-VN/Windows-Vista/troubleshoot-problems-with-watching-TV-on-your-computer

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-pictures/Media-Center-will-not-set-up-TV-because-Windows/5c038734-7bb6-48D4-AAC9-f4dee9a3d442

  • PowerPoint will not recognize my productkey reference located on the lower part of the Pc - ideas, please

    PowerPoint will not recognize my productkey reference located on the lower part of the Pc - ideas, please

    Hello

    Office, which belongs to PowerPoint is not included with your purchase of computer for free.

    Most new computers come with a trial version of Office that lets 'x' number of days usuage.

    After this test times out, you will have to buy Office.

    And the product key on the computer case or laptop for the operating system, not for the desktop Suite.

    Here is the link for the Microsoft Store to Office products:

    http://www.microsoftstore.com/store/msstore/HTML/pbPage.Office_Category_Page?ICID=Home_4up_1_OfficeCatPage

    And you might be interested in the free Open Office Suite of Office Applications.

    http://www.OpenOffice.org/

    For any other question about Office, please repost in the Office Forums:

    http://answers.Microsoft.com/en-us/Office

    See you soon.

  • Window Media Center will not configure my Xbox says that there is an error in moan by train

    Window Media Center will not configure my Xbox says that there is an error in moan by train

    Hello

    What is you get the exact error message?

    Please follow the steps mentioned in the links below.

    Set up a Windows Media Center Extender device

    http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-a-Windows-Media-Center-Extender-device

    You tried to set up your console Xbox 360 as a Media Center Extender, but the installer is not started

    http://support.Microsoft.com/kb/916180

    http://support.Xbox.com/en-us/Xbox-360/audio-video-Setup-and-use/Windows-Media-Center

    http://support.Xbox.com/en-us/Xbox-360/audio-video-Setup-and-use/Media-Center-FAQ

Maybe you are looking for