Package net.rim.device.api.ui

Examples of net.rim.device.api.ui.XYPoint


     */
    private void determineSiteColors() {
        final Vector highlightCandidates = new Vector(); // Stores the sites
                                                         // that the cursor
                                                         // touches.
        final XYPoint convertedHighlightArea[] = new XYPoint[4];

        // Cursor coordinates , obtained by dividing preferred width and height
        // by 2.
        final int cursorX = getPreferredWidth() >> 1;
        final int cursorY = getPreferredHeight() >> 1;

        // See comments below.
        int above, below, right, left;

        for (int count = 0; count < _allSites.size(); count++) {
            final Coordinates[] highlightableArea =
                    ((MapFieldDemoSite) _allSites.elementAt(count))
                            .getHighlightableArea();

            /*
             * The following algorithm dictates that for a site to be deemed
             * highlightable, the cursor must be at least over one point, under
             * one point, to the left of one point and to the right of one point
             */

            above = below = right = left = 0;
            for (int side = 0; side < 4; side++) {
                convertedHighlightArea[side] = new XYPoint();
                convertWorldToField(highlightableArea[side],
                        convertedHighlightArea[side]);

                if (convertedHighlightArea[side].x > cursorX) {
                    right++;
View Full Code Here


            final int[] xPts = new int[_numberOfPoints];
            final int[] yPts = new int[_numberOfPoints];

            // Converts the world coordinates of the map shape into pixels.
            for (int count = 0; count < _numberOfPoints; count++) {
                point[count] = new XYPoint();
                _map.convertWorldToField(_shape[count], point[count]);
            }

            // For use in 'drawFilledPath' below.
            for (int count = 0; count < _numberOfPoints; count++) {
                xPts[count] = point[count].x;
                yPts[count] = point[count].y;
            }

            g.setColor(_color);
            g.drawFilledPath(xPts, yPts, null, null);

            // Will only attempt to display site number if the zoom is 0 or 1.
            if (_map.getZoom() == 0) {
                // Display site number if available.
                if (_siteNumberPlacement != null) {
                    g.setColor(Color.WHITE);

                    final XYPoint relativePlacement = new XYPoint();
                    _map.convertWorldToField(_siteNumberPlacement,
                            relativePlacement);
                    g.drawText("" + _siteNumber, relativePlacement.x,
                            relativePlacement.y);
                }
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.XYPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.